weapp-vite 6.15.17 → 6.16.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.
@@ -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-6QUk3Zbc.mjs";
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-C1yQldy3.mjs";
2
2
  export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, VantResolver, WeuiResolver };
@@ -1,4 +1,4 @@
1
- import { d as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-CaCrpsG-.mjs";
1
+ import { d as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-C-05IQc1.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,7 +1,7 @@
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-CaCrpsG-.mjs";
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-C-05IQc1.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
3
- import { h as VERSION } from "./file-DUPlM0cH.mjs";
4
- import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-DRlj32v4.mjs";
3
+ import { h as VERSION } from "./file-BC_RNbAI.mjs";
4
+ import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-BzcrPiku.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
7
7
  import { defu } from "@weapp-core/shared";
@@ -2784,7 +2784,7 @@ function resolveRunnableHotkeyDefinition(input) {
2784
2784
  }
2785
2785
  //#endregion
2786
2786
  //#region package.json
2787
- var version = "6.15.17";
2787
+ var version = "6.16.0";
2788
2788
  //#endregion
2789
2789
  //#region src/cli/devHotkeys/format.ts
2790
2790
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,4 +1,4 @@
1
- import { c as Resolver, s as ResolvedValue } from "./index-6QUk3Zbc.mjs";
1
+ import { c as Resolver, s as ResolvedValue } from "./index-C1yQldy3.mjs";
2
2
  import { t as AutoRoutes } from "./routes-DiEBrMtj.mjs";
3
3
  import { MpPlatform, OutputExtensions } from "@weapp-core/shared";
4
4
  import { WeappAstConfig } from "@weapp-vite/ast";
@@ -778,7 +778,9 @@ interface BuildService {
778
778
  invalidateIndependentOutput: (root: string) => void;
779
779
  }
780
780
  //#endregion
781
- //#region ../../node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts
781
+ //#region ../../node_modules/.pnpm/pkg-types@2.3.1/node_modules/pkg-types/dist/index.d.mts
782
+ //#endregion
783
+ //#region src/packagejson/types.d.ts
782
784
  interface PackageJson {
783
785
  /**
784
786
  * The name is what your thing is called.
@@ -1072,7 +1074,8 @@ type PackageJsonFunding = string | {
1072
1074
  };
1073
1075
  type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
1074
1076
  type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject> };
1075
- type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
1077
+ type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>; //#endregion
1078
+ //#region src/packagejson/utils.d.ts
1076
1079
  /**
1077
1080
  * Defines a PackageJson structure.
1078
1081
  * @param pkg - The `package.json` content as an object. See {@link PackageJson}.
@@ -1380,11 +1383,14 @@ interface RuntimeState {
1380
1383
  hmr: {
1381
1384
  loadedEntrySet: Set<string>;
1382
1385
  dirtyEntrySet: Set<string>;
1383
- dirtyEntryReasons: Map<string, 'direct' | 'dependency'>;
1386
+ dirtyEntryReasons: Map<string, 'direct' | 'dependency' | 'metadata'>;
1384
1387
  resolvedEntryMap: Map<string, ResolvedId>;
1385
1388
  entriesMap: Map<string, Entry | undefined>;
1386
1389
  layoutEntryDependents: Map<string, Set<string>>;
1387
1390
  entryLayoutDependencies: Map<string, Set<string>>;
1391
+ vueEntryNonJsonSignatures: Map<string, string>;
1392
+ didEmitAllEntries: boolean;
1393
+ lastEmittedEntryIds: Set<string>;
1388
1394
  recentProfiles: Array<{
1389
1395
  totalMs: number;
1390
1396
  buildCoreMs?: number;
@@ -1398,6 +1404,7 @@ interface RuntimeState {
1398
1404
  emittedCount?: number;
1399
1405
  }>;
1400
1406
  profile: {
1407
+ eventId?: string;
1401
1408
  event?: ChangeEvent;
1402
1409
  file?: string;
1403
1410
  buildCoreMs?: number;
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { Bn as resolveWeappViteHostMeta, Fn as WeappViteHostMeta, In as WeappViteRuntime, Ln as applyWeappViteHostMeta, Pn as WEAPP_VITE_HOST_NAME, Rn as createWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, 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, nt as WeappViteConfig, 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 isWeappViteHost } from "./config-BEJTp6sp.mjs";
1
+ import { Bn as resolveWeappViteHostMeta, Fn as WeappViteHostMeta, In as WeappViteRuntime, Ln as applyWeappViteHostMeta, Pn as WEAPP_VITE_HOST_NAME, Rn as createWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, 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, nt as WeappViteConfig, 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 isWeappViteHost } from "./config-BKXx-hW-.mjs";
2
2
  export { App, Component, Page, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.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-DUPlM0cH.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-BC_RNbAI.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";
@@ -14,7 +14,7 @@ import fs$1, { existsSync, readFileSync } from "node:fs";
14
14
  import { parse } from "vue/compiler-sfc";
15
15
  import { BABEL_TS_MODULE_PARSER_OPTIONS, generate, getVisitorKeys, parse as parse$2, parseJsLike, traverse } from "@weapp-vite/ast/babel";
16
16
  import pm from "picomatch";
17
- import { VUE_COMPONENT_TAG_RE, WE_VU_MODULE_ID, WE_VU_RUNTIME_APIS, buildClassStyleComputedCode, collectVueTemplateTags, compileJsxFile, compileVueFile, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, resolveClassStyleWxsLocation } from "wevu/compiler";
17
+ import { VUE_COMPONENT_TAG_RE, WE_VU_MODULE_ID, WE_VU_RUNTIME_APIS, buildClassStyleComputedCode, collectVueTemplateTags, compileJsxFile, compileVueFile, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, resolveClassStyleWxsLocation, stripJsonMacroCallsFromCode } from "wevu/compiler";
18
18
  import process from "node:process";
19
19
  import { parse as parse$1, stringify } from "comment-json";
20
20
  import fs$2, { appendFile, copyFile, mkdir, readFile, readdir, rm } from "node:fs/promises";
@@ -4691,10 +4691,12 @@ async function resolveEntryPath(input, options) {
4691
4691
  //#endregion
4692
4692
  //#region src/utils/json.ts
4693
4693
  const ALIPAY_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_generic_component";
4694
+ const WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_scoped_slot_generic_component";
4694
4695
  const JSON_FILE_JS_EXTENSION_RE = /\.[jt]s$/;
4695
4696
  const COMPONENT_NAME_LOWER_TO_UPPER_RE = /([a-z0-9])([A-Z])/g;
4696
4697
  const COMPONENT_NAME_MULTI_UPPER_RE = /([A-Z]+)([A-Z][a-z])/g;
4697
4698
  const COMPONENT_NAME_HAS_UPPER_RE = /[A-Z]/;
4699
+ const SCOPED_SLOT_GENERIC_KEY_RE$1 = /^scoped-slots-/;
4698
4700
  function parseCommentJson(json) {
4699
4701
  return parse$1(json, void 0, true);
4700
4702
  }
@@ -4757,16 +4759,21 @@ function normalizeUsingComponentsByPlatform(usingComponents, platform, options)
4757
4759
  return normalized;
4758
4760
  }
4759
4761
  function normalizeComponentGenericsByPlatform(componentGenerics, platform) {
4760
- if (!shouldFillComponentGenericsDefault(platform)) return componentGenerics;
4762
+ if (!shouldFillComponentGenericsDefault(platform) && platform !== "weapp") return componentGenerics;
4761
4763
  const normalized = {};
4762
4764
  for (const [key, value] of Object.entries(componentGenerics)) {
4765
+ const placeholder = platform === "weapp" ? SCOPED_SLOT_GENERIC_KEY_RE$1.test(key) ? WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER : void 0 : ALIPAY_GENERIC_COMPONENT_PLACEHOLDER;
4766
+ if (!placeholder) {
4767
+ normalized[key] = value;
4768
+ continue;
4769
+ }
4763
4770
  if (value === true) {
4764
- normalized[key] = { default: ALIPAY_GENERIC_COMPONENT_PLACEHOLDER };
4771
+ normalized[key] = { default: placeholder };
4765
4772
  continue;
4766
4773
  }
4767
4774
  if (isObject(value)) {
4768
4775
  const nextValue = { ...value };
4769
- if (typeof nextValue.default !== "string" || !nextValue.default.trim()) nextValue.default = ALIPAY_GENERIC_COMPONENT_PLACEHOLDER;
4776
+ if (typeof nextValue.default !== "string" || !nextValue.default.trim()) nextValue.default = placeholder;
4770
4777
  normalized[key] = nextValue;
4771
4778
  continue;
4772
4779
  }
@@ -5402,8 +5409,8 @@ function createResolverHelpers(state) {
5402
5409
  if (typeof resolverAny.resolve === "function") {
5403
5410
  const resolved = resolverAny.resolve(candidate, baseName);
5404
5411
  if (resolved) return candidate === componentName ? resolved : {
5405
- name: componentName,
5406
- from: resolved.from
5412
+ ...resolved,
5413
+ name: componentName
5407
5414
  };
5408
5415
  }
5409
5416
  const from = resolverAny.components?.[candidate];
@@ -5414,8 +5421,8 @@ function createResolverHelpers(state) {
5414
5421
  if (typeof resolver === "function") {
5415
5422
  const resolved = resolver(candidate, baseName);
5416
5423
  if (resolved) return candidate === componentName ? resolved : {
5417
- name: componentName,
5418
- from: resolved.from
5424
+ ...resolved,
5425
+ name: componentName
5419
5426
  };
5420
5427
  }
5421
5428
  }
@@ -6928,6 +6935,7 @@ function isLayoutSourcePath(relativeSrc, layoutSourceRoot = DEFAULT_LAYOUT_SOURC
6928
6935
  //#endregion
6929
6936
  //#region src/utils/hmrProfile.ts
6930
6937
  const DEFAULT_HMR_PROFILE_JSONL_RELATIVE_PATH = ".weapp-vite/hmr-profile.jsonl";
6938
+ const HMR_PROFILE_JSON_ENV = "WEAPP_VITE_HMR_PROFILE_JSON";
6931
6939
  /**
6932
6940
  * @description 解析 HMR profile JSONL 输出路径。
6933
6941
  */
@@ -6941,6 +6949,24 @@ function resolveHmrProfileJsonPath(options) {
6941
6949
  if (fallbackToDefault) return path.join(options.cwd, DEFAULT_HMR_PROFILE_JSONL_RELATIVE_PATH);
6942
6950
  }
6943
6951
  /**
6952
+ * @description 从环境变量解析 HMR profile JSONL 输出选项。
6953
+ */
6954
+ function resolveHmrProfileJsonEnvOption(env = process.env) {
6955
+ const raw = env[HMR_PROFILE_JSON_ENV]?.trim();
6956
+ if (!raw) return;
6957
+ if (raw === "1" || raw.toLowerCase() === "true") return true;
6958
+ if (raw === "0" || raw.toLowerCase() === "false") return;
6959
+ return raw;
6960
+ }
6961
+ let hmrProfileEventSequence = 0;
6962
+ /**
6963
+ * @description 创建 HMR profile 事件 id,用于把 watcher 事件、JSONL 样本和外部审计场景稳定关联。
6964
+ */
6965
+ function createHmrProfileEventId() {
6966
+ hmrProfileEventSequence += 1;
6967
+ return `${Date.now().toString(36)}-${hmrProfileEventSequence.toString(36)}`;
6968
+ }
6969
+ /**
6944
6970
  * @description 为 HMR profile 累加阶段耗时。
6945
6971
  */
6946
6972
  function recordHmrProfileDuration(profile, key, durationMs) {
@@ -10366,9 +10392,10 @@ function createBuildService(ctx) {
10366
10392
  ctx.runtimeState.build.hmr.profile = {};
10367
10393
  }
10368
10394
  function resolveHmrProfileJsonPath$1() {
10395
+ const envOption = resolveHmrProfileJsonEnvOption();
10369
10396
  return resolveHmrProfileJsonPath({
10370
10397
  cwd: ctx.configService?.cwd ?? process.cwd(),
10371
- option: ctx.configService?.weappViteConfig.hmr?.profileJson
10398
+ option: envOption ?? ctx.configService?.weappViteConfig.hmr?.profileJson
10372
10399
  });
10373
10400
  }
10374
10401
  function finalizeHmrProfile(totalMs) {
@@ -10519,11 +10546,16 @@ function createBuildService(ctx) {
10519
10546
  }
10520
10547
  function createHmrProfileJsonSample(totalMs) {
10521
10548
  const profile = ctx.runtimeState.build.hmr.profile;
10549
+ const relativeFile = profile.file && ctx.configService ? ctx.configService.relativeCwd(profile.file) : void 0;
10550
+ const sourceRootFile = profile.file && ctx.configService ? ctx.configService.relativeAbsoluteSrcRoot(profile.file) : void 0;
10522
10551
  return {
10523
10552
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10524
10553
  totalMs,
10554
+ eventId: profile.eventId,
10525
10555
  event: profile.event,
10526
10556
  file: profile.file,
10557
+ relativeFile,
10558
+ sourceRootFile,
10527
10559
  buildCoreMs: profile.buildCoreMs,
10528
10560
  transformMs: profile.transformMs,
10529
10561
  writeMs: profile.writeMs,
@@ -10587,6 +10619,11 @@ function createBuildService(ctx) {
10587
10619
  }
10588
10620
  return autoTouchResolved;
10589
10621
  }
10622
+ function isDevOutputFile(filePath) {
10623
+ const normalizedOutDir = normalizeFsResolvedId(configService.outDir);
10624
+ const normalizedFile = normalizeFsResolvedId(filePath);
10625
+ return normalizedFile === normalizedOutDir || normalizedFile.startsWith(`${normalizedOutDir}/`);
10626
+ }
10590
10627
  async function runDev(target) {
10591
10628
  if (process.env.NODE_ENV === void 0) process.env.NODE_ENV = "development";
10592
10629
  debug$2?.(`[${target}] dev build watcher start`);
@@ -10646,6 +10683,7 @@ function createBuildService(ctx) {
10646
10683
  if (devWatcherClosed) return;
10647
10684
  if (reason?.event || reason?.file) ctx.runtimeState.build.hmr.profile = {
10648
10685
  ...ctx.runtimeState.build.hmr.profile,
10686
+ eventId: createHmrProfileEventId(),
10649
10687
  event: reason.event,
10650
10688
  file: reason.file,
10651
10689
  watchToDirtyMs: performance.now() - startedAt
@@ -10720,6 +10758,7 @@ function createBuildService(ctx) {
10720
10758
  }));
10721
10759
  snapshotWatcher.on("all", (event, id) => {
10722
10760
  if (!id) return;
10761
+ if (isDevOutputFile(id)) return;
10723
10762
  if (!shouldHandleSnapshotSidecarFile(id)) return;
10724
10763
  const sidecarStartedAt = performance.now();
10725
10764
  runSnapshotBuild({
@@ -11935,6 +11974,18 @@ function stripQueryAndHash(value) {
11935
11974
  const endIndex = [value.indexOf("?"), value.indexOf("#")].filter((index) => index >= 0).reduce((min, index) => Math.min(min, index), Number.POSITIVE_INFINITY);
11936
11975
  return Number.isFinite(endIndex) ? value.slice(0, endIndex) : value;
11937
11976
  }
11977
+ function createPathMatcher(patterns, options) {
11978
+ if (!patterns.length) return () => false;
11979
+ return pm(patterns.map((pattern) => normalizePath$1(pattern)), options);
11980
+ }
11981
+ function createAssetPathVariants(file, roots) {
11982
+ const variants = [file];
11983
+ for (const root of roots) {
11984
+ const relative = path.relative(root, file);
11985
+ if (relative && !relative.startsWith("..") && !path.isAbsolute(relative)) variants.push(relative);
11986
+ }
11987
+ return variants.map((variant) => normalizePath$1(variant));
11988
+ }
11938
11989
  function collectBundledAssetSourcePaths(bundle) {
11939
11990
  const sources = /* @__PURE__ */ new Set();
11940
11991
  for (const output of Object.values(bundle)) {
@@ -11961,7 +12012,8 @@ function scanAssetFiles(configService, config, buildTarget) {
11961
12012
  path.resolve(configService.cwd, `${config.build.outDir}/**/*`),
11962
12013
  ...exclude
11963
12014
  ];
11964
- const patterns = [`**/*.{${defaultAssetExtensions.join(",")}}`, ...include];
12015
+ const includeMatcher = createPathMatcher([`**/*.{${defaultAssetExtensions.join(",")}}`, ...include], { dot: false });
12016
+ const ignoreMatcher = createPathMatcher(ignore, { dot: true });
11965
12017
  const roots = /* @__PURE__ */ new Set();
11966
12018
  if (buildTarget !== "plugin") roots.add(configService.absoluteSrcRoot);
11967
12019
  if (configService.absolutePluginRoot && buildTarget === "plugin") roots.add(configService.absolutePluginRoot);
@@ -11970,10 +12022,16 @@ function scanAssetFiles(configService, config, buildTarget) {
11970
12022
  return new fdir({
11971
12023
  includeDirs: false,
11972
12024
  pathSeparator: "/"
11973
- }).withFullPaths().globWithOptions(patterns, {
11974
- ignore,
11975
- dot: false
11976
- }).crawl(root).withPromise();
12025
+ }).withFullPaths().crawl(root).withPromise().then((files) => {
12026
+ return files.filter((file) => {
12027
+ const variants = createAssetPathVariants(file, [
12028
+ root,
12029
+ configService.absoluteSrcRoot,
12030
+ configService.cwd
12031
+ ]);
12032
+ return variants.some((variant) => includeMatcher(variant)) && !variants.some((variant) => ignoreMatcher(variant));
12033
+ });
12034
+ });
11977
12035
  });
11978
12036
  return Promise.all(crawlPromises).then((groups) => {
11979
12037
  const files = /* @__PURE__ */ new Set();
@@ -12067,10 +12125,10 @@ function normalizeChangedPath(id) {
12067
12125
  return pathWithoutQuery;
12068
12126
  }
12069
12127
  function getAutoImportCandidateKind(filePath) {
12128
+ if (AUTO_IMPORT_CONFIG_SUFFIXES.some((suffix) => filePath.endsWith(suffix))) return "config";
12070
12129
  if (AUTO_IMPORT_VUE_SUFFIXES.has(path.extname(filePath))) return "vue";
12071
12130
  if (AUTO_IMPORT_TEMPLATE_SUFFIXES.has(path.extname(filePath))) return "template";
12072
12131
  if (AUTO_IMPORT_JS_SUFFIXES.has(path.extname(filePath))) return "script";
12073
- if (AUTO_IMPORT_CONFIG_SUFFIXES.some((suffix) => filePath.endsWith(suffix))) return "config";
12074
12132
  }
12075
12133
  function getAutoImportCandidateBase(filePath, kind) {
12076
12134
  if (!kind) return;
@@ -12604,6 +12662,44 @@ function createJsonEmitManager(configService) {
12604
12662
  };
12605
12663
  }
12606
12664
  //#endregion
12665
+ //#region src/utils/file/vueSfcSignature.ts
12666
+ function hashPayload(payload) {
12667
+ return createHash("sha256").update(JSON.stringify(payload)).digest("hex").slice(0, 16);
12668
+ }
12669
+ function serializeAttrs(attrs) {
12670
+ return Object.fromEntries(Object.entries(attrs).sort(([a], [b]) => a.localeCompare(b)));
12671
+ }
12672
+ function serializeBlock(block, content) {
12673
+ if (!block) return null;
12674
+ return {
12675
+ type: block.type,
12676
+ attrs: serializeAttrs(block.attrs),
12677
+ content: content ?? block.content
12678
+ };
12679
+ }
12680
+ function stripScriptSetupJsonMacros(content, filename) {
12681
+ try {
12682
+ return stripJsonMacroCallsFromCode(content, filename);
12683
+ } catch {
12684
+ return content;
12685
+ }
12686
+ }
12687
+ function buildNonJsonDescriptorPayload(descriptor, filename) {
12688
+ const scriptSetupContent = descriptor.scriptSetup ? stripScriptSetupJsonMacros(descriptor.scriptSetup.content, filename) : void 0;
12689
+ return {
12690
+ script: serializeBlock(descriptor.script),
12691
+ scriptSetup: serializeBlock(descriptor.scriptSetup, scriptSetupContent),
12692
+ template: serializeBlock(descriptor.template),
12693
+ styles: descriptor.styles.map((style) => serializeBlock(style)),
12694
+ customBlocks: descriptor.customBlocks.filter((block) => block.type !== "json").map((block) => serializeBlock(block))
12695
+ };
12696
+ }
12697
+ function resolveVueSfcNonJsonSignature(source, filename) {
12698
+ const { descriptor, errors } = parse(source, { filename });
12699
+ if (errors.length) return;
12700
+ return hashPayload(buildNonJsonDescriptorPayload(descriptor, filename));
12701
+ }
12702
+ //#endregion
12607
12703
  //#region src/plugins/utils/analyze.ts
12608
12704
  function collectPluginExportEntries(plugins, root) {
12609
12705
  if (!isObject(plugins)) return [];
@@ -14292,7 +14388,13 @@ async function resolveUsingComponentReference(ctx, configService, reExportResolu
14292
14388
  }
14293
14389
  async function resolveUsingComponentPath(ctx, configService, reExportResolutionCache, importSource, importerFilename, info) {
14294
14390
  if (!info) return;
14295
- return (await resolveUsingComponentReference(ctx, configService, reExportResolutionCache, importSource, importerFilename, info)).from;
14391
+ const resolved = await resolveUsingComponentReference(ctx, configService, reExportResolutionCache, importSource, importerFilename, info);
14392
+ const sourceType = resolved.resolvedId?.endsWith(".vue") ? "wevu-sfc" : "native";
14393
+ return {
14394
+ from: resolved.from,
14395
+ resolvedId: resolved.resolvedId,
14396
+ sourceType
14397
+ };
14296
14398
  }
14297
14399
  function createUsingComponentPathResolver(ctx, configService, reExportResolutionCache) {
14298
14400
  return async (importSource, importerFilename, info) => {
@@ -14416,6 +14518,17 @@ function createEntryLoader(options) {
14416
14518
  else jsonPath = changeFileExtension(id, ".json");
14417
14519
  const vueEntryPath = id.endsWith(".vue") ? id : await findVueEntry(removeExtensionDeep(id));
14418
14520
  if (vueEntryPath) addNormalizedWatchFile(this, vueEntryPath);
14521
+ let vueSource;
14522
+ const readVueSource = async () => {
14523
+ if (!vueEntryPath) return;
14524
+ if (vueSource !== void 0) return vueSource;
14525
+ try {
14526
+ vueSource = await fs.readFile(vueEntryPath, "utf-8");
14527
+ } catch (error) {
14528
+ if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT" && configService.isDev && !await fs.pathExists(vueEntryPath))) throw error;
14529
+ }
14530
+ return vueSource;
14531
+ };
14419
14532
  if (!jsonEntry.path) {
14420
14533
  if (vueEntryPath) {
14421
14534
  const configFromVue = await extractConfigFromVue(vueEntryPath);
@@ -14497,15 +14610,16 @@ function createEntryLoader(options) {
14497
14610
  reExportResolutionCache
14498
14611
  });
14499
14612
  if (type === "page") {
14500
- let vueSource;
14501
- try {
14502
- vueSource = await fs.readFile(vueEntryPath, "utf-8");
14503
- } catch (error) {
14504
- if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT" && configService.isDev && !await fs.pathExists(vueEntryPath))) throw error;
14505
- }
14613
+ const vueSource = await readVueSource();
14506
14614
  if (vueSource) {
14507
14615
  const layoutPlan = await resolvePageLayoutPlan(vueSource, vueEntryPath, configService);
14616
+ replaceLayoutDependencies(normalizedId, []);
14508
14617
  if (layoutPlan) {
14618
+ if (vueSource.includes("definePageMeta") || vueSource.includes("setPageLayout")) {
14619
+ const layoutDependencies = /* @__PURE__ */ new Set();
14620
+ for (const file of await expandResolvedPageLayoutFiles(layoutPlan.layouts)) layoutDependencies.add(normalizeFsResolvedId(file));
14621
+ replaceLayoutDependencies(normalizedId, layoutDependencies);
14622
+ }
14509
14623
  await addResolvedPageLayoutWatchFiles(this, layoutPlan.layouts);
14510
14624
  await registerResolvedPageLayoutEntries({
14511
14625
  layouts: layoutPlan.layouts,
@@ -14529,6 +14643,13 @@ function createEntryLoader(options) {
14529
14643
  }
14530
14644
  }
14531
14645
  }
14646
+ if (configService.isDev && hasJsonEntry && vueEntryPath) {
14647
+ const vueSource = await readVueSource();
14648
+ if (vueSource) {
14649
+ const nonJsonSignature = resolveVueSfcNonJsonSignature(vueSource, vueEntryPath);
14650
+ if (nonJsonSignature) ctx.runtimeState.build.hmr.vueEntryNonJsonSignatures.set(normalizedId, nonJsonSignature);
14651
+ }
14652
+ }
14532
14653
  await ctx.autoImportService?.awaitPendingRegistrations?.();
14533
14654
  applyAutoImports(baseName, json);
14534
14655
  const componentEntries = analyzeCommonJson(json);
@@ -14636,6 +14757,8 @@ function createTemplateScanner(wxmlService, debug) {
14636
14757
  }
14637
14758
  //#endregion
14638
14759
  //#region src/plugins/hooks/useLoadEntry/index.ts
14760
+ const MAX_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS = 128;
14761
+ const MAX_FALLBACK_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS = 8;
14639
14762
  function resolveUpstreamPendingReasonSummary(dirtyReasonSummary) {
14640
14763
  if (!dirtyReasonSummary?.length) return [];
14641
14764
  const pendingReasonSummary = [];
@@ -14647,6 +14770,12 @@ function resolveUpstreamPendingReasonSummary(dirtyReasonSummary) {
14647
14770
  if (hasAutoRoutesTopology) pendingReasonSummary.push("auto-routes-topology");
14648
14771
  return pendingReasonSummary;
14649
14772
  }
14773
+ function isDirectSourceSharedChunkForEntry(options) {
14774
+ if (options.sourceSharedChunks?.has(options.chunkId) !== true) return false;
14775
+ const normalizedEntryId = normalizeFsResolvedId(options.entryId);
14776
+ if ((options.entryLayoutDependencies?.get(normalizedEntryId))?.size) return true;
14777
+ return options.importerCount <= MAX_FALLBACK_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS;
14778
+ }
14650
14779
  function resolvePendingEntryIds(options) {
14651
14780
  const pending = new Set(options.dirtyEntrySet);
14652
14781
  const pendingReasonSummary = resolveUpstreamPendingReasonSummary(options.dirtyReasonSummary);
@@ -14665,6 +14794,7 @@ function resolvePendingEntryIds(options) {
14665
14794
  const startedAt = performance.now();
14666
14795
  const relatedChunkIds = /* @__PURE__ */ new Set();
14667
14796
  for (const entryId of options.dirtyEntrySet) {
14797
+ if (options.dirtyEntryReasons.get(entryId) === "metadata") continue;
14668
14798
  const chunkIds = options.sharedChunksByEntry.get(entryId);
14669
14799
  if (!chunkIds?.size) continue;
14670
14800
  for (const chunkId of chunkIds) relatedChunkIds.add(chunkId);
@@ -14685,14 +14815,22 @@ function resolvePendingEntryIds(options) {
14685
14815
  for (const importer of importers) {
14686
14816
  if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "dependency") {
14687
14817
  hasDependencyDrivenImporter = true;
14688
- break;
14818
+ continue;
14819
+ }
14820
+ if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") {
14821
+ if (isDirectSourceSharedChunkForEntry({
14822
+ chunkId,
14823
+ entryId: importer,
14824
+ sourceSharedChunks: options.sourceSharedChunks,
14825
+ entryLayoutDependencies: options.entryLayoutDependencies,
14826
+ importerCount: importers.size
14827
+ })) hasDirectDirtyImporter = true;
14689
14828
  }
14690
- if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") hasDirectDirtyImporter = true;
14691
14829
  }
14692
- if (!hasDependencyDrivenImporter && !hasDirectDirtyImporter) continue;
14830
+ if (!hasDependencyDrivenImporter && !(hasDirectDirtyImporter && importers.size <= MAX_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS)) continue;
14693
14831
  if (hasDependencyDrivenImporter && hasDirectDirtyImporter) expansionMode = "mixed";
14694
- else if (hasDependencyDrivenImporter) expansionMode = expansionMode && expansionMode !== "dependency" ? "mixed" : "dependency";
14695
14832
  else if (hasDirectDirtyImporter) expansionMode = expansionMode && expansionMode !== "direct" ? "mixed" : "direct";
14833
+ else expansionMode = expansionMode && expansionMode !== "dependency" ? "mixed" : "dependency";
14696
14834
  for (const importer of importers) {
14697
14835
  if (!pending.has(importer)) expandedImporters.add(importer);
14698
14836
  pending.add(importer);
@@ -14769,6 +14907,7 @@ function useLoadEntry(ctx, options) {
14769
14907
  const hmrSharedChunksMode = options?.hmr?.sharedChunks ?? "auto";
14770
14908
  const hmrSharedChunkImporters = options?.hmr?.sharedChunkImporters;
14771
14909
  const hmrSharedChunksByEntry = options?.hmr?.sharedChunksByEntry;
14910
+ const hmrSourceSharedChunks = options?.hmr?.sourceSharedChunks;
14772
14911
  return {
14773
14912
  loadEntry,
14774
14913
  entriesMap,
@@ -14780,7 +14919,9 @@ function useLoadEntry(ctx, options) {
14780
14919
  normalizeEntry,
14781
14920
  markEntryDirty(entryId, reason = "direct") {
14782
14921
  dirtyEntrySet.add(entryId);
14783
- dirtyEntryReasons.set(entryId, reason);
14922
+ const previous = dirtyEntryReasons.get(entryId);
14923
+ const nextReason = previous === "dependency" || reason === "dependency" ? "dependency" : previous === "direct" || reason === "direct" ? "direct" : reason;
14924
+ dirtyEntryReasons.set(entryId, nextReason);
14784
14925
  loadedEntrySet.delete(entryId);
14785
14926
  },
14786
14927
  async emitDirtyEntries() {
@@ -14800,6 +14941,8 @@ function useLoadEntry(ctx, options) {
14800
14941
  dirtyReasonSummary: ctx.runtimeState.build.hmr.profile.dirtyReasonSummary,
14801
14942
  sharedChunkImporters: hmrSharedChunkImporters,
14802
14943
  sharedChunksByEntry: hmrSharedChunksByEntry,
14944
+ sourceSharedChunks: hmrSourceSharedChunks,
14945
+ entryLayoutDependencies,
14803
14946
  subPackageRoots: new Set(ctx.scanService?.subPackageMap?.keys?.() ?? []),
14804
14947
  relativeAbsoluteSrcRoot: ctx.configService.relativeAbsoluteSrcRoot.bind(ctx.configService)
14805
14948
  });
@@ -14807,11 +14950,11 @@ function useLoadEntry(ctx, options) {
14807
14950
  const pending = [];
14808
14951
  lastActualEmittedEntryIds.clear();
14809
14952
  for (const entryId of pendingEntryIds) {
14953
+ dirtyEntrySet.delete(entryId);
14954
+ dirtyEntryReasons.delete(entryId);
14810
14955
  const resolvedId = resolvedEntryMap.get(entryId);
14811
14956
  if (!resolvedId) continue;
14812
14957
  pending.push(resolvedId);
14813
- dirtyEntrySet.delete(entryId);
14814
- dirtyEntryReasons.delete(entryId);
14815
14958
  }
14816
14959
  if (pending.length) await Promise.all(emitEntriesChunks.call(this, pending));
14817
14960
  const actualEmittedEntryIds = new Set(lastActualEmittedEntryIds);
@@ -14981,6 +15124,17 @@ function collectAffectedEntries(state, startId) {
14981
15124
  }
14982
15125
  return affected;
14983
15126
  }
15127
+ function collectAffectedEntriesFromSharedChunks(state, startId) {
15128
+ const affected = /* @__PURE__ */ new Set();
15129
+ const chunkIds = state.hmrSharedChunksByModule.get(normalizeFsResolvedId(startId));
15130
+ if (!chunkIds?.size) return affected;
15131
+ for (const chunkId of chunkIds) {
15132
+ const importers = state.hmrSharedChunkImporters.get(chunkId);
15133
+ if (!importers?.size) continue;
15134
+ for (const importer of importers) if (state.resolvedEntryMap.has(importer)) affected.add(importer);
15135
+ }
15136
+ return affected;
15137
+ }
14984
15138
  function refreshModuleGraph(pluginCtx, state) {
14985
15139
  state.moduleImporters.clear();
14986
15140
  state.entryModuleIds.clear();
@@ -15028,11 +15182,37 @@ function appendSharedChunkImporters(bundle, state, onlyEntryIds, previousImporte
15028
15182
  }
15029
15183
  return trackedImporterIds;
15030
15184
  };
15185
+ const isProjectSourceModule = (rawId) => {
15186
+ if (!rawId) return false;
15187
+ const absoluteSrcRoot = state.ctx?.configService?.absoluteSrcRoot;
15188
+ if (!absoluteSrcRoot) return false;
15189
+ const normalizedRoot = normalizeFsResolvedId(absoluteSrcRoot);
15190
+ const normalizedId = normalizeFsResolvedId(rawId);
15191
+ if (isSkippableResolvedId(normalizedId)) return false;
15192
+ return normalizedId === normalizedRoot || normalizedId.startsWith(`${normalizedRoot}/`);
15193
+ };
15194
+ const collectProjectSourceModules = (chunk) => {
15195
+ const moduleIds = /* @__PURE__ */ new Set();
15196
+ if (isProjectSourceModule(chunk.facadeModuleId)) moduleIds.add(normalizeFsResolvedId(chunk.facadeModuleId));
15197
+ if (Array.isArray(chunk.moduleIds)) {
15198
+ for (const moduleId of chunk.moduleIds) if (isProjectSourceModule(moduleId)) moduleIds.add(normalizeFsResolvedId(moduleId));
15199
+ }
15200
+ for (const moduleId of Object.keys(chunk.modules ?? {})) if (isProjectSourceModule(moduleId)) moduleIds.add(normalizeFsResolvedId(moduleId));
15201
+ return moduleIds;
15202
+ };
15203
+ const addSharedChunkModule = (moduleId, chunkId) => {
15204
+ const current = state.hmrSharedChunksByModule.get(moduleId);
15205
+ if (current) current.add(chunkId);
15206
+ else state.hmrSharedChunksByModule.set(moduleId, new Set([chunkId]));
15207
+ };
15031
15208
  for (const [bundleKey, output] of Object.entries(bundle)) {
15032
15209
  if (output?.type !== "chunk") continue;
15033
15210
  const chunk = output;
15034
15211
  if (!chunk.fileName) chunk.fileName = bundleKey;
15212
+ const projectSourceModules = collectProjectSourceModules(chunk);
15035
15213
  bundleChunks.set(chunk.fileName, chunk);
15214
+ if (projectSourceModules.size > 0) state.hmrSourceSharedChunks.add(chunk.fileName);
15215
+ for (const moduleId of projectSourceModules) addSharedChunkModule(moduleId, chunk.fileName);
15036
15216
  }
15037
15217
  const trackedImporterIdsByChunk = /* @__PURE__ */ new Map();
15038
15218
  for (const [fileName, chunk] of bundleChunks) {
@@ -15086,6 +15266,8 @@ function refreshSharedChunkImporters(bundle, state) {
15086
15266
  state.hmrSharedChunkImporters.clear();
15087
15267
  state.hmrSharedChunksByEntry.clear();
15088
15268
  state.hmrSharedChunkDependencies.clear();
15269
+ state.hmrSharedChunksByModule.clear();
15270
+ state.hmrSourceSharedChunks.clear();
15089
15271
  appendSharedChunkImporters(bundle, state);
15090
15272
  }
15091
15273
  function refreshPartialSharedChunkImporters(bundle, state, entryIds) {
@@ -17508,6 +17690,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
17508
17690
  if (sidecarWatcherMap.has(absRoot)) return;
17509
17691
  let isReady = false;
17510
17692
  const knownSidecarFiles = /* @__PURE__ */ new Set();
17693
+ const preReadyDeletedKnownFiles = /* @__PURE__ */ new Set();
17511
17694
  const renameTimers = /* @__PURE__ */ new Map();
17512
17695
  const RENAME_SETTLE_MS = 120;
17513
17696
  const handleSidecarChange = (event, filePath, ready) => {
@@ -17548,10 +17731,17 @@ function ensureSidecarWatcher(ctx, rootDir) {
17548
17731
  const forwardChange = (event, input, options) => {
17549
17732
  if (!input) return;
17550
17733
  const normalizedPath = path.normalize(input);
17551
- if (event === "create" || event === "update") knownSidecarFiles.add(normalizedPath);
17552
- else if (event === "delete") knownSidecarFiles.delete(normalizedPath);
17734
+ const wasKnown = knownSidecarFiles.has(normalizedPath);
17735
+ const isPreReadyAtomicRestore = event === "create" && preReadyDeletedKnownFiles.has(normalizedPath);
17736
+ if (event === "create" || event === "update") {
17737
+ knownSidecarFiles.add(normalizedPath);
17738
+ preReadyDeletedKnownFiles.delete(normalizedPath);
17739
+ } else if (event === "delete") {
17740
+ if (!isReady && wasKnown) preReadyDeletedKnownFiles.add(normalizedPath);
17741
+ knownSidecarFiles.delete(normalizedPath);
17742
+ }
17553
17743
  if (!options?.silent) logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
17554
- handleSidecarChange(event, normalizedPath, isReady);
17744
+ handleSidecarChange(event, normalizedPath, isReady || isPreReadyAtomicRestore);
17555
17745
  };
17556
17746
  watcher.on("add", (path) => forwardChange("create", path));
17557
17747
  watcher.on("change", (path) => forwardChange("update", path));
@@ -17599,6 +17789,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
17599
17789
  sidecarWatcherMap.set(absRoot, { close: () => {
17600
17790
  for (const timer of renameTimers.values()) clearTimeout(timer);
17601
17791
  renameTimers.clear();
17792
+ preReadyDeletedKnownFiles.clear();
17602
17793
  return watcher.close();
17603
17794
  } });
17604
17795
  }
@@ -17621,6 +17812,12 @@ function createSidecarIgnoredMatcher(ctx, rootDir) {
17621
17812
  const configSuffixes = configExtensions.map((ext) => `.${ext}`);
17622
17813
  const styleSuffixes = supportedCssLangs.map((ext) => `.${ext}`);
17623
17814
  const ATOMIC_SAVE_RECHECK_DELAYS_MS = [20, 60];
17815
+ function isOutputFileChange(state, normalizedId) {
17816
+ const outDir = state.ctx.configService?.outDir;
17817
+ if (!outDir) return false;
17818
+ const normalizedOutDir = normalizeFsResolvedId(outDir);
17819
+ return normalizedId === normalizedOutDir || normalizedId.startsWith(`${normalizedOutDir}/`);
17820
+ }
17624
17821
  async function normalizeWatchEvent(id, event) {
17625
17822
  if (event !== "delete") return event;
17626
17823
  for (const delayMs of ATOMIC_SAVE_RECHECK_DELAYS_MS) {
@@ -17644,11 +17841,22 @@ function createBuildStartHook(state) {
17644
17841
  await emitDirtyEntries.call(this);
17645
17842
  };
17646
17843
  }
17844
+ async function isVueEntryJsonOnlyUpdate(state, normalizedId) {
17845
+ if (!normalizedId.endsWith(".vue")) return false;
17846
+ const previous = state.ctx.runtimeState.build.hmr.vueEntryNonJsonSignatures.get(normalizedId);
17847
+ if (!previous) return false;
17848
+ try {
17849
+ return resolveVueSfcNonJsonSignature(await fs.readFile(normalizedId, "utf-8"), normalizedId) === previous;
17850
+ } catch {
17851
+ return false;
17852
+ }
17853
+ }
17647
17854
  async function processChangedFile(state, id, event) {
17648
17855
  const { ctx, subPackageMeta, loadEntry, loadedEntrySet, resolvedEntryMap } = state;
17649
17856
  const { scanService, configService, buildService } = ctx;
17650
17857
  const normalizedId = normalizeFsResolvedId(id);
17651
17858
  if (isSkippableResolvedId(normalizedId)) return;
17859
+ const importerGraphAffectedEntryIds = /* @__PURE__ */ new Set();
17652
17860
  const relativeSrc = configService.relativeAbsoluteSrcRoot(normalizedId);
17653
17861
  const affectedLayoutEntryIds = /* @__PURE__ */ new Set();
17654
17862
  const dirtyReasonStats = /* @__PURE__ */ new Map();
@@ -17659,6 +17867,7 @@ async function processChangedFile(state, id, event) {
17659
17867
  const declaredEntryType = state.entriesMap.get(removeExtensionDeep(relativeSrc))?.type;
17660
17868
  const isDeletedMissingSelf = event === "delete" && !await fs.pathExists(normalizedId);
17661
17869
  const isAutoRouteFile = Boolean(ctx.autoRoutesService?.isRouteFile(normalizedId));
17870
+ if (isDeletedMissingSelf) ctx.runtimeState.build.hmr.vueEntryNonJsonSignatures.delete(normalizedId);
17662
17871
  if ((event === "create" || isDeletedMissingSelf) && isAutoRouteFile) {
17663
17872
  if (await ctx.autoRoutesService?.handleFileChange(normalizedId, event)) dirtyReasonStats.set("auto-routes-topology", 1);
17664
17873
  }
@@ -17705,13 +17914,23 @@ async function processChangedFile(state, id, event) {
17705
17914
  for (const entryId of resolvedEntryMap.keys()) markEntryDirtyWithCause(entryId, "dependency", "layout-fallback-full");
17706
17915
  return [...dirtyReasonStats.entries()].map(([cause, count]) => `${cause}:${count}`);
17707
17916
  }
17708
- if (!isDeletedMissingSelf && (loadedEntrySet.has(normalizedId) || declaredEntryType === "page" || declaredEntryType === "component")) markEntryDirtyWithCause(normalizedId, "direct", "entry-direct");
17709
- else if (state.layoutEntryDependents.size && state.layoutEntryDependents.get(normalizedId)?.size) {
17917
+ if (!isDeletedMissingSelf && (loadedEntrySet.has(normalizedId) || declaredEntryType === "page" || declaredEntryType === "component")) {
17918
+ const isJsonOnlyVueEntryUpdate = event === "update" && await isVueEntryJsonOnlyUpdate(state, normalizedId);
17919
+ markEntryDirtyWithCause(normalizedId, isJsonOnlyVueEntryUpdate ? "metadata" : "direct", isJsonOnlyVueEntryUpdate ? "entry-json-only" : "entry-direct");
17920
+ } else if (state.layoutEntryDependents.size && state.layoutEntryDependents.get(normalizedId)?.size) {
17710
17921
  const affectedEntries = state.layoutEntryDependents.get(normalizedId);
17711
17922
  for (const entryId of affectedEntries) markEntryDirtyWithCause(entryId, "dependency", "layout-dependent");
17712
17923
  } else if (state.moduleImporters.size && state.entryModuleIds.size) {
17713
17924
  const affected = collectAffectedEntries(state, normalizedId);
17714
- if (affected.size) for (const entryId of affected) markEntryDirtyWithCause(entryId, "dependency", "importer-graph");
17925
+ if (affected.size) for (const entryId of affected) {
17926
+ importerGraphAffectedEntryIds.add(entryId);
17927
+ markEntryDirtyWithCause(entryId, "dependency", "importer-graph");
17928
+ }
17929
+ }
17930
+ const sharedChunkAffected = collectAffectedEntriesFromSharedChunks(state, normalizedId);
17931
+ if (sharedChunkAffected.size) for (const entryId of sharedChunkAffected) {
17932
+ if (importerGraphAffectedEntryIds.has(entryId)) continue;
17933
+ markEntryDirtyWithCause(entryId, "dependency", "shared-chunk-source");
17715
17934
  }
17716
17935
  const relativeCwd = configService.relativeCwd(normalizedId);
17717
17936
  let handledByIndependentWatcher = false;
@@ -17753,10 +17972,12 @@ function createWatchChangeHook(state) {
17753
17972
  const startedAt = performance.now();
17754
17973
  const normalizedId = normalizeFsResolvedId(id);
17755
17974
  if (isSkippableResolvedId(normalizedId)) return;
17975
+ if (isOutputFileChange(state, normalizedId)) return;
17756
17976
  const event = await normalizeWatchEvent(normalizedId, change.event);
17757
17977
  const dirtyReasonSummary = await processChangedFile(state, normalizedId, event);
17758
17978
  state.ctx.runtimeState.build.hmr.profile = {
17759
17979
  ...state.ctx.runtimeState.build.hmr.profile,
17980
+ eventId: createHmrProfileEventId(),
17760
17981
  event,
17761
17982
  file: normalizedId,
17762
17983
  watchToDirtyMs: performance.now() - startedAt,
@@ -17849,6 +18070,8 @@ function weappVite(ctx, subPackageMeta) {
17849
18070
  const hmrSharedChunkImporters = /* @__PURE__ */ new Map();
17850
18071
  const hmrSharedChunksByEntry = /* @__PURE__ */ new Map();
17851
18072
  const hmrSharedChunkDependencies = /* @__PURE__ */ new Map();
18073
+ const hmrSharedChunksByModule = /* @__PURE__ */ new Map();
18074
+ const hmrSourceSharedChunks = /* @__PURE__ */ new Set();
17852
18075
  const hmrState = {
17853
18076
  didEmitAllEntries: false,
17854
18077
  hasBuiltOnce: false,
@@ -17860,11 +18083,14 @@ function weappVite(ctx, subPackageMeta) {
17860
18083
  sharedChunks: hmrSharedChunksMode,
17861
18084
  sharedChunkImporters: hmrSharedChunkImporters,
17862
18085
  sharedChunksByEntry: hmrSharedChunksByEntry,
18086
+ sourceSharedChunks: hmrSourceSharedChunks,
17863
18087
  setDidEmitAllEntries: (value) => {
17864
18088
  hmrState.didEmitAllEntries = value;
18089
+ if (ctx.runtimeState?.build?.hmr) ctx.runtimeState.build.hmr.didEmitAllEntries = value;
17865
18090
  },
17866
18091
  setLastEmittedEntries: (entryIds) => {
17867
18092
  hmrState.lastEmittedEntryIds = new Set(entryIds);
18093
+ if (ctx.runtimeState?.build?.hmr) ctx.runtimeState.build.hmr.lastEmittedEntryIds = new Set(entryIds);
17868
18094
  }
17869
18095
  }
17870
18096
  });
@@ -17889,7 +18115,9 @@ function weappVite(ctx, subPackageMeta) {
17889
18115
  hmrSharedChunksMode,
17890
18116
  hmrSharedChunkImporters,
17891
18117
  hmrSharedChunksByEntry,
17892
- hmrSharedChunkDependencies
18118
+ hmrSharedChunkDependencies,
18119
+ hmrSharedChunksByModule,
18120
+ hmrSourceSharedChunks
17893
18121
  };
17894
18122
  return [
17895
18123
  createWxssResolverPlugin(state),
@@ -19014,6 +19242,8 @@ function scanWxml(wxml, options) {
19014
19242
  //#endregion
19015
19243
  //#region src/plugins/vue/transform/bundle/platform.ts
19016
19244
  const LEADING_DOT_SLASH_RE$1 = /^\.\//;
19245
+ const SCOPED_SLOT_GENERIC_KEY_RE = /^scoped-slots-/;
19246
+ const WEAPP_SCOPED_SLOT_GENERIC_PLACEHOLDER_TEMPLATE = "<view wx:if=\"{{false}}\" />";
19017
19247
  function resolveVueBundlePlatformOptions(options) {
19018
19248
  return {
19019
19249
  normalizeUsingComponents: resolveVueTransformJsonPlatformOptions({
@@ -19035,15 +19265,29 @@ function resolveVueBundlePlatformAssetOptions(options) {
19035
19265
  alipayNpmMode: options.configService?.weappViteConfig?.npm?.alipayNpmMode
19036
19266
  };
19037
19267
  }
19268
+ function shouldNormalizeWeappScopedSlotGenericPlaceholder(config) {
19269
+ if (!config || typeof config !== "object" || Array.isArray(config)) return false;
19270
+ const componentGenerics = config.componentGenerics;
19271
+ if (!componentGenerics || typeof componentGenerics !== "object" || Array.isArray(componentGenerics)) return false;
19272
+ return Object.entries(componentGenerics).some(([key, value]) => {
19273
+ if (!SCOPED_SLOT_GENERIC_KEY_RE.test(key)) return false;
19274
+ if (value === true) return true;
19275
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
19276
+ const defaultValue = value.default;
19277
+ return typeof defaultValue !== "string" || !defaultValue.trim();
19278
+ });
19279
+ }
19038
19280
  function normalizeVueConfigForPlatform(config, options) {
19039
19281
  const jsonPlatformOptions = resolveVueTransformJsonPlatformOptions({
19040
19282
  platform: options.platform,
19041
19283
  packageJson: { dependencies: options.dependencies },
19042
19284
  weappViteConfig: { npm: { alipayNpmMode: options.alipayNpmMode } }
19043
19285
  });
19044
- if (!config || !jsonPlatformOptions.normalizeUsingComponents) return config;
19286
+ if (!config) return config;
19045
19287
  try {
19046
- return resolveJson({ json: JSON.parse(config) }, void 0, options.platform, {
19288
+ const parsed = JSON.parse(config);
19289
+ if (!(jsonPlatformOptions.normalizeUsingComponents || options.platform === "weapp" && shouldNormalizeWeappScopedSlotGenericPlaceholder(parsed))) return config;
19290
+ return resolveJson({ json: parsed }, void 0, options.platform, {
19047
19291
  dependencies: jsonPlatformOptions.dependencies,
19048
19292
  alipayNpmMode: jsonPlatformOptions.alipayNpmMode
19049
19293
  }) ?? config;
@@ -19086,18 +19330,24 @@ function emitPlatformTemplateAsset(bundle, options) {
19086
19330
  emitSfcTemplateIfMissing(options.pluginCtx, bundle, options.relativeBase, normalizedTemplate, options.templateExtension);
19087
19331
  return normalizedTemplate;
19088
19332
  }
19089
- function resolveAlipayGenericPlaceholderBase(relativeBase) {
19333
+ function resolveGenericPlaceholderBase(relativeBase, placeholder) {
19090
19334
  const dirIndex = relativeBase.lastIndexOf("/");
19091
19335
  const dir = dirIndex >= 0 ? relativeBase.slice(0, dirIndex) : "";
19092
- const placeholderName = ALIPAY_GENERIC_COMPONENT_PLACEHOLDER.replace(LEADING_DOT_SLASH_RE$1, "");
19336
+ const placeholderName = placeholder.replace(LEADING_DOT_SLASH_RE$1, "");
19093
19337
  return dir ? `${dir}/${placeholderName}` : placeholderName;
19094
19338
  }
19095
- function emitAlipayGenericPlaceholderAssetsByBase(ctx, bundle, placeholderBase, outputExtensions) {
19339
+ function resolveAlipayGenericPlaceholderBase(relativeBase) {
19340
+ return resolveGenericPlaceholderBase(relativeBase, ALIPAY_GENERIC_COMPONENT_PLACEHOLDER);
19341
+ }
19342
+ function resolveWeappScopedSlotGenericPlaceholderBase(relativeBase) {
19343
+ return resolveGenericPlaceholderBase(relativeBase, WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER);
19344
+ }
19345
+ function emitAlipayGenericPlaceholderAssetsByBase(ctx, bundle, placeholderBase, outputExtensions, options) {
19096
19346
  const templateExtension = outputExtensions?.wxml ?? "wxml";
19097
19347
  const jsonExtension = outputExtensions?.json ?? "json";
19098
19348
  const scriptExtension = outputExtensions?.js ?? "js";
19099
- emitSfcTemplateIfMissing(ctx, bundle, placeholderBase, "<view />", templateExtension);
19100
- emitSfcJsonAsset(ctx, bundle, placeholderBase, { config: JSON.stringify({ component: true }) }, {
19349
+ emitSfcTemplateIfMissing(ctx, bundle, placeholderBase, options?.templateSource ?? "<view />", templateExtension);
19350
+ emitSfcJsonAsset(ctx, bundle, placeholderBase, { config: JSON.stringify(options?.jsonConfig ?? { component: true }) }, {
19101
19351
  extension: jsonExtension,
19102
19352
  kind: "component"
19103
19353
  });
@@ -19121,7 +19371,26 @@ function shouldEmitAlipayGenericPlaceholder(configSource) {
19121
19371
  return value.default === ALIPAY_GENERIC_COMPONENT_PLACEHOLDER;
19122
19372
  });
19123
19373
  }
19374
+ function shouldEmitWeappScopedSlotGenericPlaceholder(configSource) {
19375
+ if (!configSource) return false;
19376
+ let config;
19377
+ try {
19378
+ const parsed = JSON.parse(configSource);
19379
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return false;
19380
+ config = parsed;
19381
+ } catch {
19382
+ return false;
19383
+ }
19384
+ const componentGenerics = config.componentGenerics;
19385
+ if (!componentGenerics || typeof componentGenerics !== "object" || Array.isArray(componentGenerics)) return false;
19386
+ return Object.entries(componentGenerics).some(([key, value]) => {
19387
+ if (!SCOPED_SLOT_GENERIC_KEY_RE.test(key)) return false;
19388
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
19389
+ return value.default === WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER;
19390
+ });
19391
+ }
19124
19392
  function resolveGenericPlaceholderBaseForPlatform(relativeBase, configSource, platform) {
19393
+ if (platform === "weapp") return shouldEmitWeappScopedSlotGenericPlaceholder(configSource) ? resolveWeappScopedSlotGenericPlaceholderBase(relativeBase) : void 0;
19125
19394
  if (!resolveVueBundlePlatformOptions({ platform }).emitGenericPlaceholder || !configSource) return;
19126
19395
  if (!shouldEmitAlipayGenericPlaceholder(configSource)) return;
19127
19396
  return resolveAlipayGenericPlaceholderBase(relativeBase);
@@ -19129,7 +19398,13 @@ function resolveGenericPlaceholderBaseForPlatform(relativeBase, configSource, pl
19129
19398
  function emitAlipayGenericPlaceholderAssets(ctx, bundle, relativeBase, configSource, outputExtensions, platform) {
19130
19399
  const placeholderBase = resolveGenericPlaceholderBaseForPlatform(relativeBase, configSource, platform);
19131
19400
  if (!placeholderBase) return;
19132
- emitAlipayGenericPlaceholderAssetsByBase(ctx, bundle, placeholderBase, outputExtensions);
19401
+ emitAlipayGenericPlaceholderAssetsByBase(ctx, bundle, placeholderBase, outputExtensions, platform === "weapp" ? {
19402
+ jsonConfig: {
19403
+ component: true,
19404
+ options: { virtualHost: true }
19405
+ },
19406
+ templateSource: WEAPP_SCOPED_SLOT_GENERIC_PLACEHOLDER_TEMPLATE
19407
+ } : void 0);
19133
19408
  }
19134
19409
  function prepareNormalizedVueConfigForPlatform(options) {
19135
19410
  return normalizeVueConfigForPlatform(options.config, {
@@ -19152,7 +19427,13 @@ function resolvePlatformConfigAssetState(options) {
19152
19427
  }
19153
19428
  function emitPlatformConfigSideEffects(bundle, options) {
19154
19429
  if (options.genericPlaceholderBase) {
19155
- emitAlipayGenericPlaceholderAssetsByBase(options.pluginCtx, bundle, options.genericPlaceholderBase, options.outputExtensions);
19430
+ emitAlipayGenericPlaceholderAssetsByBase(options.pluginCtx, bundle, options.genericPlaceholderBase, options.outputExtensions, options.platform === "weapp" ? {
19431
+ jsonConfig: {
19432
+ component: true,
19433
+ options: { virtualHost: true }
19434
+ },
19435
+ templateSource: WEAPP_SCOPED_SLOT_GENERIC_PLACEHOLDER_TEMPLATE
19436
+ } : void 0);
19156
19437
  return;
19157
19438
  }
19158
19439
  emitAlipayGenericPlaceholderAssets(options.pluginCtx, bundle, options.relativeBase, options.config, options.outputExtensions, options.platform);
@@ -19423,7 +19704,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
19423
19704
  const importerBaseName = removeExtensionDeep(vuePath);
19424
19705
  const autoImportResolveCache = /* @__PURE__ */ new Map();
19425
19706
  const scopedSlotsCompiler = configService.weappViteConfig?.vue?.template?.scopedSlotsCompiler ?? "auto";
19426
- const scopedSlotsRequireProps = configService.weappViteConfig?.vue?.template?.scopedSlotsRequireProps ?? scopedSlotsCompiler !== "augmented";
19707
+ const scopedSlotsRequireProps = configService.weappViteConfig?.vue?.template?.scopedSlotsRequireProps ?? false;
19427
19708
  const slotSingleRootNoWrapper = configService.weappViteConfig?.vue?.template?.slotSingleRootNoWrapper ?? false;
19428
19709
  const slotMultipleInstance = configService.weappViteConfig?.vue?.template?.slotMultipleInstance ?? true;
19429
19710
  const htmlTagToWxml = configService.weappViteConfig?.vue?.template?.htmlTagToWxml;
@@ -19447,6 +19728,33 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
19447
19728
  const jsonConfig = configService.weappViteConfig?.json;
19448
19729
  const wevuDefaults = resolveWevuDefaultsWithPreset(configService.weappViteConfig);
19449
19730
  const jsonKind = isApp ? "app" : isPage ? "page" : "component";
19731
+ async function resolveAutoImportComponentSourceType(match) {
19732
+ if (match.kind === "local") {
19733
+ const resolvedId = match.entry.templatePath;
19734
+ return {
19735
+ resolvedId,
19736
+ sourceType: resolvedId?.endsWith(".vue") ? "wevu-sfc" : "native"
19737
+ };
19738
+ }
19739
+ const explicitSourceType = match.value.sourceType;
19740
+ const explicitResolvedId = match.value.resolvedId;
19741
+ if (explicitSourceType || explicitResolvedId?.endsWith(".vue") || match.value.from.endsWith(".vue")) return {
19742
+ resolvedId: explicitResolvedId,
19743
+ sourceType: explicitSourceType ?? (explicitResolvedId?.endsWith(".vue") || match.value.from.endsWith(".vue") ? "wevu-sfc" : "native")
19744
+ };
19745
+ let localSourceBase;
19746
+ if (match.value.from.startsWith("/")) localSourceBase = path.join(configService.absoluteSrcRoot, match.value.from.slice(1));
19747
+ else if (match.value.from.startsWith(".")) localSourceBase = path.resolve(path.dirname(importerBaseName), match.value.from);
19748
+ if (!localSourceBase) return {
19749
+ resolvedId: explicitResolvedId,
19750
+ sourceType: "native"
19751
+ };
19752
+ const resolvedId = await resolveEntryPath(localSourceBase, createCachedEntryResolveOptions(configService, { kind: "default" }));
19753
+ return {
19754
+ resolvedId,
19755
+ sourceType: resolvedId?.endsWith(".vue") ? "wevu-sfc" : "native"
19756
+ };
19757
+ }
19450
19758
  return {
19451
19759
  isPage,
19452
19760
  isApp,
@@ -19469,7 +19777,12 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
19469
19777
  match,
19470
19778
  version
19471
19779
  });
19472
- return match?.value;
19780
+ if (!match?.value) return;
19781
+ const sourceInfo = await resolveAutoImportComponentSourceType(match);
19782
+ return {
19783
+ ...match.value,
19784
+ ...sourceInfo
19785
+ };
19473
19786
  }
19474
19787
  },
19475
19788
  template: {
@@ -20282,7 +20595,10 @@ function resolveVueBundleEmitState(state) {
20282
20595
  const { ctx, compilationCache } = state;
20283
20596
  const { configService, scanService } = ctx;
20284
20597
  if (!configService || !scanService) return;
20285
- return { compilationEntries: Array.from(compilationCache.entries()) };
20598
+ const emittedEntryIds = Boolean(configService.isDev && ctx.runtimeState?.build?.hmr?.profile?.event === "update" && !ctx.runtimeState.build.hmr.didEmitAllEntries && ctx.runtimeState.build.hmr.lastEmittedEntryIds.size > 0) ? ctx.runtimeState.build.hmr.lastEmittedEntryIds : void 0;
20599
+ return { compilationEntries: Array.from(compilationCache.entries()).filter(([id]) => {
20600
+ return !emittedEntryIds || emittedEntryIds.has(normalizeFsResolvedId(id));
20601
+ }) };
20286
20602
  }
20287
20603
  async function emitCompiledBundleEntries(bundle, state, compilationEntries) {
20288
20604
  for (const [filename, cached] of compilationEntries) await emitCompiledVueEntryAssets(bundle, state, filename, cached);
@@ -20917,7 +21233,8 @@ function createVueTransformPlugin(ctx) {
20917
21233
  classStyleRuntimeWarned
20918
21234
  });
20919
21235
  },
20920
- watchChange(id) {
21236
+ watchChange(id, change) {
21237
+ const startedAt = performance.now();
20921
21238
  const normalizedId = normalizeFsResolvedId(id);
20922
21239
  handleTransformLayoutInvalidation(normalizedId, {
20923
21240
  configService: ctx.configService,
@@ -20931,6 +21248,13 @@ function createVueTransformPlugin(ctx) {
20931
21248
  styleBlocksCache,
20932
21249
  existsSync: fs.existsSync
20933
21250
  });
21251
+ const profile = ctx.runtimeState?.build?.hmr?.profile;
21252
+ if (profile && !profile.file) {
21253
+ profile.eventId = createHmrProfileEventId();
21254
+ profile.event = change?.event ?? "update";
21255
+ profile.file = normalizedId;
21256
+ profile.watchToDirtyMs = performance.now() - startedAt;
21257
+ }
20934
21258
  },
20935
21259
  async handleHotUpdate({ file }) {
20936
21260
  if (handleTransformLayoutInvalidation(file, {
@@ -22055,6 +22379,9 @@ function createRuntimeState() {
22055
22379
  entriesMap: /* @__PURE__ */ new Map(),
22056
22380
  layoutEntryDependents: /* @__PURE__ */ new Map(),
22057
22381
  entryLayoutDependencies: /* @__PURE__ */ new Map(),
22382
+ vueEntryNonJsonSignatures: /* @__PURE__ */ new Map(),
22383
+ didEmitAllEntries: false,
22384
+ lastEmittedEntryIds: /* @__PURE__ */ new Set(),
22058
22385
  recentProfiles: [],
22059
22386
  profile: {}
22060
22387
  }
@@ -22229,7 +22556,7 @@ async function loadAppEntry(ctx, scanState) {
22229
22556
  const vueAppPath = await findVueEntry(appBasename);
22230
22557
  let configFromVue;
22231
22558
  if (!appConfigFile && vueAppPath) {
22232
- const { extractConfigFromVue } = await import("./file-DBSS-d92.mjs");
22559
+ const { extractConfigFromVue } = await import("./file-djYgQoCM.mjs");
22233
22560
  configFromVue = await extractConfigFromVue(vueAppPath);
22234
22561
  if (configFromVue) appConfigFile = vueAppPath;
22235
22562
  }
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-BxGRfA3y.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-BzppVHkY.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-BC_RNbAI.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-C-05IQc1.mjs";
2
+ export { getCompilerContext };
@@ -2,6 +2,8 @@
2
2
  interface ResolvedValue {
3
3
  name: string;
4
4
  from: string;
5
+ resolvedId?: string;
6
+ sourceType?: 'wevu-sfc' | 'native';
5
7
  }
6
8
  type ResolverSupportFilesStrategy = 'used' | 'full';
7
9
  interface ExternalMetadataFileCandidates {
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Ref, Bn as resolveWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, I as RolldownPluginOption, In as WeappViteRuntime, L as RolldownWatchOptions, Ln as applyWeappViteHostMeta, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Pn as WEAPP_VITE_HOST_NAME, R as RolldownWatcher, Rn as createWeappViteHostMeta, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as isWeappViteHost } from "./config-BEJTp6sp.mjs";
1
+ import { A as Ref, Bn as resolveWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, I as RolldownPluginOption, In as WeappViteRuntime, L as RolldownWatchOptions, Ln as applyWeappViteHostMeta, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Pn as WEAPP_VITE_HOST_NAME, R as RolldownWatcher, Rn as createWeappViteHostMeta, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as isWeappViteHost } from "./config-BKXx-hW-.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
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
2
  import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
3
3
  import { t as defineConfig } from "./config-DJjSbpNX.mjs";
4
- import { t as createCompilerContext } from "./createContext-CaCrpsG-.mjs";
4
+ import { t as createCompilerContext } from "./createContext-C-05IQc1.mjs";
5
5
  import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DN3lxU9s.mjs";
6
6
  export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
package/dist/json.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-BEJTp6sp.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-BKXx-hW-.mjs";
2
2
  export { App, Component, Page, Sitemap, Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
@@ -1,4 +1,5 @@
1
1
  import { r as logger_default } from "./logger-CgxdNjvb.mjs";
2
+ import { connectMiniProgram } from "weapp-ide-cli";
2
3
  import { DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, createWeappViteMcpServer, startWeappViteMcpServer } from "@weapp-vite/mcp";
3
4
  //#region src/mcp.ts
4
5
  function normalizeEndpoint(input) {
@@ -29,6 +30,7 @@ function resolveWeappMcpConfig(config) {
29
30
  }
30
31
  async function startWeappViteMcpServer$1(options) {
31
32
  return startWeappViteMcpServer({
33
+ runtimeHooks: { connectMiniProgram },
32
34
  ...options,
33
35
  onReady: options?.onReady ?? ((message) => {
34
36
  logger_default.info(message);
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { xt as WeappMcpConfig } from "./config-BEJTp6sp.mjs";
1
+ import { xt as WeappMcpConfig } from "./config-BKXx-hW-.mjs";
2
2
  import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
3
3
 
4
4
  //#region src/mcp.d.ts
package/dist/mcp.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as resolveWeappMcpConfig, i as createWeappViteMcpServer, n as DEFAULT_MCP_HOST, o as startWeappViteMcpServer, r as DEFAULT_MCP_PORT, t as DEFAULT_MCP_ENDPOINT } from "./mcp-DRlj32v4.mjs";
1
+ import { a as resolveWeappMcpConfig, i as createWeappViteMcpServer, n as DEFAULT_MCP_HOST, o as startWeappViteMcpServer, r as DEFAULT_MCP_PORT, t as DEFAULT_MCP_ENDPOINT } from "./mcp-BzcrPiku.mjs";
2
2
  export { DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, createWeappViteMcpServer, resolveWeappMcpConfig, startWeappViteMcpServer };
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as Resolver } from "./index-6QUk3Zbc.mjs";
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 WeappDebugConfig, $t as JsonConfig, A as Ref, An as WeappManagedServerTsconfigConfig, At as WeappWevuConfig, B as BindingErrorLike, Bt as GenerateExtensionsOptions, Cn as WeappLibDtsOptions, Ct as WeappRequestRuntimeConfig, D as MethodDefinitions, Dn as WeappLibVueTscOptions, Dt as WeappVueConfig, E as InlineConfig, En as WeappLibInternalDtsOptions, Et as WeappSubPackageConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, Ft as BuildNpmPackageMeta, G as EntryJsonFragment, Gt as GenerateTemplateContext, H as BaseEntry, Ht as GenerateFilenamesOptions, I as RolldownPluginOption, In as WeappViteRuntime, It as ChunksConfig, J as ScanComponentItem, Jt as GenerateTemplateFileSource, K as PageEntry, Kt as GenerateTemplateEntry, L as RolldownWatchOptions, Lt as CopyGlobs, M as RolldownBuild, Mn as WeappManagedTypeScriptConfig, Mt as Alias, N as RolldownOptions, Nn as WeappWebConfig, Nt as AliasOptions, O as Plugin, On as WeappManagedAppTsconfigConfig, Ot as WeappVueTemplateConfig, P as RolldownOutput, Pt as AlipayNpmMode, Q as UserConfig, Qt as JsFormat, R as RolldownWatcher, Rt as CopyOptions, Sn as WeappLibConfig, St as WeappNpmConfig, T as ConfigEnv, Tn as WeappLibFileName, Tt as WeappRouteRules, U as ComponentEntry, Ut as GenerateOptions, V as AppEntry, Vt as GenerateFileType, W as Entry, Wt as GenerateTemplate, X as ProjectConfig, Xt as GenerateTemplateScope, Y as WxmlDep, Yt as GenerateTemplateInlineSource, Z as SubPackageMetaValue, Zt as GenerateTemplatesConfig, _n as SubPackageStyleConfigEntry, _t as WeappInjectRequestGlobalsTarget, an as NpmBuildOptions, at as EnhanceOptions, b as ChangeEvent, bn as SubPackageStyleScope, bt as WeappInjectWebRuntimeGlobalsTarget, cn as NpmPluginPackageConfig, ct as MultiPlatformConfig, dn as ResolvedAlias, dt as WeappAppPreludeMode, en as JsonMergeContext, et as WeappForwardConsoleConfig, fn as SharedChunkDynamicImports, ft as WeappAutoRoutesConfig, gn as SubPackage, gt as WeappInjectRequestGlobalsConfig, hn as SharedChunkStrategy, ht as WeappHmrConfig, in as MpPlatform, it as AutoImportComponentsOption, j as ResolvedConfig, jn as WeappManagedSharedTsconfigConfig, jt as WeappWorkerConfig, k as PluginOption, kn as WeappManagedNodeTsconfigConfig, kt as WeappWebRuntimeConfig, ln as NpmStrategy, lt as ScanWxmlOptions, mn as SharedChunkOverride, mt as WeappAutoRoutesIncludePattern, nn as JsonMergeStage, nt as WeappViteConfig, on as NpmDependencyPattern, ot as EnhanceWxmlOptions, pn as SharedChunkMode, pt as WeappAutoRoutesInclude, q as ComponentsMap, qt as GenerateTemplateFactory, rn as JsonMergeStrategy, rt as AutoImportComponents, sn as NpmMainPackageConfig, st as HandleWxmlOptions, tn as JsonMergeFunction, tt as WeappForwardConsoleLogLevel, un as NpmSubPackageConfig, ut as WeappAppPreludeConfig, vn as SubPackageStyleConfigObject, vt as WeappInjectWeapiConfig, w as ComputedDefinitions, wn as WeappLibEntryContext, wt as WeappRouteRule, x as WeappVitePluginApi, xn as WeappLibComponentJson, xt as WeappMcpConfig, yn as SubPackageStyleEntry, yt as WeappInjectWebRuntimeGlobalsConfig, z as ViteDevServer, zt as GenerateDirsOptions } from "./config-BEJTp6sp.mjs";
3
+ import { $ as WeappDebugConfig, $t as JsonConfig, A as Ref, An as WeappManagedServerTsconfigConfig, At as WeappWevuConfig, B as BindingErrorLike, Bt as GenerateExtensionsOptions, Cn as WeappLibDtsOptions, Ct as WeappRequestRuntimeConfig, D as MethodDefinitions, Dn as WeappLibVueTscOptions, Dt as WeappVueConfig, E as InlineConfig, En as WeappLibInternalDtsOptions, Et as WeappSubPackageConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, Ft as BuildNpmPackageMeta, G as EntryJsonFragment, Gt as GenerateTemplateContext, H as BaseEntry, Ht as GenerateFilenamesOptions, I as RolldownPluginOption, In as WeappViteRuntime, It as ChunksConfig, J as ScanComponentItem, Jt as GenerateTemplateFileSource, K as PageEntry, Kt as GenerateTemplateEntry, L as RolldownWatchOptions, Lt as CopyGlobs, M as RolldownBuild, Mn as WeappManagedTypeScriptConfig, Mt as Alias, N as RolldownOptions, Nn as WeappWebConfig, Nt as AliasOptions, O as Plugin, On as WeappManagedAppTsconfigConfig, Ot as WeappVueTemplateConfig, P as RolldownOutput, Pt as AlipayNpmMode, Q as UserConfig, Qt as JsFormat, R as RolldownWatcher, Rt as CopyOptions, Sn as WeappLibConfig, St as WeappNpmConfig, T as ConfigEnv, Tn as WeappLibFileName, Tt as WeappRouteRules, U as ComponentEntry, Ut as GenerateOptions, V as AppEntry, Vt as GenerateFileType, W as Entry, Wt as GenerateTemplate, X as ProjectConfig, Xt as GenerateTemplateScope, Y as WxmlDep, Yt as GenerateTemplateInlineSource, Z as SubPackageMetaValue, Zt as GenerateTemplatesConfig, _n as SubPackageStyleConfigEntry, _t as WeappInjectRequestGlobalsTarget, an as NpmBuildOptions, at as EnhanceOptions, b as ChangeEvent, bn as SubPackageStyleScope, bt as WeappInjectWebRuntimeGlobalsTarget, cn as NpmPluginPackageConfig, ct as MultiPlatformConfig, dn as ResolvedAlias, dt as WeappAppPreludeMode, en as JsonMergeContext, et as WeappForwardConsoleConfig, fn as SharedChunkDynamicImports, ft as WeappAutoRoutesConfig, gn as SubPackage, gt as WeappInjectRequestGlobalsConfig, hn as SharedChunkStrategy, ht as WeappHmrConfig, in as MpPlatform, it as AutoImportComponentsOption, j as ResolvedConfig, jn as WeappManagedSharedTsconfigConfig, jt as WeappWorkerConfig, k as PluginOption, kn as WeappManagedNodeTsconfigConfig, kt as WeappWebRuntimeConfig, ln as NpmStrategy, lt as ScanWxmlOptions, mn as SharedChunkOverride, mt as WeappAutoRoutesIncludePattern, nn as JsonMergeStage, nt as WeappViteConfig, on as NpmDependencyPattern, ot as EnhanceWxmlOptions, pn as SharedChunkMode, pt as WeappAutoRoutesInclude, q as ComponentsMap, qt as GenerateTemplateFactory, rn as JsonMergeStrategy, rt as AutoImportComponents, sn as NpmMainPackageConfig, st as HandleWxmlOptions, tn as JsonMergeFunction, tt as WeappForwardConsoleLogLevel, un as NpmSubPackageConfig, ut as WeappAppPreludeConfig, vn as SubPackageStyleConfigObject, vt as WeappInjectWeapiConfig, w as ComputedDefinitions, wn as WeappLibEntryContext, wt as WeappRouteRule, x as WeappVitePluginApi, xn as WeappLibComponentJson, xt as WeappMcpConfig, yn as SubPackageStyleEntry, yt as WeappInjectWebRuntimeGlobalsConfig, z as ViteDevServer, zt as GenerateDirsOptions } from "./config-BKXx-hW-.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, 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.15.17",
4
+ "version": "6.16.0",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -104,11 +104,11 @@
104
104
  "lru-cache": "^11.3.5",
105
105
  "magic-string": "^0.30.21",
106
106
  "merge": "^2.1.1",
107
- "p-queue": "^9.1.2",
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.10",
111
+ "postcss": "^8.5.12",
112
112
  "rolldown": "1.0.0-rc.17",
113
113
  "rolldown-plugin-dts": "0.23.2",
114
114
  "semver": "^7.7.4",
@@ -117,29 +117,29 @@
117
117
  "vite-tsconfig-paths": "^6.1.1",
118
118
  "vue": "^3.5.33",
119
119
  "vue-tsc": "^3.2.7",
120
- "@weapp-core/constants": "^0.1.3",
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.15.17",
126
- "@weapp-vite/mcp": "1.2.1",
125
+ "@weapp-vite/ast": "6.16.0",
126
+ "@weapp-vite/mcp": "1.3.0",
127
127
  "@weapp-vite/miniprogram-automator": "1.0.4",
128
128
  "@weapp-vite/volar": "2.1.0",
129
- "@weapp-vite/web": "1.3.19",
130
129
  "@wevu/api": "0.2.6",
131
130
  "@wevu/web-apis": "1.2.10",
132
131
  "rolldown-require": "2.0.15",
133
132
  "vite-plugin-performance": "2.0.1",
134
- "weapp-ide-cli": "5.2.6",
135
- "wevu": "6.15.17"
133
+ "weapp-ide-cli": "5.2.7",
134
+ "wevu": "6.16.0",
135
+ "@weapp-vite/web": "1.3.19"
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.127.0",
142
+ "oxc-parser": "^0.128.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-DUPlM0cH.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-CaCrpsG-.mjs";
2
- export { getCompilerContext };