weapp-vite 6.17.0 → 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 +128 -82
- package/dist/{createContext-C-aCFA7T.mjs → createContext-Dg_HER2J.mjs} +38 -38
- package/dist/file-C206GmuT.mjs +2 -0
- package/dist/{file-Byezg0ta.mjs → file-CtueODLX.mjs} +1 -1
- package/dist/getInstance-Dw7Y4EkD.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/package.json +15 -15
- package/dist/file-BrdaHBHs.mjs +0 -2
- package/dist/getInstance-COXqNkGN.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,6 +1,6 @@
|
|
|
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-
|
|
3
|
+
import { h as VERSION } from "./file-CtueODLX.mjs";
|
|
4
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";
|
|
@@ -285,8 +285,10 @@ function disconnectMiniProgram(miniProgram) {
|
|
|
285
285
|
}
|
|
286
286
|
async function openWechatIdeByAutomator(projectPath) {
|
|
287
287
|
disconnectMiniProgram(await launchAutomator({
|
|
288
|
+
persistAsDefaultSession: true,
|
|
288
289
|
preserveProjectRoot: true,
|
|
289
290
|
projectPath,
|
|
291
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
290
292
|
trustProject: true
|
|
291
293
|
}));
|
|
292
294
|
}
|
|
@@ -294,6 +296,7 @@ async function connectOpenedProject(projectPath) {
|
|
|
294
296
|
try {
|
|
295
297
|
return await connectOpenedAutomator({
|
|
296
298
|
projectPath,
|
|
299
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
297
300
|
timeout: 3e3
|
|
298
301
|
});
|
|
299
302
|
} catch {
|
|
@@ -345,11 +348,17 @@ function shouldLogAutomatorFallbackError() {
|
|
|
345
348
|
const flag = process.env.WEAPP_VITE_DEBUG_AUTOMATOR_OPEN;
|
|
346
349
|
return flag === "1" || flag === "true";
|
|
347
350
|
}
|
|
351
|
+
const PREPARE_AUTOMATOR_SESSION_TIMEOUT = 8e3;
|
|
352
|
+
const RESET_FILEUTILS_ENV = "WEAPP_VITE_RESET_IDE_FILEUTILS";
|
|
348
353
|
function isWechatIdeOpenRecoveryDisabled(options) {
|
|
349
354
|
if (options.openRecovery === false) return true;
|
|
350
355
|
const flag = process.env.WEAPP_VITE_DISABLE_IDE_OPEN_RECOVERY;
|
|
351
356
|
return flag === "1" || flag === "true";
|
|
352
357
|
}
|
|
358
|
+
function shouldResetWechatIdeFileUtils() {
|
|
359
|
+
const flag = process.env[RESET_FILEUTILS_ENV];
|
|
360
|
+
return flag === "1" || flag === "true";
|
|
361
|
+
}
|
|
353
362
|
/**
|
|
354
363
|
* @description 执行 IDE 打开流程,并在登录失效时允许按键重试。
|
|
355
364
|
*/
|
|
@@ -417,7 +426,7 @@ async function prepareOpenedWechatIdeAutomatorSession(projectPath, options) {
|
|
|
417
426
|
preserveProjectRoot: true,
|
|
418
427
|
projectPath,
|
|
419
428
|
port: resolveProjectAutomatorPort(projectPath),
|
|
420
|
-
timeout:
|
|
429
|
+
timeout: PREPARE_AUTOMATOR_SESSION_TIMEOUT,
|
|
421
430
|
trustProject: options.trustProject !== false
|
|
422
431
|
})).disconnect?.();
|
|
423
432
|
return { ok: true };
|
|
@@ -441,7 +450,7 @@ async function stabilizeOpenedWechatIdeProject(projectPath, servicePortEnabled,
|
|
|
441
450
|
reason: "service-port-disabled"
|
|
442
451
|
};
|
|
443
452
|
try {
|
|
444
|
-
await executeWechatIdeCliCommand(appendLoginRetryArgv([
|
|
453
|
+
if (shouldResetWechatIdeFileUtils()) await executeWechatIdeCliCommand(appendLoginRetryArgv([
|
|
445
454
|
"reset-fileutils",
|
|
446
455
|
"-p",
|
|
447
456
|
projectPath
|
|
@@ -548,7 +557,7 @@ async function openIde(platform, projectPath, options = {}) {
|
|
|
548
557
|
const openResult = await tryOpenWechatIdeByAutomator(projectPath, normalizedOptions);
|
|
549
558
|
if (openResult === "reused") return;
|
|
550
559
|
if (openResult) {
|
|
551
|
-
await verifyAndRecoverOpenedWechatIdeProject(platform, projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
|
|
560
|
+
if (!normalizedOptions.skipPostOpenHealthCheck) await verifyAndRecoverOpenedWechatIdeProject(platform, projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
|
|
552
561
|
return;
|
|
553
562
|
}
|
|
554
563
|
} catch (error) {
|
|
@@ -563,7 +572,8 @@ async function openIde(platform, projectPath, options = {}) {
|
|
|
563
572
|
if (!await closeIde()) logger_default.warn("关闭当前微信开发者工具失败,仍继续尝试打开目标项目。");
|
|
564
573
|
}
|
|
565
574
|
await runWechatIdeOpenWithRetry(createIdeOpenArgv(platform, projectPath, normalizedOptions));
|
|
566
|
-
if (platform === "weapp" && projectPath) await
|
|
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);
|
|
567
577
|
}
|
|
568
578
|
/**
|
|
569
579
|
* @description 解析 IDE 相关命令所需的平台、项目目录与配置上下文。
|
|
@@ -962,7 +972,7 @@ function analyzeComponentUsage(options) {
|
|
|
962
972
|
visit(edge.component, page, nextStack);
|
|
963
973
|
}
|
|
964
974
|
};
|
|
965
|
-
for (const page of pages) visit(page, page, new Set([page]));
|
|
975
|
+
for (const page of pages) visit(page, page, /* @__PURE__ */ new Set([page]));
|
|
966
976
|
return Array.from(usageMap.values()).map((usage) => {
|
|
967
977
|
const pages = Array.from(usage.pages.values()).sort((left, right) => left.page.localeCompare(right.page));
|
|
968
978
|
const suggestions = [createComponentSuggestion(usage)].filter((item) => Boolean(item));
|
|
@@ -2511,7 +2521,7 @@ function resolveSubPackageRoot(fileName, roots) {
|
|
|
2511
2521
|
function collectPackageSizeReports(output, subPackageMap) {
|
|
2512
2522
|
const outputs = Array.isArray(output) ? output : [output];
|
|
2513
2523
|
const roots = [...subPackageMap?.keys() ?? []].filter(Boolean).sort((a, b) => b.length - a.length || a.localeCompare(b));
|
|
2514
|
-
const packageBytes = new Map([["__main__", 0]]);
|
|
2524
|
+
const packageBytes = /* @__PURE__ */ new Map([["__main__", 0]]);
|
|
2515
2525
|
for (const root of roots) packageBytes.set(root, 0);
|
|
2516
2526
|
for (const current of outputs) for (const item of current.output ?? []) {
|
|
2517
2527
|
const root = resolveSubPackageRoot(item.fileName, roots) ?? "__main__";
|
|
@@ -2853,6 +2863,56 @@ const DEFAULT_FORWARD_CONSOLE_LEVELS = [
|
|
|
2853
2863
|
let activeForwardConsoleSession;
|
|
2854
2864
|
const FORWARD_CONSOLE_RETRY_DELAY_MS = 1e3;
|
|
2855
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
|
+
}
|
|
2856
2916
|
/**
|
|
2857
2917
|
* @description 解析 forwardConsole 配置,并在 auto 模式下检测 AI 终端。
|
|
2858
2918
|
*/
|
|
@@ -2893,93 +2953,71 @@ async function resolveForwardConsoleOptions(config) {
|
|
|
2893
2953
|
};
|
|
2894
2954
|
}
|
|
2895
2955
|
/**
|
|
2896
|
-
* @description 在 weapp 开发态按需启动控制台转发。
|
|
2897
|
-
*/
|
|
2898
|
-
async function maybeStartForwardConsole(options) {
|
|
2899
|
-
if (options.platform !== "weapp") return false;
|
|
2900
|
-
const projectPath = resolveIdeProjectPath(options.mpDistRoot) ?? options.cwd;
|
|
2901
|
-
if (!projectPath) return false;
|
|
2902
|
-
const resolved = await resolveForwardConsoleOptions(options.weappViteConfig);
|
|
2903
|
-
if (!resolved.enabled) return false;
|
|
2904
|
-
if (activeForwardConsoleSession) return true;
|
|
2905
|
-
try {
|
|
2906
|
-
activeForwardConsoleSession = await startForwardConsoleBridge({
|
|
2907
|
-
agentName: resolved.agentName,
|
|
2908
|
-
projectPath,
|
|
2909
|
-
logLevels: resolved.logLevels,
|
|
2910
|
-
unhandledErrors: resolved.unhandledErrors,
|
|
2911
|
-
onReadyMessage: "[forwardConsole] 已连接微信开发者工具日志"
|
|
2912
|
-
});
|
|
2913
|
-
return true;
|
|
2914
|
-
} catch (error) {
|
|
2915
|
-
activeForwardConsoleSession = void 0;
|
|
2916
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
2917
|
-
logger_default.warn(`[forwardConsole] 启动失败,回退到普通 IDE 打开流程:${message}`);
|
|
2918
|
-
return false;
|
|
2919
|
-
}
|
|
2920
|
-
}
|
|
2921
|
-
/**
|
|
2922
2956
|
* @description 统一启动 DevTools 日志桥,并在 IDE 刚启动时做短暂重试。
|
|
2923
2957
|
*/
|
|
2924
2958
|
async function startForwardConsoleBridge(options) {
|
|
2925
2959
|
return await withForwardConsoleRetry(async () => {
|
|
2960
|
+
const color = options.color ?? true;
|
|
2926
2961
|
return await startForwardConsole({
|
|
2927
2962
|
projectPath: options.projectPath,
|
|
2928
2963
|
logLevels: options.logLevels,
|
|
2964
|
+
openedOnly: options.openedOnly,
|
|
2965
|
+
port: options.port,
|
|
2929
2966
|
unhandledErrors: options.unhandledErrors,
|
|
2930
2967
|
onReady: () => {
|
|
2931
2968
|
const suffix = options.agentName ? `(AI 终端:${options.agentName})` : "";
|
|
2932
2969
|
logger_default.info(`${options.onReadyMessage}${suffix}`);
|
|
2933
2970
|
},
|
|
2934
2971
|
onLog: (event) => {
|
|
2935
|
-
|
|
2936
|
-
if (event.level === "error") {
|
|
2937
|
-
logger_default.error(line);
|
|
2938
|
-
return;
|
|
2939
|
-
}
|
|
2940
|
-
if (event.level === "warn") {
|
|
2941
|
-
logger_default.warn(line);
|
|
2942
|
-
return;
|
|
2943
|
-
}
|
|
2944
|
-
if (event.level === "info") {
|
|
2945
|
-
logger_default.info(line);
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
logger_default.log(line);
|
|
2972
|
+
writeForwardConsoleLine(`${formatForwardConsolePrefix(event.level, color)} ${formatForwardConsoleMessage(event.level, event.message, color)}`);
|
|
2949
2973
|
}
|
|
2950
2974
|
});
|
|
2951
2975
|
});
|
|
2952
2976
|
}
|
|
2953
|
-
|
|
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
|
+
};
|
|
2954
2997
|
try {
|
|
2955
|
-
|
|
2956
|
-
return
|
|
2957
|
-
isAgent: result.isAgent,
|
|
2958
|
-
agentName: result.isAgent ? result.agent.name : void 0
|
|
2959
|
-
};
|
|
2960
|
-
} catch {
|
|
2961
|
-
return {
|
|
2962
|
-
isAgent: false,
|
|
2963
|
-
agentName: void 0
|
|
2964
|
-
};
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
async function withForwardConsoleRetry(runner) {
|
|
2968
|
-
let lastError;
|
|
2969
|
-
for (let attempt = 0; attempt <= FORWARD_CONSOLE_RETRY_TIMES; attempt++) try {
|
|
2970
|
-
return await runner();
|
|
2998
|
+
activeForwardConsoleSession = await startForwardConsoleBridge(bridgeOptions);
|
|
2999
|
+
return true;
|
|
2971
3000
|
} catch (error) {
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
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
|
+
}
|
|
2975
3020
|
}
|
|
2976
|
-
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
2977
|
-
}
|
|
2978
|
-
function isDevtoolsPortNotReadyError(error) {
|
|
2979
|
-
return error instanceof Error && error.message === "DEVTOOLS_HTTP_PORT_ERROR";
|
|
2980
|
-
}
|
|
2981
|
-
function sleep(ms) {
|
|
2982
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2983
3021
|
}
|
|
2984
3022
|
//#endregion
|
|
2985
3023
|
//#region src/cli/hmrProfileSummary.ts
|
|
@@ -3154,6 +3192,7 @@ async function runIdeCommand(action, root, options) {
|
|
|
3154
3192
|
if (latestHmrSummary) logger_default.info(latestHmrSummary.line);
|
|
3155
3193
|
const session = await startForwardConsoleBridge({
|
|
3156
3194
|
projectPath: resolved.projectPath,
|
|
3195
|
+
port: resolveProjectAutomatorPort(resolved.projectPath),
|
|
3157
3196
|
agentName: void 0,
|
|
3158
3197
|
logLevels: forwardConsoleOptions.logLevels,
|
|
3159
3198
|
unhandledErrors: forwardConsoleOptions.unhandledErrors,
|
|
@@ -3985,7 +4024,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
3985
4024
|
}
|
|
3986
4025
|
//#endregion
|
|
3987
4026
|
//#region package.json
|
|
3988
|
-
var version = "6.17.
|
|
4027
|
+
var version = "6.17.1";
|
|
3989
4028
|
//#endregion
|
|
3990
4029
|
//#region src/cli/devHotkeys/format.ts
|
|
3991
4030
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -4617,6 +4656,7 @@ function createServeMiniProgramDevActions(options) {
|
|
|
4617
4656
|
openIde: async (openOptions = {}) => {
|
|
4618
4657
|
if (!openOptions.forceOpen && await options.tryReuseForwardConsole?.()) return "已通过控制台转发复用当前开发者工具会话";
|
|
4619
4658
|
await options.openIde(projectPath, openOptions);
|
|
4659
|
+
await options.tryReuseForwardConsole?.();
|
|
4620
4660
|
return openOptions.forceReopen ? "已重新打开微信开发者工具项目" : "已打开或复用微信开发者工具项目";
|
|
4621
4661
|
},
|
|
4622
4662
|
rebuild: async () => {
|
|
@@ -4638,6 +4678,9 @@ function waitForServeShutdownSignal() {
|
|
|
4638
4678
|
}
|
|
4639
4679
|
//#endregion
|
|
4640
4680
|
//#region src/cli/commands/serve/index.ts
|
|
4681
|
+
function writePostOpenSeparator() {
|
|
4682
|
+
process.stdout?.write?.("\n");
|
|
4683
|
+
}
|
|
4641
4684
|
function registerServeCommand(cli) {
|
|
4642
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) => {
|
|
4643
4686
|
filterDuplicateOptions(options);
|
|
@@ -4699,11 +4742,14 @@ function registerServeCommand(cli) {
|
|
|
4699
4742
|
loginRetry: options.loginRetry,
|
|
4700
4743
|
loginRetryTimeout: options.loginRetryTimeout,
|
|
4701
4744
|
nonInteractive: options.nonInteractive,
|
|
4702
|
-
openRecovery:
|
|
4745
|
+
openRecovery: false,
|
|
4746
|
+
prepareAutomatorSession: true,
|
|
4703
4747
|
reuseOpenedProject: !openOptions?.forceReopen,
|
|
4748
|
+
skipPostOpenHealthCheck: true,
|
|
4704
4749
|
trustProject: options.trustProject,
|
|
4705
|
-
useAutomatorOpen:
|
|
4750
|
+
useAutomatorOpen: true
|
|
4706
4751
|
});
|
|
4752
|
+
writePostOpenSeparator();
|
|
4707
4753
|
},
|
|
4708
4754
|
projectPath: resolveIdeProjectRoot(configService.mpDistRoot, configService.cwd),
|
|
4709
4755
|
tryReuseForwardConsole: async () => {
|
|
@@ -4822,7 +4868,7 @@ function registerServeCommand(cli) {
|
|
|
4822
4868
|
}
|
|
4823
4869
|
//#endregion
|
|
4824
4870
|
//#region src/cli/error.ts
|
|
4825
|
-
const watchLimitErrorCodes = new Set(["EMFILE", "ENOSPC"]);
|
|
4871
|
+
const watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
|
|
4826
4872
|
const watchLimitMessagePattern = /EMFILE|ENOSPC|unable to start FSEvent stream/i;
|
|
4827
4873
|
function findWatchLimitErrorCode(error) {
|
|
4828
4874
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -4858,7 +4904,7 @@ function handleCLIError(error) {
|
|
|
4858
4904
|
}
|
|
4859
4905
|
//#endregion
|
|
4860
4906
|
//#region src/cli/ide.ts
|
|
4861
|
-
const WEAPP_VITE_NATIVE_COMMANDS = new Set([
|
|
4907
|
+
const WEAPP_VITE_NATIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
4862
4908
|
"dev",
|
|
4863
4909
|
"serve",
|
|
4864
4910
|
"build",
|
|
@@ -4898,7 +4944,7 @@ async function tryRunIdeCommand(argv) {
|
|
|
4898
4944
|
}
|
|
4899
4945
|
//#endregion
|
|
4900
4946
|
//#region src/cli/mcpAutoStart.ts
|
|
4901
|
-
const SKIP_COMMANDS = new Set([
|
|
4947
|
+
const SKIP_COMMANDS = /* @__PURE__ */ new Set([
|
|
4902
4948
|
"--help",
|
|
4903
4949
|
"--version",
|
|
4904
4950
|
"-h",
|
|
@@ -5001,7 +5047,7 @@ registerMcpCommand(cli);
|
|
|
5001
5047
|
registerServeCommand(cli);
|
|
5002
5048
|
cli.help();
|
|
5003
5049
|
cli.version(VERSION);
|
|
5004
|
-
const skipManagedTsconfigBootstrapCommands = new Set([
|
|
5050
|
+
const skipManagedTsconfigBootstrapCommands = /* @__PURE__ */ new Set([
|
|
5005
5051
|
"g",
|
|
5006
5052
|
"generate",
|
|
5007
5053
|
"ide",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-
|
|
3
|
+
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-CtueODLX.mjs";
|
|
4
4
|
import { createRequire, isBuiltin } from "node:module";
|
|
5
5
|
import path, { posix } from "pathe";
|
|
6
6
|
import path$1, { normalize, relative, win32 } from "node:path";
|
|
@@ -13,7 +13,7 @@ import { createDebug } from "obug";
|
|
|
13
13
|
import fs$1, { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
import { parse } from "vue/compiler-sfc";
|
|
15
15
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, generate, getVisitorKeys, parse as parse$2, parseJsLike, traverse } from "@weapp-vite/ast/babel";
|
|
16
|
-
import
|
|
16
|
+
import pm from "picomatch";
|
|
17
17
|
import { VUE_COMPONENT_TAG_RE, WE_VU_INTERNAL_REACTIVITY_MODULE_ID, WE_VU_INTERNAL_RUNTIME_MODULE_ID, WE_VU_INTERNAL_TEMPLATE_MODULE_ID, WE_VU_RUNTIME_APIS, buildClassStyleComputedCode, collectVueTemplateTags, compileJsxFile, compileVueFile, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, resolveClassStyleWxsLocation, stripJsonMacroCallsFromCode } from "wevu/compiler";
|
|
18
18
|
import process from "node:process";
|
|
19
19
|
import { parse as parse$1, stringify } from "comment-json";
|
|
@@ -1328,7 +1328,7 @@ function createMetadataHelpers(state) {
|
|
|
1328
1328
|
function collectAllComponentNames(options) {
|
|
1329
1329
|
const { collectResolverComponents, registry, componentMetadataMap, manifestCache } = options;
|
|
1330
1330
|
const resolverEntries = collectResolverComponents();
|
|
1331
|
-
const names = new Set([...Object.keys(resolverEntries)]);
|
|
1331
|
+
const names = /* @__PURE__ */ new Set([...Object.keys(resolverEntries)]);
|
|
1332
1332
|
for (const key of registry.keys()) names.add(key);
|
|
1333
1333
|
for (const key of componentMetadataMap.keys()) names.add(key);
|
|
1334
1334
|
for (const key of manifestCache.keys()) names.add(key);
|
|
@@ -1451,7 +1451,7 @@ function createHtmlCustomDataDefinition(componentNames, getMetadata, baseTags =
|
|
|
1451
1451
|
const metadata = getMetadata(name);
|
|
1452
1452
|
const combinedTypes = metadata.types;
|
|
1453
1453
|
const docs = metadata.docs;
|
|
1454
|
-
const attributeNames = new Set([...combinedTypes.keys(), ...docs.keys()]);
|
|
1454
|
+
const attributeNames = /* @__PURE__ */ new Set([...combinedTypes.keys(), ...docs.keys()]);
|
|
1455
1455
|
const attributes = Array.from(attributeNames).sort((a, b) => a.localeCompare(b)).map((propName) => {
|
|
1456
1456
|
const type = combinedTypes.get(propName);
|
|
1457
1457
|
const doc = docs.get(propName);
|
|
@@ -5368,7 +5368,7 @@ function createRegistryHelpers(state) {
|
|
|
5368
5368
|
}
|
|
5369
5369
|
const nextKey = globs.join("\0");
|
|
5370
5370
|
if (!state.autoImportState.matcher || state.autoImportState.matcherKey !== nextKey) {
|
|
5371
|
-
state.autoImportState.matcher =
|
|
5371
|
+
state.autoImportState.matcher = pm(globs, { windows: true });
|
|
5372
5372
|
state.autoImportState.matcherKey = nextKey;
|
|
5373
5373
|
}
|
|
5374
5374
|
return state.autoImportState.matcher;
|
|
@@ -5816,7 +5816,7 @@ function createRule(pattern) {
|
|
|
5816
5816
|
};
|
|
5817
5817
|
return {
|
|
5818
5818
|
pattern,
|
|
5819
|
-
match:
|
|
5819
|
+
match: pm(pattern, { dot: true })
|
|
5820
5820
|
};
|
|
5821
5821
|
}
|
|
5822
5822
|
function isDefaultAutoRouteInclude(include) {
|
|
@@ -5852,7 +5852,7 @@ function createAutoRoutesMatcher(include, subPackageRoots = []) {
|
|
|
5852
5852
|
}
|
|
5853
5853
|
function getRoots(absoluteSrcRoot) {
|
|
5854
5854
|
if (isDefault) {
|
|
5855
|
-
const roots = new Set([path.join(absoluteSrcRoot, "pages")]);
|
|
5855
|
+
const roots = /* @__PURE__ */ new Set([path.join(absoluteSrcRoot, "pages")]);
|
|
5856
5856
|
for (const root of normalizedSubPackageRoots) roots.add(path.join(absoluteSrcRoot, root));
|
|
5857
5857
|
return Array.from(roots, (root) => normalizePath$1(root));
|
|
5858
5858
|
}
|
|
@@ -5911,7 +5911,7 @@ function resolveWeappAutoRoutesConfig(config) {
|
|
|
5911
5911
|
//#region src/runtime/autoRoutesPlugin/generatedPaths.ts
|
|
5912
5912
|
const AUTO_ROUTES_CACHE_FILE$1 = ".weapp-vite/auto-routes.cache.json";
|
|
5913
5913
|
const TYPED_ROUTER_OUTPUT_FILE$1 = ".weapp-vite/typed-router.d.ts";
|
|
5914
|
-
const GENERATED_DIRECTORY_NAMES = new Set([
|
|
5914
|
+
const GENERATED_DIRECTORY_NAMES = /* @__PURE__ */ new Set([
|
|
5915
5915
|
".cache",
|
|
5916
5916
|
".rolldown-require",
|
|
5917
5917
|
".rolldown-require-cache",
|
|
@@ -5924,7 +5924,7 @@ const GENERATED_DIRECTORY_NAMES = new Set([
|
|
|
5924
5924
|
"miniprogram_npm",
|
|
5925
5925
|
"node_modules"
|
|
5926
5926
|
]);
|
|
5927
|
-
const GENERATED_FILE_NAMES = new Set([path.basename(AUTO_ROUTES_CACHE_FILE$1), path.basename(TYPED_ROUTER_OUTPUT_FILE$1)]);
|
|
5927
|
+
const GENERATED_FILE_NAMES = /* @__PURE__ */ new Set([path.basename(AUTO_ROUTES_CACHE_FILE$1), path.basename(TYPED_ROUTER_OUTPUT_FILE$1)]);
|
|
5928
5928
|
function stripQuery(candidate) {
|
|
5929
5929
|
return candidate.split("?")[0];
|
|
5930
5930
|
}
|
|
@@ -5973,7 +5973,7 @@ const TEMPLATE_EXTENSIONS = new Set(templateExtensions.map((ext) => `.${ext}`));
|
|
|
5973
5973
|
const VUE_EXTENSIONS = new Set(vueExtensions.map((ext) => `.${ext}`));
|
|
5974
5974
|
const STYLE_EXTENSIONS = new Set(supportedCssLangs.map((ext) => `.${ext}`));
|
|
5975
5975
|
const CONFIG_SUFFIXES = configExtensions.map((ext) => `.${ext}`);
|
|
5976
|
-
const SKIPPED_DIRECTORIES = new Set([
|
|
5976
|
+
const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
5977
5977
|
".git",
|
|
5978
5978
|
".husky",
|
|
5979
5979
|
".idea",
|
|
@@ -6374,7 +6374,7 @@ function applyBuildScopeToAutoRoutes(routes, scope) {
|
|
|
6374
6374
|
...subPackage,
|
|
6375
6375
|
root: normalizeRoot(subPackage.root)
|
|
6376
6376
|
}));
|
|
6377
|
-
const scopedEntries = new Set([...scope.includeMainPackage ? routes.pages : [], ...subPackages.flatMap((subPackage) => subPackage.pages.map((page) => `${subPackage.root}/${page}`))]);
|
|
6377
|
+
const scopedEntries = /* @__PURE__ */ new Set([...scope.includeMainPackage ? routes.pages : [], ...subPackages.flatMap((subPackage) => subPackage.pages.map((page) => `${subPackage.root}/${page}`))]);
|
|
6378
6378
|
return {
|
|
6379
6379
|
pages: scope.includeMainPackage ? routes.pages : [],
|
|
6380
6380
|
entries: routes.entries.filter((entry) => scopedEntries.has(entry)),
|
|
@@ -7105,7 +7105,7 @@ function createAutoRoutesServicePlugin(ctx) {
|
|
|
7105
7105
|
//#region src/plugins/utils/invalidateEntry/shared.ts
|
|
7106
7106
|
const watchedCssExts = new Set(supportedCssLangs.map((ext) => `.${ext}`));
|
|
7107
7107
|
const watchedTemplateExts = new Set(templateExtensions.map((ext) => `.${ext}`));
|
|
7108
|
-
const watchedScriptModuleExts = new Set([
|
|
7108
|
+
const watchedScriptModuleExts = /* @__PURE__ */ new Set([
|
|
7109
7109
|
".wxs",
|
|
7110
7110
|
".sjs",
|
|
7111
7111
|
".wxs.ts",
|
|
@@ -7120,7 +7120,7 @@ const sidecarSuffixes = [
|
|
|
7120
7120
|
...watchedTemplateExts,
|
|
7121
7121
|
...watchedScriptModuleExts
|
|
7122
7122
|
];
|
|
7123
|
-
const defaultIgnoredDirNames = new Set([
|
|
7123
|
+
const defaultIgnoredDirNames = /* @__PURE__ */ new Set([
|
|
7124
7124
|
"node_modules",
|
|
7125
7125
|
"miniprogram_npm",
|
|
7126
7126
|
".git",
|
|
@@ -7129,7 +7129,7 @@ const defaultIgnoredDirNames = new Set([
|
|
|
7129
7129
|
".turbo",
|
|
7130
7130
|
".weapp-vite"
|
|
7131
7131
|
]);
|
|
7132
|
-
const watchLimitErrorCodes = new Set(["EMFILE", "ENOSPC"]);
|
|
7132
|
+
const watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
|
|
7133
7133
|
function isSidecarFile(filePath) {
|
|
7134
7134
|
return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
|
|
7135
7135
|
}
|
|
@@ -7455,7 +7455,7 @@ function shouldRewriteWevuComponentType(value) {
|
|
|
7455
7455
|
}
|
|
7456
7456
|
//#endregion
|
|
7457
7457
|
//#region src/runtime/libDts/shared.ts
|
|
7458
|
-
const DTS_INPUT_EXTENSIONS = new Set([
|
|
7458
|
+
const DTS_INPUT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
7459
7459
|
".ts",
|
|
7460
7460
|
".tsx",
|
|
7461
7461
|
".mts",
|
|
@@ -7717,7 +7717,7 @@ async function generateVueDtsWithInternal(configService, vueEntries, dtsOptions)
|
|
|
7717
7717
|
...rawVueCompilerOptions ?? {}
|
|
7718
7718
|
};
|
|
7719
7719
|
const rewriteWevuComponentType = shouldRewriteWevuComponentType(vueCompilerOptions.lib);
|
|
7720
|
-
const rootNames = Array.from(new Set([...(parsedTs?.fileNames ?? []).map((file) => path.isAbsolute(file) ? file : path.resolve(configService.cwd, file)), ...vueEntries.map((entry) => entry.input)])).map(normalizePath);
|
|
7720
|
+
const rootNames = Array.from(/* @__PURE__ */ new Set([...(parsedTs?.fileNames ?? []).map((file) => path.isAbsolute(file) ? file : path.resolve(configService.cwd, file)), ...vueEntries.map((entry) => entry.input)])).map(normalizePath);
|
|
7721
7721
|
const host = ts.createCompilerHost(compilerOptions);
|
|
7722
7722
|
const program = proxyCreateProgram(ts, ts.createProgram, (tsInstance, options) => {
|
|
7723
7723
|
return { languagePlugins: [createVueLanguagePlugin(tsInstance, options.options, vueCompilerOptions, (id) => id)] };
|
|
@@ -7973,7 +7973,7 @@ function getDerivedScriptModuleTagNames() {
|
|
|
7973
7973
|
return MINI_PROGRAM_PLATFORM_ADAPTERS.flatMap((adapter) => Object.values(adapter.scriptModuleTagByExtension ?? {})).filter((value) => typeof value === "string" && value.length > 0);
|
|
7974
7974
|
}
|
|
7975
7975
|
function getScriptModuleTagNames() {
|
|
7976
|
-
return [
|
|
7976
|
+
return [.../* @__PURE__ */ new Set([...DEFAULT_SCRIPT_MODULE_TAG_NAMES, ...getDerivedScriptModuleTagNames()])];
|
|
7977
7977
|
}
|
|
7978
7978
|
function isScriptModuleTagName(tagName) {
|
|
7979
7979
|
return typeof tagName === "string" && getScriptModuleTagNames().includes(tagName);
|
|
@@ -8246,7 +8246,7 @@ async function normalizeMiniprogramPackageJsModules(pkgRoot, options) {
|
|
|
8246
8246
|
const WX_TEMPLATE_REFERENCE_RE = /\.wxml\b|\.wxss\b|\.wxs\b/;
|
|
8247
8247
|
const ESM_SYNTAX_RE = /\bimport\s|\bexport\s/;
|
|
8248
8248
|
const NULLISH_COALESCING_RE = /\?\?/;
|
|
8249
|
-
const ALIPAY_TEXT_FILE_EXTENSIONS = new Set([
|
|
8249
|
+
const ALIPAY_TEXT_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
8250
8250
|
".js",
|
|
8251
8251
|
".json",
|
|
8252
8252
|
".axml",
|
|
@@ -9689,7 +9689,7 @@ function collectEffectivePrefixes(importer, options, state) {
|
|
|
9689
9689
|
const result = {
|
|
9690
9690
|
prefixes: Array.from(aggregatedPrefixes),
|
|
9691
9691
|
hasRealMain,
|
|
9692
|
-
ignored: Array.from(new Set([...aggregatedIgnored, ...ignored]))
|
|
9692
|
+
ignored: Array.from(/* @__PURE__ */ new Set([...aggregatedIgnored, ...ignored]))
|
|
9693
9693
|
};
|
|
9694
9694
|
state.cache.set(importer, result);
|
|
9695
9695
|
state.stack.delete(importer);
|
|
@@ -10480,7 +10480,7 @@ function resolveNodeModulesSharedPath(cleanedAbsoluteId) {
|
|
|
10480
10480
|
}
|
|
10481
10481
|
function createStringOrRegExpMatcher(pattern) {
|
|
10482
10482
|
if (typeof pattern === "string") {
|
|
10483
|
-
const matcher =
|
|
10483
|
+
const matcher = pm(pattern, { dot: true });
|
|
10484
10484
|
return (value) => matcher(value);
|
|
10485
10485
|
}
|
|
10486
10486
|
if (isRegexp(pattern)) return (value) => {
|
|
@@ -10756,7 +10756,7 @@ function resolveAbsolutePath(ctx, candidate) {
|
|
|
10756
10756
|
function matchesAutoImportGlobs(ctx, candidate) {
|
|
10757
10757
|
const { autoImportService, configService } = ctx;
|
|
10758
10758
|
if (!autoImportService || !configService) return false;
|
|
10759
|
-
const targets = new Set([
|
|
10759
|
+
const targets = /* @__PURE__ */ new Set([
|
|
10760
10760
|
candidate,
|
|
10761
10761
|
configService.relativeCwd(candidate),
|
|
10762
10762
|
configService.relativeAbsoluteSrcRoot(candidate)
|
|
@@ -13667,7 +13667,7 @@ const ECMASCRIPT_SHORTHAND_YEAR_MAP = {
|
|
|
13667
13667
|
15: 2024
|
|
13668
13668
|
};
|
|
13669
13669
|
const MIN_SUPPORTED_ECMA_YEAR = 2015;
|
|
13670
|
-
const NON_CONCRETE_BUILD_TARGETS = new Set([
|
|
13670
|
+
const NON_CONCRETE_BUILD_TARGETS = /* @__PURE__ */ new Set([
|
|
13671
13671
|
"esnext",
|
|
13672
13672
|
"latest",
|
|
13673
13673
|
"modules"
|
|
@@ -15287,7 +15287,7 @@ function stripQueryAndHash(value) {
|
|
|
15287
15287
|
}
|
|
15288
15288
|
function createPathMatcher(patterns, options) {
|
|
15289
15289
|
if (!patterns.length) return () => false;
|
|
15290
|
-
return
|
|
15290
|
+
return pm(patterns.map((pattern) => normalizePath$1(pattern)), options);
|
|
15291
15291
|
}
|
|
15292
15292
|
function createAssetPathVariants(file, roots) {
|
|
15293
15293
|
const variants = [file];
|
|
@@ -16468,7 +16468,7 @@ function analyzePageLayoutSourceUncached(source, filename) {
|
|
|
16468
16468
|
if (setupLayout !== void 0) layoutMeta = setupLayout;
|
|
16469
16469
|
}
|
|
16470
16470
|
const dynamicSwitch = Boolean(scriptAst && hasSetPageLayoutCallInProgram(scriptAst) || scriptSetupAst && hasSetPageLayoutCallInProgram(scriptSetupAst));
|
|
16471
|
-
const dynamicPropKeys = dynamicSwitch ? Array.from(new Set([...scriptAst ? collectSetPageLayoutPropKeysFromProgram(scriptAst) : [], ...scriptSetupAst ? collectSetPageLayoutPropKeysFromProgram(scriptSetupAst) : []])) : [];
|
|
16471
|
+
const dynamicPropKeys = dynamicSwitch ? Array.from(/* @__PURE__ */ new Set([...scriptAst ? collectSetPageLayoutPropKeysFromProgram(scriptAst) : [], ...scriptSetupAst ? collectSetPageLayoutPropKeysFromProgram(scriptSetupAst) : []])) : [];
|
|
16472
16472
|
return {
|
|
16473
16473
|
layoutMeta,
|
|
16474
16474
|
dynamicSwitch,
|
|
@@ -16523,7 +16523,7 @@ function normalizePageRouteCandidates(filename, configService) {
|
|
|
16523
16523
|
next = next.replace(TRAILING_INDEX_RE, "");
|
|
16524
16524
|
return next === "" ? "/" : next;
|
|
16525
16525
|
})();
|
|
16526
|
-
return Array.from(new Set([shorthand, fullPath]));
|
|
16526
|
+
return Array.from(/* @__PURE__ */ new Set([shorthand, fullPath]));
|
|
16527
16527
|
}
|
|
16528
16528
|
function normalizeRouteRuleLayoutMeta(input) {
|
|
16529
16529
|
if (input === false) return { disabled: true };
|
|
@@ -16552,7 +16552,7 @@ function resolveRouteRuleLayoutMeta(filename, configService) {
|
|
|
16552
16552
|
const routeCandidates = normalizePageRouteCandidates(filename, configService);
|
|
16553
16553
|
let matched;
|
|
16554
16554
|
for (const [pattern, rule] of Object.entries(routeRules)) {
|
|
16555
|
-
if (!routeCandidates.some((candidate) =>
|
|
16555
|
+
if (!routeCandidates.some((candidate) => pm(pattern)(candidate))) continue;
|
|
16556
16556
|
const normalizedMeta = normalizeRouteRuleLayoutMeta(rule?.appLayout);
|
|
16557
16557
|
const patternSegments = pattern.split("/").filter(Boolean);
|
|
16558
16558
|
const wildcardMatches = pattern.match(ROUTE_RULE_GLOB_TOKEN_RE) ?? [];
|
|
@@ -16678,7 +16678,7 @@ async function resolvePageLayoutPlan(source, filename, configService) {
|
|
|
16678
16678
|
currentLayout,
|
|
16679
16679
|
dynamicSwitch,
|
|
16680
16680
|
layouts,
|
|
16681
|
-
dynamicPropKeys: dynamicSwitch ? Array.from(new Set([...Object.keys(currentLayout?.props ?? {}), ...analyzedSource?.dynamicPropKeys ?? []])) : []
|
|
16681
|
+
dynamicPropKeys: dynamicSwitch ? Array.from(/* @__PURE__ */ new Set([...Object.keys(currentLayout?.props ?? {}), ...analyzedSource?.dynamicPropKeys ?? []])) : []
|
|
16682
16682
|
};
|
|
16683
16683
|
}
|
|
16684
16684
|
function isLayoutFile(filename, configService) {
|
|
@@ -17459,12 +17459,12 @@ function createEntryLoader(options) {
|
|
|
17459
17459
|
const componentEntries = analyzeCommonJson(json);
|
|
17460
17460
|
const pendingAutoImportMap = ctx.runtimeState?.autoImport?.pendingEntriesByImporter;
|
|
17461
17461
|
const vueBaseName = vueEntryPath ? removeExtensionDeep(vueEntryPath) : void 0;
|
|
17462
|
-
const pendingAutoImportEntries = Array.from(new Set([...Array.from(pendingAutoImportMap?.get(baseName) ?? []), ...Array.from(vueBaseName ? pendingAutoImportMap?.get(vueBaseName) ?? [] : [])]));
|
|
17462
|
+
const pendingAutoImportEntries = Array.from(/* @__PURE__ */ new Set([...Array.from(pendingAutoImportMap?.get(baseName) ?? []), ...Array.from(vueBaseName ? pendingAutoImportMap?.get(vueBaseName) ?? [] : [])]));
|
|
17463
17463
|
if (pendingAutoImportEntries.length) {
|
|
17464
17464
|
pendingAutoImportMap?.delete(baseName);
|
|
17465
17465
|
if (vueBaseName) pendingAutoImportMap?.delete(vueBaseName);
|
|
17466
17466
|
}
|
|
17467
|
-
const mergedComponentEntries = Array.from(new Set([...componentEntries, ...pendingAutoImportEntries]));
|
|
17467
|
+
const mergedComponentEntries = Array.from(/* @__PURE__ */ new Set([...componentEntries, ...pendingAutoImportEntries]));
|
|
17468
17468
|
entries.push(...mergedComponentEntries);
|
|
17469
17469
|
for (const componentEntry of mergedComponentEntries) {
|
|
17470
17470
|
const normalizedComponentEntry = normalizeEntry(componentEntry, jsonPath);
|
|
@@ -18316,7 +18316,7 @@ function appendSharedChunkImporters(bundle, state, onlyEntryIds, previousImporte
|
|
|
18316
18316
|
const addSharedChunkModule = (moduleId, chunkId) => {
|
|
18317
18317
|
const current = state.hmrSharedChunksByModule.get(moduleId);
|
|
18318
18318
|
if (current) current.add(chunkId);
|
|
18319
|
-
else state.hmrSharedChunksByModule.set(moduleId, new Set([chunkId]));
|
|
18319
|
+
else state.hmrSharedChunksByModule.set(moduleId, /* @__PURE__ */ new Set([chunkId]));
|
|
18320
18320
|
};
|
|
18321
18321
|
const pruneSharedChunkModules = (chunkId, nextModuleIds) => {
|
|
18322
18322
|
if (!nextModuleIds.size) return;
|
|
@@ -18346,10 +18346,10 @@ function appendSharedChunkImporters(bundle, state, onlyEntryIds, previousImporte
|
|
|
18346
18346
|
const addSharedChunkImporter = (chunkId, entryId) => {
|
|
18347
18347
|
const current = state.hmrSharedChunkImporters.get(chunkId);
|
|
18348
18348
|
if (current) current.add(entryId);
|
|
18349
|
-
else state.hmrSharedChunkImporters.set(chunkId, new Set([entryId]));
|
|
18349
|
+
else state.hmrSharedChunkImporters.set(chunkId, /* @__PURE__ */ new Set([entryId]));
|
|
18350
18350
|
const currentChunkIds = state.hmrSharedChunksByEntry.get(entryId);
|
|
18351
18351
|
if (currentChunkIds) currentChunkIds.add(chunkId);
|
|
18352
|
-
else state.hmrSharedChunksByEntry.set(entryId, new Set([chunkId]));
|
|
18352
|
+
else state.hmrSharedChunksByEntry.set(entryId, /* @__PURE__ */ new Set([chunkId]));
|
|
18353
18353
|
};
|
|
18354
18354
|
const restoreMissingChunkImporters = (entryId, chunkId, visited) => {
|
|
18355
18355
|
if (visited.has(chunkId)) return;
|
|
@@ -18690,8 +18690,8 @@ function getStyleMatcher(entry) {
|
|
|
18690
18690
|
if (cached) return cached;
|
|
18691
18691
|
const includePatterns = entry.include?.length ? entry.include : ["**/*"];
|
|
18692
18692
|
const excludePatterns = entry.exclude?.length ? entry.exclude : void 0;
|
|
18693
|
-
const matcher = { include:
|
|
18694
|
-
if (excludePatterns?.length) matcher.exclude =
|
|
18693
|
+
const matcher = { include: pm(includePatterns, { dot: true }) };
|
|
18694
|
+
if (excludePatterns?.length) matcher.exclude = pm(excludePatterns, { dot: true });
|
|
18695
18695
|
styleMatcherCache.set(entry, matcher);
|
|
18696
18696
|
return matcher;
|
|
18697
18697
|
}
|
|
@@ -19021,7 +19021,7 @@ const REQUEST_RUNTIME_REQUEST_TARGETS = [
|
|
|
19021
19021
|
"AbortSignal",
|
|
19022
19022
|
"XMLHttpRequest"
|
|
19023
19023
|
];
|
|
19024
|
-
const REQUEST_RUNTIME_CORE_USAGE_TARGETS = new Set([
|
|
19024
|
+
const REQUEST_RUNTIME_CORE_USAGE_TARGETS = /* @__PURE__ */ new Set([
|
|
19025
19025
|
"fetch",
|
|
19026
19026
|
"Headers",
|
|
19027
19027
|
"Request",
|
|
@@ -19036,7 +19036,7 @@ const DEFAULT_REQUEST_GLOBAL_DEPENDENCIES = [
|
|
|
19036
19036
|
];
|
|
19037
19037
|
const DEFAULT_ABORT_GLOBAL_DEPENDENCIES = ["@tanstack/query-core", "@tanstack/vue-query"];
|
|
19038
19038
|
const WEBSOCKET_USAGE_HINT_RE = /\bwebsocket\b/iu;
|
|
19039
|
-
const REQUEST_GLOBAL_FREE_BINDING_TARGETS = new Set([
|
|
19039
|
+
const REQUEST_GLOBAL_FREE_BINDING_TARGETS = /* @__PURE__ */ new Set([
|
|
19040
19040
|
...FULL_REQUEST_GLOBAL_TARGETS,
|
|
19041
19041
|
"URL",
|
|
19042
19042
|
"URLSearchParams",
|
|
@@ -19085,7 +19085,7 @@ function resolveAppPreludeWebRuntimeConfig(appPrelude, warn) {
|
|
|
19085
19085
|
};
|
|
19086
19086
|
}
|
|
19087
19087
|
function hasMatchedDependency(packageJson, patterns) {
|
|
19088
|
-
return [
|
|
19088
|
+
return [.../* @__PURE__ */ new Set([
|
|
19089
19089
|
...Object.keys(packageJson?.dependencies ?? {}),
|
|
19090
19090
|
...Object.keys(packageJson?.devDependencies ?? {}),
|
|
19091
19091
|
...Object.keys(packageJson?.peerDependencies ?? {})
|
|
@@ -25935,7 +25935,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
25935
25935
|
const vueAppPath = await findVueEntry(appBasename);
|
|
25936
25936
|
let configFromVue;
|
|
25937
25937
|
if (!appConfigFile && vueAppPath) {
|
|
25938
|
-
const { extractConfigFromVue } = await import("./file-
|
|
25938
|
+
const { extractConfigFromVue } = await import("./file-C206GmuT.mjs");
|
|
25939
25939
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
25940
25940
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
25941
25941
|
}
|
|
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
84
84
|
}
|
|
85
85
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
86
86
|
try {
|
|
87
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
87
|
+
const { getCompilerContext } = await import("./getInstance-Dw7Y4EkD.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-BL8Dhhk6.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
|
|
3
3
|
import { t as defineConfig } from "./config-DRGcCi3h.mjs";
|
|
4
|
-
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-
|
|
4
|
+
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-Dg_HER2J.mjs";
|
|
5
5
|
import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-C3z9pDQB.mjs";
|
|
6
6
|
export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.17.
|
|
4
|
+
"version": "6.17.1",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"node": "^20.19.0 || >=22.12.0"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@babel/preset-env": "^8.0.
|
|
93
|
+
"@babel/preset-env": "^8.0.2",
|
|
94
94
|
"@babel/preset-typescript": "^8.0.1",
|
|
95
95
|
"@jridgewell/remapping": "^2.3.5",
|
|
96
96
|
"@vercel/detect-agent": "^1.2.3",
|
|
@@ -111,9 +111,9 @@
|
|
|
111
111
|
"pathe": "^2.0.3",
|
|
112
112
|
"picomatch": "^4.0.4",
|
|
113
113
|
"postcss": "^8.5.15",
|
|
114
|
-
"rolldown": "1.1.
|
|
114
|
+
"rolldown": "1.1.2",
|
|
115
115
|
"rolldown-plugin-dts": "0.26.0",
|
|
116
|
-
"semver": "^7.8.
|
|
116
|
+
"semver": "^7.8.5",
|
|
117
117
|
"typescript": "^6.0.3",
|
|
118
118
|
"vite": "8.0.16",
|
|
119
119
|
"vite-tsconfig-paths": "^6.1.1",
|
|
@@ -121,27 +121,27 @@
|
|
|
121
121
|
"vue-tsc": "^3.3.5",
|
|
122
122
|
"@weapp-core/constants": "0.1.12",
|
|
123
123
|
"@weapp-core/init": "6.0.10",
|
|
124
|
-
"@weapp-core/logger": "3.1.1",
|
|
125
124
|
"@weapp-core/schematics": "6.0.4",
|
|
126
125
|
"@weapp-core/shared": "3.0.4",
|
|
127
|
-
"@weapp-
|
|
128
|
-
"@weapp-vite/
|
|
129
|
-
"@weapp-vite/
|
|
130
|
-
"@
|
|
131
|
-
"@weapp-vite/
|
|
132
|
-
"@wevu/
|
|
133
|
-
"@wevu/web-apis": "1.2.23",
|
|
126
|
+
"@weapp-core/logger": "3.1.1",
|
|
127
|
+
"@weapp-vite/ast": "6.17.1",
|
|
128
|
+
"@weapp-vite/mcp": "1.4.6",
|
|
129
|
+
"@wevu/api": "0.2.10",
|
|
130
|
+
"@weapp-vite/miniprogram-automator": "1.2.5",
|
|
131
|
+
"@wevu/web-apis": "1.2.24",
|
|
134
132
|
"rolldown-require": "2.0.19",
|
|
135
133
|
"vite-plugin-performance": "2.0.1",
|
|
136
|
-
"weapp-ide-cli": "5.4.
|
|
137
|
-
"
|
|
134
|
+
"weapp-ide-cli": "5.4.8",
|
|
135
|
+
"@weapp-vite/volar": "2.1.0",
|
|
136
|
+
"wevu": "6.17.1",
|
|
137
|
+
"@weapp-vite/web": "1.3.32"
|
|
138
138
|
},
|
|
139
139
|
"publishConfig": {
|
|
140
140
|
"access": "public",
|
|
141
141
|
"registry": "https://registry.npmjs.org"
|
|
142
142
|
},
|
|
143
143
|
"devDependencies": {
|
|
144
|
-
"oxc-parser": "^0.
|
|
144
|
+
"oxc-parser": "^0.137.0",
|
|
145
145
|
"oxc-walker": "^1.0.0",
|
|
146
146
|
"tailwindcss": "^4.3.1",
|
|
147
147
|
"ts-morph": "^28.0.0"
|
package/dist/file-BrdaHBHs.mjs
DELETED