@lynx-js/web-core-server 0.16.0 → 0.17.0

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,15 @@
1
1
  # @lynx-js/web-core-server
2
2
 
3
+ ## 0.17.0
4
+
5
+ ## 0.16.1
6
+
7
+ ### Patch Changes
8
+
9
+ - refactor: improve chunk loading ([#1703](https://github.com/lynx-family/lynx-stack/pull/1703))
10
+
11
+ - feat: supports lazy bundle. (This feature requires `@lynx-js/lynx-core >= 0.1.3`) ([#1235](https://github.com/lynx-family/lynx-stack/pull/1235))
12
+
3
13
  ## 0.16.0
4
14
 
5
15
  ### Minor Changes
package/dist/index.js CHANGED
@@ -4,17 +4,17 @@ import node_path from "node:path";
4
4
  import node_vm from "node:vm";
5
5
  import node_fs from "node:fs";
6
6
  var __webpack_modules__ = {
7
- "../web-style-transformer/dist/standard.js": function(module, __webpack_exports__, __webpack_require__) {
8
- __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
7
+ "../web-style-transformer/dist/standard.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
8
+ __webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
9
9
  try {
10
10
  __webpack_require__.d(__webpack_exports__, {
11
- M2: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.M2,
11
+ Fz: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.Fz,
12
12
  Qn: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.Qn,
13
13
  aC: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.aC,
14
14
  bL: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.bL,
15
15
  iG: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.iG,
16
16
  lI: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.lI,
17
- tZ: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.tZ,
17
+ qB: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.qB,
18
18
  yc: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_0__.yc
19
19
  });
20
20
  var _standard_bg_wasm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-style-transformer/dist/standard_bg.wasm");
@@ -31,40 +31,53 @@ var __webpack_modules__ = {
31
31
  }
32
32
  });
33
33
  },
34
- "../web-style-transformer/dist/standard_bg.js": function(module, __webpack_exports__, __webpack_require__) {
34
+ "../web-style-transformer/dist/standard_bg.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- M2: ()=>__wbg_new_78feb108b6472713,
36
+ Fz: ()=>__wbg_new_58353953ad2097cc,
37
37
  Qn: ()=>__wbindgen_throw,
38
38
  aC: ()=>transform_raw_u16_inline_style_ptr,
39
39
  bL: ()=>__wbindgen_init_externref_table,
40
40
  iG: ()=>transform_raw_u16_inline_style_ptr_parsed,
41
41
  lI: ()=>__wbg_set_wasm,
42
- tZ: ()=>__wbg_push_737cfc8c1432c2c6,
42
+ qB: ()=>__wbg_push_73fd7b5550ebf707,
43
43
  yc: ()=>__wbindgen_string_new
44
44
  });
45
- module = __webpack_require__.hmd(module);
46
45
  let wasm;
47
46
  function __wbg_set_wasm(val) {
48
47
  wasm = val;
49
48
  }
49
+ let cachedUint8ArrayMemory0 = null;
50
+ function getUint8ArrayMemory0() {
51
+ if (null === cachedUint8ArrayMemory0 || 0 === cachedUint8ArrayMemory0.byteLength) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
52
+ return cachedUint8ArrayMemory0;
53
+ }
50
54
  const lTextDecoder = 'undefined' == typeof TextDecoder ? (0, module.require)('util').TextDecoder : TextDecoder;
51
55
  let cachedTextDecoder = new lTextDecoder('utf-8', {
52
56
  ignoreBOM: true,
53
57
  fatal: true
54
58
  });
55
59
  cachedTextDecoder.decode();
56
- let cachedUint8ArrayMemory0 = null;
57
- function getUint8ArrayMemory0() {
58
- if (null === cachedUint8ArrayMemory0 || 0 === cachedUint8ArrayMemory0.byteLength) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
59
- return cachedUint8ArrayMemory0;
60
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
61
+ let numBytesDecoded = 0;
62
+ function decodeText(ptr, len) {
63
+ numBytesDecoded += len;
64
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
65
+ cachedTextDecoder = new lTextDecoder('utf-8', {
66
+ ignoreBOM: true,
67
+ fatal: true
68
+ });
69
+ cachedTextDecoder.decode();
70
+ numBytesDecoded = len;
71
+ }
72
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
60
73
  }
61
74
  function getStringFromWasm0(ptr, len) {
62
75
  ptr >>>= 0;
63
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
76
+ return decodeText(ptr, len);
64
77
  }
65
78
  let WASM_VECTOR_LEN = 0;
66
79
  const lTextEncoder = 'undefined' == typeof TextEncoder ? (0, module.require)('util').TextEncoder : TextEncoder;
67
- let cachedTextEncoder = new lTextEncoder('utf-8');
80
+ const cachedTextEncoder = new lTextEncoder('utf-8');
68
81
  const encodeString = 'function' == typeof cachedTextEncoder.encodeInto ? function(arg, view) {
69
82
  return cachedTextEncoder.encodeInto(arg, view);
70
83
  } : function(arg, view) {
@@ -122,11 +135,11 @@ var __webpack_modules__ = {
122
135
  const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
123
136
  return ret;
124
137
  }
125
- function __wbg_new_78feb108b6472713() {
138
+ function __wbg_new_58353953ad2097cc() {
126
139
  const ret = new Array();
127
140
  return ret;
128
141
  }
129
- function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
142
+ function __wbg_push_73fd7b5550ebf707(arg0, arg1) {
130
143
  const ret = arg0.push(arg1);
131
144
  return ret;
132
145
  }
@@ -147,13 +160,13 @@ var __webpack_modules__ = {
147
160
  throw new Error(getStringFromWasm0(arg0, arg1));
148
161
  }
149
162
  },
150
- "../web-style-transformer/standard.js": function(module, __webpack_exports__, __webpack_require__) {
151
- __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
163
+ "../web-style-transformer/standard.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
164
+ __webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
152
165
  try {
153
166
  __webpack_require__.r(__webpack_exports__);
154
167
  __webpack_require__.d(__webpack_exports__, {
155
- __wbg_new_78feb108b6472713: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.M2,
156
- __wbg_push_737cfc8c1432c2c6: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.tZ,
168
+ __wbg_new_58353953ad2097cc: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.Fz,
169
+ __wbg_push_73fd7b5550ebf707: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.qB,
157
170
  __wbg_set_wasm: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.lI,
158
171
  __wbindgen_init_externref_table: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.bL,
159
172
  __wbindgen_string_new: ()=>_dist_standard_js__WEBPACK_IMPORTED_MODULE_0__.yc,
@@ -172,13 +185,13 @@ var __webpack_modules__ = {
172
185
  }
173
186
  });
174
187
  },
175
- "../web-style-transformer/dist/standard_bg.wasm": function(module, exports, __webpack_require__) {
188
+ "../web-style-transformer/dist/standard_bg.wasm": function(module1, exports, __webpack_require__) {
176
189
  var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__("../web-style-transformer/dist/standard_bg.js");
177
- module.exports = __webpack_require__.v(exports, module.id, "431436911960378f", {
190
+ module1.exports = __webpack_require__.v(exports, module1.id, "8dc0062c26e8c5a1", {
178
191
  "./standard_bg.js": {
179
- __wbg_new_78feb108b6472713: WEBPACK_IMPORTED_MODULE_0.M2,
192
+ __wbg_new_58353953ad2097cc: WEBPACK_IMPORTED_MODULE_0.Fz,
180
193
  __wbindgen_string_new: WEBPACK_IMPORTED_MODULE_0.yc,
181
- __wbg_push_737cfc8c1432c2c6: WEBPACK_IMPORTED_MODULE_0.tZ,
194
+ __wbg_push_73fd7b5550ebf707: WEBPACK_IMPORTED_MODULE_0.qB,
182
195
  __wbindgen_throw: WEBPACK_IMPORTED_MODULE_0.Qn,
183
196
  __wbindgen_init_externref_table: WEBPACK_IMPORTED_MODULE_0.bL
184
197
  }
@@ -189,14 +202,12 @@ var __webpack_module_cache__ = {};
189
202
  function __webpack_require__(moduleId) {
190
203
  var cachedModule = __webpack_module_cache__[moduleId];
191
204
  if (void 0 !== cachedModule) return cachedModule.exports;
192
- var module = __webpack_module_cache__[moduleId] = {
205
+ var module1 = __webpack_module_cache__[moduleId] = {
193
206
  id: moduleId,
194
- loaded: false,
195
207
  exports: {}
196
208
  };
197
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
198
- module.loaded = true;
199
- return module.exports;
209
+ __webpack_modules__[moduleId](module1, module1.exports, __webpack_require__);
210
+ return module1.exports;
200
211
  }
201
212
  __webpack_require__.m = __webpack_modules__;
202
213
  (()=>{
@@ -233,11 +244,11 @@ __webpack_require__.m = __webpack_modules__;
233
244
  ret[webpackExports] = dep;
234
245
  return ret;
235
246
  });
236
- __webpack_require__.a = (module, body, hasAwait)=>{
247
+ __webpack_require__.a = (module1, body, hasAwait)=>{
237
248
  var queue;
238
249
  hasAwait && ((queue = []).d = -1);
239
250
  var depQueues = new Set();
240
- var exports = module.exports;
251
+ var exports = module1.exports;
241
252
  var currentDeps;
242
253
  var outerResolve;
243
254
  var reject;
@@ -249,7 +260,7 @@ __webpack_require__.m = __webpack_modules__;
249
260
  promise[webpackQueues] = (fn)=>{
250
261
  queue && fn(queue), depQueues.forEach(fn), promise["catch"](function() {});
251
262
  };
252
- module.exports = promise;
263
+ module1.exports = promise;
253
264
  body((deps)=>{
254
265
  currentDeps = wrapDeps(deps);
255
266
  var fn;
@@ -283,19 +294,6 @@ __webpack_require__.m = __webpack_modules__;
283
294
  return promises;
284
295
  }, []));
285
296
  })();
286
- (()=>{
287
- __webpack_require__.hmd = (module)=>{
288
- module = Object.create(module);
289
- if (!module.children) module.children = [];
290
- Object.defineProperty(module, 'exports', {
291
- enumerable: true,
292
- set: ()=>{
293
- throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);
294
- }
295
- });
296
- return module;
297
- };
298
- })();
299
297
  (()=>{
300
298
  __webpack_require__.u = (chunkId)=>"legacy-wasm-chunk.js";
301
299
  })();
@@ -653,6 +651,9 @@ createRpcEndpoint('updateGlobalProps', false, false);
653
651
  createRpcEndpoint('updateI18nResources', false, false);
654
652
  createRpcEndpoint('updateI18nResource', false, false);
655
653
  const dispatchI18nResourceEndpoint = createRpcEndpoint('dispatchI18nResource', false, false);
654
+ const queryComponentEndpoint = createRpcEndpoint('queryComponent', false, true);
655
+ const updateBTSTemplateCacheEndpoint = createRpcEndpoint('updateBTSTemplateCacheEndpoint', false, true);
656
+ createRpcEndpoint('loadTemplateMultiThread', false, true);
656
657
  var NativeApp_IdentifierType;
657
658
  (function(IdentifierType) {
658
659
  IdentifierType[IdentifierType["ID_SELECTOR"] = 0] = "ID_SELECTOR";
@@ -742,29 +743,28 @@ const globalDisallowedVars = [
742
743
  const templateUpgraders = [
743
744
  (template)=>{
744
745
  const defaultInjectStr = "Card,setTimeout,setInterval,clearInterval,clearTimeout,NativeModules,Component,ReactLynx,nativeAppId,Behavior,LynxJSBI,lynx,window,document,frames,location,navigator,localStorage,history,Caches,screen,alert,confirm,prompt,fetch,XMLHttpRequest,__WebSocket__,webkit,Reporter,print,global,requestAnimationFrame,cancelAnimationFrame";
746
+ template.appType = template.appType ?? (template.lepusCode.root.startsWith('(function (globDynamicComponentEntry') ? 'lazy' : 'card');
745
747
  template.manifest = Object.fromEntries(Object.entries(template.manifest).map(([key, value])=>[
746
748
  key,
747
- `{init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:null}; ${value}\n return module.exports; } }`
748
- ]));
749
- template.lepusCode = Object.fromEntries(Object.entries(template.lepusCode).map(([key, value])=>[
750
- key,
751
- `(()=>{${value}\n})();`
749
+ `module.exports={init: (lynxCoreInject) => { var {${defaultInjectStr}} = lynxCoreInject.tt; var module = {exports:{}}; var exports=module.exports; ${value}\n return module.exports; } }`
752
750
  ]));
753
751
  template.version = 2;
754
752
  return template;
755
753
  }
756
754
  ];
757
- const generateModuleContent = (content)=>[
758
- '//# allFunctionsCalledOnLoad\n',
759
- '"use strict";\n',
760
- `(() => {const ${globalDisallowedVars.join('=void 0,')}=void 0;module.exports = `,
755
+ const generateModuleContent = (content, eager, appType)=>[
756
+ eager ? '//# allFunctionsCalledOnLoad' : '',
757
+ '\n(function() { "use strict"; const ',
758
+ globalDisallowedVars.join('=void 0,'),
759
+ '=void 0;\n',
760
+ 'card' !== appType ? 'module.exports=\n' : '',
761
761
  content,
762
762
  '\n})()'
763
763
  ].join('');
764
- async function generateJavascriptUrl(obj, createJsModuleUrl, templateName) {
764
+ async function generateJavascriptUrl(obj, createJsModuleUrl, eager, appType, templateName) {
765
765
  const processEntry = async ([name, content])=>[
766
766
  name,
767
- await createJsModuleUrl(generateModuleContent(content), `${templateName}-${name.replaceAll('/', '')}.js`)
767
+ await createJsModuleUrl(generateModuleContent(content, eager, appType), `${templateName}-${name.replaceAll('/', '')}.js`)
768
768
  ];
769
769
  return Promise.all(Object.entries(obj).filter(([_, content])=>'string' == typeof content).map(processEntry)).then(Object.fromEntries);
770
770
  }
@@ -775,8 +775,8 @@ async function generateTemplate(template, createJsModuleUrl, templateName) {
775
775
  while(template.version < currentSupportedTemplateVersion && (upgrader = templateUpgraders[template.version - 1]))template = upgrader(template);
776
776
  return {
777
777
  ...template,
778
- lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, templateName),
779
- manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, templateName)
778
+ lepusCode: await generateJavascriptUrl(template.lepusCode, createJsModuleUrl, true, template.appType, templateName),
779
+ manifest: await generateJavascriptUrl(template.manifest, createJsModuleUrl, false, template.appType, templateName)
780
780
  };
781
781
  }
782
782
  function registerCallLepusMethodHandler(rpc, runtime) {
@@ -1199,8 +1199,11 @@ const __UpdateComponentInfo = /*#__PURE__*/ (element, params)=>{
1199
1199
  void 0 !== params.cssID && element.setAttribute(cssIdAttribute, params.cssID + '');
1200
1200
  void 0 !== params.name && element.setAttribute('name', params.name);
1201
1201
  };
1202
- const __SetCSSId = /*#__PURE__*/ (elements, cssId)=>{
1203
- for (const element of elements)element.setAttribute(cssIdAttribute, cssId + '');
1202
+ const __SetCSSId = /*#__PURE__*/ (elements, cssId, entryName)=>{
1203
+ for (const element of elements){
1204
+ element.setAttribute(cssIdAttribute, cssId + '');
1205
+ entryName && element.setAttribute(lynxEntryNameAttribute, entryName);
1206
+ }
1204
1207
  };
1205
1208
  const __SetClasses = /*#__PURE__*/ (element, classname)=>{
1206
1209
  classname ? element.setAttribute('class', classname) : element.removeAttribute('class');
@@ -1532,9 +1535,10 @@ function createMainThreadGlobalThis(config) {
1532
1535
  childB.replaceWith(childA);
1533
1536
  temp.replaceWith(childB);
1534
1537
  };
1535
- const __SetCSSIdForCSSOG = (elements, cssId)=>{
1538
+ const __SetCSSIdForCSSOG = (elements, cssId, entryName)=>{
1536
1539
  for (const element of elements){
1537
1540
  element.setAttribute(cssIdAttribute, cssId + '');
1541
+ entryName && element.setAttribute(lynxEntryNameAttribute, entryName);
1538
1542
  const cls = element.getAttribute('class');
1539
1543
  cls && __SetClassesForCSSOG(element, cls);
1540
1544
  }
@@ -1544,13 +1548,15 @@ function createMainThreadGlobalThis(config) {
1544
1548
  element.setAttribute('class', newClassName);
1545
1549
  const cssId = element.getAttribute(cssIdAttribute);
1546
1550
  const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1547
- callbacks.updateCssOGStyle(uniqueId, newClassName, cssId);
1551
+ const entryName = element.getAttribute(lynxEntryNameAttribute);
1552
+ callbacks.updateCssOGStyle(uniqueId, newClassName, cssId, entryName);
1548
1553
  };
1549
1554
  const __SetClassesForCSSOG = (element, classNames)=>{
1550
1555
  __SetClasses(element, classNames);
1551
1556
  const cssId = element.getAttribute(cssIdAttribute);
1552
1557
  const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1553
- callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId);
1558
+ const entryName = element.getAttribute(lynxEntryNameAttribute);
1559
+ callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId, entryName);
1554
1560
  };
1555
1561
  const __LoadLepusChunk = (path)=>{
1556
1562
  try {
@@ -1688,6 +1694,7 @@ function createMainThreadGlobalThis(config) {
1688
1694
  __LoadLepusChunk,
1689
1695
  __GetPageElement,
1690
1696
  __globalProps: globalProps,
1697
+ __QueryComponent: callbacks.__QueryComponent,
1691
1698
  SystemInfo,
1692
1699
  lynx: createMainThreadLynx(config, SystemInfo),
1693
1700
  _ReportError: (err, _)=>callbacks._ReportError(err, _, release),
@@ -1781,30 +1788,74 @@ function decodeCssOG(classes, styleInfo, cssId) {
1781
1788
  else console.warn(`[lynx-web] cannot find styleinfo for cssid ${cssId}`);
1782
1789
  return declarations.map(([property, value])=>`${property}:${value};`).join('');
1783
1790
  }
1784
- function flattenStyleInfo(styleInfo, enableCSSSelector) {
1785
- function flattenOneStyleInfo(cssId) {
1786
- const oneInfo = styleInfo[cssId];
1787
- const imports = oneInfo?.imports;
1788
- if (oneInfo && imports?.length) {
1789
- for (const im of imports){
1790
- const flatInfo = flattenOneStyleInfo(im);
1791
- if (flatInfo) {
1792
- oneInfo.content.push(...flatInfo.content);
1793
- oneInfo.rules.push(...enableCSSSelector ? flatInfo.rules : flatInfo.rules.map((i)=>({
1794
- ...i
1795
- })));
1796
- }
1791
+ function topologicalSort(styleInfo) {
1792
+ const queue = [];
1793
+ const inDegreeMap = new Map();
1794
+ for (const [cssId, oneStyleInfo] of Object.entries(styleInfo)){
1795
+ inDegreeMap.has(cssId) || inDegreeMap.set(cssId, 0);
1796
+ for (const importCssId of oneStyleInfo.imports ?? []){
1797
+ const currentInDegree = inDegreeMap.get(importCssId) ?? 0;
1798
+ inDegreeMap.set(importCssId, currentInDegree + 1);
1799
+ }
1800
+ }
1801
+ for (const [cssId, inDegree] of inDegreeMap.entries())if (0 === inDegree) queue.push(cssId);
1802
+ const sortedCssIds = [];
1803
+ while(queue.length > 0){
1804
+ const currentCssId = queue.shift();
1805
+ sortedCssIds.push(currentCssId);
1806
+ const currentAdjunction = styleInfo[currentCssId]?.imports;
1807
+ if (currentAdjunction) for (const importCssId of currentAdjunction){
1808
+ const importInDegree = inDegreeMap.get(importCssId) - 1;
1809
+ inDegreeMap.set(importCssId, importInDegree);
1810
+ if (0 === importInDegree) queue.push(importCssId);
1811
+ }
1812
+ }
1813
+ return sortedCssIds;
1814
+ }
1815
+ function generateImportByMap(styleInfo, sortedCssIds) {
1816
+ const cssIdToImportBy = new Map();
1817
+ for (const cssId of sortedCssIds){
1818
+ const currentAdjunction = styleInfo[cssId]?.imports;
1819
+ if (currentAdjunction) {
1820
+ const currentImportBy = cssIdToImportBy.get(cssId) ?? new Set([
1821
+ cssId
1822
+ ]);
1823
+ for (const importCssId of currentAdjunction){
1824
+ const importDeps = cssIdToImportBy.get(importCssId) ?? new Set([
1825
+ importCssId
1826
+ ]);
1827
+ importDeps.add(cssId);
1828
+ cssIdToImportBy.set(importCssId, currentImportBy.union(importDeps));
1797
1829
  }
1798
- oneInfo.imports = void 0;
1830
+ cssIdToImportBy.set(cssId, currentImportBy);
1799
1831
  }
1800
- return oneInfo;
1801
1832
  }
1802
- Object.keys(styleInfo).map((cssId)=>{
1803
- flattenOneStyleInfo(cssId);
1833
+ return cssIdToImportBy;
1834
+ }
1835
+ function flattenStyleInfo(styleInfo) {
1836
+ const sortedCssIds = topologicalSort(styleInfo);
1837
+ const cssIdToImportBy = generateImportByMap(styleInfo, sortedCssIds);
1838
+ sortedCssIds.reverse();
1839
+ return sortedCssIds.map((cssId)=>{
1840
+ const oneInfo = styleInfo[cssId];
1841
+ const flattenedInfo = oneInfo ? {
1842
+ content: oneInfo.content,
1843
+ rules: oneInfo.rules,
1844
+ importBy: Array.from(cssIdToImportBy.get(cssId) ?? [
1845
+ cssId
1846
+ ])
1847
+ } : {
1848
+ content: [],
1849
+ rules: [],
1850
+ importBy: [
1851
+ cssId
1852
+ ]
1853
+ };
1854
+ return flattenedInfo;
1804
1855
  });
1805
1856
  }
1806
1857
  function transformToWebCss(styleInfo) {
1807
- for (const cssInfos of Object.values(styleInfo))for (const rule of cssInfos.rules){
1858
+ for (const cssInfos of styleInfo)for (const rule of cssInfos.rules){
1808
1859
  const { sel: selectors, decl: declarations } = rule;
1809
1860
  const { transformedStyle, childStyle } = transformParsedStyles(declarations);
1810
1861
  rule.decl = transformedStyle;
@@ -1821,18 +1872,20 @@ function transformToWebCss(styleInfo) {
1821
1872
  function genCssContent(styleInfo, pageConfig, entryName) {
1822
1873
  function getExtraSelectors(cssId) {
1823
1874
  let suffix;
1824
- suffix = pageConfig.enableRemoveCSSScope ? `[${lynxTagAttribute}]` : void 0 !== cssId ? `[${cssIdAttribute}="${cssId}"]` : `[${lynxTagAttribute}]`;
1825
- suffix = entryName ? `${suffix}[${lynxEntryNameAttribute}="${entryName}"]` : `${suffix}:not([${lynxEntryNameAttribute}])`;
1875
+ suffix = pageConfig.enableRemoveCSSScope ? `[${lynxTagAttribute}]` : `[${cssIdAttribute}="${cssId}"]`;
1876
+ suffix = entryName ? `${suffix}[${lynxEntryNameAttribute}=${JSON.stringify(entryName)}]` : `${suffix}:not([${lynxEntryNameAttribute}])`;
1826
1877
  return suffix;
1827
1878
  }
1828
1879
  const finalCssContent = [];
1829
- for (const [cssId, cssInfos] of Object.entries(styleInfo)){
1830
- const suffix = getExtraSelectors(cssId);
1880
+ for (const cssInfos of styleInfo){
1831
1881
  const declarationContent = cssInfos.rules.map((rule)=>{
1832
1882
  const { sel: selectorList, decl: declarations } = rule;
1833
- const selectorString = selectorList.map((selectors)=>selectors.toSpliced(-4, 0, [
1834
- suffix
1835
- ]).flat().join('')).join(',');
1883
+ const selectorString = cssInfos.importBy.map((cssId)=>{
1884
+ const suffix = getExtraSelectors(cssId);
1885
+ return selectorList.map((selectors)=>selectors.toSpliced(-4, 0, [
1886
+ suffix
1887
+ ]).flat().join('')).join(',');
1888
+ }).join(',');
1836
1889
  const declarationString = declarations.map(([k, v])=>`${k}:${v};`).join('');
1837
1890
  return `${selectorString}{${declarationString}}`;
1838
1891
  }).join('');
@@ -1841,43 +1894,43 @@ function genCssContent(styleInfo, pageConfig, entryName) {
1841
1894
  return finalCssContent.join('\n');
1842
1895
  }
1843
1896
  function genCssOGInfo(styleInfo) {
1844
- return Object.fromEntries(Object.entries(styleInfo).map(([cssId, cssInfos])=>{
1845
- const oneCssOGInfo = {};
1846
- cssInfos.rules = cssInfos.rules.filter((oneCssInfo)=>{
1847
- oneCssInfo.sel = oneCssInfo.sel.filter((selectorList)=>{
1848
- const [classSelectors, pseudoClassSelectors, pseudoElementSelectors, combinator] = selectorList;
1849
- if (1 === classSelectors.length && '.' === classSelectors[0][0] && 0 === pseudoClassSelectors.length && 0 === pseudoElementSelectors.length && 0 === combinator.length) {
1850
- const selectorName = classSelectors[0].substring(1);
1851
- const currentDeclarations = oneCssOGInfo[selectorName];
1852
- if (currentDeclarations) currentDeclarations.push(...oneCssInfo.decl);
1853
- else oneCssOGInfo[selectorName] = oneCssInfo.decl;
1854
- return false;
1897
+ const cssOGInfo = {};
1898
+ for (const oneInfo of styleInfo)oneInfo.rules = oneInfo.rules.filter((oneRule)=>{
1899
+ oneRule.sel = oneRule.sel.filter((selectorList)=>{
1900
+ const [classSelectors, pseudoClassSelectors, pseudoElementSelectors, combinator] = selectorList;
1901
+ if (1 === classSelectors.length && '.' === classSelectors[0][0] && 0 === pseudoClassSelectors.length && 0 === pseudoElementSelectors.length && 0 === combinator.length) {
1902
+ const selectorName = classSelectors[0].substring(1);
1903
+ for (const cssId of oneInfo.importBy){
1904
+ if (!cssOGInfo[cssId]) cssOGInfo[cssId] = {};
1905
+ const currentDeclarations = cssOGInfo[cssId][selectorName];
1906
+ if (currentDeclarations) currentDeclarations.push(...oneRule.decl);
1907
+ else cssOGInfo[cssId][selectorName] = oneRule.decl;
1855
1908
  }
1856
- return true;
1857
- });
1858
- return oneCssInfo.sel.length > 0;
1909
+ return false;
1910
+ }
1911
+ return true;
1859
1912
  });
1860
- return [
1861
- cssId,
1862
- oneCssOGInfo
1863
- ];
1864
- }));
1913
+ return oneRule.sel.length > 0;
1914
+ });
1915
+ return cssOGInfo;
1865
1916
  }
1866
- function appendStyleElement(styleInfo, pageConfig, rootDom, document, entryName, ssrHydrateInfo) {
1917
+ function appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrateInfo) {
1867
1918
  const lynxUniqueIdToStyleRulesIndex = ssrHydrateInfo?.lynxUniqueIdToStyleRulesIndex ?? [];
1868
- flattenStyleInfo(styleInfo, pageConfig.enableCSSSelector);
1869
- transformToWebCss(styleInfo);
1870
- const cssOGInfo = pageConfig.enableCSSSelector ? {} : genCssOGInfo(styleInfo);
1919
+ const flattenedStyleInfo = flattenStyleInfo(styleInfo);
1920
+ transformToWebCss(flattenedStyleInfo);
1921
+ const cssOGInfo = pageConfig.enableCSSSelector ? {} : genCssOGInfo(flattenedStyleInfo);
1922
+ const lazyCSSOGInfo = {};
1871
1923
  let cardStyleElement;
1872
1924
  if (ssrHydrateInfo?.cardStyleElement) cardStyleElement = ssrHydrateInfo.cardStyleElement;
1873
1925
  else {
1874
1926
  cardStyleElement = document.createElement('style');
1875
- cardStyleElement.textContent = genCssContent(styleInfo, pageConfig, entryName);
1927
+ cardStyleElement.textContent = genCssContent(flattenedStyleInfo, pageConfig, void 0);
1876
1928
  rootDom.appendChild(cardStyleElement);
1877
1929
  }
1878
- const cardStyleElementSheet = cardStyleElement.sheet;
1879
- const updateCssOGStyle = (uniqueId, newClassName, cssID)=>{
1880
- const newStyles = decodeCssOG(newClassName, cssOGInfo, cssID);
1930
+ const updateCssOGStyle = (uniqueId, newClassName, cssID, entryName)=>{
1931
+ const cardStyleElementSheet = cardStyleElement.sheet;
1932
+ const styleMap = entryName && lazyCSSOGInfo[entryName] ? lazyCSSOGInfo[entryName] : cssOGInfo;
1933
+ const newStyles = decodeCssOG(newClassName, styleMap, cssID);
1881
1934
  if (void 0 !== lynxUniqueIdToStyleRulesIndex[uniqueId]) {
1882
1935
  const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
1883
1936
  rule.style.cssText = newStyles;
@@ -1886,12 +1939,71 @@ function appendStyleElement(styleInfo, pageConfig, rootDom, document, entryName,
1886
1939
  lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
1887
1940
  }
1888
1941
  };
1942
+ const updateLazyComponentStyle = (styleInfo, entryName)=>{
1943
+ const flattenedStyleInfo = flattenStyleInfo(styleInfo);
1944
+ transformToWebCss(flattenedStyleInfo);
1945
+ if (!pageConfig.enableCSSSelector) lazyCSSOGInfo[entryName] = genCssOGInfo(flattenedStyleInfo);
1946
+ const newStyleSheet = genCssContent(flattenedStyleInfo, pageConfig, entryName);
1947
+ cardStyleElement.textContent += newStyleSheet;
1948
+ };
1889
1949
  return {
1890
- updateCssOGStyle
1950
+ updateCssOGStyle,
1951
+ updateLazyComponentStyle
1952
+ };
1953
+ }
1954
+ function createQueryComponent(loadTemplate, updateLazyComponentStyle, backgroundThreadRpc, mtsGlobalThisRef, jsContext, mtsRealm) {
1955
+ const updateBTSTemplateCache = backgroundThreadRpc.createCall(updateBTSTemplateCacheEndpoint);
1956
+ const lazyCache = new Map();
1957
+ const __QueryComponentImpl = (url, callback)=>{
1958
+ const cacheLazy = lazyCache.get(url);
1959
+ const loadPromise = cacheLazy ?? loadTemplate(url).then(async (template)=>{
1960
+ const updateBTSCachePromise = updateBTSTemplateCache(url, template);
1961
+ let lepusRootChunkExport = await mtsRealm.loadScript(template.lepusCode.root);
1962
+ if (mtsGlobalThisRef.mtsGlobalThis.processEvalResult) lepusRootChunkExport = mtsGlobalThisRef.mtsGlobalThis.processEvalResult(lepusRootChunkExport, url);
1963
+ updateLazyComponentStyle(template.styleInfo, url);
1964
+ await updateBTSCachePromise;
1965
+ jsContext.dispatchEvent({
1966
+ type: '__OnDynamicJSSourcePrepared',
1967
+ data: url
1968
+ });
1969
+ return lepusRootChunkExport;
1970
+ });
1971
+ cacheLazy || lazyCache.set(url, loadPromise);
1972
+ loadPromise.then((lepusRootChunkExport)=>{
1973
+ callback?.({
1974
+ code: 0,
1975
+ data: {
1976
+ url,
1977
+ evalResult: lepusRootChunkExport
1978
+ }
1979
+ });
1980
+ }).catch((error)=>{
1981
+ console.error("lynx web: lazy bundle load failed:", error);
1982
+ lazyCache.delete(url);
1983
+ callback?.({
1984
+ code: -1,
1985
+ data: void 0
1986
+ });
1987
+ });
1988
+ return null;
1891
1989
  };
1990
+ backgroundThreadRpc.registerHandler(queryComponentEndpoint, (url)=>{
1991
+ const ret = new Promise((resolve)=>{
1992
+ __QueryComponentImpl(url, (result)=>{
1993
+ resolve({
1994
+ code: result.code,
1995
+ detail: {
1996
+ schema: url
1997
+ }
1998
+ });
1999
+ });
2000
+ });
2001
+ return ret;
2002
+ });
2003
+ return __QueryComponentImpl;
1892
2004
  }
1893
2005
  const initWasmPromise = initWasm();
1894
- function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, ssrHooks) {
2006
+ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
1895
2007
  const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
1896
2008
  const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
1897
2009
  const publishEvent = backgroundThreadRpc.createCall(publishEventEndpoint);
@@ -1911,7 +2023,11 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
1911
2023
  sendEventEndpoint: dispatchCoreContextOnBackgroundEndpoint
1912
2024
  });
1913
2025
  const i18nResources = initialI18nResources(initI18nResources);
1914
- const { updateCssOGStyle } = appendStyleElement(styleInfo, pageConfig, rootDom, document, void 0, ssrHydrateInfo);
2026
+ const { updateCssOGStyle, updateLazyComponentStyle } = appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrateInfo);
2027
+ const mtsGlobalThisRef = {
2028
+ mtsGlobalThis: void 0
2029
+ };
2030
+ const __QueryComponent = createQueryComponent(loadTemplate, updateLazyComponentStyle, backgroundThreadRpc, mtsGlobalThisRef, jsContext, mtsRealm);
1915
2031
  const mtsGlobalThis = createMainThreadGlobalThis({
1916
2032
  lynxTemplate: template,
1917
2033
  mtsRealm,
@@ -1995,9 +2111,11 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
1995
2111
  dispatchI18nResource(matchedInitI18nResources?.resource);
1996
2112
  if (matchedInitI18nResources) return matchedInitI18nResources.resource;
1997
2113
  return triggerI18nResourceFallback(options);
1998
- }
2114
+ },
2115
+ __QueryComponent
1999
2116
  }
2000
2117
  });
2118
+ mtsGlobalThisRef.mtsGlobalThis = mtsGlobalThis;
2001
2119
  markTimingInternal('decode_end');
2002
2120
  await mtsRealm.loadScript(template.lepusCode.root);
2003
2121
  jsContext.__start();
@@ -2017,7 +2135,7 @@ async function loadTemplate_createJsModuleUrl(content, filename) {
2017
2135
  });
2018
2136
  return fileUrl;
2019
2137
  }
2020
- async function loadTemplate(rawTemplate, templateName = Math.random().toString(36).substring(2, 7)) {
2138
+ async function loadTemplate_loadTemplate(rawTemplate, templateName = Math.random().toString(36).substring(2, 7)) {
2021
2139
  if (templateCache.has(rawTemplate)) return templateCache.get(rawTemplate);
2022
2140
  templateName += Math.random().toString(36).substring(2, 7);
2023
2141
  const decodedTemplate = templateCache.get(rawTemplate) ?? await generateTemplate(rawTemplate, loadTemplate_createJsModuleUrl, templateName + '-lepusCode');
@@ -2211,6 +2329,9 @@ class OffscreenElement extends EventTarget {
2211
2329
  this[ancestorDocument][enableEvent](type, this[OffscreenElement_uniqueId]);
2212
2330
  super.addEventListener(type, callback, options);
2213
2331
  }
2332
+ get textContent() {
2333
+ return this[textContent];
2334
+ }
2214
2335
  set textContent(text1) {
2215
2336
  this[ancestorDocument][operations].push(OperationType.SetTextContent, this[OffscreenElement_uniqueId], text1);
2216
2337
  for (const child of this.children)child.remove();
@@ -2462,13 +2583,35 @@ const templateXOverlayNg = `<style>
2462
2583
  right: 0;
2463
2584
  bottom: 0;
2464
2585
  position: fixed;
2586
+ overscroll-behavior: contain;
2587
+ scrollbar-width: none;
2588
+ }
2589
+ #dialog[open]::-webkit-scrollbar {
2590
+ display: none;
2465
2591
  }
2466
2592
  #dialog::backdrop {
2467
2593
  background-color: transparent;
2468
2594
  }
2595
+ .overlay-inner {
2596
+ position: sticky;
2597
+ top: 0;
2598
+ width: 100%;
2599
+ height: 100%;
2600
+ pointer-events: none;
2601
+ }
2602
+ .overlay-inner > * {
2603
+ pointer-events: auto;
2604
+ }
2605
+ .overlay-placeholder {
2606
+ width: 100%;
2607
+ height: 1px;
2608
+ }
2469
2609
  </style>
2470
2610
  <dialog id="dialog" part="dialog">
2471
- <slot></slot>
2611
+ <div class="overlay-inner">
2612
+ <slot></slot>
2613
+ </div>
2614
+ <div class="overlay-placeholder"></div>
2472
2615
  </dialog>`;
2473
2616
  const templateXRefreshView = `<style>
2474
2617
  .bounce-container {
@@ -2702,7 +2845,7 @@ OffscreenElement.prototype.toJSON = function() {
2702
2845
  };
2703
2846
  async function createLynxView(config) {
2704
2847
  const { template: rawTemplate, browserConfig, tagMap, initData, globalProps, overrideElementTemplates = {}, hydrateUrl, autoSize, injectStyles, lynxViewStyle, threadStrategy = 'all-on-ui', initI18nResources } = config;
2705
- const template = await loadTemplate(rawTemplate, config.templateName);
2848
+ const template = await loadTemplate_loadTemplate(rawTemplate, config.templateName);
2706
2849
  const { promise: firstPaintReadyPromise, resolve: firstPaintReady } = Promise.withResolvers();
2707
2850
  const mainWithBackgroundChannel = new MessageChannel();
2708
2851
  const backgroundThreadRpc = new Rpc(mainWithBackgroundChannel.port1, 'background-thread');
@@ -2723,7 +2866,15 @@ async function createLynxView(config) {
2723
2866
  const script = new node_vm.Script(scriptContent.toString(), {
2724
2867
  filename: url
2725
2868
  });
2726
- return script.runInContext(mtsVMContext);
2869
+ mtsVMContext.module = {
2870
+ exports: null
2871
+ };
2872
+ script.runInContext(mtsVMContext);
2873
+ const ret = mtsVMContext.module.exports;
2874
+ mtsVMContext.module = {
2875
+ exports: null
2876
+ };
2877
+ return ret;
2727
2878
  };
2728
2879
  const loadScript = async (url)=>new Promise((resolve, reject)=>{
2729
2880
  node_fs.readFile(url, (err, data)=>{
@@ -2732,8 +2883,15 @@ async function createLynxView(config) {
2732
2883
  const script = new node_vm.Script(data.toString(), {
2733
2884
  filename: url
2734
2885
  });
2735
- const result = script.runInContext(mtsVMContext);
2736
- resolve(result);
2886
+ mtsVMContext.module = {
2887
+ exports: null
2888
+ };
2889
+ script.runInContext(mtsVMContext);
2890
+ const ret = mtsVMContext.module.exports;
2891
+ mtsVMContext.module = {
2892
+ exports: null
2893
+ };
2894
+ resolve(ret);
2737
2895
  } catch (e) {
2738
2896
  reject(e);
2739
2897
  }
@@ -2748,7 +2906,7 @@ async function createLynxView(config) {
2748
2906
  }, ()=>{}, ()=>{}, ()=>{}, ()=>{}, (initI18nResources)=>{
2749
2907
  i18nResources.setData(initI18nResources);
2750
2908
  return i18nResources;
2751
- }, {
2909
+ }, ()=>{}, {
2752
2910
  __AddEvent (element, eventName, eventData, eventOptions) {
2753
2911
  events.push([
2754
2912
  Number(element.getAttribute(lynxUniqueIdAttribute)),
@@ -3,17 +3,17 @@ export const __webpack_ids__ = [
3
3
  "8"
4
4
  ];
5
5
  export const __webpack_modules__ = {
6
- "../web-style-transformer/dist/legacy.js": function(module, __webpack_exports__, __webpack_require__) {
7
- __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
6
+ "../web-style-transformer/dist/legacy.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
8
8
  try {
9
9
  __webpack_require__.d(__webpack_exports__, {
10
- M2: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.M2,
10
+ Fz: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.Fz,
11
11
  Qn: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.Qn,
12
12
  aC: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.aC,
13
13
  bk: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.bk,
14
14
  iG: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.iG,
15
15
  lI: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.lI,
16
- tZ: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.tZ,
16
+ qB: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.qB,
17
17
  yc: ()=>_legacy_bg_js__WEBPACK_IMPORTED_MODULE_0__.yc
18
18
  });
19
19
  var _legacy_bg_wasm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-style-transformer/dist/legacy_bg.wasm");
@@ -29,18 +29,17 @@ export const __webpack_modules__ = {
29
29
  }
30
30
  });
31
31
  },
32
- "../web-style-transformer/dist/legacy_bg.js": function(module, __webpack_exports__, __webpack_require__) {
32
+ "../web-style-transformer/dist/legacy_bg.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
33
33
  __webpack_require__.d(__webpack_exports__, {
34
- M2: ()=>__wbg_new_78feb108b6472713,
34
+ Fz: ()=>__wbg_new_58353953ad2097cc,
35
35
  Qn: ()=>__wbindgen_throw,
36
36
  aC: ()=>transform_raw_u16_inline_style_ptr,
37
37
  bk: ()=>__wbindgen_object_drop_ref,
38
38
  iG: ()=>transform_raw_u16_inline_style_ptr_parsed,
39
39
  lI: ()=>__wbg_set_wasm,
40
- tZ: ()=>__wbg_push_737cfc8c1432c2c6,
40
+ qB: ()=>__wbg_push_73fd7b5550ebf707,
41
41
  yc: ()=>__wbindgen_string_new
42
42
  });
43
- module = __webpack_require__.hmd(module);
44
43
  let wasm;
45
44
  function __wbg_set_wasm(val) {
46
45
  wasm = val;
@@ -68,24 +67,38 @@ export const __webpack_modules__ = {
68
67
  dropObject(idx);
69
68
  return ret;
70
69
  }
70
+ let cachedUint8ArrayMemory0 = null;
71
+ function getUint8ArrayMemory0() {
72
+ if (null === cachedUint8ArrayMemory0 || 0 === cachedUint8ArrayMemory0.byteLength) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
73
+ return cachedUint8ArrayMemory0;
74
+ }
71
75
  const lTextDecoder = 'undefined' == typeof TextDecoder ? (0, module.require)('util').TextDecoder : TextDecoder;
72
76
  let cachedTextDecoder = new lTextDecoder('utf-8', {
73
77
  ignoreBOM: true,
74
78
  fatal: true
75
79
  });
76
80
  cachedTextDecoder.decode();
77
- let cachedUint8ArrayMemory0 = null;
78
- function getUint8ArrayMemory0() {
79
- if (null === cachedUint8ArrayMemory0 || 0 === cachedUint8ArrayMemory0.byteLength) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
80
- return cachedUint8ArrayMemory0;
81
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
82
+ let numBytesDecoded = 0;
83
+ function decodeText(ptr, len) {
84
+ numBytesDecoded += len;
85
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
86
+ cachedTextDecoder = new lTextDecoder('utf-8', {
87
+ ignoreBOM: true,
88
+ fatal: true
89
+ });
90
+ cachedTextDecoder.decode();
91
+ numBytesDecoded = len;
92
+ }
93
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
81
94
  }
82
95
  function getStringFromWasm0(ptr, len) {
83
96
  ptr >>>= 0;
84
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
97
+ return decodeText(ptr, len);
85
98
  }
86
99
  let WASM_VECTOR_LEN = 0;
87
100
  const lTextEncoder = 'undefined' == typeof TextEncoder ? (0, module.require)('util').TextEncoder : TextEncoder;
88
- let cachedTextEncoder = new lTextEncoder('utf-8');
101
+ const cachedTextEncoder = new lTextEncoder('utf-8');
89
102
  const encodeString = 'function' == typeof cachedTextEncoder.encodeInto ? function(arg, view) {
90
103
  return cachedTextEncoder.encodeInto(arg, view);
91
104
  } : function(arg, view) {
@@ -155,11 +168,11 @@ export const __webpack_modules__ = {
155
168
  const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
156
169
  return takeObject(ret);
157
170
  }
158
- function __wbg_new_78feb108b6472713() {
171
+ function __wbg_new_58353953ad2097cc() {
159
172
  const ret = new Array();
160
173
  return addHeapObject(ret);
161
174
  }
162
- function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
175
+ function __wbg_push_73fd7b5550ebf707(arg0, arg1) {
163
176
  const ret = getObject(arg0).push(getObject(arg1));
164
177
  return ret;
165
178
  }
@@ -174,13 +187,13 @@ export const __webpack_modules__ = {
174
187
  throw new Error(getStringFromWasm0(arg0, arg1));
175
188
  }
176
189
  },
177
- "../web-style-transformer/legacy.js": function(module, __webpack_exports__, __webpack_require__) {
178
- __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
190
+ "../web-style-transformer/legacy.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
191
+ __webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
179
192
  try {
180
193
  __webpack_require__.r(__webpack_exports__);
181
194
  __webpack_require__.d(__webpack_exports__, {
182
- __wbg_new_78feb108b6472713: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.M2,
183
- __wbg_push_737cfc8c1432c2c6: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.tZ,
195
+ __wbg_new_58353953ad2097cc: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.Fz,
196
+ __wbg_push_73fd7b5550ebf707: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.qB,
184
197
  __wbg_set_wasm: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.lI,
185
198
  __wbindgen_object_drop_ref: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.bk,
186
199
  __wbindgen_string_new: ()=>_dist_legacy_js__WEBPACK_IMPORTED_MODULE_0__.yc,
@@ -202,13 +215,13 @@ export const __webpack_modules__ = {
202
215
  }
203
216
  });
204
217
  },
205
- "../web-style-transformer/dist/legacy_bg.wasm": function(module, exports, __webpack_require__) {
218
+ "../web-style-transformer/dist/legacy_bg.wasm": function(module1, exports, __webpack_require__) {
206
219
  var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__("../web-style-transformer/dist/legacy_bg.js");
207
- module.exports = __webpack_require__.v(exports, module.id, "578076972e1e5ffd", {
220
+ module1.exports = __webpack_require__.v(exports, module1.id, "fe95f2851571c1d7", {
208
221
  "./legacy_bg.js": {
209
- __wbg_new_78feb108b6472713: WEBPACK_IMPORTED_MODULE_0.M2,
222
+ __wbg_new_58353953ad2097cc: WEBPACK_IMPORTED_MODULE_0.Fz,
210
223
  __wbindgen_string_new: WEBPACK_IMPORTED_MODULE_0.yc,
211
- __wbg_push_737cfc8c1432c2c6: WEBPACK_IMPORTED_MODULE_0.tZ,
224
+ __wbg_push_73fd7b5550ebf707: WEBPACK_IMPORTED_MODULE_0.qB,
212
225
  __wbindgen_object_drop_ref: WEBPACK_IMPORTED_MODULE_0.bk,
213
226
  __wbindgen_throw: WEBPACK_IMPORTED_MODULE_0.Qn
214
227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-core-server",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -26,10 +26,10 @@
26
26
  "rsbuild-plugin-arethetypeswrong": "0.1.1",
27
27
  "rsbuild-plugin-publint": "0.3.3",
28
28
  "@lynx-js/offscreen-document": "0.1.4",
29
- "@lynx-js/web-constants": "0.16.0",
30
- "@lynx-js/web-elements-template": "0.8.4",
31
- "@lynx-js/web-mainthread-apis": "0.16.0",
32
- "@lynx-js/web-worker-rpc": "0.16.0"
29
+ "@lynx-js/web-constants": "0.17.0",
30
+ "@lynx-js/web-elements-template": "0.8.7",
31
+ "@lynx-js/web-mainthread-apis": "0.17.0",
32
+ "@lynx-js/web-worker-rpc": "0.17.0"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rslib build",