@open-wxa/wxa-runner-core 0.3.2 → 0.4.1
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/README.md +2 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/runtime/host.js +44 -0
- package/dist/runtime/host.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
[`@open-wxa/wxa-runner-playwright`](https://www.npmjs.com/package/@open-wxa/wxa-runner-playwright)。以下情况把它加为开发依赖:
|
|
7
7
|
|
|
8
8
|
- setup 文件要类型提示:`import { defineSetup } from '@open-wxa/wxa-runner-core/setup'`,见
|
|
9
|
-
[
|
|
9
|
+
[启动前准备(setup)](https://open-wxa.github.io/wxa-runner/setup)
|
|
10
10
|
- 不用 fixture、直接使用测试 API:`/// <reference types="@open-wxa/wxa-runner-core/test-api" />` 为
|
|
11
|
-
`window.__wxa_test_api__` 提供类型,见 [
|
|
11
|
+
`window.__wxa_test_api__` 提供类型,见 [测试 API](https://open-wxa.github.io/wxa-runner/test-api)
|
|
12
12
|
- 在 Node 里启动开发服务器:
|
|
13
13
|
|
|
14
14
|
```ts
|
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ interface AppJson {
|
|
|
15
15
|
entryPagePath?: string;
|
|
16
16
|
window?: Record<string, any>;
|
|
17
17
|
tabBar?: {
|
|
18
|
+
custom?: boolean;
|
|
18
19
|
list: Array<{
|
|
19
20
|
pagePath: string;
|
|
20
21
|
text?: string;
|
|
@@ -66,7 +67,7 @@ declare class MiniProgram {
|
|
|
66
67
|
* 规则:/ 开头为根目录绝对路径;否则先按相对路径找,再沿目录向上查找 miniprogram_npm。
|
|
67
68
|
*/
|
|
68
69
|
resolveComponent(fromId: string, ref: string): string | null;
|
|
69
|
-
/**
|
|
70
|
+
/** 收集页面、隐式自定义 tabBar 及它们(递归)引用到的组件 */
|
|
70
71
|
collectUnits(app: AppJson): {
|
|
71
72
|
pages: string[];
|
|
72
73
|
components: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface AppJson {
|
|
|
15
15
|
entryPagePath?: string;
|
|
16
16
|
window?: Record<string, any>;
|
|
17
17
|
tabBar?: {
|
|
18
|
+
custom?: boolean;
|
|
18
19
|
list: Array<{
|
|
19
20
|
pagePath: string;
|
|
20
21
|
text?: string;
|
|
@@ -66,7 +67,7 @@ declare class MiniProgram {
|
|
|
66
67
|
* 规则:/ 开头为根目录绝对路径;否则先按相对路径找,再沿目录向上查找 miniprogram_npm。
|
|
67
68
|
*/
|
|
68
69
|
resolveComponent(fromId: string, ref: string): string | null;
|
|
69
|
-
/**
|
|
70
|
+
/** 收集页面、隐式自定义 tabBar 及它们(递归)引用到的组件 */
|
|
70
71
|
collectUnits(app: AppJson): {
|
|
71
72
|
pages: string[];
|
|
72
73
|
components: string[];
|
package/dist/index.js
CHANGED
|
@@ -412,7 +412,7 @@ var MiniProgram = class {
|
|
|
412
412
|
}
|
|
413
413
|
return null;
|
|
414
414
|
}
|
|
415
|
-
/**
|
|
415
|
+
/** 收集页面、隐式自定义 tabBar 及它们(递归)引用到的组件 */
|
|
416
416
|
collectUnits(app) {
|
|
417
417
|
const pages = this.allPages(app);
|
|
418
418
|
const components = [];
|
|
@@ -423,15 +423,15 @@ var MiniProgram = class {
|
|
|
423
423
|
for (const generic of Object.values(json.componentGenerics || {})) {
|
|
424
424
|
if (typeof generic === "object" && generic.default) refs.push(generic.default);
|
|
425
425
|
}
|
|
426
|
-
for (const ref of refs)
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
426
|
+
for (const ref of refs) enter(this.resolveComponent(id, ref));
|
|
427
|
+
};
|
|
428
|
+
const enter = (id) => {
|
|
429
|
+
if (!id || visited.has(id)) return;
|
|
430
|
+
visited.add(id);
|
|
431
|
+
components.push(id);
|
|
432
|
+
visit(id);
|
|
434
433
|
};
|
|
434
|
+
if (app.tabBar?.custom) enter(this.resolveComponent("app", "/custom-tab-bar/index"));
|
|
435
435
|
pages.forEach(visit);
|
|
436
436
|
return { pages, components };
|
|
437
437
|
}
|