@lynx-js/web-constants-canary 0.16.0-canary-20250830-d7d0b9b9 → 0.16.1-canary-20250910-c24b6021
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 -2
- package/dist/types/LynxModule.d.ts +1 -0
- package/dist/utils/generateTemplate.js +24 -9
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# @lynx-js/web-constants
|
|
2
2
|
|
|
3
|
-
## 0.16.
|
|
3
|
+
## 0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/web-worker-rpc@0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
9
|
+
|
|
10
|
+
## 0.16.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
6
13
|
|
|
@@ -21,7 +28,7 @@
|
|
|
21
28
|
- fix: the SystemInfo in bts should be assigned to the globalThis ([#1599](https://github.com/lynx-family/lynx-stack/pull/1599))
|
|
22
29
|
|
|
23
30
|
- Updated dependencies [[`c1f8715`](https://github.com/lynx-family/lynx-stack/commit/c1f8715a81b2e69ff46fc363013626db4468c209)]:
|
|
24
|
-
- @lynx-js/web-worker-rpc@0.16.0
|
|
31
|
+
- @lynx-js/web-worker-rpc@0.16.0
|
|
25
32
|
|
|
26
33
|
## 0.15.7
|
|
27
34
|
|
|
@@ -42,12 +42,15 @@ const templateUpgraders = [
|
|
|
42
42
|
'requestAnimationFrame',
|
|
43
43
|
'cancelAnimationFrame',
|
|
44
44
|
].join(',');
|
|
45
|
+
template.appType = template.lepusCode.root.startsWith('(function (globDynamicComponentEntry')
|
|
46
|
+
? 'lazy'
|
|
47
|
+
: 'card';
|
|
45
48
|
/**
|
|
46
49
|
* The template version 1 has no module wrapper for bts code
|
|
47
50
|
*/
|
|
48
51
|
template.manifest = Object.fromEntries(Object.entries(template.manifest).map(([key, value]) => [
|
|
49
52
|
key,
|
|
50
|
-
`{init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:null}; ${value}\n return module.exports; } }`,
|
|
53
|
+
`module.exports={init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:null}; ${value}\n return module.exports; } }`,
|
|
51
54
|
]));
|
|
52
55
|
template.lepusCode = Object.fromEntries(Object.entries(template.lepusCode).map(([key, value]) => [
|
|
53
56
|
key,
|
|
@@ -57,17 +60,29 @@ const templateUpgraders = [
|
|
|
57
60
|
return template;
|
|
58
61
|
},
|
|
59
62
|
];
|
|
60
|
-
const generateModuleContent = (content) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const generateModuleContent = (content, eager) =>
|
|
64
|
+
/**
|
|
65
|
+
* About the `allFunctionsCalledOnLoad` directive:
|
|
66
|
+
* https://v8.dev/blog/preparser#pife
|
|
67
|
+
* https://github.com/WICG/explicit-javascript-compile-hints-file-based?tab=readme-ov-file
|
|
68
|
+
* https://v8.dev/blog/explicit-compile-hints
|
|
69
|
+
* We should ensure the MTS code is parsed eagerly to avoid runtime parse delay.
|
|
70
|
+
* But for BTS code, we should not do this as it would increase the memory usage.
|
|
71
|
+
* JavaScript Engines, like V8, already had optimizations for code starts with "(function"
|
|
72
|
+
* to be parsed eagerly.
|
|
73
|
+
*/
|
|
74
|
+
[
|
|
75
|
+
eager ? '//# allFunctionsCalledOnLoad' : '',
|
|
76
|
+
'\n(function() { "use strict"; const ',
|
|
77
|
+
globalDisallowedVars.join('=void 0,'),
|
|
78
|
+
'=void 0;\n',
|
|
64
79
|
content,
|
|
65
80
|
'\n})()',
|
|
66
81
|
].join('');
|
|
67
|
-
async function generateJavascriptUrl(obj, createJsModuleUrl, templateName) {
|
|
82
|
+
async function generateJavascriptUrl(obj, createJsModuleUrl, eager, templateName) {
|
|
68
83
|
const processEntry = async ([name, content]) => [
|
|
69
84
|
name,
|
|
70
|
-
await createJsModuleUrl(generateModuleContent(content), `${templateName}-${name.replaceAll('/', '')}.js`),
|
|
85
|
+
await createJsModuleUrl(generateModuleContent(content, eager), `${templateName}-${name.replaceAll('/', '')}.js`),
|
|
71
86
|
];
|
|
72
87
|
return Promise.all(Object.entries(obj).filter(([_, content]) => typeof content === 'string').map(processEntry)).then(Object.fromEntries);
|
|
73
88
|
}
|
|
@@ -83,8 +98,8 @@ export async function generateTemplate(template, createJsModuleUrl, templateName
|
|
|
83
98
|
}
|
|
84
99
|
return {
|
|
85
100
|
...template,
|
|
86
|
-
lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, templateName),
|
|
87
|
-
manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, templateName),
|
|
101
|
+
lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, true, templateName),
|
|
102
|
+
manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, false, templateName),
|
|
88
103
|
};
|
|
89
104
|
}
|
|
90
105
|
//# sourceMappingURL=generateTemplate.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-constants-canary",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1-canary-20250910-c24b6021",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"**/*.css"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.
|
|
26
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.1-canary-20250910-c24b6021"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4
|
|
29
|
+
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4"
|
|
30
30
|
}
|
|
31
31
|
}
|