@lynx-js/web-worker-runtime-canary 0.15.7 → 0.15.8-canary-20250826-bb53d9a0
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.8-canary-20250826112003-bb53d9a035f607e7c89952098d4ed77877a2e3c1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: the SystemInfo in bts should be assigned to the globalThis ([#1599](https://github.com/lynx-family/lynx-stack/pull/1599))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`bb53d9a`](https://github.com/lynx-family/lynx-stack/commit/bb53d9a035f607e7c89952098d4ed77877a2e3c1)]:
|
|
10
|
+
- @lynx-js/web-mainthread-apis@0.15.8-canary-20250826112003-bb53d9a035f607e7c89952098d4ed77877a2e3c1
|
|
11
|
+
- @lynx-js/web-constants@0.15.8-canary-20250826112003-bb53d9a035f607e7c89952098d4ed77877a2e3c1
|
|
12
|
+
- @lynx-js/web-worker-rpc@0.15.8-canary-20250826112003-bb53d9a035f607e7c89952098d4ed77877a2e3c1
|
|
13
|
+
|
|
3
14
|
## 0.15.7
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -98,14 +109,14 @@
|
|
|
98
109
|
Usage:
|
|
99
110
|
|
|
100
111
|
```ts
|
|
101
|
-
import { pluginWebPlatform } from
|
|
102
|
-
import { defineConfig } from
|
|
112
|
+
import { pluginWebPlatform } from "@lynx-js/web-platform-rsbuild-plugin";
|
|
113
|
+
import { defineConfig } from "@rsbuild/core";
|
|
103
114
|
|
|
104
115
|
export default defineConfig({
|
|
105
116
|
plugins: [
|
|
106
117
|
pluginWebPlatform({
|
|
107
118
|
// replace with your actual napi-modules file path
|
|
108
|
-
napiModulesPath: path.resolve(__dirname,
|
|
119
|
+
napiModulesPath: path.resolve(__dirname, "./index.napi-modules.ts"),
|
|
109
120
|
}),
|
|
110
121
|
],
|
|
111
122
|
});
|
|
@@ -116,10 +127,10 @@
|
|
|
116
127
|
```ts
|
|
117
128
|
// index.napi-modules.ts
|
|
118
129
|
export default {
|
|
119
|
-
custom_module: function(NapiModules, NapiModulesCall) {
|
|
130
|
+
custom_module: function (NapiModules, NapiModulesCall) {
|
|
120
131
|
return {
|
|
121
132
|
async test(name) {
|
|
122
|
-
console.log(
|
|
133
|
+
console.log("CustomModule", NapiModules, NapiModulesCall);
|
|
123
134
|
},
|
|
124
135
|
};
|
|
125
136
|
},
|
|
@@ -171,25 +182,25 @@
|
|
|
171
182
|
lynxView.initI18nResources = [
|
|
172
183
|
{
|
|
173
184
|
options: {
|
|
174
|
-
locale:
|
|
175
|
-
channel:
|
|
176
|
-
fallback_url:
|
|
185
|
+
locale: "en",
|
|
186
|
+
channel: "1",
|
|
187
|
+
fallback_url: "",
|
|
177
188
|
},
|
|
178
189
|
resource: {
|
|
179
|
-
hello:
|
|
180
|
-
lynx:
|
|
190
|
+
hello: "hello",
|
|
191
|
+
lynx: "lynx web platform1",
|
|
181
192
|
},
|
|
182
193
|
},
|
|
183
194
|
];
|
|
184
|
-
lynxView.addEventListener(
|
|
195
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
185
196
|
console.log(e);
|
|
186
197
|
});
|
|
187
198
|
|
|
188
199
|
// mts
|
|
189
200
|
_I18nResourceTranslation({
|
|
190
|
-
locale:
|
|
191
|
-
channel:
|
|
192
|
-
fallback_url:
|
|
201
|
+
locale: "en",
|
|
202
|
+
channel: "1",
|
|
203
|
+
fallback_url: "",
|
|
193
204
|
});
|
|
194
205
|
```
|
|
195
206
|
|
|
@@ -439,8 +450,8 @@
|
|
|
439
450
|
}
|
|
440
451
|
};`,
|
|
441
452
|
],
|
|
442
|
-
{ type:
|
|
443
|
-
)
|
|
453
|
+
{ type: "text/javascript" }
|
|
454
|
+
)
|
|
444
455
|
),
|
|
445
456
|
};
|
|
446
457
|
lynxView.nativeModulesMap = nativeModulesMap;
|
|
@@ -530,8 +541,8 @@
|
|
|
530
541
|
};
|
|
531
542
|
};`,
|
|
532
543
|
],
|
|
533
|
-
{ type:
|
|
534
|
-
)
|
|
544
|
+
{ type: "text/javascript" }
|
|
545
|
+
)
|
|
535
546
|
);
|
|
536
547
|
|
|
537
548
|
const color_methods = URL.createObjectURL(
|
|
@@ -546,8 +557,8 @@
|
|
|
546
557
|
};
|
|
547
558
|
};`,
|
|
548
559
|
],
|
|
549
|
-
{ type:
|
|
550
|
-
)
|
|
560
|
+
{ type: "text/javascript" }
|
|
561
|
+
)
|
|
551
562
|
);
|
|
552
563
|
|
|
553
564
|
lynxView.napiModuleMap = {
|
|
@@ -564,7 +575,7 @@
|
|
|
564
575
|
|
|
565
576
|
```js
|
|
566
577
|
lynxView.onNapiModulesCall = (name, data, moduleName) => {
|
|
567
|
-
if (name ===
|
|
578
|
+
if (name === "getColor" && moduleName === "color_methods") {
|
|
568
579
|
return data.color;
|
|
569
580
|
}
|
|
570
581
|
};
|
|
@@ -619,8 +630,8 @@
|
|
|
619
630
|
}
|
|
620
631
|
};`,
|
|
621
632
|
],
|
|
622
|
-
{ type:
|
|
623
|
-
)
|
|
633
|
+
{ type: "text/javascript" }
|
|
634
|
+
)
|
|
624
635
|
);
|
|
625
636
|
```
|
|
626
637
|
|
|
@@ -632,7 +643,7 @@
|
|
|
632
643
|
|
|
633
644
|
```js
|
|
634
645
|
lynxView.onNativeModulesCall = (name, data, callback) => {
|
|
635
|
-
if (name ===
|
|
646
|
+
if (name === "getColor") {
|
|
636
647
|
callback(data.color);
|
|
637
648
|
}
|
|
638
649
|
};
|
|
@@ -642,7 +653,7 @@
|
|
|
642
653
|
|
|
643
654
|
```js
|
|
644
655
|
lynxView.onNativeModulesCall = (name, data, moduleName) => {
|
|
645
|
-
if (name ===
|
|
656
|
+
if (name === "getColor" && moduleName === "bridge") {
|
|
646
657
|
return data.color;
|
|
647
658
|
}
|
|
648
659
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callLepusMethodEndpoint, setNativePropsEndpoint, triggerComponentEventEndpoint, selectComponentEndpoint,
|
|
1
|
+
import { callLepusMethodEndpoint, setNativePropsEndpoint, triggerComponentEventEndpoint, selectComponentEndpoint, 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';
|
|
@@ -14,7 +14,7 @@ import { createGetPathInfo } from './crossThreadHandlers/createGetPathInfo.js';
|
|
|
14
14
|
let nativeAppCount = 0;
|
|
15
15
|
const sharedData = {};
|
|
16
16
|
export async function createNativeApp(config) {
|
|
17
|
-
const { mainThreadRpc, uiThreadRpc, template, nativeModulesMap, timingSystem,
|
|
17
|
+
const { mainThreadRpc, uiThreadRpc, template, nativeModulesMap, timingSystem, } = config;
|
|
18
18
|
const performanceApis = createPerformanceApis(timingSystem);
|
|
19
19
|
const callLepusMethod = mainThreadRpc.createCallbackify(callLepusMethodEndpoint, 2);
|
|
20
20
|
const setNativeProps = uiThreadRpc.createCall(setNativePropsEndpoint);
|
|
@@ -43,9 +43,6 @@ export async function createNativeApp(config) {
|
|
|
43
43
|
return Reflect.ownKeys(target).filter((key) => key !== 'globalThis');
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
|
-
Object.assign(lynxCoreInject.tt, {
|
|
47
|
-
SystemInfo: { ...systemInfo, ...browserConfig },
|
|
48
|
-
});
|
|
49
46
|
const ret = entry?.(lynxCoreInject.tt);
|
|
50
47
|
return ret;
|
|
51
48
|
},
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,11 +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
|
import { startBackgroundThread } from './backgroundThread/index.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { mode, toPeerThread, toUIThread } = ev
|
|
5
|
+
globalThis.onmessage = async (ev) => {
|
|
6
|
+
const { mode, toPeerThread, toUIThread, systemInfo } = ev
|
|
8
7
|
.data;
|
|
8
|
+
if (!globalThis.SystemInfo) {
|
|
9
|
+
globalThis.SystemInfo = systemInfo;
|
|
10
|
+
}
|
|
9
11
|
if (mode === 'main') {
|
|
12
|
+
const { startMainThreadWorker } = await import(
|
|
13
|
+
/* webpackChunkName: "web-worker-runtime-main-thread" */
|
|
14
|
+
/* webpackMode: "lazy-once" */
|
|
15
|
+
/* webpackPreload: true */
|
|
16
|
+
'./mainThread/startMainThread.js');
|
|
10
17
|
startMainThreadWorker(toUIThread, toPeerThread);
|
|
11
18
|
}
|
|
12
19
|
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-bb53d9a0",
|
|
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-bb53d9a0",
|
|
27
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.8-canary-20250826-bb53d9a0",
|
|
28
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.8-canary-20250826-bb53d9a0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@lynx-js/lynx-core": "0.1.3"
|