@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/helpers.js +220 -0
  3. package/bin/index.js +141 -0
  4. package/boilerplate/common/eslint/husky/pre-commit +2 -0
  5. package/boilerplate/common/eslint/package.json +20 -0
  6. package/boilerplate/common/ide/.vscode/settings.json +10 -0
  7. package/boilerplate/js/default/.gitattributes +3 -0
  8. package/boilerplate/{package.json → js/default/package.json} +3 -3
  9. package/docs/getting_started.md +7 -7
  10. package/package.json +13 -5
  11. package/public/assets/fps_sprite.base64.js +1 -0
  12. package/public/assets/fps_sprite.png +0 -0
  13. package/scripts/postpublish.js +59 -0
  14. package/scripts/prepublishOnly.js +84 -0
  15. package/src/components/Circle.js +32 -3
  16. package/src/components/Circle.orig.js +31 -0
  17. package/src/components/FPScounter.js +1127 -0
  18. package/src/components/FPScounter.orig.js +122 -0
  19. package/src/components/Image.js +23 -2
  20. package/src/components/Image.orig.js +33 -0
  21. package/src/components/RouterView.js +22 -3
  22. package/src/components/RouterView.orig.js +51 -0
  23. package/src/components/Sprite.js +26 -3
  24. package/src/components/Sprite.orig.js +58 -0
  25. package/src/components/Text.js +56 -20
  26. package/src/components/Text.orig.js +79 -0
  27. package/src/launch.d.ts +10 -1
  28. package/src/launch.js +1 -0
  29. package/src/lib/precompiler/precompiler.js +64 -0
  30. package/src/lib/setup/base.js +2 -0
  31. package/vite/index.js +17 -0
  32. package/vite/preCompiler.js +19 -39
  33. package/bin/index.cjs +0 -25
  34. package/boilerplate/.vscode/settings.json +0 -10
  35. /package/boilerplate/{.editorconfig → common/eslint/.editorconfig} +0 -0
  36. /package/boilerplate/{.eslintignore → common/eslint/.eslintignore} +0 -0
  37. /package/boilerplate/{.eslintrc.cjs → common/eslint/.eslintrc.cjs} +0 -0
  38. /package/boilerplate/{.vscode → common/ide/.vscode}/extensions.json +0 -0
  39. /package/boilerplate/{.vscode → common/ide/.vscode}/launch.json +0 -0
  40. /package/boilerplate/{public → common/public}/assets/logo.png +0 -0
  41. /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.json +0 -0
  42. /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.png +0 -0
  43. /package/boilerplate/{public → common/public}/fonts/OpenSans-Medium.ttf +0 -0
  44. /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.json +0 -0
  45. /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.png +0 -0
  46. /package/boilerplate/{index.html → js/default/index.html} +0 -0
  47. /package/boilerplate/{src → js/default/src}/App.js +0 -0
  48. /package/boilerplate/{src → js/default/src}/components/Loader.js +0 -0
  49. /package/boilerplate/{src → js/default/src}/fontloader.js +0 -0
  50. /package/boilerplate/{src → js/default/src}/index.js +0 -0
  51. /package/boilerplate/{src → js/default/src}/pages/Home.js +0 -0
  52. /package/boilerplate/{src → js/default/src}/renderer.js +0 -0
  53. /package/boilerplate/{vite.config.js → js/default/vite.config.js} +0 -0
@@ -1,6 +1,21 @@
1
- import parser from '../src/lib/templateparser/parser.js'
2
- import generator from '../src/lib/codegenerator/generator.js'
3
- import path from 'path'
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
- if (source.indexOf('Blits.Component(') > -1 || source.indexOf('Blits.Application(') > -1) {
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
- }
@@ -1,10 +0,0 @@
1
- {
2
- "editor.formatOnSave": false,
3
- "eslint.validate": [
4
- "javascript"
5
- ],
6
- "editor.codeActionsOnSave": {
7
- "source.fixAll.eslint": true
8
- },
9
- "js/ts.implicitProjectConfig.checkJs": true
10
- }
File without changes
File without changes
File without changes