weapp-vite 6.16.47 → 6.17.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/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +243 -103
- package/dist/{config-Ds7MBgQm.d.mts → config-Cxi7xvCa.d.mts} +6 -0
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-BJPEU7dU.mjs → createContext-Dg_HER2J.mjs} +646 -184
- package/dist/file-C206GmuT.mjs +2 -0
- package/dist/{file-_O6M6mJG.mjs → file-CtueODLX.mjs} +1 -1
- package/dist/getInstance-Dw7Y4EkD.mjs +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/json.d.mts +1 -1
- package/dist/{mcp-YXCIQr-Z.mjs → mcp-BG6TliEg.mjs} +6 -2
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.mjs +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +17 -15
- package/dist/file-BQG0E0sq.mjs +0 -2
- package/dist/getInstance-BwXyeue5.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-
|
|
1
|
+
import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-Dg_HER2J.mjs";
|
|
2
2
|
//#region src/auto-routes.ts
|
|
3
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
4
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-
|
|
1
|
+
import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-Dg_HER2J.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
4
|
-
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-
|
|
3
|
+
import { h as VERSION } from "./file-CtueODLX.mjs";
|
|
4
|
+
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
7
7
|
import path$1 from "node:path";
|
|
@@ -247,6 +247,35 @@ async function closeIde$1() {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
|
+
//#region src/cli/openIde/diagnostics.ts
|
|
251
|
+
/**
|
|
252
|
+
* @description 输出微信开发者工具打开后的自助恢复步骤。
|
|
253
|
+
*/
|
|
254
|
+
function logWechatIdeRecoveryHint(options) {
|
|
255
|
+
const lines = [
|
|
256
|
+
`微信开发者工具打开后状态可能不稳定:${options.reason}`,
|
|
257
|
+
"可按下面顺序恢复:",
|
|
258
|
+
"1. 在微信开发者工具中确认:设置 -> 安全设置 -> 服务端口已开启。",
|
|
259
|
+
"2. 仅当项目索引刷新失败时,默认会自动关闭并重开一次当前目标项目;如需跳过,传入 `--no-open-recovery` 或设置 `WEAPP_VITE_DISABLE_IDE_OPEN_RECOVERY=1`。",
|
|
260
|
+
"3. 如果仍然回到项目选择页,手动导入 project.config.json 所在目录,并关闭多余的微信开发者工具窗口后重试。",
|
|
261
|
+
"4. 需要查看底层错误时,设置 `WEAPP_VITE_DEBUG_AUTOMATOR_OPEN=1` 后重试。"
|
|
262
|
+
];
|
|
263
|
+
if (options.projectPath) lines.push(`当前目标项目目录:${options.projectPath}`);
|
|
264
|
+
logger_default.warn(lines.join("\n"));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @description 输出服务端口关闭时的定向恢复提示。
|
|
268
|
+
*/
|
|
269
|
+
function logWechatIdeServicePortDisabledHint(projectPath) {
|
|
270
|
+
const lines = [
|
|
271
|
+
"检测到微信开发者工具服务端口当前处于关闭状态,已保留用户设置并回退到普通 open 流程。",
|
|
272
|
+
"自动刷新、截图、MCP 和 IDE 联动能力需要服务端口。",
|
|
273
|
+
"请在微信开发者工具中打开:设置 -> 安全设置 -> 服务端口,然后重新执行当前 dev/open 命令。"
|
|
274
|
+
];
|
|
275
|
+
if (projectPath) lines.push(`当前目标项目目录:${projectPath}`);
|
|
276
|
+
logger_default.warn(lines.join("\n"));
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
250
279
|
//#region src/cli/openIde/reuse.ts
|
|
251
280
|
function formatReuseOpenedWechatIdePrompt() {
|
|
252
281
|
return `目标项目已在微信开发者工具中打开,已跳过重复打开。按 ${colors.bold(colors.green("r"))} 关闭当前窗口后重新打开。`;
|
|
@@ -256,8 +285,10 @@ function disconnectMiniProgram(miniProgram) {
|
|
|
256
285
|
}
|
|
257
286
|
async function openWechatIdeByAutomator(projectPath) {
|
|
258
287
|
disconnectMiniProgram(await launchAutomator({
|
|
288
|
+
persistAsDefaultSession: true,
|
|
259
289
|
preserveProjectRoot: true,
|
|
260
290
|
projectPath,
|
|
291
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
261
292
|
trustProject: true
|
|
262
293
|
}));
|
|
263
294
|
}
|
|
@@ -265,6 +296,7 @@ async function connectOpenedProject(projectPath) {
|
|
|
265
296
|
try {
|
|
266
297
|
return await connectOpenedAutomator({
|
|
267
298
|
projectPath,
|
|
299
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
268
300
|
timeout: 3e3
|
|
269
301
|
});
|
|
270
302
|
} catch {
|
|
@@ -316,6 +348,17 @@ function shouldLogAutomatorFallbackError() {
|
|
|
316
348
|
const flag = process.env.WEAPP_VITE_DEBUG_AUTOMATOR_OPEN;
|
|
317
349
|
return flag === "1" || flag === "true";
|
|
318
350
|
}
|
|
351
|
+
const PREPARE_AUTOMATOR_SESSION_TIMEOUT = 8e3;
|
|
352
|
+
const RESET_FILEUTILS_ENV = "WEAPP_VITE_RESET_IDE_FILEUTILS";
|
|
353
|
+
function isWechatIdeOpenRecoveryDisabled(options) {
|
|
354
|
+
if (options.openRecovery === false) return true;
|
|
355
|
+
const flag = process.env.WEAPP_VITE_DISABLE_IDE_OPEN_RECOVERY;
|
|
356
|
+
return flag === "1" || flag === "true";
|
|
357
|
+
}
|
|
358
|
+
function shouldResetWechatIdeFileUtils() {
|
|
359
|
+
const flag = process.env[RESET_FILEUTILS_ENV];
|
|
360
|
+
return flag === "1" || flag === "true";
|
|
361
|
+
}
|
|
319
362
|
/**
|
|
320
363
|
* @description 执行 IDE 打开流程,并在登录失效时允许按键重试。
|
|
321
364
|
*/
|
|
@@ -366,6 +409,16 @@ function appendLoginRetryArgv(argv, options) {
|
|
|
366
409
|
if (options.loginRetryTimeout) argv.push("--login-retry-timeout", options.loginRetryTimeout);
|
|
367
410
|
return argv;
|
|
368
411
|
}
|
|
412
|
+
function createIdeOpenArgv(platform, projectPath, options = {}) {
|
|
413
|
+
const argv = ["open", "-p"];
|
|
414
|
+
if (projectPath) argv.push(projectPath);
|
|
415
|
+
if (platform === "weapp" && options.trustProject !== false) argv.push("--trust-project");
|
|
416
|
+
if (platform && shouldPassPlatformArgToIdeOpen(platform)) argv.push("--platform", platform);
|
|
417
|
+
if (options.nonInteractive) argv.push("--non-interactive");
|
|
418
|
+
if (options.loginRetry) argv.push("--login-retry", options.loginRetry);
|
|
419
|
+
if (options.loginRetryTimeout) argv.push("--login-retry-timeout", options.loginRetryTimeout);
|
|
420
|
+
return argv;
|
|
421
|
+
}
|
|
369
422
|
async function prepareOpenedWechatIdeAutomatorSession(projectPath, options) {
|
|
370
423
|
try {
|
|
371
424
|
(await launchAutomator({
|
|
@@ -373,24 +426,37 @@ async function prepareOpenedWechatIdeAutomatorSession(projectPath, options) {
|
|
|
373
426
|
preserveProjectRoot: true,
|
|
374
427
|
projectPath,
|
|
375
428
|
port: resolveProjectAutomatorPort(projectPath),
|
|
376
|
-
timeout:
|
|
429
|
+
timeout: PREPARE_AUTOMATOR_SESSION_TIMEOUT,
|
|
377
430
|
trustProject: options.trustProject !== false
|
|
378
431
|
})).disconnect?.();
|
|
432
|
+
return { ok: true };
|
|
379
433
|
} catch (error) {
|
|
380
434
|
logger_default.warn("准备当前项目的微信开发者工具自动化会话失败,截图、MCP 或 IDE 联动命令首次运行时将重新连接。");
|
|
435
|
+
logWechatIdeRecoveryHint({
|
|
436
|
+
projectPath,
|
|
437
|
+
reason: "无法建立当前项目的自动化会话,常见原因是 DevTools 服务端口未就绪、窗口停留在项目选择页,或存在残留 DevTools 会话。"
|
|
438
|
+
});
|
|
381
439
|
if (shouldLogAutomatorFallbackError()) logger_default.error(error);
|
|
440
|
+
return {
|
|
441
|
+
ok: false,
|
|
442
|
+
reason: "automator-session-failed",
|
|
443
|
+
error
|
|
444
|
+
};
|
|
382
445
|
}
|
|
383
446
|
}
|
|
384
447
|
async function stabilizeOpenedWechatIdeProject(projectPath, servicePortEnabled, options = {}) {
|
|
385
|
-
if (servicePortEnabled === false) return
|
|
448
|
+
if (servicePortEnabled === false) return {
|
|
449
|
+
ok: false,
|
|
450
|
+
reason: "service-port-disabled"
|
|
451
|
+
};
|
|
386
452
|
try {
|
|
387
|
-
await executeWechatIdeCliCommand(appendLoginRetryArgv([
|
|
453
|
+
if (shouldResetWechatIdeFileUtils()) await executeWechatIdeCliCommand(appendLoginRetryArgv([
|
|
388
454
|
"reset-fileutils",
|
|
389
455
|
"-p",
|
|
390
456
|
projectPath
|
|
391
457
|
], options), {
|
|
392
458
|
automatorMode: options.useAutomatorOpen === false ? "skip" : "prefer",
|
|
393
|
-
httpMode: "
|
|
459
|
+
httpMode: "require",
|
|
394
460
|
onNonLoginError: (error) => logger_default.error(error),
|
|
395
461
|
preserveProjectRoot: options.useAutomatorOpen === false,
|
|
396
462
|
projectPath
|
|
@@ -422,21 +488,53 @@ async function stabilizeOpenedWechatIdeProject(projectPath, servicePortEnabled,
|
|
|
422
488
|
} catch (error) {
|
|
423
489
|
if (shouldLogAutomatorFallbackError()) logger_default.error(error);
|
|
424
490
|
}
|
|
491
|
+
return { ok: true };
|
|
425
492
|
} catch (error) {
|
|
426
493
|
if (isWechatIdeLoginRequiredExitError(error)) throw error;
|
|
427
494
|
logger_default.warn("刷新微信开发者工具项目索引失败,已保留当前打开状态;如模拟器仍显示旧状态,可手动刷新一次。");
|
|
495
|
+
logWechatIdeRecoveryHint({
|
|
496
|
+
projectPath,
|
|
497
|
+
reason: "打开项目后的文件索引刷新失败,DevTools 可能仍在使用旧项目状态或内部服务未就绪。"
|
|
498
|
+
});
|
|
428
499
|
if (shouldLogAutomatorFallbackError()) logger_default.error(error);
|
|
500
|
+
return {
|
|
501
|
+
ok: false,
|
|
502
|
+
reason: "index-refresh-failed",
|
|
503
|
+
error
|
|
504
|
+
};
|
|
429
505
|
}
|
|
430
506
|
}
|
|
431
|
-
function
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
434
|
-
if (
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if (
|
|
439
|
-
return
|
|
507
|
+
async function verifyOpenedWechatIdeProject(projectPath, servicePortEnabled, options) {
|
|
508
|
+
const stabilizeResult = await stabilizeOpenedWechatIdeProject(projectPath, servicePortEnabled, options);
|
|
509
|
+
if (!stabilizeResult.ok) return stabilizeResult;
|
|
510
|
+
if (options.useAutomatorOpen === false && servicePortEnabled !== false) return await prepareOpenedWechatIdeAutomatorSession(projectPath, options);
|
|
511
|
+
return stabilizeResult;
|
|
512
|
+
}
|
|
513
|
+
function formatWechatIdeOpenHealthReason(result) {
|
|
514
|
+
if (result.reason === "index-refresh-failed") return "项目索引刷新失败";
|
|
515
|
+
return "服务端口未开启";
|
|
516
|
+
}
|
|
517
|
+
async function recoverOpenedWechatIdeProject(platform, projectPath, servicePortEnabled, options, failedResult) {
|
|
518
|
+
if (failedResult.reason === "service-port-disabled") return failedResult;
|
|
519
|
+
if (failedResult.reason === "automator-session-failed") {
|
|
520
|
+
logger_default.warn("已跳过微信开发者工具自动恢复;自动化会话预热失败不影响当前项目打开,截图、MCP 或 IDE 联动命令首次运行时会重新连接。");
|
|
521
|
+
return failedResult;
|
|
522
|
+
}
|
|
523
|
+
if (isWechatIdeOpenRecoveryDisabled(options)) {
|
|
524
|
+
logger_default.warn("已跳过微信开发者工具自动恢复;请按上方提示手动关闭并重新打开目标项目。");
|
|
525
|
+
return failedResult;
|
|
526
|
+
}
|
|
527
|
+
logger_default.info(`检测到微信开发者工具打开后状态不稳定(${formatWechatIdeOpenHealthReason(failedResult)}),正在自动关闭并重新打开目标项目...`);
|
|
528
|
+
if (!await closeIde()) logger_default.warn("自动恢复时关闭当前微信开发者工具失败,仍继续尝试重新打开目标项目。");
|
|
529
|
+
await runWechatIdeOpenWithRetry(createIdeOpenArgv(platform, projectPath, options));
|
|
530
|
+
const recoveredResult = await verifyOpenedWechatIdeProject(projectPath, servicePortEnabled, options);
|
|
531
|
+
if (recoveredResult.ok) logger_default.info("微信开发者工具已完成自动恢复。");
|
|
532
|
+
else logger_default.warn("微信开发者工具自动恢复未完成;可设置 `WEAPP_VITE_DISABLE_IDE_OPEN_RECOVERY=1` 或传入 `--no-open-recovery` 跳过自动关闭重开,并按提示手动处理。");
|
|
533
|
+
return recoveredResult;
|
|
534
|
+
}
|
|
535
|
+
async function verifyAndRecoverOpenedWechatIdeProject(platform, projectPath, servicePortEnabled, options) {
|
|
536
|
+
const healthResult = await verifyOpenedWechatIdeProject(projectPath, servicePortEnabled, options);
|
|
537
|
+
if (!healthResult.ok) await recoverOpenedWechatIdeProject(platform, projectPath, servicePortEnabled, options, healthResult);
|
|
440
538
|
}
|
|
441
539
|
async function openIde(platform, projectPath, options = {}) {
|
|
442
540
|
let bootstrapResult;
|
|
@@ -454,12 +552,12 @@ async function openIde(platform, projectPath, options = {}) {
|
|
|
454
552
|
logger_default.warn("检测微信开发者工具服务端口或写入项目信任状态失败,继续执行 open 流程。");
|
|
455
553
|
logger_default.error(error);
|
|
456
554
|
}
|
|
457
|
-
if (platform === "weapp" && projectPath && bootstrapResult?.servicePortEnabled === false)
|
|
555
|
+
if (platform === "weapp" && projectPath && bootstrapResult?.servicePortEnabled === false) logWechatIdeServicePortDisabledHint(projectPath);
|
|
458
556
|
if (platform === "weapp" && projectPath && normalizedOptions.trustProject !== false && bootstrapResult?.servicePortEnabled !== false && useAutomatorOpen) try {
|
|
459
557
|
const openResult = await tryOpenWechatIdeByAutomator(projectPath, normalizedOptions);
|
|
460
558
|
if (openResult === "reused") return;
|
|
461
559
|
if (openResult) {
|
|
462
|
-
await
|
|
560
|
+
if (!normalizedOptions.skipPostOpenHealthCheck) await verifyAndRecoverOpenedWechatIdeProject(platform, projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
|
|
463
561
|
return;
|
|
464
562
|
}
|
|
465
563
|
} catch (error) {
|
|
@@ -474,10 +572,8 @@ async function openIde(platform, projectPath, options = {}) {
|
|
|
474
572
|
if (!await closeIde()) logger_default.warn("关闭当前微信开发者工具失败,仍继续尝试打开目标项目。");
|
|
475
573
|
}
|
|
476
574
|
await runWechatIdeOpenWithRetry(createIdeOpenArgv(platform, projectPath, normalizedOptions));
|
|
477
|
-
if (platform === "weapp" && projectPath)
|
|
478
|
-
|
|
479
|
-
if (!useAutomatorOpen && bootstrapResult?.servicePortEnabled !== false) await prepareOpenedWechatIdeAutomatorSession(projectPath, normalizedOptions);
|
|
480
|
-
}
|
|
575
|
+
if (platform === "weapp" && projectPath && normalizedOptions.prepareAutomatorSession) await prepareOpenedWechatIdeAutomatorSession(projectPath, normalizedOptions);
|
|
576
|
+
if (platform === "weapp" && projectPath && !normalizedOptions.skipPostOpenHealthCheck) await verifyAndRecoverOpenedWechatIdeProject(platform, projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
|
|
481
577
|
}
|
|
482
578
|
/**
|
|
483
579
|
* @description 解析 IDE 相关命令所需的平台、项目目录与配置上下文。
|
|
@@ -876,7 +972,7 @@ function analyzeComponentUsage(options) {
|
|
|
876
972
|
visit(edge.component, page, nextStack);
|
|
877
973
|
}
|
|
878
974
|
};
|
|
879
|
-
for (const page of pages) visit(page, page, new Set([page]));
|
|
975
|
+
for (const page of pages) visit(page, page, /* @__PURE__ */ new Set([page]));
|
|
880
976
|
return Array.from(usageMap.values()).map((usage) => {
|
|
881
977
|
const pages = Array.from(usage.pages.values()).sort((left, right) => left.page.localeCompare(right.page));
|
|
882
978
|
const suggestions = [createComponentSuggestion(usage)].filter((item) => Boolean(item));
|
|
@@ -2425,7 +2521,7 @@ function resolveSubPackageRoot(fileName, roots) {
|
|
|
2425
2521
|
function collectPackageSizeReports(output, subPackageMap) {
|
|
2426
2522
|
const outputs = Array.isArray(output) ? output : [output];
|
|
2427
2523
|
const roots = [...subPackageMap?.keys() ?? []].filter(Boolean).sort((a, b) => b.length - a.length || a.localeCompare(b));
|
|
2428
|
-
const packageBytes = new Map([["__main__", 0]]);
|
|
2524
|
+
const packageBytes = /* @__PURE__ */ new Map([["__main__", 0]]);
|
|
2429
2525
|
for (const root of roots) packageBytes.set(root, 0);
|
|
2430
2526
|
for (const current of outputs) for (const item of current.output ?? []) {
|
|
2431
2527
|
const root = resolveSubPackageRoot(item.fileName, roots) ?? "__main__";
|
|
@@ -2475,7 +2571,7 @@ function emitDashboardEvents$1(handle, events) {
|
|
|
2475
2571
|
handle?.emitRuntimeEvents(events);
|
|
2476
2572
|
}
|
|
2477
2573
|
function registerBuildCommand(cli) {
|
|
2478
|
-
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("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 输出分包分析仪表盘`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).action(async (root, options) => {
|
|
2574
|
+
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("--no-open-recovery", "[boolean] disable automatic Wechat DevTools close-and-reopen recovery").option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 输出分包分析仪表盘`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).action(async (root, options) => {
|
|
2479
2575
|
filterDuplicateOptions(options);
|
|
2480
2576
|
const cwd = root ?? process.cwd();
|
|
2481
2577
|
const configFile = resolveConfigFile(options);
|
|
@@ -2572,7 +2668,10 @@ function registerBuildCommand(cli) {
|
|
|
2572
2668
|
detail: "构建完成后准备打开 IDE 项目。",
|
|
2573
2669
|
tags: ["ide", "open"]
|
|
2574
2670
|
}]);
|
|
2575
|
-
await openIde(configService.platform, resolveIdeProjectPath(configService.mpDistRoot), {
|
|
2671
|
+
await openIde(configService.platform, resolveIdeProjectPath(configService.mpDistRoot), {
|
|
2672
|
+
openRecovery: options.openRecovery,
|
|
2673
|
+
trustProject: options.trustProject
|
|
2674
|
+
});
|
|
2576
2675
|
}
|
|
2577
2676
|
if (analyzeHandle) await analyzeHandle.waitForExit();
|
|
2578
2677
|
ctx.watcherService?.closeAll();
|
|
@@ -2764,6 +2863,56 @@ const DEFAULT_FORWARD_CONSOLE_LEVELS = [
|
|
|
2764
2863
|
let activeForwardConsoleSession;
|
|
2765
2864
|
const FORWARD_CONSOLE_RETRY_DELAY_MS = 1e3;
|
|
2766
2865
|
const FORWARD_CONSOLE_RETRY_TIMES = 5;
|
|
2866
|
+
async function detectAgent() {
|
|
2867
|
+
try {
|
|
2868
|
+
const result = await determineAgent();
|
|
2869
|
+
return {
|
|
2870
|
+
isAgent: result.isAgent,
|
|
2871
|
+
agentName: result.isAgent ? result.agent.name : void 0
|
|
2872
|
+
};
|
|
2873
|
+
} catch {
|
|
2874
|
+
return {
|
|
2875
|
+
isAgent: false,
|
|
2876
|
+
agentName: void 0
|
|
2877
|
+
};
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
function formatForwardConsolePrefix(level, color) {
|
|
2881
|
+
const label = `[mini:${level.padEnd(5)}]`;
|
|
2882
|
+
if (!color) return label;
|
|
2883
|
+
if (level === "error") return colors.bold(colors.red(label));
|
|
2884
|
+
if (level === "warn") return colors.bold(colors.yellow(label));
|
|
2885
|
+
if (level === "info") return colors.bold(colors.cyan(label));
|
|
2886
|
+
if (level === "debug") return colors.dim(label);
|
|
2887
|
+
return colors.bold(colors.green(label));
|
|
2888
|
+
}
|
|
2889
|
+
function formatForwardConsoleMessage(level, message, color) {
|
|
2890
|
+
if (!color) return message;
|
|
2891
|
+
if (level === "error") return colors.red(message);
|
|
2892
|
+
if (level === "warn") return colors.yellow(message);
|
|
2893
|
+
if (level === "debug") return colors.dim(message);
|
|
2894
|
+
return message;
|
|
2895
|
+
}
|
|
2896
|
+
function writeForwardConsoleLine(line) {
|
|
2897
|
+
process.stdout.write(`${line}\n`);
|
|
2898
|
+
}
|
|
2899
|
+
function isDevtoolsPortNotReadyError(error) {
|
|
2900
|
+
return error instanceof Error && (error.message === "DEVTOOLS_HTTP_PORT_ERROR" || error.message === "DEVTOOLS_WS_CONNECT_ERROR" || error.message === "DEVTOOLS_EXTENSION_CONTEXT_INVALIDATED");
|
|
2901
|
+
}
|
|
2902
|
+
function sleep(ms) {
|
|
2903
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2904
|
+
}
|
|
2905
|
+
async function withForwardConsoleRetry(runner) {
|
|
2906
|
+
let lastError;
|
|
2907
|
+
for (let attempt = 0; attempt <= FORWARD_CONSOLE_RETRY_TIMES; attempt++) try {
|
|
2908
|
+
return await runner();
|
|
2909
|
+
} catch (error) {
|
|
2910
|
+
lastError = error;
|
|
2911
|
+
if (!isDevtoolsPortNotReadyError(error) || attempt === FORWARD_CONSOLE_RETRY_TIMES) break;
|
|
2912
|
+
await sleep(FORWARD_CONSOLE_RETRY_DELAY_MS);
|
|
2913
|
+
}
|
|
2914
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
2915
|
+
}
|
|
2767
2916
|
/**
|
|
2768
2917
|
* @description 解析 forwardConsole 配置,并在 auto 模式下检测 AI 终端。
|
|
2769
2918
|
*/
|
|
@@ -2804,93 +2953,71 @@ async function resolveForwardConsoleOptions(config) {
|
|
|
2804
2953
|
};
|
|
2805
2954
|
}
|
|
2806
2955
|
/**
|
|
2807
|
-
* @description 在 weapp 开发态按需启动控制台转发。
|
|
2808
|
-
*/
|
|
2809
|
-
async function maybeStartForwardConsole(options) {
|
|
2810
|
-
if (options.platform !== "weapp") return false;
|
|
2811
|
-
const projectPath = resolveIdeProjectPath(options.mpDistRoot) ?? options.cwd;
|
|
2812
|
-
if (!projectPath) return false;
|
|
2813
|
-
const resolved = await resolveForwardConsoleOptions(options.weappViteConfig);
|
|
2814
|
-
if (!resolved.enabled) return false;
|
|
2815
|
-
if (activeForwardConsoleSession) return true;
|
|
2816
|
-
try {
|
|
2817
|
-
activeForwardConsoleSession = await startForwardConsoleBridge({
|
|
2818
|
-
agentName: resolved.agentName,
|
|
2819
|
-
projectPath,
|
|
2820
|
-
logLevels: resolved.logLevels,
|
|
2821
|
-
unhandledErrors: resolved.unhandledErrors,
|
|
2822
|
-
onReadyMessage: "[forwardConsole] 已连接微信开发者工具日志"
|
|
2823
|
-
});
|
|
2824
|
-
return true;
|
|
2825
|
-
} catch (error) {
|
|
2826
|
-
activeForwardConsoleSession = void 0;
|
|
2827
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
2828
|
-
logger_default.warn(`[forwardConsole] 启动失败,回退到普通 IDE 打开流程:${message}`);
|
|
2829
|
-
return false;
|
|
2830
|
-
}
|
|
2831
|
-
}
|
|
2832
|
-
/**
|
|
2833
2956
|
* @description 统一启动 DevTools 日志桥,并在 IDE 刚启动时做短暂重试。
|
|
2834
2957
|
*/
|
|
2835
2958
|
async function startForwardConsoleBridge(options) {
|
|
2836
2959
|
return await withForwardConsoleRetry(async () => {
|
|
2960
|
+
const color = options.color ?? true;
|
|
2837
2961
|
return await startForwardConsole({
|
|
2838
2962
|
projectPath: options.projectPath,
|
|
2839
2963
|
logLevels: options.logLevels,
|
|
2964
|
+
openedOnly: options.openedOnly,
|
|
2965
|
+
port: options.port,
|
|
2840
2966
|
unhandledErrors: options.unhandledErrors,
|
|
2841
2967
|
onReady: () => {
|
|
2842
2968
|
const suffix = options.agentName ? `(AI 终端:${options.agentName})` : "";
|
|
2843
2969
|
logger_default.info(`${options.onReadyMessage}${suffix}`);
|
|
2844
2970
|
},
|
|
2845
2971
|
onLog: (event) => {
|
|
2846
|
-
|
|
2847
|
-
if (event.level === "error") {
|
|
2848
|
-
logger_default.error(line);
|
|
2849
|
-
return;
|
|
2850
|
-
}
|
|
2851
|
-
if (event.level === "warn") {
|
|
2852
|
-
logger_default.warn(line);
|
|
2853
|
-
return;
|
|
2854
|
-
}
|
|
2855
|
-
if (event.level === "info") {
|
|
2856
|
-
logger_default.info(line);
|
|
2857
|
-
return;
|
|
2858
|
-
}
|
|
2859
|
-
logger_default.log(line);
|
|
2972
|
+
writeForwardConsoleLine(`${formatForwardConsolePrefix(event.level, color)} ${formatForwardConsoleMessage(event.level, event.message, color)}`);
|
|
2860
2973
|
}
|
|
2861
2974
|
});
|
|
2862
2975
|
});
|
|
2863
2976
|
}
|
|
2864
|
-
|
|
2977
|
+
/**
|
|
2978
|
+
* @description 在 weapp 开发态按需启动控制台转发。
|
|
2979
|
+
*/
|
|
2980
|
+
async function maybeStartForwardConsole(options) {
|
|
2981
|
+
if (options.platform !== "weapp") return false;
|
|
2982
|
+
const projectPath = resolveIdeProjectPath(options.mpDistRoot) ?? options.cwd;
|
|
2983
|
+
if (!projectPath) return false;
|
|
2984
|
+
const resolved = await resolveForwardConsoleOptions(options.weappViteConfig);
|
|
2985
|
+
if (!resolved.enabled) return false;
|
|
2986
|
+
if (activeForwardConsoleSession) return true;
|
|
2987
|
+
const bridgeOptions = {
|
|
2988
|
+
agentName: resolved.agentName,
|
|
2989
|
+
color: !resolved.agentName,
|
|
2990
|
+
projectPath,
|
|
2991
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
2992
|
+
logLevels: resolved.logLevels,
|
|
2993
|
+
openedOnly: options.openedOnly,
|
|
2994
|
+
unhandledErrors: resolved.unhandledErrors,
|
|
2995
|
+
onReadyMessage: "[forwardConsole] 已连接微信开发者工具日志"
|
|
2996
|
+
};
|
|
2865
2997
|
try {
|
|
2866
|
-
|
|
2867
|
-
return
|
|
2868
|
-
isAgent: result.isAgent,
|
|
2869
|
-
agentName: result.isAgent ? result.agent.name : void 0
|
|
2870
|
-
};
|
|
2871
|
-
} catch {
|
|
2872
|
-
return {
|
|
2873
|
-
isAgent: false,
|
|
2874
|
-
agentName: void 0
|
|
2875
|
-
};
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
async function withForwardConsoleRetry(runner) {
|
|
2879
|
-
let lastError;
|
|
2880
|
-
for (let attempt = 0; attempt <= FORWARD_CONSOLE_RETRY_TIMES; attempt++) try {
|
|
2881
|
-
return await runner();
|
|
2998
|
+
activeForwardConsoleSession = await startForwardConsoleBridge(bridgeOptions);
|
|
2999
|
+
return true;
|
|
2882
3000
|
} catch (error) {
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3001
|
+
if (!isDevtoolsPortNotReadyError(error)) {
|
|
3002
|
+
activeForwardConsoleSession = void 0;
|
|
3003
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3004
|
+
logger_default.warn(`[forwardConsole] 启动失败,回退到普通 IDE 打开流程:${message}`);
|
|
3005
|
+
return false;
|
|
3006
|
+
}
|
|
3007
|
+
try {
|
|
3008
|
+
activeForwardConsoleSession = await startForwardConsoleBridge({
|
|
3009
|
+
...bridgeOptions,
|
|
3010
|
+
openedOnly: true,
|
|
3011
|
+
port: void 0
|
|
3012
|
+
});
|
|
3013
|
+
return true;
|
|
3014
|
+
} catch (fallbackError) {
|
|
3015
|
+
activeForwardConsoleSession = void 0;
|
|
3016
|
+
const message = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);
|
|
3017
|
+
logger_default.warn(`[forwardConsole] 启动失败,回退到普通 IDE 打开流程:${message}`);
|
|
3018
|
+
return false;
|
|
3019
|
+
}
|
|
2886
3020
|
}
|
|
2887
|
-
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
2888
|
-
}
|
|
2889
|
-
function isDevtoolsPortNotReadyError(error) {
|
|
2890
|
-
return error instanceof Error && error.message === "DEVTOOLS_HTTP_PORT_ERROR";
|
|
2891
|
-
}
|
|
2892
|
-
function sleep(ms) {
|
|
2893
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2894
3021
|
}
|
|
2895
3022
|
//#endregion
|
|
2896
3023
|
//#region src/cli/hmrProfileSummary.ts
|
|
@@ -3017,7 +3144,10 @@ async function runIdeCommand(action, root, options) {
|
|
|
3017
3144
|
logger_default.info(`已完成微信开发者工具配置预热:扫描实例 ${result.touchedInstanceCount} 个,检测服务端口配置 ${result.detectedSecurityCount} 处,写入项目信任 ${result.trustedProjectCount} 处。`);
|
|
3018
3145
|
return;
|
|
3019
3146
|
}
|
|
3020
|
-
if (options.open) await openIde(resolved.platform, resolved.projectPath, {
|
|
3147
|
+
if (options.open) await openIde(resolved.platform, resolved.projectPath, {
|
|
3148
|
+
openRecovery: options.openRecovery,
|
|
3149
|
+
trustProject: options.trustProject
|
|
3150
|
+
});
|
|
3021
3151
|
if (action === "info") {
|
|
3022
3152
|
const result = await getWechatIdeToolInfo({ projectPath: resolved.projectPath });
|
|
3023
3153
|
logger_default.info(formatIdeOutput(result, options));
|
|
@@ -3062,6 +3192,7 @@ async function runIdeCommand(action, root, options) {
|
|
|
3062
3192
|
if (latestHmrSummary) logger_default.info(latestHmrSummary.line);
|
|
3063
3193
|
const session = await startForwardConsoleBridge({
|
|
3064
3194
|
projectPath: resolved.projectPath,
|
|
3195
|
+
port: resolveProjectAutomatorPort(resolved.projectPath),
|
|
3065
3196
|
agentName: void 0,
|
|
3066
3197
|
logLevels: forwardConsoleOptions.logLevels,
|
|
3067
3198
|
unhandledErrors: forwardConsoleOptions.unhandledErrors,
|
|
@@ -3076,7 +3207,7 @@ async function runIdeCommand(action, root, options) {
|
|
|
3076
3207
|
* @description 注册 IDE 相关子命令。
|
|
3077
3208
|
*/
|
|
3078
3209
|
function registerIdeCommand(cli) {
|
|
3079
|
-
cli.command("ide [action] [root]", "run Wechat DevTools utility actions and log bridge commands").option("-o, --open", "[boolean] open ide before attaching log bridge").option("-p, --platform <platform>", "[string] target platform (weapp | web)").option("--project-config <path>", "[string] project config path (miniprogram only)").option("--ticket <value>", "[string] ticket used by `ide ticket:set`").option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).action(async (action, root, options) => {
|
|
3210
|
+
cli.command("ide [action] [root]", "run Wechat DevTools utility actions and log bridge commands").option("-o, --open", "[boolean] open ide before attaching log bridge").option("-p, --platform <platform>", "[string] target platform (weapp | web)").option("--project-config <path>", "[string] project config path (miniprogram only)").option("--ticket <value>", "[string] ticket used by `ide ticket:set`").option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--no-open-recovery", "[boolean] disable automatic Wechat DevTools close-and-reopen recovery").action(async (action, root, options) => {
|
|
3080
3211
|
await runIdeCommand(action, root, options);
|
|
3081
3212
|
});
|
|
3082
3213
|
}
|
|
@@ -3611,7 +3742,7 @@ function applyMcpCliOptions(config, options) {
|
|
|
3611
3742
|
//#endregion
|
|
3612
3743
|
//#region src/cli/commands/open.ts
|
|
3613
3744
|
function registerOpenCommand(cli) {
|
|
3614
|
-
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("--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("--mcp", "[boolean] auto start MCP service before opening IDE").option("--no-mcp", "[boolean] disable MCP service before opening IDE").action(async (root, options) => {
|
|
3745
|
+
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("--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 Wechat DevTools close-and-reopen recovery").option("--mcp", "[boolean] auto start MCP service before opening IDE").option("--no-mcp", "[boolean] disable MCP service before opening IDE").action(async (root, options) => {
|
|
3615
3746
|
filterDuplicateOptions(options);
|
|
3616
3747
|
const configFile = resolveConfigFile(options);
|
|
3617
3748
|
const targets = resolveRuntimeTargets(options);
|
|
@@ -3640,6 +3771,7 @@ function registerOpenCommand(cli) {
|
|
|
3640
3771
|
loginRetry: options.loginRetry,
|
|
3641
3772
|
loginRetryTimeout: options.loginRetryTimeout,
|
|
3642
3773
|
nonInteractive: options.nonInteractive,
|
|
3774
|
+
openRecovery: options.openRecovery,
|
|
3643
3775
|
trustProject: options.trustProject
|
|
3644
3776
|
});
|
|
3645
3777
|
});
|
|
@@ -3892,7 +4024,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
3892
4024
|
}
|
|
3893
4025
|
//#endregion
|
|
3894
4026
|
//#region package.json
|
|
3895
|
-
var version = "6.
|
|
4027
|
+
var version = "6.17.1";
|
|
3896
4028
|
//#endregion
|
|
3897
4029
|
//#region src/cli/devHotkeys/format.ts
|
|
3898
4030
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -4524,6 +4656,7 @@ function createServeMiniProgramDevActions(options) {
|
|
|
4524
4656
|
openIde: async (openOptions = {}) => {
|
|
4525
4657
|
if (!openOptions.forceOpen && await options.tryReuseForwardConsole?.()) return "已通过控制台转发复用当前开发者工具会话";
|
|
4526
4658
|
await options.openIde(projectPath, openOptions);
|
|
4659
|
+
await options.tryReuseForwardConsole?.();
|
|
4527
4660
|
return openOptions.forceReopen ? "已重新打开微信开发者工具项目" : "已打开或复用微信开发者工具项目";
|
|
4528
4661
|
},
|
|
4529
4662
|
rebuild: async () => {
|
|
@@ -4545,8 +4678,11 @@ function waitForServeShutdownSignal() {
|
|
|
4545
4678
|
}
|
|
4546
4679
|
//#endregion
|
|
4547
4680
|
//#region src/cli/commands/serve/index.ts
|
|
4681
|
+
function writePostOpenSeparator() {
|
|
4682
|
+
process.stdout?.write?.("\n");
|
|
4683
|
+
}
|
|
4548
4684
|
function registerServeCommand(cli) {
|
|
4549
|
-
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("--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("--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("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).action(async (root, options) => {
|
|
4685
|
+
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("--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 Wechat DevTools close-and-reopen recovery").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("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).option("--scope <scope>", `[string] 局部构建范围,例如 main,packages/order`).action(async (root, options) => {
|
|
4550
4686
|
filterDuplicateOptions(options);
|
|
4551
4687
|
const cwd = root ?? process.cwd();
|
|
4552
4688
|
const configFile = resolveConfigFile(options);
|
|
@@ -4606,10 +4742,14 @@ function registerServeCommand(cli) {
|
|
|
4606
4742
|
loginRetry: options.loginRetry,
|
|
4607
4743
|
loginRetryTimeout: options.loginRetryTimeout,
|
|
4608
4744
|
nonInteractive: options.nonInteractive,
|
|
4745
|
+
openRecovery: false,
|
|
4746
|
+
prepareAutomatorSession: true,
|
|
4609
4747
|
reuseOpenedProject: !openOptions?.forceReopen,
|
|
4748
|
+
skipPostOpenHealthCheck: true,
|
|
4610
4749
|
trustProject: options.trustProject,
|
|
4611
|
-
useAutomatorOpen:
|
|
4750
|
+
useAutomatorOpen: true
|
|
4612
4751
|
});
|
|
4752
|
+
writePostOpenSeparator();
|
|
4613
4753
|
},
|
|
4614
4754
|
projectPath: resolveIdeProjectRoot(configService.mpDistRoot, configService.cwd),
|
|
4615
4755
|
tryReuseForwardConsole: async () => {
|
|
@@ -4728,7 +4868,7 @@ function registerServeCommand(cli) {
|
|
|
4728
4868
|
}
|
|
4729
4869
|
//#endregion
|
|
4730
4870
|
//#region src/cli/error.ts
|
|
4731
|
-
const watchLimitErrorCodes = new Set(["EMFILE", "ENOSPC"]);
|
|
4871
|
+
const watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
|
|
4732
4872
|
const watchLimitMessagePattern = /EMFILE|ENOSPC|unable to start FSEvent stream/i;
|
|
4733
4873
|
function findWatchLimitErrorCode(error) {
|
|
4734
4874
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -4764,7 +4904,7 @@ function handleCLIError(error) {
|
|
|
4764
4904
|
}
|
|
4765
4905
|
//#endregion
|
|
4766
4906
|
//#region src/cli/ide.ts
|
|
4767
|
-
const WEAPP_VITE_NATIVE_COMMANDS = new Set([
|
|
4907
|
+
const WEAPP_VITE_NATIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
4768
4908
|
"dev",
|
|
4769
4909
|
"serve",
|
|
4770
4910
|
"build",
|
|
@@ -4804,7 +4944,7 @@ async function tryRunIdeCommand(argv) {
|
|
|
4804
4944
|
}
|
|
4805
4945
|
//#endregion
|
|
4806
4946
|
//#region src/cli/mcpAutoStart.ts
|
|
4807
|
-
const SKIP_COMMANDS = new Set([
|
|
4947
|
+
const SKIP_COMMANDS = /* @__PURE__ */ new Set([
|
|
4808
4948
|
"--help",
|
|
4809
4949
|
"--version",
|
|
4810
4950
|
"-h",
|
|
@@ -4907,7 +5047,7 @@ registerMcpCommand(cli);
|
|
|
4907
5047
|
registerServeCommand(cli);
|
|
4908
5048
|
cli.help();
|
|
4909
5049
|
cli.version(VERSION);
|
|
4910
|
-
const skipManagedTsconfigBootstrapCommands = new Set([
|
|
5050
|
+
const skipManagedTsconfigBootstrapCommands = /* @__PURE__ */ new Set([
|
|
4911
5051
|
"g",
|
|
4912
5052
|
"generate",
|
|
4913
5053
|
"ide",
|
|
@@ -1523,6 +1523,10 @@ interface RuntimeState {
|
|
|
1523
1523
|
independent: {
|
|
1524
1524
|
outputs: Map<string, RolldownOutput>;
|
|
1525
1525
|
};
|
|
1526
|
+
output: {
|
|
1527
|
+
emittedSource: Map<string, string>;
|
|
1528
|
+
wevuInternalRuntimeFileName?: string;
|
|
1529
|
+
};
|
|
1526
1530
|
hmr: {
|
|
1527
1531
|
loadedEntrySet: Set<string>;
|
|
1528
1532
|
dirtyEntrySet: Set<string>;
|
|
@@ -1535,10 +1539,12 @@ interface RuntimeState {
|
|
|
1535
1539
|
vueEntryHasTemplate: Map<string, boolean>;
|
|
1536
1540
|
vueEntryNonJsonSignatures: Map<string, string>;
|
|
1537
1541
|
vueEntryScriptSignatures: Map<string, string>;
|
|
1542
|
+
appEntryAutoRoutesSignature?: string;
|
|
1538
1543
|
dirtyVueEntryIds: Set<string>;
|
|
1539
1544
|
didEmitAllEntries: boolean;
|
|
1540
1545
|
lastHmrEntryIds: Set<string>;
|
|
1541
1546
|
lastEmittedEntryIds: Set<string>;
|
|
1547
|
+
lastEmittedChunkFileNames: Set<string>;
|
|
1542
1548
|
recentProfiles: Array<{
|
|
1543
1549
|
timestamp?: string;
|
|
1544
1550
|
totalMs: number;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Bn as WeappViteHostMeta, Hn as createWeappViteHostMeta, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Yn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as WEAPP_VITE_HOST_NAME } from "./config-
|
|
1
|
+
import { Bn as WeappViteHostMeta, Hn as createWeappViteHostMeta, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Yn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as WEAPP_VITE_HOST_NAME } from "./config-Cxi7xvCa.mjs";
|
|
2
2
|
export { type App, type Component, type Page, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, type WeappViteConfig, WeappViteHostMeta, type WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|