@lynx-js/web-core-server-canary 0.15.6 → 0.15.7-canary-20250818-19021aba
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 +11 -9
- package/dist/index.js +11 -5
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @lynx-js/web-core-server
|
|
2
2
|
|
|
3
|
+
## 0.15.7-canary-20250818140150-19021abafe4e9cb78e5eadeeca39b92f269b02a5
|
|
4
|
+
|
|
3
5
|
## 0.15.6
|
|
4
6
|
|
|
5
7
|
### Patch Changes
|
|
@@ -79,25 +81,25 @@
|
|
|
79
81
|
lynxView.initI18nResources = [
|
|
80
82
|
{
|
|
81
83
|
options: {
|
|
82
|
-
locale:
|
|
83
|
-
channel:
|
|
84
|
-
fallback_url:
|
|
84
|
+
locale: "en",
|
|
85
|
+
channel: "1",
|
|
86
|
+
fallback_url: "",
|
|
85
87
|
},
|
|
86
88
|
resource: {
|
|
87
|
-
hello:
|
|
88
|
-
lynx:
|
|
89
|
+
hello: "hello",
|
|
90
|
+
lynx: "lynx web platform1",
|
|
89
91
|
},
|
|
90
92
|
},
|
|
91
93
|
];
|
|
92
|
-
lynxView.addEventListener(
|
|
94
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
93
95
|
console.log(e);
|
|
94
96
|
});
|
|
95
97
|
|
|
96
98
|
// mts
|
|
97
99
|
_I18nResourceTranslation({
|
|
98
|
-
locale:
|
|
99
|
-
channel:
|
|
100
|
-
fallback_url:
|
|
100
|
+
locale: "en",
|
|
101
|
+
channel: "1",
|
|
102
|
+
fallback_url: "",
|
|
101
103
|
});
|
|
102
104
|
```
|
|
103
105
|
|
package/dist/index.js
CHANGED
|
@@ -418,6 +418,10 @@ const inShadowRootStyles = [
|
|
|
418
418
|
overflow: visible;
|
|
419
419
|
}`
|
|
420
420
|
];
|
|
421
|
+
const constants_globalDisallowedVars = [
|
|
422
|
+
'navigator',
|
|
423
|
+
'postMessage'
|
|
424
|
+
];
|
|
421
425
|
const W3cEventNameToLynx = {
|
|
422
426
|
click: 'tap',
|
|
423
427
|
lynxscroll: 'scroll',
|
|
@@ -816,7 +820,7 @@ const backgroundInjectWithBind = [
|
|
|
816
820
|
'Card',
|
|
817
821
|
'Component'
|
|
818
822
|
];
|
|
819
|
-
const generateModuleContent = (content, injectVars, injectWithBind, muteableVars, isESM)=>[
|
|
823
|
+
const generateModuleContent = (content, injectVars, injectWithBind, muteableVars, globalDisallowedVars, isESM)=>[
|
|
820
824
|
'//# allFunctionsCalledOnLoad\n',
|
|
821
825
|
isESM ? 'export default ' : 'globalThis.module.exports =',
|
|
822
826
|
'function(lynx_runtime) {',
|
|
@@ -826,6 +830,7 @@ const generateModuleContent = (content, injectVars, injectWithBind, muteableVars
|
|
|
826
830
|
'} = lynx_runtime;',
|
|
827
831
|
...injectWithBind.map((nm)=>`const ${nm} = lynx_runtime.${nm}?.bind(lynx_runtime);`),
|
|
828
832
|
';var globDynamicComponentEntry = \'__Card__\';',
|
|
833
|
+
0 !== globalDisallowedVars.length ? `var ${globalDisallowedVars.join('=')}=undefined;` : '',
|
|
829
834
|
'var {__globalProps} = lynx;',
|
|
830
835
|
'lynx_runtime._updateVars=()=>{',
|
|
831
836
|
...muteableVars.map((nm)=>`${nm} = lynx_runtime.__lynxGlobalBindingValues.${nm};`),
|
|
@@ -833,18 +838,18 @@ const generateModuleContent = (content, injectVars, injectWithBind, muteableVars
|
|
|
833
838
|
content,
|
|
834
839
|
'\n return module.exports;}'
|
|
835
840
|
].join('');
|
|
836
|
-
async function generateJavascriptUrl(obj, injectVars, injectWithBind, muteableVars, createJsModuleUrl, isESM, templateName) {
|
|
841
|
+
async function generateJavascriptUrl(obj, injectVars, injectWithBind, muteableVars, globalDisallowedVars, createJsModuleUrl, isESM, templateName) {
|
|
837
842
|
const processEntry = async ([name, content])=>[
|
|
838
843
|
name,
|
|
839
|
-
await createJsModuleUrl(generateModuleContent(content, injectVars.concat(muteableVars), injectWithBind, muteableVars, isESM), `${templateName}-${name.replaceAll('/', '')}.js`)
|
|
844
|
+
await createJsModuleUrl(generateModuleContent(content, injectVars.concat(muteableVars), injectWithBind, muteableVars, globalDisallowedVars, isESM), `${templateName}-${name.replaceAll('/', '')}.js`)
|
|
840
845
|
];
|
|
841
846
|
return Promise.all(Object.entries(obj).filter(([_, content])=>'string' == typeof content).map(processEntry)).then(Object.fromEntries);
|
|
842
847
|
}
|
|
843
848
|
async function generateTemplate(template, createJsModuleUrl, templateName) {
|
|
844
849
|
return {
|
|
845
850
|
...template,
|
|
846
|
-
lepusCode: await generateJavascriptUrl(template.lepusCode, mainThreadInjectVars, [], globalMuteableVars, createJsModuleUrl, true, templateName),
|
|
847
|
-
manifest: await generateJavascriptUrl(template.manifest, backgroundInjectVars, backgroundInjectWithBind, [], createJsModuleUrl, false, templateName)
|
|
851
|
+
lepusCode: await generateJavascriptUrl(template.lepusCode, mainThreadInjectVars, [], globalMuteableVars, templateName ? [] : constants_globalDisallowedVars, createJsModuleUrl, true, templateName),
|
|
852
|
+
manifest: await generateJavascriptUrl(template.manifest, backgroundInjectVars, backgroundInjectWithBind, [], templateName ? [] : constants_globalDisallowedVars, createJsModuleUrl, false, templateName)
|
|
848
853
|
};
|
|
849
854
|
}
|
|
850
855
|
function registerCallLepusMethodHandler(rpc, runtime) {
|
|
@@ -1882,6 +1887,7 @@ function createMainThreadGlobalThis(config) {
|
|
|
1882
1887
|
};
|
|
1883
1888
|
mtsGlobalThis.globalThis = new Proxy(mtsGlobalThis, {
|
|
1884
1889
|
get: (target, prop)=>{
|
|
1890
|
+
if ('string' == typeof prop && constants_globalDisallowedVars.includes(prop)) return;
|
|
1885
1891
|
if ('globalThis' === prop) return target;
|
|
1886
1892
|
return target[prop] ?? globalThis[prop];
|
|
1887
1893
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-server-canary",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.7-canary-20250818-19021aba",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"rsbuild-plugin-arethetypeswrong": "0.1.1",
|
|
27
|
+
"rsbuild-plugin-publint": "0.3.3",
|
|
26
28
|
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.3",
|
|
27
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.6",
|
|
28
29
|
"@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.8.4",
|
|
29
|
-
"@lynx-js/web-
|
|
30
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.
|
|
30
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.7-canary-20250818-19021aba",
|
|
31
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.7-canary-20250818-19021aba",
|
|
32
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.7-canary-20250818-19021aba"
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|
|
33
35
|
"build": "rslib build",
|