@lynx-js/web-constants-canary 0.16.1-canary-20250915-f24eb4a2 → 0.16.1-canary-20250915-608f375e

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,11 +1,13 @@
1
1
  # @lynx-js/web-constants
2
2
 
3
- ## 0.16.1-canary-20250915034450-f24eb4a20111a1e1ab4d485d866d5859100902ad
3
+ ## 0.16.1-canary-20250915073423-608f375e20732cc4c9f141bfbf9800ba6896100b
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - feat: supports lazy bundle. (This feature requires `@lynx-js/lynx-core >= 0.1.3`) ([#1235](https://github.com/lynx-family/lynx-stack/pull/1235))
8
+
7
9
  - Updated dependencies []:
8
- - @lynx-js/web-worker-rpc@0.16.1-canary-20250915034450-f24eb4a20111a1e1ab4d485d866d5859100902ad
10
+ - @lynx-js/web-worker-rpc@0.16.1-canary-20250915073423-608f375e20732cc4c9f141bfbf9800ba6896100b
9
11
 
10
12
  ## 0.16.0
11
13
 
@@ -3,7 +3,7 @@ import type { Cloneable, CloneableObject } from './types/Cloneable.js';
3
3
  import type { StartMainThreadContextConfig } from './types/MainThreadStartConfigs.js';
4
4
  import type { IdentifierType, InvokeCallbackRes } from './types/NativeApp.js';
5
5
  import type { ElementAnimationOptions } from './types/Element.js';
6
- import type { BackMainThreadContextConfig, MarkTiming } from './types/index.js';
6
+ import type { BackMainThreadContextConfig, LynxTemplate, MarkTiming } from './types/index.js';
7
7
  export declare const postExposureEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[{
8
8
  exposures: ExposureWorkerEvent[];
9
9
  disExposures: ExposureWorkerEvent[];
@@ -57,3 +57,11 @@ export declare const updateGlobalPropsEndpoint: import("@lynx-js/web-worker-rpc/
57
57
  export declare const updateI18nResourcesEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[Cloneable]>;
58
58
  export declare const updateI18nResourceEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[Cloneable]>;
59
59
  export declare const dispatchI18nResourceEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[Cloneable]>;
60
+ export declare const queryComponentEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[string], {
61
+ code: number;
62
+ detail: {
63
+ schema: string;
64
+ };
65
+ }>;
66
+ export declare const updateBTSTemplateCacheEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[string, LynxTemplate], void>;
67
+ export declare const loadTemplateMultiThread: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[string], LynxTemplate>;
package/dist/endpoints.js CHANGED
@@ -38,4 +38,7 @@ export const updateGlobalPropsEndpoint = createRpcEndpoint('updateGlobalProps',
38
38
  export const updateI18nResourcesEndpoint = createRpcEndpoint('updateI18nResources', false, false);
39
39
  export const updateI18nResourceEndpoint = createRpcEndpoint('updateI18nResource', false, false);
40
40
  export const dispatchI18nResourceEndpoint = createRpcEndpoint('dispatchI18nResource', false, false);
41
+ export const queryComponentEndpoint = createRpcEndpoint('queryComponent', false, true);
42
+ export const updateBTSTemplateCacheEndpoint = createRpcEndpoint('updateBTSTemplateCacheEndpoint', false, true);
43
+ export const loadTemplateMultiThread = createRpcEndpoint('loadTemplateMultiThread', false, true);
41
44
  //# sourceMappingURL=endpoints.js.map
@@ -80,7 +80,7 @@ export type AddClassPAPI = (element: WebFiberElementImpl, className: string) =>
80
80
  export type SetClassesPAPI = (element: WebFiberElementImpl, classNames: string | null) => void;
81
81
  export type AddInlineStylePAPI = (element: WebFiberElementImpl, key: number | string, value: string | number | null | undefined) => void;
82
82
  export type SetInlineStylesPAPI = (element: WebFiberElementImpl, value: string | Record<string, string> | undefined) => void;
83
- export type SetCSSIdPAPI = (elements: WebFiberElementImpl[], cssId: number | null) => void;
83
+ export type SetCSSIdPAPI = (elements: WebFiberElementImpl[], cssId: number | null, entryName: string | undefined) => void;
84
84
  export type GetPageElementPAPI = () => WebFiberElementImpl | undefined;
85
85
  export type MarkTemplateElementPAPI = (element: WebFiberElementImpl) => void;
86
86
  export type MarkPartElementPAPI = (element: WebFiberElementImpl, partId: string) => void;
@@ -90,6 +90,13 @@ interface JSErrorInfo {
90
90
  }
91
91
  export type ElementFromBinaryPAPI = (templateId: string, parentComponentUniId: number) => WebFiberElementImpl[];
92
92
  export type GetAttributeByNamePAPI = (element: WebFiberElementImpl, name: string) => string | null;
93
+ export type QueryComponentPAPI = (source: string, resultCallback?: (result: {
94
+ code: number;
95
+ data?: {
96
+ url: string;
97
+ evalResult: unknown;
98
+ };
99
+ }) => void) => null;
93
100
  export interface MainThreadGlobalThis {
94
101
  __ElementFromBinary: ElementFromBinaryPAPI;
95
102
  __GetTemplateParts?: GetTemplatePartsPAPI;
@@ -161,6 +168,8 @@ export interface MainThreadGlobalThis {
161
168
  __FlushElementTree: (_subTree: unknown, options: FlushElementTreeOptions) => void;
162
169
  _I18nResourceTranslation: (options: I18nResourceTranslationOptions) => unknown | undefined;
163
170
  _AddEventListener: (...args: unknown[]) => void;
171
+ __QueryComponent: QueryComponentPAPI;
172
+ processEvalResult?: (exports: unknown, schema: string) => unknown;
164
173
  renderPage: ((data: unknown) => void) | undefined;
165
174
  updatePage?: (data: Cloneable, options?: Record<string, string>) => void;
166
175
  runWorklet?: (obj: unknown, event: unknown) => void;
@@ -3,3 +3,4 @@ export interface MarkTiming {
3
3
  pipelineId?: string;
4
4
  timeStamp: number;
5
5
  }
6
+ export type MarkTimingInternal = (timingKey: string, pipelineId?: string, timeStamp?: number) => void;
@@ -82,7 +82,7 @@ export interface NativeApp {
82
82
  clearInterval: typeof clearInterval;
83
83
  requestAnimationFrame: (cb: () => void) => void;
84
84
  cancelAnimationFrame: (id: number) => void;
85
- loadScript: (sourceURL: string) => BundleInitReturnObj;
85
+ loadScript: (sourceURL: string, entryName?: string) => BundleInitReturnObj;
86
86
  loadScriptAsync(sourceURL: string, callback: (message: string | null, exports?: BundleInitReturnObj) => void): void;
87
87
  nativeModuleProxy: Record<string, any>;
88
88
  setNativeProps: (type: IdentifierType, identifier: string, component_id: string, first_only: boolean, native_props: Record<string, unknown>, root_unique_id: number | undefined) => void;
@@ -125,4 +125,13 @@ export interface NativeApp {
125
125
  i18nResource: I18nResource;
126
126
  reportException: (error: Error, _: unknown) => void;
127
127
  __SetSourceMapRelease: (err: Error) => void;
128
+ queryComponent: (source: string, callback: (ret: {
129
+ __hasReady: boolean;
130
+ } | {
131
+ code: number;
132
+ detail?: {
133
+ schema: string;
134
+ };
135
+ }) => void) => void;
136
+ tt: NativeTTObject | null;
128
137
  }
@@ -0,0 +1,2 @@
1
+ import type { LynxTemplate } from './LynxModule.js';
2
+ export type TemplateLoader = (url: string) => Promise<LynxTemplate>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TemplateLoader.js.map
@@ -20,3 +20,4 @@ export * from './BackThreadStartConfigs.js';
20
20
  export * from './MarkTiming.js';
21
21
  export * from './SSR.js';
22
22
  export * from './JSRealm.js';
23
+ export * from './TemplateLoader.js';
@@ -20,4 +20,5 @@ export * from './BackThreadStartConfigs.js';
20
20
  export * from './MarkTiming.js';
21
21
  export * from './SSR.js';
22
22
  export * from './JSRealm.js';
23
+ export * from './TemplateLoader.js';
23
24
  //# sourceMappingURL=index.js.map
@@ -50,17 +50,13 @@ const templateUpgraders = [
50
50
  */
51
51
  template.manifest = Object.fromEntries(Object.entries(template.manifest).map(([key, value]) => [
52
52
  key,
53
- `module.exports={init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:null}; ${value}\n return module.exports; } }`,
54
- ]));
55
- template.lepusCode = Object.fromEntries(Object.entries(template.lepusCode).map(([key, value]) => [
56
- key,
57
- `(()=>{${value}\n})();`,
53
+ `module.exports={init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:{}}; var exports=module.exports; ${value}\n return module.exports; } }`,
58
54
  ]));
59
55
  template.version = 2;
60
56
  return template;
61
57
  },
62
58
  ];
63
- const generateModuleContent = (content, eager) =>
59
+ const generateModuleContent = (content, eager, appType) =>
64
60
  /**
65
61
  * About the `allFunctionsCalledOnLoad` directive:
66
62
  * https://v8.dev/blog/preparser#pife
@@ -76,13 +72,14 @@ const generateModuleContent = (content, eager) =>
76
72
  '\n(function() { "use strict"; const ',
77
73
  globalDisallowedVars.join('=void 0,'),
78
74
  '=void 0;\n',
75
+ appType === 'lazy' ? 'module.exports=\n' : '',
79
76
  content,
80
77
  '\n})()',
81
78
  ].join('');
82
- async function generateJavascriptUrl(obj, createJsModuleUrl, eager, templateName) {
79
+ async function generateJavascriptUrl(obj, createJsModuleUrl, eager, appType, templateName) {
83
80
  const processEntry = async ([name, content]) => [
84
81
  name,
85
- await createJsModuleUrl(generateModuleContent(content, eager), `${templateName}-${name.replaceAll('/', '')}.js`),
82
+ await createJsModuleUrl(generateModuleContent(content, eager, appType), `${templateName}-${name.replaceAll('/', '')}.js`),
86
83
  ];
87
84
  return Promise.all(Object.entries(obj).filter(([_, content]) => typeof content === 'string').map(processEntry)).then(Object.fromEntries);
88
85
  }
@@ -98,8 +95,8 @@ export async function generateTemplate(template, createJsModuleUrl, templateName
98
95
  }
99
96
  return {
100
97
  ...template,
101
- lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, true, templateName),
102
- manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, false, templateName),
98
+ lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, true, template.appType, templateName),
99
+ manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, false, template.appType, templateName),
103
100
  };
104
101
  }
105
102
  //# sourceMappingURL=generateTemplate.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-constants-canary",
3
- "version": "0.16.1-canary-20250915-f24eb4a2",
3
+ "version": "0.16.1-canary-20250915-608f375e",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -23,7 +23,7 @@
23
23
  "**/*.css"
24
24
  ],
25
25
  "dependencies": {
26
- "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.1-canary-20250915-f24eb4a2"
26
+ "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.1-canary-20250915-608f375e"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4"