@lynx-js/web-constants-canary 0.17.1-canary-20250925-6180e11d → 0.17.2-canary-20250928-a35a2452
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
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# @lynx-js/web-constants
|
|
2
2
|
|
|
3
|
-
## 0.17.
|
|
3
|
+
## 0.17.2-canary-20250928082931-a35a2452e5355bda3c475f9a750a86085e0cf56a
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: support load bts chunk from remote address ([#1834](https://github.com/lynx-family/lynx-stack/pull/1834))
|
|
8
|
+
|
|
9
|
+
- re-support chunk splitting
|
|
10
|
+
- support lynx.requireModule with a json file
|
|
11
|
+
- support lynx.requireModule, lynx.requireModuleAsync with a remote url
|
|
12
|
+
- support to add a breakpoint in chrome after reloading the web page
|
|
13
|
+
|
|
14
|
+
- Updated dependencies []:
|
|
15
|
+
- @lynx-js/web-worker-rpc@0.17.2-canary-20250928082931-a35a2452e5355bda3c475f9a750a86085e0cf56a
|
|
16
|
+
|
|
17
|
+
## 0.17.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
6
20
|
|
|
7
21
|
- Updated dependencies []:
|
|
8
|
-
- @lynx-js/web-worker-rpc@0.17.1
|
|
22
|
+
- @lynx-js/web-worker-rpc@0.17.1
|
|
9
23
|
|
|
10
24
|
## 0.17.0
|
|
11
25
|
|
|
@@ -39,6 +39,9 @@ export interface LynxTemplate {
|
|
|
39
39
|
version?: number;
|
|
40
40
|
appType: 'card' | 'lazy';
|
|
41
41
|
}
|
|
42
|
+
export type BTSChunkEntry = (postMessage: undefined, module: {
|
|
43
|
+
exports: unknown;
|
|
44
|
+
}, exports: unknown, lynxCoreInject: unknown, Card: unknown, setTimeout: unknown, setInterval: unknown, clearInterval: unknown, clearTimeout: unknown, NativeModules: unknown, Component: unknown, ReactLynx: unknown, nativeAppId: unknown, Behavior: unknown, LynxJSBI: unknown, lynx: unknown, window: unknown, document: unknown, frames: unknown, location: unknown, navigator: unknown, localStorage: unknown, history: unknown, Caches: unknown, screen: unknown, alert: unknown, confirm: unknown, prompt: unknown, fetch: unknown, XMLHttpRequest: unknown, webkit: unknown, Reporter: unknown, print: unknown, global: unknown, requestAnimationFrame: unknown, cancelAnimationFrame: unknown) => unknown;
|
|
42
45
|
export interface LynxJSModule {
|
|
43
46
|
exports?: (lynx_runtime: any) => unknown;
|
|
44
47
|
}
|
|
@@ -82,8 +82,9 @@ export interface NativeApp {
|
|
|
82
82
|
clearInterval: typeof clearInterval;
|
|
83
83
|
requestAnimationFrame: (cb: () => void) => void;
|
|
84
84
|
cancelAnimationFrame: (id: number) => void;
|
|
85
|
+
readScript: (sourceURL: string, entryName?: string) => string;
|
|
85
86
|
loadScript: (sourceURL: string, entryName?: string) => BundleInitReturnObj;
|
|
86
|
-
loadScriptAsync(sourceURL: string, callback: (message: string | null, exports?: BundleInitReturnObj) => void): void;
|
|
87
|
+
loadScriptAsync(sourceURL: string, callback: (message: string | null, exports?: BundleInitReturnObj) => void, entryName?: string): void;
|
|
87
88
|
nativeModuleProxy: Record<string, any>;
|
|
88
89
|
setNativeProps: (type: IdentifierType, identifier: string, component_id: string, first_only: boolean, native_props: Record<string, unknown>, root_unique_id: number | undefined) => void;
|
|
89
90
|
invokeUIMethod: (type: IdentifierType, identifier: string, component_id: string, method: string, params: object, callback: (ret: InvokeCallbackRes) => void, root_unique_id: number) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { LynxTemplate } from '../types/LynxModule.js';
|
|
2
|
-
export declare function generateTemplate(template: LynxTemplate, createJsModuleUrl: ((content: string, name: string) => Promise<string>) | ((content: string) => string), templateName
|
|
2
|
+
export declare function generateTemplate(template: LynxTemplate, createJsModuleUrl: ((content: string, name: string) => Promise<string>) | ((content: string) => string), templateName: string): Promise<LynxTemplate>;
|
|
@@ -2,61 +2,18 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
const currentSupportedTemplateVersion = 2;
|
|
5
|
-
const globalDisallowedVars = ['navigator', 'postMessage'];
|
|
5
|
+
const globalDisallowedVars = ['navigator', 'postMessage', 'window'];
|
|
6
6
|
const templateUpgraders = [
|
|
7
7
|
(template) => {
|
|
8
|
-
const defaultInjectStr = [
|
|
9
|
-
'Card',
|
|
10
|
-
'setTimeout',
|
|
11
|
-
'setInterval',
|
|
12
|
-
'clearInterval',
|
|
13
|
-
'clearTimeout',
|
|
14
|
-
'NativeModules',
|
|
15
|
-
'Component',
|
|
16
|
-
'ReactLynx',
|
|
17
|
-
'nativeAppId',
|
|
18
|
-
'Behavior',
|
|
19
|
-
'LynxJSBI',
|
|
20
|
-
'lynx',
|
|
21
|
-
// BOM API
|
|
22
|
-
'window',
|
|
23
|
-
'document',
|
|
24
|
-
'frames',
|
|
25
|
-
'location',
|
|
26
|
-
'navigator',
|
|
27
|
-
'localStorage',
|
|
28
|
-
'history',
|
|
29
|
-
'Caches',
|
|
30
|
-
'screen',
|
|
31
|
-
'alert',
|
|
32
|
-
'confirm',
|
|
33
|
-
'prompt',
|
|
34
|
-
'fetch',
|
|
35
|
-
'XMLHttpRequest',
|
|
36
|
-
'__WebSocket__', // We would provide `WebSocket` using `ProvidePlugin`
|
|
37
|
-
'webkit',
|
|
38
|
-
'Reporter',
|
|
39
|
-
'print',
|
|
40
|
-
'global',
|
|
41
|
-
// Lynx API
|
|
42
|
-
'requestAnimationFrame',
|
|
43
|
-
'cancelAnimationFrame',
|
|
44
|
-
].join(',');
|
|
45
8
|
template.appType = template.appType ?? (template.lepusCode.root.startsWith('(function (globDynamicComponentEntry')
|
|
46
9
|
? 'lazy'
|
|
47
10
|
: 'card');
|
|
48
|
-
/**
|
|
49
|
-
* The template version 1 has no module wrapper for bts code
|
|
50
|
-
*/
|
|
51
|
-
template.manifest = Object.fromEntries(Object.entries(template.manifest).map(([key, value]) => [
|
|
52
|
-
key,
|
|
53
|
-
`module.exports={init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:{}}; var exports=module.exports; ${value}\n return module.exports; } }`,
|
|
54
|
-
]));
|
|
55
11
|
template.version = 2;
|
|
12
|
+
template.lepusCode = Object.fromEntries(Object.entries(template.lepusCode).filter(([_, content]) => typeof content === 'string'));
|
|
56
13
|
return template;
|
|
57
14
|
},
|
|
58
15
|
];
|
|
59
|
-
const generateModuleContent = (content, eager, appType) =>
|
|
16
|
+
const generateModuleContent = (fileName, content, eager, appType) =>
|
|
60
17
|
/**
|
|
61
18
|
* About the `allFunctionsCalledOnLoad` directive:
|
|
62
19
|
* https://v8.dev/blog/preparser#pife
|
|
@@ -75,13 +32,16 @@ const generateModuleContent = (content, eager, appType) =>
|
|
|
75
32
|
appType !== 'card' ? 'module.exports=\n' : '',
|
|
76
33
|
content,
|
|
77
34
|
'\n})()',
|
|
35
|
+
'\n//# sourceURL=',
|
|
36
|
+
fileName,
|
|
78
37
|
].join('');
|
|
79
38
|
async function generateJavascriptUrl(obj, createJsModuleUrl, eager, appType, templateName) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
39
|
+
return Promise.all(Object.entries(obj).filter(([_, content]) => typeof content === 'string').map(async ([name, content]) => {
|
|
40
|
+
return [
|
|
41
|
+
name,
|
|
42
|
+
await createJsModuleUrl(generateModuleContent(`${templateName}/${name.replaceAll('/', '_')}.js`, content, eager, appType), `${templateName}-${name.replaceAll('/', '_')}.js`),
|
|
43
|
+
];
|
|
44
|
+
})).then(Object.fromEntries);
|
|
85
45
|
}
|
|
86
46
|
export async function generateTemplate(template, createJsModuleUrl, templateName) {
|
|
87
47
|
template.version = template.version ?? 1;
|
|
@@ -96,7 +56,6 @@ export async function generateTemplate(template, createJsModuleUrl, templateName
|
|
|
96
56
|
return {
|
|
97
57
|
...template,
|
|
98
58
|
lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, true, template.appType, templateName),
|
|
99
|
-
manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, false, template.appType, templateName),
|
|
100
59
|
};
|
|
101
60
|
}
|
|
102
61
|
//# 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.17.
|
|
3
|
+
"version": "0.17.2-canary-20250928-a35a2452",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"**/*.css"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.17.
|
|
26
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.17.2-canary-20250928-a35a2452"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4"
|