@lynx-js/web-worker-runtime 0.13.1 → 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 CHANGED
@@ -1,5 +1,25 @@
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
+
3
23
  ## 0.13.1
4
24
 
5
25
  ### Patch Changes
@@ -22,7 +22,20 @@ 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
40
  SystemInfo: { ...systemInfo, ...browserConfig },
28
41
  });
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { startMainThread } from './mainThread/startMainThread.js';
1
2
  export interface WorkerStartMessage {
2
3
  mode: 'main' | 'background';
3
4
  toPeerThread: MessagePort;
4
5
  toUIThread: MessagePort;
5
6
  }
7
+ export { startMainThread };
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
- self.onmessage = (ev) => {
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
- export declare function startMainThread(uiThreadPort: MessagePort, backgroundThreadPort: MessagePort): void;
1
+ import { OffscreenDocument } from '@lynx-js/offscreen-document/webworker';
2
+ export declare function startMainThread(uiThreadPort: MessagePort, backgroundThreadPort: MessagePort): {
3
+ docu: OffscreenDocument;
4
+ };
@@ -24,5 +24,8 @@ export function startMainThread(uiThreadPort, backgroundThreadPort) {
24
24
  registerUpdateDataHandler(uiThreadRpc, runtime);
25
25
  });
26
26
  });
27
+ return {
28
+ docu,
29
+ };
27
30
  }
28
31
  //# sourceMappingURL=startMainThread.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-worker-runtime",
3
- "version": "0.13.1",
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.2",
26
- "@lynx-js/web-constants": "0.13.1",
27
- "@lynx-js/web-mainthread-apis": "0.13.1",
28
- "@lynx-js/web-worker-rpc": "0.13.1"
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"