weapp-vite 7.5.0 → 7.7.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/README.md +14 -6
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/bin/bootstrap.js +9 -4
- package/bin/bootstrap.test.ts +82 -1
- package/bin/nodeVersionWarning.js +17 -0
- package/bin/nodeVersionWarning.test.ts +30 -0
- package/dist/action-BD56SQh4.mjs +254 -0
- package/dist/action-CPtgEl6p.mjs +94 -0
- package/dist/action-le0bNff_.mjs +1102 -0
- package/dist/action-ytG5oFAw.mjs +138 -0
- package/dist/action-zmJrU8PC.mjs +245 -0
- package/dist/{analyze-ZJUvEdaY.mjs → analyze-DCZo-sJd.mjs} +4 -71
- package/dist/artifacts-TrTX9_jj.mjs +104 -0
- package/dist/assets-XyhpYtGl.mjs +630 -0
- package/dist/auto-import-components/resolvers.d.mts +1 -1
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-import-presets/wevu-router.d.mts +1 -1
- package/dist/auto-import-presets/wevu-router.mjs +1 -1
- package/dist/auto-import-presets/wevu.d.mts +1 -1
- package/dist/auto-import-presets/wevu.mjs +1 -1
- package/dist/auto-import-presets.d.mts +2 -2
- package/dist/auto-import-presets.mjs +2 -2
- package/dist/auto-routes.d.mts +1 -3
- package/dist/auto-routes.mjs +3 -4
- package/dist/{budget-BD7VqLCl.d.mts → budget-DTPngJU0.d.mts} +1 -10
- package/dist/budget-_Mu-4GKn.mjs +63 -0
- package/dist/builtProject-B145uOt5.mjs +534 -0
- package/dist/{package-7swhyLmf.mjs → classifier-CNTJOYQL.mjs} +5 -9
- package/dist/cli-acceptance.mjs +3 -4
- package/dist/cli.mjs +142 -4569
- package/dist/{config-DRGcCi3h.mjs → config-59ZWhCIf.mjs} +1 -2
- package/dist/{config-V0L-IAJf.d.mts → config-BNx2BODw.d.mts} +145 -150
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/{constants-DEZdcsMn.mjs → constants-BOe8mgqL.mjs} +2 -4
- package/dist/{createCompilerContextInstance-DJH_P_nZ.mjs → createCompilerContextInstance-BXSdH2E8.mjs} +19930 -14019
- package/dist/{createContext-BqYzHhY9.mjs → createContext-W0TeXxbo.mjs} +7 -5
- package/dist/dashboard/analyze.d.mts +1 -7
- package/dist/dashboard/analyze.mjs +3 -1
- package/dist/dashboard/vite.d.mts +2 -4
- package/dist/dashboard/vite.mjs +1 -2
- package/dist/dashboard.d.mts +2 -2
- package/dist/dashboard.mjs +1733 -1
- package/dist/dashboardTransport-C9290QgS.mjs +15 -0
- package/dist/{dashboardViteBridge-Dy3nAD4m.mjs → dashboardViteBridge-B7QgQo94.mjs} +11 -11
- package/dist/{dev-fR5GiJRO.mjs → dev-D1QSExwk.mjs} +6 -3
- package/dist/devProvider-Bcvz5nu4.mjs +4966 -0
- package/dist/docs/README.md +14 -6
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/mcp.md +11 -1
- package/dist/docs/troubleshooting.md +16 -0
- package/dist/docs/vue-sfc.md +25 -2
- package/dist/docs/weapp-config.md +29 -0
- package/dist/docs/wevu-authoring.md +2 -0
- package/dist/doctor-worker.mjs +5 -5
- package/dist/doctor.d.mts +2 -8
- package/dist/doctor.mjs +24 -31
- package/dist/engine-Mnnm_ALP.mjs +53 -0
- package/dist/file-5eEfbK60.mjs +1 -0
- package/dist/{file-sC3jD7Fh.mjs → file-D8mp5GmB.mjs} +50 -26
- package/dist/{files-BqxFIPRp.mjs → files-Cy9jURJu.mjs} +1 -2
- package/dist/forwardConsole-D2Q0RIqc.mjs +509 -0
- package/dist/getInstance-BXNVH7sU.mjs +1 -0
- package/dist/{getInstance-DiGSzBNI.mjs → getInstance-DfNlbr-X.mjs} +2 -3
- package/dist/history-dKxzoHmN.mjs +774 -0
- package/dist/i18n.d.mts +1 -3
- package/dist/i18n.mjs +1 -2
- package/dist/{index-C9HjUX5c.d.mts → index-DIZJRrvK.d.mts} +1 -24
- package/dist/{index-CaXAtb9e.d.mts → index-SnaW3cvA.d.mts} +0 -12
- package/dist/index.d.mts +3 -7
- package/dist/index.mjs +6 -6
- package/dist/{json-BL8Dhhk6.mjs → json-Cvon2mw5.mjs} +1 -2
- package/dist/json.d.mts +1 -1
- package/dist/json.mjs +1 -1
- package/dist/lib-CJyMBzoe.mjs +140 -0
- package/dist/{lifecycle-BROTlwSL.mjs → lifecycle-CUo8PMQc.mjs} +123 -33
- package/dist/{loadConfig-C3BQhz7F.mjs → loadConfig-CKIdfW4o.mjs} +2 -3
- package/dist/loadConfig-D4WGJcYp.mjs +1 -0
- package/dist/logBuildAppFinish-DOBoof6S.mjs +54 -0
- package/dist/mcp-D88QvQgG.mjs +84 -0
- package/dist/{mcp-Cj8Maqo6.mjs → mcp-ovJgl1N9.mjs} +2 -4
- package/dist/mcp.d.mts +1 -3
- package/dist/mcp.mjs +1 -1
- package/dist/mcpClient-C8JzVZ46.mjs +283 -0
- package/dist/{processCleanup-B6KA30Zc.mjs → metadata-HlDKtlsu.mjs} +2 -21
- package/dist/nodeEnv-zq1EymWj.mjs +6 -0
- package/dist/openIde-QoYKhuuM.mjs +643 -0
- package/dist/options-Cz8vZ-0w.mjs +33 -0
- package/dist/{chunkStrategy-DRA5WpB-.mjs → package-DR62fAzP.mjs} +32 -31
- package/dist/path-E1OjBJAl.mjs +43 -0
- package/dist/{platform-CnkySBKz.mjs → platform-BiMpsZIb.mjs} +1 -2
- package/dist/{pluginHost--CaeyWpA.mjs → pluginHost-vn8Vty1J.mjs} +1 -2
- package/dist/processCleanup-DzB64WI8.mjs +18 -0
- package/dist/{protocol-vg8HGJ4n.mjs → protocol-HiSJRrSO.mjs} +43 -41
- package/dist/reader-wzPH_W8A.mjs +92 -0
- package/dist/realpathScope-DwlLaCk3.mjs +22 -0
- package/dist/report-PJVyo-UZ.mjs +105 -0
- package/dist/{path-doV773b7.mjs → resolvedId-DaxPh_yV.mjs} +5 -50
- package/dist/{resolvers-Dod-euqX.mjs → resolvers-CKYqmRD_.mjs} +10 -20
- package/dist/resolvers.d.mts +1 -1
- package/dist/resolvers.mjs +1 -1
- package/dist/{routes-C7fCmf92.d.mts → routes-DvAFX29h.d.mts} +0 -2
- package/dist/{runtime-Ee2HY6gR.d.mts → runtime-BL4RjBRa.d.mts} +1 -9
- package/dist/runtime-CKtMVERT.mjs +42 -0
- package/dist/{runtime-D6VCNhNY.mjs → runtime-DDUCb7pP.mjs} +4 -8
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/schematics-DikfOjMD.mjs +90 -0
- package/dist/{session-PskhD-nZ.mjs → session-COrQJYif.mjs} +81 -21
- package/dist/test.d.mts +1 -3
- package/dist/test.mjs +54 -30
- package/dist/types-BK2EQ3Jm.d.mts +37 -0
- package/dist/{types-CgZn5X6j.d.mts → types-e2BMP9NU.d.mts} +1 -4
- package/dist/types.d.mts +4 -4
- package/dist/{upload-D4msblBf.mjs → upload-Chal5b3w.mjs} +118 -24
- package/dist/upload-worker.mjs +3 -5
- package/dist/{utils-CJSCgEj6.mjs → utils-CTGSZp4j.mjs} +72 -146
- package/dist/vite.d.mts +2 -4
- package/dist/vite.mjs +55 -21
- package/dist/volar.mjs +1 -2
- package/dist/{wevu-BQWUU7br.mjs → wevu-BaihCXO9.mjs} +1 -2
- package/dist/wevu-DTtSOyxB.d.mts +3 -0
- package/dist/{wevu-router-Dg1LnBlg.mjs → wevu-router-BIoxDbnu.mjs} +1 -2
- package/dist/wevu-router-CdWurGQ4.d.mts +3 -0
- package/dist/wxs-7V7MPzeW.mjs +1 -0
- package/dist/wxs-BdHHXltv.mjs +110 -0
- package/package.json +62 -53
- package/dist/dashboard-DvqF3Key.mjs +0 -1842
- package/dist/devProvider-BGBkw28J.mjs +0 -1050
- package/dist/file-DRb4eWqw.mjs +0 -1
- package/dist/getInstance-SiE6WZRh.mjs +0 -1
- package/dist/loadConfig-VGtBF4qm.mjs +0 -1
- package/dist/mcp-D3Yh24Cj.mjs +0 -529
- package/dist/wevu-C4KEC5kO.d.mts +0 -5
- package/dist/wevu-router-Cg2sIkIE.d.mts +0 -5
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import path from "pathe";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/viteId.ts
|
|
2
|
+
// src/utils/viteId.ts
|
|
5
3
|
const VUE_VIRTUAL_MODULE_PREFIX = "\0vue:";
|
|
6
|
-
const BACKSLASH_RE
|
|
4
|
+
const BACKSLASH_RE = /\\/g;
|
|
7
5
|
const WINDOWS_VITE_AT_FS_DRIVE_RE = /^\/[A-Z]:\//i;
|
|
8
6
|
function stripViteAtFsPrefix(id) {
|
|
9
7
|
if (!id.startsWith("/@fs/")) return id;
|
|
@@ -29,11 +27,10 @@ function normalizeViteId(id, options) {
|
|
|
29
27
|
}
|
|
30
28
|
if (stripAtFsPrefix) clean = stripViteAtFsPrefix(clean);
|
|
31
29
|
if (stripLeadingNullByte && clean.startsWith("\0")) clean = clean.slice(1);
|
|
32
|
-
if (clean.includes("\\")) clean = clean.replace(BACKSLASH_RE
|
|
30
|
+
if (clean.includes("\\")) clean = clean.replace(BACKSLASH_RE, "/");
|
|
33
31
|
return clean;
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
//#region src/utils/resolvedId.ts
|
|
33
|
+
// src/utils/resolvedId.ts
|
|
37
34
|
function isSkippableResolvedId(id) {
|
|
38
35
|
if (!id) return true;
|
|
39
36
|
return id.startsWith("\0") || id.startsWith("node:");
|
|
@@ -58,46 +55,4 @@ function resolveFsResolvedIdNormalizeOptions(options) {
|
|
|
58
55
|
function normalizeFsResolvedId(id, options) {
|
|
59
56
|
return normalizeViteId(id, resolveFsResolvedIdNormalizeOptions(options));
|
|
60
57
|
}
|
|
61
|
-
|
|
62
|
-
//#region src/utils/path.ts
|
|
63
|
-
const BACKSLASH_RE = /\\/g;
|
|
64
|
-
const LEADING_SLASH_RE = /^[\\/]+/;
|
|
65
|
-
const DUPLICATE_SLASH_RE = /\/{2,}/g;
|
|
66
|
-
const TRIM_SLASH_RE = /^\/+|\/+$/g;
|
|
67
|
-
const WINDOWS_DEVICE_RE = /^\\\\\?\\/;
|
|
68
|
-
const WINDOWS_UNC_PREFIX = /^\\\\\?\\UNC\\/;
|
|
69
|
-
function stripWindowsDevicePath(value) {
|
|
70
|
-
if (WINDOWS_UNC_PREFIX.test(value)) return `\\\\${value.slice(8)}`;
|
|
71
|
-
if (WINDOWS_DEVICE_RE.test(value)) return value.slice(4);
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
function toPosixPath(value) {
|
|
75
|
-
return value.replace(BACKSLASH_RE, "/");
|
|
76
|
-
}
|
|
77
|
-
function normalizePath(value) {
|
|
78
|
-
if (!value) return value;
|
|
79
|
-
const cleaned = stripWindowsDevicePath(value);
|
|
80
|
-
return toPosixPath(path.normalize(cleaned));
|
|
81
|
-
}
|
|
82
|
-
function normalizeRelativePath(value) {
|
|
83
|
-
if (value === "") return value;
|
|
84
|
-
return normalizePath(value);
|
|
85
|
-
}
|
|
86
|
-
function normalizeWatchPath(value) {
|
|
87
|
-
if (!value) return value;
|
|
88
|
-
const posix = toPosixPath(stripWindowsDevicePath(value));
|
|
89
|
-
return toPosixPath(normalize(posix));
|
|
90
|
-
}
|
|
91
|
-
function stripLeadingSlashes(value) {
|
|
92
|
-
return value.replace(LEADING_SLASH_RE, "");
|
|
93
|
-
}
|
|
94
|
-
function normalizeRoot(root) {
|
|
95
|
-
return toPosixPath(root).replace(DUPLICATE_SLASH_RE, "/").replace(TRIM_SLASH_RE, "");
|
|
96
|
-
}
|
|
97
|
-
function isPathInside(parent, target) {
|
|
98
|
-
if (!parent) return false;
|
|
99
|
-
const relative = path.relative(parent, target);
|
|
100
|
-
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
101
|
-
}
|
|
102
|
-
//#endregion
|
|
103
|
-
export { normalizeWatchPath as a, isSkippableResolvedId as c, normalizeRoot as i, normalizeFsResolvedId as l, normalizePath as n, stripLeadingSlashes as o, normalizeRelativePath as r, toPosixPath as s, isPathInside as t, normalizeViteId as u };
|
|
58
|
+
export { normalizeFsResolvedId as n, normalizeViteId as r, isSkippableResolvedId as t };
|
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import path from "pathe";
|
|
4
4
|
import { defu } from "@weapp-core/shared";
|
|
5
|
-
|
|
5
|
+
// src/auto-import-components/resolvers/json/tdesign.json
|
|
6
6
|
var tdesign_default = [
|
|
7
7
|
"action-sheet",
|
|
8
8
|
"avatar",
|
|
@@ -93,8 +93,7 @@ var tdesign_default = [
|
|
|
93
93
|
"upload",
|
|
94
94
|
"watermark"
|
|
95
95
|
];
|
|
96
|
-
|
|
97
|
-
//#region src/auto-import-components/resolvers/tdesign.ts
|
|
96
|
+
// src/auto-import-components/resolvers/tdesign.ts
|
|
98
97
|
const defaultPrefix$2 = "t-";
|
|
99
98
|
const TDesignResolver = (opts) => {
|
|
100
99
|
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
@@ -153,8 +152,7 @@ const TDesignResolver = (opts) => {
|
|
|
153
152
|
}
|
|
154
153
|
};
|
|
155
154
|
};
|
|
156
|
-
|
|
157
|
-
//#region src/auto-import-components/resolvers/json/uviewPlus.json
|
|
155
|
+
// src/auto-import-components/resolvers/json/uviewPlus.json
|
|
158
156
|
var uviewPlus_default = [
|
|
159
157
|
"u-action-sheet",
|
|
160
158
|
"u-action-sheet-data",
|
|
@@ -298,8 +296,7 @@ var uviewPlus_default = [
|
|
|
298
296
|
"u-virtual-list",
|
|
299
297
|
"u-waterfall"
|
|
300
298
|
];
|
|
301
|
-
|
|
302
|
-
//#region src/auto-import-components/resolvers/uviewPlus.ts
|
|
299
|
+
// src/auto-import-components/resolvers/uviewPlus.ts
|
|
303
300
|
const PACKAGE_NAME$1 = "uview-plus";
|
|
304
301
|
const require = createRequire(import.meta.url);
|
|
305
302
|
function resolveComponentId(from, importerBaseName) {
|
|
@@ -355,8 +352,7 @@ function UviewPlusResolver(options = {}) {
|
|
|
355
352
|
}
|
|
356
353
|
};
|
|
357
354
|
}
|
|
358
|
-
|
|
359
|
-
//#region src/auto-import-components/resolvers/json/vant.json
|
|
355
|
+
// src/auto-import-components/resolvers/json/vant.json
|
|
360
356
|
var vant_default = [
|
|
361
357
|
"action-sheet",
|
|
362
358
|
"area",
|
|
@@ -428,8 +424,7 @@ var vant_default = [
|
|
|
428
424
|
"tree-select",
|
|
429
425
|
"uploader"
|
|
430
426
|
];
|
|
431
|
-
|
|
432
|
-
//#region src/auto-import-components/resolvers/vant.ts
|
|
427
|
+
// src/auto-import-components/resolvers/vant.ts
|
|
433
428
|
const defaultPrefix$1 = "van-";
|
|
434
429
|
const VantResolver = (opts) => {
|
|
435
430
|
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
@@ -474,8 +469,7 @@ const VantResolver = (opts) => {
|
|
|
474
469
|
}
|
|
475
470
|
};
|
|
476
471
|
};
|
|
477
|
-
|
|
478
|
-
//#region src/auto-import-components/resolvers/json/weui.json
|
|
472
|
+
// src/auto-import-components/resolvers/json/weui.json
|
|
479
473
|
var weui_default = [
|
|
480
474
|
"actionsheet",
|
|
481
475
|
"badge",
|
|
@@ -499,8 +493,7 @@ var weui_default = [
|
|
|
499
493
|
"toptips",
|
|
500
494
|
"uploader"
|
|
501
495
|
];
|
|
502
|
-
|
|
503
|
-
//#region src/auto-import-components/resolvers/weui.ts
|
|
496
|
+
// src/auto-import-components/resolvers/weui.ts
|
|
504
497
|
const defaultPrefix = "mp-";
|
|
505
498
|
const WeuiResolver = (opts) => {
|
|
506
499
|
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
@@ -535,8 +528,7 @@ const WeuiResolver = (opts) => {
|
|
|
535
528
|
}
|
|
536
529
|
};
|
|
537
530
|
};
|
|
538
|
-
|
|
539
|
-
//#region src/auto-import-components/resolvers/json/wotUi.json
|
|
531
|
+
// src/auto-import-components/resolvers/json/wotUi.json
|
|
540
532
|
var wotUi_default = [
|
|
541
533
|
"wd-action-sheet",
|
|
542
534
|
"wd-avatar",
|
|
@@ -639,8 +631,7 @@ var wotUi_default = [
|
|
|
639
631
|
"wd-video-preview",
|
|
640
632
|
"wd-watermark"
|
|
641
633
|
];
|
|
642
|
-
|
|
643
|
-
//#region src/auto-import-components/resolvers/wotUi.ts
|
|
634
|
+
// src/auto-import-components/resolvers/wotUi.ts
|
|
644
635
|
const PACKAGE_NAME = "@wot-ui/ui";
|
|
645
636
|
/**
|
|
646
637
|
* 创建 Wot UI 的 Vue SFC 自动导入解析器。
|
|
@@ -685,5 +676,4 @@ function WotUiResolver(options) {
|
|
|
685
676
|
}
|
|
686
677
|
};
|
|
687
678
|
}
|
|
688
|
-
//#endregion
|
|
689
679
|
export { TDesignResolver as a, UviewPlusResolver as i, WeuiResolver as n, VantResolver as r, WotUiResolver as t };
|
package/dist/resolvers.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UviewPlusResolver, c as CreateResolver, d as ResolvedValue, f as Resolver, g as ResolverSupportFilesStrategy, h as ResolverObject, i as VantResolver, l as ExternalMetadataFileCandidates, m as ResolverMeta, n as WotUiResolverOptions, o as UviewPlusResolverOptions, p as ResolverFn, r as WeuiResolver, s as TDesignResolver, t as WotUiResolver, u as Options } from "./index-
|
|
1
|
+
import { a as UviewPlusResolver, c as CreateResolver, d as ResolvedValue, f as Resolver, g as ResolverSupportFilesStrategy, h as ResolverObject, i as VantResolver, l as ExternalMetadataFileCandidates, m as ResolverMeta, n as WotUiResolverOptions, o as UviewPlusResolverOptions, p as ResolverFn, r as WeuiResolver, s as TDesignResolver, t as WotUiResolver, u as Options } from "./index-SnaW3cvA.mjs";
|
|
2
2
|
export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, UviewPlusResolver, UviewPlusResolverOptions, VantResolver, WeuiResolver, WotUiResolver, WotUiResolverOptions };
|
package/dist/resolvers.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as TDesignResolver, i as UviewPlusResolver, r as VantResolver, n as WeuiResolver, t as WotUiResolver } from "./resolvers-
|
|
1
|
+
export { a as TDesignResolver, i as UviewPlusResolver, r as VantResolver, n as WeuiResolver, t as WotUiResolver } from "./resolvers-CKYqmRD_.mjs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types/routes.d.ts
|
|
2
1
|
interface AutoRoutesSubPackage {
|
|
3
2
|
root: string;
|
|
4
3
|
pages: string[];
|
|
@@ -9,5 +8,4 @@ interface AutoRoutes {
|
|
|
9
8
|
entries: string[];
|
|
10
9
|
subPackages: AutoRoutesSubPackage[];
|
|
11
10
|
}
|
|
12
|
-
//#endregion
|
|
13
11
|
export { AutoRoutesSubPackage as n, AutoRoutes as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ComputedDefinitions, MethodDefinitions, WevuPageLayoutMap } from "wevu";
|
|
2
|
-
//#region src/plugins/vue/createWevuComponent.d.ts
|
|
1
|
+
import { ComputedDefinitions, MethodDefinitions, WevuPageLayoutMap } from "wevu/types";
|
|
3
2
|
interface WevuComponentOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> {
|
|
4
3
|
data?: () => D;
|
|
5
4
|
computed?: C;
|
|
@@ -19,8 +18,6 @@ interface WevuComponentOptions<D extends object = Record<string, any>, C extends
|
|
|
19
18
|
* 在微信小程序中,Component() 可以同时定义页面与组件。
|
|
20
19
|
*/
|
|
21
20
|
declare function createWevuComponent(options: WevuComponentOptions): void;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/plugins/vue/nativeLayoutHost.d.ts
|
|
24
21
|
type LayoutHostContext = Record<string, any>;
|
|
25
22
|
type LayoutHostResolver = (key: string) => unknown;
|
|
26
23
|
type LayoutHostEntry = unknown | (() => unknown);
|
|
@@ -50,14 +47,10 @@ declare function resolveLayoutHost<T = any>(key: string, options?: LayoutHostRes
|
|
|
50
47
|
* 等待当前页面 layout 宿主组件可用。
|
|
51
48
|
*/
|
|
52
49
|
declare function waitForLayoutHost<T = any>(key: string, options?: LayoutHostResolveOptions): Promise<T | null>;
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/plugins/vue/nativePageLayout.d.ts
|
|
55
50
|
type ResolveTypedPageLayoutName = keyof WevuPageLayoutMap extends never ? string : Extract<keyof WevuPageLayoutMap, string>;
|
|
56
51
|
type ResolveTypedPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap ? WevuPageLayoutMap[Name] : Record<string, any>;
|
|
57
52
|
declare function setPageLayout(layout: false): void;
|
|
58
53
|
declare function setPageLayout<Name extends ResolveTypedPageLayoutName>(layout: Name, props?: ResolveTypedPageLayoutProps<Name>): void;
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/plugins/vue/runtimeMacros.d.ts
|
|
61
54
|
/**
|
|
62
55
|
* 说明:Vue 3 风格的 props 声明(用于类型提示)
|
|
63
56
|
*/
|
|
@@ -66,5 +59,4 @@ declare function defineProps<T extends Record<string, any>>(props: T): T;
|
|
|
66
59
|
* 说明:Vue 3 风格的 emits 声明(用于类型提示)
|
|
67
60
|
*/
|
|
68
61
|
declare function defineEmits<T extends Record<string, any> | string[]>(emits: T): T;
|
|
69
|
-
//#endregion
|
|
70
62
|
export { LayoutHostContext as a, LayoutHostResolver as c, unregisterLayoutHosts as d, waitForLayoutHost as f, LayoutHostBridge as i, registerLayoutHosts as l, createWevuComponent as m, defineProps as n, LayoutHostEntry as o, WevuComponentOptions as p, setPageLayout as r, LayoutHostResolveOptions as s, defineEmits as t, resolveLayoutHost as u };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { l as resolveBackendExecution } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
3
|
+
import { defu } from "@weapp-core/shared";
|
|
4
|
+
// src/cli/runtime.ts
|
|
5
|
+
function logRuntimeTarget(targets, options = {}) {
|
|
6
|
+
if (options.silent) return;
|
|
7
|
+
if (targets.label === "config") {
|
|
8
|
+
const resolvedPlatform = targets.platform ?? options.resolvedConfigPlatform;
|
|
9
|
+
if (resolvedPlatform) {
|
|
10
|
+
logger_default.info(`目标平台:${colors.green(resolvedPlatform)}`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
logger_default.info(`目标平台:使用配置文件中的 ${colors.bold(colors.green("weapp.platform"))}`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
logger_default.info(`目标平台:${colors.green(targets.label)}`);
|
|
17
|
+
}
|
|
18
|
+
function resolveRuntimeTargets(options) {
|
|
19
|
+
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
20
|
+
const execution = resolveBackendExecution(rawPlatform, { warn: (message) => logger_default.warn(message) });
|
|
21
|
+
const miniBackend = execution.get("miniprogram");
|
|
22
|
+
return {
|
|
23
|
+
...execution,
|
|
24
|
+
platform: miniBackend?.platform,
|
|
25
|
+
rawPlatform
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function resolveConfiguredRuntimeTargets(targets, platform) {
|
|
29
|
+
return targets.rawPlatform === void 0 && platform === "web" ? resolveRuntimeTargets({ platform: "web" }) : targets;
|
|
30
|
+
}
|
|
31
|
+
function createInlineConfig(execution, options = {}) {
|
|
32
|
+
const configs = execution.entries.map((entry) => entry.driver.createInlineConfig({
|
|
33
|
+
execution,
|
|
34
|
+
platform: entry.platform,
|
|
35
|
+
scope: options.scope,
|
|
36
|
+
host: options.host
|
|
37
|
+
})).filter((config) => Boolean(config));
|
|
38
|
+
if (configs.length === 0) return options.inlineConfig;
|
|
39
|
+
const merged = configs.slice(1).reduce((merged, config) => defu(merged, config), configs[0]);
|
|
40
|
+
return options.inlineConfig ? defu(options.inlineConfig, merged) : merged;
|
|
41
|
+
}
|
|
42
|
+
export { resolveRuntimeTargets as i, logRuntimeTarget as n, resolveConfiguredRuntimeTargets as r, createInlineConfig as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WEVU_PAGE_LAYOUT_SETTER_KEY } from "@weapp-core/constants";
|
|
2
2
|
import { createMiniProgramLayoutHostRegistry, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramRuntimeCapability } from "@weapp-core/shared";
|
|
3
3
|
import { defineComponent } from "wevu";
|
|
4
|
-
|
|
4
|
+
// src/plugins/vue/createWevuComponent.ts
|
|
5
5
|
/**
|
|
6
6
|
* 从 Vue SFC 的 options 创建 wevu 组件
|
|
7
7
|
* 同时支持 Vue 2 风格(Options API)与 Vue 3 风格(Composition API)
|
|
@@ -18,8 +18,7 @@ function createWevuComponent(options) {
|
|
|
18
18
|
...mpOptions
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
//#region src/plugins/vue/nativeLayoutHost.ts
|
|
21
|
+
// src/plugins/vue/nativeLayoutHost.ts
|
|
23
22
|
const layoutHostRegistry = createMiniProgramLayoutHostRegistry();
|
|
24
23
|
function resolveCurrentPageInstance$1() {
|
|
25
24
|
const compiledPlatform = resolveMiniProgramPlatform(import.meta.env?.PLATFORM);
|
|
@@ -81,8 +80,7 @@ function resolveLayoutHost(key, options = {}) {
|
|
|
81
80
|
function waitForLayoutHost(key, options = {}) {
|
|
82
81
|
return layoutHostRegistry.waitForHost(key, () => resolvePageKeys(resolvePageFromContext(options.context)), (bridge, key) => bridge.resolveHost(key), options);
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
//#region src/plugins/vue/nativePageLayout.ts
|
|
83
|
+
// src/plugins/vue/nativePageLayout.ts
|
|
86
84
|
function resolveCurrentPageInstance() {
|
|
87
85
|
const compiledPlatform = resolveMiniProgramPlatform(import.meta.env?.PLATFORM);
|
|
88
86
|
if (!supportsMiniProgramRuntimeCapability(compiledPlatform, "globalPageStack")) return;
|
|
@@ -106,8 +104,7 @@ function setPageLayout(layout, props) {
|
|
|
106
104
|
}
|
|
107
105
|
throw new Error("setPageLayout() 未找到当前页面实例。请在页面生命周期、事件回调或当前页面上下文中调用。");
|
|
108
106
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/plugins/vue/runtimeMacros.ts
|
|
107
|
+
// src/plugins/vue/runtimeMacros.ts
|
|
111
108
|
/**
|
|
112
109
|
* 说明:Vue 3 风格的 props 声明(用于类型提示)
|
|
113
110
|
*/
|
|
@@ -120,5 +117,4 @@ function defineProps(props) {
|
|
|
120
117
|
function defineEmits(emits) {
|
|
121
118
|
return emits;
|
|
122
119
|
}
|
|
123
|
-
//#endregion
|
|
124
120
|
export { resolveLayoutHost as a, createWevuComponent as c, registerLayoutHosts as i, defineProps as n, unregisterLayoutHosts as o, setPageLayout as r, waitForLayoutHost as s, defineEmits as t };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LayoutHostContext, c as LayoutHostResolver, d as unregisterLayoutHosts, f as waitForLayoutHost, i as LayoutHostBridge, l as registerLayoutHosts, m as createWevuComponent, n as defineProps, o as LayoutHostEntry, p as WevuComponentOptions, r as setPageLayout, s as LayoutHostResolveOptions, t as defineEmits, u as resolveLayoutHost } from "./runtime-
|
|
1
|
+
import { a as LayoutHostContext, c as LayoutHostResolver, d as unregisterLayoutHosts, f as waitForLayoutHost, i as LayoutHostBridge, l as registerLayoutHosts, m as createWevuComponent, n as defineProps, o as LayoutHostEntry, p as WevuComponentOptions, r as setPageLayout, s as LayoutHostResolveOptions, t as defineEmits, u as resolveLayoutHost } from "./runtime-BL4RjBRa.mjs";
|
|
2
2
|
export { type LayoutHostBridge, type LayoutHostContext, type LayoutHostEntry, type LayoutHostResolveOptions, type LayoutHostResolver, type WevuComponentOptions, createWevuComponent, defineEmits, defineProps, registerLayoutHosts, resolveLayoutHost, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { c as createWevuComponent, t as defineEmits, n as defineProps, i as registerLayoutHosts, a as resolveLayoutHost, r as setPageLayout, o as unregisterLayoutHosts, s as waitForLayoutHost } from "./runtime-
|
|
1
|
+
export { c as createWevuComponent, t as defineEmits, n as defineProps, i as registerLayoutHosts, a as resolveLayoutHost, r as setPageLayout, o as unregisterLayoutHosts, s as waitForLayoutHost } from "./runtime-DDUCb7pP.mjs";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import path from "pathe";
|
|
4
|
+
import { defu } from "@weapp-core/shared";
|
|
5
|
+
import { fs } from "@weapp-core/shared/fs";
|
|
6
|
+
import { generateJs, generateJson, generateWxml, generateWxss } from "@weapp-core/schematics";
|
|
7
|
+
// src/schematics.ts
|
|
8
|
+
function composePath(outDir, filename) {
|
|
9
|
+
return `${outDir}${outDir ? "/" : ""}${filename}`;
|
|
10
|
+
}
|
|
11
|
+
const defaultExtensions = {
|
|
12
|
+
js: "js",
|
|
13
|
+
json: "json",
|
|
14
|
+
wxml: "wxml",
|
|
15
|
+
wxss: "wxss"
|
|
16
|
+
};
|
|
17
|
+
function resolveExtension(extension) {
|
|
18
|
+
return extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
|
|
19
|
+
}
|
|
20
|
+
async function readTemplateFile(templatePath, context) {
|
|
21
|
+
const absolutePath = path.isAbsolute(templatePath) ? templatePath : path.resolve(context.cwd, templatePath);
|
|
22
|
+
return fs.readFile(absolutePath, "utf8");
|
|
23
|
+
}
|
|
24
|
+
async function loadTemplate(template, context) {
|
|
25
|
+
if (template === void 0) return;
|
|
26
|
+
if (typeof template === "function") {
|
|
27
|
+
const result = await template(context);
|
|
28
|
+
return result == null ? void 0 : String(result);
|
|
29
|
+
}
|
|
30
|
+
if (typeof template === "string") return readTemplateFile(template, context);
|
|
31
|
+
if ("content" in template && typeof template.content === "string") return template.content;
|
|
32
|
+
if ("path" in template && typeof template.path === "string") return readTemplateFile(template.path, context);
|
|
33
|
+
}
|
|
34
|
+
function resolveTemplate(templates, type, fileType) {
|
|
35
|
+
const scoped = templates?.[type]?.[fileType];
|
|
36
|
+
if (scoped !== void 0) return scoped;
|
|
37
|
+
return templates?.shared?.[fileType];
|
|
38
|
+
}
|
|
39
|
+
async function generate(options) {
|
|
40
|
+
let { fileName, outDir, extensions, type, cwd, templates } = defu(options, {
|
|
41
|
+
type: "component",
|
|
42
|
+
extensions: { ...defaultExtensions },
|
|
43
|
+
cwd: process.cwd(),
|
|
44
|
+
templates: void 0
|
|
45
|
+
});
|
|
46
|
+
if (fileName === void 0) fileName = path.basename(outDir);
|
|
47
|
+
const basepath = path.resolve(cwd, outDir);
|
|
48
|
+
const targetFileTypes = type === "app" ? [
|
|
49
|
+
"js",
|
|
50
|
+
"wxss",
|
|
51
|
+
"json"
|
|
52
|
+
] : [
|
|
53
|
+
"js",
|
|
54
|
+
"wxss",
|
|
55
|
+
"json",
|
|
56
|
+
"wxml"
|
|
57
|
+
];
|
|
58
|
+
const files = [];
|
|
59
|
+
for (const fileType of targetFileTypes) {
|
|
60
|
+
const configuredExt = extensions[fileType] ?? defaultExtensions[fileType];
|
|
61
|
+
let resolvedExt = configuredExt;
|
|
62
|
+
let defaultCode;
|
|
63
|
+
if (fileType === "js") defaultCode = generateJs(type);
|
|
64
|
+
else if (fileType === "wxss") defaultCode = generateWxss();
|
|
65
|
+
else if (fileType === "wxml") defaultCode = generateWxml(path.join(outDir, fileName));
|
|
66
|
+
else if (fileType === "json") {
|
|
67
|
+
defaultCode = generateJson(type, configuredExt);
|
|
68
|
+
if (configuredExt === "js" || configuredExt === "ts") resolvedExt = `json.${configuredExt}`;
|
|
69
|
+
}
|
|
70
|
+
const context = {
|
|
71
|
+
type,
|
|
72
|
+
fileType,
|
|
73
|
+
fileName,
|
|
74
|
+
outDir,
|
|
75
|
+
extension: resolvedExt,
|
|
76
|
+
cwd,
|
|
77
|
+
defaultCode
|
|
78
|
+
};
|
|
79
|
+
const finalCode = await loadTemplate(resolveTemplate(templates, type, fileType), context) ?? defaultCode;
|
|
80
|
+
if (finalCode !== void 0) files.push({
|
|
81
|
+
fileName: `${fileName}${resolveExtension(resolvedExt)}`,
|
|
82
|
+
code: finalCode
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
for (const { code, fileName } of files) if (code !== void 0) {
|
|
86
|
+
await fs.outputFile(path.resolve(basepath, fileName), code, "utf8");
|
|
87
|
+
logger_default.success(`${composePath(outDir, fileName)} 创建成功!`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export { generate };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { F as
|
|
4
|
-
import {
|
|
1
|
+
import { B as resolveHmrRuntimeDecision, D as getStatefulHmrHost, E as createStatefulHmrHostPlugins, F as prepareClassicIdeConfig, I as attachHmrRuntimeSession, L as createHmrRuntimeSession, N as syncManagedTsconfigFiles, O as createSharedBuildConfig, P as getInitialBuildInputObservation, S as createOxcRuntimeSupport, T as attachStatefulHmrHost, _ as clearStatefulHmrSnapshot, b as createPackageBuilder, d as buildStatefulHmrSnapshot, f as prepareStatefulHmrSnapshot, g as StatefulHmrSnapshotHandoff, h as prepareStatefulClassicHandoff, k as getHmrRuntimeCapabilityFallback, m as captureWatchDependencies, p as checkAppWorkersOptions, u as CompilerSession, v as offerStatefulHmrSnapshot, x as settlePackageBuilds, y as getPackNpmRelationList, z as findSkylineRendererFiles } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { t as resolveRealpath } from "./realpathScope-DwlLaCk3.mjs";
|
|
3
|
+
import { F as resolveNpmBuildCandidateDependenciesSync, L as resolveNpmDistDirName, P as resolveMainBuildDependencyPatterns, f as attachDevModuleGraphHost, z as resolveTargetDependencies } from "./devProvider-Bcvz5nu4.mjs";
|
|
4
|
+
import { g as pruneOwnedAssetFiles } from "./utils-CTGSZp4j.mjs";
|
|
5
|
+
import { n as loadHostRolldownBuild } from "./engine-Mnnm_ALP.mjs";
|
|
5
6
|
import path from "pathe";
|
|
6
7
|
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
|
7
8
|
import { build } from "vite";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
|
-
import { Buffer } from "node:buffer";
|
|
10
10
|
import os from "node:os";
|
|
11
|
-
|
|
11
|
+
import { Buffer } from "node:buffer";
|
|
12
|
+
// src/vite/npm/sourcemap.ts
|
|
12
13
|
const URL_SCHEME = /^[a-z][a-z\d+.-]*:/i;
|
|
13
14
|
const INLINE_MAP = /(\/\/[#@]\s*sourceMappingURL=data:application\/json(?:;charset=[^;,]*)?;base64,)([a-z\d+/=]+)/gi;
|
|
14
15
|
/** npm 镜像目录深度可能不同,重定位相对源码路径但保持 URL 与绝对来源不变。 */
|
|
@@ -39,8 +40,7 @@ function relocateNpmSourcemap(source, from, to) {
|
|
|
39
40
|
sources
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/vite/npm/output.ts
|
|
43
|
+
// src/vite/npm/output.ts
|
|
44
44
|
function relativeOutput(root, target) {
|
|
45
45
|
const relative = path.relative(root, target);
|
|
46
46
|
return relative !== ".." && !relative.startsWith("../") && !path.isAbsolute(relative) ? relative : void 0;
|
|
@@ -154,8 +154,7 @@ function createNpmOutput(temporaryRoot, targetRoots) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
//#region src/vite/npm/index.ts
|
|
157
|
+
// src/vite/npm/index.ts
|
|
159
158
|
/** 复用依赖编译器和 npm 关联配置,最终输出统一交给宿主 emit/write。 */
|
|
160
159
|
async function prepareNpmAssets(ctx) {
|
|
161
160
|
const config = ctx.configService;
|
|
@@ -208,8 +207,7 @@ async function prepareNpmAssets(ctx) {
|
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
|
-
|
|
212
|
-
//#region src/vite/npm/publish.ts
|
|
210
|
+
// src/vite/npm/publish.ts
|
|
213
211
|
/** 手工映射到主目录外的依赖仍由宿主配套引擎写出,只清理上轮实际拥有的文件。 */
|
|
214
212
|
async function publishNpmAssets(outDir, assets, obsolete) {
|
|
215
213
|
const virtualEntry = "\0weapp-vite-npm-output";
|
|
@@ -242,8 +240,7 @@ async function publishNpmAssets(outDir, assets, obsolete) {
|
|
|
242
240
|
await bundle.close();
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
|
-
|
|
246
|
-
//#region src/vite/npm/ownership.ts
|
|
243
|
+
// src/vite/npm/ownership.ts
|
|
247
244
|
async function readOwnership(fileName) {
|
|
248
245
|
let value;
|
|
249
246
|
try {
|
|
@@ -275,14 +272,24 @@ async function publishOwnedNpmAssets(cwd, hostOutDir, external) {
|
|
|
275
272
|
source: JSON.stringify([...current])
|
|
276
273
|
}], []);
|
|
277
274
|
}
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
// src/vite/session.ts
|
|
276
|
+
const runtimeOwners = /* @__PURE__ */ new WeakMap();
|
|
280
277
|
/** 标准插件的目标校验和依赖准备,共享底层编译会话生命周期。 */
|
|
281
278
|
var WeappBuildSession = class extends CompilerSession {
|
|
279
|
+
hmrRuntimeSession;
|
|
282
280
|
dependencyBuild;
|
|
283
281
|
validating;
|
|
282
|
+
hostClosing;
|
|
283
|
+
terminalClosing;
|
|
284
284
|
isWeb = false;
|
|
285
285
|
statefulController;
|
|
286
|
+
constructor(hmrRuntimeSession = createHmrRuntimeSession()) {
|
|
287
|
+
super();
|
|
288
|
+
this.hmrRuntimeSession = hmrRuntimeSession;
|
|
289
|
+
runtimeOwners.set(hmrRuntimeSession, this);
|
|
290
|
+
this.onClose(attachHmrRuntimeSession(this.context, hmrRuntimeSession));
|
|
291
|
+
this.onClose(() => clearStatefulHmrSnapshot(this.context));
|
|
292
|
+
}
|
|
286
293
|
async prepare(config, cwd, mode, isDev = false) {
|
|
287
294
|
if (!config.resolve?.preserveSymlinks) try {
|
|
288
295
|
cwd = resolveRealpath(cwd);
|
|
@@ -307,16 +314,65 @@ var WeappBuildSession = class extends CompilerSession {
|
|
|
307
314
|
if (!merged) throw new Error("[weapp-vite] Web 目标不能禁用 weapp.web。");
|
|
308
315
|
return merged;
|
|
309
316
|
}
|
|
310
|
-
|
|
317
|
+
await prepareClassicIdeConfig(this.context);
|
|
318
|
+
if (isDev && this.hmrRuntimeSession.resolve(resolveHmrRuntimeDecision({
|
|
311
319
|
platform: service.platform,
|
|
312
320
|
configured: service.weappViteConfig.hmr?.runtime,
|
|
313
321
|
compileHotReLoad: service.projectPrivateConfig.setting?.compileHotReLoad
|
|
314
|
-
}).runtime === "stateful-experimental") {
|
|
315
|
-
if (service.platform !== "weapp")
|
|
316
|
-
|
|
322
|
+
})).runtime === "stateful-experimental") {
|
|
323
|
+
if (service.platform !== "weapp") this.hmrRuntimeSession.requestClassic({
|
|
324
|
+
code: "platform",
|
|
325
|
+
message: "当前小程序平台不支持状态保持热更新。"
|
|
326
|
+
});
|
|
327
|
+
else await this.run(async () => {
|
|
328
|
+
try {
|
|
329
|
+
const snapshot = prepareStatefulHmrSnapshot(await buildStatefulHmrSnapshot(service.loadOptions, void 0, this.context, void 0, []));
|
|
330
|
+
const skylineFiles = findSkylineRendererFiles(snapshot.output);
|
|
331
|
+
if (skylineFiles.length) {
|
|
332
|
+
this.hmrRuntimeSession.requestClassic({
|
|
333
|
+
code: "skyline",
|
|
334
|
+
message: "微信 Skyline 暂不支持状态保持 HMR。",
|
|
335
|
+
files: skylineFiles
|
|
336
|
+
});
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
await offerStatefulHmrSnapshot(this.context, new StatefulHmrSnapshotHandoff(snapshot, snapshot.inputs));
|
|
340
|
+
this.statefulController = createStatefulHmrHostPlugins(this.context);
|
|
341
|
+
} catch (error) {
|
|
342
|
+
const fallback = getHmrRuntimeCapabilityFallback(error);
|
|
343
|
+
if (!fallback) throw error;
|
|
344
|
+
this.hmrRuntimeSession.requestClassic(fallback);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
317
347
|
}
|
|
318
348
|
return this.context.configService.merge(void 0, createSharedBuildConfig(this.context.configService, this.context.scanService));
|
|
319
349
|
}
|
|
350
|
+
/** 只关闭本代资源;宿主负责在原生 watcher 和服务器均退出后恢复 IDE 设置。 */
|
|
351
|
+
closeHostGeneration(reason) {
|
|
352
|
+
if (!this.hostClosing) {
|
|
353
|
+
if (reason === "restart" && this.hmrRuntimeSession.fallback) prepareStatefulClassicHandoff(this.context);
|
|
354
|
+
this.hostClosing = super.close();
|
|
355
|
+
}
|
|
356
|
+
return this.hostClosing;
|
|
357
|
+
}
|
|
358
|
+
/** 无宿主的构建或首次配置失败可直接释放,已绑定宿主必须走其关闭门禁。 */
|
|
359
|
+
close(reason = "close") {
|
|
360
|
+
return reason === "restart" ? this.closeHostGeneration(reason) : this.terminalClosing ??= this.closeHostGeneration(reason).then(() => this.releaseClassicIdeConfig());
|
|
361
|
+
}
|
|
362
|
+
/** 只释放仍未被替换宿主接管的 owner,初始化失败和遗弃交接使用同一关闭门禁。 */
|
|
363
|
+
async releaseClassicIdeConfig() {
|
|
364
|
+
await super.close();
|
|
365
|
+
if (runtimeOwners.get(this.hmrRuntimeSession) === this) {
|
|
366
|
+
this.hmrRuntimeSession.sourcePublication.close();
|
|
367
|
+
await this.hmrRuntimeSession.classicIdeConfig.close();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/** 原生宿主链已完全退出后,连同尚未绑定宿主的失败替换代一起释放。 */
|
|
371
|
+
async releaseHostClassicIdeConfig() {
|
|
372
|
+
await runtimeOwners.get(this.hmrRuntimeSession)?.closeHostGeneration("close");
|
|
373
|
+
this.hmrRuntimeSession.sourcePublication.close();
|
|
374
|
+
await this.hmrRuntimeSession.classicIdeConfig.close();
|
|
375
|
+
}
|
|
320
376
|
validateEntries() {
|
|
321
377
|
if (this.validating && !this.isClosing) return this.validating;
|
|
322
378
|
if (this.state !== "ready" && this.state !== "building") return Promise.reject(/* @__PURE__ */ new Error(`[weapp-vite] 无法从 ${this.state} 状态开始构建。`));
|
|
@@ -330,6 +386,9 @@ var WeappBuildSession = class extends CompilerSession {
|
|
|
330
386
|
await syncManagedTsconfigFiles(this.context);
|
|
331
387
|
if (this.isClosing) throw new Error("[weapp-vite] 构建会话已关闭。");
|
|
332
388
|
this.state = "building";
|
|
389
|
+
}).catch((error) => {
|
|
390
|
+
getInitialBuildInputObservation(this.context.configService)?.close();
|
|
391
|
+
throw error;
|
|
333
392
|
}).finally(() => {
|
|
334
393
|
this.validating = void 0;
|
|
335
394
|
});
|
|
@@ -345,7 +404,9 @@ var WeappBuildSession = class extends CompilerSession {
|
|
|
345
404
|
let reportedReady = false;
|
|
346
405
|
const reportReady = () => {
|
|
347
406
|
if (started && successful && !reportedReady && !this.isClosing) {
|
|
407
|
+
if (this.statefulController && this.hmrRuntimeSession.phase === "switching") return;
|
|
348
408
|
reportedReady = true;
|
|
409
|
+
if (!this.statefulController) this.hmrRuntimeSession.markClassic();
|
|
349
410
|
server.config.logger.info(`[weapp-vite] 小程序开发产物已就绪 (${this.statefulController ? "stateful-experimental" : "classic"})`);
|
|
350
411
|
}
|
|
351
412
|
};
|
|
@@ -386,5 +447,4 @@ var WeappBuildSession = class extends CompilerSession {
|
|
|
386
447
|
await this.run(() => publishOwnedNpmAssets(cwd, outDir, external));
|
|
387
448
|
}
|
|
388
449
|
};
|
|
389
|
-
//#endregion
|
|
390
450
|
export { WeappBuildSession };
|
package/dist/test.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/testArtifact.d.ts
|
|
2
1
|
export interface BuildTestArtifactOptions {
|
|
3
2
|
configFile?: string;
|
|
4
3
|
cwd?: string;
|
|
@@ -29,5 +28,4 @@ export declare function buildTestArtifact(options?: BuildTestArtifactOptions): P
|
|
|
29
28
|
projectPath: string;
|
|
30
29
|
sourceRootPath: string;
|
|
31
30
|
}>;
|
|
32
|
-
export declare function watchTestArtifact(options?: WatchTestArtifactOptions): Promise<WeappViteTestArtifactWatcher>;
|
|
33
|
-
//#endregion
|
|
31
|
+
export declare function watchTestArtifact(options?: WatchTestArtifactOptions): Promise<WeappViteTestArtifactWatcher>;
|