@lynx-js/web-mainthread-apis-canary 0.15.8-canary-20250827-60c81a1e → 0.16.0-canary-20250828-c1f8715a
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,14 +1,26 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.16.0-canary-20250828064127-c1f8715a81b2e69ff46fc363013626db4468c209
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- refactor: provide the mts a real globalThis ([#1589](https://github.com/lynx-family/lynx-stack/pull/1589))
|
|
8
|
+
|
|
9
|
+
Before this change, We create a function wrapper and a fake globalThis for Javascript code.
|
|
10
|
+
|
|
11
|
+
This caused some issues.
|
|
12
|
+
|
|
13
|
+
After this change, we will create an iframe for createing an isolated Javascript context.
|
|
14
|
+
|
|
15
|
+
This means the globalThis will be the real one.
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
6
18
|
|
|
7
19
|
- fix: the SystemInfo in bts should be assigned to the globalThis ([#1599](https://github.com/lynx-family/lynx-stack/pull/1599))
|
|
8
20
|
|
|
9
|
-
- Updated dependencies [[`bb53d9a`](https://github.com/lynx-family/lynx-stack/commit/bb53d9a035f607e7c89952098d4ed77877a2e3c1)]:
|
|
10
|
-
- @lynx-js/web-constants@0.
|
|
11
|
-
- @lynx-js/web-style-transformer@0.
|
|
21
|
+
- Updated dependencies [[`bb53d9a`](https://github.com/lynx-family/lynx-stack/commit/bb53d9a035f607e7c89952098d4ed77877a2e3c1), [`c1f8715`](https://github.com/lynx-family/lynx-stack/commit/c1f8715a81b2e69ff46fc363013626db4468c209)]:
|
|
22
|
+
- @lynx-js/web-constants@0.16.0-canary-20250828064127-c1f8715a81b2e69ff46fc363013626db4468c209
|
|
23
|
+
- @lynx-js/web-style-transformer@0.16.0-canary-20250828064127-c1f8715a81b2e69ff46fc363013626db4468c209
|
|
12
24
|
|
|
13
25
|
## 0.15.7
|
|
14
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LynxTemplate, type PageConfig, type StyleInfo, type FlushElementTreeOptions, type Cloneable, type BrowserConfig, type publishEventEndpoint, type publicComponentEventEndpoint, type reportErrorEndpoint, type RpcCallType, type LynxContextEventTarget, type
|
|
1
|
+
import { type LynxTemplate, type PageConfig, type StyleInfo, type FlushElementTreeOptions, type Cloneable, type BrowserConfig, type publishEventEndpoint, type publicComponentEventEndpoint, type reportErrorEndpoint, type RpcCallType, type LynxContextEventTarget, type MainThreadGlobalThis, type WebFiberElementImpl, type I18nResourceTranslationOptions, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm } from '@lynx-js/web-constants';
|
|
2
2
|
export interface MainThreadRuntimeCallbacks {
|
|
3
3
|
mainChunkReady: () => void;
|
|
4
4
|
flushElementTree: (options: FlushElementTreeOptions, timingFlags: string[], exposureChangedElements: WebFiberElementImpl[]) => void;
|
|
@@ -7,7 +7,6 @@ export interface MainThreadRuntimeCallbacks {
|
|
|
7
7
|
markTiming: (pipelineId: string, timingKey: string) => void;
|
|
8
8
|
publishEvent: RpcCallType<typeof publishEventEndpoint>;
|
|
9
9
|
publicComponentEvent: RpcCallType<typeof publicComponentEventEndpoint>;
|
|
10
|
-
createElement: (tag: string) => WebFiberElementImpl;
|
|
11
10
|
_I18nResourceTranslation: (options: I18nResourceTranslationOptions) => unknown | undefined;
|
|
12
11
|
}
|
|
13
12
|
export interface MainThreadRuntimeConfig {
|
|
@@ -15,14 +14,14 @@ export interface MainThreadRuntimeConfig {
|
|
|
15
14
|
globalProps: unknown;
|
|
16
15
|
callbacks: MainThreadRuntimeCallbacks;
|
|
17
16
|
styleInfo: StyleInfo;
|
|
18
|
-
|
|
19
|
-
elementTemplate: LynxTemplate['elementTemplate'];
|
|
20
|
-
lepusCode: Record<string, LynxJSModule>;
|
|
17
|
+
lynxTemplate: LynxTemplate;
|
|
21
18
|
browserConfig: BrowserConfig;
|
|
22
19
|
tagMap: Record<string, string>;
|
|
23
20
|
rootDom: Pick<Element, 'append' | 'addEventListener'> & Partial<Pick<ShadowRoot, 'querySelectorAll' | 'cloneNode'>>;
|
|
24
21
|
jsContext: LynxContextEventTarget;
|
|
25
22
|
ssrHydrateInfo?: SSRHydrateInfo;
|
|
26
23
|
ssrHooks?: SSRDehydrateHooks;
|
|
24
|
+
mtsRealm: JSRealm;
|
|
25
|
+
document: Document;
|
|
27
26
|
}
|
|
28
27
|
export declare function createMainThreadGlobalThis(config: MainThreadRuntimeConfig): MainThreadGlobalThis;
|
|
@@ -1,8 +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 { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute,
|
|
5
|
-
import { globalMuteableVars } from '@lynx-js/web-constants';
|
|
4
|
+
import { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute, } from '@lynx-js/web-constants';
|
|
6
5
|
import { createMainThreadLynx } from './createMainThreadLynx.js';
|
|
7
6
|
import { flattenStyleInfo, genCssContent, genCssOGInfo, transformToWebCss, } from './utils/processStyleInfo.js';
|
|
8
7
|
import { __AddClass, __AddConfig, __AddDataset, __AddInlineStyle, __AppendElement, __ElementIsEqual, __FirstElement, __GetAttributes, __GetChildren, __GetClasses, __GetComponentID, __GetDataByKey, __GetDataset, __GetElementConfig, __GetElementUniqueID, __GetID, __GetParent, __GetTag, __GetTemplateParts, __InsertElementBefore, __LastElement, __MarkPartElement, __MarkTemplateElement, __NextElement, __RemoveElement, __ReplaceElement, __ReplaceElements, __SetClasses, __SetConfig, __SetCSSId, __SetDataset, __SetID, __SetInlineStyles, __UpdateComponentID, __UpdateComponentInfo, __GetAttributeByName, } from './pureElementPAPIs.js';
|
|
@@ -22,19 +21,14 @@ const exposureRelatedAttributes = new Set([
|
|
|
22
21
|
]);
|
|
23
22
|
export function createMainThreadGlobalThis(config) {
|
|
24
23
|
let timingFlags = [];
|
|
25
|
-
|
|
26
|
-
const {
|
|
24
|
+
const { callbacks, tagMap, pageConfig, lynxTemplate, rootDom, globalProps, styleInfo, ssrHydrateInfo, ssrHooks, mtsRealm, document, } = config;
|
|
25
|
+
const { elementTemplate, lepusCode } = lynxTemplate;
|
|
27
26
|
const lynxUniqueIdToElement = ssrHydrateInfo?.lynxUniqueIdToElement ?? [];
|
|
28
27
|
const lynxUniqueIdToStyleRulesIndex = ssrHydrateInfo?.lynxUniqueIdToStyleRulesIndex ?? [];
|
|
29
28
|
const elementToRuntimeInfoMap = new WeakMap();
|
|
30
29
|
let pageElement = lynxUniqueIdToElement[1]
|
|
31
30
|
?.deref();
|
|
32
31
|
let uniqueIdInc = lynxUniqueIdToElement.length || 1;
|
|
33
|
-
/**
|
|
34
|
-
* for "update" the globalThis.val in the main thread
|
|
35
|
-
*/
|
|
36
|
-
const varsUpdateHandlers = [];
|
|
37
|
-
const lynxGlobalBindingValues = {};
|
|
38
32
|
const exposureChangedElements = new Set();
|
|
39
33
|
/**
|
|
40
34
|
* now create the style content
|
|
@@ -54,7 +48,7 @@ export function createMainThreadGlobalThis(config) {
|
|
|
54
48
|
cardStyleElement = ssrHydrateInfo.cardStyleElement;
|
|
55
49
|
}
|
|
56
50
|
else {
|
|
57
|
-
cardStyleElement =
|
|
51
|
+
cardStyleElement = document.createElement('style');
|
|
58
52
|
cardStyleElement.innerHTML = genCssContent(styleInfo, pageConfig);
|
|
59
53
|
rootDom.append(cardStyleElement);
|
|
60
54
|
}
|
|
@@ -107,7 +101,8 @@ export function createMainThreadGlobalThis(config) {
|
|
|
107
101
|
crossThreadEvent.currentTarget
|
|
108
102
|
.elementRefptr = event.currentTarget;
|
|
109
103
|
}
|
|
110
|
-
|
|
104
|
+
mtsRealm.globalWindow
|
|
105
|
+
.runWorklet?.(hname.value, [crossThreadEvent]);
|
|
111
106
|
}
|
|
112
107
|
}
|
|
113
108
|
return false;
|
|
@@ -227,7 +222,7 @@ export function createMainThreadGlobalThis(config) {
|
|
|
227
222
|
const __CreateElement = (tag, parentComponentUniqueId) => {
|
|
228
223
|
const uniqueId = uniqueIdInc++;
|
|
229
224
|
const htmlTag = tagMap[tag] ?? tag;
|
|
230
|
-
const element =
|
|
225
|
+
const element = document.createElement(htmlTag);
|
|
231
226
|
lynxUniqueIdToElement[uniqueId] = new WeakRef(element);
|
|
232
227
|
const parentComponentCssID = lynxUniqueIdToElement[parentComponentUniqueId]
|
|
233
228
|
?.deref()?.getAttribute(cssIdAttribute);
|
|
@@ -326,9 +321,11 @@ export function createMainThreadGlobalThis(config) {
|
|
|
326
321
|
elementToRuntimeInfoMap.set(element, runtimeInfo);
|
|
327
322
|
};
|
|
328
323
|
const __SwapElement = (childA, childB) => {
|
|
329
|
-
const temp =
|
|
324
|
+
const temp = document.createElement('div');
|
|
325
|
+
// @ts-expect-error fixme
|
|
330
326
|
childA.replaceWith(temp);
|
|
331
327
|
childB.replaceWith(childA);
|
|
328
|
+
// @ts-expect-error fixme
|
|
332
329
|
temp.replaceWith(childB);
|
|
333
330
|
};
|
|
334
331
|
const __SetCSSIdForCSSOG = (elements, cssId) => {
|
|
@@ -351,13 +348,13 @@ export function createMainThreadGlobalThis(config) {
|
|
|
351
348
|
updateCssOGStyle(Number(element.getAttribute(lynxUniqueIdAttribute)), newStyleStr ?? '');
|
|
352
349
|
};
|
|
353
350
|
const __LoadLepusChunk = (path) => {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
entry?.(mtsGlobalThis);
|
|
351
|
+
try {
|
|
352
|
+
path = lepusCode?.[path] ?? path;
|
|
353
|
+
mtsRealm.loadScriptSync(path);
|
|
358
354
|
return true;
|
|
359
355
|
}
|
|
360
|
-
|
|
356
|
+
catch (e) {
|
|
357
|
+
console.error(`failed to load lepus chunk ${path}`, e);
|
|
361
358
|
return false;
|
|
362
359
|
}
|
|
363
360
|
};
|
|
@@ -412,7 +409,7 @@ export function createMainThreadGlobalThis(config) {
|
|
|
412
409
|
}
|
|
413
410
|
};
|
|
414
411
|
const __ElementFromBinary = (templateId, parentComponentUniId) => {
|
|
415
|
-
const elementTemplateData =
|
|
412
|
+
const elementTemplateData = elementTemplate[templateId];
|
|
416
413
|
if (elementTemplateData) {
|
|
417
414
|
let clonedElements;
|
|
418
415
|
if (templateIdToTemplate[templateId]) {
|
|
@@ -421,7 +418,7 @@ export function createMainThreadGlobalThis(config) {
|
|
|
421
418
|
else {
|
|
422
419
|
clonedElements = elementTemplateData.map(data => createElementForElementTemplateData(data, parentComponentUniId));
|
|
423
420
|
if (rootDom.cloneNode) {
|
|
424
|
-
const template =
|
|
421
|
+
const template = document.createElement('template');
|
|
425
422
|
template.content.append(...clonedElements);
|
|
426
423
|
templateIdToTemplate[templateId] = template;
|
|
427
424
|
rootDom.append(template);
|
|
@@ -513,53 +510,22 @@ export function createMainThreadGlobalThis(config) {
|
|
|
513
510
|
_SetSourceMapRelease: (errInfo) => release = errInfo?.release,
|
|
514
511
|
__OnLifecycleEvent: callbacks.__OnLifecycleEvent,
|
|
515
512
|
__FlushElementTree,
|
|
516
|
-
__lynxGlobalBindingValues: lynxGlobalBindingValues,
|
|
517
513
|
_I18nResourceTranslation: callbacks._I18nResourceTranslation,
|
|
518
514
|
_AddEventListener: () => { },
|
|
519
|
-
|
|
520
|
-
varsUpdateHandlers.push(handler);
|
|
521
|
-
},
|
|
522
|
-
set renderPage(foo) {
|
|
523
|
-
renderPage = foo;
|
|
524
|
-
queueMicrotask(callbacks.mainChunkReady);
|
|
525
|
-
},
|
|
526
|
-
get renderPage() {
|
|
527
|
-
return renderPage;
|
|
528
|
-
},
|
|
515
|
+
renderPage: undefined,
|
|
529
516
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
if (prop === 'globalThis') {
|
|
536
|
-
return target;
|
|
537
|
-
}
|
|
538
|
-
// @ts-expect-error
|
|
539
|
-
return target[prop] ?? globalThis[prop];
|
|
540
|
-
},
|
|
541
|
-
set: (target, prop, value) => {
|
|
542
|
-
// @ts-expect-error
|
|
543
|
-
target[prop] = value;
|
|
544
|
-
return true;
|
|
517
|
+
Object.assign(mtsRealm.globalWindow, mtsGlobalThis);
|
|
518
|
+
Object.defineProperty(mtsRealm.globalWindow, 'renderPage', {
|
|
519
|
+
get() {
|
|
520
|
+
return mtsGlobalThis.renderPage;
|
|
545
521
|
},
|
|
546
|
-
|
|
547
|
-
|
|
522
|
+
set(v) {
|
|
523
|
+
mtsGlobalThis.renderPage = v;
|
|
524
|
+
queueMicrotask(callbacks.mainChunkReady);
|
|
548
525
|
},
|
|
526
|
+
configurable: true,
|
|
527
|
+
enumerable: true,
|
|
549
528
|
});
|
|
550
|
-
|
|
551
|
-
Object.defineProperty(mtsGlobalThis, nm, {
|
|
552
|
-
get: () => {
|
|
553
|
-
return lynxGlobalBindingValues[nm];
|
|
554
|
-
},
|
|
555
|
-
set: (v) => {
|
|
556
|
-
lynxGlobalBindingValues[nm] = v;
|
|
557
|
-
for (const handler of varsUpdateHandlers) {
|
|
558
|
-
handler();
|
|
559
|
-
}
|
|
560
|
-
},
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
return mtsGlobalThis;
|
|
529
|
+
return mtsRealm.globalWindow;
|
|
564
530
|
}
|
|
565
531
|
//# sourceMappingURL=createMainThreadGlobalThis.js.map
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import {} from './createMainThreadGlobalThis.js';
|
|
2
2
|
export function createMainThreadLynx(config, SystemInfo) {
|
|
3
|
+
const requestAnimationFrameBrowserImpl = requestAnimationFrame;
|
|
4
|
+
const cancelAnimationFrameBrowserImpl = cancelAnimationFrame;
|
|
5
|
+
const setTimeoutBrowserImpl = setTimeout;
|
|
6
|
+
const clearTimeoutBrowserImpl = clearTimeout;
|
|
7
|
+
const setIntervalBrowserImpl = setInterval;
|
|
8
|
+
const clearIntervalBrowserImpl = clearInterval;
|
|
3
9
|
return {
|
|
4
10
|
getJSContext() {
|
|
5
11
|
return config.jsContext;
|
|
6
12
|
},
|
|
7
13
|
requestAnimationFrame(cb) {
|
|
8
|
-
return
|
|
14
|
+
return requestAnimationFrameBrowserImpl(cb);
|
|
9
15
|
},
|
|
10
16
|
cancelAnimationFrame(handler) {
|
|
11
|
-
return
|
|
17
|
+
return cancelAnimationFrameBrowserImpl(handler);
|
|
12
18
|
},
|
|
13
19
|
__globalProps: config.globalProps,
|
|
14
20
|
getCustomSectionSync(key) {
|
|
15
|
-
return config.customSections[key]?.content;
|
|
21
|
+
return config.lynxTemplate.customSections[key]?.content;
|
|
16
22
|
},
|
|
17
23
|
markPipelineTiming: config.callbacks.markTiming,
|
|
18
24
|
SystemInfo,
|
|
25
|
+
setTimeout: setTimeoutBrowserImpl,
|
|
26
|
+
clearTimeout: clearTimeoutBrowserImpl,
|
|
27
|
+
setInterval: setIntervalBrowserImpl,
|
|
28
|
+
clearInterval: clearIntervalBrowserImpl,
|
|
19
29
|
};
|
|
20
30
|
}
|
|
21
31
|
//# sourceMappingURL=createMainThreadLynx.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Rpc, type StartMainThreadContextConfig, type RpcCallType, type reportErrorEndpoint, type
|
|
2
|
-
export declare function prepareMainThreadAPIs(backgroundThreadRpc: Rpc, rootDom: Document | ShadowRoot,
|
|
3
|
-
startMainThread: (config: StartMainThreadContextConfig, ssrHydrateInfo?: SSRHydrateInfo) => Promise<
|
|
1
|
+
import { type Rpc, type StartMainThreadContextConfig, type RpcCallType, type reportErrorEndpoint, type I18nResourceTranslationOptions, type InitI18nResources, type I18nResources, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm } from '@lynx-js/web-constants';
|
|
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, ssrHooks?: SSRDehydrateHooks): {
|
|
3
|
+
startMainThread: (config: StartMainThreadContextConfig, ssrHydrateInfo?: SSRHydrateInfo) => Promise<void>;
|
|
4
4
|
};
|
|
@@ -8,8 +8,7 @@ import { createMainThreadGlobalThis } from './createMainThreadGlobalThis.js';
|
|
|
8
8
|
import { createExposureService } from './utils/createExposureService.js';
|
|
9
9
|
import { initWasm } from '@lynx-js/web-style-transformer';
|
|
10
10
|
const initWasmPromise = initWasm();
|
|
11
|
-
|
|
12
|
-
export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, createElement, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, ssrHooks) {
|
|
11
|
+
export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, ssrHooks) {
|
|
13
12
|
const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
|
|
14
13
|
const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
|
|
15
14
|
const publishEvent = backgroundThreadRpc.createCall(publishEventEndpoint);
|
|
@@ -20,26 +19,9 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, createElemen
|
|
|
20
19
|
async function startMainThread(config, ssrHydrateInfo) {
|
|
21
20
|
let isFp = true;
|
|
22
21
|
const { globalProps, template, browserConfig, nativeModulesMap, napiModulesMap, tagMap, initI18nResources, } = config;
|
|
23
|
-
const { styleInfo, pageConfig, customSections, cardType,
|
|
22
|
+
const { styleInfo, pageConfig, customSections, cardType, } = template;
|
|
24
23
|
markTimingInternal('decode_start');
|
|
25
24
|
await initWasmPromise;
|
|
26
|
-
const lepusCodeEntries = await Promise.all(Object.entries(lepusCode).map(async ([name, url]) => {
|
|
27
|
-
const cachedModule = moduleCache[url];
|
|
28
|
-
if (cachedModule) {
|
|
29
|
-
return [name, cachedModule];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const { default: evaluateModule } = await import(
|
|
33
|
-
/* webpackIgnore: true */ url);
|
|
34
|
-
const module = {
|
|
35
|
-
exports: evaluateModule,
|
|
36
|
-
};
|
|
37
|
-
moduleCache[url] = module;
|
|
38
|
-
return [name, module];
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
const lepusCodeLoaded = Object.fromEntries(lepusCodeEntries);
|
|
42
|
-
const entry = lepusCodeLoaded['root'].exports;
|
|
43
25
|
const jsContext = new LynxCrossThreadContext({
|
|
44
26
|
rpc: backgroundThreadRpc,
|
|
45
27
|
receiveEventEndpoint: dispatchJSContextOnMainThreadEndpoint,
|
|
@@ -47,18 +29,18 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, createElemen
|
|
|
47
29
|
});
|
|
48
30
|
const i18nResources = initialI18nResources(initI18nResources);
|
|
49
31
|
const mtsGlobalThis = createMainThreadGlobalThis({
|
|
32
|
+
lynxTemplate: template,
|
|
33
|
+
mtsRealm,
|
|
50
34
|
jsContext,
|
|
51
35
|
tagMap,
|
|
52
36
|
browserConfig,
|
|
53
|
-
customSections,
|
|
54
|
-
elementTemplate,
|
|
55
37
|
globalProps,
|
|
56
38
|
pageConfig,
|
|
57
39
|
styleInfo,
|
|
58
|
-
lepusCode: lepusCodeLoaded,
|
|
59
40
|
rootDom,
|
|
60
41
|
ssrHydrateInfo,
|
|
61
42
|
ssrHooks,
|
|
43
|
+
document,
|
|
62
44
|
callbacks: {
|
|
63
45
|
mainChunkReady: () => {
|
|
64
46
|
markTimingInternal('data_processor_start');
|
|
@@ -134,7 +116,6 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, createElemen
|
|
|
134
116
|
markTiming: (a, b) => markTimingInternal(b, a),
|
|
135
117
|
publishEvent,
|
|
136
118
|
publicComponentEvent,
|
|
137
|
-
createElement,
|
|
138
119
|
_I18nResourceTranslation: (options) => {
|
|
139
120
|
const matchedInitI18nResources = i18nResources.data?.find(i => getCacheI18nResourcesKey(i.options)
|
|
140
121
|
=== getCacheI18nResourcesKey(options));
|
|
@@ -147,9 +128,8 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, createElemen
|
|
|
147
128
|
},
|
|
148
129
|
});
|
|
149
130
|
markTimingInternal('decode_end');
|
|
150
|
-
|
|
131
|
+
await mtsRealm.loadScript(template.lepusCode.root);
|
|
151
132
|
jsContext.__start(); // start the jsContext after the runtime is created
|
|
152
|
-
return mtsGlobalThis;
|
|
153
133
|
}
|
|
154
134
|
return { startMainThread };
|
|
155
135
|
}
|
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.16.0-canary-20250828-c1f8715a",
|
|
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.16.0-canary-20250828-c1f8715a",
|
|
28
|
+
"@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.16.0-canary-20250828-c1f8715a",
|
|
29
29
|
"hyphenate-style-name": "^1.1.0"
|
|
30
30
|
}
|
|
31
31
|
}
|