weapp-vite 6.16.27 → 6.16.29

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,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.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-B9O7wZIh.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-DgdYQ44n.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";
@@ -34,7 +34,8 @@ import { getPackageInfo, getPackageInfoSync, resolveModule } from "local-pkg";
34
34
  import { spawn } from "node:child_process";
35
35
  import * as t from "@weapp-vite/ast/babelTypes";
36
36
  import { objectHash } from "@weapp-core/shared/node";
37
- import { APP_PRELUDE_CHUNK_MARKER, APP_PRELUDE_GUARD_KEY, APP_PRELUDE_REQUIRE_MARKER, REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_BUNDLE_HOST_REF, REQUEST_GLOBAL_BUNDLE_MARKER, REQUEST_GLOBAL_CHUNK_HOST_REF, REQUEST_GLOBAL_CHUNK_MODULE_REF, REQUEST_GLOBAL_EXPOSE_HELPER, REQUEST_GLOBAL_INSTALLER_HOST_REF, REQUEST_GLOBAL_LAZY_CONSTRUCTOR_HELPER, REQUEST_GLOBAL_LAZY_FUNCTION_HELPER, REQUEST_GLOBAL_LOCAL_BINDINGS_MARKER, REQUEST_GLOBAL_MARK_PLACEHOLDER_HELPER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER as REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER$1, REQUEST_GLOBAL_PLACEHOLDER_KEY, REQUEST_GLOBAL_PRELUDE_GUARD_KEY, REQUEST_GLOBAL_PRELUDE_MARKER, REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME, REQUEST_GLOBAL_USABLE_CONSTRUCTOR_HELPER, WEAPP_VITE_IMPORT_META_ENV_KEY, WEAPP_VITE_INJECTED_API_IDENTIFIER, WEVU_APP_SHELL_COMPONENT_BASE, WEVU_APP_SHELL_TAG_NAME, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_INTERNAL_KEY_IDENTIFIER, WEVU_LAYOUT_BIND_PREFIX, WEVU_PAGE_LAYOUT_CURRENT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_CURRENT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_NEXT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_NEXT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NONE, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY, WEVU_SLOT_OWNER_ID_ATTR, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_PROPS_ATTR, WEVU_SLOT_SCOPE_ATTR, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
37
+ import PQueue from "p-queue";
38
+ import { APP_PRELUDE_CHUNK_MARKER, APP_PRELUDE_GUARD_KEY, APP_PRELUDE_REQUIRE_MARKER, REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_BUNDLE_HOST_REF, REQUEST_GLOBAL_BUNDLE_MARKER, REQUEST_GLOBAL_CHUNK_HOST_REF, REQUEST_GLOBAL_CHUNK_MODULE_REF, REQUEST_GLOBAL_EXPOSE_HELPER, REQUEST_GLOBAL_INSTALLER_HOST_REF, REQUEST_GLOBAL_LAZY_CONSTRUCTOR_HELPER, REQUEST_GLOBAL_LAZY_FUNCTION_HELPER, REQUEST_GLOBAL_LOCAL_BINDINGS_MARKER, REQUEST_GLOBAL_MARK_PLACEHOLDER_HELPER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER as REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER$1, REQUEST_GLOBAL_PLACEHOLDER_KEY, REQUEST_GLOBAL_PRELUDE_GUARD_KEY, REQUEST_GLOBAL_PRELUDE_MARKER, REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME, REQUEST_GLOBAL_USABLE_CONSTRUCTOR_HELPER, WEAPP_VITE_IMPORT_META_ENV_KEY, WEAPP_VITE_INJECTED_API_IDENTIFIER, WEVU_APP_SHELL_COMPONENT_BASE, WEVU_APP_SHELL_TAG_NAME, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_INTERNAL_KEY_IDENTIFIER, WEVU_LAYOUT_BIND_PREFIX, WEVU_PAGE_LAYOUT_CURRENT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_CURRENT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_NEXT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_NEXT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NONE, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY, WEVU_SLOT_FALLBACK_VIRTUAL_HOST_BASE, WEVU_SLOT_FALLBACK_VIRTUAL_HOST_GLOBAL_PATH, WEVU_SLOT_FALLBACK_VIRTUAL_HOST_TAG_NAME, WEVU_SLOT_OWNER_ID_ATTR, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_PROPS_ATTR, WEVU_SLOT_SCOPE_ATTR, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
38
39
  import { Buffer } from "node:buffer";
39
40
  import { detect } from "package-manager-detector/detect";
40
41
  import tsconfigPaths from "vite-tsconfig-paths";
@@ -47,7 +48,6 @@ import postcss from "postcss";
47
48
  import remapping from "@jridgewell/remapping";
48
49
  import { weappWebPlugin } from "@weapp-vite/web";
49
50
  import { bundleRequire } from "rolldown-require";
50
- import PQueue from "p-queue";
51
51
  //#region src/runtime/autoImport/config/base.ts
52
52
  const DEFAULT_AUTO_IMPORT_MANIFEST_FILENAME = "auto-import-components.json";
53
53
  const WEAPP_VITE_INTERNAL_DIRNAME = ".weapp-vite";
@@ -1683,10 +1683,12 @@ function formatGlobalComponentEntry(name, metadata, sourceImport) {
1683
1683
  function formatGlobalConstEntry(name, metadata, sourceImport) {
1684
1684
  if (!isValidIdentifierName(name)) return;
1685
1685
  const propsType = formatPropsType(metadata.types);
1686
- const baseType = propsType.includes("\n") ? `WeappComponent<${propsType.split("\n").map((line, index) => {
1687
- if (index === 0) return line;
1688
- return ` ${line}`;
1689
- }).join("\n")}>` : `WeappComponent<${propsType}>`;
1686
+ const baseType = propsType.includes("\n") ? (() => {
1687
+ return `WeappComponent<${propsType.split("\n").map((line, index) => {
1688
+ if (index === 0) return line;
1689
+ return ` ${line}`;
1690
+ }).join("\n")}>`;
1691
+ })() : `WeappComponent<${propsType}>`;
1690
1692
  return ` const ${name}: ${sourceImport ? formatComponentTypeWithSourceImport(sourceImport, baseType) : baseType}`;
1691
1693
  }
1692
1694
  function createVueComponentsDefinition(componentNames, getMetadata, options = {}) {
@@ -4711,7 +4713,7 @@ function parseCommentJson(json) {
4711
4713
  function jsonFileRemoveJsExtension(fileName) {
4712
4714
  return fileName.replace(JSON_FILE_JS_EXTENSION_RE, "");
4713
4715
  }
4714
- function stringifyJson(value, replacer) {
4716
+ function stringifyJson$1(value, replacer) {
4715
4717
  return stringify(value, replacer, 2);
4716
4718
  }
4717
4719
  function normalizeAppJson(json) {
@@ -4828,7 +4830,7 @@ function resolveJson(entry, aliasEntries, platform, options) {
4828
4830
  const componentGenerics = get(json, "componentGenerics");
4829
4831
  if (isObject(componentGenerics)) set(json, "componentGenerics", normalizeComponentGenericsByPlatform(componentGenerics, platform));
4830
4832
  if (Reflect.has(json, "$schema")) delete json.$schema;
4831
- return stringifyJson(json);
4833
+ return stringifyJson$1(json);
4832
4834
  }
4833
4835
  }
4834
4836
  //#endregion
@@ -8957,187 +8959,613 @@ function createNpmService(ctx) {
8957
8959
  };
8958
8960
  }
8959
8961
  //#endregion
8960
- //#region src/plugins/core/lifecycle/emit/constants.ts
8961
- const PRETTY_NODE_MODULES_RE = /node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(.+)/;
8962
- const REQUEST_GLOBAL_EXPORT_RE = /Object\.defineProperty\(exports,\s*(?:`([^`]+)`|'([^']+)'|"([^"]+)"),\s*\{[\s\S]*?get:function\(\)\{return ([A-Za-z_$][\w$]*)\}\}\)/g;
8963
- const REQUEST_GLOBAL_INSTALLER_RE = /function\s+([A-Za-z_$][\w$]*)\([^)]*=\{\}\)\{[\s\S]{0,220}?targets\?\?\[[\s\S]{0,80}?fetch[\s\S]{0,80}?Headers[\s\S]{0,80}?Request[\s\S]{0,80}?Response[\s\S]{0,80}?AbortController[\s\S]{0,80}?AbortSignal[\s\S]{0,80}?XMLHttpRequest[\s\S]{0,80}?WebSocket[\s\S]{0,260}?return [^}]+\}/;
8964
- const REQUEST_GLOBAL_ENTRY_NAME_RE = /\.[^/.]+$/;
8965
- const REQUEST_GLOBAL_REQUIRE_DECLARATOR_RE = /([A-Za-z_$][\w$]*)\s*=\s*require\((`([^`]+)`|'([^']+)'|"([^"]+)")\)/g;
8966
- const REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME = "weapp-vendors/request-globals-runtime.js";
8967
- const DYNAMIC_GLOBAL_RESOLUTION_RE = /Function\(\s*(?:`return this`|'return this'|"return this")\s*\)\(\)/g;
8968
- const BROWSER_GLOBAL_HOST_TERNARY_RE = /typeof self<[`'"]u[`'"]\?self:typeof window<[`'"]u[`'"]\?window:globalThis/g;
8969
- const AXIOS_MODULE_ID_RE = /[/\\](?:\.pnpm[/\\][^/\\]+[/\\]node_modules[/\\])?axios[/\\]/u;
8970
- const APP_PRELUDE_REQUIRE_FILE_BASENAME = "app.prelude.js";
8971
- const DIRECTIVE_PROLOGUE_RE = /^(?:(['"])(?:\\.|(?!\1)[^\\])*\1;?\s*)+/u;
8972
- const USE_STRICT_PREFIX_RE = /^(?:['"]use strict['"];\s*)+/u;
8973
- //#endregion
8974
- //#region src/runtime/chunkStrategy/state.ts
8975
- const sharedChunkDiagnostics = /* @__PURE__ */ new Map();
8976
- const takeImportersMap = /* @__PURE__ */ new Map();
8977
- const forceDuplicateSharedChunks = /* @__PURE__ */ new Set();
8978
- const sharedChunkNameCache = /* @__PURE__ */ new Map();
8979
- function resetTakeImportRegistry(options = {}) {
8980
- takeImportersMap.clear();
8981
- forceDuplicateSharedChunks.clear();
8982
- sharedChunkDiagnostics.clear();
8983
- if (!options.preserveSharedChunkNameCache) sharedChunkNameCache.clear();
8984
- }
8985
- function getTakeImporters(moduleId) {
8986
- return takeImportersMap.get(moduleId);
8987
- }
8988
- function markForceDuplicateSharedChunk(sharedName) {
8989
- if (!sharedName) return;
8990
- forceDuplicateSharedChunks.add(sharedName);
8991
- forceDuplicateSharedChunks.add(`${sharedName}.js`);
8992
- }
8993
- function isForceDuplicateSharedChunk(fileName) {
8994
- return forceDuplicateSharedChunks.has(fileName);
8995
- }
8996
- function hasForceDuplicateSharedChunks() {
8997
- return forceDuplicateSharedChunks.size > 0;
8962
+ //#region src/cache/file.ts
8963
+ const FNV_OFFSET_BASIS = 14695981039346656037n;
8964
+ const FNV_PRIME = 1099511628211n;
8965
+ const FNV_MASK = 18446744073709551615n;
8966
+ function fnv1aStep(hash, byte) {
8967
+ hash ^= BigInt(byte & 255);
8968
+ return hash * FNV_PRIME & FNV_MASK;
8998
8969
  }
8999
- function recordSharedChunkDiagnostics(sharedName, ignoredMainImporters) {
9000
- if (!sharedName || ignoredMainImporters.length === 0) return;
9001
- const uniqueImporters = Array.from(new Set(ignoredMainImporters));
9002
- sharedChunkDiagnostics.set(sharedName, { ignoredMainImporters: uniqueImporters });
9003
- sharedChunkDiagnostics.set(`${sharedName}.js`, { ignoredMainImporters: uniqueImporters });
8970
+ function createSignature(content) {
8971
+ let hash = FNV_OFFSET_BASIS;
8972
+ if (typeof content === "string") for (let i = 0; i < content.length; i++) {
8973
+ const code = content.charCodeAt(i);
8974
+ hash = fnv1aStep(hash, code & 255);
8975
+ const high = code >>> 8;
8976
+ if (high > 0) hash = fnv1aStep(hash, high);
8977
+ }
8978
+ else for (const byte of content) hash = fnv1aStep(hash, byte);
8979
+ return hash.toString(36);
9004
8980
  }
9005
- function consumeSharedChunkDiagnostics(fileName) {
9006
- const direct = sharedChunkDiagnostics.get(fileName);
9007
- if (direct) {
9008
- sharedChunkDiagnostics.delete(fileName);
9009
- return direct;
8981
+ var FileCache = class {
8982
+ cache;
8983
+ mtimeMap;
8984
+ signatureMap;
8985
+ constructor(max = 1024) {
8986
+ this.mtimeMap = /* @__PURE__ */ new Map();
8987
+ this.signatureMap = /* @__PURE__ */ new Map();
8988
+ this.cache = new LRUCache({
8989
+ max,
8990
+ dispose: (_value, key) => {
8991
+ this.mtimeMap.delete(key);
8992
+ this.signatureMap.delete(key);
8993
+ }
8994
+ });
9010
8995
  }
9011
- const withoutExt = fileName.replace(/\.[^./\\]+$/, "");
9012
- const fallback = sharedChunkDiagnostics.get(withoutExt);
9013
- if (fallback) {
9014
- sharedChunkDiagnostics.delete(withoutExt);
9015
- return fallback;
8996
+ get(id) {
8997
+ return this.cache.get(id);
9016
8998
  }
9017
- }
9018
- function getCachedSharedChunkName(moduleId) {
9019
- if (!sharedChunkNameCache.has(moduleId)) return;
9020
- return sharedChunkNameCache.get(moduleId) ?? null;
9021
- }
9022
- function setCachedSharedChunkName(moduleId, value) {
9023
- if (!moduleId) return;
9024
- sharedChunkNameCache.set(moduleId, value ?? null);
9025
- }
9026
- //#endregion
9027
- //#region src/runtime/chunkStrategy/utils.ts
9028
- function replaceAll(source, searchValue, replaceValue) {
9029
- if (!searchValue) return source;
9030
- if (source.includes(searchValue)) return source.split(searchValue).join(replaceValue);
9031
- if (searchValue.startsWith("./") && replaceValue.startsWith("./")) {
9032
- const trimmedSearch = searchValue.slice(2);
9033
- const trimmedReplace = replaceValue.slice(2);
9034
- if (trimmedSearch && source.includes(trimmedSearch)) return source.split(trimmedSearch).join(trimmedReplace);
8999
+ set(id, content) {
9000
+ return this.cache.set(id, content);
9035
9001
  }
9036
- return source;
9037
- }
9038
- function containsImportSpecifier(source, specifier) {
9039
- if (!specifier) return false;
9040
- if (source.includes(specifier)) return true;
9041
- if (specifier.startsWith("./")) {
9042
- const trimmed = specifier.slice(2);
9043
- if (trimmed && source.includes(trimmed)) return true;
9002
+ delete(id) {
9003
+ this.mtimeMap.delete(id);
9004
+ this.signatureMap.delete(id);
9005
+ return this.cache.delete(id);
9044
9006
  }
9045
- return false;
9046
- }
9047
- function hasInCollection$1(collection, value) {
9048
- if (!collection || !value) return false;
9049
- if (collection instanceof Set) return collection.has(value);
9050
- if (Array.isArray(collection)) return collection.includes(value);
9051
- if (collection instanceof Map) return collection.has(value);
9052
- return false;
9053
- }
9054
- function createRelativeImport(fromFile, toFile) {
9055
- const relative = posix.relative(posix.dirname(fromFile), toFile);
9056
- if (!relative || relative.startsWith(".")) return relative || "./";
9057
- return `./${relative}`;
9058
- }
9059
- //#endregion
9060
- //#region src/runtime/chunkStrategy/bundle.ts
9061
- function findChunkImporters(bundle, target) {
9062
- const importers = /* @__PURE__ */ new Set();
9063
- for (const [fileName, output] of Object.entries(bundle)) {
9064
- if (fileName === target) continue;
9065
- if (output?.type !== "chunk") continue;
9066
- const chunk = output;
9067
- if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
9068
- importers.add(fileName);
9069
- continue;
9070
- }
9071
- const metadata = chunk.viteMetadata;
9072
- if (metadata) {
9073
- const importedChunks = metadata.importedChunks;
9074
- if (hasInCollection$1(importedChunks, target)) {
9075
- importers.add(fileName);
9076
- continue;
9007
+ async isInvalidate(id, options) {
9008
+ const checkMtime = options?.checkMtime ?? true;
9009
+ const nextSignature = options?.signature ?? (options?.content !== void 0 ? createSignature(options.content) : void 0);
9010
+ if (!checkMtime) {
9011
+ if (nextSignature === void 0) return true;
9012
+ if (this.signatureMap.get(id) !== nextSignature) {
9013
+ this.signatureMap.set(id, nextSignature);
9014
+ return true;
9077
9015
  }
9078
- if (hasInCollection$1(metadata.importedScripts ?? metadata.importedScriptsByUrl, target)) {
9079
- importers.add(fileName);
9080
- continue;
9016
+ return false;
9017
+ }
9018
+ let mtimeMs;
9019
+ if (typeof options?.mtimeMs === "number" && Number.isFinite(options.mtimeMs)) mtimeMs = options.mtimeMs;
9020
+ else try {
9021
+ mtimeMs = (await fs.stat(id)).mtimeMs;
9022
+ } catch (error) {
9023
+ if (error && error.code === "ENOENT") {
9024
+ this.cache.delete(id);
9025
+ this.mtimeMap.delete(id);
9026
+ this.signatureMap.delete(id);
9027
+ return true;
9081
9028
  }
9029
+ throw error;
9082
9030
  }
9083
- const potentialImport = createRelativeImport(fileName, target);
9084
- if (potentialImport && potentialImport !== "./" && containsImportSpecifier(chunk.code ?? "", potentialImport)) importers.add(fileName);
9085
- }
9086
- return Array.from(importers);
9087
- }
9088
- function ensureUniqueFileName(bundle, fileName) {
9089
- if (!bundle[fileName]) return fileName;
9090
- const { dir, name, ext } = posix.parse(fileName);
9091
- let index = 1;
9092
- let candidate = fileName;
9093
- while (bundle[candidate]) {
9094
- const nextName = `${name}.${index}`;
9095
- candidate = dir ? posix.join(dir, `${nextName}${ext}`) : `${nextName}${ext}`;
9096
- index++;
9097
- }
9098
- return candidate;
9099
- }
9100
- function updateImporters(bundle, importerToChunk, originalFileName) {
9101
- for (const [importerFile, newChunkFile] of importerToChunk.entries()) {
9102
- const importer = bundle[importerFile];
9103
- if (!importer || importer.type !== "chunk") continue;
9104
- const importerChunk = importer;
9105
- const originalImportPath = createRelativeImport(importerFile, originalFileName);
9106
- const newImportPath = createRelativeImport(importerFile, newChunkFile);
9107
- let codeUpdated = false;
9108
- if (originalImportPath !== newImportPath) {
9109
- const updated = replaceAll(importerChunk.code, originalImportPath, newImportPath);
9110
- if (updated !== importerChunk.code) {
9111
- importerChunk.code = updated;
9112
- codeUpdated = true;
9031
+ if (mtimeMs === void 0) return true;
9032
+ const cachedMtime = this.mtimeMap.get(id);
9033
+ const updateSignature = () => {
9034
+ if (nextSignature !== void 0) this.signatureMap.set(id, nextSignature);
9035
+ };
9036
+ if (cachedMtime === void 0) {
9037
+ this.mtimeMap.set(id, mtimeMs);
9038
+ updateSignature();
9039
+ return true;
9040
+ } else if (cachedMtime > mtimeMs) {
9041
+ this.mtimeMap.set(id, mtimeMs);
9042
+ updateSignature();
9043
+ return true;
9044
+ } else if (cachedMtime === mtimeMs) {
9045
+ if (nextSignature !== void 0) {
9046
+ if (this.signatureMap.get(id) !== nextSignature) {
9047
+ updateSignature();
9048
+ return true;
9049
+ }
9113
9050
  }
9051
+ return false;
9052
+ } else {
9053
+ this.mtimeMap.set(id, mtimeMs);
9054
+ updateSignature();
9055
+ return true;
9114
9056
  }
9115
- importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile, codeUpdated);
9116
- importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile, codeUpdated);
9117
- const implicitlyLoadedBefore = importerChunk.implicitlyLoadedBefore;
9118
- if (Array.isArray(implicitlyLoadedBefore)) importerChunk.implicitlyLoadedBefore = replaceInArray(implicitlyLoadedBefore, originalFileName, newChunkFile, codeUpdated);
9119
- const referencedFiles = importerChunk.referencedFiles;
9120
- if (Array.isArray(referencedFiles)) importerChunk.referencedFiles = replaceInArray(referencedFiles, originalFileName, newChunkFile, codeUpdated);
9121
- updateViteMetadata(importerChunk, originalFileName, newChunkFile, codeUpdated);
9122
- }
9123
- }
9124
- function replaceInArray(list, searchValue, replaceValue, shouldInsert) {
9125
- const values = Array.isArray(list) ? [...list] : [];
9126
- let replaced = false;
9127
- for (let index = 0; index < values.length; index++) if (values[index] === searchValue) {
9128
- values[index] = replaceValue;
9129
- replaced = true;
9130
9057
  }
9131
- if ((replaced || shouldInsert) && replaceValue && !values.includes(replaceValue)) values.push(replaceValue);
9132
- return values;
9133
- }
9134
- function updateViteMetadata(importerChunk, originalFileName, newChunkFile, shouldInsert) {
9135
- const metadata = importerChunk.viteMetadata;
9136
- if (!metadata || typeof metadata !== "object") return;
9137
- for (const key of ["importedChunks", "importedScripts"]) {
9138
- const collection = metadata[key];
9139
- if (collection instanceof Set) {
9140
- if (collection.delete(originalFileName) || shouldInsert) collection.add(newChunkFile);
9058
+ };
9059
+ //#endregion
9060
+ //#region src/defaults.ts
9061
+ const defaultExcluded = [
9062
+ "**/node_modules/**",
9063
+ "**/miniprogram_npm/**",
9064
+ "**/.weapp-vite",
9065
+ "**/.weapp-vite/**"
9066
+ ];
9067
+ /**
9068
+ * 样式扩展名说明:
9069
+ * - wxss:微信小程序
9070
+ * - acss:支付宝小程序
9071
+ * - jxss:京东小程序
9072
+ * - ttss:头条小程序
9073
+ * - qss:QQ 小程序
9074
+ * - css:通用样式文件
9075
+ * - tyss:涂鸦小程序
9076
+ */
9077
+ /**
9078
+ * 模板扩展名说明:
9079
+ * - wxml:微信小程序
9080
+ * - axml:支付宝小程序
9081
+ * - jxml:京东小程序
9082
+ * - ksml:快手小程序
9083
+ * - ttml:头条小程序
9084
+ * - qml:QQ 小程序
9085
+ * - tyml:涂鸦小程序
9086
+ * - xhsml:小红书小程序
9087
+ * - swan:百度小程序
9088
+ */
9089
+ function getOutputExtensions(platform) {
9090
+ return getPlatformOutputExtensions(platform ?? DEFAULT_MP_PLATFORM);
9091
+ }
9092
+ function getWeappViteConfig() {
9093
+ return {
9094
+ autoRoutes: false,
9095
+ wxml: true,
9096
+ wxs: true,
9097
+ enhance: {
9098
+ wxml: true,
9099
+ wxs: true
9100
+ },
9101
+ platform: DEFAULT_MP_PLATFORM,
9102
+ multiPlatform: false,
9103
+ es5: false,
9104
+ packageSizeWarningBytes: 2 * 1024 * 1024,
9105
+ analyze: {
9106
+ budgets: {
9107
+ totalBytes: 20 * 1024 * 1024,
9108
+ mainBytes: 2 * 1024 * 1024,
9109
+ subPackageBytes: 2 * 1024 * 1024,
9110
+ independentBytes: 2 * 1024 * 1024,
9111
+ warningRatio: .85
9112
+ },
9113
+ history: {
9114
+ enabled: true,
9115
+ dir: ".weapp-vite/analyze-history",
9116
+ limit: 20
9117
+ }
9118
+ },
9119
+ jsFormat: "cjs",
9120
+ isAdditionalWxml: () => {
9121
+ return false;
9122
+ },
9123
+ npm: {
9124
+ enable: true,
9125
+ cache: true,
9126
+ alipayNpmMode: "node_modules"
9127
+ },
9128
+ hmr: {
9129
+ sharedChunks: "auto",
9130
+ touchAppWxss: "auto",
9131
+ logLevel: "default",
9132
+ profileJson: false
9133
+ },
9134
+ mcp: {
9135
+ enabled: true,
9136
+ autoStart: false,
9137
+ host: "127.0.0.1",
9138
+ port: 3088,
9139
+ endpoint: "/mcp",
9140
+ restEndpoint: "/api/weapp/devtools"
9141
+ },
9142
+ forwardConsole: {
9143
+ enabled: "auto",
9144
+ logLevels: [
9145
+ "log",
9146
+ "info",
9147
+ "warn",
9148
+ "error"
9149
+ ],
9150
+ unhandledErrors: true
9151
+ },
9152
+ appPrelude: { mode: "require" },
9153
+ wevu: { defaults: { component: { allowNullPropInput: true } } },
9154
+ chunks: {
9155
+ sharedStrategy: "duplicate",
9156
+ sharedMode: "common",
9157
+ sharedOverrides: [],
9158
+ sharedPathRoot: void 0,
9159
+ dynamicImports: "preserve",
9160
+ logOptimization: true,
9161
+ forceDuplicatePatterns: [],
9162
+ duplicateWarningBytes: 512 * 1024
9163
+ }
9164
+ };
9165
+ }
9166
+ const defaultAssetExtensions = [
9167
+ "png",
9168
+ "jpg",
9169
+ "jpeg",
9170
+ "gif",
9171
+ "svg",
9172
+ "cer",
9173
+ "mp3",
9174
+ "aac",
9175
+ "m4a",
9176
+ "mp4",
9177
+ "wav",
9178
+ "ogg",
9179
+ "silk",
9180
+ "wasm",
9181
+ "br",
9182
+ "cert"
9183
+ ];
9184
+ //#endregion
9185
+ //#region src/multiPlatform.ts
9186
+ const DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT = "config";
9187
+ function normalizeMultiPlatformProjectConfigRoot(input) {
9188
+ if (typeof input !== "string") return DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT;
9189
+ return input.trim() || "config";
9190
+ }
9191
+ function resolveMultiPlatformTargets(value) {
9192
+ const supportedPlatforms = getSupportedMiniProgramPlatforms$1();
9193
+ if (value == null || value === "all") return supportedPlatforms;
9194
+ if (!Array.isArray(value)) throw new TypeError("`weapp.multiPlatform.targets` 必须是平台数组或 \"all\"。");
9195
+ const resolvedTargets = [];
9196
+ const invalidTargets = [];
9197
+ for (const rawTarget of value) {
9198
+ const resolvedTarget = typeof rawTarget === "string" ? resolveMiniPlatform(rawTarget) : void 0;
9199
+ if (!resolvedTarget) {
9200
+ invalidTargets.push(String(rawTarget));
9201
+ continue;
9202
+ }
9203
+ if (!resolvedTargets.includes(resolvedTarget)) resolvedTargets.push(resolvedTarget);
9204
+ }
9205
+ if (invalidTargets.length > 0) throw new Error(`\`weapp.multiPlatform.targets\` 包含不支持的平台:${invalidTargets.join(", ")}`);
9206
+ if (resolvedTargets.length === 0) throw new Error("`weapp.multiPlatform.targets` 至少需要包含一个目标平台。");
9207
+ return resolvedTargets;
9208
+ }
9209
+ function resolveMultiPlatformConfig(value) {
9210
+ if (!value) return {
9211
+ enabled: false,
9212
+ projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
9213
+ targets: getSupportedMiniProgramPlatforms$1()
9214
+ };
9215
+ if (value === true) return {
9216
+ enabled: true,
9217
+ projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
9218
+ targets: getSupportedMiniProgramPlatforms$1()
9219
+ };
9220
+ if (typeof value === "object" && value !== null) {
9221
+ const record = value;
9222
+ const targets = resolveMultiPlatformTargets(record.targets);
9223
+ return {
9224
+ enabled: record.enabled !== false,
9225
+ projectConfigRoot: normalizeMultiPlatformProjectConfigRoot(record.projectConfigRoot),
9226
+ targets
9227
+ };
9228
+ }
9229
+ return {
9230
+ enabled: false,
9231
+ projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
9232
+ targets: getSupportedMiniProgramPlatforms$1()
9233
+ };
9234
+ }
9235
+ function supportsMultiPlatformTarget(multiPlatform, platform) {
9236
+ return multiPlatform.targets.includes(platform);
9237
+ }
9238
+ function resolveMultiPlatformProjectConfigDir(multiPlatform, platform) {
9239
+ return path.join(multiPlatform.projectConfigRoot || "config", platform);
9240
+ }
9241
+ //#endregion
9242
+ //#region src/runtime/runtimeState.ts
9243
+ function createDefaultLoadConfigResult() {
9244
+ return {
9245
+ config: {},
9246
+ loadOptions: {
9247
+ cwd: process.cwd(),
9248
+ isDev: false,
9249
+ mode: "development",
9250
+ emitDefaultAutoImportOutputs: true
9251
+ },
9252
+ aliasEntries: [],
9253
+ outputExtensions: getOutputExtensions(DEFAULT_MP_PLATFORM),
9254
+ packageJson: {},
9255
+ relativeSrcRoot: (p) => p,
9256
+ cwd: process.cwd(),
9257
+ isDev: false,
9258
+ mode: "development",
9259
+ emitDefaultAutoImportOutputs: true,
9260
+ projectConfig: {},
9261
+ projectConfigPath: void 0,
9262
+ projectPrivateConfigPath: void 0,
9263
+ mpDistRoot: "",
9264
+ multiPlatform: resolveMultiPlatformConfig(false),
9265
+ weappLib: void 0,
9266
+ weappLibOutputMap: void 0,
9267
+ packageJsonPath: "",
9268
+ platform: DEFAULT_MP_PLATFORM,
9269
+ srcRoot: "",
9270
+ configFilePath: void 0,
9271
+ configFileDependencies: [],
9272
+ weappWeb: void 0,
9273
+ configMergeInfo: void 0
9274
+ };
9275
+ }
9276
+ function createDefaultPackageInfo() {
9277
+ return {
9278
+ name: "",
9279
+ version: void 0,
9280
+ rootPath: "",
9281
+ packageJsonPath: "",
9282
+ packageJson: {}
9283
+ };
9284
+ }
9285
+ function createDefaultPackageManager() {
9286
+ return {
9287
+ agent: "npm",
9288
+ name: "npm"
9289
+ };
9290
+ }
9291
+ function createRuntimeState() {
9292
+ const emptyAutoRoutesSnapshot = createEmptyAutoRoutesSnapshot();
9293
+ const emptyAutoRoutesArtifacts = createAutoRoutesArtifacts(emptyAutoRoutesSnapshot);
9294
+ return {
9295
+ autoRoutes: {
9296
+ routes: emptyAutoRoutesSnapshot,
9297
+ serialized: emptyAutoRoutesArtifacts.serialized,
9298
+ moduleCode: emptyAutoRoutesArtifacts.moduleCode,
9299
+ typedDefinition: "",
9300
+ watchFiles: /* @__PURE__ */ new Set(),
9301
+ watchDirs: /* @__PURE__ */ new Set(),
9302
+ dirty: true,
9303
+ initialized: false,
9304
+ candidates: /* @__PURE__ */ new Map(),
9305
+ needsFullRescan: true,
9306
+ loadingAppConfig: false
9307
+ },
9308
+ autoImport: {
9309
+ registry: /* @__PURE__ */ new Map(),
9310
+ resolvedResolverComponents: /* @__PURE__ */ new Map(),
9311
+ matcherKey: "",
9312
+ version: 0,
9313
+ pendingEntriesByImporter: /* @__PURE__ */ new Map()
9314
+ },
9315
+ build: {
9316
+ queue: new PQueue({ autoStart: false }),
9317
+ npmBuilt: false,
9318
+ independent: { outputs: /* @__PURE__ */ new Map() },
9319
+ hmr: {
9320
+ loadedEntrySet: /* @__PURE__ */ new Set(),
9321
+ dirtyEntrySet: /* @__PURE__ */ new Set(),
9322
+ dirtyEntryReasons: /* @__PURE__ */ new Map(),
9323
+ resolvedEntryMap: /* @__PURE__ */ new Map(),
9324
+ externalComponentEntryMap: /* @__PURE__ */ new Map(),
9325
+ entriesMap: /* @__PURE__ */ new Map(),
9326
+ layoutEntryDependents: /* @__PURE__ */ new Map(),
9327
+ entryLayoutDependencies: /* @__PURE__ */ new Map(),
9328
+ vueEntryHasTemplate: /* @__PURE__ */ new Map(),
9329
+ vueEntryNonJsonSignatures: /* @__PURE__ */ new Map(),
9330
+ vueEntryScriptSignatures: /* @__PURE__ */ new Map(),
9331
+ dirtyVueEntryIds: /* @__PURE__ */ new Set(),
9332
+ didEmitAllEntries: false,
9333
+ lastHmrEntryIds: /* @__PURE__ */ new Set(),
9334
+ lastEmittedEntryIds: /* @__PURE__ */ new Set(),
9335
+ recentProfiles: [],
9336
+ profile: {}
9337
+ }
9338
+ },
9339
+ json: {
9340
+ cache: new FileCache(),
9341
+ emittedSource: /* @__PURE__ */ new Map()
9342
+ },
9343
+ asset: {
9344
+ emittedBuffer: /* @__PURE__ */ new Map(),
9345
+ scopedSlotGenerics: /* @__PURE__ */ new Map()
9346
+ },
9347
+ css: {
9348
+ importerToDependencies: /* @__PURE__ */ new Map(),
9349
+ dependencyToImporters: /* @__PURE__ */ new Map(),
9350
+ emittedSource: /* @__PURE__ */ new Map()
9351
+ },
9352
+ watcher: {
9353
+ rollupWatcherMap: /* @__PURE__ */ new Map(),
9354
+ sidecarWatcherMap: /* @__PURE__ */ new Map()
9355
+ },
9356
+ wxml: {
9357
+ depsMap: /* @__PURE__ */ new Map(),
9358
+ importerMap: /* @__PURE__ */ new Map(),
9359
+ tokenMap: /* @__PURE__ */ new Map(),
9360
+ componentsMap: /* @__PURE__ */ new Map(),
9361
+ aggregatedComponentsMap: /* @__PURE__ */ new Map(),
9362
+ templatePathMap: /* @__PURE__ */ new Map(),
9363
+ cache: new FileCache(),
9364
+ emittedCode: /* @__PURE__ */ new Map()
9365
+ },
9366
+ scan: {
9367
+ subPackageMap: /* @__PURE__ */ new Map(),
9368
+ independentSubPackageMap: /* @__PURE__ */ new Map(),
9369
+ warnedMessages: /* @__PURE__ */ new Set(),
9370
+ isDirty: true,
9371
+ independentDirtyRoots: /* @__PURE__ */ new Set(),
9372
+ pluginJsonPath: void 0
9373
+ },
9374
+ lib: {
9375
+ enabled: false,
9376
+ entries: /* @__PURE__ */ new Map()
9377
+ },
9378
+ config: {
9379
+ packageInfo: createDefaultPackageInfo(),
9380
+ defineEnv: {},
9381
+ importMetaEnvDefineOverride: void 0,
9382
+ packageManager: createDefaultPackageManager(),
9383
+ options: createDefaultLoadConfigResult()
9384
+ }
9385
+ };
9386
+ }
9387
+ //#endregion
9388
+ //#region src/plugins/core/lifecycle/emit/constants.ts
9389
+ const PRETTY_NODE_MODULES_RE = /node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(.+)/;
9390
+ const REQUEST_GLOBAL_EXPORT_RE = /Object\.defineProperty\(exports,\s*(?:`([^`]+)`|'([^']+)'|"([^"]+)"),\s*\{[\s\S]*?get:function\(\)\{return ([A-Za-z_$][\w$]*)\}\}\)/g;
9391
+ const REQUEST_GLOBAL_INSTALLER_RE = /function\s+([A-Za-z_$][\w$]*)\([^)]*=\{\}\)\{[\s\S]{0,220}?targets\?\?\[[\s\S]{0,80}?fetch[\s\S]{0,80}?Headers[\s\S]{0,80}?Request[\s\S]{0,80}?Response[\s\S]{0,80}?AbortController[\s\S]{0,80}?AbortSignal[\s\S]{0,80}?XMLHttpRequest[\s\S]{0,80}?WebSocket[\s\S]{0,260}?return [^}]+\}/;
9392
+ const REQUEST_GLOBAL_ENTRY_NAME_RE = /\.[^/.]+$/;
9393
+ const REQUEST_GLOBAL_REQUIRE_DECLARATOR_RE = /([A-Za-z_$][\w$]*)\s*=\s*require\((`([^`]+)`|'([^']+)'|"([^"]+)")\)/g;
9394
+ const REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME = "weapp-vendors/request-globals-runtime.js";
9395
+ const DYNAMIC_GLOBAL_RESOLUTION_RE = /Function\(\s*(?:`return this`|'return this'|"return this")\s*\)\(\)/g;
9396
+ const BROWSER_GLOBAL_HOST_TERNARY_RE = /typeof self<[`'"]u[`'"]\?self:typeof window<[`'"]u[`'"]\?window:globalThis/g;
9397
+ const AXIOS_MODULE_ID_RE = /[/\\](?:\.pnpm[/\\][^/\\]+[/\\]node_modules[/\\])?axios[/\\]/u;
9398
+ const APP_PRELUDE_REQUIRE_FILE_BASENAME = "app.prelude.js";
9399
+ const DIRECTIVE_PROLOGUE_RE = /^(?:(['"])(?:\\.|(?!\1)[^\\])*\1;?\s*)+/u;
9400
+ const USE_STRICT_PREFIX_RE = /^(?:['"]use strict['"];\s*)+/u;
9401
+ //#endregion
9402
+ //#region src/runtime/chunkStrategy/state.ts
9403
+ const sharedChunkDiagnostics = /* @__PURE__ */ new Map();
9404
+ const takeImportersMap = /* @__PURE__ */ new Map();
9405
+ const forceDuplicateSharedChunks = /* @__PURE__ */ new Set();
9406
+ const sharedChunkNameCache = /* @__PURE__ */ new Map();
9407
+ function resetTakeImportRegistry(options = {}) {
9408
+ takeImportersMap.clear();
9409
+ forceDuplicateSharedChunks.clear();
9410
+ sharedChunkDiagnostics.clear();
9411
+ if (!options.preserveSharedChunkNameCache) sharedChunkNameCache.clear();
9412
+ }
9413
+ function getTakeImporters(moduleId) {
9414
+ return takeImportersMap.get(moduleId);
9415
+ }
9416
+ function markForceDuplicateSharedChunk(sharedName) {
9417
+ if (!sharedName) return;
9418
+ forceDuplicateSharedChunks.add(sharedName);
9419
+ forceDuplicateSharedChunks.add(`${sharedName}.js`);
9420
+ }
9421
+ function isForceDuplicateSharedChunk(fileName) {
9422
+ return forceDuplicateSharedChunks.has(fileName);
9423
+ }
9424
+ function hasForceDuplicateSharedChunks() {
9425
+ return forceDuplicateSharedChunks.size > 0;
9426
+ }
9427
+ function recordSharedChunkDiagnostics(sharedName, ignoredMainImporters) {
9428
+ if (!sharedName || ignoredMainImporters.length === 0) return;
9429
+ const uniqueImporters = Array.from(new Set(ignoredMainImporters));
9430
+ sharedChunkDiagnostics.set(sharedName, { ignoredMainImporters: uniqueImporters });
9431
+ sharedChunkDiagnostics.set(`${sharedName}.js`, { ignoredMainImporters: uniqueImporters });
9432
+ }
9433
+ function consumeSharedChunkDiagnostics(fileName) {
9434
+ const direct = sharedChunkDiagnostics.get(fileName);
9435
+ if (direct) {
9436
+ sharedChunkDiagnostics.delete(fileName);
9437
+ return direct;
9438
+ }
9439
+ const withoutExt = fileName.replace(/\.[^./\\]+$/, "");
9440
+ const fallback = sharedChunkDiagnostics.get(withoutExt);
9441
+ if (fallback) {
9442
+ sharedChunkDiagnostics.delete(withoutExt);
9443
+ return fallback;
9444
+ }
9445
+ }
9446
+ function getCachedSharedChunkName(moduleId) {
9447
+ if (!sharedChunkNameCache.has(moduleId)) return;
9448
+ return sharedChunkNameCache.get(moduleId) ?? null;
9449
+ }
9450
+ function setCachedSharedChunkName(moduleId, value) {
9451
+ if (!moduleId) return;
9452
+ sharedChunkNameCache.set(moduleId, value ?? null);
9453
+ }
9454
+ //#endregion
9455
+ //#region src/runtime/chunkStrategy/utils.ts
9456
+ function replaceAll(source, searchValue, replaceValue) {
9457
+ if (!searchValue) return source;
9458
+ if (source.includes(searchValue)) return source.split(searchValue).join(replaceValue);
9459
+ if (searchValue.startsWith("./") && replaceValue.startsWith("./")) {
9460
+ const trimmedSearch = searchValue.slice(2);
9461
+ const trimmedReplace = replaceValue.slice(2);
9462
+ if (trimmedSearch && source.includes(trimmedSearch)) return source.split(trimmedSearch).join(trimmedReplace);
9463
+ }
9464
+ return source;
9465
+ }
9466
+ function containsImportSpecifier(source, specifier) {
9467
+ if (!specifier) return false;
9468
+ if (source.includes(specifier)) return true;
9469
+ if (specifier.startsWith("./")) {
9470
+ const trimmed = specifier.slice(2);
9471
+ if (trimmed && source.includes(trimmed)) return true;
9472
+ }
9473
+ return false;
9474
+ }
9475
+ function hasInCollection$1(collection, value) {
9476
+ if (!collection || !value) return false;
9477
+ if (collection instanceof Set) return collection.has(value);
9478
+ if (Array.isArray(collection)) return collection.includes(value);
9479
+ if (collection instanceof Map) return collection.has(value);
9480
+ return false;
9481
+ }
9482
+ function createRelativeImport(fromFile, toFile) {
9483
+ const relative = posix.relative(posix.dirname(fromFile), toFile);
9484
+ if (!relative || relative.startsWith(".")) return relative || "./";
9485
+ return `./${relative}`;
9486
+ }
9487
+ //#endregion
9488
+ //#region src/runtime/chunkStrategy/bundle.ts
9489
+ function findChunkImporters(bundle, target) {
9490
+ const importers = /* @__PURE__ */ new Set();
9491
+ for (const [fileName, output] of Object.entries(bundle)) {
9492
+ if (fileName === target) continue;
9493
+ if (output?.type !== "chunk") continue;
9494
+ const chunk = output;
9495
+ if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
9496
+ importers.add(fileName);
9497
+ continue;
9498
+ }
9499
+ const metadata = chunk.viteMetadata;
9500
+ if (metadata) {
9501
+ const importedChunks = metadata.importedChunks;
9502
+ if (hasInCollection$1(importedChunks, target)) {
9503
+ importers.add(fileName);
9504
+ continue;
9505
+ }
9506
+ if (hasInCollection$1(metadata.importedScripts ?? metadata.importedScriptsByUrl, target)) {
9507
+ importers.add(fileName);
9508
+ continue;
9509
+ }
9510
+ }
9511
+ const potentialImport = createRelativeImport(fileName, target);
9512
+ if (potentialImport && potentialImport !== "./" && containsImportSpecifier(chunk.code ?? "", potentialImport)) importers.add(fileName);
9513
+ }
9514
+ return Array.from(importers);
9515
+ }
9516
+ function ensureUniqueFileName(bundle, fileName) {
9517
+ if (!bundle[fileName]) return fileName;
9518
+ const { dir, name, ext } = posix.parse(fileName);
9519
+ let index = 1;
9520
+ let candidate = fileName;
9521
+ while (bundle[candidate]) {
9522
+ const nextName = `${name}.${index}`;
9523
+ candidate = dir ? posix.join(dir, `${nextName}${ext}`) : `${nextName}${ext}`;
9524
+ index++;
9525
+ }
9526
+ return candidate;
9527
+ }
9528
+ function updateImporters(bundle, importerToChunk, originalFileName) {
9529
+ for (const [importerFile, newChunkFile] of importerToChunk.entries()) {
9530
+ const importer = bundle[importerFile];
9531
+ if (!importer || importer.type !== "chunk") continue;
9532
+ const importerChunk = importer;
9533
+ const originalImportPath = createRelativeImport(importerFile, originalFileName);
9534
+ const newImportPath = createRelativeImport(importerFile, newChunkFile);
9535
+ let codeUpdated = false;
9536
+ if (originalImportPath !== newImportPath) {
9537
+ const updated = replaceAll(importerChunk.code, originalImportPath, newImportPath);
9538
+ if (updated !== importerChunk.code) {
9539
+ importerChunk.code = updated;
9540
+ codeUpdated = true;
9541
+ }
9542
+ }
9543
+ importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile, codeUpdated);
9544
+ importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile, codeUpdated);
9545
+ const implicitlyLoadedBefore = importerChunk.implicitlyLoadedBefore;
9546
+ if (Array.isArray(implicitlyLoadedBefore)) importerChunk.implicitlyLoadedBefore = replaceInArray(implicitlyLoadedBefore, originalFileName, newChunkFile, codeUpdated);
9547
+ const referencedFiles = importerChunk.referencedFiles;
9548
+ if (Array.isArray(referencedFiles)) importerChunk.referencedFiles = replaceInArray(referencedFiles, originalFileName, newChunkFile, codeUpdated);
9549
+ updateViteMetadata(importerChunk, originalFileName, newChunkFile, codeUpdated);
9550
+ }
9551
+ }
9552
+ function replaceInArray(list, searchValue, replaceValue, shouldInsert) {
9553
+ const values = Array.isArray(list) ? [...list] : [];
9554
+ let replaced = false;
9555
+ for (let index = 0; index < values.length; index++) if (values[index] === searchValue) {
9556
+ values[index] = replaceValue;
9557
+ replaced = true;
9558
+ }
9559
+ if ((replaced || shouldInsert) && replaceValue && !values.includes(replaceValue)) values.push(replaceValue);
9560
+ return values;
9561
+ }
9562
+ function updateViteMetadata(importerChunk, originalFileName, newChunkFile, shouldInsert) {
9563
+ const metadata = importerChunk.viteMetadata;
9564
+ if (!metadata || typeof metadata !== "object") return;
9565
+ for (const key of ["importedChunks", "importedScripts"]) {
9566
+ const collection = metadata[key];
9567
+ if (collection instanceof Set) {
9568
+ if (collection.delete(originalFileName) || shouldInsert) collection.add(newChunkFile);
9141
9569
  } else if (Array.isArray(collection)) metadata[key] = replaceInArray(collection, originalFileName, newChunkFile, shouldInsert);
9142
9570
  else if (collection instanceof Map) {
9143
9571
  if (collection.has(originalFileName)) {
@@ -10629,16 +11057,42 @@ function watchWorkers(configService, watcherService, workersDir) {
10629
11057
  }
10630
11058
  //#endregion
10631
11059
  //#region src/runtime/buildPlugin/service.ts
10632
- function shouldHandleSnapshotSidecarFile(filePath) {
10633
- return isSidecarFile(filePath);
11060
+ function shouldHandleSnapshotSidecarFile(filePath, configService) {
11061
+ if (isSidecarFile(filePath)) return true;
11062
+ const normalizedFile = normalizeFsResolvedId(filePath);
11063
+ const normalizedSrcRoot = normalizeFsResolvedId(configService.absoluteSrcRoot);
11064
+ if (normalizedFile === normalizedSrcRoot || normalizedFile.startsWith(`${normalizedSrcRoot}/`)) return false;
11065
+ return path.extname(filePath) !== "";
11066
+ }
11067
+ function isGeneratedMiniprogramWatchInclude(pattern, configService) {
11068
+ if (pattern === "**") return true;
11069
+ const normalizedPattern = normalizeFsResolvedId(path.isAbsolute(pattern) ? pattern : path.resolve(configService.cwd, pattern));
11070
+ const normalizedSrcRoot = normalizeFsResolvedId(configService.absoluteSrcRoot);
11071
+ if (normalizedPattern === normalizedSrcRoot || normalizedPattern.startsWith(`${normalizedSrcRoot}/`)) return true;
11072
+ if (configService.absolutePluginRoot) {
11073
+ const normalizedPluginRoot = normalizeFsResolvedId(configService.absolutePluginRoot);
11074
+ if (normalizedPattern === normalizedPluginRoot || normalizedPattern.startsWith(`${normalizedPluginRoot}/`)) return true;
11075
+ }
11076
+ return (configService.configFileDependencies ?? []).some((dependency) => {
11077
+ return normalizedPattern === normalizeFsResolvedId(dependency);
11078
+ });
10634
11079
  }
10635
- function createSnapshotSidecarWatchPatterns(root) {
10636
- return [
11080
+ function resolveUserBuildWatchInclude(configService, inlineConfig) {
11081
+ const buildWatch = inlineConfig?.build?.watch ?? configService?.inlineConfig?.build?.watch;
11082
+ if (!buildWatch || typeof buildWatch !== "object") return [];
11083
+ const include = buildWatch.include;
11084
+ return (Array.isArray(include) ? include : include ? [include] : []).filter((pattern) => typeof pattern === "string").filter((pattern) => !isGeneratedMiniprogramWatchInclude(pattern, configService)).map((pattern) => path.normalize(path.isAbsolute(pattern) ? pattern : path.resolve(configService.cwd, pattern)));
11085
+ }
11086
+ function createSnapshotSidecarWatchPatterns(configService, inlineConfig) {
11087
+ const root = configService.absoluteSrcRoot;
11088
+ const patterns = [
10637
11089
  ...configSuffixes$1.map((suffix) => path.join(root, `**/*${suffix}`)),
10638
11090
  ...Array.from(watchedCssExts).map((ext) => path.join(root, `**/*${ext}`)),
10639
11091
  ...Array.from(watchedTemplateExts).map((ext) => path.join(root, `**/*${ext}`)),
10640
11092
  ...Array.from(watchedScriptModuleExts).map((ext) => path.join(root, `**/*${ext}`))
10641
11093
  ];
11094
+ for (const include of resolveUserBuildWatchInclude(configService, inlineConfig)) patterns.push(include);
11095
+ return patterns;
10642
11096
  }
10643
11097
  function createSnapshotSidecarIgnoredMatcher(ctx) {
10644
11098
  const configService = ctx.configService;
@@ -10875,6 +11329,7 @@ function createBuildService(ctx) {
10875
11329
  }
10876
11330
  const buildState = ctx.runtimeState.build;
10877
11331
  const { queue } = buildState;
11332
+ const requestedConfigRestartBuilds = /* @__PURE__ */ new Set();
10878
11333
  let autoTouchResolved = false;
10879
11334
  let autoTouchChecked = false;
10880
11335
  const { buildIndependentBundle, getIndependentOutput, invalidateIndependentOutput } = createIndependentBuilder(configService, buildState);
@@ -10898,6 +11353,22 @@ function createBuildService(ctx) {
10898
11353
  const normalizedFile = normalizeFsResolvedId(filePath);
10899
11354
  return normalizedFile === normalizedOutDir || normalizedFile.startsWith(`${normalizedOutDir}/`);
10900
11355
  }
11356
+ function shouldRestartDevBuild(target) {
11357
+ if (!configService.isDev) return false;
11358
+ return requestedConfigRestartBuilds.delete(target);
11359
+ }
11360
+ function resetRuntimeStateForConfigRestart() {
11361
+ const fresh = createRuntimeState();
11362
+ ctx.runtimeState.autoRoutes = fresh.autoRoutes;
11363
+ ctx.runtimeState.autoImport = fresh.autoImport;
11364
+ ctx.runtimeState.build.hmr = fresh.build.hmr;
11365
+ ctx.runtimeState.json = fresh.json;
11366
+ ctx.runtimeState.asset = fresh.asset;
11367
+ ctx.runtimeState.css = fresh.css;
11368
+ ctx.runtimeState.wxml = fresh.wxml;
11369
+ ctx.runtimeState.scan = fresh.scan;
11370
+ ctx.runtimeState.lib = fresh.lib;
11371
+ }
10901
11372
  async function runDev(target) {
10902
11373
  if (process.env.NODE_ENV === void 0) process.env.NODE_ENV = "development";
10903
11374
  debug$2?.(`[${target}] dev build watcher start`);
@@ -10955,13 +11426,16 @@ function createBuildService(ctx) {
10955
11426
  const startedAt = reason ? performance.now() : 0;
10956
11427
  snapshotBuildChain = snapshotBuildChain.then(async () => {
10957
11428
  if (devWatcherClosed) return;
10958
- if (reason?.event || reason?.file) ctx.runtimeState.build.hmr.profile = {
10959
- ...ctx.runtimeState.build.hmr.profile,
10960
- eventId: createHmrProfileEventId(),
10961
- event: reason.event,
10962
- file: reason.file,
10963
- watchToDirtyMs: performance.now() - startedAt
10964
- };
11429
+ if (reason?.event || reason?.file) {
11430
+ if (reason.file) invalidateFileCache(reason.file);
11431
+ ctx.runtimeState.build.hmr.profile = {
11432
+ ...ctx.runtimeState.build.hmr.profile,
11433
+ eventId: createHmrProfileEventId(),
11434
+ event: reason.event,
11435
+ file: reason.file,
11436
+ watchToDirtyMs: performance.now() - startedAt
11437
+ };
11438
+ }
10965
11439
  const sidecarEntryId = await resolveSnapshotSidecarEntryId(reason);
10966
11440
  if (sidecarEntryId) {
10967
11441
  markSnapshotEntryDirty(sidecarEntryId);
@@ -11019,6 +11493,15 @@ function createBuildService(ctx) {
11019
11493
  resetHmrProfile();
11020
11494
  if (appWxssPath && shouldTouchAppWxss()) touch(appWxssPath).catch(() => {});
11021
11495
  resolveWatcher(e);
11496
+ if (shouldRestartDevBuild(target)) {
11497
+ await watcher.close();
11498
+ logger_default.info("检测到 Vite 配置变更,正在重启小程序开发构建...");
11499
+ resetRuntimeStateForConfigRestart();
11500
+ await configService.load(configService.loadOptions);
11501
+ await scanService.loadAppEntry().catch(() => {});
11502
+ logger_default.success("Vite 配置已重新加载,小程序开发构建已重启。");
11503
+ await runDev(target);
11504
+ }
11022
11505
  })().catch((error) => {
11023
11506
  resetHmrProfile();
11024
11507
  rejectWatcher(error);
@@ -11031,7 +11514,7 @@ function createBuildService(ctx) {
11031
11514
  await promise;
11032
11515
  const watcherRoot = target === "plugin" ? configService.absolutePluginRoot ?? configService.absoluteSrcRoot : "/";
11033
11516
  if (target === "app" && !watcherService.sidecarWatcherMap.has(snapshotWatcherRoot)) {
11034
- const snapshotWatcher = chokidar.watch(createSnapshotSidecarWatchPatterns(configService.absoluteSrcRoot), createSidecarWatchOptions(configService, {
11517
+ const snapshotWatcher = chokidar.watch(createSnapshotSidecarWatchPatterns(configService, buildOptions), createSidecarWatchOptions(configService, {
11035
11518
  persistent: true,
11036
11519
  ignoreInitial: true,
11037
11520
  ignored: createSnapshotSidecarIgnoredMatcher(ctx)
@@ -11039,7 +11522,7 @@ function createBuildService(ctx) {
11039
11522
  snapshotWatcher.on("all", (event, id) => {
11040
11523
  if (!id) return;
11041
11524
  if (isDevOutputFile(id)) return;
11042
- if (!shouldHandleSnapshotSidecarFile(id)) return;
11525
+ if (!shouldHandleSnapshotSidecarFile(id, configService)) return;
11043
11526
  const sidecarStartedAt = performance.now();
11044
11527
  runSnapshotBuild({
11045
11528
  event: event.startsWith("unlink") ? "delete" : event.startsWith("add") ? "create" : "update",
@@ -11140,7 +11623,10 @@ function createBuildService(ctx) {
11140
11623
  }
11141
11624
  async function runBuildTarget(target) {
11142
11625
  ctx.currentBuildTarget = target;
11143
- if (configService.isDev) return await runDev(target);
11626
+ if (configService.isDev) {
11627
+ requestedConfigRestartBuilds.delete(target);
11628
+ return await runDev(target);
11629
+ }
11144
11630
  return await runProd(target);
11145
11631
  }
11146
11632
  async function buildEntry(options) {
@@ -11174,6 +11660,9 @@ function createBuildService(ctx) {
11174
11660
  return {
11175
11661
  queue,
11176
11662
  build: buildEntry,
11663
+ requestConfigRestart(target = "app") {
11664
+ requestedConfigRestartBuilds.add(target);
11665
+ },
11177
11666
  buildIndependentBundle,
11178
11667
  getIndependentOutput,
11179
11668
  invalidateIndependentOutput
@@ -11186,63 +11675,6 @@ function createBuildServicePlugin(ctx) {
11186
11675
  return { name: "weapp-runtime:build-service" };
11187
11676
  }
11188
11677
  //#endregion
11189
- //#region src/multiPlatform.ts
11190
- const DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT = "config";
11191
- function normalizeMultiPlatformProjectConfigRoot(input) {
11192
- if (typeof input !== "string") return DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT;
11193
- return input.trim() || "config";
11194
- }
11195
- function resolveMultiPlatformTargets(value) {
11196
- const supportedPlatforms = getSupportedMiniProgramPlatforms$1();
11197
- if (value == null || value === "all") return supportedPlatforms;
11198
- if (!Array.isArray(value)) throw new TypeError("`weapp.multiPlatform.targets` 必须是平台数组或 \"all\"。");
11199
- const resolvedTargets = [];
11200
- const invalidTargets = [];
11201
- for (const rawTarget of value) {
11202
- const resolvedTarget = typeof rawTarget === "string" ? resolveMiniPlatform(rawTarget) : void 0;
11203
- if (!resolvedTarget) {
11204
- invalidTargets.push(String(rawTarget));
11205
- continue;
11206
- }
11207
- if (!resolvedTargets.includes(resolvedTarget)) resolvedTargets.push(resolvedTarget);
11208
- }
11209
- if (invalidTargets.length > 0) throw new Error(`\`weapp.multiPlatform.targets\` 包含不支持的平台:${invalidTargets.join(", ")}`);
11210
- if (resolvedTargets.length === 0) throw new Error("`weapp.multiPlatform.targets` 至少需要包含一个目标平台。");
11211
- return resolvedTargets;
11212
- }
11213
- function resolveMultiPlatformConfig(value) {
11214
- if (!value) return {
11215
- enabled: false,
11216
- projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
11217
- targets: getSupportedMiniProgramPlatforms$1()
11218
- };
11219
- if (value === true) return {
11220
- enabled: true,
11221
- projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
11222
- targets: getSupportedMiniProgramPlatforms$1()
11223
- };
11224
- if (typeof value === "object" && value !== null) {
11225
- const record = value;
11226
- const targets = resolveMultiPlatformTargets(record.targets);
11227
- return {
11228
- enabled: record.enabled !== false,
11229
- projectConfigRoot: normalizeMultiPlatformProjectConfigRoot(record.projectConfigRoot),
11230
- targets
11231
- };
11232
- }
11233
- return {
11234
- enabled: false,
11235
- projectConfigRoot: DEFAULT_MULTI_PLATFORM_PROJECT_CONFIG_ROOT,
11236
- targets: getSupportedMiniProgramPlatforms$1()
11237
- };
11238
- }
11239
- function supportsMultiPlatformTarget(multiPlatform, platform) {
11240
- return multiPlatform.targets.includes(platform);
11241
- }
11242
- function resolveMultiPlatformProjectConfigDir(multiPlatform, platform) {
11243
- return path.join(multiPlatform.projectConfigRoot || "config", platform);
11244
- }
11245
- //#endregion
11246
11678
  //#region src/runtime/packageAliases.ts
11247
11679
  const WEVU_WORKSPACE_PACKAGE_PATH = "packages-runtime/wevu";
11248
11680
  const PACKAGE_ALIASES = [
@@ -11384,131 +11816,6 @@ function createAliasManager(oxcAlias, defaultBuiltinAliases) {
11384
11816
  return { injectBuiltinAliases };
11385
11817
  }
11386
11818
  //#endregion
11387
- //#region src/defaults.ts
11388
- const defaultExcluded = [
11389
- "**/node_modules/**",
11390
- "**/miniprogram_npm/**",
11391
- "**/.weapp-vite",
11392
- "**/.weapp-vite/**"
11393
- ];
11394
- /**
11395
- * 样式扩展名说明:
11396
- * - wxss:微信小程序
11397
- * - acss:支付宝小程序
11398
- * - jxss:京东小程序
11399
- * - ttss:头条小程序
11400
- * - qss:QQ 小程序
11401
- * - css:通用样式文件
11402
- * - tyss:涂鸦小程序
11403
- */
11404
- /**
11405
- * 模板扩展名说明:
11406
- * - wxml:微信小程序
11407
- * - axml:支付宝小程序
11408
- * - jxml:京东小程序
11409
- * - ksml:快手小程序
11410
- * - ttml:头条小程序
11411
- * - qml:QQ 小程序
11412
- * - tyml:涂鸦小程序
11413
- * - xhsml:小红书小程序
11414
- * - swan:百度小程序
11415
- */
11416
- function getOutputExtensions(platform) {
11417
- return getPlatformOutputExtensions(platform ?? DEFAULT_MP_PLATFORM);
11418
- }
11419
- function getWeappViteConfig() {
11420
- return {
11421
- autoRoutes: false,
11422
- wxml: true,
11423
- wxs: true,
11424
- enhance: {
11425
- wxml: true,
11426
- wxs: true
11427
- },
11428
- platform: DEFAULT_MP_PLATFORM,
11429
- multiPlatform: false,
11430
- es5: false,
11431
- packageSizeWarningBytes: 2 * 1024 * 1024,
11432
- analyze: {
11433
- budgets: {
11434
- totalBytes: 20 * 1024 * 1024,
11435
- mainBytes: 2 * 1024 * 1024,
11436
- subPackageBytes: 2 * 1024 * 1024,
11437
- independentBytes: 2 * 1024 * 1024,
11438
- warningRatio: .85
11439
- },
11440
- history: {
11441
- enabled: true,
11442
- dir: ".weapp-vite/analyze-history",
11443
- limit: 20
11444
- }
11445
- },
11446
- jsFormat: "cjs",
11447
- isAdditionalWxml: () => {
11448
- return false;
11449
- },
11450
- npm: {
11451
- enable: true,
11452
- cache: true,
11453
- alipayNpmMode: "node_modules"
11454
- },
11455
- hmr: {
11456
- sharedChunks: "auto",
11457
- touchAppWxss: "auto",
11458
- logLevel: "default",
11459
- profileJson: false
11460
- },
11461
- mcp: {
11462
- enabled: true,
11463
- autoStart: false,
11464
- host: "127.0.0.1",
11465
- port: 3088,
11466
- endpoint: "/mcp",
11467
- restEndpoint: "/api/weapp/devtools"
11468
- },
11469
- forwardConsole: {
11470
- enabled: "auto",
11471
- logLevels: [
11472
- "log",
11473
- "info",
11474
- "warn",
11475
- "error"
11476
- ],
11477
- unhandledErrors: true
11478
- },
11479
- appPrelude: { mode: "require" },
11480
- wevu: { defaults: { component: { allowNullPropInput: true } } },
11481
- chunks: {
11482
- sharedStrategy: "duplicate",
11483
- sharedMode: "common",
11484
- sharedOverrides: [],
11485
- sharedPathRoot: void 0,
11486
- dynamicImports: "preserve",
11487
- logOptimization: true,
11488
- forceDuplicatePatterns: [],
11489
- duplicateWarningBytes: 512 * 1024
11490
- }
11491
- };
11492
- }
11493
- const defaultAssetExtensions = [
11494
- "png",
11495
- "jpg",
11496
- "jpeg",
11497
- "gif",
11498
- "svg",
11499
- "cer",
11500
- "mp3",
11501
- "aac",
11502
- "m4a",
11503
- "mp4",
11504
- "wav",
11505
- "ogg",
11506
- "silk",
11507
- "wasm",
11508
- "br",
11509
- "cert"
11510
- ];
11511
- //#endregion
11512
11819
  //#region src/runtime/config/enhance.ts
11513
11820
  const enhanceKeys = [
11514
11821
  "wxml",
@@ -12340,6 +12647,7 @@ function createLoadConfig(options) {
12340
12647
  };
12341
12648
  return {
12342
12649
  config,
12650
+ loadOptions: opts,
12343
12651
  aliasEntries,
12344
12652
  outputExtensions,
12345
12653
  packageJson,
@@ -13031,7 +13339,7 @@ function hasOwn$4(source, key) {
13031
13339
  function resolveSfcAssetFileName(relativeBase, extension) {
13032
13340
  return `${relativeBase}.${extension}`;
13033
13341
  }
13034
- function parseJsonSafely$1(source) {
13342
+ function parseJsonSafely$2(source) {
13035
13343
  if (!source) return;
13036
13344
  try {
13037
13345
  return JSON.parse(source);
@@ -13086,7 +13394,7 @@ function emitSfcJsonAsset(ctx, bundle, relativeBase, result, options) {
13086
13394
  kind: options.kind ?? "unknown"
13087
13395
  });
13088
13396
  const defaultConfig = options.defaultConfig;
13089
- let nextConfig = parseJsonSafely$1(result.config);
13397
+ let nextConfig = parseJsonSafely$2(result.config);
13090
13398
  if (!nextConfig && options.defaults) nextConfig = mergeJson({}, options.defaults, "defaults");
13091
13399
  if (defaultConfig) nextConfig = mergeJson(defaultConfig, nextConfig ?? {}, "emit");
13092
13400
  if (defaultConfig && nextConfig) {
@@ -14126,33 +14434,40 @@ function autoRoutes(ctx) {
14126
14434
  }
14127
14435
  //#endregion
14128
14436
  //#region src/plugins/hooks/useLoadEntry/autoImport.ts
14129
- function createAutoImportAugmenter(autoImportService, wxmlService) {
14437
+ function createAutoImportAugmenter(autoImportService, wxmlService, externalComponentEntryMap) {
14130
14438
  const cache = /* @__PURE__ */ new Map();
14131
14439
  return function applyAutoImports(baseName, json) {
14132
14440
  const hit = wxmlService.getAggregatedAutoImportComponents?.(baseName) ?? wxmlService.getAggregatedComponents(baseName);
14133
14441
  if (!hit) return [];
14134
14442
  const version = autoImportService.getVersion();
14135
14443
  const cached = cache.get(baseName);
14136
- const resolvedUsingComponents = cached && cached.hit === hit && cached.version === version ? cached.usingComponents : (() => {
14137
- const usingComponents = {};
14444
+ const resolvedComponents = cached && cached.hit === hit && cached.version === version ? cached.resolvedComponents : (() => {
14445
+ const resolvedComponents = {};
14138
14446
  for (const depComponentName of Object.keys(hit)) {
14139
14447
  const match = autoImportService.resolve(depComponentName, baseName);
14140
14448
  if (!match) continue;
14141
- usingComponents[match.value.name] = match.value.from;
14449
+ resolvedComponents[match.value.name] = {
14450
+ from: match.value.from,
14451
+ resolvedId: match.value.resolvedId
14452
+ };
14142
14453
  }
14143
14454
  cache.set(baseName, {
14144
14455
  hit,
14145
14456
  version,
14146
- usingComponents
14457
+ resolvedComponents
14147
14458
  });
14148
- return usingComponents;
14459
+ return resolvedComponents;
14149
14460
  })();
14150
14461
  const injectedEntries = [];
14151
- for (const [name, from] of Object.entries(resolvedUsingComponents)) {
14462
+ for (const [name, resolved] of Object.entries(resolvedComponents)) {
14152
14463
  const usingComponents = get(json, "usingComponents");
14153
- if (isObject(usingComponents) && Reflect.has(usingComponents, name)) continue;
14154
- set(json, `usingComponents.${name}`, from);
14155
- injectedEntries.push(from);
14464
+ if (isObject(usingComponents) && Reflect.has(usingComponents, name)) {
14465
+ if (usingComponents[name] === resolved.from) injectedEntries.push(resolved.from);
14466
+ continue;
14467
+ }
14468
+ set(json, `usingComponents.${name}`, resolved.from);
14469
+ injectedEntries.push(resolved.from);
14470
+ if (resolved.resolvedId) externalComponentEntryMap?.set(resolved.from.replace(/^\/+/, ""), resolved.resolvedId);
14156
14471
  }
14157
14472
  return injectedEntries;
14158
14473
  };
@@ -16143,6 +16458,7 @@ function resolveUpstreamPendingReasonSummary(dirtyReasonSummary) {
16143
16458
  const hasLayoutFallback = dirtyReasonSummary.some((item) => item.startsWith("layout-fallback-full:"));
16144
16459
  const hasLayoutPropagation = dirtyReasonSummary.some((item) => item.startsWith("layout-self:") || item.startsWith("layout-dependent:"));
16145
16460
  const hasAutoRoutesTopology = dirtyReasonSummary.some((item) => item.startsWith("auto-routes-topology:"));
16461
+ if (dirtyReasonSummary.some((item) => item.startsWith("config-restart:"))) pendingReasonSummary.push("config-restart");
16146
16462
  if (hasLayoutFallback) pendingReasonSummary.push("layout-fallback-full");
16147
16463
  else if (hasLayoutPropagation) pendingReasonSummary.push("layout-propagation");
16148
16464
  if (hasAutoRoutesTopology) pendingReasonSummary.push("auto-routes-topology");
@@ -16309,7 +16625,7 @@ function useLoadEntry(ctx, options) {
16309
16625
  registerJsonAsset,
16310
16626
  scanTemplateEntry,
16311
16627
  emitEntriesChunks,
16312
- applyAutoImports: createAutoImportAugmenter(ctx.autoImportService, ctx.wxmlService),
16628
+ applyAutoImports: createAutoImportAugmenter(ctx.autoImportService, ctx.wxmlService, ctx.runtimeState.build.hmr.externalComponentEntryMap),
16313
16629
  extendedLibManager: createExtendedLibManager(),
16314
16630
  buildTarget,
16315
16631
  debug
@@ -16655,7 +16971,7 @@ function collectAffectedEntries(state, startId) {
16655
16971
  const current = queue.shift();
16656
16972
  if (visited.has(current)) continue;
16657
16973
  visited.add(current);
16658
- if (state.entryModuleIds.has(current)) {
16974
+ if (state.entryModuleIds.has(current) || state.resolvedEntryMap.has(current)) {
16659
16975
  affected.add(current);
16660
16976
  continue;
16661
16977
  }
@@ -20021,6 +20337,9 @@ function isAutoRoutesGeneratedFileChange(state, normalizedId) {
20021
20337
  managedOutputPaths: resolveAutoRoutesManagedOutputPaths(state.ctx)
20022
20338
  });
20023
20339
  }
20340
+ function isConfigFileDependencyChange(state, normalizedId) {
20341
+ return state.ctx.configService.configFileDependencies.some((dependency) => normalizeFsResolvedId(dependency) === normalizedId);
20342
+ }
20024
20343
  function isCurrentSubPackageFile(relativeSrc, subPackageMeta) {
20025
20344
  const root = subPackageMeta?.subPackage.root;
20026
20345
  return !root || relativeSrc === root || relativeSrc.startsWith(`${root}/`);
@@ -20257,6 +20576,13 @@ async function processChangedFile(state, id, event) {
20257
20576
  const relativeCwd = configService.relativeCwd(normalizedId);
20258
20577
  let handledByIndependentWatcher = false;
20259
20578
  let independentMeta;
20579
+ const isConfigDependency = isConfigFileDependencyChange(state, normalizedId);
20580
+ if (isConfigDependency) {
20581
+ loadEntry?.invalidateResolveCache?.();
20582
+ scanService.markDirty();
20583
+ buildService.requestConfigRestart?.(state.buildTarget);
20584
+ for (const entryId of resolvedEntryMap.keys()) markEntryDirtyWithCause(entryId, "direct", "config-restart");
20585
+ }
20260
20586
  if (event === "create" || event === "delete") {
20261
20587
  loadEntry?.invalidateResolveCache?.();
20262
20588
  await invalidateEntryForSidecar(ctx, normalizedId, event);
@@ -20271,7 +20597,7 @@ async function processChangedFile(state, id, event) {
20271
20597
  const platformConfigPrefix = `${resolveMultiPlatformProjectConfigDir(configService.multiPlatform, platform)}/`;
20272
20598
  shouldMarkProjectConfigDirty = relativeCwd.startsWith(platformConfigPrefix);
20273
20599
  }
20274
- if (relativeSrc === "app.json" || shouldMarkProjectConfigDirty) scanService.markDirty();
20600
+ if (!isConfigDependency && (relativeSrc === "app.json" || shouldMarkProjectConfigDirty)) scanService.markDirty();
20275
20601
  const independentRoot = Array.from(scanService.independentSubPackageMap.keys()).find((root) => {
20276
20602
  return relativeSrc.startsWith(`${root}/`);
20277
20603
  });
@@ -20648,6 +20974,132 @@ function getSourceFromVirtualId(id) {
20648
20974
  return id;
20649
20975
  }
20650
20976
  //#endregion
20977
+ //#region src/plugins/vue/transform/bundle/outputExtensions.ts
20978
+ function resolveBundleOutputExtensions(outputExtensions) {
20979
+ return resolveOutputExtensions(outputExtensions);
20980
+ }
20981
+ //#endregion
20982
+ //#region src/plugins/vue/transform/slotFallbackWrapper.ts
20983
+ const slotFallbackWrapperUsageByBundle = /* @__PURE__ */ new WeakMap();
20984
+ const slotFallbackWrapperScriptByBundle = /* @__PURE__ */ new WeakMap();
20985
+ function parseJsonSafely$1(source) {
20986
+ if (!source) return {};
20987
+ try {
20988
+ const parsed = JSON.parse(source);
20989
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
20990
+ } catch {
20991
+ return {};
20992
+ }
20993
+ }
20994
+ function stringifyJson(json) {
20995
+ return JSON.stringify(json, null, 2);
20996
+ }
20997
+ function isAsset(value) {
20998
+ return value?.type === "asset";
20999
+ }
21000
+ function getAssetSource(asset) {
21001
+ return asset?.source?.toString?.() ?? "";
21002
+ }
21003
+ function upsertSlotFallbackWrapperUsingComponent(json) {
21004
+ const usingComponents = json.usingComponents && typeof json.usingComponents === "object" && !Array.isArray(json.usingComponents) ? { ...json.usingComponents } : {};
21005
+ usingComponents[WEVU_SLOT_FALLBACK_VIRTUAL_HOST_TAG_NAME] = WEVU_SLOT_FALLBACK_VIRTUAL_HOST_GLOBAL_PATH;
21006
+ json.usingComponents = usingComponents;
21007
+ return json;
21008
+ }
21009
+ function normalizeJsonConfigForPlatform$1(json, compilerCtx) {
21010
+ const jsonPlatformOptions = resolveVueTransformJsonPlatformOptions(compilerCtx?.configService);
21011
+ if (!jsonPlatformOptions.normalizeUsingComponents) return json;
21012
+ try {
21013
+ const source = resolveJson({ json }, void 0, jsonPlatformOptions.platform, {
21014
+ dependencies: jsonPlatformOptions.dependencies,
21015
+ alipayNpmMode: jsonPlatformOptions.alipayNpmMode
21016
+ });
21017
+ return source ? JSON.parse(source) : json;
21018
+ } catch {
21019
+ return json;
21020
+ }
21021
+ }
21022
+ function getSlotFallbackWrapperUsage(bundle) {
21023
+ let usage = slotFallbackWrapperUsageByBundle.get(bundle);
21024
+ if (!usage) {
21025
+ usage = /* @__PURE__ */ new Set();
21026
+ slotFallbackWrapperUsageByBundle.set(bundle, usage);
21027
+ }
21028
+ return usage;
21029
+ }
21030
+ function markSlotFallbackWrapperUsage(bundle, relativeBase) {
21031
+ getSlotFallbackWrapperUsage(bundle).add(relativeBase);
21032
+ }
21033
+ function getSlotFallbackWrapperScriptCache(bundle) {
21034
+ let cache = slotFallbackWrapperScriptByBundle.get(bundle);
21035
+ if (!cache) {
21036
+ cache = /* @__PURE__ */ new Map();
21037
+ slotFallbackWrapperScriptByBundle.set(bundle, cache);
21038
+ }
21039
+ return cache;
21040
+ }
21041
+ function injectSlotFallbackWrapperIntoJsonAsset(bundle, jsonFileName, compilerCtx) {
21042
+ const output = bundle[jsonFileName];
21043
+ if (!isAsset(output)) return false;
21044
+ output.source = stringifyJson(normalizeJsonConfigForPlatform$1(upsertSlotFallbackWrapperUsingComponent(parseJsonSafely$1(getAssetSource(output))), compilerCtx));
21045
+ return true;
21046
+ }
21047
+ function injectGlobalSlotFallbackWrapperUsingComponent(bundle, compilerCtx, outputExtensions) {
21048
+ const { jsonExtension } = resolveBundleOutputExtensions(outputExtensions);
21049
+ const usage = slotFallbackWrapperUsageByBundle.get(bundle);
21050
+ if (!usage?.size) return false;
21051
+ if (injectSlotFallbackWrapperIntoJsonAsset(bundle, `app.${jsonExtension}`, compilerCtx)) return true;
21052
+ for (const relativeBase of usage) injectSlotFallbackWrapperIntoJsonAsset(bundle, `${relativeBase}.${jsonExtension}`, compilerCtx);
21053
+ return false;
21054
+ }
21055
+ function hasGlobalSlotFallbackWrapperUsingComponentAsset(bundle, outputExtensions) {
21056
+ const { jsonExtension } = resolveBundleOutputExtensions(outputExtensions);
21057
+ return isAsset(bundle[`app.${jsonExtension}`]);
21058
+ }
21059
+ function injectLocalSlotFallbackWrapperUsingComponentIfNeeded(options) {
21060
+ if (!options.result.slotFallbackWrapperComponent || hasGlobalSlotFallbackWrapperUsingComponentAsset(options.bundle, options.outputExtensions)) return false;
21061
+ const config = upsertSlotFallbackWrapperUsingComponent(parseJsonSafely$1(options.result.config));
21062
+ options.result.config = stringifyJson(normalizeJsonConfigForPlatform$1(config, options.compilerCtx));
21063
+ return true;
21064
+ }
21065
+ function emitSlotFallbackWrapperScriptIfMissing(ctx, bundle, fileName, script) {
21066
+ const existing = bundle[fileName];
21067
+ if (existing && existing.type === "asset") {
21068
+ if ((existing.source?.toString?.() ?? "") !== script) existing.source = script;
21069
+ return;
21070
+ }
21071
+ const cache = getSlotFallbackWrapperScriptCache(bundle);
21072
+ if (cache.get(fileName) === script) return;
21073
+ if (!existing) {
21074
+ ctx.emitFile({
21075
+ type: "asset",
21076
+ fileName,
21077
+ source: script
21078
+ });
21079
+ cache.set(fileName, script);
21080
+ }
21081
+ }
21082
+ function emitSlotFallbackWrapperComponentAsset(options) {
21083
+ const component = options.result.slotFallbackWrapperComponent;
21084
+ if (!component) return;
21085
+ const { templateExtension, jsonExtension, scriptExtension } = resolveBundleOutputExtensions(options.outputExtensions);
21086
+ const componentBase = WEVU_SLOT_FALLBACK_VIRTUAL_HOST_BASE;
21087
+ markSlotFallbackWrapperUsage(options.bundle, options.relativeBase);
21088
+ emitSfcTemplateIfMissing(options.ctx, options.bundle, componentBase, component.template, templateExtension);
21089
+ const jsonFileName = `${componentBase}.${jsonExtension}`;
21090
+ const mergeJson = createJsonMerger(options.jsonOptions?.mergeStrategy, {
21091
+ filename: jsonFileName,
21092
+ kind: "component"
21093
+ });
21094
+ let config = component.config;
21095
+ if (options.jsonOptions?.defaults && Object.keys(options.jsonOptions.defaults).length > 0) config = mergeJson(config, options.jsonOptions.defaults, "defaults");
21096
+ emitSfcJsonAsset(options.ctx, options.bundle, componentBase, { config: JSON.stringify(normalizeJsonConfigForPlatform$1(config, options.compilerCtx), null, 2) }, {
21097
+ kind: "component",
21098
+ extension: jsonExtension
21099
+ });
21100
+ emitSlotFallbackWrapperScriptIfMissing(options.ctx, options.bundle, `${componentBase}.${scriptExtension}`, component.script);
21101
+ }
21102
+ //#endregion
20651
21103
  //#region src/plugins/vue/transform/classStyle.ts
20652
21104
  function resolveClassStylePackageRoot(ctx, relativeBase, configService) {
20653
21105
  const currentRoot = normalizeRoot(configService.currentSubPackageRoot ?? "");
@@ -20673,11 +21125,6 @@ function resolveClassStyleWxsLocationForBase(ctx, relativeBase, extension, confi
20673
21125
  });
20674
21126
  }
20675
21127
  //#endregion
20676
- //#region src/plugins/vue/transform/bundle/outputExtensions.ts
20677
- function resolveBundleOutputExtensions(outputExtensions) {
20678
- return resolveOutputExtensions(outputExtensions);
20679
- }
20680
- //#endregion
20681
21128
  //#region src/plugins/vue/transform/scopedSlot/assets.ts
20682
21129
  function hasOwn(source, key) {
20683
21130
  return Object.prototype.hasOwnProperty.call(source, key);
@@ -20955,6 +21402,24 @@ function emitSharedVueEntryAssets(options) {
20955
21402
  defaults: scopedSlotDefaults,
20956
21403
  mergeStrategy: scopedSlotMergeStrategy
20957
21404
  });
21405
+ injectLocalSlotFallbackWrapperUsingComponentIfNeeded({
21406
+ bundle,
21407
+ result,
21408
+ compilerCtx: ctx,
21409
+ outputExtensions
21410
+ });
21411
+ emitSlotFallbackWrapperComponentAsset({
21412
+ ctx: pluginCtx,
21413
+ bundle,
21414
+ relativeBase,
21415
+ result,
21416
+ compilerCtx: ctx,
21417
+ outputExtensions,
21418
+ jsonOptions: {
21419
+ defaults: scopedSlotDefaults,
21420
+ mergeStrategy: scopedSlotMergeStrategy
21421
+ }
21422
+ });
20958
21423
  return { classStyleWxs };
20959
21424
  }
20960
21425
  function emitBundleVueEntryAssets(options) {
@@ -21152,6 +21617,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
21152
21617
  const scopedSlotsRequireProps = configService.weappViteConfig?.vue?.template?.scopedSlotsRequireProps ?? false;
21153
21618
  const slotSingleRootNoWrapper = configService.weappViteConfig?.vue?.template?.slotSingleRootNoWrapper ?? false;
21154
21619
  const slotFallbackWrapper = configService.weappViteConfig?.vue?.template?.slotFallbackWrapper;
21620
+ const slotFallbackWrapperStrategy = configService.weappViteConfig?.vue?.template?.slotFallbackWrapperStrategy ?? (configService.platform === "weapp" && slotFallbackWrapper === void 0 ? "virtual-host" : "view");
21155
21621
  const slotMultipleInstance = configService.weappViteConfig?.vue?.template?.slotMultipleInstance ?? true;
21156
21622
  const htmlTagToWxml = configService.weappViteConfig?.vue?.template?.htmlTagToWxml;
21157
21623
  const htmlTagToWxmlTagClass = configService.weappViteConfig?.vue?.template?.htmlTagToWxmlTagClass ?? true;
@@ -21243,6 +21709,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
21243
21709
  scopedSlotsRequireProps,
21244
21710
  slotSingleRootNoWrapper,
21245
21711
  slotFallbackWrapper,
21712
+ slotFallbackWrapperStrategy,
21246
21713
  slotMultipleInstance,
21247
21714
  classStyleRuntime: templatePlatformOptions.classStyleRuntime,
21248
21715
  objectLiteralBindMode,
@@ -22699,6 +23166,7 @@ async function emitVueBundleAssets(bundle, state) {
22699
23166
  if (!emitState) return;
22700
23167
  await emitCompiledBundleEntries(bundle, state, emitState.compilationEntries);
22701
23168
  await emitFallbackPageAssets(bundle, state, { emittedEntryIds: emitState.emittedEntryIds });
23169
+ injectGlobalSlotFallbackWrapperUsingComponent(bundle, state.ctx, state.ctx.configService.outputExtensions);
22702
23170
  }
22703
23171
  //#endregion
22704
23172
  //#region src/plugins/wevu.ts
@@ -23335,9 +23803,9 @@ function resolveMiniprogramWatchInclude(options) {
23335
23803
  watchInclude.push(path.join(pluginPatternBase, "**"));
23336
23804
  }
23337
23805
  for (const dependency of options.configFileDependencies ?? []) watchInclude.push(dependency);
23338
- const userInclude = Array.isArray(options.userInclude) ? options.userInclude : options.userInclude ? [options.userInclude] : [];
23806
+ const include = [...Array.isArray(options.userInclude) ? options.userInclude : options.userInclude ? [options.userInclude] : [], ...watchInclude];
23339
23807
  const seen = /* @__PURE__ */ new Set();
23340
- return [...userInclude, ...watchInclude].filter((item) => {
23808
+ return include.filter((item) => {
23341
23809
  if (typeof item !== "string") return true;
23342
23810
  if (seen.has(item)) return false;
23343
23811
  seen.add(item);
@@ -23376,6 +23844,7 @@ function mergeMiniprogram(options, ...configs) {
23376
23844
  };
23377
23845
  if (isDev) {
23378
23846
  const hmrWatchBuildDelay = 60;
23847
+ const userBuildWatch = config.build?.watch;
23379
23848
  const watchInclude = resolveMiniprogramWatchInclude({
23380
23849
  cwd,
23381
23850
  srcRoot,
@@ -23392,6 +23861,7 @@ function mergeMiniprogram(options, ...configs) {
23392
23861
  modulePreload: false,
23393
23862
  watch: {
23394
23863
  buildDelay: hmrWatchBuildDelay,
23864
+ ...typeof userBuildWatch === "object" && userBuildWatch ? userBuildWatch : {},
23395
23865
  exclude: [...defaultExcluded, mpDistRoot ? path.join(cwd, mpDistRoot, "**") : path.join(cwd, "dist", "**")],
23396
23866
  include: watchInclude
23397
23867
  },
@@ -23401,6 +23871,14 @@ function mergeMiniprogram(options, ...configs) {
23401
23871
  sourcemap: false
23402
23872
  }
23403
23873
  });
23874
+ inline.build.watch.include = resolveMiniprogramWatchInclude({
23875
+ cwd,
23876
+ srcRoot,
23877
+ pluginRoot: config.weapp?.pluginRoot,
23878
+ buildScope: resolveBuildScope(config.weapp?.buildScope),
23879
+ userInclude: inline.build?.watch?.include,
23880
+ configFileDependencies
23881
+ });
23404
23882
  normalizeInlineConfigAfterDefu(inline, {
23405
23883
  cwd,
23406
23884
  ctx,
@@ -23422,6 +23900,7 @@ function mergeMiniprogram(options, ...configs) {
23422
23900
  rolldownOptions: { ...rolldownOptions }
23423
23901
  }
23424
23902
  });
23903
+ if (inlineConfig.build) delete inlineConfig.build.watch;
23425
23904
  normalizeInlineConfigAfterDefu(inlineConfig, {
23426
23905
  cwd,
23427
23906
  ctx,
@@ -23750,6 +24229,7 @@ function createConfigService(ctx) {
23750
24229
  emitDefaultAutoImportOutputs: true,
23751
24230
  projectConfig: {},
23752
24231
  config: {},
24232
+ loadOptions: input,
23753
24233
  packageJson: {},
23754
24234
  platform: "weapp",
23755
24235
  multiPlatform: resolveMultiPlatformConfig(false),
@@ -23847,6 +24327,9 @@ function createConfigService(ctx) {
23847
24327
  get inlineConfig() {
23848
24328
  return options.config;
23849
24329
  },
24330
+ get loadOptions() {
24331
+ return options.loadOptions;
24332
+ },
23850
24333
  get weappViteConfig() {
23851
24334
  return options.config.weapp;
23852
24335
  },
@@ -24020,244 +24503,6 @@ function createNpmServicePlugin(ctx) {
24020
24503
  return { name: "weapp-runtime:npm-service" };
24021
24504
  }
24022
24505
  //#endregion
24023
- //#region src/cache/file.ts
24024
- const FNV_OFFSET_BASIS = 14695981039346656037n;
24025
- const FNV_PRIME = 1099511628211n;
24026
- const FNV_MASK = 18446744073709551615n;
24027
- function fnv1aStep(hash, byte) {
24028
- hash ^= BigInt(byte & 255);
24029
- return hash * FNV_PRIME & FNV_MASK;
24030
- }
24031
- function createSignature(content) {
24032
- let hash = FNV_OFFSET_BASIS;
24033
- if (typeof content === "string") for (let i = 0; i < content.length; i++) {
24034
- const code = content.charCodeAt(i);
24035
- hash = fnv1aStep(hash, code & 255);
24036
- const high = code >>> 8;
24037
- if (high > 0) hash = fnv1aStep(hash, high);
24038
- }
24039
- else for (const byte of content) hash = fnv1aStep(hash, byte);
24040
- return hash.toString(36);
24041
- }
24042
- var FileCache = class {
24043
- cache;
24044
- mtimeMap;
24045
- signatureMap;
24046
- constructor(max = 1024) {
24047
- this.mtimeMap = /* @__PURE__ */ new Map();
24048
- this.signatureMap = /* @__PURE__ */ new Map();
24049
- this.cache = new LRUCache({
24050
- max,
24051
- dispose: (_value, key) => {
24052
- this.mtimeMap.delete(key);
24053
- this.signatureMap.delete(key);
24054
- }
24055
- });
24056
- }
24057
- get(id) {
24058
- return this.cache.get(id);
24059
- }
24060
- set(id, content) {
24061
- return this.cache.set(id, content);
24062
- }
24063
- delete(id) {
24064
- this.mtimeMap.delete(id);
24065
- this.signatureMap.delete(id);
24066
- return this.cache.delete(id);
24067
- }
24068
- async isInvalidate(id, options) {
24069
- const checkMtime = options?.checkMtime ?? true;
24070
- const nextSignature = options?.signature ?? (options?.content !== void 0 ? createSignature(options.content) : void 0);
24071
- if (!checkMtime) {
24072
- if (nextSignature === void 0) return true;
24073
- if (this.signatureMap.get(id) !== nextSignature) {
24074
- this.signatureMap.set(id, nextSignature);
24075
- return true;
24076
- }
24077
- return false;
24078
- }
24079
- let mtimeMs;
24080
- if (typeof options?.mtimeMs === "number" && Number.isFinite(options.mtimeMs)) mtimeMs = options.mtimeMs;
24081
- else try {
24082
- mtimeMs = (await fs.stat(id)).mtimeMs;
24083
- } catch (error) {
24084
- if (error && error.code === "ENOENT") {
24085
- this.cache.delete(id);
24086
- this.mtimeMap.delete(id);
24087
- this.signatureMap.delete(id);
24088
- return true;
24089
- }
24090
- throw error;
24091
- }
24092
- if (mtimeMs === void 0) return true;
24093
- const cachedMtime = this.mtimeMap.get(id);
24094
- const updateSignature = () => {
24095
- if (nextSignature !== void 0) this.signatureMap.set(id, nextSignature);
24096
- };
24097
- if (cachedMtime === void 0) {
24098
- this.mtimeMap.set(id, mtimeMs);
24099
- updateSignature();
24100
- return true;
24101
- } else if (cachedMtime > mtimeMs) {
24102
- this.mtimeMap.set(id, mtimeMs);
24103
- updateSignature();
24104
- return true;
24105
- } else if (cachedMtime === mtimeMs) {
24106
- if (nextSignature !== void 0) {
24107
- if (this.signatureMap.get(id) !== nextSignature) {
24108
- updateSignature();
24109
- return true;
24110
- }
24111
- }
24112
- return false;
24113
- } else {
24114
- this.mtimeMap.set(id, mtimeMs);
24115
- updateSignature();
24116
- return true;
24117
- }
24118
- }
24119
- };
24120
- //#endregion
24121
- //#region src/runtime/runtimeState.ts
24122
- function createDefaultLoadConfigResult() {
24123
- return {
24124
- config: {},
24125
- aliasEntries: [],
24126
- outputExtensions: getOutputExtensions(DEFAULT_MP_PLATFORM),
24127
- packageJson: {},
24128
- relativeSrcRoot: (p) => p,
24129
- cwd: process.cwd(),
24130
- isDev: false,
24131
- mode: "development",
24132
- emitDefaultAutoImportOutputs: true,
24133
- projectConfig: {},
24134
- projectConfigPath: void 0,
24135
- projectPrivateConfigPath: void 0,
24136
- mpDistRoot: "",
24137
- multiPlatform: resolveMultiPlatformConfig(false),
24138
- weappLib: void 0,
24139
- weappLibOutputMap: void 0,
24140
- packageJsonPath: "",
24141
- platform: DEFAULT_MP_PLATFORM,
24142
- srcRoot: "",
24143
- configFilePath: void 0,
24144
- configFileDependencies: [],
24145
- weappWeb: void 0,
24146
- configMergeInfo: void 0
24147
- };
24148
- }
24149
- function createDefaultPackageInfo() {
24150
- return {
24151
- name: "",
24152
- version: void 0,
24153
- rootPath: "",
24154
- packageJsonPath: "",
24155
- packageJson: {}
24156
- };
24157
- }
24158
- function createDefaultPackageManager() {
24159
- return {
24160
- agent: "npm",
24161
- name: "npm"
24162
- };
24163
- }
24164
- function createRuntimeState() {
24165
- const emptyAutoRoutesSnapshot = createEmptyAutoRoutesSnapshot();
24166
- const emptyAutoRoutesArtifacts = createAutoRoutesArtifacts(emptyAutoRoutesSnapshot);
24167
- return {
24168
- autoRoutes: {
24169
- routes: emptyAutoRoutesSnapshot,
24170
- serialized: emptyAutoRoutesArtifacts.serialized,
24171
- moduleCode: emptyAutoRoutesArtifacts.moduleCode,
24172
- typedDefinition: "",
24173
- watchFiles: /* @__PURE__ */ new Set(),
24174
- watchDirs: /* @__PURE__ */ new Set(),
24175
- dirty: true,
24176
- initialized: false,
24177
- candidates: /* @__PURE__ */ new Map(),
24178
- needsFullRescan: true,
24179
- loadingAppConfig: false
24180
- },
24181
- autoImport: {
24182
- registry: /* @__PURE__ */ new Map(),
24183
- resolvedResolverComponents: /* @__PURE__ */ new Map(),
24184
- matcherKey: "",
24185
- version: 0,
24186
- pendingEntriesByImporter: /* @__PURE__ */ new Map()
24187
- },
24188
- build: {
24189
- queue: new PQueue({ autoStart: false }),
24190
- npmBuilt: false,
24191
- independent: { outputs: /* @__PURE__ */ new Map() },
24192
- hmr: {
24193
- loadedEntrySet: /* @__PURE__ */ new Set(),
24194
- dirtyEntrySet: /* @__PURE__ */ new Set(),
24195
- dirtyEntryReasons: /* @__PURE__ */ new Map(),
24196
- resolvedEntryMap: /* @__PURE__ */ new Map(),
24197
- externalComponentEntryMap: /* @__PURE__ */ new Map(),
24198
- entriesMap: /* @__PURE__ */ new Map(),
24199
- layoutEntryDependents: /* @__PURE__ */ new Map(),
24200
- entryLayoutDependencies: /* @__PURE__ */ new Map(),
24201
- vueEntryHasTemplate: /* @__PURE__ */ new Map(),
24202
- vueEntryNonJsonSignatures: /* @__PURE__ */ new Map(),
24203
- vueEntryScriptSignatures: /* @__PURE__ */ new Map(),
24204
- dirtyVueEntryIds: /* @__PURE__ */ new Set(),
24205
- didEmitAllEntries: false,
24206
- lastHmrEntryIds: /* @__PURE__ */ new Set(),
24207
- lastEmittedEntryIds: /* @__PURE__ */ new Set(),
24208
- recentProfiles: [],
24209
- profile: {}
24210
- }
24211
- },
24212
- json: {
24213
- cache: new FileCache(),
24214
- emittedSource: /* @__PURE__ */ new Map()
24215
- },
24216
- asset: {
24217
- emittedBuffer: /* @__PURE__ */ new Map(),
24218
- scopedSlotGenerics: /* @__PURE__ */ new Map()
24219
- },
24220
- css: {
24221
- importerToDependencies: /* @__PURE__ */ new Map(),
24222
- dependencyToImporters: /* @__PURE__ */ new Map(),
24223
- emittedSource: /* @__PURE__ */ new Map()
24224
- },
24225
- watcher: {
24226
- rollupWatcherMap: /* @__PURE__ */ new Map(),
24227
- sidecarWatcherMap: /* @__PURE__ */ new Map()
24228
- },
24229
- wxml: {
24230
- depsMap: /* @__PURE__ */ new Map(),
24231
- importerMap: /* @__PURE__ */ new Map(),
24232
- tokenMap: /* @__PURE__ */ new Map(),
24233
- componentsMap: /* @__PURE__ */ new Map(),
24234
- aggregatedComponentsMap: /* @__PURE__ */ new Map(),
24235
- templatePathMap: /* @__PURE__ */ new Map(),
24236
- cache: new FileCache(),
24237
- emittedCode: /* @__PURE__ */ new Map()
24238
- },
24239
- scan: {
24240
- subPackageMap: /* @__PURE__ */ new Map(),
24241
- independentSubPackageMap: /* @__PURE__ */ new Map(),
24242
- warnedMessages: /* @__PURE__ */ new Set(),
24243
- isDirty: true,
24244
- independentDirtyRoots: /* @__PURE__ */ new Set(),
24245
- pluginJsonPath: void 0
24246
- },
24247
- lib: {
24248
- enabled: false,
24249
- entries: /* @__PURE__ */ new Map()
24250
- },
24251
- config: {
24252
- packageInfo: createDefaultPackageInfo(),
24253
- defineEnv: {},
24254
- importMetaEnvDefineOverride: void 0,
24255
- packageManager: createDefaultPackageManager(),
24256
- options: createDefaultLoadConfigResult()
24257
- }
24258
- };
24259
- }
24260
- //#endregion
24261
24506
  //#region src/runtime/scanPlugin/service/shared.ts
24262
24507
  function createWarnOnce(warnedMessages) {
24263
24508
  return function warnOnce(message) {
@@ -24389,7 +24634,7 @@ async function loadAppEntry(ctx, scanState) {
24389
24634
  const vueAppPath = await findVueEntry(appBasename);
24390
24635
  let configFromVue;
24391
24636
  if (!appConfigFile && vueAppPath) {
24392
- const { extractConfigFromVue } = await import("./file-DEY9-lgk.mjs");
24637
+ const { extractConfigFromVue } = await import("./file-obpuUUBb.mjs");
24393
24638
  configFromVue = await extractConfigFromVue(vueAppPath);
24394
24639
  if (configFromVue) appConfigFile = vueAppPath;
24395
24640
  }