Skip to content

Commit

Permalink
Merge pull request #282 from lightning-js/dev
Browse files Browse the repository at this point in the history
Release 1.19.1
  • Loading branch information
michielvandergeest authored Feb 3, 2025
2 parents 18ef18a + 6f58521 commit 4647036
Show file tree
Hide file tree
Showing 7 changed files with 629 additions and 29 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## v1.19.1

_3 feb 2025_

- Removed left-over console.log
- Upgraded to renderer v2.11.1
- Fixed issues with wrongly pre-compiling `template` key of non-blits related objects

## v1.19.0

_31 jan 2025_
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightningjs/blits",
"version": "1.19.0",
"version": "1.19.1",
"description": "Blits: The Lightning 3 App Development Framework",
"bin": "bin/index.js",
"exports": {
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"dependencies": {
"@lightningjs/msdf-generator": "^1.1.1",
"@lightningjs/renderer": "^2.10.0"
"@lightningjs/renderer": "^2.11.1"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/engines/L3/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ const propsTransformer = {
}
},
set alpha(v) {
if(this.raw['show'] === undefined || this.raw['show'] === true) {
if (this.raw['show'] === undefined || this.raw['show'] === true) {
this.props['alpha'] = v
}
},
Expand Down
2 changes: 0 additions & 2 deletions src/engines/L3/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ const textRenderEngines = (settings) => {
}

export default (App, target, settings = {}) => {
console.log(RENDER_QUALITIES[settings.renderQuality] || settings.renderQuality || 1)

renderer = new RendererMain(
{
appWidth: settings.w || 1920,
Expand Down
43 changes: 24 additions & 19 deletions src/lib/precompiler/precompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,37 @@ export default (source, filePath) => {

for (const template of templates) {
if (template[2]) {
const templateStartIndex = template.index + offset
const templateEndIndex = templateStartIndex + template[0].length
const templateContent = template[2]

// Parse the template
let resourceName = 'Blits.Application'
if (source.indexOf('Blits.Component(') > -1) {
resourceName = source.match(/Blits\.Component\(['"](.*)['"]\s*,/)[1]
}
// Only process if it looks like a Blits template
if (templateContent.match(/^\s*(<!--[\s\S]*?-->|<[A-Za-z][^>]*>)/s)) {
const templateStartIndex = template.index + offset
const templateEndIndex = templateStartIndex + template[0].length


const parsed = parser(templateContent, resourceName, null, filePath)
// Parse the template
let resourceName = 'Blits.Application'
if (source.indexOf('Blits.Component(') > -1) {
resourceName = source.match(/Blits\.Component\(['"](.*)['"]\s*,/)[1]
}

// Generate the code
const code = generator.call({ components: {} }, parsed)
const parsed = parser(templateContent, resourceName, null, filePath)

// Insert the code in the component using the 'code' key, replacing the template key
const replacement = `/* eslint-disable no-unused-vars */ \ncode: { render: ${code.render.toString()}, effects: [${code.effects.map(
(fn) => fn.toString()
)}], context: {}}`
// Generate the code
const code = generator.call({ components: {} }, parsed)

offset += replacement.length - template[0].length
// Insert the code in the component using the 'code' key, replacing the template key
const replacement = `/* eslint-disable no-unused-vars */ \ncode: { render: ${code.render.toString()}, effects: [${code.effects.map(
(fn) => fn.toString()
)}], context: {}}`

newSource =
newSource.substring(0, templateStartIndex) +
replacement +
newSource.substring(templateEndIndex)
offset += replacement.length - template[0].length

newSource =
newSource.substring(0, templateStartIndex) +
replacement +
newSource.substring(templateEndIndex)
}
}
}
return newSource
Expand Down
Loading

0 comments on commit 4647036

Please sign in to comment.