@open-wxa/wxa-runner-core 0.4.0 → 0.5.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/dist/index.mjs CHANGED
@@ -376,7 +376,7 @@ var MiniProgram = class {
376
376
  }
377
377
  return null;
378
378
  }
379
- /** 收集所有页面以及它们(递归)引用到的自定义组件 */
379
+ /** 收集页面、隐式自定义 tabBar 及它们(递归)引用到的组件 */
380
380
  collectUnits(app) {
381
381
  const pages = this.allPages(app);
382
382
  const components = [];
@@ -387,15 +387,15 @@ var MiniProgram = class {
387
387
  for (const generic of Object.values(json.componentGenerics || {})) {
388
388
  if (typeof generic === "object" && generic.default) refs.push(generic.default);
389
389
  }
390
- for (const ref of refs) {
391
- const component = this.resolveComponent(id, ref);
392
- if (component && !visited.has(component)) {
393
- visited.add(component);
394
- components.push(component);
395
- visit(component);
396
- }
397
- }
390
+ for (const ref of refs) enter(this.resolveComponent(id, ref));
398
391
  };
392
+ const enter = (id) => {
393
+ if (!id || visited.has(id)) return;
394
+ visited.add(id);
395
+ components.push(id);
396
+ visit(id);
397
+ };
398
+ if (app.tabBar?.custom) enter(this.resolveComponent("app", "/custom-tab-bar/index"));
399
399
  pages.forEach(visit);
400
400
  return { pages, components };
401
401
  }
@@ -529,6 +529,9 @@ function webviewHtml(build2, pagePath, webviewId, options) {
529
529
  <!-- \u771F\u673A\u7684\u6EDA\u52A8\u6761\u662F\u4E0D\u5360\u5E03\u5C40\u7684\u6D6E\u5C42\uFF1B\u684C\u9762\u6D4F\u89C8\u5668\u7684\u5E38\u89C4\u6EDA\u52A8\u6761\u548C\u81EA\u5B9A\u4E49 ::-webkit-scrollbar \u4F1A\u6324\u7A84\u9875\u9762\uFF0C\u4E00\u5F8B\u9690\u85CF\u3002
530
530
  scrollbar-width \u4F18\u5148\u4E8E ::-webkit-scrollbar\uFF0C\u9875\u9762\u6837\u5F0F\u4E0D\u4F1A\u518D\u628A\u6EDA\u52A8\u6761\u52A0\u56DE\u6765 -->
531
531
  <style>*{scrollbar-width:none}::-webkit-scrollbar{display:none}</style>
532
+ <!-- \u903B\u8F91\u5C42\u5EFA\u7684 2d\u3001webgl \u753B\u5E03\u642C\u8FDB wx-canvas \u540E\u94FA\u6EE1\u5B83\uFF08\u89C1 frame.ts \u7684 moveCanvasesIntoPages\uFF09\u3002
533
+ \u57FA\u7840\u5E93\u8FD8\u4F1A\u6309\u903B\u8F91\u5C42\u91CC\u7684\u5E03\u5C40\u6539\u5B83\u7684\u4F4D\u7F6E\u548C\u663E\u9690\uFF0C\u8FD9\u91CC\u4E00\u5F8B\u538B\u4F4F\uFF1B\u89E6\u6478\u7167\u5E38\u4EA4\u7ED9 wx-canvas \u81EA\u5DF1\u7684 canvas -->
534
+ <style>.wxa-service-canvas{position:absolute!important;left:0!important;top:0!important;width:100%!important;height:100%!important;visibility:inherit!important;pointer-events:none}</style>
532
535
  <script>var __wxConfig = ${toJs(wxConfig)};</script>
533
536
  <script src="/__wxa__/runtime/frame.js" data-kind="webview" data-webview-id="${id}"></script>
534
537
  <script src="/__baselib__/WAWebview.js"></script>
@@ -1155,7 +1158,22 @@ ${error.message}`);
1155
1158
  res.status(404).end();
1156
1159
  return;
1157
1160
  }
1158
- res.type(path4.extname(req.params.name)).send(data);
1161
+ res.type(path4.extname(req.params.name));
1162
+ res.setHeader("ETag", `"${req.params.name}"`);
1163
+ res.setHeader("Accept-Ranges", "bytes");
1164
+ const ranges = req.range(data.length);
1165
+ if (ranges === -1) {
1166
+ res.status(416).setHeader("Content-Range", `bytes */${data.length}`);
1167
+ res.end();
1168
+ return;
1169
+ }
1170
+ if (Array.isArray(ranges) && ranges.type === "bytes" && ranges.length === 1) {
1171
+ const { start, end } = ranges[0];
1172
+ res.status(206).setHeader("Content-Range", `bytes ${start}-${end}/${data.length}`);
1173
+ res.send(data.subarray(start, end + 1));
1174
+ return;
1175
+ }
1176
+ res.send(data);
1159
1177
  });
1160
1178
  app.delete("/__wxa__/tmp/:name", (req, res) => {
1161
1179
  res.status(this.tempFiles.delete(req.params.name) ? 204 : 404).end();