@lynx-js/web-mainthread-apis-canary 0.17.2 → 0.18.0-canary-20251010-77397fd5
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 +27 -9
- package/dist/prepareMainThreadAPIs.d.ts +2 -1
- package/dist/prepareMainThreadAPIs.js +11 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
+
## 0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: ([#1837](https://github.com/lynx-family/lynx-stack/pull/1837))
|
|
8
|
+
|
|
9
|
+
1. `LynxView.updateData()` cannot trigger `dataProcessor`.
|
|
10
|
+
|
|
11
|
+
2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`77397fd`](https://github.com/lynx-family/lynx-stack/commit/77397fd535cf60556f8f82f7ef8dae8a623d1625)]:
|
|
18
|
+
- @lynx-js/web-constants@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
19
|
+
- @lynx-js/web-style-transformer@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
20
|
+
|
|
3
21
|
## 0.17.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -244,25 +262,25 @@
|
|
|
244
262
|
lynxView.initI18nResources = [
|
|
245
263
|
{
|
|
246
264
|
options: {
|
|
247
|
-
locale:
|
|
248
|
-
channel:
|
|
249
|
-
fallback_url:
|
|
265
|
+
locale: "en",
|
|
266
|
+
channel: "1",
|
|
267
|
+
fallback_url: "",
|
|
250
268
|
},
|
|
251
269
|
resource: {
|
|
252
|
-
hello:
|
|
253
|
-
lynx:
|
|
270
|
+
hello: "hello",
|
|
271
|
+
lynx: "lynx web platform1",
|
|
254
272
|
},
|
|
255
273
|
},
|
|
256
274
|
];
|
|
257
|
-
lynxView.addEventListener(
|
|
275
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
258
276
|
console.log(e);
|
|
259
277
|
});
|
|
260
278
|
|
|
261
279
|
// mts
|
|
262
280
|
_I18nResourceTranslation({
|
|
263
|
-
locale:
|
|
264
|
-
channel:
|
|
265
|
-
fallback_url:
|
|
281
|
+
locale: "en",
|
|
282
|
+
channel: "1",
|
|
283
|
+
fallback_url: "",
|
|
266
284
|
});
|
|
267
285
|
```
|
|
268
286
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Rpc, type StartMainThreadContextConfig, type RpcCallType, type reportErrorEndpoint, type I18nResourceTranslationOptions, type InitI18nResources, type I18nResources, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm, type TemplateLoader } from '@lynx-js/web-constants';
|
|
1
|
+
import { type Rpc, type StartMainThreadContextConfig, type RpcCallType, type reportErrorEndpoint, type I18nResourceTranslationOptions, type InitI18nResources, type I18nResources, type Cloneable, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm, type TemplateLoader, type UpdateDataOptions } from '@lynx-js/web-constants';
|
|
2
2
|
export declare function prepareMainThreadAPIs(backgroundThreadRpc: Rpc, rootDom: Document | ShadowRoot, document: Document, mtsRealm: JSRealm, commitDocument: (exposureChangedElements: HTMLElement[]) => Promise<void> | void, markTimingInternal: (timingKey: string, pipelineId?: string) => void, flushMarkTimingInternal: () => void, reportError: RpcCallType<typeof reportErrorEndpoint>, triggerI18nResourceFallback: (options: I18nResourceTranslationOptions) => void, initialI18nResources: (data: InitI18nResources) => I18nResources, loadTemplate: TemplateLoader, ssrHooks?: SSRDehydrateHooks): {
|
|
3
3
|
startMainThread: (config: StartMainThreadContextConfig, ssrHydrateInfo?: SSRHydrateInfo) => Promise<void>;
|
|
4
|
+
handleUpdatedData: (newData: Cloneable, options: UpdateDataOptions | undefined) => Promise<void>;
|
|
4
5
|
};
|
|
@@ -1,7 +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
|
-
import { BackgroundThreadStartEndpoint, publishEventEndpoint, publicComponentEventEndpoint, postExposureEndpoint, postTimingFlagsEndpoint, dispatchCoreContextOnBackgroundEndpoint, dispatchJSContextOnMainThreadEndpoint, LynxCrossThreadContext, switchExposureServiceEndpoint, getCacheI18nResourcesKey, dispatchI18nResourceEndpoint, } from '@lynx-js/web-constants';
|
|
4
|
+
import { BackgroundThreadStartEndpoint, publishEventEndpoint, publicComponentEventEndpoint, postExposureEndpoint, postTimingFlagsEndpoint, dispatchCoreContextOnBackgroundEndpoint, dispatchJSContextOnMainThreadEndpoint, LynxCrossThreadContext, switchExposureServiceEndpoint, getCacheI18nResourcesKey, dispatchI18nResourceEndpoint, updateDataEndpoint, } from '@lynx-js/web-constants';
|
|
5
5
|
import { registerCallLepusMethodHandler } from './crossThreadHandlers/registerCallLepusMethodHandler.js';
|
|
6
6
|
import { registerGetCustomSectionHandler } from './crossThreadHandlers/registerGetCustomSectionHandler.js';
|
|
7
7
|
import { createMainThreadGlobalThis } from './createMainThreadGlobalThis.js';
|
|
@@ -17,6 +17,7 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mt
|
|
|
17
17
|
const publicComponentEvent = backgroundThreadRpc.createCall(publicComponentEventEndpoint);
|
|
18
18
|
const postExposure = backgroundThreadRpc.createCall(postExposureEndpoint);
|
|
19
19
|
const dispatchI18nResource = backgroundThreadRpc.createCall(dispatchI18nResourceEndpoint);
|
|
20
|
+
const updateDataBackground = backgroundThreadRpc.createCall(updateDataEndpoint);
|
|
20
21
|
markTimingInternal('lepus_execute_start');
|
|
21
22
|
async function startMainThread(config, ssrHydrateInfo) {
|
|
22
23
|
let isFp = true;
|
|
@@ -140,6 +141,14 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mt
|
|
|
140
141
|
await mtsRealm.loadScript(template.lepusCode.root);
|
|
141
142
|
jsContext.__start(); // start the jsContext after the runtime is created
|
|
142
143
|
}
|
|
143
|
-
|
|
144
|
+
function handleUpdatedData(newData, options) {
|
|
145
|
+
const runtime = mtsRealm.globalWindow;
|
|
146
|
+
const processedData = runtime.processData
|
|
147
|
+
? runtime.processData(newData, options?.processorName)
|
|
148
|
+
: newData;
|
|
149
|
+
runtime.updatePage?.(processedData, options);
|
|
150
|
+
return updateDataBackground(processedData, options);
|
|
151
|
+
}
|
|
152
|
+
return { startMainThread, handleUpdatedData };
|
|
144
153
|
}
|
|
145
154
|
//# sourceMappingURL=prepareMainThreadAPIs.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-mainthread-apis-canary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-canary-20251010-77397fd5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"**/*.css"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.
|
|
28
|
-
"@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.
|
|
27
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.18.0-canary-20251010-77397fd5",
|
|
28
|
+
"@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.18.0-canary-20251010-77397fd5",
|
|
29
29
|
"hyphenate-style-name": "^1.1.0"
|
|
30
30
|
}
|
|
31
31
|
}
|