weapp-vite 6.20.3 → 6.20.5
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 +1 -1
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +135 -17
- package/dist/{config-C810aRQQ.d.mts → config-B1H1OqnR.d.mts} +10 -1
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-DavT7XIA.mjs → createContext-Ryo4nfbU.mjs} +627 -151
- package/dist/docs/README.md +1 -1
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/getting-started.md +13 -2
- package/dist/docs/testing.md +13 -0
- package/dist/docs/uni-app-component-libraries.md +4 -4
- package/dist/docs/weapp-config.md +21 -4
- package/dist/file-BjrPjC70.mjs +2 -0
- package/dist/{file-AiMZtyLe.mjs → file-CWbsTVPm.mjs} +1 -1
- package/dist/getInstance-CJAXp9db.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.d.mts +1 -1
- package/dist/{resolvers-w4g7O94W.mjs → resolvers-icNxkpcy.mjs} +2 -0
- package/dist/resolvers.mjs +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +18 -18
- package/dist/file-D0RifY1q.mjs +0 -2
- package/dist/getInstance-Czvi9cUi.mjs +0 -2
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ export default defineConfig({
|
|
|
47
47
|
})
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
未配置 `weapp.hmr.runtime` 时,`wv dev` 会在启动时读取 `project.private.config.json.setting.compileHotReLoad`:开启时使用 `stateful-experimental`,关闭或无法确认时使用 `classic`。启动日志会以 `HMR 模式` 和 `HMR 切换` 两行显示最终模式、选择来源和切换方法。显式设置 `classic` 或 `stateful-experimental`
|
|
50
|
+
未配置 `weapp.hmr.runtime` 时,`wv dev` 会在启动时读取 `project.private.config.json.setting.compileHotReLoad`:开启时使用 `stateful-experimental`,关闭或无法确认时使用 `classic`。启动日志会以 `HMR 模式` 和 `HMR 切换` 两行显示最终模式、选择来源和切换方法。显式设置 `classic` 或 `stateful-experimental` 会覆盖自动选择,但 Skyline 例外:微信开发者工具暂不支持 Skyline 热重载,首次编译检测到任意应用或页面配置使用 `renderer: 'skyline'` 时,会显示兼容性警告、自动将项目私有配置中的 `compileHotReLoad` 设为 `false`,并强制降级到 `classic`。切回 WebView 后可按需手动重新开启热重载。修改 DevTools 设置后请重启 `wv dev`;CSS、资源、配置和不兼容更新会自动回退完整构建与当前路由重载。
|
|
51
51
|
|
|
52
52
|
> 说明:CLI 同时支持完整命令 `weapp-vite` 与简写命令 `wv`,两者等价。下面的示例默认使用 `weapp-vite`,你也可以按个人习惯替换成 `wv`。
|
|
53
53
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TDesignResolver, i as UviewPlusResolver, n as WeuiResolver, r as VantResolver, t as WotUiResolver } from "../resolvers-
|
|
1
|
+
import { a as TDesignResolver, i as UviewPlusResolver, n as WeuiResolver, r as VantResolver, t as WotUiResolver } from "../resolvers-icNxkpcy.mjs";
|
|
2
2
|
export { TDesignResolver, UviewPlusResolver, VantResolver, WeuiResolver, WotUiResolver };
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-Ryo4nfbU.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
|
|
1
|
+
import { A as isPathInside, C as findPreloadRuleKey, D as createCjsConfigLoadError, E as parseCommentJson, O as getDefaultIdeProjectRoot, S as collectPreloadPages, T as loadViteConfigFile, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, k as shouldPassPlatformArgToIdeOpen, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as suggestPreloadRules, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-Ryo4nfbU.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, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-CWbsTVPm.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 fs from "node:fs";
|
|
@@ -8,6 +8,7 @@ import path, { posix } from "pathe";
|
|
|
8
8
|
import path$1 from "node:path";
|
|
9
9
|
import { defu } from "@weapp-core/shared";
|
|
10
10
|
import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
11
|
+
import { parse } from "vue/compiler-sfc";
|
|
11
12
|
import process from "node:process";
|
|
12
13
|
import fs$2, { mkdir, writeFile } from "node:fs/promises";
|
|
13
14
|
import { build, createServer } from "vite";
|
|
@@ -15,7 +16,7 @@ import os from "node:os";
|
|
|
15
16
|
import { execFile, spawn } from "node:child_process";
|
|
16
17
|
import { Buffer } from "node:buffer";
|
|
17
18
|
import { cac } from "cac";
|
|
18
|
-
import { RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, bootstrapWechatDevtoolsSettings, buildWechatIdeNpm, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectOpenedAutomator, createSharedInputSession, createWechatIdeLoginRequiredExitError, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, formatAutomatorLoginError, getConfig, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, isAutomatorLoginError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, parse, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, refreshWechatIdeTicket, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveProjectAutomatorPort, runRetryableCommand, runWechatIdeEngineBuild, runWithSuspendedSharedInput, setWechatIdeTicket, startForwardConsole, takeScreenshot } from "weapp-ide-cli";
|
|
19
|
+
import { RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, bootstrapWechatDevtoolsSettings, buildWechatIdeNpm, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectOpenedAutomator, createSharedInputSession, createWechatIdeLoginRequiredExitError, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, formatAutomatorLoginError, getConfig, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, isAutomatorLoginError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, parse as parse$1, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, refreshWechatIdeTicket, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveProjectAutomatorPort, runRetryableCommand, runWechatIdeEngineBuild, runWithSuspendedSharedInput, setWechatIdeTicket, startForwardConsole, takeScreenshot } from "weapp-ide-cli";
|
|
19
20
|
import { promisify } from "node:util";
|
|
20
21
|
import { brotliCompressSync, gzipSync } from "node:zlib";
|
|
21
22
|
import { resolveCommand } from "package-manager-detector/commands";
|
|
@@ -161,7 +162,7 @@ async function executeWechatIdeCliCommand(argv, options = {}) {
|
|
|
161
162
|
createCancelError: (error) => createWechatIdeLoginRequiredExitError(error, "cancelled"),
|
|
162
163
|
execute: async () => {
|
|
163
164
|
try {
|
|
164
|
-
await parse(argv);
|
|
165
|
+
await parse$1(argv);
|
|
165
166
|
return null;
|
|
166
167
|
} catch (error) {
|
|
167
168
|
if (isWechatIdeLoginRequiredExitError(error)) throw error;
|
|
@@ -1069,6 +1070,99 @@ async function analyzeHmrProfile(options) {
|
|
|
1069
1070
|
};
|
|
1070
1071
|
}
|
|
1071
1072
|
//#endregion
|
|
1073
|
+
//#region src/analyze/preload.ts
|
|
1074
|
+
async function readFileIfExists(filePath) {
|
|
1075
|
+
if (!filePath) return;
|
|
1076
|
+
try {
|
|
1077
|
+
return await fs$1.readFile(filePath, "utf8");
|
|
1078
|
+
} catch {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
function splitVueSource(source, filename) {
|
|
1083
|
+
try {
|
|
1084
|
+
const { descriptor } = parse(source, { filename });
|
|
1085
|
+
return {
|
|
1086
|
+
template: descriptor.template?.content,
|
|
1087
|
+
script: [descriptor.script?.content, descriptor.scriptSetup?.content].filter((content) => Boolean(content)).join("\n")
|
|
1088
|
+
};
|
|
1089
|
+
} catch {
|
|
1090
|
+
return {
|
|
1091
|
+
template: source,
|
|
1092
|
+
script: source
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
async function collectPageSources(ctx, route) {
|
|
1097
|
+
const base = path.resolve(ctx.configService.absoluteSrcRoot, route);
|
|
1098
|
+
const [templateEntry, scriptEntry, vueEntry] = await Promise.all([
|
|
1099
|
+
findTemplateEntry(base, ctx.configService.platform),
|
|
1100
|
+
findJsEntry(base),
|
|
1101
|
+
findVueEntry(base)
|
|
1102
|
+
]);
|
|
1103
|
+
if (vueEntry) {
|
|
1104
|
+
const source = await readFileIfExists(vueEntry);
|
|
1105
|
+
return source ? splitVueSource(source, vueEntry) : {};
|
|
1106
|
+
}
|
|
1107
|
+
const [template, script] = await Promise.all([readFileIfExists(templateEntry.path), readFileIfExists(scriptEntry.path)]);
|
|
1108
|
+
return {
|
|
1109
|
+
template,
|
|
1110
|
+
script
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
function aggregateSuggestions(result, configuredRules) {
|
|
1114
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
1115
|
+
for (const suggestion of result.suggestions) {
|
|
1116
|
+
const current = byPage.get(suggestion.page) ?? {
|
|
1117
|
+
page: suggestion.page,
|
|
1118
|
+
packages: [],
|
|
1119
|
+
evidence: [],
|
|
1120
|
+
alreadyConfigured: []
|
|
1121
|
+
};
|
|
1122
|
+
if (!current.packages.includes(suggestion.packageRoot)) current.packages.push(suggestion.packageRoot);
|
|
1123
|
+
current.evidence.push({
|
|
1124
|
+
target: suggestion.target,
|
|
1125
|
+
packageRoot: suggestion.packageRoot,
|
|
1126
|
+
source: suggestion.source
|
|
1127
|
+
});
|
|
1128
|
+
const configuredKey = findPreloadRuleKey(suggestion.page, configuredRules);
|
|
1129
|
+
const existingRule = configuredKey === void 0 ? void 0 : configuredRules[configuredKey];
|
|
1130
|
+
const existingPackages = existingRule && typeof existingRule === "object" && "packages" in existingRule ? existingRule.packages : void 0;
|
|
1131
|
+
if (Array.isArray(existingPackages) && existingPackages.includes(suggestion.packageRoot)) current.alreadyConfigured.push(suggestion.packageRoot);
|
|
1132
|
+
byPage.set(suggestion.page, current);
|
|
1133
|
+
}
|
|
1134
|
+
return [...byPage.values()].map((suggestion) => ({
|
|
1135
|
+
...suggestion,
|
|
1136
|
+
packages: suggestion.packages.sort(),
|
|
1137
|
+
alreadyConfigured: [...new Set(suggestion.alreadyConfigured)].sort(),
|
|
1138
|
+
evidence: suggestion.evidence.sort((left, right) => left.target.localeCompare(right.target))
|
|
1139
|
+
}));
|
|
1140
|
+
}
|
|
1141
|
+
async function analyzePreloadRules(ctx, now = /* @__PURE__ */ new Date()) {
|
|
1142
|
+
const appJson = (await ctx.scanService.loadAppEntry()).json;
|
|
1143
|
+
const pages = collectPreloadPages(appJson);
|
|
1144
|
+
const pageSources = /* @__PURE__ */ new Map();
|
|
1145
|
+
const sourceEntries = await Promise.all(pages.map(async (page) => [page.route, await collectPageSources(ctx, page.route)]));
|
|
1146
|
+
for (const [route, source] of sourceEntries) pageSources.set(route, source);
|
|
1147
|
+
const configuredRules = appJson.preloadRule && typeof appJson.preloadRule === "object" ? appJson.preloadRule : {};
|
|
1148
|
+
const suggestions = suggestPreloadRules(appJson, pageSources);
|
|
1149
|
+
return {
|
|
1150
|
+
runtime: "mini",
|
|
1151
|
+
kind: "preload",
|
|
1152
|
+
generatedAt: now.toISOString(),
|
|
1153
|
+
platform: ctx.configService.platform,
|
|
1154
|
+
pages: pages.map((page) => page.route),
|
|
1155
|
+
configuredRules,
|
|
1156
|
+
suggestions: aggregateSuggestions(suggestions, configuredRules),
|
|
1157
|
+
uncoveredPages: suggestions.uncovered,
|
|
1158
|
+
limitations: [
|
|
1159
|
+
"仅分析静态路由字面量;动态路由、后端配置和运行时守卫不会被推断。",
|
|
1160
|
+
"建议使用分包 root 作为 packages 值,正式启用前仍需结合业务访问频率和 2 MB 预下载额度复核。",
|
|
1161
|
+
"该命令只提供可审计建议,不会自动修改源码或覆盖手写的 app.json.preloadRule。"
|
|
1162
|
+
]
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1072
1166
|
//#region src/analyze/components/suggestions.ts
|
|
1073
1167
|
function createComponentSuggestion(usage) {
|
|
1074
1168
|
if (usage.componentPackage !== "__main__" || usage.crossPackageUsageCount === 0) return;
|
|
@@ -2583,6 +2677,18 @@ function printWebAnalysisSummary(result) {
|
|
|
2583
2677
|
logger_default.warn(`- 未支持范围:${result.unsupportedScopes.join(";")}`);
|
|
2584
2678
|
for (const limitation of result.limitations) logger_default.warn(`- 限制:${limitation}`);
|
|
2585
2679
|
}
|
|
2680
|
+
function printPreloadAnalysisSummary(result) {
|
|
2681
|
+
logger_default.success("preloadRule 静态分析完成");
|
|
2682
|
+
if (result.suggestions.length === 0) logger_default.info("未检测到可以证明的跨分包静态跳转。");
|
|
2683
|
+
for (const suggestion of result.suggestions) {
|
|
2684
|
+
const packages = suggestion.packages.join("、");
|
|
2685
|
+
const covered = suggestion.alreadyConfigured.length > 0 ? `,已配置:${suggestion.alreadyConfigured.join("、")}` : "";
|
|
2686
|
+
logger_default.info(`- ${suggestion.page} -> ${packages}${covered}`);
|
|
2687
|
+
for (const evidence of suggestion.evidence.slice(0, 5)) logger_default.info(` - ${evidence.source}:${evidence.target}`);
|
|
2688
|
+
}
|
|
2689
|
+
if (result.uncoveredPages.length > 0) logger_default.warn(`- 未找到可扫描源码的页面:${result.uncoveredPages.join("、")}`);
|
|
2690
|
+
for (const limitation of result.limitations) logger_default.warn(`- 限制:${limitation}`);
|
|
2691
|
+
}
|
|
2586
2692
|
async function writeAnalyzeResult(result, outputOption, configService, format = "json", previousResult) {
|
|
2587
2693
|
if (!outputOption) return;
|
|
2588
2694
|
const baseDir = configService.cwd;
|
|
@@ -2703,7 +2809,7 @@ function printHmrProfileAnalysisSummary(result, configService) {
|
|
|
2703
2809
|
}
|
|
2704
2810
|
}
|
|
2705
2811
|
function registerAnalyzeCommand(cli) {
|
|
2706
|
-
cli.command("analyze [root]", "analyze 两端包体与源码映射").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("--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) => {
|
|
2812
|
+
cli.command("analyze [root]", "analyze 两端包体与源码映射").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("--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) => {
|
|
2707
2813
|
filterDuplicateOptions(options);
|
|
2708
2814
|
const configFile = resolveConfigFile(options);
|
|
2709
2815
|
const outputJson = coerceBooleanOption(options.json);
|
|
@@ -2743,6 +2849,14 @@ function registerAnalyzeCommand(cli) {
|
|
|
2743
2849
|
} else printHmrProfileAnalysisSummary(hmrProfileResult, ctx.configService);
|
|
2744
2850
|
return;
|
|
2745
2851
|
}
|
|
2852
|
+
if (coerceBooleanOption(options.preload)) {
|
|
2853
|
+
if (targets.kind !== "miniprogram" || ctx.configService.platform !== "weapp") throw new Error("preloadRule 分析目前仅支持微信小程序平台。");
|
|
2854
|
+
const preloadResult = await analyzePreloadRules(ctx);
|
|
2855
|
+
const writtenPath = await writeAnalyzeResult(preloadResult, outputOption, ctx.configService);
|
|
2856
|
+
if (outputJson && !writtenPath) process.stdout.write(`${JSON.stringify(preloadResult, null, 2)}\n`);
|
|
2857
|
+
if (!outputJson && !writtenPath) printPreloadAnalysisSummary(preloadResult);
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2746
2860
|
if (getBackendForCapability(targets, "web", "analyze")) {
|
|
2747
2861
|
const webResult = createWebAnalyzeResult(ctx.configService, { platform: "web" });
|
|
2748
2862
|
const writtenPath = await writeAnalyzeResult(webResult, outputOption, ctx.configService);
|
|
@@ -3654,7 +3768,10 @@ async function readLatestHmrProfileSummary(options) {
|
|
|
3654
3768
|
//#region src/cli/commands/ide.ts
|
|
3655
3769
|
async function runIdeDoctor(projectPath, options) {
|
|
3656
3770
|
const resolvedCli = await resolveCliPath();
|
|
3657
|
-
const servicePort = await detectWechatDevtoolsServicePort().
|
|
3771
|
+
const servicePort = await detectWechatDevtoolsServicePort().then((result) => ({
|
|
3772
|
+
...result,
|
|
3773
|
+
error: void 0
|
|
3774
|
+
})).catch((error) => ({
|
|
3658
3775
|
servicePortEnabled: void 0,
|
|
3659
3776
|
servicePort: void 0,
|
|
3660
3777
|
error
|
|
@@ -3810,50 +3927,51 @@ async function runIdeCommand(action, root, options) {
|
|
|
3810
3927
|
cliPlatform: targets.rawPlatform
|
|
3811
3928
|
});
|
|
3812
3929
|
if (action !== "doctor" && resolved.platform !== "weapp") throw new Error("`weapp-vite ide logs` 当前仅支持微信小程序平台。");
|
|
3813
|
-
if (action !== "doctor" && !resolved.projectPath) throw new Error("无法解析微信开发者工具项目目录,请显式传入 root 或检查 project.config.json。");
|
|
3814
3930
|
if (action === "doctor") {
|
|
3815
3931
|
await runIdeDoctor(resolved.projectPath, options);
|
|
3816
3932
|
return;
|
|
3817
3933
|
}
|
|
3934
|
+
const projectPath = resolved.projectPath;
|
|
3935
|
+
if (!projectPath) throw new Error("无法解析微信开发者工具项目目录,请显式传入 root 或检查 project.config.json。");
|
|
3818
3936
|
if (action === "setup") {
|
|
3819
3937
|
const result = await bootstrapWechatDevtoolsSettings({
|
|
3820
|
-
projectPath
|
|
3938
|
+
projectPath,
|
|
3821
3939
|
trustProject: options.trustProject
|
|
3822
3940
|
});
|
|
3823
3941
|
logger_default.info(`已完成微信开发者工具配置预热:扫描实例 ${result.touchedInstanceCount} 个,检测服务端口配置 ${result.detectedSecurityCount} 处,写入项目信任 ${result.trustedProjectCount} 处。`);
|
|
3824
3942
|
return;
|
|
3825
3943
|
}
|
|
3826
|
-
if (options.open) await openIde(resolved.platform,
|
|
3944
|
+
if (options.open) await openIde(resolved.platform, projectPath, {
|
|
3827
3945
|
openRecovery: options.openRecovery,
|
|
3828
3946
|
trustProject: options.trustProject,
|
|
3829
3947
|
openStrategy: options.ideOpenStrategy
|
|
3830
3948
|
});
|
|
3831
3949
|
if (action === "info") {
|
|
3832
|
-
const result = await getWechatIdeToolInfo({ projectPath
|
|
3950
|
+
const result = await getWechatIdeToolInfo({ projectPath });
|
|
3833
3951
|
logger_default.info(formatIdeOutput(result, options));
|
|
3834
3952
|
return;
|
|
3835
3953
|
}
|
|
3836
3954
|
if (action === "test-accounts") {
|
|
3837
|
-
const result = await getWechatIdeTestAccounts({ projectPath
|
|
3955
|
+
const result = await getWechatIdeTestAccounts({ projectPath });
|
|
3838
3956
|
logger_default.info(formatIdeOutput(result, options));
|
|
3839
3957
|
return;
|
|
3840
3958
|
}
|
|
3841
3959
|
if (action === "ticket") {
|
|
3842
|
-
const result = await getWechatIdeTicket({ projectPath
|
|
3960
|
+
const result = await getWechatIdeTicket({ projectPath });
|
|
3843
3961
|
logger_default.info(formatIdeOutput(result, options));
|
|
3844
3962
|
return;
|
|
3845
3963
|
}
|
|
3846
3964
|
if (action === "ticket:set") {
|
|
3847
3965
|
if (!options.ticket) throw new Error("`weapp-vite ide ticket:set` 需要提供 --ticket。");
|
|
3848
3966
|
await setWechatIdeTicket({
|
|
3849
|
-
projectPath
|
|
3967
|
+
projectPath,
|
|
3850
3968
|
ticket: options.ticket
|
|
3851
3969
|
});
|
|
3852
3970
|
logger_default.info(`已设置微信开发者工具 ticket:${options.ticket}`);
|
|
3853
3971
|
return;
|
|
3854
3972
|
}
|
|
3855
3973
|
if (action === "ticket:refresh") {
|
|
3856
|
-
await refreshWechatIdeTicket({ projectPath
|
|
3974
|
+
await refreshWechatIdeTicket({ projectPath });
|
|
3857
3975
|
logger_default.info("已刷新微信开发者工具 ticket。");
|
|
3858
3976
|
return;
|
|
3859
3977
|
}
|
|
@@ -3871,8 +3989,8 @@ async function runIdeCommand(action, root, options) {
|
|
|
3871
3989
|
});
|
|
3872
3990
|
if (latestHmrSummary) logger_default.info(latestHmrSummary.line);
|
|
3873
3991
|
const session = await startForwardConsoleBridge({
|
|
3874
|
-
projectPath
|
|
3875
|
-
port: resolveProjectAutomatorPort(
|
|
3992
|
+
projectPath,
|
|
3993
|
+
port: resolveProjectAutomatorPort(projectPath),
|
|
3876
3994
|
agentName: void 0,
|
|
3877
3995
|
logLevels: forwardConsoleOptions.logLevels,
|
|
3878
3996
|
unhandledErrors: forwardConsoleOptions.unhandledErrors,
|
|
@@ -4727,7 +4845,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
4727
4845
|
}
|
|
4728
4846
|
//#endregion
|
|
4729
4847
|
//#region package.json
|
|
4730
|
-
var version = "6.20.
|
|
4848
|
+
var version = "6.20.5";
|
|
4731
4849
|
//#endregion
|
|
4732
4850
|
//#region src/cli/devHotkeys/format.ts
|
|
4733
4851
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -656,8 +656,17 @@ interface WeappReactConfig {
|
|
|
656
656
|
renderMode?: 'auto' | 'dynamic' | 'static';
|
|
657
657
|
devWarnings?: boolean;
|
|
658
658
|
}
|
|
659
|
+
type WeappPreloadNetwork = 'all' | 'wifi';
|
|
660
|
+
/**
|
|
661
|
+
* @description 页面进入后的分包预下载规则。
|
|
662
|
+
*/
|
|
663
|
+
interface WeappPreloadRule {
|
|
664
|
+
packages: string[];
|
|
665
|
+
network?: WeappPreloadNetwork;
|
|
666
|
+
}
|
|
659
667
|
interface WeappRouteRule {
|
|
660
668
|
appLayout?: PageLayoutMeta;
|
|
669
|
+
preload?: WeappPreloadRule;
|
|
661
670
|
}
|
|
662
671
|
type WeappRouteRules = Record<string, WeappRouteRule>;
|
|
663
672
|
//#endregion
|
|
@@ -2033,4 +2042,4 @@ declare module 'vite' {
|
|
|
2033
2042
|
*/
|
|
2034
2043
|
declare function defineConfig<T extends UserConfigExport>(config: T): T;
|
|
2035
2044
|
//#endregion
|
|
2036
|
-
export { WeappAnalyzeBudgetConfig as $,
|
|
2045
|
+
export { WeappAnalyzeBudgetConfig as $, WEB_PLATFORM_ALIASES as $n, GenerateFilenamesOptions as $t, Ref as A, SubPackageStyleEntry as An, WeappReactCompilerConfig as At, BindingErrorLike as B, WeappManagedNodeTsconfigConfig as Bn, WeappWevuConfig as Bt, LoadConfigOptions as C, SharedChunkDynamicImports as Cn, WeappInjectWeapiConfig as Ct, MethodDefinitions$1 as D, SubPackage as Dn, WeappNpmConfig as Dt, InlineConfig$1 as E, SharedChunkStrategy as En, WeappMcpConfig as Et, RolldownPlugin as F, WeappLibEntryContext as Fn, WeappSubPackageConfig as Ft, EntryJsonFragment as G, WEAPP_VITE_HOST_NAME as Gn, BuildNpmPackageMeta as Gt, BaseEntry as H, WeappManagedSharedTsconfigConfig as Hn, Alias as Ht, RolldownPluginOption as I, WeappLibFileName as In, WeappUniAppConfig as It, ScanComponentItem as J, createWeappViteHostMeta as Jn, CopyOptions as Jt, PageEntry as K, WeappViteHostMeta as Kn, ChunksConfig as Kt, RolldownWatchOptions as L, WeappLibInternalDtsOptions as Ln, WeappVueConfig as Lt, RolldownBuild as M, WeappLibComponentJson as Mn, WeappRequestRuntimeConfig as Mt, RolldownOptions as N, WeappLibConfig as Nn, WeappRouteRule as Nt, Plugin$1 as O, SubPackageStyleConfigEntry as On, WeappPreloadNetwork as Ot, RolldownOutput$1 as P, WeappLibDtsOptions as Pn, WeappRouteRules as Pt, UserConfig$2 as Q, ResolvedWeappViteTarget as Qn, GenerateFileType as Qt, RolldownWatcher$1 as R, WeappLibVueTscOptions as Rn, WeappVueTemplateConfig as Rt, CompilerContext as S, ResolvedAlias as Sn, WeappInjectRequestGlobalsTarget as St, ConfigEnv$1 as T, SharedChunkOverride as Tn, WeappInjectWebRuntimeGlobalsTarget as Tt, ComponentEntry as U, WeappManagedTypeScriptConfig as Un, AliasOptions as Ut, AppEntry as V, WeappManagedServerTsconfigConfig as Vn, WeappWorkerConfig as Vt, Entry as W, WeappWebConfig as Wn, AlipayNpmMode as Wt, ProjectConfig as X, resolveWeappViteHostMeta as Xn, GenerateDirsOptions as Xt, WxmlDep as Y, isWeappViteHost as Yn, DeprecatedInlineDynamicImports as Yt, SubPackageMetaValue as Z, ResolveWeappViteTargetOptions as Zn, GenerateExtensionsOptions as Zt, definePageJson as _, NpmDependencyPattern as _n, WeappAutoRoutesIncludePattern as _t, UserConfigFnNoEnvPlain as a, GenerateTemplateFileSource as an, WebPlatform as ar, WeappViteConfig as at, ChangeEvent as b, NpmStrategy as bn, WeappHmrConfig as bt, UserConfigFnPromise as c, GenerateTemplatesConfig as cn, isWebPlatform as cr, EnhanceOptions as ct, Component$1 as d, JsonMergeContext as dn, MultiPlatformConfig as dt, GenerateOptions as en, WeappVitePlatform as er, WeappAnalyzeConfig as et, Page$1 as f, JsonMergeFunction as fn, ScanWxmlOptions as ft, defineComponentJson as g, NpmBuildOptions as gn, WeappAutoRoutesInclude as gt, defineAppJson as h, MpPlatform$1 as hn, WeappAutoRoutesConfig as ht, UserConfigFnNoEnv as i, GenerateTemplateFactory as in, WeappViteTargetKind as ir, WeappForwardConsoleLogLevel as it, ResolvedConfig as j, SubPackageStyleScope as jn, WeappReactConfig as jt, PluginOption as k, SubPackageStyleConfigObject as kn, WeappPreloadRule as kt, defineConfig as l, JsFormat as ln, resolveWeappViteTarget as lr, EnhanceWxmlOptions as lt, Theme$1 as m, JsonMergeStrategy as mn, WeappAppPreludeMode as mt, UserConfigExport as n, GenerateTemplateContext as nn, WeappViteTargetDescriptor as nr, WeappDebugConfig as nt, UserConfigFnObject as o, GenerateTemplateInlineSource as on, getSupportedWeappVitePlatforms as or, AutoImportComponents as ot, Sitemap$1 as p, JsonMergeStage as pn, WeappAppPreludeConfig as pt, ComponentsMap as q, applyWeappViteHostMeta as qn, CopyGlobs as qt, UserConfigFn as r, GenerateTemplateEntry as rn, WeappViteTargetInput as rr, WeappForwardConsoleConfig as rt, UserConfigFnObjectPlain as s, GenerateTemplateScope as sn, getSupportedWeappViteTargetDescriptors as sr, AutoImportComponentsOption as st, UserConfig$1 as t, GenerateTemplate as tn, WeappViteRuntime as tr, WeappAnalyzeHistoryConfig as tt, App$1 as u, JsonConfig as un, HandleWxmlOptions as ut, defineSitemapJson as v, NpmMainPackageConfig as vn, WeappBuildScopeConfig as vt, ComputedDefinitions$1 as w, SharedChunkMode as wn, WeappInjectWebRuntimeGlobalsConfig as wt, WeappVitePluginApi as x, NpmSubPackageConfig as xn, WeappInjectRequestGlobalsConfig as xt, defineThemeJson as y, NpmPluginPackageConfig as yn, WeappBuildScopeObjectConfig as yt, ViteDevServer$1 as z, WeappManagedAppTsconfigConfig as zn, WeappWebRuntimeConfig as zt };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gn as WEAPP_VITE_HOST_NAME, Jn as createWeappViteHostMeta, Kn as WeappViteHostMeta, Xn as resolveWeappViteHostMeta, Yn as isWeappViteHost, _ 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, qn as applyWeappViteHostMeta, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, tr as WeappViteRuntime, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-B1H1OqnR.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 };
|