weapp-vite 6.18.7 → 6.19.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/README.md CHANGED
@@ -28,7 +28,10 @@
28
28
  - ⚡️ **Vite 构建**:带来了 `typescript` / `scss` / `less` 等等的原生支持
29
29
  - ♻️ **实验性状态保持 HMR**:微信开发者工具中可保留 Page/Component/wevu 状态并替换 JavaScript 方法
30
30
  - 🔌 **插件生态**:Vite 插件生态支持,也可以自定义编写插件,方便扩展
31
+ - 🌐 **实验性 Web Runtime**:同一份原生 WXML/WXSS/TS 或 wevu Vue SFC 源码可通过 `-p web` 启动和构建浏览器版本
32
+ - 🧩 **实验性 uni-app 组件库兼容**:通过显式依赖白名单与 `WotUiResolver()` 在微信小程序和 Web 中使用 Wot UI Vue SFC
31
33
  - 🧰 **IDE 命令增强**:可直接透传 `weapp-ide-cli` 全量命令(`preview/upload/config/automator` 等)
34
+ - 🧪 **真实产物单测**:`weapp-vite/test` 提供不启动 CLI 的程序化测试构建入口,可配合 `@mpcore/test` 测试页面和组件
32
35
 
33
36
  ## 快速开始
34
37
 
@@ -48,6 +51,17 @@ export default defineConfig({
48
51
 
49
52
  > 说明:CLI 同时支持完整命令 `weapp-vite` 与简写命令 `wv`,两者等价。下面的示例默认使用 `weapp-vite`,你也可以按个人习惯替换成 `wv`。
50
53
 
54
+ ### Web 项目
55
+
56
+ 项目根目录提供引用 `/@weapp-vite/web/entry` 的 `index.html` 后,可以直接运行同一份小程序源码:
57
+
58
+ ```bash
59
+ wv dev -p web --host
60
+ wv build -p web
61
+ ```
62
+
63
+ `web` 是浏览器 runtime 的规范平台名,`h5` 仅作为向后兼容别名保留;未选择 Web 平台时不改变现有小程序构建。完整配置和兼容边界见 [Web 运行时配置](https://vite.icebreaker.top/config/web) 与 [`@weapp-vite/web`](https://vite.icebreaker.top/packages/web)。
64
+
51
65
  ### Vue 项目
52
66
 
53
67
  ```typescript
@@ -112,6 +126,7 @@ function handleClick() {
112
126
  - defineConfig 重载说明:[docs/define-config-overloads.md](./docs/define-config-overloads.md)
113
127
  - Vite 插件识别 weapp-vite 宿主:https://vite.icebreaker.top/guide/vite-plugin-host
114
128
  - MCP 集成使用指南:[docs/mcp.md](./docs/mcp.md)
129
+ - Wot UI 与 uni-app 组件库:[docs/packaged/uni-app-component-libraries.md](./docs/packaged/uni-app-component-libraries.md)
115
130
 
116
131
  ## AI 项目指引
117
132
 
@@ -143,6 +158,7 @@ function handleClick() {
143
158
  - `ai-workflows.md`
144
159
  - `project-structure.md`
145
160
  - `weapp-config.md`
161
+ - `uni-app-component-libraries.md`
146
162
  - `wevu-authoring.md`
147
163
  - `vue-sfc.md`
148
164
  - `troubleshooting.md`
@@ -370,6 +386,18 @@ export default defineConfig({
370
386
 
371
387
  详细说明见:[docs/mcp.md](./docs/mcp.md)
372
388
 
389
+ ## 小程序页面与组件测试
390
+
391
+ `buildTestArtifact()` 会通过 Vite/Rolldown 把真实编译产物输出到隔离目录,供 mpcore 测试环境消费:
392
+
393
+ ```ts
394
+ import { buildTestArtifact } from 'weapp-vite/test'
395
+
396
+ const artifact = await buildTestArtifact({ cwd: process.cwd() })
397
+ ```
398
+
399
+ 默认输出目录是 `.weapp-vite/test-artifacts/`。完整的 render、查询、交互和 Vitest 接入见 [测试指南](./docs/packaged/testing.md)。
400
+
373
401
  ## Contribute
374
402
 
375
403
  我们邀请你来贡献和帮助改进 `weapp-vite` 💚💚💚
@@ -1,2 +1,2 @@
1
- import { a as ExternalMetadataFileCandidates, c as Resolver, d as ResolverObject, f as ResolverSupportFilesStrategy, i as CreateResolver, l as ResolverFn, n as VantResolver, o as Options, r as TDesignResolver, s as ResolvedValue, t as WeuiResolver, u as ResolverMeta } from "../index-Bmclyjw8.mjs";
2
- export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, VantResolver, WeuiResolver };
1
+ import { a as UviewPlusResolver, c as CreateResolver, d as ResolvedValue, f as Resolver, g as ResolverSupportFilesStrategy, h as ResolverObject, i as VantResolver, l as ExternalMetadataFileCandidates, m as ResolverMeta, n as WotUiResolverOptions, o as UviewPlusResolverOptions, p as ResolverFn, r as WeuiResolver, s as TDesignResolver, t as WotUiResolver, u as Options } from "../index-CaXAtb9e.mjs";
2
+ export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, UviewPlusResolver, UviewPlusResolverOptions, VantResolver, WeuiResolver, WotUiResolver, WotUiResolverOptions };
@@ -1,334 +1,2 @@
1
- import { defu } from "@weapp-core/shared";
2
- //#region src/auto-import-components/resolvers/json/tdesign.json
3
- var tdesign_default = [
4
- "action-sheet",
5
- "avatar",
6
- "avatar-group",
7
- "back-top",
8
- "badge",
9
- "button",
10
- "calendar",
11
- "cascader",
12
- "cell",
13
- "cell-group",
14
- "check-tag",
15
- "checkbox",
16
- "checkbox-group",
17
- "col",
18
- "collapse",
19
- "collapse-panel",
20
- "color-picker",
21
- "config-provider",
22
- "count-down",
23
- "date-time-picker",
24
- "dialog",
25
- "divider",
26
- "drawer",
27
- "dropdown-item",
28
- "dropdown-menu",
29
- "empty",
30
- "fab",
31
- "footer",
32
- "form",
33
- "form-item",
34
- "grid",
35
- "grid-item",
36
- "guide",
37
- "icon",
38
- "image",
39
- "image-viewer",
40
- "indexes",
41
- "indexes-anchor",
42
- "input",
43
- "link",
44
- "loading",
45
- "message",
46
- "message-item",
47
- "navbar",
48
- "notice-bar",
49
- "overlay",
50
- "paragraph",
51
- "picker",
52
- "picker-item",
53
- "popover",
54
- "popup",
55
- "progress",
56
- "pull-down-refresh",
57
- "qrcode",
58
- "radio",
59
- "radio-group",
60
- "rate",
61
- "result",
62
- "row",
63
- "scroll-view",
64
- "search",
65
- "segmented",
66
- "side-bar",
67
- "side-bar-item",
68
- "skeleton",
69
- "slider",
70
- "step-item",
71
- "stepper",
72
- "steps",
73
- "sticky",
74
- "swipe-cell",
75
- "swiper",
76
- "swiper-nav",
77
- "switch",
78
- "tab-bar",
79
- "tab-bar-item",
80
- "tab-panel",
81
- "table",
82
- "tabs",
83
- "tag",
84
- "text",
85
- "textarea",
86
- "title",
87
- "toast",
88
- "transition",
89
- "tree-select",
90
- "upload",
91
- "watermark"
92
- ];
93
- //#endregion
94
- //#region src/auto-import-components/resolvers/tdesign.ts
95
- const defaultPrefix$2 = "t-";
96
- const TDesignResolver = (opts) => {
97
- const { prefix, resolve, supportFilesStrategy } = defu(opts, {
98
- prefix: defaultPrefix$2,
99
- supportFilesStrategy: "full",
100
- resolve({ name, prefix }) {
101
- return {
102
- key: `${prefix}${name}`,
103
- value: `tdesign-miniprogram/${name}/${name}`
104
- };
105
- }
106
- });
107
- const map = tdesign_default.reduce((acc, cur) => {
108
- const { key, value } = resolve({
109
- name: cur,
110
- prefix
111
- });
112
- acc[key] = value;
113
- return acc;
114
- }, {});
115
- return {
116
- components: Object.freeze({ ...map }),
117
- componentLookupStrategy: "static",
118
- supportFilesStrategy,
119
- resolve(componentName) {
120
- const from = map[componentName];
121
- if (!from) return;
122
- return {
123
- name: componentName,
124
- from
125
- };
126
- },
127
- resolveExternalMetadataCandidates(from) {
128
- if (!from.startsWith("tdesign-miniprogram/")) return;
129
- const segments = from.slice(20).split("/").filter(Boolean);
130
- const componentDir = segments[0];
131
- const fileBase = segments[segments.length - 1];
132
- if (!componentDir || !fileBase) return;
133
- const baseDir = `miniprogram_dist/${componentDir}`;
134
- const base = `${baseDir}/${fileBase}`;
135
- return {
136
- packageName: "tdesign-miniprogram",
137
- dts: [
138
- `${baseDir}/type.d.ts`,
139
- `${baseDir}/props.d.ts`,
140
- `${base}.d.ts`,
141
- `${baseDir}/index.d.ts`
142
- ],
143
- js: [
144
- `${baseDir}/type.js`,
145
- `${baseDir}/props.js`,
146
- `${base}.js`,
147
- `${baseDir}/index.js`
148
- ]
149
- };
150
- }
151
- };
152
- };
153
- //#endregion
154
- //#region src/auto-import-components/resolvers/json/vant.json
155
- var vant_default = [
156
- "action-sheet",
157
- "area",
158
- "button",
159
- "calendar",
160
- "card",
161
- "cascader",
162
- "cell",
163
- "cell-group",
164
- "checkbox",
165
- "checkbox-group",
166
- "circle",
167
- "col",
168
- "collapse",
169
- "collapse-item",
170
- "config-provider",
171
- "count-down",
172
- "datetime-picker",
173
- "definitions",
174
- "dialog",
175
- "divider",
176
- "dropdown-item",
177
- "dropdown-menu",
178
- "empty",
179
- "field",
180
- "goods-action",
181
- "goods-action-button",
182
- "goods-action-icon",
183
- "grid",
184
- "grid-item",
185
- "icon",
186
- "image",
187
- "index-anchor",
188
- "index-bar",
189
- "info",
190
- "loading",
191
- "nav-bar",
192
- "notice-bar",
193
- "notify",
194
- "overlay",
195
- "panel",
196
- "picker",
197
- "picker-column",
198
- "popup",
199
- "progress",
200
- "radio",
201
- "radio-group",
202
- "rate",
203
- "row",
204
- "search",
205
- "share-sheet",
206
- "sidebar",
207
- "sidebar-item",
208
- "skeleton",
209
- "slider",
210
- "stepper",
211
- "steps",
212
- "sticky",
213
- "submit-bar",
214
- "swipe-cell",
215
- "switch",
216
- "tab",
217
- "tabbar",
218
- "tabbar-item",
219
- "tabs",
220
- "tag",
221
- "toast",
222
- "transition",
223
- "tree-select",
224
- "uploader"
225
- ];
226
- //#endregion
227
- //#region src/auto-import-components/resolvers/vant.ts
228
- const defaultPrefix$1 = "van-";
229
- const VantResolver = (opts) => {
230
- const { prefix, resolve, supportFilesStrategy } = defu(opts, {
231
- prefix: defaultPrefix$1,
232
- supportFilesStrategy: "full",
233
- resolve({ name, prefix }) {
234
- return {
235
- key: `${prefix}${name}`,
236
- value: `@vant/weapp/${name}`
237
- };
238
- }
239
- });
240
- const map = vant_default.reduce((acc, cur) => {
241
- const { key, value } = resolve({
242
- name: cur,
243
- prefix
244
- });
245
- acc[key] = value;
246
- return acc;
247
- }, {});
248
- return {
249
- components: Object.freeze({ ...map }),
250
- componentLookupStrategy: "static",
251
- supportFilesStrategy,
252
- resolve(componentName) {
253
- const from = map[componentName];
254
- if (!from) return;
255
- return {
256
- name: componentName,
257
- from
258
- };
259
- },
260
- resolveExternalMetadataCandidates(from) {
261
- if (!from.startsWith("@vant/weapp/")) return;
262
- const component = from.slice(12);
263
- if (!component) return;
264
- return {
265
- packageName: "@vant/weapp",
266
- dts: [`lib/${component}/index.d.ts`, `dist/${component}/index.d.ts`],
267
- js: [`lib/${component}/index.js`, `dist/${component}/index.js`]
268
- };
269
- }
270
- };
271
- };
272
- //#endregion
273
- //#region src/auto-import-components/resolvers/json/weui.json
274
- var weui_default = [
275
- "actionsheet",
276
- "badge",
277
- "cell",
278
- "cells",
279
- "checkbox",
280
- "checkbox-group",
281
- "dialog",
282
- "form",
283
- "form-page",
284
- "gallery",
285
- "grids",
286
- "half-screen-dialog",
287
- "icon",
288
- "loading",
289
- "msg",
290
- "navigation-bar",
291
- "searchbar",
292
- "slideview",
293
- "tabbar",
294
- "toptips",
295
- "uploader"
296
- ];
297
- //#endregion
298
- //#region src/auto-import-components/resolvers/weui.ts
299
- const defaultPrefix = "mp-";
300
- const WeuiResolver = (opts) => {
301
- const { prefix, resolve, supportFilesStrategy } = defu(opts, {
302
- prefix: defaultPrefix,
303
- supportFilesStrategy: "full",
304
- resolve({ name, prefix }) {
305
- return {
306
- key: `${prefix}${name}`,
307
- value: `weui-miniprogram/${name}/${name}`
308
- };
309
- }
310
- });
311
- const map = weui_default.reduce((acc, cur) => {
312
- const { key, value } = resolve({
313
- name: cur,
314
- prefix
315
- });
316
- acc[key] = value;
317
- return acc;
318
- }, {});
319
- return {
320
- components: Object.freeze({ ...map }),
321
- componentLookupStrategy: "static",
322
- supportFilesStrategy,
323
- resolve(componentName) {
324
- const from = map[componentName];
325
- if (!from) return;
326
- return {
327
- name: componentName,
328
- from
329
- };
330
- }
331
- };
332
- };
333
- //#endregion
334
- export { TDesignResolver, VantResolver, WeuiResolver };
1
+ import { a as TDesignResolver, i as UviewPlusResolver, n as WeuiResolver, r as VantResolver, t as WotUiResolver } from "../resolvers-w4g7O94W.mjs";
2
+ export { TDesignResolver, UviewPlusResolver, VantResolver, WeuiResolver, WotUiResolver };
@@ -1,4 +1,4 @@
1
- import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-C3XuGjnq.mjs";
1
+ import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-DrwOUlDX.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 parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-C3XuGjnq.mjs";
1
+ import { C as parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-DrwOUlDX.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-DjQkG6ce.mjs";
3
+ import { h as VERSION } from "./file-CdNDPmkx.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";
@@ -56,8 +56,9 @@ function createInlineConfig(execution, options = {}) {
56
56
  scope: options.scope,
57
57
  host: options.host
58
58
  })).filter((config) => Boolean(config));
59
- if (configs.length === 0) return;
60
- return configs.slice(1).reduce((merged, config) => defu(merged, config), configs[0]);
59
+ if (configs.length === 0) return options.inlineConfig;
60
+ const merged = configs.slice(1).reduce((merged, config) => defu(merged, config), configs[0]);
61
+ return options.inlineConfig ? defu(options.inlineConfig, merged) : merged;
61
62
  }
62
63
  //#endregion
63
64
  //#region src/cli/openIde/execute.ts
@@ -279,6 +280,7 @@ function logWechatIdeServicePortDisabledHint(projectPath) {
279
280
  //#endregion
280
281
  //#region src/cli/openIde/reuse.ts
281
282
  const OPENED_PROJECT_HEALTH_CHECK_TIMEOUT = 3e3;
283
+ const OPEN_AUTOMATOR_TIMEOUT = 12e4;
282
284
  function formatReuseOpenedWechatIdePrompt() {
283
285
  return `目标项目已在微信开发者工具中打开,已跳过重复打开。按 ${RETRY_CONFIRM_KEYS.map((key) => colors.bold(colors.green(key))).join(" / ")} 关闭当前窗口后重新打开。`;
284
286
  }
@@ -306,6 +308,7 @@ async function openWechatIdeByAutomator(projectPath) {
306
308
  preserveProjectRoot: true,
307
309
  projectPath,
308
310
  port: resolveProjectAutomatorPort(projectPath),
311
+ timeout: OPEN_AUTOMATOR_TIMEOUT,
309
312
  trustProject: true
310
313
  }));
311
314
  }
@@ -1174,8 +1177,8 @@ function analyzeComponentUsage(options) {
1174
1177
  }
1175
1178
  //#endregion
1176
1179
  //#region src/analyze/subpackages/metadata.ts
1177
- const defaultTotalBudgetBytes = 20 * 1024 * 1024;
1178
- const defaultPackageBudgetBytes = 2 * 1024 * 1024;
1180
+ const defaultTotalBudgetBytes = 20971520;
1181
+ const defaultPackageBudgetBytes = 2097152;
1179
1182
  const defaultWarningRatio = .85;
1180
1183
  const defaultHistoryDir = ".weapp-vite/analyze-history";
1181
1184
  const defaultHistoryLimit = 20;
@@ -1522,10 +1525,11 @@ async function analyzeSubpackages(ctx) {
1522
1525
  subPackageRoots,
1523
1526
  independentRoots
1524
1527
  };
1525
- const mainResult = await build(configService.merge(void 0, createSharedBuildConfig(configService, scanService), { build: {
1528
+ const analysisConfig = configService.merge(void 0, createSharedBuildConfig(configService, scanService), { build: {
1526
1529
  write: false,
1527
1530
  watch: null
1528
- } }));
1531
+ } });
1532
+ const mainResult = await build(analysisConfig);
1529
1533
  const mainOutputs = Array.isArray(mainResult) ? mainResult : [mainResult];
1530
1534
  const packages = /* @__PURE__ */ new Map();
1531
1535
  const modules = /* @__PURE__ */ new Map();
@@ -1992,7 +1996,7 @@ const ANALYZE_DASHBOARD_PACKAGE_NAME = "@weapp-vite/dashboard";
1992
1996
  const ANALYZE_SSE_PATH = "/__weapp_vite_analyze";
1993
1997
  const FILE_CONTENT_PATH = "/__weapp_vite_file_content";
1994
1998
  const DASHBOARD_EVENT_NAME = "weapp-dashboard:event";
1995
- const MAX_FILE_CONTENT_BYTES = 2 * 1024 * 1024;
1999
+ const MAX_FILE_CONTENT_BYTES = 2097152;
1996
2000
  const require = createRequire(import.meta.url);
1997
2001
  function createInstallCommand(agent) {
1998
2002
  const resolved = resolveCommand(agent ?? "npm", "install", [ANALYZE_DASHBOARD_PACKAGE_NAME]);
@@ -2827,6 +2831,27 @@ function terminateStaleSassEmbeddedProcess() {
2827
2831
  function emitDashboardEvents$1(handle, events) {
2828
2832
  handle?.emitRuntimeEvents(events);
2829
2833
  }
2834
+ function normalizeBuildSourcemap(value) {
2835
+ if (value === "true") return true;
2836
+ if (value === "false") return false;
2837
+ return value;
2838
+ }
2839
+ function normalizeBuildMinify(value) {
2840
+ if (value === "true") return true;
2841
+ if (value === "false") return false;
2842
+ return value;
2843
+ }
2844
+ function hasCliOption(options, key) {
2845
+ return Object.prototype.hasOwnProperty.call(options, key);
2846
+ }
2847
+ function createBuildInlineConfig(options) {
2848
+ const build = {};
2849
+ if (typeof options.outDir === "string") build.outDir = options.outDir;
2850
+ if (hasCliOption(options, "sourcemap")) build.sourcemap = normalizeBuildSourcemap(options.sourcemap);
2851
+ if (hasCliOption(options, "minify")) build.minify = normalizeBuildMinify(options.minify);
2852
+ if (typeof options.emptyOutDir === "boolean") build.emptyOutDir = options.emptyOutDir;
2853
+ return Object.keys(build).length ? { build } : void 0;
2854
+ }
2830
2855
  function shouldScheduleCompletedProductionBuildExit(options, analyzeHandle) {
2831
2856
  return process.env.VITEST !== "true" && process.env.NODE_ENV !== "test" && process.env.WEAPP_VITE_DISABLE_COMPLETED_BUILD_EXIT !== "1" && options.watch !== true && options.open !== true && analyzeHandle === void 0;
2832
2857
  }
@@ -2847,7 +2872,10 @@ function registerBuildCommand(cli) {
2847
2872
  const cwd = root ?? process.cwd();
2848
2873
  const configFile = resolveConfigFile(options);
2849
2874
  targets = resolveRuntimeTargets(options);
2850
- const inlineConfig = createInlineConfig(targets, { scope: options.scope });
2875
+ const inlineConfig = createInlineConfig(targets, {
2876
+ scope: options.scope,
2877
+ inlineConfig: createBuildInlineConfig(options)
2878
+ });
2851
2879
  ctx = await createCompilerContext({
2852
2880
  cwd,
2853
2881
  mode: options.mode ?? "production",
@@ -3142,6 +3170,7 @@ let activeForwardConsoleSession;
3142
3170
  let activeForwardConsoleBridgeOptions;
3143
3171
  const FORWARD_CONSOLE_RETRY_DELAY_MS = 1e3;
3144
3172
  const FORWARD_CONSOLE_RETRY_TIMES = 5;
3173
+ const FORWARD_CONSOLE_START_TIMEOUT_MS = 12e4;
3145
3174
  async function detectAgent() {
3146
3175
  try {
3147
3176
  const result = await determineAgent();
@@ -3242,6 +3271,7 @@ async function startForwardConsoleBridge(options) {
3242
3271
  logLevels: options.logLevels,
3243
3272
  openedOnly: options.openedOnly,
3244
3273
  port: options.port,
3274
+ timeout: options.timeout,
3245
3275
  unhandledErrors: options.unhandledErrors,
3246
3276
  onReady: () => {
3247
3277
  const suffix = options.agentName ? `(AI 终端:${options.agentName})` : "";
@@ -3293,6 +3323,7 @@ async function maybeStartForwardConsole(options) {
3293
3323
  color: !resolved.agentName,
3294
3324
  projectPath,
3295
3325
  port: resolveProjectAutomatorPort(projectPath),
3326
+ timeout: FORWARD_CONSOLE_START_TIMEOUT_MS,
3296
3327
  logLevels: resolved.logLevels,
3297
3328
  openedOnly: options.openedOnly,
3298
3329
  unhandledErrors: resolved.unhandledErrors,
@@ -3981,7 +4012,8 @@ async function resolveHttpUrl(options) {
3981
4012
  const originalCwd = process.cwd();
3982
4013
  try {
3983
4014
  if (workspaceRoot !== originalCwd) process.chdir(workspaceRoot);
3984
- const resolved = resolveWeappMcpConfig((await loadConfig(resolveConfigFile(options)))?.config?.weapp?.mcp);
4015
+ const loaded = await loadConfig(resolveConfigFile(options));
4016
+ const resolved = resolveWeappMcpConfig(loaded?.config?.weapp?.mcp);
3985
4017
  return `http://${resolved.host}:${resolved.port}${resolved.endpoint}`;
3986
4018
  } catch {
3987
4019
  const resolved = resolveWeappMcpConfig(void 0);
@@ -4260,7 +4292,7 @@ function registerPrepareCommand(cli) {
4260
4292
  filterDuplicateOptions(options);
4261
4293
  const cwd = path.resolve(resolvePrepareRoot(input));
4262
4294
  const cliPlatform = resolvePreparePlatform(options);
4263
- const supportFiles = await syncProjectSupportFiles(await createCompilerContext({
4295
+ const ctx = await createCompilerContext({
4264
4296
  cwd,
4265
4297
  isDev: false,
4266
4298
  mode: typeof options.mode === "string" ? options.mode : "development",
@@ -4269,7 +4301,8 @@ function registerPrepareCommand(cli) {
4269
4301
  syncSupportFiles: false,
4270
4302
  preloadAppEntry: false,
4271
4303
  ...cliPlatform ? { cliPlatform } : {}
4272
- }));
4304
+ });
4305
+ const supportFiles = await syncProjectSupportFiles(ctx);
4273
4306
  for (const warning of supportFiles.managedTsconfigWarnings) logger_default.warn(warning);
4274
4307
  logger_default.info("已生成 .weapp-vite 支持文件。");
4275
4308
  } catch (error) {
@@ -4507,7 +4540,7 @@ function resolveRunnableHotkeyDefinition(input) {
4507
4540
  }
4508
4541
  //#endregion
4509
4542
  //#region package.json
4510
- var version = "6.18.7";
4543
+ var version = "6.19.1";
4511
4544
  //#endregion
4512
4545
  //#region src/cli/devHotkeys/format.ts
4513
4546
  const FULLWIDTH_ASCII_START = 65281;
@@ -5207,17 +5240,18 @@ function registerServeCommand(cli) {
5207
5240
  fallbackProjectPath: configService.cwd,
5208
5241
  openIde: async (projectPath, openOptions) => {
5209
5242
  const forceReopen = openOptions?.forceReopen === true;
5243
+ const useAutomatorOpen = forceReopen || openOptions?.useAutomatorOpen === true;
5210
5244
  await openIde(configService.platform, projectPath, {
5211
5245
  loginRetry: options.loginRetry,
5212
5246
  loginRetryTimeout: options.loginRetryTimeout,
5213
5247
  nonInteractive: options.nonInteractive,
5214
5248
  openRecovery: false,
5215
- prepareAutomatorSession: forceReopen ? true : "connect-opened",
5249
+ prepareAutomatorSession: useAutomatorOpen ? true : "connect-opened",
5216
5250
  reuseOpenedProject: !forceReopen,
5217
5251
  skipAutomatorCompile: !forceReopen,
5218
5252
  skipPostOpenHealthCheck: true,
5219
5253
  trustProject: options.trustProject,
5220
- useAutomatorOpen: forceReopen
5254
+ useAutomatorOpen
5221
5255
  });
5222
5256
  writePostOpenSeparator();
5223
5257
  },
@@ -5328,7 +5362,8 @@ function registerServeCommand(cli) {
5328
5362
  try {
5329
5363
  await miniProgramDevActions.openIde({
5330
5364
  forceOpen: true,
5331
- forceReopen: false
5365
+ forceReopen: false,
5366
+ useAutomatorOpen: options.trustProject !== false
5332
5367
  });
5333
5368
  } finally {
5334
5369
  devHotkeysSession?.restore();