@lynx-js/web-worker-runtime-canary 0.15.7 → 0.15.8-canary-20250826-1777bb4b
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 +34 -25
- package/dist/index.js +6 -2
- package/dist/mainThread/startMainThread.js +7 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @lynx-js/web-worker-runtime
|
|
2
2
|
|
|
3
|
+
## 0.15.8-canary-20250826060301-1777bb4bc1d031b0d30d5e2c079fc04cd72e402e
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/web-constants@0.15.8-canary-20250826060301-1777bb4bc1d031b0d30d5e2c079fc04cd72e402e
|
|
9
|
+
- @lynx-js/web-mainthread-apis@0.15.8-canary-20250826060301-1777bb4bc1d031b0d30d5e2c079fc04cd72e402e
|
|
10
|
+
- @lynx-js/web-worker-rpc@0.15.8-canary-20250826060301-1777bb4bc1d031b0d30d5e2c079fc04cd72e402e
|
|
11
|
+
|
|
3
12
|
## 0.15.7
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -98,14 +107,14 @@
|
|
|
98
107
|
Usage:
|
|
99
108
|
|
|
100
109
|
```ts
|
|
101
|
-
import { pluginWebPlatform } from
|
|
102
|
-
import { defineConfig } from
|
|
110
|
+
import { pluginWebPlatform } from "@lynx-js/web-platform-rsbuild-plugin";
|
|
111
|
+
import { defineConfig } from "@rsbuild/core";
|
|
103
112
|
|
|
104
113
|
export default defineConfig({
|
|
105
114
|
plugins: [
|
|
106
115
|
pluginWebPlatform({
|
|
107
116
|
// replace with your actual napi-modules file path
|
|
108
|
-
napiModulesPath: path.resolve(__dirname,
|
|
117
|
+
napiModulesPath: path.resolve(__dirname, "./index.napi-modules.ts"),
|
|
109
118
|
}),
|
|
110
119
|
],
|
|
111
120
|
});
|
|
@@ -116,10 +125,10 @@
|
|
|
116
125
|
```ts
|
|
117
126
|
// index.napi-modules.ts
|
|
118
127
|
export default {
|
|
119
|
-
custom_module: function(NapiModules, NapiModulesCall) {
|
|
128
|
+
custom_module: function (NapiModules, NapiModulesCall) {
|
|
120
129
|
return {
|
|
121
130
|
async test(name) {
|
|
122
|
-
console.log(
|
|
131
|
+
console.log("CustomModule", NapiModules, NapiModulesCall);
|
|
123
132
|
},
|
|
124
133
|
};
|
|
125
134
|
},
|
|
@@ -171,25 +180,25 @@
|
|
|
171
180
|
lynxView.initI18nResources = [
|
|
172
181
|
{
|
|
173
182
|
options: {
|
|
174
|
-
locale:
|
|
175
|
-
channel:
|
|
176
|
-
fallback_url:
|
|
183
|
+
locale: "en",
|
|
184
|
+
channel: "1",
|
|
185
|
+
fallback_url: "",
|
|
177
186
|
},
|
|
178
187
|
resource: {
|
|
179
|
-
hello:
|
|
180
|
-
lynx:
|
|
188
|
+
hello: "hello",
|
|
189
|
+
lynx: "lynx web platform1",
|
|
181
190
|
},
|
|
182
191
|
},
|
|
183
192
|
];
|
|
184
|
-
lynxView.addEventListener(
|
|
193
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
185
194
|
console.log(e);
|
|
186
195
|
});
|
|
187
196
|
|
|
188
197
|
// mts
|
|
189
198
|
_I18nResourceTranslation({
|
|
190
|
-
locale:
|
|
191
|
-
channel:
|
|
192
|
-
fallback_url:
|
|
199
|
+
locale: "en",
|
|
200
|
+
channel: "1",
|
|
201
|
+
fallback_url: "",
|
|
193
202
|
});
|
|
194
203
|
```
|
|
195
204
|
|
|
@@ -439,8 +448,8 @@
|
|
|
439
448
|
}
|
|
440
449
|
};`,
|
|
441
450
|
],
|
|
442
|
-
{ type:
|
|
443
|
-
)
|
|
451
|
+
{ type: "text/javascript" }
|
|
452
|
+
)
|
|
444
453
|
),
|
|
445
454
|
};
|
|
446
455
|
lynxView.nativeModulesMap = nativeModulesMap;
|
|
@@ -530,8 +539,8 @@
|
|
|
530
539
|
};
|
|
531
540
|
};`,
|
|
532
541
|
],
|
|
533
|
-
{ type:
|
|
534
|
-
)
|
|
542
|
+
{ type: "text/javascript" }
|
|
543
|
+
)
|
|
535
544
|
);
|
|
536
545
|
|
|
537
546
|
const color_methods = URL.createObjectURL(
|
|
@@ -546,8 +555,8 @@
|
|
|
546
555
|
};
|
|
547
556
|
};`,
|
|
548
557
|
],
|
|
549
|
-
{ type:
|
|
550
|
-
)
|
|
558
|
+
{ type: "text/javascript" }
|
|
559
|
+
)
|
|
551
560
|
);
|
|
552
561
|
|
|
553
562
|
lynxView.napiModuleMap = {
|
|
@@ -564,7 +573,7 @@
|
|
|
564
573
|
|
|
565
574
|
```js
|
|
566
575
|
lynxView.onNapiModulesCall = (name, data, moduleName) => {
|
|
567
|
-
if (name ===
|
|
576
|
+
if (name === "getColor" && moduleName === "color_methods") {
|
|
568
577
|
return data.color;
|
|
569
578
|
}
|
|
570
579
|
};
|
|
@@ -619,8 +628,8 @@
|
|
|
619
628
|
}
|
|
620
629
|
};`,
|
|
621
630
|
],
|
|
622
|
-
{ type:
|
|
623
|
-
)
|
|
631
|
+
{ type: "text/javascript" }
|
|
632
|
+
)
|
|
624
633
|
);
|
|
625
634
|
```
|
|
626
635
|
|
|
@@ -632,7 +641,7 @@
|
|
|
632
641
|
|
|
633
642
|
```js
|
|
634
643
|
lynxView.onNativeModulesCall = (name, data, callback) => {
|
|
635
|
-
if (name ===
|
|
644
|
+
if (name === "getColor") {
|
|
636
645
|
callback(data.color);
|
|
637
646
|
}
|
|
638
647
|
};
|
|
@@ -642,7 +651,7 @@
|
|
|
642
651
|
|
|
643
652
|
```js
|
|
644
653
|
lynxView.onNativeModulesCall = (name, data, moduleName) => {
|
|
645
|
-
if (name ===
|
|
654
|
+
if (name === "getColor" && moduleName === "bridge") {
|
|
646
655
|
return data.color;
|
|
647
656
|
}
|
|
648
657
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
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
|
import { startBackgroundThread } from './backgroundThread/index.js';
|
|
5
|
-
|
|
6
|
-
globalThis.onmessage = (ev) => {
|
|
5
|
+
globalThis.onmessage = async (ev) => {
|
|
7
6
|
const { mode, toPeerThread, toUIThread } = ev
|
|
8
7
|
.data;
|
|
9
8
|
if (mode === 'main') {
|
|
9
|
+
const { startMainThreadWorker } = await import(
|
|
10
|
+
/* webpackChunkName: "web-worker-runtime-main-thread" */
|
|
11
|
+
/* webpackMode: "lazy-once" */
|
|
12
|
+
/* webpackPreload: true */
|
|
13
|
+
'./mainThread/startMainThread.js');
|
|
10
14
|
startMainThreadWorker(toUIThread, toPeerThread);
|
|
11
15
|
}
|
|
12
16
|
else {
|
|
@@ -7,8 +7,14 @@ import { createMarkTimingInternal } from './crossThreadHandlers/createMainthread
|
|
|
7
7
|
import { OffscreenDocument } from '@lynx-js/offscreen-document/webworker';
|
|
8
8
|
import { _onEvent } from '@lynx-js/offscreen-document/webworker';
|
|
9
9
|
import { registerUpdateDataHandler } from './crossThreadHandlers/registerUpdateDataHandler.js';
|
|
10
|
+
const { prepareMainThreadAPIs } = await import(
|
|
11
|
+
/* webpackChunkName: "web-core-main-thread-apis" */
|
|
12
|
+
/* webpackMode: "lazy-once" */
|
|
13
|
+
/* webpackPreload: true */
|
|
14
|
+
/* webpackPrefetch: true */
|
|
15
|
+
/* webpackFetchPriority: "high" */
|
|
16
|
+
'@lynx-js/web-mainthread-apis');
|
|
10
17
|
export async function startMainThreadWorker(uiThreadPort, backgroundThreadPort) {
|
|
11
|
-
const { prepareMainThreadAPIs } = await import('@lynx-js/web-mainthread-apis');
|
|
12
18
|
const uiThreadRpc = new Rpc(uiThreadPort, 'main-to-ui');
|
|
13
19
|
const backgroundThreadRpc = new Rpc(backgroundThreadPort, 'main-to-bg');
|
|
14
20
|
const { markTimingInternal, flushMarkTimingInternal } = createMarkTimingInternal(backgroundThreadRpc);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-worker-runtime-canary",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.8-canary-20250826-1777bb4b",
|
|
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.
|
|
27
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.
|
|
28
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.
|
|
26
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.8-canary-20250826-1777bb4b",
|
|
27
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.8-canary-20250826-1777bb4b",
|
|
28
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.8-canary-20250826-1777bb4b"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@lynx-js/lynx-core": "0.1.3"
|