weapp-vite 6.16.3 → 6.16.4

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.
@@ -1,4 +1,4 @@
1
- import { d as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-C775dw5P.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-CoTaL8he.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 isPathInside, S as shouldPassPlatformArgToIdeOpen, _ as createCjsConfigLoadError, b as normalizeMiniPlatform, c as createSharedBuildConfig, f as resolveWeappConfigFile, g as parseCommentJson, h as loadViteConfigFile, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as getProjectConfigFileName, n as syncProjectSupportFiles, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, u as resolveHmrProfileJsonPath, v as DEFAULT_MP_PLATFORM, x as resolveMiniPlatform, y as getDefaultIdeProjectRoot } from "./createContext-C775dw5P.mjs";
1
+ import { C as getDefaultIdeProjectRoot, S as createCjsConfigLoadError, T as isPathInside, _ as resolveWeappConfigFile, b as loadViteConfigFile, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as checkRuntime, w as shouldPassPlatformArgToIdeOpen, x as parseCommentJson, y as getProjectConfigFileName } from "./createContext-CoTaL8he.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
3
- import { h as VERSION } from "./file-CueQM5Yi.mjs";
3
+ import { h as VERSION } from "./file-D57m5ljp.mjs";
4
4
  import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-DV3K2AVD.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -1127,7 +1127,8 @@ function createDashboardRuntimeEvent(input) {
1127
1127
  timestamp: formatEventTimestamp(),
1128
1128
  source: input.source ?? "weapp-vite",
1129
1129
  durationMs: input.durationMs,
1130
- tags: input.tags
1130
+ tags: input.tags,
1131
+ profile: input.profile
1131
1132
  };
1132
1133
  }
1133
1134
  function readDashboardManifest(packageJsonPath) {
@@ -1553,7 +1554,7 @@ function isUiEnabled(options) {
1553
1554
  function logRuntimeTarget(targets, options = {}) {
1554
1555
  if (options.silent) return;
1555
1556
  if (targets.label === "config") {
1556
- const resolvedPlatform = targets.mpPlatform ?? options.resolvedConfigPlatform;
1557
+ const resolvedPlatform = targets.platform ?? options.resolvedConfigPlatform;
1557
1558
  if (resolvedPlatform) {
1558
1559
  logger_default.info(`目标平台:${colors.green(resolvedPlatform)}`);
1559
1560
  return;
@@ -1565,56 +1566,18 @@ function logRuntimeTarget(targets, options = {}) {
1565
1566
  }
1566
1567
  function resolveRuntimeTargets(options) {
1567
1568
  const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
1568
- if (!rawPlatform) return {
1569
- runMini: true,
1570
- runWeb: false,
1571
- mpPlatform: void 0,
1572
- label: "config",
1573
- rawPlatform
1574
- };
1575
- const normalized = normalizeMiniPlatform(rawPlatform);
1576
- const lowerRawPlatform = rawPlatform.toLowerCase();
1577
- if (lowerRawPlatform === "all" || lowerRawPlatform === "both") return {
1578
- runMini: true,
1579
- runWeb: true,
1580
- mpPlatform: void 0,
1581
- label: "weapp + web",
1582
- rawPlatform
1583
- };
1584
- if (!normalized) return {
1585
- runMini: true,
1586
- runWeb: false,
1587
- mpPlatform: DEFAULT_MP_PLATFORM,
1588
- label: DEFAULT_MP_PLATFORM,
1589
- rawPlatform
1590
- };
1591
- if (normalized === "h5" || normalized === "web") return {
1592
- runMini: false,
1593
- runWeb: true,
1594
- mpPlatform: void 0,
1595
- label: normalized === "h5" ? "h5" : "web",
1596
- rawPlatform
1597
- };
1598
- const mpPlatform = resolveMiniPlatform(normalized);
1599
- if (mpPlatform) return {
1600
- runMini: true,
1601
- runWeb: false,
1602
- mpPlatform,
1603
- label: mpPlatform,
1604
- rawPlatform
1605
- };
1606
- logger_default.warn(`未识别的平台 "${colors.yellow(rawPlatform)}",已回退到 ${colors.green(DEFAULT_MP_PLATFORM)}`);
1569
+ const target = resolveWeappViteTarget(rawPlatform, { warn: (message) => logger_default.warn(message) });
1607
1570
  return {
1608
- runMini: true,
1609
- runWeb: false,
1610
- mpPlatform: DEFAULT_MP_PLATFORM,
1611
- label: DEFAULT_MP_PLATFORM,
1571
+ runMini: target.runMini,
1572
+ runWeb: target.runWeb,
1573
+ platform: target.kind === "miniprogram" ? target.platform : void 0,
1574
+ label: target.label,
1612
1575
  rawPlatform
1613
1576
  };
1614
1577
  }
1615
- function createInlineConfig(mpPlatform) {
1616
- if (!mpPlatform) return;
1617
- return { weapp: { platform: mpPlatform } };
1578
+ function createInlineConfig(platform) {
1579
+ if (!platform) return;
1580
+ return { weapp: { platform } };
1618
1581
  }
1619
1582
  //#endregion
1620
1583
  //#region src/cli/commands/analyze.ts
@@ -1777,7 +1740,7 @@ function printHmrProfileAnalysisSummary(result, configService) {
1777
1740
  }
1778
1741
  }
1779
1742
  function registerAnalyzeCommand(cli) {
1780
- cli.command("analyze [root]", "analyze 两端包体与源码映射").option("--hmr-profile [file]", `[string | boolean] 分析 HMR JSONL profile,省略值时优先读取配置,否则回退到默认路径`).option("--json", `[boolean] 输出 JSON 结果`).option("--markdown", `[boolean] 输出 Markdown 报告`).option("--report <type>", `[string] 输出指定报告类型(pr)`).option("--budget-check", `[boolean] 检查 analyze 预算,超过预算时返回非 0 退出码`).option("--output <file>", `[string] 将分析结果写入指定文件(JSON 或 Markdown)`).option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).action(async (root, options) => {
1743
+ cli.command("analyze [root]", "analyze 两端包体与源码映射").option("--hmr-profile [file]", `[string | boolean] 分析 HMR JSONL profile,省略值时优先读取配置,否则回退到默认路径`).option("--json", `[boolean] 输出 JSON 结果`).option("--markdown", `[boolean] 输出 Markdown 报告`).option("--report <type>", `[string] 输出指定报告类型(pr)`).option("--budget-check", `[boolean] 检查 analyze 预算,超过预算时返回非 0 退出码`).option("--output <file>", `[string] 将分析结果写入指定文件(JSON 或 Markdown)`).option("-p, --platform <platform>", `[string] target platform (weapp | web)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).action(async (root, options) => {
1781
1744
  filterDuplicateOptions(options);
1782
1745
  const configFile = resolveConfigFile(options);
1783
1746
  const outputJson = coerceBooleanOption(options.json);
@@ -1787,7 +1750,7 @@ function registerAnalyzeCommand(cli) {
1787
1750
  if (reportType && !outputPrReport) throw new Error(`不支持的 analyze report 类型:${reportType}`);
1788
1751
  const budgetCheck = coerceBooleanOption(options.budgetCheck);
1789
1752
  const targets = resolveRuntimeTargets(options);
1790
- const inlineConfig = createInlineConfig(targets.mpPlatform);
1753
+ const inlineConfig = createInlineConfig(targets.platform);
1791
1754
  try {
1792
1755
  const ctx = await createCompilerContext({
1793
1756
  cwd: root,
@@ -1818,7 +1781,7 @@ function registerAnalyzeCommand(cli) {
1818
1781
  return;
1819
1782
  }
1820
1783
  if (targets.runWeb) {
1821
- const webResult = createWebAnalyzeResult(ctx.configService, { platform: targets.label === "web" ? "web" : "h5" });
1784
+ const webResult = createWebAnalyzeResult(ctx.configService, { platform: "web" });
1822
1785
  const writtenPath = await writeAnalyzeResult(webResult, outputOption, ctx.configService);
1823
1786
  if (outputJson) {
1824
1787
  if (!writtenPath) process.stdout.write(`${JSON.stringify(webResult, null, 2)}\n`);
@@ -1826,7 +1789,7 @@ function registerAnalyzeCommand(cli) {
1826
1789
  return;
1827
1790
  }
1828
1791
  if (!targets.runMini) {
1829
- logger_default.warn("当前命令不支持该平台,请通过 --platform weapp 或 --platform h5 指定目标。");
1792
+ logger_default.warn("当前命令不支持该平台,请通过 --platform weapp 或 --platform web 指定目标。");
1830
1793
  return;
1831
1794
  }
1832
1795
  const previousResult = await readLatestAnalyzeHistorySnapshot(ctx.configService);
@@ -2359,11 +2322,11 @@ function emitDashboardEvents$1(handle, events) {
2359
2322
  handle?.emitRuntimeEvents(events);
2360
2323
  }
2361
2324
  function registerBuildCommand(cli) {
2362
- cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("-p, --platform <platform>", `[string] target platform (weapp | h5 | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: esbuild)").option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 输出分包分析仪表盘`, { default: false }).action(async (root, options) => {
2325
+ cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("-p, --platform <platform>", `[string] target platform (weapp | web | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: esbuild)").option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 输出分包分析仪表盘`, { default: false }).action(async (root, options) => {
2363
2326
  filterDuplicateOptions(options);
2364
2327
  const configFile = resolveConfigFile(options);
2365
2328
  const targets = resolveRuntimeTargets(options);
2366
- const inlineConfig = createInlineConfig(targets.mpPlatform);
2329
+ const inlineConfig = createInlineConfig(targets.platform);
2367
2330
  const ctx = await createCompilerContext({
2368
2331
  cwd: root,
2369
2332
  mode: options.mode ?? "production",
@@ -2887,7 +2850,7 @@ async function runIdeCommand(action, root, options) {
2887
2850
  const resolved = await resolveIdeCommandContext({
2888
2851
  configFile,
2889
2852
  mode: options.mode ?? "development",
2890
- platform: targets.mpPlatform,
2853
+ platform: targets.platform,
2891
2854
  projectPath: root,
2892
2855
  cliPlatform: targets.rawPlatform
2893
2856
  });
@@ -2960,7 +2923,7 @@ async function runIdeCommand(action, root, options) {
2960
2923
  * @description 注册 IDE 相关子命令。
2961
2924
  */
2962
2925
  function registerIdeCommand(cli) {
2963
- cli.command("ide [action] [root]", "run Wechat DevTools utility actions and log bridge commands").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)").option("--ticket <value>", "[string] ticket used by `ide ticket:set`").option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).action(async (action, root, options) => {
2926
+ cli.command("ide [action] [root]", "run Wechat DevTools utility actions and log bridge commands").option("-o, --open", "[boolean] open ide before attaching log bridge").option("-p, --platform <platform>", "[string] target platform (weapp | web)").option("--project-config <path>", "[string] project config path (miniprogram only)").option("--ticket <value>", "[string] ticket used by `ide ticket:set`").option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).action(async (action, root, options) => {
2964
2927
  await runIdeCommand(action, root, options);
2965
2928
  });
2966
2929
  }
@@ -3387,14 +3350,14 @@ function registerNpmCommand(cli) {
3387
3350
  //#endregion
3388
3351
  //#region src/cli/commands/open.ts
3389
3352
  function registerOpenCommand(cli) {
3390
- cli.command("open [root]").option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).action(async (root, options) => {
3353
+ cli.command("open [root]").option("-p, --platform <platform>", `[string] target platform (weapp | web)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).action(async (root, options) => {
3391
3354
  filterDuplicateOptions(options);
3392
3355
  const configFile = resolveConfigFile(options);
3393
3356
  const targets = resolveRuntimeTargets(options);
3394
3357
  const { cwd, platform, projectPath, mpDistRoot, weappViteConfig } = await resolveIdeCommandContext({
3395
3358
  configFile,
3396
3359
  mode: options.mode ?? "development",
3397
- platform: targets.mpPlatform,
3360
+ platform: targets.platform,
3398
3361
  projectPath: root,
3399
3362
  cliPlatform: targets.rawPlatform
3400
3363
  });
@@ -3421,7 +3384,7 @@ function resolvePreparePlatform(options) {
3421
3384
  return typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
3422
3385
  }
3423
3386
  function registerPrepareCommand(cli) {
3424
- cli.command("prepare [...input]", "generate .weapp-vite support files").option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).action(async (input, options) => {
3387
+ cli.command("prepare [...input]", "generate .weapp-vite support files").option("-p, --platform <platform>", `[string] target platform (weapp | web)`).action(async (input, options) => {
3425
3388
  try {
3426
3389
  filterDuplicateOptions(options);
3427
3390
  const cwd = path.resolve(resolvePrepareRoot(input));
@@ -3653,7 +3616,7 @@ function resolveRunnableHotkeyDefinition(input) {
3653
3616
  }
3654
3617
  //#endregion
3655
3618
  //#region package.json
3656
- var version = "6.16.3";
3619
+ var version = "6.16.4";
3657
3620
  //#endregion
3658
3621
  //#region src/cli/devHotkeys/format.ts
3659
3622
  const FULLWIDTH_ASCII_START = 65281;
@@ -3953,6 +3916,27 @@ const REG_DIST_POSIX_SEP = /\\/g;
3953
3916
  function emitDashboardEvents(handle, events) {
3954
3917
  handle?.emitRuntimeEvents(events);
3955
3918
  }
3919
+ function formatHmrProfileFile(profile) {
3920
+ return profile.sourceRootFile ?? profile.relativeFile ?? profile.file ?? "未知文件";
3921
+ }
3922
+ function createHmrProfileEvent(profile) {
3923
+ if (!profile || typeof profile.totalMs !== "number") return;
3924
+ const file = formatHmrProfileFile(profile);
3925
+ const counts = [
3926
+ typeof profile.dirtyCount === "number" ? `dirty ${profile.dirtyCount}` : void 0,
3927
+ typeof profile.pendingCount === "number" ? `pending ${profile.pendingCount}` : void 0,
3928
+ typeof profile.emittedCount === "number" ? `emitted ${profile.emittedCount}` : void 0
3929
+ ].filter(Boolean).join(" / ");
3930
+ return {
3931
+ kind: "hmr",
3932
+ level: profile.totalMs >= 1e3 ? "warning" : "success",
3933
+ title: "mini hmr rebuild completed",
3934
+ detail: counts ? `${file} 已完成热更新重建(${counts})。` : `${file} 已完成热更新重建。`,
3935
+ durationMs: profile.totalMs,
3936
+ tags: ["hmr", "rebuild"],
3937
+ profile
3938
+ };
3939
+ }
3956
3940
  function hasAnalyzeData(result) {
3957
3941
  return result.packages.length > 0 || result.modules.length > 0;
3958
3942
  }
@@ -4053,7 +4037,7 @@ function createAnalyzeController(options) {
4053
4037
  mode: configService.mode,
4054
4038
  isDev: false,
4055
4039
  configFile,
4056
- inlineConfig: createInlineConfig(targets.mpPlatform),
4040
+ inlineConfig: createInlineConfig(targets.platform),
4057
4041
  cliPlatform: targets.rawPlatform,
4058
4042
  projectConfigPath: cliOptions.projectConfig,
4059
4043
  syncSupportFiles: false
@@ -4122,6 +4106,8 @@ function createAnalyzeController(options) {
4122
4106
  let updating = false;
4123
4107
  if (analyzeHandle && buildResult && typeof buildResult.on === "function") buildResult.on("event", (event) => {
4124
4108
  if (event.code !== "END" || updating) return;
4109
+ const hmrEvent = createHmrProfileEvent(ctx.runtimeState.build.hmr.recentProfiles.at(-1));
4110
+ if (hmrEvent) emitDashboardEvents(analyzeHandle, [hmrEvent]);
4125
4111
  updating = true;
4126
4112
  triggerAnalyzeUpdate("watch").finally(() => {
4127
4113
  updating = false;
@@ -4229,11 +4215,11 @@ function waitForServeShutdownSignal() {
4229
4215
  //#endregion
4230
4216
  //#region src/cli/commands/serve/index.ts
4231
4217
  function registerServeCommand(cli) {
4232
- cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("-p, --platform <platform>", `[string] target platform (weapp | h5 | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--host [host]", `[string] web dev server host`).option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).action(async (root, options) => {
4218
+ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("-p, --platform <platform>", `[string] target platform (weapp | web | all)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--trust-project", "[boolean] auto trust Wechat DevTools project on open", { default: true }).option("--host [host]", `[string] web dev server host`).option("--ui", `[boolean] 启动调试 UI(当前提供分析视图)`, { default: false }).option("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).action(async (root, options) => {
4233
4219
  filterDuplicateOptions(options);
4234
4220
  const configFile = resolveConfigFile(options);
4235
4221
  const targets = resolveRuntimeTargets(options);
4236
- let inlineConfig = createInlineConfig(targets.mpPlatform);
4222
+ let inlineConfig = createInlineConfig(targets.platform);
4237
4223
  if (targets.runWeb) {
4238
4224
  const host = resolveWebHost(options.host);
4239
4225
  if (host !== void 0) inlineConfig = {
@@ -19,15 +19,45 @@ import { WeappWebPluginOptions } from "@weapp-vite/web/plugin";
19
19
  import { CompilerOptions } from "typescript";
20
20
  import { DetectResult } from "package-manager-detector";
21
21
 
22
+ //#region src/runtimeTarget.d.ts
23
+ type WebPlatform = 'web';
24
+ type WeappViteRuntime = 'miniprogram' | 'web';
25
+ type WeappVitePlatform = MpPlatform$1 | WebPlatform;
26
+ type WeappViteTargetInput = WeappVitePlatform | 'h5' | 'all' | 'both' | (string & {});
27
+ type WeappViteTargetKind = WeappViteRuntime | 'all';
28
+ interface ResolvedWeappViteTarget {
29
+ kind: WeappViteTargetKind;
30
+ runMini: boolean;
31
+ runWeb: boolean;
32
+ platform?: WeappVitePlatform;
33
+ label: string;
34
+ raw?: string;
35
+ }
36
+ interface ResolveWeappViteTargetOptions {
37
+ fallbackMiniPlatform?: MpPlatform$1;
38
+ warn?: (message: string) => void;
39
+ }
40
+ interface WeappViteTargetDescriptor {
41
+ platform: WeappVitePlatform;
42
+ runtime: WeappViteRuntime;
43
+ aliases: readonly string[];
44
+ label: string;
45
+ }
46
+ declare const WEB_PLATFORM_ALIASES: readonly string[];
47
+ declare function isWebPlatform(input?: string | null): boolean;
48
+ declare function getSupportedWeappViteTargetDescriptors(): readonly WeappViteTargetDescriptor[];
49
+ declare function getSupportedWeappVitePlatforms(): readonly WeappVitePlatform[];
50
+ declare function resolveWeappViteTarget(input?: WeappViteTargetInput | null, options?: ResolveWeappViteTargetOptions): ResolvedWeappViteTarget;
51
+ //#endregion
22
52
  //#region src/pluginHost.d.ts
23
53
  declare const WEAPP_VITE_HOST_NAME = "weapp-vite";
24
- type WeappViteRuntime = 'miniprogram' | 'web';
25
54
  interface WeappViteHostMeta {
26
55
  name: typeof WEAPP_VITE_HOST_NAME;
27
56
  runtime: WeappViteRuntime;
57
+ platform?: WeappVitePlatform;
28
58
  }
29
- declare function createWeappViteHostMeta(runtime: WeappViteRuntime): WeappViteHostMeta;
30
- declare function applyWeappViteHostMeta(config: InlineConfig, runtime: WeappViteRuntime): InlineConfig;
59
+ declare function createWeappViteHostMeta(runtime: WeappViteRuntime, platform?: WeappVitePlatform): WeappViteHostMeta;
60
+ declare function applyWeappViteHostMeta(config: InlineConfig, runtime: WeappViteRuntime, platform?: WeappVitePlatform): InlineConfig;
31
61
  declare function resolveWeappViteHostMeta(config: Pick<InlineConfig, 'weappVite'> | undefined): WeappViteHostMeta | undefined;
32
62
  declare function isWeappViteHost(config: Pick<InlineConfig, 'weappVite'> | undefined): boolean;
33
63
  declare module 'vite' {
@@ -1452,7 +1482,13 @@ interface RuntimeState {
1452
1482
  didEmitAllEntries: boolean;
1453
1483
  lastEmittedEntryIds: Set<string>;
1454
1484
  recentProfiles: Array<{
1485
+ timestamp?: string;
1455
1486
  totalMs: number;
1487
+ eventId?: string;
1488
+ event?: string;
1489
+ file?: string;
1490
+ relativeFile?: string;
1491
+ sourceRootFile?: string;
1456
1492
  buildCoreMs?: number;
1457
1493
  transformMs?: number;
1458
1494
  writeMs?: number;
@@ -1462,6 +1498,8 @@ interface RuntimeState {
1462
1498
  dirtyCount?: number;
1463
1499
  pendingCount?: number;
1464
1500
  emittedCount?: number;
1501
+ dirtyReasonSummary?: string[];
1502
+ pendingReasonSummary?: string[];
1465
1503
  }>;
1466
1504
  profile: {
1467
1505
  eventId?: string;
@@ -1712,4 +1750,4 @@ declare module 'vite' {
1712
1750
  */
1713
1751
  declare function defineConfig<T extends UserConfigExport>(config: T): T;
1714
1752
  //#endregion
1715
- export { WeappAnalyzeBudgetConfig as $, GenerateTemplateScope as $t, Ref as A, WeappLibVueTscOptions as An, WeappVueConfig as At, BindingErrorLike as B, applyWeappViteHostMeta as Bn, CopyGlobs as Bt, LoadConfigOptions as C, SubPackageStyleScope as Cn, WeappInjectWebRuntimeGlobalsTarget as Ct, MethodDefinitions$1 as D, WeappLibEntryContext as Dn, WeappRouteRule as Dt, InlineConfig$1 as E, WeappLibDtsOptions as En, WeappRequestRuntimeConfig as Et, RolldownPlugin as F, WeappManagedTypeScriptConfig as Fn, Alias as Ft, EntryJsonFragment as G, GenerateFilenamesOptions as Gt, BaseEntry as H, isWeappViteHost as Hn, GenerateDirsOptions as Ht, RolldownPluginOption as I, WeappWebConfig as In, AliasOptions as It, ScanComponentItem as J, GenerateTemplateContext as Jt, PageEntry as K, GenerateOptions as Kt, RolldownWatchOptions as L, WEAPP_VITE_HOST_NAME as Ln, AlipayNpmMode as Lt, RolldownBuild as M, WeappManagedNodeTsconfigConfig as Mn, WeappWebRuntimeConfig as Mt, RolldownOptions as N, WeappManagedServerTsconfigConfig as Nn, WeappWevuConfig as Nt, Plugin$1 as O, WeappLibFileName as On, WeappRouteRules as Ot, RolldownOutput$1 as P, WeappManagedSharedTsconfigConfig as Pn, WeappWorkerConfig as Pt, UserConfig$2 as Q, GenerateTemplateInlineSource as Qt, RolldownWatcher$1 as R, WeappViteHostMeta as Rn, BuildNpmPackageMeta as Rt, CompilerContext as S, SubPackageStyleEntry as Sn, WeappInjectWebRuntimeGlobalsConfig as St, ConfigEnv$1 as T, WeappLibConfig as Tn, WeappNpmConfig as Tt, ComponentEntry as U, resolveWeappViteHostMeta as Un, GenerateExtensionsOptions as Ut, AppEntry as V, createWeappViteHostMeta as Vn, CopyOptions as Vt, Entry as W, GenerateFileType as Wt, ProjectConfig as X, GenerateTemplateFactory as Xt, WxmlDep as Y, GenerateTemplateEntry as Yt, SubPackageMetaValue as Z, GenerateTemplateFileSource as Zt, definePageJson as _, SharedChunkOverride as _n, WeappAutoRoutesIncludePattern as _t, UserConfigFnNoEnvPlain as a, JsonMergeStage as an, WeappViteConfig as at, ChangeEvent as b, SubPackageStyleConfigEntry as bn, WeappInjectRequestGlobalsTarget as bt, UserConfigFnPromise as c, NpmBuildOptions as cn, EnhanceOptions as ct, Component$1 as d, NpmPluginPackageConfig as dn, MultiPlatformConfig as dt, GenerateTemplatesConfig as en, WeappAnalyzeConfig as et, Page$1 as f, NpmStrategy as fn, ScanWxmlOptions as ft, defineComponentJson as g, SharedChunkMode as gn, WeappAutoRoutesInclude as gt, defineAppJson as h, SharedChunkDynamicImports as hn, WeappAutoRoutesConfig as ht, UserConfigFnNoEnv as i, JsonMergeFunction as in, WeappForwardConsoleLogLevel as it, ResolvedConfig as j, WeappManagedAppTsconfigConfig as jn, WeappVueTemplateConfig as jt, PluginOption as k, WeappLibInternalDtsOptions as kn, WeappSubPackageConfig as kt, defineConfig as l, NpmDependencyPattern as ln, EnhanceWxmlOptions as lt, Theme$1 as m, ResolvedAlias as mn, WeappAppPreludeMode as mt, UserConfigExport as n, JsonConfig as nn, WeappDebugConfig as nt, UserConfigFnObject as o, JsonMergeStrategy as on, AutoImportComponents as ot, Sitemap$1 as p, NpmSubPackageConfig as pn, WeappAppPreludeConfig as pt, ComponentsMap as q, GenerateTemplate as qt, UserConfigFn as r, JsonMergeContext as rn, WeappForwardConsoleConfig as rt, UserConfigFnObjectPlain as s, MpPlatform$1 as sn, AutoImportComponentsOption as st, UserConfig$1 as t, JsFormat as tn, WeappAnalyzeHistoryConfig as tt, App$1 as u, NpmMainPackageConfig as un, HandleWxmlOptions as ut, defineSitemapJson as v, SharedChunkStrategy as vn, WeappHmrConfig as vt, ComputedDefinitions$1 as w, WeappLibComponentJson as wn, WeappMcpConfig as wt, WeappVitePluginApi as x, SubPackageStyleConfigObject as xn, WeappInjectWeapiConfig as xt, defineThemeJson as y, SubPackage as yn, WeappInjectRequestGlobalsConfig as yt, ViteDevServer$1 as z, WeappViteRuntime as zn, ChunksConfig as zt };
1753
+ export { WeappAnalyzeBudgetConfig as $, getSupportedWeappViteTargetDescriptors as $n, GenerateTemplateScope as $t, Ref as A, WeappLibVueTscOptions as An, WeappVueConfig as At, BindingErrorLike as B, createWeappViteHostMeta as Bn, CopyGlobs as Bt, LoadConfigOptions as C, SubPackageStyleScope as Cn, WeappInjectWebRuntimeGlobalsTarget as Ct, MethodDefinitions$1 as D, WeappLibEntryContext as Dn, WeappRouteRule as Dt, InlineConfig$1 as E, WeappLibDtsOptions as En, WeappRequestRuntimeConfig as Et, RolldownPlugin as F, WeappManagedTypeScriptConfig as Fn, Alias as Ft, EntryJsonFragment as G, WEB_PLATFORM_ALIASES as Gn, GenerateFilenamesOptions as Gt, BaseEntry as H, resolveWeappViteHostMeta as Hn, GenerateDirsOptions as Ht, RolldownPluginOption as I, WeappWebConfig as In, AliasOptions as It, ScanComponentItem as J, WeappViteTargetDescriptor as Jn, GenerateTemplateContext as Jt, PageEntry as K, WeappVitePlatform as Kn, GenerateOptions as Kt, RolldownWatchOptions as L, WEAPP_VITE_HOST_NAME as Ln, AlipayNpmMode as Lt, RolldownBuild as M, WeappManagedNodeTsconfigConfig as Mn, WeappWebRuntimeConfig as Mt, RolldownOptions as N, WeappManagedServerTsconfigConfig as Nn, WeappWevuConfig as Nt, Plugin$1 as O, WeappLibFileName as On, WeappRouteRules as Ot, RolldownOutput$1 as P, WeappManagedSharedTsconfigConfig as Pn, WeappWorkerConfig as Pt, UserConfig$2 as Q, getSupportedWeappVitePlatforms as Qn, GenerateTemplateInlineSource as Qt, RolldownWatcher$1 as R, WeappViteHostMeta as Rn, BuildNpmPackageMeta as Rt, CompilerContext as S, SubPackageStyleEntry as Sn, WeappInjectWebRuntimeGlobalsConfig as St, ConfigEnv$1 as T, WeappLibConfig as Tn, WeappNpmConfig as Tt, ComponentEntry as U, ResolveWeappViteTargetOptions as Un, GenerateExtensionsOptions as Ut, AppEntry as V, isWeappViteHost as Vn, CopyOptions as Vt, Entry as W, ResolvedWeappViteTarget as Wn, GenerateFileType as Wt, ProjectConfig as X, WeappViteTargetKind as Xn, GenerateTemplateFactory as Xt, WxmlDep as Y, WeappViteTargetInput as Yn, GenerateTemplateEntry as Yt, SubPackageMetaValue as Z, WebPlatform as Zn, GenerateTemplateFileSource as Zt, definePageJson as _, SharedChunkOverride as _n, WeappAutoRoutesIncludePattern as _t, UserConfigFnNoEnvPlain as a, JsonMergeStage as an, WeappViteConfig as at, ChangeEvent as b, SubPackageStyleConfigEntry as bn, WeappInjectRequestGlobalsTarget as bt, UserConfigFnPromise as c, NpmBuildOptions as cn, EnhanceOptions as ct, Component$1 as d, NpmPluginPackageConfig as dn, MultiPlatformConfig as dt, GenerateTemplatesConfig as en, isWebPlatform as er, WeappAnalyzeConfig as et, Page$1 as f, NpmStrategy as fn, ScanWxmlOptions as ft, defineComponentJson as g, SharedChunkMode as gn, WeappAutoRoutesInclude as gt, defineAppJson as h, SharedChunkDynamicImports as hn, WeappAutoRoutesConfig as ht, UserConfigFnNoEnv as i, JsonMergeFunction as in, WeappForwardConsoleLogLevel as it, ResolvedConfig as j, WeappManagedAppTsconfigConfig as jn, WeappVueTemplateConfig as jt, PluginOption as k, WeappLibInternalDtsOptions as kn, WeappSubPackageConfig as kt, defineConfig as l, NpmDependencyPattern as ln, EnhanceWxmlOptions as lt, Theme$1 as m, ResolvedAlias as mn, WeappAppPreludeMode as mt, UserConfigExport as n, JsonConfig as nn, WeappDebugConfig as nt, UserConfigFnObject as o, JsonMergeStrategy as on, AutoImportComponents as ot, Sitemap$1 as p, NpmSubPackageConfig as pn, WeappAppPreludeConfig as pt, ComponentsMap as q, WeappViteRuntime as qn, GenerateTemplate as qt, UserConfigFn as r, JsonMergeContext as rn, WeappForwardConsoleConfig as rt, UserConfigFnObjectPlain as s, MpPlatform$1 as sn, AutoImportComponentsOption as st, UserConfig$1 as t, JsFormat as tn, resolveWeappViteTarget as tr, WeappAnalyzeHistoryConfig as tt, App$1 as u, NpmMainPackageConfig as un, HandleWxmlOptions as ut, defineSitemapJson as v, SharedChunkStrategy as vn, WeappHmrConfig as vt, ComputedDefinitions$1 as w, WeappLibComponentJson as wn, WeappMcpConfig as wt, WeappVitePluginApi as x, SubPackageStyleConfigObject as xn, WeappInjectWeapiConfig as xt, defineThemeJson as y, SubPackage as yn, WeappInjectRequestGlobalsConfig as yt, ViteDevServer$1 as z, applyWeappViteHostMeta as zn, ChunksConfig as zt };
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { Bn as applyWeappViteHostMeta, Hn as isWeappViteHost, Ln as WEAPP_VITE_HOST_NAME, Rn as WeappViteHostMeta, Un as resolveWeappViteHostMeta, Vn as createWeappViteHostMeta, _ 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 WeappViteRuntime } from "./config-Deromcuk.mjs";
1
+ import { Bn as createWeappViteHostMeta, Hn as resolveWeappViteHostMeta, Ln as WEAPP_VITE_HOST_NAME, Rn as WeappViteHostMeta, Vn as isWeappViteHost, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, qn as WeappViteRuntime, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as applyWeappViteHostMeta } from "./config-CXABkCb8.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 };
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-D0HkutE0.mjs";
2
- import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
2
+ import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BEnGeaSo.mjs";
3
3
  import { t as defineConfig } from "./config-DJjSbpNX.mjs";
4
4
  export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
@@ -1,6 +1,6 @@
1
- import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
1
+ import { n as applyWeappViteHostMeta } from "./pluginHost-BEnGeaSo.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.mjs";
3
- import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-CueQM5Yi.mjs";
3
+ import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-D57m5ljp.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import path, { posix } from "pathe";
6
6
  import path$1, { normalize, relative, win32 } from "node:path";
@@ -10384,20 +10384,34 @@ function shouldHandleSnapshotSidecarFile(filePath) {
10384
10384
  }
10385
10385
  function createBuildService(ctx) {
10386
10386
  let lastHmrSlowTipProfileCount = 0;
10387
+ function createHmrProfileJsonSample(totalMs) {
10388
+ const profile = ctx.runtimeState.build.hmr.profile;
10389
+ const relativeFile = profile.file && ctx.configService ? ctx.configService.relativeCwd(profile.file) : void 0;
10390
+ const sourceRootFile = profile.file && ctx.configService ? ctx.configService.relativeAbsoluteSrcRoot(profile.file) : void 0;
10391
+ return {
10392
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10393
+ totalMs,
10394
+ eventId: profile.eventId,
10395
+ event: profile.event,
10396
+ file: profile.file,
10397
+ relativeFile,
10398
+ sourceRootFile,
10399
+ buildCoreMs: profile.buildCoreMs,
10400
+ transformMs: profile.transformMs,
10401
+ writeMs: profile.writeMs,
10402
+ watchToDirtyMs: profile.watchToDirtyMs,
10403
+ emitMs: profile.emitMs,
10404
+ sharedChunkResolveMs: profile.sharedChunkResolveMs,
10405
+ dirtyCount: profile.dirtyCount,
10406
+ pendingCount: profile.pendingCount,
10407
+ emittedCount: profile.emittedCount,
10408
+ dirtyReasonSummary: profile.dirtyReasonSummary,
10409
+ pendingReasonSummary: profile.pendingReasonSummary
10410
+ };
10411
+ }
10387
10412
  function recordHmrProfile(totalMs) {
10388
10413
  const hmrState = ctx.runtimeState.build.hmr;
10389
- hmrState.recentProfiles.push({
10390
- totalMs,
10391
- buildCoreMs: hmrState.profile.buildCoreMs,
10392
- transformMs: hmrState.profile.transformMs,
10393
- writeMs: hmrState.profile.writeMs,
10394
- watchToDirtyMs: hmrState.profile.watchToDirtyMs,
10395
- emitMs: hmrState.profile.emitMs,
10396
- sharedChunkResolveMs: hmrState.profile.sharedChunkResolveMs,
10397
- dirtyCount: hmrState.profile.dirtyCount,
10398
- pendingCount: hmrState.profile.pendingCount,
10399
- emittedCount: hmrState.profile.emittedCount
10400
- });
10414
+ hmrState.recentProfiles.push(createHmrProfileJsonSample(totalMs));
10401
10415
  if (hmrState.recentProfiles.length > 5) hmrState.recentProfiles.splice(0, hmrState.recentProfiles.length - 5);
10402
10416
  }
10403
10417
  function resetHmrProfile() {
@@ -10556,31 +10570,6 @@ function createBuildService(ctx) {
10556
10570
  logger_default.info(`检测到 HMR 重建明显变慢:当前 ${currentProfile.totalMs.toFixed(2)} ms,近${previousProfiles.length}次均值 ${previousAverage.toFixed(2)} ms${formatHmrPhaseRegressionHint(currentProfile, previousProfiles)};建议运行 weapp-vite analyze --hmr-profile 查看阶段统计。`);
10557
10571
  return true;
10558
10572
  }
10559
- function createHmrProfileJsonSample(totalMs) {
10560
- const profile = ctx.runtimeState.build.hmr.profile;
10561
- const relativeFile = profile.file && ctx.configService ? ctx.configService.relativeCwd(profile.file) : void 0;
10562
- const sourceRootFile = profile.file && ctx.configService ? ctx.configService.relativeAbsoluteSrcRoot(profile.file) : void 0;
10563
- return {
10564
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10565
- totalMs,
10566
- eventId: profile.eventId,
10567
- event: profile.event,
10568
- file: profile.file,
10569
- relativeFile,
10570
- sourceRootFile,
10571
- buildCoreMs: profile.buildCoreMs,
10572
- transformMs: profile.transformMs,
10573
- writeMs: profile.writeMs,
10574
- watchToDirtyMs: profile.watchToDirtyMs,
10575
- emitMs: profile.emitMs,
10576
- sharedChunkResolveMs: profile.sharedChunkResolveMs,
10577
- dirtyCount: profile.dirtyCount,
10578
- pendingCount: profile.pendingCount,
10579
- emittedCount: profile.emittedCount,
10580
- dirtyReasonSummary: profile.dirtyReasonSummary,
10581
- pendingReasonSummary: profile.pendingReasonSummary
10582
- };
10583
- }
10584
10573
  async function writeHmrProfileJsonSample(totalMs) {
10585
10574
  const outputPath = resolveHmrProfileJsonPath$1();
10586
10575
  if (!outputPath) return;
@@ -10955,10 +10944,11 @@ function resolveMultiPlatformConfig(value) {
10955
10944
  };
10956
10945
  if (typeof value === "object" && value !== null) {
10957
10946
  const record = value;
10947
+ const targets = resolveMultiPlatformTargets(record.targets);
10958
10948
  return {
10959
10949
  enabled: record.enabled !== false,
10960
10950
  projectConfigRoot: normalizeMultiPlatformProjectConfigRoot(record.projectConfigRoot),
10961
- targets: resolveMultiPlatformTargets(record.targets)
10951
+ targets
10962
10952
  };
10963
10953
  }
10964
10954
  return {
@@ -11286,6 +11276,75 @@ function resolveWeappWebConfig(options) {
11286
11276
  };
11287
11277
  }
11288
11278
  //#endregion
11279
+ //#region src/runtimeTarget.ts
11280
+ const WEB_PLATFORM_ALIASES = Object.freeze(["web", "h5"]);
11281
+ function isWebPlatform(input) {
11282
+ if (!input) return false;
11283
+ return WEB_PLATFORM_ALIASES.includes(input.trim().toLowerCase());
11284
+ }
11285
+ function getSupportedWeappViteTargetDescriptors() {
11286
+ return [...getSupportedMiniProgramPlatforms$1().map((platform) => ({
11287
+ platform,
11288
+ runtime: "miniprogram",
11289
+ aliases: [platform],
11290
+ label: platform
11291
+ })), {
11292
+ platform: "web",
11293
+ runtime: "web",
11294
+ aliases: WEB_PLATFORM_ALIASES,
11295
+ label: "web"
11296
+ }];
11297
+ }
11298
+ function getSupportedWeappVitePlatforms() {
11299
+ return getSupportedWeappViteTargetDescriptors().map((descriptor) => descriptor.platform);
11300
+ }
11301
+ function resolveWeappViteTarget(input, options = {}) {
11302
+ const raw = typeof input === "string" ? input : void 0;
11303
+ if (!raw) return {
11304
+ kind: "miniprogram",
11305
+ runMini: true,
11306
+ runWeb: false,
11307
+ label: "config",
11308
+ raw
11309
+ };
11310
+ const normalized = normalizeMiniPlatform(raw);
11311
+ const lowerRaw = raw.trim().toLowerCase();
11312
+ if (lowerRaw === "all" || lowerRaw === "both") return {
11313
+ kind: "all",
11314
+ runMini: true,
11315
+ runWeb: true,
11316
+ label: "weapp + web",
11317
+ raw
11318
+ };
11319
+ if (isWebPlatform(normalized ?? lowerRaw)) return {
11320
+ kind: "web",
11321
+ runMini: false,
11322
+ runWeb: true,
11323
+ platform: "web",
11324
+ label: "web",
11325
+ raw
11326
+ };
11327
+ const platform = resolveMiniPlatform(normalized ?? raw);
11328
+ if (platform) return {
11329
+ kind: "miniprogram",
11330
+ runMini: true,
11331
+ runWeb: false,
11332
+ platform,
11333
+ label: platform,
11334
+ raw
11335
+ };
11336
+ const fallbackMiniPlatform = options.fallbackMiniPlatform ?? DEFAULT_MP_PLATFORM;
11337
+ options.warn?.(`未识别的平台 "${raw}",已回退到 ${fallbackMiniPlatform}`);
11338
+ return {
11339
+ kind: "miniprogram",
11340
+ runMini: true,
11341
+ runWeb: false,
11342
+ platform: fallbackMiniPlatform,
11343
+ label: fallbackMiniPlatform,
11344
+ raw
11345
+ };
11346
+ }
11347
+ //#endregion
11289
11348
  //#region src/runtime/config/legacyEs5.ts
11290
11349
  function importSwcCore() {
11291
11350
  return import("@swc/core");
@@ -11474,10 +11533,10 @@ async function loadPackageJson(cwd) {
11474
11533
  //#endregion
11475
11534
  //#region src/runtime/config/internal/loadConfig/build.ts
11476
11535
  function resolveCliPlatformRuntime(cliPlatform) {
11477
- const normalizedCliPlatform = normalizeMiniPlatform(cliPlatform);
11536
+ const target = resolveWeappViteTarget(cliPlatform);
11478
11537
  return {
11479
- normalizedCliPlatform,
11480
- isWebRuntime: normalizedCliPlatform === "h5" || normalizedCliPlatform === "web"
11538
+ normalizedCliPlatform: target.platform ?? (target.runWeb ? target.label : void 0),
11539
+ isWebRuntime: target.runWeb && !target.runMini
11481
11540
  };
11482
11541
  }
11483
11542
  function resolveMultiPlatformProjectConfigHint(platform, projectConfigRoot = "config") {
@@ -11767,7 +11826,7 @@ async function loadConfigFileWithFallback(configEnv, configFile, cwd, configLoad
11767
11826
  if (configLoader !== "native") throw error;
11768
11827
  const message = error instanceof Error ? error.message : String(error);
11769
11828
  logger_default.warn(`[prepare] 原生配置加载失败,已回退到 runner:${message}`);
11770
- return loadViteConfigFile(configEnv, configFile, cwd, void 0, void 0, "runner");
11829
+ return loadConfigFileWithFallback(configEnv, configFile, cwd, "runner");
11771
11830
  }
11772
11831
  }
11773
11832
  function createLoadConfig(options) {
@@ -11930,10 +11989,12 @@ function createLoadConfig(options) {
11930
11989
  const aliasEntries = getAliasEntries(config.weapp?.jsonAlias);
11931
11990
  config.plugins ??= [];
11932
11991
  const tsconfigPathsOptions = config.weapp?.tsconfigPaths;
11933
- if (tsconfigPathsOptions !== false) if (typeof tsconfigPathsOptions === "object" && tsconfigPathsOptions !== null) config.plugins.push(tsconfigPaths(tsconfigPathsOptions));
11934
- else {
11935
- config.resolve ??= {};
11936
- config.resolve.tsconfigPaths ??= true;
11992
+ if (tsconfigPathsOptions !== false) {
11993
+ if (typeof tsconfigPathsOptions === "object" && tsconfigPathsOptions !== null) config.plugins.push(tsconfigPaths(tsconfigPathsOptions));
11994
+ else if (tsconfigPathsOptions === true || tsconfigPathsUsage.enabled) {
11995
+ config.resolve ??= {};
11996
+ config.resolve.tsconfigPaths ??= true;
11997
+ }
11937
11998
  }
11938
11999
  const configFilePath = weappLoaded?.path ?? loaded?.path ?? resolvedConfigFile;
11939
12000
  const configMergeInfo = loaded?.path && weappLoaded?.path && !shouldReuseLoadedWeappConfig(weappLoaded.path, loaded.path) ? {
@@ -14833,6 +14894,8 @@ function resolvePendingEntryIds(options) {
14833
14894
  };
14834
14895
  const startedAt = performance.now();
14835
14896
  const relatedChunkIds = /* @__PURE__ */ new Set();
14897
+ const shouldExpandLayoutSharedChunks = pendingReasonSummary.includes("layout-propagation") || pendingReasonSummary.includes("layout-fallback-full");
14898
+ if (shouldExpandLayoutSharedChunks) for (const chunkId of options.sharedChunkImporters.keys()) relatedChunkIds.add(chunkId);
14836
14899
  for (const entryId of options.dirtyEntrySet) {
14837
14900
  if (options.dirtyEntryReasons.get(entryId) === "metadata") continue;
14838
14901
  const chunkIds = options.sharedChunksByEntry.get(entryId);
@@ -14849,7 +14912,7 @@ function resolvePendingEntryIds(options) {
14849
14912
  for (const chunkId of relatedChunkIds) {
14850
14913
  const importers = options.sharedChunkImporters.get(chunkId);
14851
14914
  if (!importers) continue;
14852
- if (importers.size <= 1) continue;
14915
+ if (importers.size <= 1 && !shouldExpandLayoutSharedChunks) continue;
14853
14916
  let hasDependencyDrivenImporter = false;
14854
14917
  let hasDirectDirtyImporter = false;
14855
14918
  for (const importer of importers) {
@@ -14859,8 +14922,9 @@ function resolvePendingEntryIds(options) {
14859
14922
  }
14860
14923
  if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") hasDirectDirtyImporter = true;
14861
14924
  }
14862
- if (!hasDependencyDrivenImporter && !hasDirectDirtyImporter) continue;
14863
- if (hasDependencyDrivenImporter && hasDirectDirtyImporter) expansionMode = "mixed";
14925
+ if (!hasDependencyDrivenImporter && !hasDirectDirtyImporter && !shouldExpandLayoutSharedChunks) continue;
14926
+ if (shouldExpandLayoutSharedChunks && !hasDependencyDrivenImporter && !hasDirectDirtyImporter) expansionMode = expansionMode && expansionMode !== "dependency" ? "mixed" : "dependency";
14927
+ else if (hasDependencyDrivenImporter && hasDirectDirtyImporter) expansionMode = "mixed";
14864
14928
  else if (hasDirectDirtyImporter) expansionMode = expansionMode && expansionMode !== "direct" ? "mixed" : "direct";
14865
14929
  else expansionMode = expansionMode && expansionMode !== "dependency" ? "mixed" : "dependency";
14866
14930
  for (const importer of importers) {
@@ -14971,7 +15035,8 @@ function useLoadEntry(ctx, options) {
14971
15035
  dirtyEntryReasons,
14972
15036
  dirtyReasonSummary: ctx.runtimeState.build.hmr.profile.dirtyReasonSummary,
14973
15037
  sharedChunkImporters: hmrSharedChunkImporters,
14974
- sharedChunksByEntry: hmrSharedChunksByEntry
15038
+ sharedChunksByEntry: hmrSharedChunksByEntry,
15039
+ sourceSharedChunks: options?.hmr?.sourceSharedChunks
14975
15040
  });
14976
15041
  const pendingEntryIds = pendingResolution.pending;
14977
15042
  const pending = [];
@@ -18078,6 +18143,32 @@ async function processChangedFile(state, id, event) {
18078
18143
  const declaredEntryType = state.entriesMap.get(removeExtensionDeep(relativeSrc))?.type;
18079
18144
  const isDeletedMissingSelf = event === "delete" && !await fs.pathExists(normalizedId);
18080
18145
  const isAutoRouteFile = Boolean(ctx.autoRoutesService?.isRouteFile(normalizedId));
18146
+ const isTemplateSidecar = Boolean(path.extname(normalizedId) && watchedTemplateExts.has(path.extname(normalizedId)));
18147
+ const isScriptModuleSidecar = Array.from(watchedScriptModuleExts).some((suffix) => normalizedId.endsWith(suffix));
18148
+ const addWxmlImporterEntries = async (startId) => {
18149
+ const wxmlService = ctx.wxmlService;
18150
+ if (!wxmlService || typeof wxmlService.getImporters !== "function") return;
18151
+ const visited = /* @__PURE__ */ new Set();
18152
+ const queue = [startId];
18153
+ while (queue.length) {
18154
+ const current = queue.shift();
18155
+ if (visited.has(current)) continue;
18156
+ visited.add(current);
18157
+ const importers = wxmlService.getImporters(current);
18158
+ for (const importer of importers) {
18159
+ const normalizedImporter = normalizeFsResolvedId(importer);
18160
+ if (!visited.has(normalizedImporter)) queue.push(normalizedImporter);
18161
+ const ext = path.extname(normalizedImporter);
18162
+ if (!ext) continue;
18163
+ const primaryScript = await findJsEntry(normalizedImporter.slice(0, -ext.length));
18164
+ if (!primaryScript.path) continue;
18165
+ const primaryScriptId = normalizeFsResolvedId(primaryScript.path);
18166
+ const reason = isLayoutSourcePath(configService.relativeAbsoluteSrcRoot(primaryScriptId)) ? "dependency" : "direct";
18167
+ if (reason === "dependency") affectedLayoutEntryIds.add(primaryScriptId);
18168
+ else markEntryDirtyWithCause(primaryScriptId, reason, "wxml-importer");
18169
+ }
18170
+ }
18171
+ };
18081
18172
  if (isDeletedMissingSelf) ctx.runtimeState.build.hmr.vueEntryNonJsonSignatures.delete(normalizedId);
18082
18173
  if ((event === "create" || isDeletedMissingSelf) && isAutoRouteFile) {
18083
18174
  if (await ctx.autoRoutesService?.handleFileChange(normalizedId, event)) dirtyReasonStats.set("auto-routes-topology", 1);
@@ -18091,6 +18182,7 @@ async function processChangedFile(state, id, event) {
18091
18182
  const wxmlService = ctx.wxmlService;
18092
18183
  if (wxmlService) await wxmlService.scan(normalizedId);
18093
18184
  }
18185
+ if (isTemplateSidecar || isScriptModuleSidecar) await addWxmlImporterEntries(normalizedId);
18094
18186
  const isHtmlTemplateFile = normalizedId.endsWith(".html");
18095
18187
  if (isTemplateFile || configSuffix || isStyleFile || isHtmlTemplateFile) {
18096
18188
  const primaryScript = await findJsEntry(configSuffix ? normalizedId.slice(0, -configSuffix.length) : (() => {
@@ -21770,6 +21862,7 @@ function resolveMiniprogramWatchInclude(options) {
21770
21862
  }
21771
21863
  function mergeMiniprogram(options, ...configs) {
21772
21864
  const { ctx, subPackageMeta, config, cwd, srcRoot, mpDistRoot, packageJson, isDev, applyRuntimePlatform, injectBuiltinAliases, getDefineImportMetaEnv, setOptions, oxcRolldownPlugin } = options;
21865
+ const platform = ctx.configService?.platform;
21773
21866
  applyRuntimePlatform("miniprogram");
21774
21867
  const createMiniprogramCustomLogger = () => {
21775
21868
  return createLogger("warn");
@@ -21821,7 +21914,7 @@ function mergeMiniprogram(options, ...configs) {
21821
21914
  ...inline.define ?? {},
21822
21915
  __VITE_IS_MODERN__: "false"
21823
21916
  };
21824
- applyWeappViteHostMeta(inline, "miniprogram");
21917
+ applyWeappViteHostMeta(inline, "miniprogram", platform);
21825
21918
  stripRollupOptions(inline);
21826
21919
  arrangePlugins(inline, ctx, subPackageMeta);
21827
21920
  injectBuiltinAliases(inline);
@@ -21842,7 +21935,7 @@ function mergeMiniprogram(options, ...configs) {
21842
21935
  ...inlineConfig.define ?? {},
21843
21936
  __VITE_IS_MODERN__: "false"
21844
21937
  };
21845
- applyWeappViteHostMeta(inlineConfig, "miniprogram");
21938
+ applyWeappViteHostMeta(inlineConfig, "miniprogram", platform);
21846
21939
  stripRollupOptions(inlineConfig);
21847
21940
  arrangePlugins(inlineConfig, ctx, subPackageMeta);
21848
21941
  inlineConfig.logLevel = "warn";
@@ -21892,7 +21985,7 @@ function mergeWeb(options, ...configs) {
21892
21985
  inline.build ??= {};
21893
21986
  inline.build.outDir = web.outDir;
21894
21987
  inline.build.emptyOutDir ??= !isDev;
21895
- applyWeappViteHostMeta(inline, "web");
21988
+ applyWeappViteHostMeta(inline, "web", "web");
21896
21989
  inline.define = defu(inline.define ?? {}, getDefineImportMetaEnv());
21897
21990
  injectBuiltinAliases(inline);
21898
21991
  return inline;
@@ -21908,6 +22001,7 @@ function resolveWorkersBuildDefaults(isDev) {
21908
22001
  }
21909
22002
  function mergeWorkers(options, ...configs) {
21910
22003
  const { ctx, isDev, config, cwd, injectBuiltinAliases, getDefineImportMetaEnv, applyRuntimePlatform } = options;
22004
+ const platform = ctx.configService?.platform;
21911
22005
  applyRuntimePlatform("miniprogram");
21912
22006
  if (isDev) {
21913
22007
  const inline = defu(config, ...configs, {
@@ -21917,7 +22011,7 @@ function mergeWorkers(options, ...configs) {
21917
22011
  define: getDefineImportMetaEnv(),
21918
22012
  build: resolveWorkersBuildDefaults(true)
21919
22013
  });
21920
- applyWeappViteHostMeta(inline, "miniprogram");
22014
+ applyWeappViteHostMeta(inline, "miniprogram", platform);
21921
22015
  stripRollupOptions(inline);
21922
22016
  injectBuiltinAliases(inline);
21923
22017
  return inline;
@@ -21929,7 +22023,7 @@ function mergeWorkers(options, ...configs) {
21929
22023
  define: getDefineImportMetaEnv(),
21930
22024
  build: resolveWorkersBuildDefaults(false)
21931
22025
  });
21932
- applyWeappViteHostMeta(inlineConfig, "miniprogram");
22026
+ applyWeappViteHostMeta(inlineConfig, "miniprogram", platform);
21933
22027
  stripRollupOptions(inlineConfig);
21934
22028
  inlineConfig.logLevel = "info";
21935
22029
  injectBuiltinAliases(inlineConfig);
@@ -22096,8 +22190,8 @@ function createConfigService(ctx) {
22096
22190
  return configState.importMetaEnvDefineOverride ?? getUserDefinedImportMetaEnv();
22097
22191
  }
22098
22192
  function getImportMetaBaseEnv() {
22099
- const mpPlatform = options?.platform ?? DEFAULT_MP_PLATFORM;
22100
- const resolvedPlatform = defineEnv.PLATFORM ?? mpPlatform;
22193
+ const miniPlatform = options?.platform ?? DEFAULT_MP_PLATFORM;
22194
+ const resolvedPlatform = defineEnv.PLATFORM ?? miniPlatform;
22101
22195
  return {
22102
22196
  PLATFORM: resolvedPlatform,
22103
22197
  MP_PLATFORM: resolvedPlatform,
@@ -22115,8 +22209,8 @@ function createConfigService(ctx) {
22115
22209
  }
22116
22210
  function applyRuntimePlatform(runtime) {
22117
22211
  const isWeb = runtime === "web";
22118
- const mpPlatform = options?.platform ?? DEFAULT_MP_PLATFORM;
22119
- setDefineEnv("PLATFORM", isWeb ? "web" : mpPlatform);
22212
+ const miniPlatform = options?.platform ?? DEFAULT_MP_PLATFORM;
22213
+ setDefineEnv("PLATFORM", isWeb ? "web" : miniPlatform);
22120
22214
  setDefineEnv("IS_WEB", isWeb);
22121
22215
  setDefineEnv("IS_MINIPROGRAM", !isWeb);
22122
22216
  }
@@ -22786,7 +22880,7 @@ async function loadAppEntry(ctx, scanState) {
22786
22880
  const vueAppPath = await findVueEntry(appBasename);
22787
22881
  let configFromVue;
22788
22882
  if (!appConfigFile && vueAppPath) {
22789
- const { extractConfigFromVue } = await import("./file-D7c-LQA5.mjs");
22883
+ const { extractConfigFromVue } = await import("./file-Dxf7qCi6.mjs");
22790
22884
  configFromVue = await extractConfigFromVue(vueAppPath);
22791
22885
  if (configFromVue) appConfigFile = vueAppPath;
22792
22886
  }
@@ -23938,6 +24032,17 @@ async function createManagedTsconfigFiles(ctx) {
23938
24032
  }
23939
24033
  ];
23940
24034
  }
24035
+ function createManagedRootTsconfig() {
24036
+ return toJson({
24037
+ references: [
24038
+ { path: "./.weapp-vite/tsconfig.app.json" },
24039
+ { path: "./.weapp-vite/tsconfig.server.json" },
24040
+ { path: "./.weapp-vite/tsconfig.node.json" },
24041
+ { path: "./.weapp-vite/tsconfig.shared.json" }
24042
+ ],
24043
+ files: []
24044
+ });
24045
+ }
23941
24046
  async function hasManagedTsconfigChanges$1(ctx) {
23942
24047
  const files = await createManagedTsconfigFiles(ctx);
23943
24048
  for (const file of files) if (await fs.readFile(file.path, "utf8").catch(() => void 0) !== file.content) return true;
@@ -23957,6 +24062,12 @@ async function syncManagedTsconfigBootstrapFiles(cwd) {
23957
24062
  weappViteConfig: {}
23958
24063
  } };
23959
24064
  let changed = false;
24065
+ const rootTsconfigPath = path.resolve(cwd, "tsconfig.json");
24066
+ const rootJsconfigPath = path.resolve(cwd, "jsconfig.json");
24067
+ if (!(await fs.pathExists(rootTsconfigPath) || await fs.pathExists(rootJsconfigPath))) {
24068
+ await fs.outputFile(rootTsconfigPath, createManagedRootTsconfig(), "utf8");
24069
+ changed = true;
24070
+ }
23960
24071
  for (const file of await createManagedTsconfigFiles(bootstrapCtx)) {
23961
24072
  if (await fs.readFile(file.path, "utf8").catch(() => void 0) != null) continue;
23962
24073
  await fs.outputFile(file.path, file.content, "utf8");
@@ -24060,4 +24171,4 @@ async function createCompilerContext(options) {
24060
24171
  return ctx;
24061
24172
  }
24062
24173
  //#endregion
24063
- export { isPathInside as C, shouldPassPlatformArgToIdeOpen as S, createCjsConfigLoadError as _, resetCompilerContext as a, normalizeMiniPlatform as b, createSharedBuildConfig as c, getRouteRuntimeGlobalKeys as d, resolveWeappConfigFile as f, parseCommentJson as g, loadViteConfigFile as h, getCompilerContext as i, SHARED_CHUNK_VIRTUAL_PREFIX as l, getProjectConfigFileName as m, syncProjectSupportFiles as n, setActiveCompilerContextKey as o, checkRuntime as p, syncManagedTsconfigBootstrapFiles as r, formatBytes as s, createCompilerContext as t, resolveHmrProfileJsonPath as u, DEFAULT_MP_PLATFORM as v, resolveMiniPlatform as x, getDefaultIdeProjectRoot as y };
24174
+ export { getDefaultIdeProjectRoot as C, createCjsConfigLoadError as S, isPathInside as T, resolveWeappConfigFile as _, resetCompilerContext as a, loadViteConfigFile as b, WEB_PLATFORM_ALIASES as c, isWebPlatform as d, resolveWeappViteTarget as f, getRouteRuntimeGlobalKeys as g, resolveHmrProfileJsonPath as h, getCompilerContext as i, getSupportedWeappVitePlatforms as l, SHARED_CHUNK_VIRTUAL_PREFIX as m, syncProjectSupportFiles as n, setActiveCompilerContextKey as o, createSharedBuildConfig as p, syncManagedTsconfigBootstrapFiles as r, formatBytes as s, createCompilerContext as t, getSupportedWeappViteTargetDescriptors as u, checkRuntime as v, shouldPassPlatformArgToIdeOpen as w, parseCommentJson as x, getProjectConfigFileName as y };
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-BzywMrU-.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-BWhJaTcd.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-D57m5ljp.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-CoTaL8he.mjs";
2
+ export { getCompilerContext };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Ref, Bn as applyWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Hn as isWeappViteHost, I as RolldownPluginOption, L as RolldownWatchOptions, Ln as WEAPP_VITE_HOST_NAME, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, R as RolldownWatcher, Rn as WeappViteHostMeta, S as CompilerContext, T as ConfigEnv, Un as resolveWeappViteHostMeta, Vn as createWeappViteHostMeta, _ 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, j as ResolvedConfig, k as PluginOption, 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, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as WeappViteRuntime } from "./config-Deromcuk.mjs";
1
+ import { $n as getSupportedWeappViteTargetDescriptors, A as Ref, Bn as createWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Gn as WEB_PLATFORM_ALIASES, Hn as resolveWeappViteHostMeta, I as RolldownPluginOption, Jn as WeappViteTargetDescriptor, Kn as WeappVitePlatform, L as RolldownWatchOptions, Ln as WEAPP_VITE_HOST_NAME, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as getSupportedWeappVitePlatforms, R as RolldownWatcher, Rn as WeappViteHostMeta, S as CompilerContext, T as ConfigEnv, Un as ResolveWeappViteTargetOptions, Vn as isWeappViteHost, Wn as ResolvedWeappViteTarget, Xn as WeappViteTargetKind, Yn as WeappViteTargetInput, Zn as WebPlatform, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, er as isWebPlatform, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, qn as WeappViteRuntime, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, tr as resolveWeappViteTarget, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as applyWeappViteHostMeta } from "./config-CXABkCb8.mjs";
2
2
  import { a as createWevuComponent, i as WevuComponentOptions, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DSLk7kWi.mjs";
3
3
 
4
4
  //#region src/createContext.d.ts
@@ -12,4 +12,4 @@ interface CreateCompilerContextOptions extends Partial<LoadConfigOptions> {
12
12
  */
13
13
  declare function createCompilerContext(options?: CreateCompilerContextOptions): Promise<CompilerContext>;
14
14
  //#endregion
15
- export { App, Component, ComputedDefinitions, ConfigEnv, InlineConfig, MethodDefinitions, Page, Plugin, PluginOption, Ref, ResolvedConfig, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, ViteDevServer, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, type WevuComponentOptions, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
15
+ export { App, Component, ComputedDefinitions, ConfigEnv, InlineConfig, MethodDefinitions, Page, Plugin, PluginOption, Ref, ResolveWeappViteTargetOptions, ResolvedConfig, ResolvedWeappViteTarget, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, ViteDevServer, WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, WeappViteConfig, WeappViteHostMeta, WeappVitePlatform, WeappViteRuntime, WeappViteTargetDescriptor, WeappViteTargetInput, WeappViteTargetKind, WebPlatform, type WevuComponentOptions, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-D0HkutE0.mjs";
2
- import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
2
+ import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BEnGeaSo.mjs";
3
3
  import { t as defineConfig } from "./config-DJjSbpNX.mjs";
4
- import { t as createCompilerContext } from "./createContext-C775dw5P.mjs";
4
+ import { c as WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-CoTaL8he.mjs";
5
5
  import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DN3lxU9s.mjs";
6
- export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
6
+ export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
package/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-Deromcuk.mjs";
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-CXABkCb8.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 { wt as WeappMcpConfig } from "./config-Deromcuk.mjs";
1
+ import { wt as WeappMcpConfig } from "./config-CXABkCb8.mjs";
2
2
  import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, DEFAULT_RUNTIME_REST_ENDPOINT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
3
3
 
4
4
  //#region src/mcp.d.ts
@@ -1,13 +1,15 @@
1
1
  //#region src/pluginHost.ts
2
2
  const WEAPP_VITE_HOST_NAME = "weapp-vite";
3
- function createWeappViteHostMeta(runtime) {
4
- return {
3
+ function createWeappViteHostMeta(runtime, platform) {
4
+ const meta = {
5
5
  name: WEAPP_VITE_HOST_NAME,
6
6
  runtime
7
7
  };
8
+ if (platform) meta.platform = platform;
9
+ return meta;
8
10
  }
9
- function applyWeappViteHostMeta(config, runtime) {
10
- config.weappVite = createWeappViteHostMeta(runtime);
11
+ function applyWeappViteHostMeta(config, runtime, platform) {
12
+ config.weappVite = createWeappViteHostMeta(runtime, platform);
11
13
  return config;
12
14
  }
13
15
  function resolveWeappViteHostMeta(config) {
@@ -15,6 +17,7 @@ function resolveWeappViteHostMeta(config) {
15
17
  if (!meta || typeof meta !== "object") return;
16
18
  if (meta.name !== "weapp-vite") return;
17
19
  if (meta.runtime !== "miniprogram" && meta.runtime !== "web") return;
20
+ if (meta.platform !== void 0 && typeof meta.platform !== "string") return;
18
21
  return meta;
19
22
  }
20
23
  function isWeappViteHost(config) {
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { c as Resolver } from "./index-C1yQldy3.mjs";
2
2
  import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DiEBrMtj.mjs";
3
- import { $ as WeappAnalyzeBudgetConfig, $t as GenerateTemplateScope, A as Ref, An as WeappLibVueTscOptions, At as WeappVueConfig, B as BindingErrorLike, Bt as CopyGlobs, Cn as SubPackageStyleScope, Ct as WeappInjectWebRuntimeGlobalsTarget, D as MethodDefinitions, Dn as WeappLibEntryContext, Dt as WeappRouteRule, E as InlineConfig, En as WeappLibDtsOptions, Et as WeappRequestRuntimeConfig, F as RolldownPlugin, Fn as WeappManagedTypeScriptConfig, Ft as Alias, G as EntryJsonFragment, Gt as GenerateFilenamesOptions, H as BaseEntry, Ht as GenerateDirsOptions, I as RolldownPluginOption, In as WeappWebConfig, It as AliasOptions, J as ScanComponentItem, Jt as GenerateTemplateContext, K as PageEntry, Kt as GenerateOptions, L as RolldownWatchOptions, Lt as AlipayNpmMode, M as RolldownBuild, Mn as WeappManagedNodeTsconfigConfig, Mt as WeappWebRuntimeConfig, N as RolldownOptions, Nn as WeappManagedServerTsconfigConfig, Nt as WeappWevuConfig, O as Plugin, On as WeappLibFileName, Ot as WeappRouteRules, P as RolldownOutput, Pn as WeappManagedSharedTsconfigConfig, Pt as WeappWorkerConfig, Q as UserConfig, Qt as GenerateTemplateInlineSource, R as RolldownWatcher, Rn as WeappViteHostMeta, Rt as BuildNpmPackageMeta, Sn as SubPackageStyleEntry, St as WeappInjectWebRuntimeGlobalsConfig, T as ConfigEnv, Tn as WeappLibConfig, Tt as WeappNpmConfig, U as ComponentEntry, Ut as GenerateExtensionsOptions, V as AppEntry, Vt as CopyOptions, W as Entry, Wt as GenerateFileType, X as ProjectConfig, Xt as GenerateTemplateFactory, Y as WxmlDep, Yt as GenerateTemplateEntry, Z as SubPackageMetaValue, Zt as GenerateTemplateFileSource, _n as SharedChunkOverride, _t as WeappAutoRoutesIncludePattern, an as JsonMergeStage, at as WeappViteConfig, b as ChangeEvent, bn as SubPackageStyleConfigEntry, bt as WeappInjectRequestGlobalsTarget, cn as NpmBuildOptions, ct as EnhanceOptions, dn as NpmPluginPackageConfig, dt as MultiPlatformConfig, en as GenerateTemplatesConfig, et as WeappAnalyzeConfig, fn as NpmStrategy, ft as ScanWxmlOptions, gn as SharedChunkMode, gt as WeappAutoRoutesInclude, hn as SharedChunkDynamicImports, ht as WeappAutoRoutesConfig, in as JsonMergeFunction, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as WeappManagedAppTsconfigConfig, jt as WeappVueTemplateConfig, k as PluginOption, kn as WeappLibInternalDtsOptions, kt as WeappSubPackageConfig, ln as NpmDependencyPattern, lt as EnhanceWxmlOptions, mn as ResolvedAlias, mt as WeappAppPreludeMode, nn as JsonConfig, nt as WeappDebugConfig, on as JsonMergeStrategy, ot as AutoImportComponents, pn as NpmSubPackageConfig, pt as WeappAppPreludeConfig, q as ComponentsMap, qt as GenerateTemplate, rn as JsonMergeContext, rt as WeappForwardConsoleConfig, sn as MpPlatform, st as AutoImportComponentsOption, tn as JsFormat, tt as WeappAnalyzeHistoryConfig, un as NpmMainPackageConfig, ut as HandleWxmlOptions, vn as SharedChunkStrategy, vt as WeappHmrConfig, w as ComputedDefinitions, wn as WeappLibComponentJson, wt as WeappMcpConfig, x as WeappVitePluginApi, xn as SubPackageStyleConfigObject, xt as WeappInjectWeapiConfig, yn as SubPackage, yt as WeappInjectRequestGlobalsConfig, z as ViteDevServer, zn as WeappViteRuntime, zt as ChunksConfig } from "./config-Deromcuk.mjs";
3
+ import { $ as WeappAnalyzeBudgetConfig, $t as GenerateTemplateScope, A as Ref, An as WeappLibVueTscOptions, At as WeappVueConfig, B as BindingErrorLike, Bt as CopyGlobs, Cn as SubPackageStyleScope, Ct as WeappInjectWebRuntimeGlobalsTarget, D as MethodDefinitions, Dn as WeappLibEntryContext, Dt as WeappRouteRule, E as InlineConfig, En as WeappLibDtsOptions, Et as WeappRequestRuntimeConfig, F as RolldownPlugin, Fn as WeappManagedTypeScriptConfig, Ft as Alias, G as EntryJsonFragment, Gt as GenerateFilenamesOptions, H as BaseEntry, Ht as GenerateDirsOptions, I as RolldownPluginOption, In as WeappWebConfig, It as AliasOptions, J as ScanComponentItem, Jt as GenerateTemplateContext, K as PageEntry, Kt as GenerateOptions, L as RolldownWatchOptions, Lt as AlipayNpmMode, M as RolldownBuild, Mn as WeappManagedNodeTsconfigConfig, Mt as WeappWebRuntimeConfig, N as RolldownOptions, Nn as WeappManagedServerTsconfigConfig, Nt as WeappWevuConfig, O as Plugin, On as WeappLibFileName, Ot as WeappRouteRules, P as RolldownOutput, Pn as WeappManagedSharedTsconfigConfig, Pt as WeappWorkerConfig, Q as UserConfig, Qt as GenerateTemplateInlineSource, R as RolldownWatcher, Rn as WeappViteHostMeta, Rt as BuildNpmPackageMeta, Sn as SubPackageStyleEntry, St as WeappInjectWebRuntimeGlobalsConfig, T as ConfigEnv, Tn as WeappLibConfig, Tt as WeappNpmConfig, U as ComponentEntry, Ut as GenerateExtensionsOptions, V as AppEntry, Vt as CopyOptions, W as Entry, Wt as GenerateFileType, X as ProjectConfig, Xt as GenerateTemplateFactory, Y as WxmlDep, Yt as GenerateTemplateEntry, Z as SubPackageMetaValue, Zt as GenerateTemplateFileSource, _n as SharedChunkOverride, _t as WeappAutoRoutesIncludePattern, an as JsonMergeStage, at as WeappViteConfig, b as ChangeEvent, bn as SubPackageStyleConfigEntry, bt as WeappInjectRequestGlobalsTarget, cn as NpmBuildOptions, ct as EnhanceOptions, dn as NpmPluginPackageConfig, dt as MultiPlatformConfig, en as GenerateTemplatesConfig, et as WeappAnalyzeConfig, fn as NpmStrategy, ft as ScanWxmlOptions, gn as SharedChunkMode, gt as WeappAutoRoutesInclude, hn as SharedChunkDynamicImports, ht as WeappAutoRoutesConfig, in as JsonMergeFunction, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as WeappManagedAppTsconfigConfig, jt as WeappVueTemplateConfig, k as PluginOption, kn as WeappLibInternalDtsOptions, kt as WeappSubPackageConfig, ln as NpmDependencyPattern, lt as EnhanceWxmlOptions, mn as ResolvedAlias, mt as WeappAppPreludeMode, nn as JsonConfig, nt as WeappDebugConfig, on as JsonMergeStrategy, ot as AutoImportComponents, pn as NpmSubPackageConfig, pt as WeappAppPreludeConfig, q as ComponentsMap, qn as WeappViteRuntime, qt as GenerateTemplate, rn as JsonMergeContext, rt as WeappForwardConsoleConfig, sn as MpPlatform, st as AutoImportComponentsOption, tn as JsFormat, tt as WeappAnalyzeHistoryConfig, un as NpmMainPackageConfig, ut as HandleWxmlOptions, vn as SharedChunkStrategy, vt as WeappHmrConfig, w as ComputedDefinitions, wn as WeappLibComponentJson, wt as WeappMcpConfig, x as WeappVitePluginApi, xn as SubPackageStyleConfigObject, xt as WeappInjectWeapiConfig, yn as SubPackage, yt as WeappInjectRequestGlobalsConfig, z as ViteDevServer, zt as ChunksConfig } from "./config-CXABkCb8.mjs";
4
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, NpmDependencyPattern, NpmMainPackageConfig, NpmPluginPackageConfig, NpmStrategy, 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, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, 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.16.3",
4
+ "version": "6.16.4",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -93,7 +93,7 @@
93
93
  "@jridgewell/remapping": "^2.3.5",
94
94
  "@vercel/detect-agent": "^1.2.3",
95
95
  "@volar/typescript": "^2.4.28",
96
- "@vue/language-core": "^3.2.7",
96
+ "@vue/language-core": "^3.2.8",
97
97
  "cac": "^7.0.0",
98
98
  "chokidar": "^5.0.0",
99
99
  "comment-json": "^5.0.0",
@@ -101,14 +101,14 @@
101
101
  "fdir": "^6.5.0",
102
102
  "htmlparser2": "^12.0.0",
103
103
  "local-pkg": "^1.1.2",
104
- "lru-cache": "^11.3.5",
104
+ "lru-cache": "^11.3.6",
105
105
  "magic-string": "^0.30.21",
106
106
  "merge": "^2.1.1",
107
107
  "p-queue": "^9.2.0",
108
108
  "package-manager-detector": "^1.6.0",
109
109
  "pathe": "^2.0.3",
110
110
  "picomatch": "^4.0.4",
111
- "postcss": "^8.5.13",
111
+ "postcss": "^8.5.14",
112
112
  "rolldown": "1.0.0-rc.17",
113
113
  "rolldown-plugin-dts": "0.23.2",
114
114
  "semver": "^7.7.4",
@@ -116,13 +116,13 @@
116
116
  "vite": "8.0.10",
117
117
  "vite-tsconfig-paths": "^6.1.1",
118
118
  "vue": "^3.5.33",
119
- "vue-tsc": "^3.2.7",
119
+ "vue-tsc": "^3.2.8",
120
120
  "@weapp-core/constants": "^0.1.4",
121
121
  "@weapp-core/init": "6.0.8",
122
122
  "@weapp-core/logger": "3.1.1",
123
123
  "@weapp-core/schematics": "6.0.4",
124
124
  "@weapp-core/shared": "3.0.4",
125
- "@weapp-vite/ast": "6.16.3",
125
+ "@weapp-vite/ast": "6.16.4",
126
126
  "@weapp-vite/mcp": "1.3.1",
127
127
  "@weapp-vite/miniprogram-automator": "1.0.5",
128
128
  "@weapp-vite/volar": "2.1.0",
@@ -132,14 +132,14 @@
132
132
  "rolldown-require": "2.0.15",
133
133
  "vite-plugin-performance": "2.0.1",
134
134
  "weapp-ide-cli": "5.2.8",
135
- "wevu": "6.16.3"
135
+ "wevu": "6.16.4"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
139
139
  "registry": "https://registry.npmjs.org"
140
140
  },
141
141
  "devDependencies": {
142
- "oxc-parser": "^0.128.0",
142
+ "oxc-parser": "^0.129.0",
143
143
  "oxc-walker": "^0.7.0",
144
144
  "tailwindcss": "^4.2.4",
145
145
  "ts-morph": "^28.0.0"
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-CueQM5Yi.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-C775dw5P.mjs";
2
- export { getCompilerContext };