weapp-vite 7.6.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 +6 -4
- package/THIRD_PARTY_NOTICES.md +3 -3
- 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-B3YZMA-h.mjs → action-BD56SQh4.mjs} +7 -8
- package/dist/{action-DlC6JYpt.mjs → action-CPtgEl6p.mjs} +9 -10
- package/dist/{action-BOk3vGI7.mjs → action-le0bNff_.mjs} +22 -30
- package/dist/{action-BELcDNNv.mjs → action-ytG5oFAw.mjs} +5 -6
- package/dist/{action-zEDY7oh_.mjs → action-zmJrU8PC.mjs} +11 -13
- package/dist/{analyze-DN79YOAH.mjs → analyze-DCZo-sJd.mjs} +3 -6
- package/dist/{artifacts-BOyC9Fy-.mjs → artifacts-TrTX9_jj.mjs} +2 -4
- package/dist/{assets-C5_YYXNk.mjs → assets-XyhpYtGl.mjs} +11 -18
- 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-CTLOHwgI.d.mts → budget-DTPngJU0.d.mts} +1 -9
- package/dist/{budget-EOeEycc_.mjs → budget-_Mu-4GKn.mjs} +2 -4
- package/dist/{builtProject-C29udgXY.mjs → builtProject-B145uOt5.mjs} +11 -18
- package/dist/{classifier-DBJY__kg.mjs → classifier-CNTJOYQL.mjs} +4 -5
- package/dist/cli-acceptance.mjs +3 -4
- package/dist/cli.mjs +55 -86
- package/dist/{config-DRGcCi3h.mjs → config-59ZWhCIf.mjs} +1 -2
- package/dist/{config-Bf6DWhyb.d.mts → config-BNx2BODw.d.mts} +13 -105
- 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-aYwi8wQt.mjs → createCompilerContextInstance-BXSdH2E8.mjs} +1710 -1511
- package/dist/{createContext-tApLtII-.mjs → createContext-W0TeXxbo.mjs} +3 -4
- package/dist/dashboard/analyze.d.mts +1 -7
- package/dist/dashboard/analyze.mjs +2 -2
- 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 +20 -36
- package/dist/{dashboardTransport-C_Y6jMp-.mjs → dashboardTransport-C9290QgS.mjs} +1 -2
- package/dist/{dashboardViteBridge-DCGR43aM.mjs → dashboardViteBridge-B7QgQo94.mjs} +4 -7
- package/dist/{dev-C2fgr_Xd.mjs → dev-D1QSExwk.mjs} +2 -3
- package/dist/devProvider-Bcvz5nu4.mjs +4966 -0
- package/dist/docs/README.md +6 -4
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/mcp.md +1 -1
- package/dist/docs/troubleshooting.md +8 -0
- package/dist/docs/weapp-config.md +29 -0
- package/dist/docs/wevu-authoring.md +2 -0
- package/dist/doctor-worker.mjs +5 -6
- package/dist/doctor.d.mts +2 -8
- package/dist/doctor.mjs +16 -25
- package/dist/{engine-C66J0HLz.mjs → engine-Mnnm_ALP.mjs} +1 -2
- package/dist/file-5eEfbK60.mjs +1 -0
- package/dist/{file-CcIOmqhC.mjs → file-D8mp5GmB.mjs} +6 -10
- package/dist/{files-BqxFIPRp.mjs → files-Cy9jURJu.mjs} +1 -2
- package/dist/{forwardConsole-B0Reo8Lf.mjs → forwardConsole-D2Q0RIqc.mjs} +5 -7
- package/dist/getInstance-BXNVH7sU.mjs +1 -0
- package/dist/{getInstance-Dt9IQDKr.mjs → getInstance-DfNlbr-X.mjs} +2 -3
- package/dist/{history-BIiRCzbq.mjs → history-dKxzoHmN.mjs} +18 -28
- package/dist/i18n.d.mts +1 -3
- package/dist/i18n.mjs +1 -2
- package/dist/{index-D5rgBzYZ.d.mts → index-DIZJRrvK.d.mts} +1 -23
- 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-DjccSI1B.mjs → lib-CJyMBzoe.mjs} +5 -8
- package/dist/{lifecycle-C36WSbQS.mjs → lifecycle-CUo8PMQc.mjs} +3 -6
- package/dist/{loadConfig-BWIsDXR4.mjs → loadConfig-CKIdfW4o.mjs} +2 -3
- package/dist/loadConfig-D4WGJcYp.mjs +1 -0
- package/dist/{logBuildAppFinish-ChjwATMv.mjs → logBuildAppFinish-DOBoof6S.mjs} +4 -7
- package/dist/{mcp-CYgX9HpO.mjs → mcp-D88QvQgG.mjs} +3 -5
- 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-DVLvFLZv.mjs → mcpClient-C8JzVZ46.mjs} +4 -8
- package/dist/{metadata-hwF7QRcS.mjs → metadata-HlDKtlsu.mjs} +1 -2
- package/dist/{nodeEnv-BmH8UZPR.mjs → nodeEnv-zq1EymWj.mjs} +1 -2
- package/dist/{openIde-CroqOgk5.mjs → openIde-QoYKhuuM.mjs} +8 -13
- package/dist/{options-jqFwfD1G.mjs → options-Cz8vZ-0w.mjs} +1 -2
- package/dist/{chunkStrategy-DY_LZIIe.mjs → package-DR62fAzP.mjs} +20 -31
- package/dist/{path-CYYIQGS7.mjs → path-E1OjBJAl.mjs} +1 -2
- package/dist/{platform-CnkySBKz.mjs → platform-BiMpsZIb.mjs} +1 -2
- package/dist/{pluginHost--CaeyWpA.mjs → pluginHost-vn8Vty1J.mjs} +1 -2
- package/dist/{processCleanup-BQn2kTcK.mjs → processCleanup-DzB64WI8.mjs} +1 -2
- package/dist/{protocol-Cg6Jdlvb.mjs → protocol-HiSJRrSO.mjs} +2 -3
- package/dist/{reader-sh_POQ9-.mjs → reader-wzPH_W8A.mjs} +1 -2
- package/dist/{realpathScope-Tf9mz-fh.mjs → realpathScope-DwlLaCk3.mjs} +1 -2
- package/dist/{report-hyonPGbZ.mjs → report-PJVyo-UZ.mjs} +2 -4
- package/dist/{resolvedId-CiDl7SC1.mjs → resolvedId-DaxPh_yV.mjs} +2 -4
- 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-DpVf714f.d.mts → runtime-BL4RjBRa.d.mts} +0 -8
- package/dist/{runtime-CLUhQsdA.mjs → runtime-CKtMVERT.mjs} +2 -3
- 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-kO26eQRT.mjs → schematics-DikfOjMD.mjs} +1 -2
- package/dist/{session-D3zsdzIy.mjs → session-COrQJYif.mjs} +16 -18
- package/dist/test.d.mts +1 -3
- package/dist/test.mjs +50 -28
- package/dist/{types-D0FFexRF.d.mts → types-BK2EQ3Jm.d.mts} +0 -2
- package/dist/{types-D-kfuyVa.d.mts → types-e2BMP9NU.d.mts} +0 -2
- package/dist/types.d.mts +4 -4
- package/dist/{upload-DozK8UdN.mjs → upload-Chal5b3w.mjs} +11 -21
- package/dist/upload-worker.mjs +3 -5
- package/dist/{utils-Dy51PYAC.mjs → utils-CTGSZp4j.mjs} +20 -34
- package/dist/vite.d.mts +2 -4
- package/dist/vite.mjs +9 -14
- 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-BT8btflA.mjs → wxs-BdHHXltv.mjs} +2 -4
- package/package.json +46 -43
- package/dist/devProvider-D-hTfsEO.mjs +0 -3027
- package/dist/file-DtcteQ4G.mjs +0 -1
- package/dist/getInstance-BAIaU2y9.mjs +0 -1
- package/dist/loadConfig-D-BpBgsk.mjs +0 -1
- package/dist/package-Cmakyy3J.mjs +0 -4
- package/dist/wevu-C4KEC5kO.d.mts +0 -5
- package/dist/wevu-router-Cg2sIkIE.d.mts +0 -5
- package/dist/wxs-Z4VQDeJ_.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "../wevu-
|
|
1
|
+
export { t as default } from "../wevu-BaihCXO9.mjs";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as wevu } from "./wevu-
|
|
2
|
-
import { t as wevuRouter } from "./wevu-router-
|
|
1
|
+
import { t as wevu } from "./wevu-DTtSOyxB.mjs";
|
|
2
|
+
import { t as wevuRouter } from "./wevu-router-CdWurGQ4.mjs";
|
|
3
3
|
export { wevu, wevuRouter };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as wevu } from "./wevu-
|
|
2
|
-
import { t as wevuRouter } from "./wevu-router-
|
|
1
|
+
import { t as wevu } from "./wevu-BaihCXO9.mjs";
|
|
2
|
+
import { t as wevuRouter } from "./wevu-router-BIoxDbnu.mjs";
|
|
3
3
|
export { wevu, wevuRouter };
|
package/dist/auto-routes.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-
|
|
2
|
-
//#region src/auto-routes.d.ts
|
|
1
|
+
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DvAFX29h.mjs";
|
|
3
2
|
declare const routes: AutoRoutes;
|
|
4
3
|
declare const pages: string[];
|
|
5
4
|
declare const entries: string[];
|
|
@@ -14,5 +13,4 @@ export interface AutoRoutesMiniProgramRouter {
|
|
|
14
13
|
export type AutoRoutesWxRouter = AutoRoutesMiniProgramRouter;
|
|
15
14
|
declare const miniProgramRouter: AutoRoutesMiniProgramRouter;
|
|
16
15
|
declare const wxRouter: AutoRoutesWxRouter;
|
|
17
|
-
//#endregion
|
|
18
16
|
export { type AutoRoutes, type AutoRoutesSubPackage, routes as default, routes, entries, miniProgramRouter, pages, subPackages, wxRouter };
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { V as getRouteRuntimeGlobalKeys } from "./createCompilerContextInstance-
|
|
2
|
-
import { t as getCompilerContext } from "./getInstance-
|
|
3
|
-
|
|
1
|
+
import { V as getRouteRuntimeGlobalKeys } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { t as getCompilerContext } from "./getInstance-DfNlbr-X.mjs";
|
|
3
|
+
// src/auto-routes.ts
|
|
4
4
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
5
5
|
function createGetter(resolver) {
|
|
6
6
|
return {
|
|
@@ -59,5 +59,4 @@ const miniProgramRouter = {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
const wxRouter = miniProgramRouter;
|
|
62
|
-
//#endregion
|
|
63
62
|
export { routes as default, routes, entries, miniProgramRouter, pages, subPackages, wxRouter };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as GlassEaselAnalyzeResult } from "./types-
|
|
2
|
-
//#region src/analyze/components/types.d.ts
|
|
1
|
+
import { n as GlassEaselAnalyzeResult } from "./types-BK2EQ3Jm.mjs";
|
|
3
2
|
type AnalyzeComponentSuggestionKind = 'move-to-subpackage' | 'split-or-async' | 'shared-subpackage-or-placeholder';
|
|
4
3
|
interface AnalyzeComponentSuggestion {
|
|
5
4
|
kind: AnalyzeComponentSuggestionKind;
|
|
@@ -22,8 +21,6 @@ interface AnalyzeComponentUsage {
|
|
|
22
21
|
pages: AnalyzeComponentPageUsage[];
|
|
23
22
|
suggestions: AnalyzeComponentSuggestion[];
|
|
24
23
|
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/analyze/subpackages/artifacts/types.d.ts
|
|
27
24
|
interface AnalyzeModuleOwner {
|
|
28
25
|
name: string;
|
|
29
26
|
version?: string;
|
|
@@ -65,8 +62,6 @@ interface AnalyzeArtifactAnalysis {
|
|
|
65
62
|
unknownFiles: string[];
|
|
66
63
|
};
|
|
67
64
|
}
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/analyze/subpackages/types.d.ts
|
|
70
65
|
type PackageType = 'main' | 'subPackage' | 'independent' | 'virtual';
|
|
71
66
|
type ModuleSourceType = 'src' | 'plugin' | 'node_modules' | 'workspace';
|
|
72
67
|
type BuildOrigin = 'main' | 'independent';
|
|
@@ -152,8 +147,6 @@ interface AnalyzeSubpackagesResult {
|
|
|
152
147
|
components?: AnalyzeComponentUsage[];
|
|
153
148
|
glassEasel: GlassEaselAnalyzeResult;
|
|
154
149
|
}
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/analyze/subpackages/budget.d.ts
|
|
157
150
|
interface AnalyzeBudgetCheckItem {
|
|
158
151
|
id: string;
|
|
159
152
|
label: string;
|
|
@@ -173,5 +166,4 @@ interface AnalyzeBudgetCheckInput {
|
|
|
173
166
|
};
|
|
174
167
|
}
|
|
175
168
|
declare function createAnalyzeBudgetCheck(result: AnalyzeBudgetCheckInput): AnalyzeBudgetCheckItem[];
|
|
176
|
-
//#endregion
|
|
177
169
|
export { AnalyzeSubpackagesResult as a, AnalyzeBudgetConfig as i, AnalyzeBudgetCheckItem as n, ModuleSourceType as o, createAnalyzeBudgetCheck as r, AnalyzeBudgetCheckInput as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/analyze/subpackages/artifacts/category.ts
|
|
2
2
|
function isRuntimeCategory(category) {
|
|
3
3
|
return category === "runtime" || category === "reactivity" || category === "host" || category === "helper";
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
//#region src/analyze/subpackages/budget.ts
|
|
5
|
+
// src/analyze/subpackages/budget.ts
|
|
7
6
|
const defaultBudgets = {
|
|
8
7
|
totalBytes: 20971520,
|
|
9
8
|
mainBytes: 2097152,
|
|
@@ -61,5 +60,4 @@ function createAnalyzeBudgetCheck(result) {
|
|
|
61
60
|
}
|
|
62
61
|
return items.sort((a, b) => b.ratio - a.ratio || a.label.localeCompare(b.label));
|
|
63
62
|
}
|
|
64
|
-
//#endregion
|
|
65
63
|
export { isRuntimeCategory as n, createAnalyzeBudgetCheck as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWeappViteHostMeta } from "./pluginHost
|
|
2
|
-
import { l as getProjectPlatformOptions } from "./platform-
|
|
1
|
+
import { a as resolveWeappViteHostMeta } from "./pluginHost-vn8Vty1J.mjs";
|
|
2
|
+
import { l as getProjectPlatformOptions } from "./platform-BiMpsZIb.mjs";
|
|
3
3
|
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
4
|
-
import { r as printUploadProgress } from "./report-
|
|
5
|
-
import { a as terminateUploadProcess, i as terminateUploadDescendants, n as resolveUploadPlatforms, o as describeUploadProcessTreeError, r as redactUploadSecrets, t as prepareUpload } from "./upload-
|
|
4
|
+
import { r as printUploadProgress } from "./report-PJVyo-UZ.mjs";
|
|
5
|
+
import { a as terminateUploadProcess, i as terminateUploadDescendants, n as resolveUploadPlatforms, o as describeUploadProcessTreeError, r as redactUploadSecrets, t as prepareUpload } from "./upload-Chal5b3w.mjs";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import path from "node:path";
|
|
@@ -11,7 +11,7 @@ import { randomUUID } from "node:crypto";
|
|
|
11
11
|
import { fork } from "node:child_process";
|
|
12
12
|
import semverInc from "semver/functions/inc.js";
|
|
13
13
|
import { x } from "tinyexec";
|
|
14
|
-
|
|
14
|
+
// src/cli/upload/autoMetadata.ts
|
|
15
15
|
/** 只读取命令根目录的清单,不向父目录查找或修改文件。 */
|
|
16
16
|
async function readPackageVersion(packagePath) {
|
|
17
17
|
let manifest;
|
|
@@ -131,8 +131,7 @@ async function prepareAutoUploadMetadataWithRollback(cwd, options, action) {
|
|
|
131
131
|
rollback: () => restoreMetadataSnapshot(snapshots)
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
//#region src/cli/upload/env.ts
|
|
134
|
+
// src/cli/upload/env.ts
|
|
136
135
|
/** 凭据不经过 Vite 的 env 调试日志;文件优先级和进程环境覆盖规则保持一致。 */
|
|
137
136
|
async function loadUploadEnv(cwd, mode, root, envDir) {
|
|
138
137
|
if (envDir === false) return { ...process.env };
|
|
@@ -174,8 +173,7 @@ async function loadUploadEnv(cwd, mode, root, envDir) {
|
|
|
174
173
|
...process.env
|
|
175
174
|
};
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
//#region src/cli/upload/executionError.ts
|
|
176
|
+
// src/cli/upload/executionError.ts
|
|
179
177
|
/** 仅描述本地执行结果,不代表远端上传已取消。 */
|
|
180
178
|
var UploadExecutionError = class extends Error {
|
|
181
179
|
/** timeout 为本地超时,interrupted 为本地中断,failed 为工具或传输失败。 */
|
|
@@ -189,8 +187,7 @@ var UploadExecutionError = class extends Error {
|
|
|
189
187
|
this.remoteOutcome = remoteOutcome;
|
|
190
188
|
}
|
|
191
189
|
};
|
|
192
|
-
|
|
193
|
-
//#region src/cli/upload/result.ts
|
|
190
|
+
// src/cli/upload/result.ts
|
|
194
191
|
/** 只接受可展示的预览结果,文件必须由本次任务生成,不能沿用旧二维码。 */
|
|
195
192
|
async function validatePreviewResult(value, context) {
|
|
196
193
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("预览工具未返回二维码或预览链接。");
|
|
@@ -221,8 +218,7 @@ async function validatePreviewResult(value, context) {
|
|
|
221
218
|
if (!result.qrCodeUrl && !result.previewUrl && !result.qrCodeFile) throw new Error("预览工具未返回二维码或预览链接。");
|
|
222
219
|
return result;
|
|
223
220
|
}
|
|
224
|
-
|
|
225
|
-
//#region src/cli/upload/process.ts
|
|
221
|
+
// src/cli/upload/process.ts
|
|
226
222
|
function readProgress(value, secrets) {
|
|
227
223
|
if (!value || typeof value !== "object" || !("type" in value) || ![
|
|
228
224
|
"progress",
|
|
@@ -446,8 +442,7 @@ async function executeUpload(platform, context, secrets, action = "upload", opti
|
|
|
446
442
|
if (output) logger_default.info(output);
|
|
447
443
|
return action === "preview" ? validatePreviewResult(result, context) : result;
|
|
448
444
|
}
|
|
449
|
-
|
|
450
|
-
//#region src/cli/upload/project.ts
|
|
445
|
+
// src/cli/upload/project.ts
|
|
451
446
|
/** 确保官方工具读取的目录正是本次构建输出,拒绝误传旧目录或同名配置。 */
|
|
452
447
|
async function validateUploadProject(options) {
|
|
453
448
|
const { projectConfigFileName } = getProjectPlatformOptions(options.platform);
|
|
@@ -463,8 +458,7 @@ async function validateUploadProject(options) {
|
|
|
463
458
|
if (actualRoot !== outputRoot) throw new Error(`${projectConfigFileName} 的代码目录与本次构建输出不一致,已阻止上传旧产物。请检查项目配置根目录与 build.outDir。`);
|
|
464
459
|
await access(path.join(outputRoot, "app.json"));
|
|
465
460
|
}
|
|
466
|
-
|
|
467
|
-
//#region src/cli/upload/builtProject.ts
|
|
461
|
+
// src/cli/upload/builtProject.ts
|
|
468
462
|
/** 仅由显式上传或预览入口读取参数,不执行构建或调用平台工具。 */
|
|
469
463
|
async function createUploadTarget(config, options, action) {
|
|
470
464
|
if (config.weappLibConfig?.enabled || config.pluginOnly) throw new Error(`${action} 仅支持完整小程序项目,不支持组件库或独立插件构建。`);
|
|
@@ -537,5 +531,4 @@ async function executeUploadTarget(target, options, action, execution = {}) {
|
|
|
537
531
|
} else logger_default.success(`[upload:${platform}] ${context.version} 上传完成(未提审、未正式发布)。`);
|
|
538
532
|
return result;
|
|
539
533
|
}
|
|
540
|
-
//#endregion
|
|
541
534
|
export { prepareAutoUploadMetadataWithRollback as a, prepareAutoUploadMetadata as i, executeUploadTarget as n, validateAutoUploadMetadata as o, UploadExecutionError as r, createUploadTarget as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as isPathInside } from "./path-
|
|
2
|
-
import "./utils-
|
|
3
|
-
import {
|
|
1
|
+
import { t as isPathInside } from "./path-E1OjBJAl.mjs";
|
|
2
|
+
import "./utils-CTGSZp4j.mjs";
|
|
3
|
+
import { o as SHARED_CHUNK_VIRTUAL_PREFIX } from "./package-DR62fAzP.mjs";
|
|
4
4
|
import { posix } from "pathe";
|
|
5
|
-
|
|
5
|
+
// src/analyze/subpackages/classifier.ts
|
|
6
6
|
const VIRTUAL_MODULE_INDICATOR = "\0";
|
|
7
7
|
const VIRTUAL_PREFIX = `${SHARED_CHUNK_VIRTUAL_PREFIX}/`;
|
|
8
8
|
function classifyModuleSourceKind(options) {
|
|
@@ -84,5 +84,4 @@ function resolveAssetSource(fileName, ctx) {
|
|
|
84
84
|
sourceType: "plugin"
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
//#endregion
|
|
88
87
|
export { resolveModuleSourceType as i, normalizeModuleId as n, resolveAssetSource as r, classifyPackage as t };
|
package/dist/cli-acceptance.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as VERSION } from "./constants-
|
|
2
|
-
import { n as registerAcceptCommand, t as registerMcpCommand } from "./mcp-
|
|
1
|
+
import { t as VERSION } from "./constants-BOe8mgqL.mjs";
|
|
2
|
+
import { n as registerAcceptCommand, t as registerMcpCommand } from "./mcp-D88QvQgG.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { cac } from "cac";
|
|
5
|
-
|
|
5
|
+
// src/cli-acceptance.ts
|
|
6
6
|
const cli = cac("weapp-vite");
|
|
7
7
|
cli.option("-c, --config <file>", "Vite configuration for explicit HTTP onboarding only");
|
|
8
8
|
registerAcceptCommand(cli);
|
|
@@ -17,5 +17,4 @@ try {
|
|
|
17
17
|
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
18
18
|
process.exitCode = 1;
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export {};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { o as createDevShutdownScope } from "./lifecycle-
|
|
2
|
-
import { M as syncManagedTsconfigBootstrapFiles, R as getHmrRuntimeSession, c as getBackendForCapability, j as syncProjectSupportFiles, w as createGlassEaselAnalyzeResult } from "./createCompilerContextInstance-
|
|
3
|
-
import { t as VERSION } from "./constants-
|
|
1
|
+
import { o as createDevShutdownScope } from "./lifecycle-CUo8PMQc.mjs";
|
|
2
|
+
import { M as syncManagedTsconfigBootstrapFiles, R as getHmrRuntimeSession, c as getBackendForCapability, j as syncProjectSupportFiles, w as createGlassEaselAnalyzeResult } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
3
|
+
import { t as VERSION } from "./constants-BOe8mgqL.mjs";
|
|
4
4
|
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { a as
|
|
10
|
-
import { n as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { r as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { t as
|
|
18
|
-
import { t as setCommandNodeEnv } from "./nodeEnv-
|
|
19
|
-
import { t as createAnalyzeMetadata } from "./metadata-
|
|
20
|
-
import { i as readUploadMetadata, n as outputUploadReport } from "./report-
|
|
5
|
+
import { n as version } from "./package-DR62fAzP.mjs";
|
|
6
|
+
import { t as createCompilerContext } from "./createContext-W0TeXxbo.mjs";
|
|
7
|
+
import { n as registerAcceptCommand, t as registerMcpCommand } from "./mcp-D88QvQgG.mjs";
|
|
8
|
+
import { i as resolveRuntimeTargets, n as logRuntimeTarget, r as resolveConfiguredRuntimeTargets, t as createInlineConfig } from "./runtime-CKtMVERT.mjs";
|
|
9
|
+
import { a as resolveIdeProjectRoot, n as openIde, r as resolveIdeCommandContext, s as executeWechatIdeCliCommand, t as closeIde } from "./openIde-QoYKhuuM.mjs";
|
|
10
|
+
import { a as parseDashboardUiHost, i as isUiEnabled, n as convertBase, o as resolveConfigFile, r as filterDuplicateOptions } from "./options-Cz8vZ-0w.mjs";
|
|
11
|
+
import { n as formatDuration, r as scheduleCompletedProductionBuildExit, t as logBuildAppFinish } from "./logBuildAppFinish-DOBoof6S.mjs";
|
|
12
|
+
import { t as loadConfig } from "./loadConfig-CKIdfW4o.mjs";
|
|
13
|
+
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-ovJgl1N9.mjs";
|
|
14
|
+
import { n as maybeStartForwardConsole, o as readLatestHmrProfileSummary, r as pauseActiveForwardConsole, t as closeActiveForwardConsole } from "./forwardConsole-D2Q0RIqc.mjs";
|
|
15
|
+
import { r as formatMcpQuickStart } from "./mcpClient-C8JzVZ46.mjs";
|
|
16
|
+
import { n as createDashboardArtifactSnapshot } from "./artifacts-TrTX9_jj.mjs";
|
|
17
|
+
import { i as startAnalyzeDashboard, n as writeAnalyzeHistorySnapshot, r as analyzeSubpackages, t as readLatestAnalyzeHistorySnapshot } from "./history-dKxzoHmN.mjs";
|
|
18
|
+
import { t as setCommandNodeEnv } from "./nodeEnv-zq1EymWj.mjs";
|
|
19
|
+
import { t as createAnalyzeMetadata } from "./metadata-HlDKtlsu.mjs";
|
|
20
|
+
import { i as readUploadMetadata, n as outputUploadReport } from "./report-PJVyo-UZ.mjs";
|
|
21
21
|
import process from "node:process";
|
|
22
22
|
import path from "pathe";
|
|
23
23
|
import path$1 from "node:path";
|
|
@@ -28,7 +28,7 @@ import { MANAGED_PROJECT_JOURNAL_ENV, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, bui
|
|
|
28
28
|
import { spawn } from "node:child_process";
|
|
29
29
|
import net from "node:net";
|
|
30
30
|
import { brotliCompressSync, gzipSync } from "node:zlib";
|
|
31
|
-
|
|
31
|
+
// src/cli/commands/alipayExecute.ts
|
|
32
32
|
function createSpawnOptions() {
|
|
33
33
|
return {
|
|
34
34
|
shell: process.platform === "win32",
|
|
@@ -59,8 +59,7 @@ async function runSpawnMinidev(command, argv, runner) {
|
|
|
59
59
|
async function spawnMinidev(command, argv) {
|
|
60
60
|
return await runSpawnMinidev(command, argv, spawn);
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
//#region src/cli/commands/alipay.ts
|
|
62
|
+
// src/cli/commands/alipay.ts
|
|
64
63
|
function normalizePassthroughArgs(args) {
|
|
65
64
|
return Array.isArray(args) ? args.filter((arg) => typeof arg === "string") : [];
|
|
66
65
|
}
|
|
@@ -113,31 +112,27 @@ function registerAlipayCommand(cli) {
|
|
|
113
112
|
await runAlipayCommand(action, root, options);
|
|
114
113
|
});
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
//#region src/cli/commands/analyze/index.ts
|
|
115
|
+
// src/cli/commands/analyze/index.ts
|
|
118
116
|
function registerAnalyzeCommand(cli) {
|
|
119
117
|
cli.command("analyze [root]", "analyze 两端包体与源码映射").option("--ui-host <host>", `[string] 启动调试 UI 并选择宿主(standalone | hub)`).option("--hmr-profile [file]", `[string | boolean] 分析 HMR JSONL profile,省略值时优先读取配置,否则回退到默认路径`).option("--json", `[boolean] 输出 JSON 结果`).option("--markdown", `[boolean] 输出 Markdown 报告`).option("--report <type>", `[string] 输出指定报告类型(pr)`).option("--budget-check", `[boolean] 检查 analyze 预算,超过预算时返回非 0 退出码`).option("--glass-easel-check", `[boolean] 检查 glass-easel 配置、模板和 SelectorQuery 迁移兼容性`).option("--preload", `[boolean] 分析静态页面跳转、实际分包体积和 preloadRule 额度`).option("--output <file>", `[string] 将分析结果写入指定文件(JSON 或 Markdown)`).option("-p, --platform <platform>", `[string] target platform (weapp | web)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).action(async (root, options) => {
|
|
120
|
-
const { runAnalyzeCommand } = await import("./action-
|
|
118
|
+
const { runAnalyzeCommand } = await import("./action-le0bNff_.mjs");
|
|
121
119
|
return runAnalyzeCommand(root, options);
|
|
122
120
|
});
|
|
123
121
|
}
|
|
124
|
-
|
|
125
|
-
//#region src/cli/commands/build/index.ts
|
|
122
|
+
// src/cli/commands/build/index.ts
|
|
126
123
|
function registerBuildCommand(cli) {
|
|
127
124
|
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("-p, --platform <platform>", `[string] target platform (weapp | web | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: esbuild)").option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--ide-open-strategy <strategy>", "[string] IDE open strategy (cli | automator)", { default: "cli" }).option("--no-open-recovery", "[boolean] disable automatic target-project open retry (preserves existing IDE windows)").option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--ui-host <host>", `[string] 启动调试 UI 并选择宿主(standalone | hub)`).option("--analyze", `[boolean] 输出分包分析仪表盘`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).option("--upload", "[boolean] upload the mini program after this build succeeds").option("--uv <version>", "[string] upload version override (requires --upload)").option("--desc <text>", "[string] upload description override (requires --upload)").option("--bump <release>", "[string] increment local package version (patch | minor | major; requires --upload)").option("--git-desc", "[boolean] use the latest Git commit subject (requires --upload)").option("--dry-run", "[boolean] validate upload output without credentials or SDK calls (requires --upload)").action(async (root, options) => {
|
|
128
|
-
const { runBuildCommand } = await import("./action-
|
|
125
|
+
const { runBuildCommand } = await import("./action-zmJrU8PC.mjs");
|
|
129
126
|
return runBuildCommand(cli, root, options);
|
|
130
127
|
});
|
|
131
128
|
}
|
|
132
|
-
|
|
133
|
-
//#region src/cli/commands/close.ts
|
|
129
|
+
// src/cli/commands/close.ts
|
|
134
130
|
function registerCloseCommand(cli) {
|
|
135
131
|
cli.command("close", "close Wechat DevTools").action(async () => {
|
|
136
132
|
if (!await closeIde()) throw new Error("关闭微信开发者工具失败。");
|
|
137
133
|
});
|
|
138
134
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/cli/commands/doctor.ts
|
|
135
|
+
// src/cli/commands/doctor.ts
|
|
141
136
|
function registerDoctorCommand(cli) {
|
|
142
137
|
cli.command("doctor [root]", "检查项目、源码、产物与显式选择的宿主证据").option("--targets <targets>", "编译目标,逗号分隔(默认 weapp)").option("--platform <platform>", "单个编译目标").option("--source <directory>", "静态源码目录(默认 src,不执行配置推断)").option("--artifact <directory>", "复用最终产物目录(新鲜度未验证)").option("--build", "显式执行配置和构建,使用独立输出目录").option("--runtime", "连接已打开项目的宿主探针,不启动 IDE").option("--runtime-port <port>", "已有 automator 会话的端口(默认项目派生端口)").option("--runtime-cli <path>", "只读检查所选 CLI 的可执行条件,不回退安装").option("--runtime-service-port <port>", "检查指定回环 TCP 服务监听,不推断宿主身份").option("--runtime-login", "显式运行原生登录查询,可能启动 IDE;需要 --runtime-cli").option("--format <format>", "terminal | json | sarif", { default: "terminal" }).action(async (root, options) => {
|
|
143
138
|
const { formatDoctorReport, runDoctor } = await import("./doctor.mjs");
|
|
@@ -169,8 +164,7 @@ function registerDoctorCommand(cli) {
|
|
|
169
164
|
process.exitCode = report.exitCode;
|
|
170
165
|
});
|
|
171
166
|
}
|
|
172
|
-
|
|
173
|
-
//#region src/cli/commands/generate.ts
|
|
167
|
+
// src/cli/commands/generate.ts
|
|
174
168
|
function registerGenerateCommand(cli) {
|
|
175
169
|
cli.command("g [filepath]", "generate component").alias("generate").option("-a, --app", "type app").option("-p, --page", "type app").option("-n, --name <name>", "filename").action(async (filepath, options) => {
|
|
176
170
|
filterDuplicateOptions(options);
|
|
@@ -189,7 +183,7 @@ function registerGenerateCommand(cli) {
|
|
|
189
183
|
if (options.page) type = "page";
|
|
190
184
|
const generateOptions = config?.config.weapp?.generate;
|
|
191
185
|
fileName = generateOptions?.filenames?.[type] ?? fileName;
|
|
192
|
-
const { generate } = await import("./schematics-
|
|
186
|
+
const { generate } = await import("./schematics-DikfOjMD.mjs");
|
|
193
187
|
await generate({
|
|
194
188
|
outDir: path.join(generateOptions?.dirs?.[type] ?? "", filepath),
|
|
195
189
|
type,
|
|
@@ -199,11 +193,10 @@ function registerGenerateCommand(cli) {
|
|
|
199
193
|
});
|
|
200
194
|
});
|
|
201
195
|
}
|
|
202
|
-
|
|
203
|
-
//#region src/cli/commands/ide/index.ts
|
|
196
|
+
// src/cli/commands/ide/index.ts
|
|
204
197
|
/** 仅在执行 IDE 子命令时加载宿主工具和日志桥接实现。 */
|
|
205
198
|
async function runIdeCommand(action, root, options) {
|
|
206
|
-
const { runIdeCommand } = await import("./action-
|
|
199
|
+
const { runIdeCommand } = await import("./action-BD56SQh4.mjs");
|
|
207
200
|
return runIdeCommand(action, root, options);
|
|
208
201
|
}
|
|
209
202
|
/**
|
|
@@ -214,8 +207,7 @@ function registerIdeCommand(cli) {
|
|
|
214
207
|
await runIdeCommand(action, root, options);
|
|
215
208
|
});
|
|
216
209
|
}
|
|
217
|
-
|
|
218
|
-
//#region src/cli/commands/init.ts
|
|
210
|
+
// src/cli/commands/init.ts
|
|
219
211
|
function registerInitCommand(cli) {
|
|
220
212
|
cli.command("init").action(async () => {
|
|
221
213
|
try {
|
|
@@ -226,8 +218,7 @@ function registerInitCommand(cli) {
|
|
|
226
218
|
}
|
|
227
219
|
});
|
|
228
220
|
}
|
|
229
|
-
|
|
230
|
-
//#region src/cli/commands/npm.ts
|
|
221
|
+
// src/cli/commands/npm.ts
|
|
231
222
|
function registerNpmCommand(cli) {
|
|
232
223
|
cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
233
224
|
try {
|
|
@@ -237,8 +228,7 @@ function registerNpmCommand(cli) {
|
|
|
237
228
|
}
|
|
238
229
|
});
|
|
239
230
|
}
|
|
240
|
-
|
|
241
|
-
//#region src/cli/mcpDetached.ts
|
|
231
|
+
// src/cli/mcpDetached.ts
|
|
242
232
|
function resolveCliEntrypoint() {
|
|
243
233
|
return process.argv[1];
|
|
244
234
|
}
|
|
@@ -336,8 +326,7 @@ async function maybeStartDetachedMcpServer(options) {
|
|
|
336
326
|
transport: "http"
|
|
337
327
|
})) logger_default.info(line);
|
|
338
328
|
}
|
|
339
|
-
|
|
340
|
-
//#region src/cli/mcpOptions.ts
|
|
329
|
+
// src/cli/mcpOptions.ts
|
|
341
330
|
function applyMcpCliOptions(config, options) {
|
|
342
331
|
if (options.mcp === false) return false;
|
|
343
332
|
if (options.mcp === true) return {
|
|
@@ -347,8 +336,7 @@ function applyMcpCliOptions(config, options) {
|
|
|
347
336
|
};
|
|
348
337
|
return config;
|
|
349
338
|
}
|
|
350
|
-
|
|
351
|
-
//#region src/cli/commands/open.ts
|
|
339
|
+
// src/cli/commands/open.ts
|
|
352
340
|
function registerOpenCommand(cli) {
|
|
353
341
|
cli.command("open [root]").option("-p, --platform <platform>", `[string] target platform (weapp | web)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--ide-open-strategy <strategy>", "[string] IDE open strategy (cli | automator)", { default: "cli" }).option("--login-retry <mode>", "[string] login retry mode for Wechat DevTools (never | once | always)").option("--login-retry-timeout <ms>", "[number] login retry prompt timeout in milliseconds").option("--non-interactive", "[boolean] fail immediately when Wechat DevTools login has expired").option("--no-open-recovery", "[boolean] disable automatic target-project open retry (preserves existing IDE windows)").option("--mcp", "[boolean] auto start MCP service before opening IDE").option("--no-mcp", "[boolean] disable MCP service before opening IDE").action(async (root, options) => {
|
|
354
342
|
filterDuplicateOptions(options);
|
|
@@ -391,8 +379,7 @@ function registerOpenCommand(cli) {
|
|
|
391
379
|
else await openSelected();
|
|
392
380
|
});
|
|
393
381
|
}
|
|
394
|
-
|
|
395
|
-
//#region src/cli/commands/prepare.ts
|
|
382
|
+
// src/cli/commands/prepare.ts
|
|
396
383
|
function resolvePrepareRoot(input) {
|
|
397
384
|
const values = Array.isArray(input) ? input.filter((item) => typeof item === "string" && item.length > 0) : [];
|
|
398
385
|
if (values.length === 0) return ".";
|
|
@@ -428,8 +415,7 @@ function registerPrepareCommand(cli) {
|
|
|
428
415
|
}
|
|
429
416
|
});
|
|
430
417
|
}
|
|
431
|
-
|
|
432
|
-
//#region src/cli/devHotkeys/devtools.ts
|
|
418
|
+
// src/cli/devHotkeys/devtools.ts
|
|
433
419
|
async function appendLatestHmrSummary(baseSummary, options) {
|
|
434
420
|
const summary = await readLatestHmrProfileSummary({
|
|
435
421
|
cwd: options.cwd,
|
|
@@ -489,8 +475,7 @@ async function runOpenIdeAction(options) {
|
|
|
489
475
|
logger_default.success("[dev action] 微信开发者工具项目已重新打开。");
|
|
490
476
|
return await appendLatestHmrSummary(summary ?? "已重新打开微信开发者工具项目", options);
|
|
491
477
|
}
|
|
492
|
-
|
|
493
|
-
//#region src/cli/devHotkeys/screenshot.ts
|
|
478
|
+
// src/cli/devHotkeys/screenshot.ts
|
|
494
479
|
const DEV_SCREENSHOT_DIR = ".weapp-vite/dev-screenshots";
|
|
495
480
|
const DEFAULT_SCREENSHOT_TIMEOUT = 12e4;
|
|
496
481
|
/**
|
|
@@ -545,8 +530,7 @@ async function runScreenshotAction(options) {
|
|
|
545
530
|
await resumeForwardConsole?.();
|
|
546
531
|
}
|
|
547
532
|
}
|
|
548
|
-
|
|
549
|
-
//#region src/cli/devHotkeys/actions.ts
|
|
533
|
+
// src/cli/devHotkeys/actions.ts
|
|
550
534
|
const DEV_HOTKEY_GROUPS = [
|
|
551
535
|
{
|
|
552
536
|
key: "development",
|
|
@@ -656,8 +640,7 @@ function resolveDevHotkeyRowsByGroup() {
|
|
|
656
640
|
function resolveRunnableHotkeyDefinition(input) {
|
|
657
641
|
return DEV_HOTKEY_DEFINITIONS.find((action) => action.run && action.key === input);
|
|
658
642
|
}
|
|
659
|
-
|
|
660
|
-
//#region src/cli/devHotkeys/format.ts
|
|
643
|
+
// src/cli/devHotkeys/format.ts
|
|
661
644
|
const FULLWIDTH_ASCII_START = 65281;
|
|
662
645
|
const FULLWIDTH_ASCII_END = 65374;
|
|
663
646
|
const FULLWIDTH_ASCII_OFFSET = 65248;
|
|
@@ -747,8 +730,7 @@ function normalizeInputChar(input) {
|
|
|
747
730
|
function resolveProjectLabel(cwd) {
|
|
748
731
|
return formatProjectLabel(cwd);
|
|
749
732
|
}
|
|
750
|
-
|
|
751
|
-
//#region src/cli/devHotkeys/mcp.ts
|
|
733
|
+
// src/cli/devHotkeys/mcp.ts
|
|
752
734
|
const REG_EADDRINUSE$1 = /EADDRINUSE/;
|
|
753
735
|
function formatMcpUrl$1(host, port, endpoint) {
|
|
754
736
|
return `http://${host}:${port}${endpoint}`;
|
|
@@ -798,8 +780,7 @@ function createToggleMcpAction(options) {
|
|
|
798
780
|
return `MCP 已启动 (${url})`;
|
|
799
781
|
};
|
|
800
782
|
}
|
|
801
|
-
|
|
802
|
-
//#region src/cli/devHotkeys/index.ts
|
|
783
|
+
// src/cli/devHotkeys/index.ts
|
|
803
784
|
function forwardSigint() {
|
|
804
785
|
process.kill(process.pid, "SIGINT");
|
|
805
786
|
}
|
|
@@ -1004,8 +985,7 @@ function startDevHotkeys(options) {
|
|
|
1004
985
|
suspend: suspendInput
|
|
1005
986
|
};
|
|
1006
987
|
}
|
|
1007
|
-
|
|
1008
|
-
//#region src/cli/commands/serve/shared.ts
|
|
988
|
+
// src/cli/commands/serve/shared.ts
|
|
1009
989
|
function startBackgroundForwardConsole(startForwardConsole, options) {
|
|
1010
990
|
if (!startForwardConsole) return;
|
|
1011
991
|
try {
|
|
@@ -1046,8 +1026,7 @@ function createServeMiniProgramDevActions(options) {
|
|
|
1046
1026
|
}
|
|
1047
1027
|
};
|
|
1048
1028
|
}
|
|
1049
|
-
|
|
1050
|
-
//#region src/cli/commands/serve/actions.ts
|
|
1029
|
+
// src/cli/commands/serve/actions.ts
|
|
1051
1030
|
/** 启动与热键共用动作,退出后不再创建新的 IDE 或日志消费者。 */
|
|
1052
1031
|
function createServeDevelopmentActions(ctx, miniBackend, options, shutdown) {
|
|
1053
1032
|
const { configService } = ctx;
|
|
@@ -1125,8 +1104,7 @@ function createServeDevelopmentActions(ctx, miniBackend, options, shutdown) {
|
|
|
1125
1104
|
}
|
|
1126
1105
|
});
|
|
1127
1106
|
}
|
|
1128
|
-
|
|
1129
|
-
//#region src/cli/commands/serve/analyze.ts
|
|
1107
|
+
// src/cli/commands/serve/analyze.ts
|
|
1130
1108
|
const REG_DIST_PAGE_ENTRY = /pages\/.+\/index\.js$/;
|
|
1131
1109
|
const REG_DIST_POSIX_SEP = /\\/g;
|
|
1132
1110
|
function emitDashboardEvents(handle, events) {
|
|
@@ -1431,8 +1409,7 @@ function createAnalyzeController(options) {
|
|
|
1431
1409
|
}
|
|
1432
1410
|
};
|
|
1433
1411
|
}
|
|
1434
|
-
|
|
1435
|
-
//#region src/cli/commands/serve/startup.ts
|
|
1412
|
+
// src/cli/commands/serve/startup.ts
|
|
1436
1413
|
/** 启动阶段只取得资源;退出协调器负责等待在途操作并统一释放。 */
|
|
1437
1414
|
async function startServeCommand(root, options, shutdown) {
|
|
1438
1415
|
if (shutdown.stopping) return;
|
|
@@ -1603,8 +1580,7 @@ async function startServeCommand(root, options, shutdown) {
|
|
|
1603
1580
|
waitForExit: analyzeHandle ? () => analyzeController.waitForExit() : void 0
|
|
1604
1581
|
};
|
|
1605
1582
|
}
|
|
1606
|
-
|
|
1607
|
-
//#region src/cli/commands/serve/index.ts
|
|
1583
|
+
// src/cli/commands/serve/index.ts
|
|
1608
1584
|
function registerServeCommand(cli) {
|
|
1609
1585
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("-p, --platform <platform>", `[string] target platform (weapp | web | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--ide-open-strategy <strategy>", "[string] IDE open strategy (cli | automator)", { default: "cli" }).option("--login-retry <mode>", "[string] login retry mode for Wechat DevTools (never | once | always)").option("--login-retry-timeout <ms>", "[number] login retry prompt timeout in milliseconds").option("--non-interactive", "[boolean] fail immediately when Wechat DevTools login has expired").option("--no-open-recovery", "[boolean] disable automatic target-project open retry (preserves existing IDE windows)").option("--mcp", "[boolean] auto start MCP service during dev").option("--no-mcp", "[boolean] disable MCP service during dev").option("--host [host]", `[string] web dev server host`).option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--ui-host <host>", `[string] 启动调试 UI 并选择宿主(standalone | hub)`).option("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).action(async (root, options) => {
|
|
1610
1586
|
const shutdown = createDevShutdownScope({ reportError: (error) => logger_default.error(error) });
|
|
@@ -1619,11 +1595,10 @@ function registerServeCommand(cli) {
|
|
|
1619
1595
|
await shutdown.close(failure);
|
|
1620
1596
|
});
|
|
1621
1597
|
}
|
|
1622
|
-
|
|
1623
|
-
//#region src/cli/commands/upload/index.ts
|
|
1598
|
+
// src/cli/commands/upload/index.ts
|
|
1624
1599
|
/** 按实际上传或预览调用加载执行层,保留原有返回值重载。 */
|
|
1625
1600
|
async function runUploadCommand(root, options, action = "upload") {
|
|
1626
|
-
const { runUploadCommand } = await import("./action-
|
|
1601
|
+
const { runUploadCommand } = await import("./action-CPtgEl6p.mjs");
|
|
1627
1602
|
return runUploadCommand(root, options, action);
|
|
1628
1603
|
}
|
|
1629
1604
|
function registerUploadCommand(cli) {
|
|
@@ -1643,8 +1618,7 @@ function registerPreviewCommand(cli) {
|
|
|
1643
1618
|
scheduleCompletedProductionBuildExit({}, void 0);
|
|
1644
1619
|
});
|
|
1645
1620
|
}
|
|
1646
|
-
|
|
1647
|
-
//#region src/cli/error.ts
|
|
1621
|
+
// src/cli/error.ts
|
|
1648
1622
|
const watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
|
|
1649
1623
|
const watchLimitMessagePattern = /EMFILE|ENOSPC|unable to start FSEvent stream/i;
|
|
1650
1624
|
function findWatchLimitErrorCode(error) {
|
|
@@ -1679,8 +1653,7 @@ function handleCLIError(error) {
|
|
|
1679
1653
|
}
|
|
1680
1654
|
logger_default.error(error);
|
|
1681
1655
|
}
|
|
1682
|
-
|
|
1683
|
-
//#region src/cli/ide.ts
|
|
1656
|
+
// src/cli/ide.ts
|
|
1684
1657
|
const WEAPP_VITE_NATIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
1685
1658
|
"dev",
|
|
1686
1659
|
"serve",
|
|
@@ -1789,8 +1762,7 @@ async function tryRunIdeCommand(argv) {
|
|
|
1789
1762
|
if (!await dispatchWechatCliCommand(argv)) await executeWechatIdeCliCommand(argv);
|
|
1790
1763
|
return true;
|
|
1791
1764
|
}
|
|
1792
|
-
|
|
1793
|
-
//#region src/cli/mcpAutoStart.ts
|
|
1765
|
+
// src/cli/mcpAutoStart.ts
|
|
1794
1766
|
const SKIP_COMMANDS = /* @__PURE__ */ new Set([
|
|
1795
1767
|
"--help",
|
|
1796
1768
|
"--version",
|
|
@@ -1855,8 +1827,7 @@ async function maybeAutoStartMcpServer(argv, cliOptions) {
|
|
|
1855
1827
|
logger_default.warn(`[mcp] 自动启动失败:${message}`);
|
|
1856
1828
|
}
|
|
1857
1829
|
}
|
|
1858
|
-
|
|
1859
|
-
//#region src/cli/prepareGuard.ts
|
|
1830
|
+
// src/cli/prepareGuard.ts
|
|
1860
1831
|
function isPrepareCommandArgs(args) {
|
|
1861
1832
|
return Array.isArray(args) && args[0] === "prepare";
|
|
1862
1833
|
}
|
|
@@ -1869,8 +1840,7 @@ function handlePrepareLifecycleError(args, error) {
|
|
|
1869
1840
|
process.exitCode = 0;
|
|
1870
1841
|
return true;
|
|
1871
1842
|
}
|
|
1872
|
-
|
|
1873
|
-
//#region src/cli.ts
|
|
1843
|
+
// src/cli.ts
|
|
1874
1844
|
const cli = cac("weapp-vite");
|
|
1875
1845
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`).option("--devtools-channel <channel>", "select stable | rc | nightly").option("--devtools-version <version>", "select DevTools product version").option("--cli-path <path>", "select DevTools CLI installation").option("--require-official-latest", "require the official latest channel version");
|
|
1876
1846
|
registerAcceptCommand(cli);
|
|
@@ -1954,5 +1924,4 @@ try {
|
|
|
1954
1924
|
process.exitCode = 1;
|
|
1955
1925
|
}
|
|
1956
1926
|
}
|
|
1957
|
-
//#endregion
|
|
1958
1927
|
export {};
|