diff --git a/CHANGELOG.md b/CHANGELOG.md index a7fb8992..6e981c15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.9.2 + +_5 nov 2024_ + +- Fixed Element related tests +- Bumped renderer to version 2.6.0 + ## v1.9.1 _4 nov 2024_ diff --git a/package-lock.json b/package-lock.json index a64812bf..ad526e5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "@lightningjs/blits", - "version": "1.9.1", + "version": "1.9.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lightningjs/blits", - "version": "1.9.1", + "version": "1.9.2", "license": "Apache-2.0", "dependencies": { "@lightningjs/msdf-generator": "^1.1.0", - "@lightningjs/renderer": "^2.5.1" + "@lightningjs/renderer": "^2.6.0" }, "bin": { "blits": "bin/index.js" @@ -787,9 +787,9 @@ } }, "node_modules/@lightningjs/renderer": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@lightningjs/renderer/-/renderer-2.5.1.tgz", - "integrity": "sha512-zCnuMUBQG4BekEvXcutgPb9zZu2dxYX/hcNIE9ZGMC6Usm+p2FPSyhB3W8QqKHS64pP1hhWTcfoEO1rPKdK43Q==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@lightningjs/renderer/-/renderer-2.6.0.tgz", + "integrity": "sha512-JDIeDLKN3tA1LGZgZovcbrL8I9sSvQotFROALVq1OXtSYM9FECkVi7dQMeyQ2s/tjZ74QDh6UPS9blgVsCq0Sw==", "hasInstallScript": true, "engines": { "node": ">= 20.9.0", diff --git a/package.json b/package.json index a3947641..f6bffd13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lightningjs/blits", - "version": "1.9.1", + "version": "1.9.2", "description": "Blits: The Lightning 3 App Development Framework", "bin": "bin/index.js", "exports": { @@ -9,7 +9,8 @@ "./transitions": "./src/router/transitions/index.js", "./precompiler": "./src/lib/precompiler/precompiler.js", "./plugins": "./src/plugins/index.js", - "./symbols": "./src/lib/symbols.js" + "./symbols": "./src/lib/symbols.js", + "./blitsFileConverter": "./src/lib/blitsfileconverter/blitsfileconverter.js" }, "scripts": { "test": "c8 npm run test:run", @@ -49,7 +50,7 @@ }, "dependencies": { "@lightningjs/msdf-generator": "^1.1.0", - "@lightningjs/renderer": "^2.5.1" + "@lightningjs/renderer": "^2.6.0" }, "repository": { "type": "git", diff --git a/packages/create-blits/boilerplate/js/default/blits.d.ts b/packages/create-blits/boilerplate/js/default/blits.d.ts new file mode 100644 index 00000000..c19c1261 --- /dev/null +++ b/packages/create-blits/boilerplate/js/default/blits.d.ts @@ -0,0 +1,5 @@ +// required for suppressing vscode typescript errors when importing .blits files in JS/TS files +declare module '*.blits' { + const value: any; + export default value; +} diff --git a/packages/create-blits/boilerplate/ts/default/blits.d.ts b/packages/create-blits/boilerplate/ts/default/blits.d.ts new file mode 100644 index 00000000..c19c1261 --- /dev/null +++ b/packages/create-blits/boilerplate/ts/default/blits.d.ts @@ -0,0 +1,5 @@ +// required for suppressing vscode typescript errors when importing .blits files in JS/TS files +declare module '*.blits' { + const value: any; + export default value; +} diff --git a/src/engines/L3/element.test.js b/src/engines/L3/element.test.js index d3fabb69..f1a5e73e 100644 --- a/src/engines/L3/element.test.js +++ b/src/engines/L3/element.test.js @@ -101,7 +101,7 @@ test('Element - Set `w` property', (assert) => { assert.equal(el.node['width'], 100, 'Node width parameter should be set') assert.equal(el.props.props['width'], 100, 'Props width parameter should be set') - assert.equal(el.props.raw.get('w'), 100, "Props' raw map entry should be added") + assert.equal(el.props.raw['w'], 100, "Props' raw map entry should be added") assert.end() }) @@ -116,7 +116,7 @@ test('Element - Set `mount` property', (assert) => { assert.equal(el.node['mountY'], 20, 'Node mountY parameter should be set') assert.equal(el.props.props['mountX'], 10, 'Props mountX parameter should be set') assert.equal(el.props.props['mountY'], 20, 'Props mountY parameter should be set') - assert.equal(el.props.raw.get('mount'), value, "Props' raw map entry should be added") + assert.equal(el.props.raw['mount'], value, "Props' raw map entry should be added") assert.end() }) @@ -128,7 +128,7 @@ test('Element - Set `color` property', (assert) => { assert.equal(el.node['color'], '0xf0ffffff', 'Node color parameter should be set') assert.equal(el.props.props['color'], '0xf0ffffff', 'Props color parameter should be set') - assert.equal(el.props.raw.get('color'), 'azure', "Props' raw map entry should be added") + assert.equal(el.props.raw['color'], 'azure', "Props' raw map entry should be added") assert.end() }) @@ -141,7 +141,7 @@ test('Element - Set `src` property', (assert) => { assert.equal(el.node['src'], value, 'Node src parameter should be set') assert.equal(el.props.props['src'], value, 'Props src parameter should be set') - assert.equal(el.props.raw.get('src'), value, "Props' raw map entry should be added") + assert.equal(el.props.raw['src'], value, "Props' raw map entry should be added") assert.equal(el.props.props['color'], 0xffffffff, 'Props default color parameter should be set') assert.end() }) @@ -154,7 +154,7 @@ test('Element - Set `texture` property', (assert) => { assert.equal(el.node['texture'], 'foo', 'Node texture parameter should be set') assert.equal(el.props.props['texture'], 'foo', 'Props texture parameter should be set') - assert.equal(el.props.raw.get('texture'), 'foo', "Props' raw map entry should be added") + assert.equal(el.props.raw['texture'], 'foo', "Props' raw map entry should be added") assert.equal(el.props.props['color'], 0xffffffff, 'Props default color parameter should be set') assert.end() }) @@ -181,7 +181,7 @@ test('Element - Set `fit` property with a string type value', (assert) => { fitVal, 'Props textureOptions parameter should be set' ) - assert.equal(el.props.raw.get('fit'), fitVal, "Props' raw map entry should be added") + assert.equal(el.props.raw['fit'], fitVal, "Props' raw map entry should be added") assert.end() }) @@ -212,7 +212,7 @@ test('Element - Set `fit` property with an object type value', (assert) => { 1, 'Node resizeMode "clipY" parameter should be set to correct value' ) - assert.equal(el.props.raw.get('fit'), fitVal, "Props' raw map entry should be added") + assert.equal(el.props.raw['fit'], fitVal, "Props' raw map entry should be added") assert.end() }) @@ -243,7 +243,7 @@ test('Element - Set `fit` property with position key as a string type value', (a 1, 'Node resizeMode "clipY" parameter should be set to correct value' ) - assert.equal(el.props.raw.get('fit'), fitVal, "Props' raw map entry should be added") + assert.equal(el.props.raw['fit'], fitVal, "Props' raw map entry should be added") assert.end() }) diff --git a/src/lib/blitsfileconverter/blitsfileconverter.js b/src/lib/blitsfileconverter/blitsfileconverter.js new file mode 100644 index 00000000..a6e8b222 --- /dev/null +++ b/src/lib/blitsfileconverter/blitsfileconverter.js @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Comcast Cable Communications Management, LLC + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export default (source) => { + const { template, script } = parseBlitsFile(source) + return injectTemplate(script, template) +} + +const parseBlitsFile = (source) => { + const templateMatch = source.match(/