@lynx-js/web-worker-runtime-canary 0.15.6 → 0.15.7-canary-20250818-70863fbc

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,5 +1,16 @@
1
1
  # @lynx-js/web-worker-runtime
2
2
 
3
+ ## 0.15.7-canary-20250818120211-70863fbc311d8885ebda40855668097b0631f521
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: globalThis is never accessible in MTS ([#1531](https://github.com/lynx-family/lynx-stack/pull/1531))
8
+
9
+ - Updated dependencies [[`70863fb`](https://github.com/lynx-family/lynx-stack/commit/70863fbc311d8885ebda40855668097b0631f521)]:
10
+ - @lynx-js/web-mainthread-apis@0.15.7-canary-20250818120211-70863fbc311d8885ebda40855668097b0631f521
11
+ - @lynx-js/web-constants@0.15.7-canary-20250818120211-70863fbc311d8885ebda40855668097b0631f521
12
+ - @lynx-js/web-worker-rpc@0.15.7-canary-20250818120211-70863fbc311d8885ebda40855668097b0631f521
13
+
3
14
  ## 0.15.6
4
15
 
5
16
  ### Patch Changes
@@ -87,14 +98,14 @@
87
98
  Usage:
88
99
 
89
100
  ```ts
90
- import { pluginWebPlatform } from '@lynx-js/web-platform-rsbuild-plugin';
91
- import { defineConfig } from '@rsbuild/core';
101
+ import { pluginWebPlatform } from "@lynx-js/web-platform-rsbuild-plugin";
102
+ import { defineConfig } from "@rsbuild/core";
92
103
 
93
104
  export default defineConfig({
94
105
  plugins: [
95
106
  pluginWebPlatform({
96
107
  // replace with your actual napi-modules file path
97
- napiModulesPath: path.resolve(__dirname, './index.napi-modules.ts'),
108
+ napiModulesPath: path.resolve(__dirname, "./index.napi-modules.ts"),
98
109
  }),
99
110
  ],
100
111
  });
@@ -105,10 +116,10 @@
105
116
  ```ts
106
117
  // index.napi-modules.ts
107
118
  export default {
108
- custom_module: function(NapiModules, NapiModulesCall) {
119
+ custom_module: function (NapiModules, NapiModulesCall) {
109
120
  return {
110
121
  async test(name) {
111
- console.log('CustomModule', NapiModules, NapiModulesCall);
122
+ console.log("CustomModule", NapiModules, NapiModulesCall);
112
123
  },
113
124
  };
114
125
  },
@@ -160,25 +171,25 @@
160
171
  lynxView.initI18nResources = [
161
172
  {
162
173
  options: {
163
- locale: 'en',
164
- channel: '1',
165
- fallback_url: '',
174
+ locale: "en",
175
+ channel: "1",
176
+ fallback_url: "",
166
177
  },
167
178
  resource: {
168
- hello: 'hello',
169
- lynx: 'lynx web platform1',
179
+ hello: "hello",
180
+ lynx: "lynx web platform1",
170
181
  },
171
182
  },
172
183
  ];
173
- lynxView.addEventListener('i18nResourceMissed', (e) => {
184
+ lynxView.addEventListener("i18nResourceMissed", (e) => {
174
185
  console.log(e);
175
186
  });
176
187
 
177
188
  // mts
178
189
  _I18nResourceTranslation({
179
- locale: 'en',
180
- channel: '1',
181
- fallback_url: '',
190
+ locale: "en",
191
+ channel: "1",
192
+ fallback_url: "",
182
193
  });
183
194
  ```
184
195
 
@@ -428,8 +439,8 @@
428
439
  }
429
440
  };`,
430
441
  ],
431
- { type: 'text/javascript' },
432
- ),
442
+ { type: "text/javascript" }
443
+ )
433
444
  ),
434
445
  };
435
446
  lynxView.nativeModulesMap = nativeModulesMap;
@@ -519,8 +530,8 @@
519
530
  };
520
531
  };`,
521
532
  ],
522
- { type: 'text/javascript' },
523
- ),
533
+ { type: "text/javascript" }
534
+ )
524
535
  );
525
536
 
526
537
  const color_methods = URL.createObjectURL(
@@ -535,8 +546,8 @@
535
546
  };
536
547
  };`,
537
548
  ],
538
- { type: 'text/javascript' },
539
- ),
549
+ { type: "text/javascript" }
550
+ )
540
551
  );
541
552
 
542
553
  lynxView.napiModuleMap = {
@@ -553,7 +564,7 @@
553
564
 
554
565
  ```js
555
566
  lynxView.onNapiModulesCall = (name, data, moduleName) => {
556
- if (name === 'getColor' && moduleName === 'color_methods') {
567
+ if (name === "getColor" && moduleName === "color_methods") {
557
568
  return data.color;
558
569
  }
559
570
  };
@@ -608,8 +619,8 @@
608
619
  }
609
620
  };`,
610
621
  ],
611
- { type: 'text/javascript' },
612
- ),
622
+ { type: "text/javascript" }
623
+ )
613
624
  );
614
625
  ```
615
626
 
@@ -621,7 +632,7 @@
621
632
 
622
633
  ```js
623
634
  lynxView.onNativeModulesCall = (name, data, callback) => {
624
- if (name === 'getColor') {
635
+ if (name === "getColor") {
625
636
  callback(data.color);
626
637
  }
627
638
  };
@@ -631,7 +642,7 @@
631
642
 
632
643
  ```js
633
644
  lynxView.onNativeModulesCall = (name, data, moduleName) => {
634
- if (name === 'getColor' && moduleName === 'bridge') {
645
+ if (name === "getColor" && moduleName === "bridge") {
635
646
  return data.color;
636
647
  }
637
648
  };
@@ -1,4 +1,4 @@
1
- import { callLepusMethodEndpoint, setNativePropsEndpoint, triggerComponentEventEndpoint, selectComponentEndpoint, systemInfo, I18nResource, reportErrorEndpoint, } from '@lynx-js/web-constants';
1
+ import { callLepusMethodEndpoint, setNativePropsEndpoint, triggerComponentEventEndpoint, selectComponentEndpoint, systemInfo, I18nResource, reportErrorEndpoint, globalDisallowedVars, } from '@lynx-js/web-constants';
2
2
  import { createInvokeUIMethod } from './crossThreadHandlers/createInvokeUIMethod.js';
3
3
  import { registerPublicComponentEventHandler } from './crossThreadHandlers/registerPublicComponentEventHandler.js';
4
4
  import { registerGlobalExposureEventHandler } from './crossThreadHandlers/registerGlobalExposureEventHandler.js';
@@ -28,6 +28,9 @@ export async function createNativeApp(config) {
28
28
  lynxCoreInject.tt.lynxCoreInject = lynxCoreInject;
29
29
  lynxCoreInject.tt.globalThis ??= new Proxy(lynxCoreInject, {
30
30
  get(target, prop) {
31
+ if (typeof prop === 'string' && globalDisallowedVars.includes(prop)) {
32
+ return undefined;
33
+ }
31
34
  // @ts-expect-error
32
35
  return target[prop] ?? globalThis[prop];
33
36
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-worker-runtime-canary",
3
- "version": "0.15.6",
3
+ "version": "0.15.7-canary-20250818-70863fbc",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.3",
26
- "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.6",
27
- "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.6",
28
- "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.6"
26
+ "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.7-canary-20250818-70863fbc",
27
+ "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.7-canary-20250818-70863fbc",
28
+ "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.7-canary-20250818-70863fbc"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@lynx-js/lynx-core": "0.1.3"