@lightningjs/blits 0.6.9 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/bin/helpers.js +220 -0
- package/bin/index.js +141 -0
- package/boilerplate/common/eslint/husky/pre-commit +2 -0
- package/boilerplate/common/eslint/package.json +20 -0
- package/boilerplate/common/ide/.vscode/settings.json +10 -0
- package/boilerplate/js/default/.gitattributes +3 -0
- package/boilerplate/{package.json → js/default/package.json} +3 -3
- package/docs/getting_started.md +7 -7
- package/package.json +13 -5
- package/public/assets/fps_sprite.base64.js +1 -0
- package/public/assets/fps_sprite.png +0 -0
- package/scripts/postpublish.js +59 -0
- package/scripts/prepublishOnly.js +84 -0
- package/src/components/Circle.js +32 -3
- package/src/components/Circle.orig.js +31 -0
- package/src/components/FPScounter.js +1127 -0
- package/src/components/FPScounter.orig.js +122 -0
- package/src/components/Image.js +23 -2
- package/src/components/Image.orig.js +33 -0
- package/src/components/RouterView.js +22 -3
- package/src/components/RouterView.orig.js +51 -0
- package/src/components/Sprite.js +26 -3
- package/src/components/Sprite.orig.js +58 -0
- package/src/components/Text.js +56 -20
- package/src/components/Text.orig.js +79 -0
- package/src/launch.d.ts +10 -1
- package/src/launch.js +1 -0
- package/src/lib/precompiler/precompiler.js +64 -0
- package/src/lib/setup/base.js +2 -0
- package/vite/index.js +17 -0
- package/vite/preCompiler.js +19 -39
- package/bin/index.cjs +0 -25
- package/boilerplate/.vscode/settings.json +0 -10
- /package/boilerplate/{.editorconfig → common/eslint/.editorconfig} +0 -0
- /package/boilerplate/{.eslintignore → common/eslint/.eslintignore} +0 -0
- /package/boilerplate/{.eslintrc.cjs → common/eslint/.eslintrc.cjs} +0 -0
- /package/boilerplate/{.vscode → common/ide/.vscode}/extensions.json +0 -0
- /package/boilerplate/{.vscode → common/ide/.vscode}/launch.json +0 -0
- /package/boilerplate/{public → common/public}/assets/logo.png +0 -0
- /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.json +0 -0
- /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.png +0 -0
- /package/boilerplate/{public → common/public}/fonts/OpenSans-Medium.ttf +0 -0
- /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.json +0 -0
- /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.png +0 -0
- /package/boilerplate/{index.html → js/default/index.html} +0 -0
- /package/boilerplate/{src → js/default/src}/App.js +0 -0
- /package/boilerplate/{src → js/default/src}/components/Loader.js +0 -0
- /package/boilerplate/{src → js/default/src}/fontloader.js +0 -0
- /package/boilerplate/{src → js/default/src}/index.js +0 -0
- /package/boilerplate/{src → js/default/src}/pages/Home.js +0 -0
- /package/boilerplate/{src → js/default/src}/renderer.js +0 -0
- /package/boilerplate/{vite.config.js → js/default/vite.config.js} +0 -0
package/vite/preCompiler.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import compiler from '../src/lib/precompiler/precompiler.js'
|
|
4
19
|
|
|
5
20
|
export default function () {
|
|
6
21
|
let config
|
|
@@ -11,42 +26,7 @@ export default function () {
|
|
|
11
26
|
},
|
|
12
27
|
transform(source, filePath) {
|
|
13
28
|
if (config.blits && config.blits.precompile === false) return source
|
|
14
|
-
|
|
15
|
-
// get the start of the template key in de component configuration object
|
|
16
|
-
const templateKeyRegex = /template:\s*([`"'])*/g
|
|
17
|
-
const templateStartResult = templateKeyRegex.exec(source)
|
|
18
|
-
const typeOfQuotesUsed = templateStartResult[1]
|
|
19
|
-
const templateStartIndex = templateStartResult.index
|
|
20
|
-
|
|
21
|
-
// get the template contents from the configuration object
|
|
22
|
-
const templateContentsRegex = new RegExp(
|
|
23
|
-
`${typeOfQuotesUsed}([\\s\\S]*?)${typeOfQuotesUsed}`
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const templateContentResult = templateContentsRegex.exec(source.slice(templateStartIndex))
|
|
27
|
-
const templateEndIndex =
|
|
28
|
-
templateStartIndex + templateContentResult.index + templateContentResult[0].length
|
|
29
|
-
|
|
30
|
-
// Parse the template
|
|
31
|
-
let resourceName = 'Blits.Application'
|
|
32
|
-
if (source.indexOf('Blits.Component(') > -1) {
|
|
33
|
-
resourceName = source.match(/Blits\.Component\(['"](.*)['"]\s*,/)[1]
|
|
34
|
-
}
|
|
35
|
-
const componentPath = path.relative(process.cwd(), filePath)
|
|
36
|
-
const parsed = parser(templateContentResult[1], resourceName, null, componentPath)
|
|
37
|
-
|
|
38
|
-
// Generate the code
|
|
39
|
-
const code = generator.call({ components: {} }, parsed)
|
|
40
|
-
|
|
41
|
-
// Insert the code in the component using the 'code' key, replacing the template key
|
|
42
|
-
const replacement = `code: { render: ${code.render.toString()}, effects: [${code.effects.map(
|
|
43
|
-
(fn) => fn.toString() + ','
|
|
44
|
-
)}], context: {}}`
|
|
45
|
-
const newSource =
|
|
46
|
-
source.substring(0, templateStartIndex) + replacement + source.substring(templateEndIndex)
|
|
47
|
-
|
|
48
|
-
return newSource
|
|
49
|
-
}
|
|
29
|
+
return compiler(source, filePath)
|
|
50
30
|
},
|
|
51
31
|
}
|
|
52
32
|
}
|
package/bin/index.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path')
|
|
4
|
-
const fs = require('fs')
|
|
5
|
-
|
|
6
|
-
const folder = process.argv.slice(2).pop()
|
|
7
|
-
|
|
8
|
-
if (!folder) {
|
|
9
|
-
console.error('Please specify a folder for your new Lightning 3 App')
|
|
10
|
-
} else {
|
|
11
|
-
if (fs.existsSync(folder)) {
|
|
12
|
-
console.error(`The directory ${folder} already exists! Choose a different location.`)
|
|
13
|
-
} else {
|
|
14
|
-
fs.cpSync(path.join(__dirname, '..', 'boilerplate'), folder, { recursive: true })
|
|
15
|
-
console.log(
|
|
16
|
-
'================================== ⚡️⚡️⚡️⚡️ ================================== '
|
|
17
|
-
)
|
|
18
|
-
console.log('Your new boilerplate Lightning 3 App has been created!')
|
|
19
|
-
console.log('')
|
|
20
|
-
console.log(`Go to ${folder}, run npm install, followed by npm run dev to get started`)
|
|
21
|
-
console.log(
|
|
22
|
-
'================================== ⚡️⚡️⚡️⚡️ ================================== '
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|