weapp-vite 6.18.7 → 6.19.0

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-B5rRMSjV.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-B5rRMSjV.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-BgstESAr.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
  }
@@ -2827,6 +2830,27 @@ function terminateStaleSassEmbeddedProcess() {
2827
2830
  function emitDashboardEvents$1(handle, events) {
2828
2831
  handle?.emitRuntimeEvents(events);
2829
2832
  }
2833
+ function normalizeBuildSourcemap(value) {
2834
+ if (value === "true") return true;
2835
+ if (value === "false") return false;
2836
+ return value;
2837
+ }
2838
+ function normalizeBuildMinify(value) {
2839
+ if (value === "true") return true;
2840
+ if (value === "false") return false;
2841
+ return value;
2842
+ }
2843
+ function hasCliOption(options, key) {
2844
+ return Object.prototype.hasOwnProperty.call(options, key);
2845
+ }
2846
+ function createBuildInlineConfig(options) {
2847
+ const build = {};
2848
+ if (typeof options.outDir === "string") build.outDir = options.outDir;
2849
+ if (hasCliOption(options, "sourcemap")) build.sourcemap = normalizeBuildSourcemap(options.sourcemap);
2850
+ if (hasCliOption(options, "minify")) build.minify = normalizeBuildMinify(options.minify);
2851
+ if (typeof options.emptyOutDir === "boolean") build.emptyOutDir = options.emptyOutDir;
2852
+ return Object.keys(build).length ? { build } : void 0;
2853
+ }
2830
2854
  function shouldScheduleCompletedProductionBuildExit(options, analyzeHandle) {
2831
2855
  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
2856
  }
@@ -2847,7 +2871,10 @@ function registerBuildCommand(cli) {
2847
2871
  const cwd = root ?? process.cwd();
2848
2872
  const configFile = resolveConfigFile(options);
2849
2873
  targets = resolveRuntimeTargets(options);
2850
- const inlineConfig = createInlineConfig(targets, { scope: options.scope });
2874
+ const inlineConfig = createInlineConfig(targets, {
2875
+ scope: options.scope,
2876
+ inlineConfig: createBuildInlineConfig(options)
2877
+ });
2851
2878
  ctx = await createCompilerContext({
2852
2879
  cwd,
2853
2880
  mode: options.mode ?? "production",
@@ -3142,6 +3169,7 @@ let activeForwardConsoleSession;
3142
3169
  let activeForwardConsoleBridgeOptions;
3143
3170
  const FORWARD_CONSOLE_RETRY_DELAY_MS = 1e3;
3144
3171
  const FORWARD_CONSOLE_RETRY_TIMES = 5;
3172
+ const FORWARD_CONSOLE_START_TIMEOUT_MS = 12e4;
3145
3173
  async function detectAgent() {
3146
3174
  try {
3147
3175
  const result = await determineAgent();
@@ -3242,6 +3270,7 @@ async function startForwardConsoleBridge(options) {
3242
3270
  logLevels: options.logLevels,
3243
3271
  openedOnly: options.openedOnly,
3244
3272
  port: options.port,
3273
+ timeout: options.timeout,
3245
3274
  unhandledErrors: options.unhandledErrors,
3246
3275
  onReady: () => {
3247
3276
  const suffix = options.agentName ? `(AI 终端:${options.agentName})` : "";
@@ -3293,6 +3322,7 @@ async function maybeStartForwardConsole(options) {
3293
3322
  color: !resolved.agentName,
3294
3323
  projectPath,
3295
3324
  port: resolveProjectAutomatorPort(projectPath),
3325
+ timeout: FORWARD_CONSOLE_START_TIMEOUT_MS,
3296
3326
  logLevels: resolved.logLevels,
3297
3327
  openedOnly: options.openedOnly,
3298
3328
  unhandledErrors: resolved.unhandledErrors,
@@ -4507,7 +4537,7 @@ function resolveRunnableHotkeyDefinition(input) {
4507
4537
  }
4508
4538
  //#endregion
4509
4539
  //#region package.json
4510
- var version = "6.18.7";
4540
+ var version = "6.19.0";
4511
4541
  //#endregion
4512
4542
  //#region src/cli/devHotkeys/format.ts
4513
4543
  const FULLWIDTH_ASCII_START = 65281;
@@ -5207,17 +5237,18 @@ function registerServeCommand(cli) {
5207
5237
  fallbackProjectPath: configService.cwd,
5208
5238
  openIde: async (projectPath, openOptions) => {
5209
5239
  const forceReopen = openOptions?.forceReopen === true;
5240
+ const useAutomatorOpen = forceReopen || openOptions?.useAutomatorOpen === true;
5210
5241
  await openIde(configService.platform, projectPath, {
5211
5242
  loginRetry: options.loginRetry,
5212
5243
  loginRetryTimeout: options.loginRetryTimeout,
5213
5244
  nonInteractive: options.nonInteractive,
5214
5245
  openRecovery: false,
5215
- prepareAutomatorSession: forceReopen ? true : "connect-opened",
5246
+ prepareAutomatorSession: useAutomatorOpen ? true : "connect-opened",
5216
5247
  reuseOpenedProject: !forceReopen,
5217
5248
  skipAutomatorCompile: !forceReopen,
5218
5249
  skipPostOpenHealthCheck: true,
5219
5250
  trustProject: options.trustProject,
5220
- useAutomatorOpen: forceReopen
5251
+ useAutomatorOpen
5221
5252
  });
5222
5253
  writePostOpenSeparator();
5223
5254
  },
@@ -5328,7 +5359,8 @@ function registerServeCommand(cli) {
5328
5359
  try {
5329
5360
  await miniProgramDevActions.openIde({
5330
5361
  forceOpen: true,
5331
- forceReopen: false
5362
+ forceReopen: false,
5363
+ useAutomatorOpen: options.trustProject !== false
5332
5364
  });
5333
5365
  } finally {
5334
5366
  devHotkeysSession?.restore();
@@ -1,4 +1,4 @@
1
- import { c as Resolver, s as ResolvedValue } from "./index-Bmclyjw8.mjs";
1
+ import { d as ResolvedValue, f as Resolver } from "./index-CaXAtb9e.mjs";
2
2
  import { t as AutoRoutes } from "./routes-C7fCmf92.mjs";
3
3
  import { MpPlatform, OutputExtensions } from "@weapp-core/shared";
4
4
  import { WeappAstConfig } from "@weapp-vite/ast";
@@ -312,7 +312,11 @@ interface NpmPluginPackageConfig {
312
312
  type JsFormat = 'cjs' | 'esm';
313
313
  type SharedChunkStrategy = 'hoist' | 'duplicate';
314
314
  type SharedChunkMode = 'common' | 'path' | 'inline';
315
- type SharedChunkDynamicImports = 'preserve' | 'inline';
315
+ /**
316
+ * @deprecated `inline` 当前会回退为 `preserve`,请改用 `preserve` 或 `native`。
317
+ */
318
+ type DeprecatedInlineDynamicImports = 'inline';
319
+ type SharedChunkDynamicImports = 'preserve' | 'native' | DeprecatedInlineDynamicImports;
316
320
  interface SharedChunkOverride {
317
321
  test: string | RegExp;
318
322
  mode: SharedChunkMode;
@@ -379,6 +383,15 @@ interface AutoImportComponents {
379
383
  vueComponentsModule?: string;
380
384
  }
381
385
  type AutoImportComponentsOption = AutoImportComponents | boolean;
386
+ /**
387
+ * @description 实验性的 uni-app 源码兼容配置。
388
+ */
389
+ interface WeappUniAppConfig {
390
+ /**
391
+ * @description 允许参与兼容转换的 npm 包名。项目源码始终参与转换。
392
+ */
393
+ include: string[];
394
+ }
382
395
  type EnhanceWxmlOptions = ScanWxmlOptions & HandleWxmlOptions;
383
396
  /**
384
397
  * @description WXML 扫描阶段配置
@@ -806,6 +819,10 @@ interface WeappViteConfig {
806
819
  wxml?: EnhanceOptions['wxml'];
807
820
  wxs?: EnhanceOptions['wxs'];
808
821
  autoImportComponents?: AutoImportComponentsOption;
822
+ /**
823
+ * 实验性的 uni-app 源码兼容层。默认关闭。
824
+ */
825
+ uniApp?: false | WeappUniAppConfig;
809
826
  enhance?: EnhanceOptions;
810
827
  debug?: WeappDebugConfig;
811
828
  hmr?: WeappHmrConfig;
@@ -944,7 +961,7 @@ interface DevModuleGraph {
944
961
  getModuleById: (id: string) => DevModuleNode | undefined;
945
962
  getModulesByFile: (file: string) => Set<DevModuleNode> | undefined;
946
963
  idToModuleMap?: Map<string, DevModuleNode>;
947
- invalidateModule: (module: DevModuleNode) => void;
964
+ invalidateModule(module: DevModuleNode): void;
948
965
  }
949
966
  interface DevServerGraphHost {
950
967
  moduleGraph: DevModuleGraph;
@@ -1323,6 +1340,7 @@ interface LoadConfigOptions {
1323
1340
  isDev: boolean;
1324
1341
  mode: string;
1325
1342
  emitDefaultAutoImportOutputs?: boolean;
1343
+ outputRoot?: string;
1326
1344
  pluginOnly?: boolean;
1327
1345
  inlineConfig?: InlineConfig;
1328
1346
  configFile?: string;
@@ -1996,4 +2014,4 @@ declare module 'vite' {
1996
2014
  */
1997
2015
  declare function defineConfig<T extends UserConfigExport>(config: T): T;
1998
2016
  //#endregion
1999
- export { WeappAnalyzeBudgetConfig as $, WebPlatform as $n, GenerateTemplateFileSource as $t, Ref as A, WeappLibFileName as An, WeappRouteRules as At, BindingErrorLike as B, WeappViteHostMeta as Bn, BuildNpmPackageMeta as Bt, LoadConfigOptions as C, SubPackageStyleConfigObject as Cn, WeappInjectWeapiConfig as Ct, MethodDefinitions$1 as D, WeappLibConfig as Dn, WeappNpmConfig as Dt, InlineConfig$1 as E, WeappLibComponentJson as En, WeappMcpConfig as Et, RolldownPlugin as F, WeappManagedServerTsconfigConfig as Fn, WeappWevuConfig as Ft, EntryJsonFragment as G, ResolveWeappViteTargetOptions as Gn, GenerateExtensionsOptions as Gt, BaseEntry as H, createWeappViteHostMeta as Hn, CopyGlobs as Ht, RolldownPluginOption as I, WeappManagedSharedTsconfigConfig as In, WeappWorkerConfig as It, ScanComponentItem as J, WeappVitePlatform as Jn, GenerateOptions as Jt, PageEntry as K, ResolvedWeappViteTarget as Kn, GenerateFileType as Kt, RolldownWatchOptions as L, WeappManagedTypeScriptConfig as Ln, Alias as Lt, RolldownBuild as M, WeappLibVueTscOptions as Mn, WeappVueConfig as Mt, RolldownOptions as N, WeappManagedAppTsconfigConfig as Nn, WeappVueTemplateConfig as Nt, Plugin$1 as O, WeappLibDtsOptions as On, WeappRequestRuntimeConfig as Ot, RolldownOutput$1 as P, WeappManagedNodeTsconfigConfig as Pn, WeappWebRuntimeConfig as Pt, UserConfig$2 as Q, WeappViteTargetKind as Qn, GenerateTemplateFactory as Qt, RolldownWatcher$1 as R, WeappWebConfig as Rn, AliasOptions as Rt, CompilerContext as S, SubPackageStyleConfigEntry as Sn, WeappInjectRequestGlobalsTarget as St, ConfigEnv$1 as T, SubPackageStyleScope as Tn, WeappInjectWebRuntimeGlobalsTarget as Tt, ComponentEntry as U, isWeappViteHost as Un, CopyOptions as Ut, AppEntry as V, applyWeappViteHostMeta as Vn, ChunksConfig as Vt, Entry as W, resolveWeappViteHostMeta as Wn, GenerateDirsOptions as Wt, ProjectConfig as X, WeappViteTargetDescriptor as Xn, GenerateTemplateContext as Xt, WxmlDep as Y, WeappViteRuntime as Yn, GenerateTemplate as Yt, SubPackageMetaValue as Z, WeappViteTargetInput as Zn, GenerateTemplateEntry as Zt, definePageJson as _, SharedChunkDynamicImports as _n, WeappAutoRoutesIncludePattern as _t, UserConfigFnNoEnvPlain as a, JsonMergeContext as an, WeappViteConfig as at, ChangeEvent as b, SharedChunkStrategy as bn, WeappHmrConfig as bt, UserConfigFnPromise as c, JsonMergeStrategy as cn, EnhanceOptions as ct, Component$1 as d, NpmDependencyPattern as dn, MultiPlatformConfig as dt, GenerateTemplateInlineSource as en, getSupportedWeappVitePlatforms as er, WeappAnalyzeConfig as et, Page$1 as f, NpmMainPackageConfig as fn, ScanWxmlOptions as ft, defineComponentJson as g, ResolvedAlias as gn, WeappAutoRoutesInclude as gt, defineAppJson as h, NpmSubPackageConfig as hn, WeappAutoRoutesConfig as ht, UserConfigFnNoEnv as i, JsonConfig as in, WeappForwardConsoleLogLevel as it, ResolvedConfig as j, WeappLibInternalDtsOptions as jn, WeappSubPackageConfig as jt, PluginOption as k, WeappLibEntryContext as kn, WeappRouteRule as kt, defineConfig as l, MpPlatform$1 as ln, EnhanceWxmlOptions as lt, Theme$1 as m, NpmStrategy as mn, WeappAppPreludeMode as mt, UserConfigExport as n, GenerateTemplatesConfig as nn, isWebPlatform as nr, WeappDebugConfig as nt, UserConfigFnObject as o, JsonMergeFunction as on, AutoImportComponents as ot, Sitemap$1 as p, NpmPluginPackageConfig as pn, WeappAppPreludeConfig as pt, ComponentsMap as q, WEB_PLATFORM_ALIASES as qn, GenerateFilenamesOptions as qt, UserConfigFn as r, JsFormat as rn, resolveWeappViteTarget as rr, WeappForwardConsoleConfig as rt, UserConfigFnObjectPlain as s, JsonMergeStage as sn, AutoImportComponentsOption as st, UserConfig$1 as t, GenerateTemplateScope as tn, getSupportedWeappViteTargetDescriptors as tr, WeappAnalyzeHistoryConfig as tt, App$1 as u, NpmBuildOptions as un, HandleWxmlOptions as ut, defineSitemapJson as v, SharedChunkMode as vn, WeappBuildScopeConfig as vt, ComputedDefinitions$1 as w, SubPackageStyleEntry as wn, WeappInjectWebRuntimeGlobalsConfig as wt, WeappVitePluginApi as x, SubPackage as xn, WeappInjectRequestGlobalsConfig as xt, defineThemeJson as y, SharedChunkOverride as yn, WeappBuildScopeObjectConfig as yt, ViteDevServer$1 as z, WEAPP_VITE_HOST_NAME as zn, AlipayNpmMode as zt };
2017
+ export { WeappAnalyzeBudgetConfig as $, WeappViteTargetInput as $n, GenerateTemplateEntry as $t, Ref as A, WeappLibDtsOptions as An, WeappRouteRules as At, BindingErrorLike as B, WeappWebConfig as Bn, AlipayNpmMode as Bt, LoadConfigOptions as C, SubPackage as Cn, WeappInjectWeapiConfig as Ct, MethodDefinitions$1 as D, SubPackageStyleScope as Dn, WeappNpmConfig as Dt, InlineConfig$1 as E, SubPackageStyleEntry as En, WeappMcpConfig as Et, RolldownPlugin as F, WeappManagedAppTsconfigConfig as Fn, WeappWebRuntimeConfig as Ft, EntryJsonFragment as G, isWeappViteHost as Gn, DeprecatedInlineDynamicImports as Gt, BaseEntry as H, WeappViteHostMeta as Hn, ChunksConfig as Ht, RolldownPluginOption as I, WeappManagedNodeTsconfigConfig as In, WeappWevuConfig as It, ScanComponentItem as J, ResolvedWeappViteTarget as Jn, GenerateFileType as Jt, PageEntry as K, resolveWeappViteHostMeta as Kn, GenerateDirsOptions as Kt, RolldownWatchOptions as L, WeappManagedServerTsconfigConfig as Ln, WeappWorkerConfig as Lt, RolldownBuild as M, WeappLibFileName as Mn, WeappUniAppConfig as Mt, RolldownOptions as N, WeappLibInternalDtsOptions as Nn, WeappVueConfig as Nt, Plugin$1 as O, WeappLibComponentJson as On, WeappRequestRuntimeConfig as Ot, RolldownOutput$1 as P, WeappLibVueTscOptions as Pn, WeappVueTemplateConfig as Pt, UserConfig$2 as Q, WeappViteTargetDescriptor as Qn, GenerateTemplateContext as Qt, RolldownWatcher$1 as R, WeappManagedSharedTsconfigConfig as Rn, Alias as Rt, CompilerContext as S, SharedChunkStrategy as Sn, WeappInjectRequestGlobalsTarget as St, ConfigEnv$1 as T, SubPackageStyleConfigObject as Tn, WeappInjectWebRuntimeGlobalsTarget as Tt, ComponentEntry as U, applyWeappViteHostMeta as Un, CopyGlobs as Ut, AppEntry as V, WEAPP_VITE_HOST_NAME as Vn, BuildNpmPackageMeta as Vt, Entry as W, createWeappViteHostMeta as Wn, CopyOptions as Wt, ProjectConfig as X, WeappVitePlatform as Xn, GenerateOptions as Xt, WxmlDep as Y, WEB_PLATFORM_ALIASES as Yn, GenerateFilenamesOptions as Yt, SubPackageMetaValue as Z, WeappViteRuntime as Zn, GenerateTemplate as Zt, definePageJson as _, NpmSubPackageConfig as _n, WeappAutoRoutesIncludePattern as _t, UserConfigFnNoEnvPlain as a, JsFormat as an, resolveWeappViteTarget as ar, WeappViteConfig as at, ChangeEvent as b, SharedChunkMode as bn, WeappHmrConfig as bt, UserConfigFnPromise as c, JsonMergeFunction as cn, EnhanceOptions as ct, Component$1 as d, MpPlatform$1 as dn, MultiPlatformConfig as dt, GenerateTemplateFactory as en, WeappViteTargetKind as er, WeappAnalyzeConfig as et, Page$1 as f, NpmBuildOptions as fn, ScanWxmlOptions as ft, defineComponentJson as g, NpmStrategy as gn, WeappAutoRoutesInclude as gt, defineAppJson as h, NpmPluginPackageConfig as hn, WeappAutoRoutesConfig as ht, UserConfigFnNoEnv as i, GenerateTemplatesConfig as in, isWebPlatform as ir, WeappForwardConsoleLogLevel as it, ResolvedConfig as j, WeappLibEntryContext as jn, WeappSubPackageConfig as jt, PluginOption as k, WeappLibConfig as kn, WeappRouteRule as kt, defineConfig as l, JsonMergeStage as ln, EnhanceWxmlOptions as lt, Theme$1 as m, NpmMainPackageConfig as mn, WeappAppPreludeMode as mt, UserConfigExport as n, GenerateTemplateInlineSource as nn, getSupportedWeappVitePlatforms as nr, WeappDebugConfig as nt, UserConfigFnObject as o, JsonConfig as on, AutoImportComponents as ot, Sitemap$1 as p, NpmDependencyPattern as pn, WeappAppPreludeConfig as pt, ComponentsMap as q, ResolveWeappViteTargetOptions as qn, GenerateExtensionsOptions as qt, UserConfigFn as r, GenerateTemplateScope as rn, getSupportedWeappViteTargetDescriptors as rr, WeappForwardConsoleConfig as rt, UserConfigFnObjectPlain as s, JsonMergeContext as sn, AutoImportComponentsOption as st, UserConfig$1 as t, GenerateTemplateFileSource as tn, WebPlatform as tr, WeappAnalyzeHistoryConfig as tt, App$1 as u, JsonMergeStrategy as un, HandleWxmlOptions as ut, defineSitemapJson as v, ResolvedAlias as vn, WeappBuildScopeConfig as vt, ComputedDefinitions$1 as w, SubPackageStyleConfigEntry as wn, WeappInjectWebRuntimeGlobalsConfig as wt, WeappVitePluginApi as x, SharedChunkOverride as xn, WeappInjectRequestGlobalsConfig as xt, defineThemeJson as y, SharedChunkDynamicImports as yn, WeappBuildScopeObjectConfig as yt, ViteDevServer$1 as z, WeappManagedTypeScriptConfig as zn, AliasOptions as zt };
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { Bn as WeappViteHostMeta, Hn as createWeappViteHostMeta, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Yn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as WEAPP_VITE_HOST_NAME } from "./config-DEdY6_Qn.mjs";
1
+ import { Gn as isWeappViteHost, Hn as WeappViteHostMeta, Kn as resolveWeappViteHostMeta, Un as applyWeappViteHostMeta, Vn as WEAPP_VITE_HOST_NAME, Wn as createWeappViteHostMeta, Zn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-CKToDk5V.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 };