@lynx-js/web-worker-runtime-canary 0.16.0 → 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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @lynx-js/web-worker-runtime
|
|
2
2
|
|
|
3
|
+
## 0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/web-constants@0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
9
|
+
- @lynx-js/web-mainthread-apis@0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
10
|
+
- @lynx-js/web-worker-rpc@0.16.1-canary-20250910033502-c24b60214bbb194adfd96985f3f80d1e0f5a0e08
|
|
11
|
+
|
|
3
12
|
## 0.16.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -122,14 +131,14 @@
|
|
|
122
131
|
Usage:
|
|
123
132
|
|
|
124
133
|
```ts
|
|
125
|
-
import { pluginWebPlatform } from
|
|
126
|
-
import { defineConfig } from
|
|
134
|
+
import { pluginWebPlatform } from "@lynx-js/web-platform-rsbuild-plugin";
|
|
135
|
+
import { defineConfig } from "@rsbuild/core";
|
|
127
136
|
|
|
128
137
|
export default defineConfig({
|
|
129
138
|
plugins: [
|
|
130
139
|
pluginWebPlatform({
|
|
131
140
|
// replace with your actual napi-modules file path
|
|
132
|
-
napiModulesPath: path.resolve(__dirname,
|
|
141
|
+
napiModulesPath: path.resolve(__dirname, "./index.napi-modules.ts"),
|
|
133
142
|
}),
|
|
134
143
|
],
|
|
135
144
|
});
|
|
@@ -140,10 +149,10 @@
|
|
|
140
149
|
```ts
|
|
141
150
|
// index.napi-modules.ts
|
|
142
151
|
export default {
|
|
143
|
-
custom_module: function(NapiModules, NapiModulesCall) {
|
|
152
|
+
custom_module: function (NapiModules, NapiModulesCall) {
|
|
144
153
|
return {
|
|
145
154
|
async test(name) {
|
|
146
|
-
console.log(
|
|
155
|
+
console.log("CustomModule", NapiModules, NapiModulesCall);
|
|
147
156
|
},
|
|
148
157
|
};
|
|
149
158
|
},
|
|
@@ -195,25 +204,25 @@
|
|
|
195
204
|
lynxView.initI18nResources = [
|
|
196
205
|
{
|
|
197
206
|
options: {
|
|
198
|
-
locale:
|
|
199
|
-
channel:
|
|
200
|
-
fallback_url:
|
|
207
|
+
locale: "en",
|
|
208
|
+
channel: "1",
|
|
209
|
+
fallback_url: "",
|
|
201
210
|
},
|
|
202
211
|
resource: {
|
|
203
|
-
hello:
|
|
204
|
-
lynx:
|
|
212
|
+
hello: "hello",
|
|
213
|
+
lynx: "lynx web platform1",
|
|
205
214
|
},
|
|
206
215
|
},
|
|
207
216
|
];
|
|
208
|
-
lynxView.addEventListener(
|
|
217
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
209
218
|
console.log(e);
|
|
210
219
|
});
|
|
211
220
|
|
|
212
221
|
// mts
|
|
213
222
|
_I18nResourceTranslation({
|
|
214
|
-
locale:
|
|
215
|
-
channel:
|
|
216
|
-
fallback_url:
|
|
223
|
+
locale: "en",
|
|
224
|
+
channel: "1",
|
|
225
|
+
fallback_url: "",
|
|
217
226
|
});
|
|
218
227
|
```
|
|
219
228
|
|
|
@@ -463,8 +472,8 @@
|
|
|
463
472
|
}
|
|
464
473
|
};`,
|
|
465
474
|
],
|
|
466
|
-
{ type:
|
|
467
|
-
)
|
|
475
|
+
{ type: "text/javascript" }
|
|
476
|
+
)
|
|
468
477
|
),
|
|
469
478
|
};
|
|
470
479
|
lynxView.nativeModulesMap = nativeModulesMap;
|
|
@@ -554,8 +563,8 @@
|
|
|
554
563
|
};
|
|
555
564
|
};`,
|
|
556
565
|
],
|
|
557
|
-
{ type:
|
|
558
|
-
)
|
|
566
|
+
{ type: "text/javascript" }
|
|
567
|
+
)
|
|
559
568
|
);
|
|
560
569
|
|
|
561
570
|
const color_methods = URL.createObjectURL(
|
|
@@ -570,8 +579,8 @@
|
|
|
570
579
|
};
|
|
571
580
|
};`,
|
|
572
581
|
],
|
|
573
|
-
{ type:
|
|
574
|
-
)
|
|
582
|
+
{ type: "text/javascript" }
|
|
583
|
+
)
|
|
575
584
|
);
|
|
576
585
|
|
|
577
586
|
lynxView.napiModuleMap = {
|
|
@@ -588,7 +597,7 @@
|
|
|
588
597
|
|
|
589
598
|
```js
|
|
590
599
|
lynxView.onNapiModulesCall = (name, data, moduleName) => {
|
|
591
|
-
if (name ===
|
|
600
|
+
if (name === "getColor" && moduleName === "color_methods") {
|
|
592
601
|
return data.color;
|
|
593
602
|
}
|
|
594
603
|
};
|
|
@@ -643,8 +652,8 @@
|
|
|
643
652
|
}
|
|
644
653
|
};`,
|
|
645
654
|
],
|
|
646
|
-
{ type:
|
|
647
|
-
)
|
|
655
|
+
{ type: "text/javascript" }
|
|
656
|
+
)
|
|
648
657
|
);
|
|
649
658
|
```
|
|
650
659
|
|
|
@@ -656,7 +665,7 @@
|
|
|
656
665
|
|
|
657
666
|
```js
|
|
658
667
|
lynxView.onNativeModulesCall = (name, data, callback) => {
|
|
659
|
-
if (name ===
|
|
668
|
+
if (name === "getColor") {
|
|
660
669
|
callback(data.color);
|
|
661
670
|
}
|
|
662
671
|
};
|
|
@@ -666,7 +675,7 @@
|
|
|
666
675
|
|
|
667
676
|
```js
|
|
668
677
|
lynxView.onNativeModulesCall = (name, data, moduleName) => {
|
|
669
|
-
if (name ===
|
|
678
|
+
if (name === "getColor" && moduleName === "bridge") {
|
|
670
679
|
return data.color;
|
|
671
680
|
}
|
|
672
681
|
};
|
|
@@ -22,8 +22,10 @@ export async function createNativeApp(config) {
|
|
|
22
22
|
const selectComponent = uiThreadRpc.createCallbackify(selectComponentEndpoint, 3);
|
|
23
23
|
const reportError = uiThreadRpc.createCall(reportErrorEndpoint);
|
|
24
24
|
const createBundleInitReturnObj = () => {
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const ret = globalThis.module.exports ?? globalThis.__bundle__holder;
|
|
26
|
+
globalThis.module.exports = null;
|
|
27
|
+
globalThis.__bundle__holder = null;
|
|
28
|
+
return ret;
|
|
27
29
|
};
|
|
28
30
|
const i18nResource = new I18nResource();
|
|
29
31
|
let release = '';
|
|
@@ -39,6 +41,8 @@ export async function createNativeApp(config) {
|
|
|
39
41
|
const manifestUrl = template.manifest[`/${sourceURL}`];
|
|
40
42
|
if (manifestUrl)
|
|
41
43
|
sourceURL = manifestUrl;
|
|
44
|
+
globalThis.module.exports = null;
|
|
45
|
+
globalThis.__bundle__holder = null;
|
|
42
46
|
import(
|
|
43
47
|
/* webpackIgnore: true */
|
|
44
48
|
sourceURL).catch(callback).then(async () => {
|
|
@@ -49,6 +53,8 @@ export async function createNativeApp(config) {
|
|
|
49
53
|
const manifestUrl = template.manifest[`/${sourceURL}`];
|
|
50
54
|
if (manifestUrl)
|
|
51
55
|
sourceURL = manifestUrl;
|
|
56
|
+
globalThis.module.exports = null;
|
|
57
|
+
globalThis.__bundle__holder = null;
|
|
52
58
|
importScripts(sourceURL);
|
|
53
59
|
return createBundleInitReturnObj();
|
|
54
60
|
},
|
|
@@ -15,15 +15,19 @@ const { prepareMainThreadAPIs } = await import(
|
|
|
15
15
|
/* webpackFetchPriority: "high" */
|
|
16
16
|
'@lynx-js/web-mainthread-apis');
|
|
17
17
|
function loadScriptSync(url) {
|
|
18
|
+
globalThis.module.exports = null;
|
|
18
19
|
importScripts(url);
|
|
19
|
-
|
|
20
|
+
const ret = globalThis.module?.exports;
|
|
21
|
+
return ret;
|
|
20
22
|
}
|
|
21
23
|
function loadScript(url) {
|
|
22
24
|
return new Promise((resolve, reject) => {
|
|
23
25
|
fetch(url)
|
|
24
26
|
.then(() => {
|
|
27
|
+
globalThis.module.exports = null;
|
|
25
28
|
importScripts(url);
|
|
26
|
-
|
|
29
|
+
const ret = globalThis.module?.exports;
|
|
30
|
+
resolve(ret);
|
|
27
31
|
}).catch(reject);
|
|
28
32
|
});
|
|
29
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-worker-runtime-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
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4",
|
|
26
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.16.
|
|
27
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.16.
|
|
28
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.
|
|
26
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.16.1-canary-20250910-c24b6021",
|
|
27
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.16.1-canary-20250910-c24b6021",
|
|
28
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.1-canary-20250910-c24b6021"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@lynx-js/lynx-core": "0.1.3"
|