@lynx-js/web-worker-runtime 0.13.0 → 0.13.2
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 +43 -0
- package/dist/backgroundThread/background-apis/createBackgroundLynx.d.ts +1 -0
- package/dist/backgroundThread/background-apis/createBackgroundLynx.js +3 -0
- package/dist/backgroundThread/background-apis/createNativeApp.js +15 -2
- package/dist/backgroundThread/background-apis/createNativeModules.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/mainThread/startMainThread.d.ts +4 -1
- package/dist/mainThread/startMainThread.js +3 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @lynx-js/web-worker-runtime
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: allow lynx code to get JS engine provided properties on globalThis ([#786](https://github.com/lynx-family/lynx-stack/pull/786))
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
globalThis.Reflect; // this will be the Reflect Object
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Note that `assigning to the globalThis` is still not allowed.
|
|
14
|
+
|
|
15
|
+
- feat: return the offscreenDocument instance for startMainThread() ([#772](https://github.com/lynx-family/lynx-stack/pull/772))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`03a5f64`](https://github.com/lynx-family/lynx-stack/commit/03a5f64d7d09e38903f5d1c022f36f6e68b6432d), [`8cdd288`](https://github.com/lynx-family/lynx-stack/commit/8cdd28884288b9456aee3a919d6edbf72da1c67b), [`6d3d852`](https://github.com/lynx-family/lynx-stack/commit/6d3d8529d0d528419920102ca52da279bbe0f1e0)]:
|
|
18
|
+
- @lynx-js/web-mainthread-apis@0.13.2
|
|
19
|
+
- @lynx-js/web-constants@0.13.2
|
|
20
|
+
- @lynx-js/offscreen-document@0.0.3
|
|
21
|
+
- @lynx-js/web-worker-rpc@0.13.2
|
|
22
|
+
|
|
23
|
+
## 0.13.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- feat: support for using `lynx.queueMicrotask`. ([#702](https://github.com/lynx-family/lynx-stack/pull/702))
|
|
28
|
+
|
|
29
|
+
- feat: support touch events for MTS ([#641](https://github.com/lynx-family/lynx-stack/pull/641))
|
|
30
|
+
|
|
31
|
+
now we support
|
|
32
|
+
|
|
33
|
+
- main-thread:bindtouchstart
|
|
34
|
+
- main-thread:bindtouchend
|
|
35
|
+
- main-thread:bindtouchmove
|
|
36
|
+
- main-thread:bindtouchcancel
|
|
37
|
+
|
|
38
|
+
- feat: provide comments for `@lynx-js/web-platform-rsbuild-plugin`. ([#668](https://github.com/lynx-family/lynx-stack/pull/668))
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`c9ccad6`](https://github.com/lynx-family/lynx-stack/commit/c9ccad6b574c98121149d3e9d4a9a7e97af63d91), [`9ad394e`](https://github.com/lynx-family/lynx-stack/commit/9ad394ea9ef28688a3b810b4051868b2a28eb7de), [`c9ccad6`](https://github.com/lynx-family/lynx-stack/commit/c9ccad6b574c98121149d3e9d4a9a7e97af63d91)]:
|
|
41
|
+
- @lynx-js/offscreen-document@0.0.2
|
|
42
|
+
- @lynx-js/web-mainthread-apis@0.13.1
|
|
43
|
+
- @lynx-js/web-constants@0.13.1
|
|
44
|
+
- @lynx-js/web-worker-rpc@0.13.1
|
|
45
|
+
|
|
3
46
|
## 0.13.0
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -11,4 +11,5 @@ export declare function createBackgroundLynx(config: CreateLynxConfig, nativeApp
|
|
|
11
11
|
getCoreContext(): LynxCrossThreadContext;
|
|
12
12
|
getCustomSectionSync(key: string): Cloneable;
|
|
13
13
|
getCustomSection: (key: string, callback: (object: Cloneable) => void) => void;
|
|
14
|
+
queueMicrotask: (callback: () => void) => void;
|
|
14
15
|
};
|
|
@@ -23,6 +23,9 @@ export function createBackgroundLynx(config, nativeApp, mainThreadRpc) {
|
|
|
23
23
|
return config.customSections[key];
|
|
24
24
|
},
|
|
25
25
|
getCustomSection: createGetCustomSection(mainThreadRpc, config.customSections),
|
|
26
|
+
queueMicrotask: (callback) => {
|
|
27
|
+
queueMicrotask(callback);
|
|
28
|
+
},
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=createBackgroundLynx.js.map
|
|
@@ -22,9 +22,22 @@ export async function createNativeApp(config) {
|
|
|
22
22
|
return {
|
|
23
23
|
init: (lynxCoreInject) => {
|
|
24
24
|
lynxCoreInject.tt.lynxCoreInject = lynxCoreInject;
|
|
25
|
-
lynxCoreInject.tt.globalThis ??= lynxCoreInject
|
|
25
|
+
lynxCoreInject.tt.globalThis ??= new Proxy(lynxCoreInject, {
|
|
26
|
+
get(target, prop) {
|
|
27
|
+
// @ts-expect-error
|
|
28
|
+
return target[prop] ?? globalThis[prop];
|
|
29
|
+
},
|
|
30
|
+
set(target, prop, value) {
|
|
31
|
+
// @ts-expect-error
|
|
32
|
+
target[prop] = value;
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
ownKeys(target) {
|
|
36
|
+
return Reflect.ownKeys(target).filter((key) => key !== 'globalThis');
|
|
37
|
+
},
|
|
38
|
+
});
|
|
26
39
|
Object.assign(lynxCoreInject.tt, {
|
|
27
|
-
SystemInfo: { ...systemInfo,
|
|
40
|
+
SystemInfo: { ...systemInfo, ...browserConfig },
|
|
28
41
|
});
|
|
29
42
|
const ret = entry?.(lynxCoreInject.tt);
|
|
30
43
|
return ret;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Lynx Authors. All rights reserved.
|
|
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
|
+
/* LYNX_NATIVE_MODULES_IMPORT */
|
|
4
5
|
import { nativeModulesCallEndpoint, switchExposureServiceEndpoint, } from '@lynx-js/web-constants';
|
|
5
6
|
export async function createNativeModules(uiThreadRpc, mainThreadRpc, nativeModulesMap) {
|
|
6
7
|
const switchExposure = mainThreadRpc.createCall(switchExposureServiceEndpoint);
|
|
@@ -21,6 +22,7 @@ export async function createNativeModules(uiThreadRpc, mainThreadRpc, nativeModu
|
|
|
21
22
|
const nativeModules = {};
|
|
22
23
|
const customNativeModules = {};
|
|
23
24
|
await Promise.all(Object.entries(nativeModulesMap).map(([moduleName, moduleStr]) => import(/* webpackIgnore: true */ moduleStr).then(module => customNativeModules[moduleName] = module?.default?.(nativeModules, (name, data) => nativeModulesCall(name, data, moduleName)))));
|
|
25
|
+
/* LYNX_NATIVE_MODULES_ADD */
|
|
24
26
|
return Object.assign(nativeModules, {
|
|
25
27
|
bridge: bridgeModule,
|
|
26
28
|
LynxExposureModule: lynxExposureModule,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { startBackgroundThread } from './backgroundThread/index.js';
|
|
5
5
|
import { startMainThread } from './mainThread/startMainThread.js';
|
|
6
|
-
|
|
6
|
+
globalThis.onmessage = (ev) => {
|
|
7
7
|
const { mode, toPeerThread, toUIThread } = ev
|
|
8
8
|
.data;
|
|
9
9
|
if (mode === 'main') {
|
|
@@ -16,4 +16,5 @@ self.onmessage = (ev) => {
|
|
|
16
16
|
Object.assign(globalThis, {
|
|
17
17
|
module: { exports: null },
|
|
18
18
|
});
|
|
19
|
+
export { startMainThread };
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { OffscreenDocument } from '@lynx-js/offscreen-document/webworker';
|
|
2
|
+
export declare function startMainThread(uiThreadPort: MessagePort, backgroundThreadPort: MessagePort): {
|
|
3
|
+
docu: OffscreenDocument;
|
|
4
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-worker-runtime",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@lynx-js/offscreen-document": "0.0.
|
|
26
|
-
"@lynx-js/web-constants": "0.13.
|
|
27
|
-
"@lynx-js/web-mainthread-apis": "0.13.
|
|
28
|
-
"@lynx-js/web-worker-rpc": "0.13.
|
|
25
|
+
"@lynx-js/offscreen-document": "0.0.3",
|
|
26
|
+
"@lynx-js/web-constants": "0.13.2",
|
|
27
|
+
"@lynx-js/web-mainthread-apis": "0.13.2",
|
|
28
|
+
"@lynx-js/web-worker-rpc": "0.13.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@lynx-js/lynx-core": "0.1.2"
|