@lynx-js/web-core 0.13.2 → 0.13.3

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,31 @@
1
1
  # @lynx-js/web-core
2
2
 
3
+ ## 0.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: code clean ([#897](https://github.com/lynx-family/lynx-stack/pull/897))
8
+
9
+ rename many internal apis to make logic be clear:
10
+
11
+ multi-thread: startMainWorker -> prepareMainThreadAPIs -> startMainThread -> createMainThreadContext(new MainThreadRuntime)
12
+ all-on-ui: prepareMainThreadAPIs -> startMainThread -> createMainThreadContext(new MainThreadRuntime)
13
+
14
+ - perf: improve dom operation performance ([#881](https://github.com/lynx-family/lynx-stack/pull/881))
15
+
16
+ - code clean for offscreen-document, cut down inheritance levels
17
+ - add `appendChild` method for OffscreenElement, improve performance for append one node
18
+ - bypass some JS getter for dumping SSR string
19
+
20
+ - fix: worker not released when backgroundWorkerContextCount != 1 ([#845](https://github.com/lynx-family/lynx-stack/pull/845))
21
+
22
+ - Updated dependencies [[`bb1f9d8`](https://github.com/lynx-family/lynx-stack/commit/bb1f9d845ef2395a0508666701409972e159389d), [`b6e27da`](https://github.com/lynx-family/lynx-stack/commit/b6e27daf865b0627b1c3238228a4fdf65ad87ee3), [`3d716d7`](https://github.com/lynx-family/lynx-stack/commit/3d716d79ae053b225e9bac2bbb036c968f5261e7)]:
23
+ - @lynx-js/offscreen-document@0.0.4
24
+ - @lynx-js/web-mainthread-apis@0.13.3
25
+ - @lynx-js/web-worker-runtime@0.13.3
26
+ - @lynx-js/web-constants@0.13.3
27
+ - @lynx-js/web-worker-rpc@0.13.3
28
+
3
29
  ## 0.13.2
4
30
 
5
31
  ### Patch Changes
@@ -36,6 +36,10 @@ export function bootWorkers(lynxGroupId, allOnUI) {
36
36
  backgroundWorkerContextCount[lynxGroupId] = 0;
37
37
  contextIdToBackgroundWorker[lynxGroupId] = undefined;
38
38
  }
39
+ else if (typeof backgroundWorkerContextCount[lynxGroupId] === 'number'
40
+ && backgroundWorkerContextCount[lynxGroupId] > 1) {
41
+ backgroundWorkerContextCount[lynxGroupId]--;
42
+ }
39
43
  },
40
44
  };
41
45
  }
@@ -1,8 +1,8 @@
1
- import type { MainThreadStartConfigs } from '@lynx-js/web-constants';
1
+ import type { StartMainThreadContextConfig } from '@lynx-js/web-constants';
2
2
  import { Rpc } from '@lynx-js/web-worker-rpc';
3
3
  export declare function createRenderAllOnUI(mainToBackgroundRpc: Rpc, shadowRoot: ShadowRoot, markTimingInternal: (timingKey: string, pipelineId?: string, timeStamp?: number) => void, callbacks: {
4
4
  onError?: () => void;
5
5
  }): {
6
- start: (configs: MainThreadStartConfigs) => Promise<void>;
6
+ start: (configs: StartMainThreadContextConfig) => Promise<void>;
7
7
  updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: Record<string, string>) => Promise<void>;
8
8
  };
@@ -1,13 +1,10 @@
1
1
  import { Rpc } from '@lynx-js/web-worker-rpc';
2
- const { loadMainThread, } = await import('@lynx-js/web-mainthread-apis');
2
+ const { prepareMainThreadAPIs, } = await import('@lynx-js/web-mainthread-apis');
3
3
  export function createRenderAllOnUI(mainToBackgroundRpc, shadowRoot, markTimingInternal, callbacks) {
4
4
  if (!globalThis.module) {
5
5
  Object.assign(globalThis, { module: {} });
6
6
  }
7
- const docu = Object.assign(shadowRoot, {
8
- createElement: document.createElement.bind(document),
9
- });
10
- const { startMainThread } = loadMainThread(mainToBackgroundRpc, docu, () => { }, markTimingInternal, () => {
7
+ const { startMainThread } = prepareMainThreadAPIs(mainToBackgroundRpc, shadowRoot, document.createElement.bind(document), () => { }, markTimingInternal, () => {
11
8
  callbacks.onError?.();
12
9
  });
13
10
  let runtime;
@@ -2,6 +2,6 @@ import type { Rpc } from '@lynx-js/web-worker-rpc';
2
2
  export declare function createRenderMultiThread(mainThreadRpc: Rpc, shadowRoot: ShadowRoot, callbacks: {
3
3
  onError?: () => void;
4
4
  }): {
5
- start: (args_0: import("@lynx-js/web-constants").MainThreadStartConfigs) => void;
5
+ start: (args_0: import("@lynx-js/web-constants").StartMainThreadContextConfig) => void;
6
6
  updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: Record<string, string>) => Promise<void>;
7
7
  };
@@ -1,9 +1,9 @@
1
1
  import type { LynxView } from '../apis/createLynxView.js';
2
- import { type LynxTemplate, type MainThreadStartConfigs, type NapiModulesCall, type NativeModulesCall } from '@lynx-js/web-constants';
2
+ import { type LynxTemplate, type StartMainThreadContextConfig, type NapiModulesCall, type NativeModulesCall } from '@lynx-js/web-constants';
3
3
  export type StartUIThreadCallbacks = {
4
4
  nativeModulesCall: NativeModulesCall;
5
5
  napiModulesCall: NapiModulesCall;
6
6
  onError?: () => void;
7
7
  customTemplateLoader?: (url: string) => Promise<LynxTemplate>;
8
8
  };
9
- export declare function startUIThread(templateUrl: string, configs: Omit<MainThreadStartConfigs, 'template'>, shadowRoot: ShadowRoot, lynxGroupId: number | undefined, threadStrategy: 'all-on-ui' | 'multi-thread', callbacks: StartUIThreadCallbacks): LynxView;
9
+ export declare function startUIThread(templateUrl: string, configs: Omit<StartMainThreadContextConfig, 'template'>, shadowRoot: ShadowRoot, lynxGroupId: number | undefined, threadStrategy: 'all-on-ui' | 'multi-thread', callbacks: StartUIThreadCallbacks): LynxView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-core",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -24,15 +24,15 @@
24
24
  "**/*.css"
25
25
  ],
26
26
  "dependencies": {
27
- "@lynx-js/offscreen-document": "0.0.3",
28
- "@lynx-js/web-constants": "0.13.2",
29
- "@lynx-js/web-mainthread-apis": "0.13.2",
30
- "@lynx-js/web-worker-rpc": "0.13.2",
31
- "@lynx-js/web-worker-runtime": "0.13.2"
27
+ "@lynx-js/offscreen-document": "0.0.4",
28
+ "@lynx-js/web-constants": "0.13.3",
29
+ "@lynx-js/web-mainthread-apis": "0.13.3",
30
+ "@lynx-js/web-worker-rpc": "0.13.3",
31
+ "@lynx-js/web-worker-runtime": "0.13.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@lynx-js/lynx-core": "0.1.2",
35
- "@lynx-js/web-elements": "0.7.2"
35
+ "@lynx-js/web-elements": "0.7.3"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@lynx-js/lynx-core": "0.1.2",