weapp-vite 6.11.4 → 6.11.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 +34 -0
- package/dist/auto-routes.mjs +1 -3
- package/dist/cli.mjs +336 -22
- package/dist/{config-DFy0eHs2.d.mts → config-DHz3M7If.d.mts} +25 -7
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-D2PataOA.mjs → createContext-BzGZK60x.mjs} +66 -20
- package/dist/{file-hsZ3VxaT.mjs → file-CHBdQW3o.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -3
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -85,6 +85,39 @@ function handleClick() {
|
|
|
85
85
|
- Vite 插件识别 weapp-vite 宿主:https://vite.icebreaker.top/guide/vite-plugin-host
|
|
86
86
|
- MCP 集成使用指南:[docs/mcp.md](./docs/mcp.md)
|
|
87
87
|
|
|
88
|
+
## DevTools 日志桥接
|
|
89
|
+
|
|
90
|
+
`weapp-vite` 现在支持把微信开发者工具里的小程序 `console` 输出桥接到当前终端。
|
|
91
|
+
|
|
92
|
+
默认行为:
|
|
93
|
+
|
|
94
|
+
- `weapp.forwardConsole` 默认是 `enabled: 'auto'`
|
|
95
|
+
- 当检测到当前运行环境是 AI 终端时,`weapp-vite dev --open` 会自动尝试附加日志桥
|
|
96
|
+
- 也可以手动进入持续监听模式
|
|
97
|
+
|
|
98
|
+
配置示例:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
102
|
+
|
|
103
|
+
export default defineConfig({
|
|
104
|
+
weapp: {
|
|
105
|
+
forwardConsole: {
|
|
106
|
+
enabled: 'auto',
|
|
107
|
+
logLevels: ['log', 'info', 'warn', 'error'],
|
|
108
|
+
unhandledErrors: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
手动启动持续监听:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
weapp-vite ide logs
|
|
118
|
+
weapp-vite ide logs --open
|
|
119
|
+
```
|
|
120
|
+
|
|
88
121
|
## CLI 中调用 weapp-ide-cli
|
|
89
122
|
|
|
90
123
|
`weapp-vite` 内置了对 `weapp-ide-cli` 的透传能力,除了 `dev/build/open/init/generate/analyze/npm` 等原生命令外,其它 IDE 相关命令都可以直接调用:
|
|
@@ -101,6 +134,7 @@ weapp-vite navigate pages/index/index --project ./dist/build/mp-weixin
|
|
|
101
134
|
```sh
|
|
102
135
|
weapp-vite ide preview --project ./dist/build/mp-weixin
|
|
103
136
|
weapp-vite ide config show
|
|
137
|
+
weapp-vite ide logs --open
|
|
104
138
|
```
|
|
105
139
|
|
|
106
140
|
## CLI 启动 MCP
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { i as getCompilerContext } from "./createContext-
|
|
2
|
-
import "./logger-gutcwWKE.mjs";
|
|
3
|
-
import "./file-hsZ3VxaT.mjs";
|
|
1
|
+
import { i as getCompilerContext } from "./createContext-BzGZK60x.mjs";
|
|
4
2
|
//#region src/auto-routes.ts
|
|
5
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
6
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as normalizeMiniPlatform, d as SHARED_CHUNK_VIRTUAL_PREFIX, f as resolveWeappConfigFile, g as isPathInside, h as createCjsConfigLoadError, l as resolveMiniPlatform, m as getProjectConfigFileName, n as syncProjectSupportFiles, o as formatBytes, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as DEFAULT_MP_PLATFORM, t as createCompilerContext, u as createSharedBuildConfig } from "./createContext-
|
|
1
|
+
import { c as normalizeMiniPlatform, d as SHARED_CHUNK_VIRTUAL_PREFIX, f as resolveWeappConfigFile, g as isPathInside, h as createCjsConfigLoadError, l as resolveMiniPlatform, m as getProjectConfigFileName, n as syncProjectSupportFiles, o as formatBytes, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as DEFAULT_MP_PLATFORM, t as createCompilerContext, u as createSharedBuildConfig } from "./createContext-BzGZK60x.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
|
|
3
|
-
import { f as VERSION } from "./file-
|
|
3
|
+
import { f as VERSION } from "./file-CHBdQW3o.mjs";
|
|
4
4
|
import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
|
|
5
5
|
import { defu } from "@weapp-core/shared";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -8,12 +8,15 @@ import fs from "fs-extra";
|
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { build, createServer, loadConfigFromFile } from "vite";
|
|
10
10
|
import { getPackageInfoSync } from "local-pkg";
|
|
11
|
+
import { execFile } from "node:child_process";
|
|
11
12
|
import { Buffer } from "node:buffer";
|
|
12
13
|
import fs$1 from "node:fs";
|
|
13
14
|
import { cac } from "cac";
|
|
14
15
|
import { resolveCommand } from "package-manager-detector/commands";
|
|
15
|
-
import {
|
|
16
|
+
import { promisify } from "node:util";
|
|
17
|
+
import { formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getConfig, isWeappIdeTopLevelCommand, isWechatIdeLoginRequiredError, parse, startForwardConsole, waitForRetryKeypress } from "weapp-ide-cli";
|
|
16
18
|
import { generateJs, generateJson, generateWxml, generateWxss } from "@weapp-core/schematics";
|
|
19
|
+
import { determineAgent } from "@vercel/detect-agent";
|
|
17
20
|
import { initConfig } from "@weapp-core/init";
|
|
18
21
|
//#region src/analyze/subpackages/classifier.ts
|
|
19
22
|
const VIRTUAL_MODULE_INDICATOR = "\0";
|
|
@@ -759,12 +762,71 @@ function logBuildPackageSizeReport(options) {
|
|
|
759
762
|
}
|
|
760
763
|
//#endregion
|
|
761
764
|
//#region src/cli/openIde.ts
|
|
765
|
+
const execFileAsync = promisify(execFile);
|
|
762
766
|
async function openIde(platform, projectPath) {
|
|
763
767
|
const argv = ["open", "-p"];
|
|
764
768
|
if (projectPath) argv.push(projectPath);
|
|
765
769
|
if (platform === "alipay") argv.push("--platform", platform);
|
|
766
770
|
await runWechatIdeOpenWithRetry(argv);
|
|
767
771
|
}
|
|
772
|
+
async function closeIde() {
|
|
773
|
+
const config = await getConfig();
|
|
774
|
+
const cliPath = config.cliPath?.trim() ? config.cliPath : null;
|
|
775
|
+
try {
|
|
776
|
+
await parse(["close"]);
|
|
777
|
+
return true;
|
|
778
|
+
} catch (error) {
|
|
779
|
+
if (isWechatIdeLoginRequiredError(error)) try {
|
|
780
|
+
await runWechatIdeOpenWithRetry(["close"]);
|
|
781
|
+
return true;
|
|
782
|
+
} catch (retryError) {
|
|
783
|
+
logger_default.error(retryError);
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
logger_default.warn("微信开发者工具 CLI close 执行失败,尝试回退为系统级关闭。");
|
|
787
|
+
logger_default.error(error);
|
|
788
|
+
}
|
|
789
|
+
if (await closeIdeByAppleScript()) {
|
|
790
|
+
logger_default.info("已回退为系统级关闭微信开发者工具。");
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
if (await closeIdeByProcessKill(cliPath)) {
|
|
794
|
+
logger_default.info("已回退为进程级关闭微信开发者工具。");
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* @description 解析 IDE 相关命令所需的平台、项目目录与配置上下文。
|
|
802
|
+
*/
|
|
803
|
+
async function resolveIdeCommandContext(options) {
|
|
804
|
+
const cwd = options.cwd ?? process.cwd();
|
|
805
|
+
let platform = options.platform;
|
|
806
|
+
let projectPath = options.projectPath;
|
|
807
|
+
if (!platform || !projectPath) try {
|
|
808
|
+
const ctx = await createCompilerContext({
|
|
809
|
+
cwd,
|
|
810
|
+
mode: options.mode ?? "development",
|
|
811
|
+
configFile: options.configFile,
|
|
812
|
+
inlineConfig: createInlineConfig(platform),
|
|
813
|
+
cliPlatform: options.cliPlatform
|
|
814
|
+
});
|
|
815
|
+
platform ??= ctx.configService.platform;
|
|
816
|
+
if (!projectPath) projectPath = resolveIdeProjectRoot(ctx.configService.mpDistRoot, ctx.configService.cwd);
|
|
817
|
+
return {
|
|
818
|
+
platform,
|
|
819
|
+
projectPath,
|
|
820
|
+
weappViteConfig: ctx.configService.weappViteConfig,
|
|
821
|
+
mpDistRoot: ctx.configService.mpDistRoot
|
|
822
|
+
};
|
|
823
|
+
} catch {}
|
|
824
|
+
if (!projectPath && platform === "alipay") projectPath = resolveIdeProjectRoot("dist/alipay/dist", cwd);
|
|
825
|
+
return {
|
|
826
|
+
platform,
|
|
827
|
+
projectPath
|
|
828
|
+
};
|
|
829
|
+
}
|
|
768
830
|
/**
|
|
769
831
|
* @description 执行 IDE 打开流程,并在登录失效时允许按键重试。
|
|
770
832
|
*/
|
|
@@ -789,15 +851,41 @@ async function runWechatIdeOpenWithRetry(argv) {
|
|
|
789
851
|
logger_default.info(colors.bold(colors.green("正在重试连接微信开发者工具...")));
|
|
790
852
|
}
|
|
791
853
|
}
|
|
854
|
+
async function closeIdeByAppleScript() {
|
|
855
|
+
if (process.platform !== "darwin") return false;
|
|
856
|
+
const appName = process.env.WEAPP_DEVTOOLS_APP_NAME || "wechatwebdevtools";
|
|
857
|
+
try {
|
|
858
|
+
await execFileAsync("osascript", ["-e", `tell application "${appName}" to quit`]);
|
|
859
|
+
return true;
|
|
860
|
+
} catch {
|
|
861
|
+
return false;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
async function closeIdeByProcessKill(cliPath) {
|
|
865
|
+
if (!cliPath) return false;
|
|
866
|
+
const appContentsRoot = cliPath.includes(".app/") ? cliPath.slice(0, cliPath.indexOf(".app/") + 4) : path.dirname(path.dirname(cliPath));
|
|
867
|
+
try {
|
|
868
|
+
await execFileAsync("pkill", ["-f", appContentsRoot]);
|
|
869
|
+
return true;
|
|
870
|
+
} catch {
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
792
874
|
/**
|
|
793
875
|
* @description 根据 mpDistRoot 推导 IDE 项目目录(目录内应包含 project/mini 配置)
|
|
794
876
|
*/
|
|
795
877
|
function resolveIdeProjectPath(mpDistRoot) {
|
|
796
878
|
if (!mpDistRoot || !mpDistRoot.trim()) return;
|
|
797
879
|
const parent = path.dirname(mpDistRoot);
|
|
798
|
-
if (!parent || parent === ".") return;
|
|
880
|
+
if (!parent || parent === "." || parent === "/") return;
|
|
799
881
|
return parent;
|
|
800
882
|
}
|
|
883
|
+
/**
|
|
884
|
+
* @description 结合 mpDistRoot 与配置根目录解析最终 IDE 项目目录。
|
|
885
|
+
*/
|
|
886
|
+
function resolveIdeProjectRoot(mpDistRoot, cwd) {
|
|
887
|
+
return resolveIdeProjectPath(mpDistRoot) ?? cwd;
|
|
888
|
+
}
|
|
801
889
|
//#endregion
|
|
802
890
|
//#region src/cli/commands/build.ts
|
|
803
891
|
function registerBuildCommand(cli) {
|
|
@@ -858,6 +946,13 @@ function isSassEmbeddedChild(handle) {
|
|
|
858
946
|
return Boolean(handle && typeof handle === "object" && "kill" in handle && "spawnfile" in handle && typeof handle.spawnfile === "string" && handle.spawnfile?.includes("sass-embedded"));
|
|
859
947
|
}
|
|
860
948
|
//#endregion
|
|
949
|
+
//#region src/cli/commands/close.ts
|
|
950
|
+
function registerCloseCommand(cli) {
|
|
951
|
+
cli.command("close", "close Wechat DevTools").action(async () => {
|
|
952
|
+
if (!await closeIde()) throw new Error("关闭微信开发者工具失败。");
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
861
956
|
//#region src/schematics.ts
|
|
862
957
|
function composePath(outDir, filename) {
|
|
863
958
|
return `${outDir}${outDir ? "/" : ""}${filename}`;
|
|
@@ -1026,6 +1121,213 @@ function registerGenerateCommand(cli) {
|
|
|
1026
1121
|
});
|
|
1027
1122
|
}
|
|
1028
1123
|
//#endregion
|
|
1124
|
+
//#region src/cli/forwardConsole.ts
|
|
1125
|
+
const DEFAULT_FORWARD_CONSOLE_LEVELS = [
|
|
1126
|
+
"log",
|
|
1127
|
+
"info",
|
|
1128
|
+
"warn",
|
|
1129
|
+
"error"
|
|
1130
|
+
];
|
|
1131
|
+
let activeForwardConsoleSession;
|
|
1132
|
+
const FORWARD_CONSOLE_RETRY_DELAY_MS = 1e3;
|
|
1133
|
+
const FORWARD_CONSOLE_RETRY_TIMES = 5;
|
|
1134
|
+
/**
|
|
1135
|
+
* @description 解析 forwardConsole 配置,并在 auto 模式下检测 AI 终端。
|
|
1136
|
+
*/
|
|
1137
|
+
async function resolveForwardConsoleOptions(config) {
|
|
1138
|
+
const rawConfig = config?.forwardConsole;
|
|
1139
|
+
const defaults = {
|
|
1140
|
+
logLevels: DEFAULT_FORWARD_CONSOLE_LEVELS,
|
|
1141
|
+
unhandledErrors: true
|
|
1142
|
+
};
|
|
1143
|
+
if (rawConfig === false) return {
|
|
1144
|
+
enabled: false,
|
|
1145
|
+
...defaults
|
|
1146
|
+
};
|
|
1147
|
+
if (rawConfig === true) return {
|
|
1148
|
+
enabled: true,
|
|
1149
|
+
...defaults
|
|
1150
|
+
};
|
|
1151
|
+
const normalizedConfig = rawConfig ?? {};
|
|
1152
|
+
const enabledMode = normalizedConfig.enabled ?? "auto";
|
|
1153
|
+
const logLevels = normalizedConfig.logLevels?.length ? normalizedConfig.logLevels : defaults.logLevels;
|
|
1154
|
+
const unhandledErrors = normalizedConfig.unhandledErrors ?? defaults.unhandledErrors;
|
|
1155
|
+
if (enabledMode === true) return {
|
|
1156
|
+
enabled: true,
|
|
1157
|
+
logLevels,
|
|
1158
|
+
unhandledErrors
|
|
1159
|
+
};
|
|
1160
|
+
if (enabledMode === false) return {
|
|
1161
|
+
enabled: false,
|
|
1162
|
+
logLevels,
|
|
1163
|
+
unhandledErrors
|
|
1164
|
+
};
|
|
1165
|
+
const agentResult = await detectAgent();
|
|
1166
|
+
return {
|
|
1167
|
+
enabled: agentResult.isAgent,
|
|
1168
|
+
agentName: agentResult.agentName,
|
|
1169
|
+
logLevels,
|
|
1170
|
+
unhandledErrors
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* @description 在 weapp 开发态按需启动控制台转发。
|
|
1175
|
+
*/
|
|
1176
|
+
async function maybeStartForwardConsole(options) {
|
|
1177
|
+
if (options.platform !== "weapp") return false;
|
|
1178
|
+
const projectPath = resolveIdeProjectPath(options.mpDistRoot) ?? options.cwd;
|
|
1179
|
+
if (!projectPath) return false;
|
|
1180
|
+
const resolved = await resolveForwardConsoleOptions(options.weappViteConfig);
|
|
1181
|
+
if (!resolved.enabled) return false;
|
|
1182
|
+
if (activeForwardConsoleSession) return true;
|
|
1183
|
+
try {
|
|
1184
|
+
activeForwardConsoleSession = await startForwardConsoleBridge({
|
|
1185
|
+
agentName: resolved.agentName,
|
|
1186
|
+
projectPath,
|
|
1187
|
+
logLevels: resolved.logLevels,
|
|
1188
|
+
unhandledErrors: resolved.unhandledErrors,
|
|
1189
|
+
onReadyMessage: "[forwardConsole] 已连接微信开发者工具日志"
|
|
1190
|
+
});
|
|
1191
|
+
return true;
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
activeForwardConsoleSession = void 0;
|
|
1194
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1195
|
+
logger_default.warn(`[forwardConsole] 启动失败,回退到普通 IDE 打开流程:${message}`);
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* @description 统一启动 DevTools 日志桥,并在 IDE 刚启动时做短暂重试。
|
|
1201
|
+
*/
|
|
1202
|
+
async function startForwardConsoleBridge(options) {
|
|
1203
|
+
return await withForwardConsoleRetry(async () => {
|
|
1204
|
+
return await startForwardConsole({
|
|
1205
|
+
projectPath: options.projectPath,
|
|
1206
|
+
logLevels: options.logLevels,
|
|
1207
|
+
unhandledErrors: options.unhandledErrors,
|
|
1208
|
+
onReady: () => {
|
|
1209
|
+
const suffix = options.agentName ? `(AI 终端:${options.agentName})` : "";
|
|
1210
|
+
logger_default.info(`${options.onReadyMessage}${suffix}`);
|
|
1211
|
+
},
|
|
1212
|
+
onLog: (event) => {
|
|
1213
|
+
const line = `[mini:${event.level}] ${event.message}`;
|
|
1214
|
+
if (event.level === "error") {
|
|
1215
|
+
logger_default.error(line);
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (event.level === "warn") {
|
|
1219
|
+
logger_default.warn(line);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
if (event.level === "info") {
|
|
1223
|
+
logger_default.info(line);
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
logger_default.log(line);
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
async function detectAgent() {
|
|
1232
|
+
try {
|
|
1233
|
+
const result = await determineAgent();
|
|
1234
|
+
return {
|
|
1235
|
+
isAgent: result.isAgent,
|
|
1236
|
+
agentName: result.isAgent ? result.agent.name : void 0
|
|
1237
|
+
};
|
|
1238
|
+
} catch {
|
|
1239
|
+
return {
|
|
1240
|
+
isAgent: false,
|
|
1241
|
+
agentName: void 0
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
async function withForwardConsoleRetry(runner) {
|
|
1246
|
+
let lastError;
|
|
1247
|
+
for (let attempt = 0; attempt <= FORWARD_CONSOLE_RETRY_TIMES; attempt++) try {
|
|
1248
|
+
return await runner();
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
lastError = error;
|
|
1251
|
+
if (!isDevtoolsPortNotReadyError(error) || attempt === FORWARD_CONSOLE_RETRY_TIMES) break;
|
|
1252
|
+
await sleep(FORWARD_CONSOLE_RETRY_DELAY_MS);
|
|
1253
|
+
}
|
|
1254
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
1255
|
+
}
|
|
1256
|
+
function isDevtoolsPortNotReadyError(error) {
|
|
1257
|
+
return error instanceof Error && error.message === "DEVTOOLS_HTTP_PORT_ERROR";
|
|
1258
|
+
}
|
|
1259
|
+
function sleep(ms) {
|
|
1260
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1261
|
+
}
|
|
1262
|
+
//#endregion
|
|
1263
|
+
//#region src/cli/commands/ide.ts
|
|
1264
|
+
/**
|
|
1265
|
+
* @description 注册 IDE 相关子命令。
|
|
1266
|
+
*/
|
|
1267
|
+
function registerIdeCommand(cli) {
|
|
1268
|
+
cli.command("ide [action] [root]", "forward Wechat DevTools console logs to terminal").option("-o, --open", "[boolean] open ide before attaching log bridge").option("-p, --platform <platform>", "[string] target platform (weapp | h5)").option("--project-config <path>", "[string] project config path (miniprogram only)").action(async (action, root, options) => {
|
|
1269
|
+
await runIdeCommand(action, root, options);
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* @description 执行 ide 子命令。
|
|
1274
|
+
*/
|
|
1275
|
+
async function runIdeCommand(action, root, options) {
|
|
1276
|
+
if (action !== "logs") throw new Error(`未知 ide 子命令: ${action ?? "(empty)"}`);
|
|
1277
|
+
filterDuplicateOptions(options);
|
|
1278
|
+
const configFile = resolveConfigFile(options);
|
|
1279
|
+
const targets = resolveRuntimeTargets(options);
|
|
1280
|
+
const resolved = await resolveIdeCommandContext({
|
|
1281
|
+
configFile,
|
|
1282
|
+
mode: options.mode ?? "development",
|
|
1283
|
+
platform: targets.mpPlatform,
|
|
1284
|
+
projectPath: root,
|
|
1285
|
+
cliPlatform: targets.rawPlatform
|
|
1286
|
+
});
|
|
1287
|
+
if (resolved.platform !== "weapp") throw new Error("`weapp-vite ide logs` 当前仅支持微信小程序平台。");
|
|
1288
|
+
if (!resolved.projectPath) throw new Error("无法解析微信开发者工具项目目录,请显式传入 root 或检查 project.config.json。");
|
|
1289
|
+
if (options.open) await openIde(resolved.platform, resolved.projectPath);
|
|
1290
|
+
const forwardConsoleOptions = await resolveForwardConsoleOptions({
|
|
1291
|
+
...resolved.weappViteConfig,
|
|
1292
|
+
forwardConsole: resolved.weappViteConfig?.forwardConsole === false ? { enabled: true } : {
|
|
1293
|
+
...typeof resolved.weappViteConfig?.forwardConsole === "object" ? resolved.weappViteConfig.forwardConsole : {},
|
|
1294
|
+
enabled: true
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1297
|
+
const session = await startForwardConsoleBridge({
|
|
1298
|
+
projectPath: resolved.projectPath,
|
|
1299
|
+
agentName: void 0,
|
|
1300
|
+
logLevels: forwardConsoleOptions.logLevels,
|
|
1301
|
+
unhandledErrors: forwardConsoleOptions.unhandledErrors,
|
|
1302
|
+
onReadyMessage: "[forwardConsole] 已进入持续监听模式,按 Ctrl+C 退出。"
|
|
1303
|
+
});
|
|
1304
|
+
await waitForTermination(async () => {
|
|
1305
|
+
logger_default.info("[forwardConsole] 正在关闭日志桥接...");
|
|
1306
|
+
await session.close();
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
async function waitForTermination(cleanup) {
|
|
1310
|
+
await new Promise((resolve) => {
|
|
1311
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
1312
|
+
let cleaning = false;
|
|
1313
|
+
const teardown = async () => {
|
|
1314
|
+
if (cleaning) return;
|
|
1315
|
+
cleaning = true;
|
|
1316
|
+
for (const signal of signals) process.off(signal, handlers.get(signal));
|
|
1317
|
+
await cleanup();
|
|
1318
|
+
resolve();
|
|
1319
|
+
};
|
|
1320
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
1321
|
+
for (const signal of signals) {
|
|
1322
|
+
const handler = () => {
|
|
1323
|
+
teardown();
|
|
1324
|
+
};
|
|
1325
|
+
handlers.set(signal, handler);
|
|
1326
|
+
process.on(signal, handler);
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
//#endregion
|
|
1029
1331
|
//#region src/cli/commands/init.ts
|
|
1030
1332
|
function registerInitCommand(cli) {
|
|
1031
1333
|
cli.command("init").action(async () => {
|
|
@@ -1076,21 +1378,14 @@ function registerOpenCommand(cli) {
|
|
|
1076
1378
|
filterDuplicateOptions(options);
|
|
1077
1379
|
const configFile = resolveConfigFile(options);
|
|
1078
1380
|
const targets = resolveRuntimeTargets(options);
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
cliPlatform: targets.rawPlatform
|
|
1088
|
-
});
|
|
1089
|
-
platform ??= ctx.configService.platform;
|
|
1090
|
-
if (!projectPath) projectPath = resolveIdeProjectPath(ctx.configService.mpDistRoot);
|
|
1091
|
-
} catch {}
|
|
1092
|
-
if (!projectPath && platform === "alipay") projectPath = resolveIdeProjectPath("dist/alipay/dist");
|
|
1093
|
-
await openIde(platform, projectPath);
|
|
1381
|
+
const { platform, projectPath, mpDistRoot } = await resolveIdeCommandContext({
|
|
1382
|
+
configFile,
|
|
1383
|
+
mode: options.mode ?? "development",
|
|
1384
|
+
platform: targets.mpPlatform,
|
|
1385
|
+
projectPath: root,
|
|
1386
|
+
cliPlatform: targets.rawPlatform
|
|
1387
|
+
});
|
|
1388
|
+
await openIde(platform, projectPath ?? resolveIdeProjectRoot(mpDistRoot, process.cwd()));
|
|
1094
1389
|
});
|
|
1095
1390
|
}
|
|
1096
1391
|
//#endregion
|
|
@@ -1186,7 +1481,14 @@ function registerServeCommand(cli) {
|
|
|
1186
1481
|
}
|
|
1187
1482
|
if (targets.runMini) logBuildAppFinish(configService, webServer, { skipWeb: !targets.runWeb });
|
|
1188
1483
|
else if (targets.runWeb) logBuildAppFinish(configService, webServer, { skipMini: true });
|
|
1189
|
-
if (options.open && targets.runMini)
|
|
1484
|
+
if (options.open && targets.runMini) {
|
|
1485
|
+
if (!await maybeStartForwardConsole({
|
|
1486
|
+
platform: configService.platform,
|
|
1487
|
+
mpDistRoot: configService.mpDistRoot,
|
|
1488
|
+
cwd: configService.cwd,
|
|
1489
|
+
weappViteConfig: configService.weappViteConfig
|
|
1490
|
+
})) await openIde(configService.platform, resolveIdeProjectRoot(configService.mpDistRoot, configService.cwd));
|
|
1491
|
+
}
|
|
1190
1492
|
if (analyzeHandle) await analyzeHandle.waitForExit();
|
|
1191
1493
|
});
|
|
1192
1494
|
}
|
|
@@ -1238,6 +1540,7 @@ const WEAPP_VITE_NATIVE_COMMANDS = new Set([
|
|
|
1238
1540
|
"dev",
|
|
1239
1541
|
"serve",
|
|
1240
1542
|
"build",
|
|
1543
|
+
"close",
|
|
1241
1544
|
"analyze",
|
|
1242
1545
|
"init",
|
|
1243
1546
|
"open",
|
|
@@ -1255,6 +1558,7 @@ async function tryRunIdeCommand(argv) {
|
|
|
1255
1558
|
const command = argv[0];
|
|
1256
1559
|
if (!command) return false;
|
|
1257
1560
|
if (command === "ide") {
|
|
1561
|
+
if (argv[1] === "logs") return false;
|
|
1258
1562
|
await parse(argv.slice(1));
|
|
1259
1563
|
return true;
|
|
1260
1564
|
}
|
|
@@ -1349,8 +1653,9 @@ try {
|
|
|
1349
1653
|
});
|
|
1350
1654
|
} catch {}
|
|
1351
1655
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
1352
|
-
|
|
1656
|
+
registerIdeCommand(cli);
|
|
1353
1657
|
registerBuildCommand(cli);
|
|
1658
|
+
registerCloseCommand(cli);
|
|
1354
1659
|
registerAnalyzeCommand(cli);
|
|
1355
1660
|
registerInitCommand(cli);
|
|
1356
1661
|
registerOpenCommand(cli);
|
|
@@ -1358,11 +1663,13 @@ registerPrepareCommand(cli);
|
|
|
1358
1663
|
registerNpmCommand(cli);
|
|
1359
1664
|
registerGenerateCommand(cli);
|
|
1360
1665
|
registerMcpCommand(cli);
|
|
1666
|
+
registerServeCommand(cli);
|
|
1361
1667
|
cli.help();
|
|
1362
1668
|
cli.version(VERSION);
|
|
1363
1669
|
const skipManagedTsconfigBootstrapCommands = new Set([
|
|
1364
1670
|
"g",
|
|
1365
1671
|
"generate",
|
|
1672
|
+
"ide",
|
|
1366
1673
|
"init",
|
|
1367
1674
|
"mcp",
|
|
1368
1675
|
"npm"
|
|
@@ -1371,10 +1678,17 @@ function resolveManagedTsconfigBootstrapRoot(args) {
|
|
|
1371
1678
|
const [firstArg, secondArg] = args;
|
|
1372
1679
|
if (!firstArg || firstArg === "--help" || firstArg === "-h" || firstArg === "--version" || firstArg === "-v") return;
|
|
1373
1680
|
if (firstArg.startsWith("-")) return process.cwd();
|
|
1374
|
-
if (skipManagedTsconfigBootstrapCommands.has(firstArg))
|
|
1681
|
+
if (skipManagedTsconfigBootstrapCommands.has(firstArg)) {
|
|
1682
|
+
if (firstArg === "ide") {
|
|
1683
|
+
const thirdArg = args[2];
|
|
1684
|
+
if (secondArg === "logs" && thirdArg && !thirdArg.startsWith("-")) return path.resolve(thirdArg);
|
|
1685
|
+
}
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1375
1688
|
if ([
|
|
1376
1689
|
"analyze",
|
|
1377
1690
|
"build",
|
|
1691
|
+
"close",
|
|
1378
1692
|
"dev",
|
|
1379
1693
|
"open",
|
|
1380
1694
|
"prepare",
|
|
@@ -12,8 +12,8 @@ import { WrapPluginOptions } from "vite-plugin-performance";
|
|
|
12
12
|
import PQueue from "p-queue";
|
|
13
13
|
import { ComputedDefinitions as ComputedDefinitions$1, MethodDefinitions as MethodDefinitions$1, PageLayoutMeta, Ref, WevuDefaults } from "wevu";
|
|
14
14
|
import { App, App as App$1, Component, Component as Component$1, GenerateType, Page, Page as Page$1, Plugin, Sitemap, Sitemap as Sitemap$1, Theme, Theme as Theme$1 } from "@weapp-core/schematics";
|
|
15
|
-
import { CompilerOptions } from "typescript";
|
|
16
15
|
import { WeappWebPluginOptions } from "@weapp-vite/web/plugin";
|
|
16
|
+
import { CompilerOptions } from "typescript";
|
|
17
17
|
import { DetectResult } from "package-manager-detector";
|
|
18
18
|
|
|
19
19
|
//#region src/pluginHost.d.ts
|
|
@@ -508,6 +508,27 @@ interface WeappDebugConfig {
|
|
|
508
508
|
}) => void;
|
|
509
509
|
inspect?: WrapPluginOptions;
|
|
510
510
|
}
|
|
511
|
+
type WeappForwardConsoleLogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error';
|
|
512
|
+
/**
|
|
513
|
+
* @description 微信开发者工具日志转发配置。
|
|
514
|
+
*/
|
|
515
|
+
interface WeappForwardConsoleConfig {
|
|
516
|
+
/**
|
|
517
|
+
* 是否启用日志转发。
|
|
518
|
+
* - `true`: 始终开启
|
|
519
|
+
* - `false`: 始终关闭
|
|
520
|
+
* - `'auto'`: 仅在检测到 AI 终端时开启
|
|
521
|
+
*/
|
|
522
|
+
enabled?: boolean | 'auto';
|
|
523
|
+
/**
|
|
524
|
+
* 允许转发的日志级别。
|
|
525
|
+
*/
|
|
526
|
+
logLevels?: WeappForwardConsoleLogLevel[];
|
|
527
|
+
/**
|
|
528
|
+
* 是否同时转发未捕获异常。
|
|
529
|
+
*/
|
|
530
|
+
unhandledErrors?: boolean;
|
|
531
|
+
}
|
|
511
532
|
/**
|
|
512
533
|
* @description weapp-vite 主配置
|
|
513
534
|
*/
|
|
@@ -575,6 +596,7 @@ interface WeappViteConfig {
|
|
|
575
596
|
routeRules?: WeappRouteRules;
|
|
576
597
|
injectWeapi?: boolean | WeappInjectWeapiConfig;
|
|
577
598
|
mcp?: boolean | WeappMcpConfig;
|
|
599
|
+
forwardConsole?: boolean | WeappForwardConsoleConfig;
|
|
578
600
|
chunks?: ChunksConfig;
|
|
579
601
|
json?: JsonConfig;
|
|
580
602
|
}
|
|
@@ -1428,7 +1450,6 @@ type UserConfigFnObjectPlain<T extends UserConfig$1 = UserConfig$1> = (env: Conf
|
|
|
1428
1450
|
type UserConfigFnObject<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => T;
|
|
1429
1451
|
type UserConfigFnPromise<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => Promise<T>;
|
|
1430
1452
|
type UserConfigFn<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => T | Promise<T>;
|
|
1431
|
-
type UserConfigLoose = UserConfig$1 & Record<string, any>;
|
|
1432
1453
|
type UserConfigExport<T extends UserConfig$1 = UserConfig$1> = T | Promise<T> | UserConfigFnNoEnv<T> | UserConfigFnObject<T> | UserConfigFnPromise<T> | UserConfigFn<T>;
|
|
1433
1454
|
declare module 'vite' {
|
|
1434
1455
|
interface UserConfig {
|
|
@@ -1443,11 +1464,8 @@ declare module 'vite' {
|
|
|
1443
1464
|
*/
|
|
1444
1465
|
declare function defineConfig(config: UserConfig$1): UserConfig$1;
|
|
1445
1466
|
declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
|
|
1446
|
-
declare function defineConfig(config: UserConfigFnNoEnvPlain): UserConfigFnNoEnvPlain;
|
|
1447
|
-
declare function defineConfig(config: UserConfigFnNoEnv): UserConfigFnNoEnv;
|
|
1448
1467
|
declare function defineConfig(config: UserConfigFnObjectPlain): UserConfigFnObjectPlain;
|
|
1449
|
-
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
1450
1468
|
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
1451
|
-
declare function defineConfig(config:
|
|
1469
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
1452
1470
|
//#endregion
|
|
1453
|
-
export { WeappDebugConfig as $,
|
|
1471
|
+
export { WeappDebugConfig as $, NpmPluginPackageConfig as $t, Ref as A, resolveWeappViteHostMeta as An, CopyOptions as At, BindingErrorLike as B, GenerateTemplateFileSource as Bt, LoadConfigOptions as C, WeappWebConfig as Cn, WeappWorkerConfig as Ct, MethodDefinitions$1 as D, applyWeappViteHostMeta as Dn, BuildNpmPackageMeta as Dt, InlineConfig$1 as E, WeappViteRuntime as En, AlipayNpmMode as Et, RolldownPlugin as F, GenerateOptions as Ft, EntryJsonFragment as G, JsonConfig as Gt, BaseEntry as H, GenerateTemplateScope as Ht, RolldownPluginOption as I, GenerateTemplate as It, ScanComponentItem as J, JsonMergeStage as Jt, PageEntry as K, JsonMergeContext as Kt, RolldownWatchOptions as L, GenerateTemplateContext as Lt, RolldownBuild as M, GenerateExtensionsOptions as Mt, RolldownOptions as N, GenerateFileType as Nt, Plugin$1 as O, createWeappViteHostMeta as On, ChunksConfig as Ot, RolldownOutput$1 as P, GenerateFilenamesOptions as Pt, UserConfig$2 as Q, NpmMainPackageConfig as Qt, RolldownWatcher$1 as R, GenerateTemplateEntry as Rt, CompilerContext as S, WeappManagedTypeScriptConfig as Sn, WeappWevuConfig as St, ConfigEnv$1 as T, WeappViteHostMeta as Tn, AliasOptions as Tt, ComponentEntry as U, GenerateTemplatesConfig as Ut, AppEntry as V, GenerateTemplateInlineSource as Vt, Entry as W, JsFormat as Wt, ProjectConfig as X, MpPlatform as Xt, WxmlDep as Y, JsonMergeStrategy as Yt, SubPackageMetaValue as Z, NpmBuildOptions as Zt, definePageJson as _, WeappLibVueTscOptions as _n, WeappRouteRule as _t, UserConfigFnNoEnvPlain as a, SharedChunkStrategy as an, EnhanceOptions as at, ChangeEvent as b, WeappManagedServerTsconfigConfig as bn, WeappVueConfig as bt, UserConfigFnPromise as c, SubPackageStyleConfigObject as cn, MultiPlatformConfig as ct, Component$1 as d, WeappLibComponentJson as dn, WeappAutoRoutesInclude as dt, NpmSubPackageConfig as en, WeappForwardConsoleConfig as et, Page$1 as f, WeappLibConfig as fn, WeappAutoRoutesIncludePattern as ft, defineComponentJson as g, WeappLibInternalDtsOptions as gn, WeappNpmConfig as gt, defineAppJson as h, WeappLibFileName as hn, WeappMcpConfig as ht, UserConfigFnNoEnv as i, SharedChunkOverride as in, AutoImportComponentsOption as it, ResolvedConfig as j, GenerateDirsOptions as jt, PluginOption as k, isWeappViteHost as kn, CopyGlobs as kt, defineConfig as l, SubPackageStyleEntry as ln, ScanWxmlOptions as lt, Theme$1 as m, WeappLibEntryContext as mn, WeappInjectWeapiConfig as mt, UserConfigExport as n, SharedChunkDynamicImports as nn, WeappViteConfig as nt, UserConfigFnObject as o, SubPackage as on, EnhanceWxmlOptions as ot, Sitemap$1 as p, WeappLibDtsOptions as pn, WeappHmrConfig as pt, ComponentsMap as q, JsonMergeFunction as qt, UserConfigFn as r, SharedChunkMode as rn, AutoImportComponents as rt, UserConfigFnObjectPlain as s, SubPackageStyleConfigEntry as sn, HandleWxmlOptions as st, UserConfig$1 as t, ResolvedAlias as tn, WeappForwardConsoleLogLevel as tt, App$1 as u, SubPackageStyleScope as un, WeappAutoRoutesConfig as ut, defineSitemapJson as v, WeappManagedAppTsconfigConfig as vn, WeappRouteRules as vt, ComputedDefinitions$1 as w, WEAPP_VITE_HOST_NAME as wn, Alias as wt, WeappVitePluginApi as x, WeappManagedSharedTsconfigConfig as xn, WeappVueTemplateConfig as xt, defineThemeJson as y, WeappManagedNodeTsconfigConfig as yn, WeappSubPackageConfig as yt, ViteDevServer$1 as z, GenerateTemplateFactory as zt };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as resolveWeappViteHostMeta, Dn as applyWeappViteHostMeta, En as WeappViteRuntime, On as createWeappViteHostMeta, Tn as WeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, kn as isWeappViteHost, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, wn as WEAPP_VITE_HOST_NAME, y as defineThemeJson } from "./config-DHz3M7If.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
|
|
2
2
|
import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { n as configureLogger, r as logger_default } from "./logger-gutcwWKE.mjs";
|
|
4
|
-
import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-
|
|
4
|
+
import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-CHBdQW3o.mjs";
|
|
5
5
|
import { createRequire, isBuiltin } from "node:module";
|
|
6
6
|
import { addExtension, defu, get, isEmptyObject, isObject, objectHash, removeExtension, removeExtensionDeep, set } from "@weapp-core/shared";
|
|
7
7
|
import { LRUCache } from "lru-cache";
|
|
@@ -8344,8 +8344,7 @@ function createAliasManager(oxcAlias, builtinAliases) {
|
|
|
8344
8344
|
if (Array.isArray(alias)) return alias.filter((entry) => {
|
|
8345
8345
|
return Boolean(entry && typeof entry === "object" && "find" in entry && "replacement" in entry);
|
|
8346
8346
|
});
|
|
8347
|
-
|
|
8348
|
-
return Object.entries(record).map(([find, replacement]) => {
|
|
8347
|
+
return Object.entries(alias).map(([find, replacement]) => {
|
|
8349
8348
|
return {
|
|
8350
8349
|
find,
|
|
8351
8350
|
replacement
|
|
@@ -8431,6 +8430,16 @@ function getWeappViteConfig() {
|
|
|
8431
8430
|
port: 3088,
|
|
8432
8431
|
endpoint: "/mcp"
|
|
8433
8432
|
},
|
|
8433
|
+
forwardConsole: {
|
|
8434
|
+
enabled: "auto",
|
|
8435
|
+
logLevels: [
|
|
8436
|
+
"log",
|
|
8437
|
+
"info",
|
|
8438
|
+
"warn",
|
|
8439
|
+
"error"
|
|
8440
|
+
],
|
|
8441
|
+
unhandledErrors: true
|
|
8442
|
+
},
|
|
8434
8443
|
chunks: {
|
|
8435
8444
|
sharedStrategy: "duplicate",
|
|
8436
8445
|
sharedMode: "common",
|
|
@@ -9055,8 +9064,7 @@ function scanAssetFiles(configService, config, buildTarget) {
|
|
|
9055
9064
|
}
|
|
9056
9065
|
async function emitAssets(ctx, pluginContext, files, concurrency) {
|
|
9057
9066
|
if (!files.length) return;
|
|
9058
|
-
const
|
|
9059
|
-
const workerCount = Math.min(normalizedConcurrency, files.length);
|
|
9067
|
+
const workerCount = Math.min(Number.isFinite(concurrency) && concurrency > 0 ? Math.floor(concurrency) : 8, files.length);
|
|
9060
9068
|
let index = 0;
|
|
9061
9069
|
await Promise.all(Array.from({ length: workerCount }).map(async () => {
|
|
9062
9070
|
while (index < files.length) {
|
|
@@ -9103,7 +9111,7 @@ function asset(ctx) {
|
|
|
9103
9111
|
const LEADING_DOT_SLASH_RE$1 = /^\.\//;
|
|
9104
9112
|
const LEADING_SLASHES_RE$2 = /^\/+/;
|
|
9105
9113
|
const GLOB_WILDCARD_RE = /[*?[{]/;
|
|
9106
|
-
const TRAILING_SLASHES_RE$
|
|
9114
|
+
const TRAILING_SLASHES_RE$2 = /\/+$/;
|
|
9107
9115
|
const AUTO_IMPORT_WATCHER_KEY = "__auto-import-vue-watcher__";
|
|
9108
9116
|
function isEnabledOutputOption(option) {
|
|
9109
9117
|
if (option === true) return true;
|
|
@@ -9167,7 +9175,7 @@ function registerAutoImportWatchTargets(state, globs, registrar, options = {}) {
|
|
|
9167
9175
|
for (const pattern of globs ?? []) {
|
|
9168
9176
|
const normalizedPattern = toPosixPath(pattern).replace(LEADING_DOT_SLASH_RE$1, "").replace(LEADING_SLASHES_RE$2, "");
|
|
9169
9177
|
const wildcardIndex = normalizedPattern.search(GLOB_WILDCARD_RE);
|
|
9170
|
-
const cleanedBase = (wildcardIndex >= 0 ? normalizedPattern.slice(0, wildcardIndex) : normalizedPattern).replace(TRAILING_SLASHES_RE$
|
|
9178
|
+
const cleanedBase = (wildcardIndex >= 0 ? normalizedPattern.slice(0, wildcardIndex) : normalizedPattern).replace(TRAILING_SLASHES_RE$2, "");
|
|
9171
9179
|
if (!cleanedBase) continue;
|
|
9172
9180
|
watchTargets.add(path.resolve(configService.absoluteSrcRoot, cleanedBase));
|
|
9173
9181
|
}
|
|
@@ -10882,6 +10890,8 @@ function createTemplateScanner(wxmlService, debug) {
|
|
|
10882
10890
|
}
|
|
10883
10891
|
//#endregion
|
|
10884
10892
|
//#region src/plugins/hooks/useLoadEntry/index.ts
|
|
10893
|
+
const LEADING_RELATIVE_SEGMENTS_RE = /^[./]+/;
|
|
10894
|
+
const TRAILING_SLASHES_RE$1 = /\/+$/;
|
|
10885
10895
|
function useLoadEntry(ctx, options) {
|
|
10886
10896
|
const debug = createDebugger("weapp-vite:load-entry");
|
|
10887
10897
|
const buildTarget = options?.buildTarget ?? "app";
|
|
@@ -10964,7 +10974,9 @@ function useLoadEntry(ctx, options) {
|
|
|
10964
10974
|
resolvedEntryMap,
|
|
10965
10975
|
dirtyEntrySet,
|
|
10966
10976
|
dirtyEntryReasons,
|
|
10967
|
-
sharedChunkImporters: hmrSharedChunkImporters
|
|
10977
|
+
sharedChunkImporters: hmrSharedChunkImporters,
|
|
10978
|
+
subPackageRoots: new Set(ctx.scanService?.subPackageMap?.keys?.() ?? []),
|
|
10979
|
+
relativeAbsoluteSrcRoot: ctx.configService.relativeAbsoluteSrcRoot.bind(ctx.configService)
|
|
10968
10980
|
});
|
|
10969
10981
|
const pending = [];
|
|
10970
10982
|
const shouldEmitAllEntries = pendingEntryIds.size > 0 && pendingEntryIds.size === resolvedEntryMap.size;
|
|
@@ -10991,8 +11003,8 @@ function resolvePendingEntryIds(options) {
|
|
|
10991
11003
|
hasDependencyDrivenEntry = true;
|
|
10992
11004
|
break;
|
|
10993
11005
|
}
|
|
10994
|
-
if (!hasDependencyDrivenEntry) return pending;
|
|
10995
11006
|
if (!options.sharedChunkImporters?.size) return pending;
|
|
11007
|
+
if (!hasDependencyDrivenEntry && !hasCrossPackageDirectDirtyImporter(options)) return pending;
|
|
10996
11008
|
for (const importers of options.sharedChunkImporters.values()) {
|
|
10997
11009
|
if (importers.size <= 1) continue;
|
|
10998
11010
|
let hasDependencyDrivenImporter = false;
|
|
@@ -11000,11 +11012,40 @@ function resolvePendingEntryIds(options) {
|
|
|
11000
11012
|
hasDependencyDrivenImporter = true;
|
|
11001
11013
|
break;
|
|
11002
11014
|
}
|
|
11003
|
-
if (!hasDependencyDrivenImporter)
|
|
11015
|
+
if (!hasDependencyDrivenImporter) {
|
|
11016
|
+
if (!shouldExpandDirectUpdateAcrossPackageScopes(importers, options)) continue;
|
|
11017
|
+
}
|
|
11004
11018
|
for (const importer of importers) pending.add(importer);
|
|
11005
11019
|
}
|
|
11006
11020
|
return pending;
|
|
11007
11021
|
}
|
|
11022
|
+
function shouldExpandDirectUpdateAcrossPackageScopes(importers, options) {
|
|
11023
|
+
let hasDirectDirtyImporter = false;
|
|
11024
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
11025
|
+
for (const importer of importers) {
|
|
11026
|
+
if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") hasDirectDirtyImporter = true;
|
|
11027
|
+
const scope = resolveEntryPackageScope(importer, options.subPackageRoots, options.relativeAbsoluteSrcRoot);
|
|
11028
|
+
scopes.add(scope);
|
|
11029
|
+
if (scopes.size > 1 && hasDirectDirtyImporter) return true;
|
|
11030
|
+
}
|
|
11031
|
+
return false;
|
|
11032
|
+
}
|
|
11033
|
+
function hasCrossPackageDirectDirtyImporter(options) {
|
|
11034
|
+
for (const importers of options.sharedChunkImporters?.values() ?? []) {
|
|
11035
|
+
if (importers.size <= 1) continue;
|
|
11036
|
+
if (shouldExpandDirectUpdateAcrossPackageScopes(importers, options)) return true;
|
|
11037
|
+
}
|
|
11038
|
+
return false;
|
|
11039
|
+
}
|
|
11040
|
+
function resolveEntryPackageScope(entryId, subPackageRoots, relativeAbsoluteSrcRoot) {
|
|
11041
|
+
const normalized = (relativeAbsoluteSrcRoot?.(entryId) ?? entryId).replace(LEADING_RELATIVE_SEGMENTS_RE, "");
|
|
11042
|
+
for (const root of subPackageRoots ?? []) {
|
|
11043
|
+
const normalizedRoot = posix.normalize(root).replace(LEADING_RELATIVE_SEGMENTS_RE, "").replace(TRAILING_SLASHES_RE$1, "");
|
|
11044
|
+
if (!normalizedRoot) continue;
|
|
11045
|
+
if (normalized === normalizedRoot || normalized.startsWith(`${normalizedRoot}/`)) return normalizedRoot;
|
|
11046
|
+
}
|
|
11047
|
+
return "";
|
|
11048
|
+
}
|
|
11008
11049
|
//#endregion
|
|
11009
11050
|
//#region src/utils/wxmlScriptModule.ts
|
|
11010
11051
|
function resolveScriptModuleTagByPlatform(platform, scriptModuleExtension) {
|
|
@@ -17457,7 +17498,7 @@ function createScanService(ctx) {
|
|
|
17457
17498
|
let vueAppPath;
|
|
17458
17499
|
if (!appEntryPath) vueAppPath = await findVueEntry(appBasename);
|
|
17459
17500
|
if (!appConfigFile && vueAppPath) {
|
|
17460
|
-
const { extractConfigFromVue } = await import("./file-
|
|
17501
|
+
const { extractConfigFromVue } = await import("./file-CHBdQW3o.mjs").then((n) => n.r);
|
|
17461
17502
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
17462
17503
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
17463
17504
|
}
|
|
@@ -17924,6 +17965,14 @@ function hasDependency(packageJson, name) {
|
|
|
17924
17965
|
function unique(values) {
|
|
17925
17966
|
return [...new Set(values)];
|
|
17926
17967
|
}
|
|
17968
|
+
function rebaseManagedPathValue(root, managedDir, value) {
|
|
17969
|
+
if (!value.startsWith("./") && !value.startsWith("../")) return value;
|
|
17970
|
+
return path.relative(managedDir, path.resolve(root, value)).replace(WINDOWS_PATH_SEPARATOR_PATTERN, "/");
|
|
17971
|
+
}
|
|
17972
|
+
function rebaseManagedPaths(root, managedDir, paths) {
|
|
17973
|
+
if (!paths) return;
|
|
17974
|
+
return Object.fromEntries(Object.entries(paths).map(([key, values]) => [key, Array.isArray(values) ? values.map((value) => rebaseManagedPathValue(root, managedDir, value)) : []]));
|
|
17975
|
+
}
|
|
17927
17976
|
function mergePaths(...entries) {
|
|
17928
17977
|
const merged = {};
|
|
17929
17978
|
for (const entry of entries) {
|
|
@@ -17980,11 +18029,13 @@ function getAppTypes(ctx, legacyConfig) {
|
|
|
17980
18029
|
}
|
|
17981
18030
|
function getAppPaths(ctx, legacyConfig) {
|
|
17982
18031
|
const configService = requireConfigService(ctx, "生成 app paths 前必须初始化 configService。");
|
|
18032
|
+
const root = resolveBaseDir(configService);
|
|
18033
|
+
const managedDir = resolveManagedDir(ctx);
|
|
17983
18034
|
const userConfig = getManagedTypeScriptConfig(ctx);
|
|
17984
18035
|
const normalizedSrcRoot = typeof configService.srcRoot === "string" ? configService.srcRoot.replace(WINDOWS_PATH_SEPARATOR_PATTERN, "/").replace(LEADING_DOT_SLASH_PATTERN, "").replace(TRAILING_SLASH_PATTERN, "") || "src" : "src";
|
|
17985
|
-
const defaultPaths = { "@/*": [
|
|
17986
|
-
if (hasDependency(configService.packageJson, "wevu")) defaultPaths["weapp-vite/typed-components"] = ["
|
|
17987
|
-
return mergePaths(defaultPaths, legacyConfig?.shared?.compilerOptions?.paths, legacyConfig?.app?.compilerOptions?.paths, userConfig?.shared?.compilerOptions?.paths, userConfig?.app?.compilerOptions?.paths);
|
|
18036
|
+
const defaultPaths = { "@/*": [`../${normalizedSrcRoot}/*`] };
|
|
18037
|
+
if (hasDependency(configService.packageJson, "wevu")) defaultPaths["weapp-vite/typed-components"] = ["./typed-components.d.ts"];
|
|
18038
|
+
return mergePaths(defaultPaths, rebaseManagedPaths(root, managedDir, legacyConfig?.shared?.compilerOptions?.paths), rebaseManagedPaths(root, managedDir, legacyConfig?.app?.compilerOptions?.paths), rebaseManagedPaths(root, managedDir, userConfig?.shared?.compilerOptions?.paths), rebaseManagedPaths(root, managedDir, userConfig?.app?.compilerOptions?.paths));
|
|
17988
18039
|
}
|
|
17989
18040
|
function createSharedTsconfig(ctx, legacyConfig) {
|
|
17990
18041
|
const userConfig = getManagedTypeScriptConfig(ctx);
|
|
@@ -18024,13 +18075,8 @@ function createAppTsconfig(ctx, legacyConfig) {
|
|
|
18024
18075
|
const compilerOptions = {
|
|
18025
18076
|
tsBuildInfoFile: "../node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
18026
18077
|
target: "ES2023",
|
|
18027
|
-
lib: [
|
|
18028
|
-
"ES2023",
|
|
18029
|
-
"DOM",
|
|
18030
|
-
"DOM.Iterable"
|
|
18031
|
-
],
|
|
18078
|
+
lib: ["ES2023", "DOM"],
|
|
18032
18079
|
jsx: "preserve",
|
|
18033
|
-
baseUrl: "..",
|
|
18034
18080
|
resolveJsonModule: true,
|
|
18035
18081
|
allowJs: true,
|
|
18036
18082
|
allowSyntheticDefaultImports: true,
|
|
@@ -78,7 +78,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
78
78
|
}
|
|
79
79
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
80
80
|
try {
|
|
81
|
-
const { getCompilerContext } = await import("./createContext-
|
|
81
|
+
const { getCompilerContext } = await import("./createContext-BzGZK60x.mjs").then((n) => n.a);
|
|
82
82
|
const compilerContext = getCompilerContext();
|
|
83
83
|
const service = compilerContext.autoRoutesService;
|
|
84
84
|
const reference = service?.getReference?.();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Ref,
|
|
1
|
+
import { A as Ref, An as resolveWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, Dn as applyWeappViteHostMeta, E as InlineConfig, En as WeappViteRuntime, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, On as createWeappViteHostMeta, P as RolldownOutput, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Tn as WeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, kn as isWeappViteHost, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, wn as WEAPP_VITE_HOST_NAME, y as defineThemeJson, z as ViteDevServer } from "./config-DHz3M7If.mjs";
|
|
2
2
|
import { WevuComponentOptions, defineEmits, defineProps } from "./runtime.mjs";
|
|
3
3
|
import { createWevuComponent, setPageLayout } from "wevu";
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson } from "./json.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import { t as createCompilerContext } from "./createContext-
|
|
5
|
-
import "./logger-gutcwWKE.mjs";
|
|
6
|
-
import "./file-hsZ3VxaT.mjs";
|
|
4
|
+
import { t as createCompilerContext } from "./createContext-BzGZK60x.mjs";
|
|
7
5
|
import { defineEmits, defineProps } from "./runtime.mjs";
|
|
8
6
|
import { createWevuComponent, setPageLayout } from "wevu";
|
|
9
7
|
export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
|
package/dist/json.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-DHz3M7If.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ht as WeappMcpConfig } from "./config-DHz3M7If.mjs";
|
|
2
2
|
import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as Resolver } from "./index-BQqQ_BLM.mjs";
|
|
2
2
|
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DUBjYF43.mjs";
|
|
3
|
-
import { $ as WeappDebugConfig, $t as
|
|
4
|
-
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, ComputedDefinitions, ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmMainPackageConfig, NpmPluginPackageConfig, NpmSubPackageConfig, PageEntry, Plugin, PluginOption, ProjectConfig, Ref, ResolvedAlias, ResolvedConfig, Resolver, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, ViteDevServer, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappHmrConfig, WeappInjectWeapiConfig, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
|
|
3
|
+
import { $ as WeappDebugConfig, $t as NpmPluginPackageConfig, A as Ref, At as CopyOptions, B as BindingErrorLike, Bt as GenerateTemplateFileSource, Cn as WeappWebConfig, Ct as WeappWorkerConfig, D as MethodDefinitions, Dt as BuildNpmPackageMeta, E as InlineConfig, En as WeappViteRuntime, Et as AlipayNpmMode, F as RolldownPlugin, Ft as GenerateOptions, G as EntryJsonFragment, Gt as JsonConfig, H as BaseEntry, Ht as GenerateTemplateScope, I as RolldownPluginOption, It as GenerateTemplate, J as ScanComponentItem, Jt as JsonMergeStage, K as PageEntry, Kt as JsonMergeContext, L as RolldownWatchOptions, Lt as GenerateTemplateContext, M as RolldownBuild, Mt as GenerateExtensionsOptions, N as RolldownOptions, Nt as GenerateFileType, O as Plugin, Ot as ChunksConfig, P as RolldownOutput, Pt as GenerateFilenamesOptions, Q as UserConfig, Qt as NpmMainPackageConfig, R as RolldownWatcher, Rt as GenerateTemplateEntry, Sn as WeappManagedTypeScriptConfig, St as WeappWevuConfig, T as ConfigEnv, Tn as WeappViteHostMeta, Tt as AliasOptions, U as ComponentEntry, Ut as GenerateTemplatesConfig, V as AppEntry, Vt as GenerateTemplateInlineSource, W as Entry, Wt as JsFormat, X as ProjectConfig, Xt as MpPlatform, Y as WxmlDep, Yt as JsonMergeStrategy, Z as SubPackageMetaValue, Zt as NpmBuildOptions, _n as WeappLibVueTscOptions, _t as WeappRouteRule, an as SharedChunkStrategy, at as EnhanceOptions, b as ChangeEvent, bn as WeappManagedServerTsconfigConfig, bt as WeappVueConfig, cn as SubPackageStyleConfigObject, ct as MultiPlatformConfig, dn as WeappLibComponentJson, dt as WeappAutoRoutesInclude, en as NpmSubPackageConfig, et as WeappForwardConsoleConfig, fn as WeappLibConfig, ft as WeappAutoRoutesIncludePattern, gn as WeappLibInternalDtsOptions, gt as WeappNpmConfig, hn as WeappLibFileName, ht as WeappMcpConfig, in as SharedChunkOverride, it as AutoImportComponentsOption, j as ResolvedConfig, jt as GenerateDirsOptions, k as PluginOption, kt as CopyGlobs, ln as SubPackageStyleEntry, lt as ScanWxmlOptions, mn as WeappLibEntryContext, mt as WeappInjectWeapiConfig, nn as SharedChunkDynamicImports, nt as WeappViteConfig, on as SubPackage, ot as EnhanceWxmlOptions, pn as WeappLibDtsOptions, pt as WeappHmrConfig, q as ComponentsMap, qt as JsonMergeFunction, rn as SharedChunkMode, rt as AutoImportComponents, sn as SubPackageStyleConfigEntry, st as HandleWxmlOptions, tn as ResolvedAlias, tt as WeappForwardConsoleLogLevel, un as SubPackageStyleScope, ut as WeappAutoRoutesConfig, vn as WeappManagedAppTsconfigConfig, vt as WeappRouteRules, w as ComputedDefinitions, wt as Alias, x as WeappVitePluginApi, xn as WeappManagedSharedTsconfigConfig, xt as WeappVueTemplateConfig, yn as WeappManagedNodeTsconfigConfig, yt as WeappSubPackageConfig, z as ViteDevServer, zt as GenerateTemplateFactory } from "./config-DHz3M7If.mjs";
|
|
4
|
+
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, ComputedDefinitions, ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmMainPackageConfig, NpmPluginPackageConfig, NpmSubPackageConfig, PageEntry, Plugin, PluginOption, ProjectConfig, Ref, ResolvedAlias, ResolvedConfig, Resolver, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, ViteDevServer, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, WeappInjectWeapiConfig, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.11.
|
|
4
|
+
"version": "6.11.5",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"node": "^20.19.0 || >=22.12.0"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
+
"@vercel/detect-agent": "^1.2.1",
|
|
89
90
|
"@volar/typescript": "^2.4.28",
|
|
90
91
|
"@vue/language-core": "^3.2.6",
|
|
91
92
|
"cac": "^7.0.0",
|
|
@@ -102,29 +103,29 @@
|
|
|
102
103
|
"p-queue": "^9.1.0",
|
|
103
104
|
"package-manager-detector": "^1.6.0",
|
|
104
105
|
"pathe": "^2.0.3",
|
|
105
|
-
"picomatch": "^4.0.
|
|
106
|
+
"picomatch": "^4.0.4",
|
|
106
107
|
"postcss": "^8.5.8",
|
|
107
|
-
"rolldown": "1.0.0-rc.
|
|
108
|
+
"rolldown": "1.0.0-rc.11",
|
|
108
109
|
"rolldown-plugin-dts": "0.22.5",
|
|
109
110
|
"semver": "^7.7.4",
|
|
110
|
-
"typescript": "^
|
|
111
|
-
"vite": "8.0.
|
|
111
|
+
"typescript": "^6.0.2",
|
|
112
|
+
"vite": "8.0.2",
|
|
112
113
|
"vite-tsconfig-paths": "^6.1.1",
|
|
113
114
|
"vue": "^3.5.30",
|
|
114
115
|
"vue-tsc": "^3.2.6",
|
|
115
|
-
"@weapp-core/init": "6.0.
|
|
116
|
+
"@weapp-core/init": "6.0.5",
|
|
116
117
|
"@weapp-core/logger": "3.1.1",
|
|
117
118
|
"@weapp-core/schematics": "6.0.4",
|
|
118
119
|
"@weapp-core/shared": "3.0.2",
|
|
119
|
-
"@weapp-vite/ast": "6.11.
|
|
120
|
+
"@weapp-vite/ast": "6.11.5",
|
|
120
121
|
"@weapp-vite/mcp": "1.1.1",
|
|
121
122
|
"@weapp-vite/volar": "2.0.8",
|
|
122
123
|
"@weapp-vite/web": "1.3.7",
|
|
123
124
|
"@wevu/api": "0.2.2",
|
|
124
125
|
"rolldown-require": "2.0.9",
|
|
125
126
|
"vite-plugin-performance": "2.0.1",
|
|
126
|
-
"weapp-ide-cli": "5.1.
|
|
127
|
-
"wevu": "6.11.
|
|
127
|
+
"weapp-ide-cli": "5.1.2",
|
|
128
|
+
"wevu": "6.11.5"
|
|
128
129
|
},
|
|
129
130
|
"publishConfig": {
|
|
130
131
|
"access": "public",
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
"bench": "vitest bench -c vitest.bench.config.ts",
|
|
145
146
|
"test:dev": "vitest",
|
|
146
147
|
"test": "vitest run",
|
|
147
|
-
"test:types": "cd test-d/auto-routes-define-app-json && tsd",
|
|
148
|
+
"test:types": "cd test-d/auto-routes-define-app-json && tsd && cd ../config-define-config && tsd",
|
|
148
149
|
"lint:src": "eslint src --ext .ts",
|
|
149
150
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
150
151
|
"sync": "cnpm sync weapp-vite"
|