weapp-vite 6.0.0-alpha.4 → 6.0.0-alpha.5

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.
Files changed (39) hide show
  1. package/dist/auto-import-components/resolvers.cjs +6 -6
  2. package/dist/auto-import-components/resolvers.mjs +1 -1
  3. package/dist/auto-routes.cjs +9 -9
  4. package/dist/auto-routes.mjs +5 -5
  5. package/dist/{chunk-SJSLFDTA.cjs → chunk-2CHNKORP.cjs} +2 -2
  6. package/dist/{chunk-ML5KPLC5.mjs → chunk-3WGUNRY5.mjs} +1 -1
  7. package/dist/chunk-53RK3GBH.cjs +6 -0
  8. package/dist/{chunk-YIVKT2UN.mjs → chunk-7GJOCTON.mjs} +1 -1
  9. package/dist/{chunk-5CBZRYDL.mjs → chunk-AOUAT7U3.mjs} +2 -2
  10. package/dist/{chunk-YXFADQPY.mjs → chunk-AZBN7A5I.mjs} +1 -1
  11. package/dist/{chunk-ZAAP7JAU.mjs → chunk-B44QTW7W.mjs} +219 -144
  12. package/dist/{chunk-E34K6TPD.cjs → chunk-HL25C7YQ.cjs} +2 -2
  13. package/dist/{chunk-UKTIE44Q.cjs → chunk-HRJEZONN.cjs} +2 -2
  14. package/dist/{chunk-PXOMWSIN.mjs → chunk-HTF2YIJT.mjs} +2 -2
  15. package/dist/{chunk-EVZXCCHN.cjs → chunk-JZO2G5T5.cjs} +622 -547
  16. package/dist/{chunk-TZGJRA2Y.cjs → chunk-PFE2IVZ3.cjs} +2 -2
  17. package/dist/{chunk-AYB4WOZM.mjs → chunk-T6MAVU7E.mjs} +1 -1
  18. package/dist/{chunk-O6633IWP.mjs → chunk-V5RMQ6TF.mjs} +1 -1
  19. package/dist/{chunk-SVAH2XJL.cjs → chunk-WLWDPBMV.cjs} +6 -6
  20. package/dist/{chunk-R6Z72GR5.cjs → chunk-ZZA26GJI.cjs} +3 -3
  21. package/dist/cli.cjs +78 -78
  22. package/dist/cli.mjs +4 -4
  23. package/dist/config.cjs +4 -4
  24. package/dist/config.mjs +3 -3
  25. package/dist/{file-AP6E5UEG.mjs → file-4WEK4X45.mjs} +2 -2
  26. package/dist/file-IMZTAEKY.cjs +29 -0
  27. package/dist/index.cjs +10 -10
  28. package/dist/index.mjs +8 -8
  29. package/dist/json.cjs +3 -3
  30. package/dist/json.mjs +2 -2
  31. package/dist/runtime.cjs +3 -3
  32. package/dist/runtime.mjs +2 -2
  33. package/dist/types.cjs +9 -9
  34. package/dist/types.mjs +2 -2
  35. package/dist/volar.cjs +2 -2
  36. package/dist/volar.mjs +1 -1
  37. package/package.json +9 -9
  38. package/dist/chunk-WYYIFHJZ.cjs +0 -6
  39. package/dist/file-ZWW24BA5.cjs +0 -29
@@ -15,12 +15,12 @@ import {
15
15
  templateExtensions,
16
16
  touch,
17
17
  vueExtensions
18
- } from "./chunk-AYB4WOZM.mjs";
18
+ } from "./chunk-T6MAVU7E.mjs";
19
19
  import {
20
20
  __commonJS,
21
21
  __toESM,
22
22
  init_esm_shims
23
- } from "./chunk-5CBZRYDL.mjs";
23
+ } from "./chunk-AOUAT7U3.mjs";
24
24
 
25
25
  // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
26
26
  var require_debug = __commonJS({
@@ -910,12 +910,21 @@ init_esm_shims();
910
910
  import { sep } from "path";
911
911
  import path2 from "pathe";
912
912
  var BACKSLASH_RE = /\\/g;
913
+ var LEADING_SLASH_RE = /^[\\/]+/;
914
+ var DUPLICATE_SLASH_RE = /\/{2,}/g;
915
+ var TRIM_SLASH_RE = /^\/+|\/+$/g;
913
916
  function toPosixPath(value) {
914
917
  return value.replace(BACKSLASH_RE, "/");
915
918
  }
916
919
  function fromPosixPath(value) {
917
920
  return sep === "/" ? value : value.split("/").join(sep);
918
921
  }
922
+ function stripLeadingSlashes(value) {
923
+ return value.replace(LEADING_SLASH_RE, "");
924
+ }
925
+ function normalizeRoot(root) {
926
+ return toPosixPath(root).replace(DUPLICATE_SLASH_RE, "/").replace(TRIM_SLASH_RE, "");
927
+ }
919
928
  function isPathInside(parent, target) {
920
929
  if (!parent) {
921
930
  return false;
@@ -2783,9 +2792,6 @@ function mergeAutoImportComponents(lower, upper, preferUpperScalars = false) {
2783
2792
  }
2784
2793
  return merged;
2785
2794
  }
2786
- function normalizeGlobRoot(root) {
2787
- return toPosixPath(root).replace(/^\/+|\/+$/g, "");
2788
- }
2789
2795
  function createDefaultAutoImportComponents(configService) {
2790
2796
  const globs = /* @__PURE__ */ new Set();
2791
2797
  globs.add("components/**/*.wxml");
@@ -2798,7 +2804,7 @@ function createDefaultAutoImportComponents(configService) {
2798
2804
  if (subConfig?.autoImportComponents === false) {
2799
2805
  continue;
2800
2806
  }
2801
- const normalized = normalizeGlobRoot(root);
2807
+ const normalized = normalizeRoot(root);
2802
2808
  if (!normalized) {
2803
2809
  continue;
2804
2810
  }
@@ -9644,8 +9650,8 @@ var PathScurryBase = class {
9644
9650
  *
9645
9651
  * @internal
9646
9652
  */
9647
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs33 = defaultFS } = {}) {
9648
- this.#fs = fsFromOption(fs33);
9653
+ constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs30 = defaultFS } = {}) {
9654
+ this.#fs = fsFromOption(fs30);
9649
9655
  if (cwd instanceof URL || cwd.startsWith("file://")) {
9650
9656
  cwd = fileURLToPath(cwd);
9651
9657
  }
@@ -10203,8 +10209,8 @@ var PathScurryWin32 = class extends PathScurryBase {
10203
10209
  /**
10204
10210
  * @internal
10205
10211
  */
10206
- newRoot(fs33) {
10207
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs33 });
10212
+ newRoot(fs30) {
10213
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs30 });
10208
10214
  }
10209
10215
  /**
10210
10216
  * Return true if the provided path string is an absolute path
@@ -10232,8 +10238,8 @@ var PathScurryPosix = class extends PathScurryBase {
10232
10238
  /**
10233
10239
  * @internal
10234
10240
  */
10235
- newRoot(fs33) {
10236
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs33 });
10241
+ newRoot(fs30) {
10242
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs30 });
10237
10243
  }
10238
10244
  /**
10239
10245
  * Return true if the provided path string is an absolute path
@@ -21856,7 +21862,6 @@ function autoRoutes(ctx) {
21856
21862
  // src/plugins/core.ts
21857
21863
  init_esm_shims();
21858
21864
  import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
21859
- import fs15 from "fs-extra";
21860
21865
  import MagicString3 from "magic-string";
21861
21866
  import path27 from "pathe";
21862
21867
 
@@ -22254,7 +22259,7 @@ import { fileURLToPath as fileURLToPath5 } from "url";
22254
22259
  import { parse as babelParse } from "@babel/parser";
22255
22260
  import { NodeTypes, baseParse as parseTemplate } from "@vue/compiler-core";
22256
22261
  import { removeExtensionDeep as removeExtensionDeep3 } from "@weapp-core/shared";
22257
- import fs13 from "fs-extra";
22262
+ import fs14 from "fs-extra";
22258
22263
  import MagicString from "magic-string";
22259
22264
  import path23 from "pathe";
22260
22265
  import { parse as parseSfc } from "vue/compiler-sfc";
@@ -22431,22 +22436,88 @@ function analyzeCommonJson(json) {
22431
22436
  return entries;
22432
22437
  }
22433
22438
 
22439
+ // src/plugins/utils/cache.ts
22440
+ init_esm_shims();
22441
+ import fs13 from "fs-extra";
22442
+ var mtimeCache = /* @__PURE__ */ new Map();
22443
+ var loadCache = new LRUCache({
22444
+ max: 1024
22445
+ });
22446
+ var pathExistsCache = new LRUCache({
22447
+ max: 4096
22448
+ });
22449
+ async function isInvalidate(id) {
22450
+ const cachedMtime = mtimeCache.get(id);
22451
+ const stats = await fs13.stat(id);
22452
+ const mtimeMs = typeof stats?.mtimeMs === "number" ? stats.mtimeMs : Number.NaN;
22453
+ if (!Number.isFinite(mtimeMs)) {
22454
+ return true;
22455
+ }
22456
+ if (cachedMtime === void 0) {
22457
+ mtimeCache.set(id, mtimeMs);
22458
+ return true;
22459
+ } else if (cachedMtime >= mtimeMs) {
22460
+ return false;
22461
+ } else {
22462
+ mtimeCache.set(id, mtimeMs);
22463
+ return true;
22464
+ }
22465
+ }
22466
+ async function readFile2(id, options) {
22467
+ const checkMtime = options?.checkMtime ?? true;
22468
+ const encoding = options?.encoding ?? "utf8";
22469
+ if (!checkMtime) {
22470
+ const cached = loadCache.get(id);
22471
+ if (cached !== void 0) {
22472
+ return cached;
22473
+ }
22474
+ const content2 = await fs13.readFile(id, encoding);
22475
+ loadCache.set(id, content2);
22476
+ return content2;
22477
+ }
22478
+ const invalid = await isInvalidate(id);
22479
+ if (!invalid) {
22480
+ const cached = loadCache.get(id);
22481
+ if (cached !== void 0) {
22482
+ return cached;
22483
+ }
22484
+ }
22485
+ const content = await fs13.readFile(id, encoding);
22486
+ loadCache.set(id, content);
22487
+ return content;
22488
+ }
22489
+ async function pathExists2(id, options) {
22490
+ const ttlMs = options?.ttlMs;
22491
+ const cached = pathExistsCache.get(id);
22492
+ if (cached !== void 0) {
22493
+ return cached;
22494
+ }
22495
+ const exists = await fs13.pathExists(id);
22496
+ if (typeof ttlMs === "number" && Number.isFinite(ttlMs) && ttlMs > 0) {
22497
+ pathExistsCache.set(id, exists, { ttl: ttlMs });
22498
+ } else {
22499
+ pathExistsCache.set(id, exists);
22500
+ }
22501
+ return exists;
22502
+ }
22503
+
22434
22504
  // src/plugins/hooks/useLoadEntry/loadEntry.ts
22435
22505
  function createStopwatch() {
22436
22506
  const start = performance3.now();
22437
22507
  return () => `${(performance3.now() - start).toFixed(2)}ms`;
22438
22508
  }
22509
+ var RESERVED_VUE_COMPONENT_TAGS = /* @__PURE__ */ new Set([
22510
+ "template",
22511
+ "slot",
22512
+ "component",
22513
+ "transition",
22514
+ "keep-alive",
22515
+ "teleport",
22516
+ "suspense"
22517
+ ]);
22518
+ var COMPONENT_TAG_RE = /^[A-Z_$][\w$]*$/i;
22439
22519
  function collectVueTemplateComponentNames(template) {
22440
22520
  const names = /* @__PURE__ */ new Set();
22441
- const reserved = /* @__PURE__ */ new Set([
22442
- "template",
22443
- "slot",
22444
- "component",
22445
- "transition",
22446
- "keep-alive",
22447
- "teleport",
22448
- "suspense"
22449
- ]);
22450
22521
  const ast = parseTemplate(template, { onError: () => {
22451
22522
  } });
22452
22523
  const visit = (node) => {
@@ -22459,8 +22530,8 @@ function collectVueTemplateComponentNames(template) {
22459
22530
  }
22460
22531
  if (node.type === NodeTypes.ELEMENT) {
22461
22532
  const tag = node.tag;
22462
- if (typeof tag === "string" && /^[A-Z_$][\w$]*$/i.test(tag)) {
22463
- if (!reserved.has(tag) && !isBuiltinComponent(tag)) {
22533
+ if (typeof tag === "string" && COMPONENT_TAG_RE.test(tag)) {
22534
+ if (!RESERVED_VUE_COMPONENT_TAGS.has(tag) && !isBuiltinComponent(tag)) {
22464
22535
  names.add(tag);
22465
22536
  }
22466
22537
  }
@@ -22538,7 +22609,7 @@ async function addWatchTarget(pluginCtx, target, existsCache) {
22538
22609
  pluginCtx.addWatchFile(target);
22539
22610
  return cached;
22540
22611
  }
22541
- const exists = await fs13.exists(target);
22612
+ const exists = await fs14.exists(target);
22542
22613
  pluginCtx.addWatchFile(target);
22543
22614
  existsCache.set(target, exists);
22544
22615
  return exists;
@@ -22700,7 +22771,7 @@ function createEntryLoader(options) {
22700
22771
  applyAutoImports(baseName, json);
22701
22772
  if (vueEntryPath) {
22702
22773
  try {
22703
- const vueSource = await fs13.readFile(vueEntryPath, "utf8");
22774
+ const vueSource = await readFile2(vueEntryPath, { checkMtime: configService.isDev });
22704
22775
  const { descriptor, errors } = parseSfc(vueSource, { filename: vueEntryPath });
22705
22776
  if (!errors?.length && descriptor?.scriptSetup && descriptor?.template) {
22706
22777
  const templateComponentNames = collectVueTemplateComponentNames(descriptor.template.content);
@@ -22746,7 +22817,7 @@ function createEntryLoader(options) {
22746
22817
  visited.add(exporterFile);
22747
22818
  let code2;
22748
22819
  try {
22749
- code2 = await fs13.readFile(exporterFile, "utf8");
22820
+ code2 = await readFile2(exporterFile, { checkMtime: configService.isDev });
22750
22821
  } catch {
22751
22822
  return void 0;
22752
22823
  }
@@ -22884,7 +22955,7 @@ function createEntryLoader(options) {
22884
22955
  type: "plugin"
22885
22956
  });
22886
22957
  }
22887
- const code = await fs13.readFile(id, "utf8");
22958
+ const code = await readFile2(id, { checkMtime: configService.isDev });
22888
22959
  const styleImports = await collectStyleImports(this, id, existsCache);
22889
22960
  debug4?.(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
22890
22961
  if (styleImports.length === 0) {
@@ -23025,7 +23096,7 @@ function collectRequireTokens(ast) {
23025
23096
 
23026
23097
  // src/plugins/utils/invalidateEntry.ts
23027
23098
  init_esm_shims();
23028
- import fs14 from "fs";
23099
+ import fs15 from "fs";
23029
23100
  import process6 from "process";
23030
23101
  import path25 from "pathe";
23031
23102
  var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
@@ -23112,7 +23183,7 @@ function registerCssImports(ctx, importer, dependencies) {
23112
23183
  }
23113
23184
  async function extractCssImportDependencies(ctx, importer) {
23114
23185
  try {
23115
- const stats = await fs14.promises.stat(importer);
23186
+ const stats = await fs15.promises.stat(importer);
23116
23187
  if (!stats.isFile()) {
23117
23188
  cleanupImporterGraph(ctx, importer);
23118
23189
  return;
@@ -23123,7 +23194,7 @@ async function extractCssImportDependencies(ctx, importer) {
23123
23194
  }
23124
23195
  let cssContent;
23125
23196
  try {
23126
- cssContent = await fs14.promises.readFile(importer, "utf8");
23197
+ cssContent = await fs15.promises.readFile(importer, "utf8");
23127
23198
  } catch {
23128
23199
  cleanupImporterGraph(ctx, importer);
23129
23200
  return;
@@ -23305,7 +23376,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
23305
23376
  }
23306
23377
  const { sidecarWatcherMap } = ctx.runtimeState.watcher;
23307
23378
  const absRoot = path25.normalize(rootDir);
23308
- if (!fs14.existsSync(absRoot)) {
23379
+ if (!fs15.existsSync(absRoot)) {
23309
23380
  return;
23310
23381
  }
23311
23382
  if (sidecarWatcherMap.has(absRoot)) {
@@ -23374,7 +23445,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
23374
23445
  }
23375
23446
  const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absRoot : absRoot;
23376
23447
  const resolved = path25.isAbsolute(candidate) ? candidate : path25.resolve(baseDir, candidate);
23377
- const exists = fs14.existsSync(resolved);
23448
+ const exists = fs15.existsSync(resolved);
23378
23449
  const derivedEvent = exists ? "create" : "delete";
23379
23450
  const relativeResolved = ctx.configService.relativeCwd(resolved);
23380
23451
  logger_default.info(`[watch:rename->${derivedEvent}] ${relativeResolved}`);
@@ -23425,9 +23496,15 @@ function createSidecarIgnoredMatcher(ctx, rootDir) {
23425
23496
  init_esm_shims();
23426
23497
  function parseRequest(id) {
23427
23498
  const [filename, rawQuery] = id.split(`?`, 2);
23428
- const query = Object.fromEntries(new URLSearchParams(rawQuery));
23429
- if (Reflect.has(query, "wxss")) {
23430
- query.wxss = true;
23499
+ const query = {};
23500
+ if (rawQuery) {
23501
+ const params = new URLSearchParams(rawQuery);
23502
+ for (const [key, value] of params.entries()) {
23503
+ query[key] = value;
23504
+ }
23505
+ if (Object.prototype.hasOwnProperty.call(query, "wxss")) {
23506
+ query.wxss = true;
23507
+ }
23431
23508
  }
23432
23509
  return {
23433
23510
  filename,
@@ -23896,24 +23973,26 @@ function createCoreLifecyclePlugin(state) {
23896
23973
  },
23897
23974
  async load(id) {
23898
23975
  configService.weappViteConfig?.debug?.load?.(id, subPackageMeta);
23899
- const relativeBasename = removeExtensionDeep5(configService.relativeAbsoluteSrcRoot(id));
23900
23976
  if (isCSSRequest(id)) {
23901
23977
  const parsed = parseRequest(id);
23902
23978
  if (parsed.query.wxss) {
23903
23979
  const realPath = getCssRealPath(parsed);
23904
23980
  this.addWatchFile(realPath);
23905
- if (await fs15.exists(realPath)) {
23906
- const css2 = await fs15.readFile(realPath, "utf8");
23981
+ try {
23982
+ const css2 = await readFile2(realPath, { checkMtime: configService.isDev });
23907
23983
  return { code: css2 };
23984
+ } catch {
23908
23985
  }
23909
23986
  }
23910
23987
  return null;
23911
23988
  }
23912
- if (loadedEntrySet.has(id) || subPackageMeta?.entries.includes(relativeBasename)) {
23913
- return await loadEntry.call(this, id, "component");
23989
+ const cleanId = id.split("?", 1)[0];
23990
+ const relativeBasename = removeExtensionDeep5(configService.relativeAbsoluteSrcRoot(cleanId));
23991
+ if (loadedEntrySet.has(cleanId) || subPackageMeta?.entries.includes(relativeBasename)) {
23992
+ return await loadEntry.call(this, cleanId, "component");
23914
23993
  }
23915
23994
  if (relativeBasename === "app") {
23916
- return await loadEntry.call(this, id, "app");
23995
+ return await loadEntry.call(this, cleanId, "app");
23917
23996
  }
23918
23997
  },
23919
23998
  renderStart() {
@@ -24305,10 +24384,6 @@ import path29 from "pathe";
24305
24384
  init_esm_shims();
24306
24385
  import path28 from "pathe";
24307
24386
  import picomatch2 from "picomatch";
24308
- var SLASH_RE = /\\/g;
24309
- function toPosixPath2(value) {
24310
- return value.replace(SLASH_RE, "/");
24311
- }
24312
24387
  var styleMatcherCache = /* @__PURE__ */ new WeakMap();
24313
24388
  function collectSharedStyleEntries(ctx, configService) {
24314
24389
  const map = /* @__PURE__ */ new Map();
@@ -24328,11 +24403,8 @@ function collectSharedStyleEntries(ctx, configService) {
24328
24403
  }
24329
24404
  return map;
24330
24405
  }
24331
- function normalizeRoot(root) {
24332
- return toPosixPath2(root).replace(/^\/+|\/+$/g, "");
24333
- }
24334
24406
  function sanitizeRelativePath(value) {
24335
- const normalized = toPosixPath2(value);
24407
+ const normalized = toPosixPath(value);
24336
24408
  if (normalized.startsWith("./")) {
24337
24409
  return normalized.slice(2);
24338
24410
  }
@@ -24418,12 +24490,12 @@ function findSharedStylesForModule(modulePath, fileName, sharedStyles) {
24418
24490
  return matched;
24419
24491
  }
24420
24492
  function resolveImportSpecifiers(fileName, entries) {
24421
- const posixFileName = toPosixPath2(fileName);
24493
+ const posixFileName = toPosixPath(fileName);
24422
24494
  const dir = path28.posix.dirname(posixFileName);
24423
24495
  const seen = /* @__PURE__ */ new Set();
24424
24496
  const specifiers = [];
24425
24497
  for (const entry of entries) {
24426
- const target = toPosixPath2(entry.outputRelativePath);
24498
+ const target = toPosixPath(entry.outputRelativePath);
24427
24499
  if (target === posixFileName) {
24428
24500
  continue;
24429
24501
  }
@@ -24467,11 +24539,11 @@ function injectSharedStyleImports(css2, modulePath, fileName, sharedStyles, conf
24467
24539
  if (!relativeModulePath) {
24468
24540
  return css2;
24469
24541
  }
24470
- const normalizedModule = toPosixPath2(relativeModulePath);
24542
+ const normalizedModule = toPosixPath(relativeModulePath);
24471
24543
  if (normalizedModule.startsWith("..")) {
24472
24544
  return css2;
24473
24545
  }
24474
- const normalizedFileName = toPosixPath2(fileName);
24546
+ const normalizedFileName = toPosixPath(fileName);
24475
24547
  const entries = findSharedStylesForModule(normalizedModule, normalizedFileName, sharedStyles);
24476
24548
  if (!entries?.length) {
24477
24549
  return css2;
@@ -24512,7 +24584,7 @@ async function handleBundleEntry(bundle, bundleKey, asset2, configService, share
24512
24584
  const absOriginal = rawOriginal ? toAbsolute(rawOriginal) : path29.resolve(configService.absoluteSrcRoot, bundleKey);
24513
24585
  const fileName = configService.relativeOutputPath(absOriginal);
24514
24586
  if (fileName) {
24515
- emitted.add(toPosixPath2(fileName));
24587
+ emitted.add(toPosixPath(fileName));
24516
24588
  }
24517
24589
  if (fileName && fileName !== bundleKey) {
24518
24590
  delete bundle[bundleKey];
@@ -24543,7 +24615,7 @@ async function handleBundleEntry(bundle, bundleKey, asset2, configService, share
24543
24615
  if (!fileName) {
24544
24616
  return;
24545
24617
  }
24546
- const normalizedFileName = toPosixPath2(fileName);
24618
+ const normalizedFileName = toPosixPath(fileName);
24547
24619
  const rawCss = asset2.source.toString();
24548
24620
  const processedCss = await processCssWithCache(rawCss, configService);
24549
24621
  const cssWithImports = injectSharedStyleImports(
@@ -24569,7 +24641,7 @@ async function emitSharedStyleEntries(sharedStyles, emitted, configService, bund
24569
24641
  }
24570
24642
  for (const entries of sharedStyles.values()) {
24571
24643
  for (const entry of entries) {
24572
- const fileName = toPosixPath2(entry.outputRelativePath);
24644
+ const fileName = toPosixPath(entry.outputRelativePath);
24573
24645
  if (emitted.has(fileName)) {
24574
24646
  continue;
24575
24647
  }
@@ -24624,7 +24696,7 @@ async function emitSharedStyleImportsForChunks(sharedStyles, emitted, configServ
24624
24696
  if (!fileName) {
24625
24697
  return;
24626
24698
  }
24627
- const normalizedFileName = toPosixPath2(fileName);
24699
+ const normalizedFileName = toPosixPath(fileName);
24628
24700
  if (emitted.has(normalizedFileName)) {
24629
24701
  return;
24630
24702
  }
@@ -24723,11 +24795,17 @@ init_esm_shims();
24723
24795
  init_esm_shims();
24724
24796
  import { createRequire as createRequire4 } from "module";
24725
24797
  import process7 from "process";
24726
- import fs17 from "fs-extra";
24727
24798
  import path30 from "pathe";
24728
24799
  var VUE_VIRTUAL_MODULE_PREFIX = "\0vue:";
24729
24800
  var warnedMissingWevu = false;
24801
+ var wevuInstallState = "unknown";
24730
24802
  function ensureWevuInstalled(ctx) {
24803
+ if (wevuInstallState === "present") {
24804
+ return;
24805
+ }
24806
+ if (wevuInstallState === "missing") {
24807
+ return;
24808
+ }
24731
24809
  if (warnedMissingWevu) {
24732
24810
  return;
24733
24811
  }
@@ -24736,8 +24814,10 @@ function ensureWevuInstalled(ctx) {
24736
24814
  const require2 = createRequire4(path30.join(cwd, "package.json"));
24737
24815
  try {
24738
24816
  require2.resolve("wevu");
24817
+ wevuInstallState = "present";
24739
24818
  } catch {
24740
24819
  warnedMissingWevu = true;
24820
+ wevuInstallState = "missing";
24741
24821
  logger_default.warn("[vue] \u68C0\u6D4B\u5230\u9879\u76EE\u4E2D\u6709 .vue \u6587\u4EF6\uFF0C\u4F46\u672A\u5B89\u88C5 wevu\uFF0C\u8BF7\u5B89\u88C5 wevu \u540E\u91CD\u8BD5\u3002");
24742
24822
  }
24743
24823
  }
@@ -24765,7 +24845,7 @@ function createVueResolverPlugin(ctx) {
24765
24845
  }
24766
24846
  }
24767
24847
  const vuePath = `${absoluteId}.vue`;
24768
- if (await fs17.pathExists(vuePath)) {
24848
+ if (await pathExists2(vuePath, { ttlMs: configService.isDev ? 250 : 6e4 })) {
24769
24849
  ensureWevuInstalled(ctx);
24770
24850
  return vuePath;
24771
24851
  }
@@ -24775,7 +24855,10 @@ function createVueResolverPlugin(ctx) {
24775
24855
  if (id.startsWith(VUE_VIRTUAL_MODULE_PREFIX)) {
24776
24856
  const actualId = id.slice(VUE_VIRTUAL_MODULE_PREFIX.length);
24777
24857
  const absoluteId = path30.isAbsolute(actualId) ? actualId : path30.resolve(ctx.configService.cwd, actualId);
24778
- const code = await fs17.readFile(absoluteId, "utf-8");
24858
+ const code = await readFile2(absoluteId, {
24859
+ checkMtime: ctx.configService?.isDev ?? false,
24860
+ encoding: "utf-8"
24861
+ });
24779
24862
  return {
24780
24863
  code,
24781
24864
  moduleSideEffects: false
@@ -25743,7 +25826,7 @@ function compileVueTemplateToWxml(template, filename) {
25743
25826
  init_esm_shims();
25744
25827
  var import_merge = __toESM(require_src(), 1);
25745
25828
  import { parse as parseJson2 } from "comment-json";
25746
- import fs18 from "fs-extra";
25829
+ import fs17 from "fs-extra";
25747
25830
  import path31 from "pathe";
25748
25831
  import { bundleRequire } from "rolldown-require";
25749
25832
  function normalizeConfigLang(lang) {
@@ -25769,11 +25852,11 @@ async function evaluateJsLikeConfig(source, filename, lang) {
25769
25852
  const dir = path31.dirname(filename);
25770
25853
  const extension = resolveJsLikeLang(lang) === "ts" ? "ts" : "js";
25771
25854
  const tempDir = path31.join(dir, ".wevu-config");
25772
- await fs18.ensureDir(tempDir);
25855
+ await fs17.ensureDir(tempDir);
25773
25856
  const basename4 = path31.basename(filename, path31.extname(filename));
25774
25857
  const unique = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
25775
25858
  const tempFile = path31.join(tempDir, `${basename4}.${unique}.${extension}`);
25776
- await fs18.writeFile(tempFile, source, "utf8");
25859
+ await fs17.writeFile(tempFile, source, "utf8");
25777
25860
  try {
25778
25861
  const { mod } = await bundleRequire({
25779
25862
  filepath: tempFile,
@@ -25792,13 +25875,13 @@ async function evaluateJsLikeConfig(source, filename, lang) {
25792
25875
  throw new Error("Config block must export an object or a function returning an object");
25793
25876
  } finally {
25794
25877
  try {
25795
- await fs18.remove(tempFile);
25878
+ await fs17.remove(tempFile);
25796
25879
  } catch {
25797
25880
  }
25798
25881
  try {
25799
- const remains = await fs18.readdir(tempDir);
25882
+ const remains = await fs17.readdir(tempDir);
25800
25883
  if (remains.length === 0) {
25801
- await fs18.remove(tempDir);
25884
+ await fs17.remove(tempDir);
25802
25885
  }
25803
25886
  } catch {
25804
25887
  }
@@ -25844,7 +25927,7 @@ var import_merge2 = __toESM(require_src(), 1);
25844
25927
  import { parse as babelParse3 } from "@babel/parser";
25845
25928
  import traverseModule from "@babel/traverse";
25846
25929
  import * as t3 from "@babel/types";
25847
- import fs19 from "fs-extra";
25930
+ import fs18 from "fs-extra";
25848
25931
  import MagicString4 from "magic-string";
25849
25932
  import path32 from "pathe";
25850
25933
  import { bundleRequire as bundleRequire2 } from "rolldown-require";
@@ -26088,11 +26171,11 @@ export default __weapp_json_macro_values
26088
26171
  `;
26089
26172
  const evalSource = header + ms.toString() + footer;
26090
26173
  const extension = resolveScriptSetupExtension(lang);
26091
- await fs19.ensureDir(tempDir);
26174
+ await fs18.ensureDir(tempDir);
26092
26175
  const basename4 = path32.basename(filename, path32.extname(filename));
26093
26176
  const unique = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
26094
26177
  const tempFile = path32.join(tempDir, `${basename4}.json-macro.${unique}.${extension}`);
26095
- await fs19.writeFile(tempFile, evalSource, "utf8");
26178
+ await fs18.writeFile(tempFile, evalSource, "utf8");
26096
26179
  try {
26097
26180
  const { mod } = await bundleRequire2({
26098
26181
  filepath: tempFile,
@@ -26126,13 +26209,13 @@ export default __weapp_json_macro_values
26126
26209
  return accumulator;
26127
26210
  } finally {
26128
26211
  try {
26129
- await fs19.remove(tempFile);
26212
+ await fs18.remove(tempFile);
26130
26213
  } catch {
26131
26214
  }
26132
26215
  try {
26133
- const remains = await fs19.readdir(tempDir);
26216
+ const remains = await fs18.readdir(tempDir);
26134
26217
  if (remains.length === 0) {
26135
- await fs19.remove(tempDir);
26218
+ await fs18.remove(tempDir);
26136
26219
  }
26137
26220
  } catch {
26138
26221
  }
@@ -27019,7 +27102,7 @@ function createPageEntryMatcher(ctx) {
27019
27102
  const set3 = /* @__PURE__ */ new Set();
27020
27103
  const appEntry = await scanService.loadAppEntry();
27021
27104
  for (const pageEntry of appEntry.json?.pages ?? []) {
27022
- const normalized = String(pageEntry).replace(/^[\\/]+/, "");
27105
+ const normalized = stripLeadingSlashes(String(pageEntry));
27023
27106
  if (!normalized) {
27024
27107
  continue;
27025
27108
  }
@@ -27028,7 +27111,7 @@ function createPageEntryMatcher(ctx) {
27028
27111
  for (const meta of scanService.loadSubPackages()) {
27029
27112
  const root = meta.subPackage.root ?? "";
27030
27113
  for (const pageEntry of meta.subPackage.pages ?? []) {
27031
- const normalized = String(pageEntry).replace(/^[\\/]+/, "");
27114
+ const normalized = stripLeadingSlashes(String(pageEntry));
27032
27115
  if (!normalized) {
27033
27116
  continue;
27034
27117
  }
@@ -27038,7 +27121,7 @@ function createPageEntryMatcher(ctx) {
27038
27121
  if (scanService.pluginJson) {
27039
27122
  const pluginPages = Object.values(scanService.pluginJson.pages ?? {});
27040
27123
  for (const entry of pluginPages) {
27041
- const normalized = String(entry).replace(/^[\\/]+/, "");
27124
+ const normalized = stripLeadingSlashes(String(entry));
27042
27125
  if (!normalized) {
27043
27126
  continue;
27044
27127
  }
@@ -27062,7 +27145,6 @@ function createPageEntryMatcher(ctx) {
27062
27145
 
27063
27146
  // src/plugins/wevu/pageFeatures/plugin.ts
27064
27147
  init_esm_shims();
27065
- import fs20 from "fs-extra";
27066
27148
  import path34 from "pathe";
27067
27149
  function createWevuAutoPageFeaturesPlugin(ctx) {
27068
27150
  const matcher = createPageEntryMatcher(ctx);
@@ -27105,10 +27187,7 @@ function createWevuAutoPageFeaturesPlugin(ctx) {
27105
27187
  return void 0;
27106
27188
  }
27107
27189
  try {
27108
- if (await fs20.pathExists(clean)) {
27109
- return await fs20.readFile(clean, "utf8");
27110
- }
27111
- return void 0;
27190
+ return await readFile2(clean, { checkMtime: configService.isDev });
27112
27191
  } catch {
27113
27192
  return void 0;
27114
27193
  }
@@ -27772,7 +27851,7 @@ createWevuComponent({});
27772
27851
 
27773
27852
  // src/plugins/vue/transform/plugin.ts
27774
27853
  init_esm_shims();
27775
- import fs25 from "fs-extra";
27854
+ import fs22 from "fs-extra";
27776
27855
  import path38 from "pathe";
27777
27856
 
27778
27857
  // src/plugins/vue/transform/vitePlugin/emitAssets.ts
@@ -27848,20 +27927,20 @@ function emitSfcScriptAssetReplacingBundleEntry(ctx, bundle, relativeBase, code)
27848
27927
 
27849
27928
  // src/plugins/vue/transform/vitePlugin/fallbackEntries.ts
27850
27929
  init_esm_shims();
27851
- import fs22 from "fs-extra";
27930
+ import fs20 from "fs-extra";
27852
27931
  import path36 from "pathe";
27853
27932
 
27854
27933
  // src/plugins/vue/transform/vitePlugin/collectVuePages.ts
27855
27934
  init_esm_shims();
27856
- import fs21 from "fs-extra";
27935
+ import fs19 from "fs-extra";
27857
27936
  import path35 from "pathe";
27858
27937
  async function collectVuePages(root) {
27859
27938
  const results = [];
27860
27939
  try {
27861
- const entries = await fs21.readdir(root);
27940
+ const entries = await fs19.readdir(root);
27862
27941
  for (const entry of entries) {
27863
27942
  const full = path35.join(root, entry);
27864
- const stat5 = await fs21.stat(full);
27943
+ const stat5 = await fs19.stat(full);
27865
27944
  if (stat5.isDirectory()) {
27866
27945
  const nested = await collectVuePages(full);
27867
27946
  results.push(...nested);
@@ -27882,7 +27961,7 @@ async function collectFallbackPageEntryIds(configService, scanService) {
27882
27961
  } else {
27883
27962
  const appJsonPath = path36.join(configService.cwd, "dist", "app.json");
27884
27963
  try {
27885
- const appJsonContent = await fs22.readFile(appJsonPath, "utf-8");
27964
+ const appJsonContent = await fs20.readFile(appJsonPath, "utf-8");
27886
27965
  const appJson = JSON.parse(appJsonContent);
27887
27966
  pageList = appJson.pages || [];
27888
27967
  } catch {
@@ -27897,8 +27976,8 @@ async function collectFallbackPageEntryIds(configService, scanService) {
27897
27976
 
27898
27977
  // src/plugins/vue/transform/vitePlugin/injectPageFeatures.ts
27899
27978
  init_esm_shims();
27900
- import fs23 from "fs-extra";
27901
- async function injectWevuPageFeaturesInJsWithViteResolver(ctx, source, id) {
27979
+ async function injectWevuPageFeaturesInJsWithViteResolver(ctx, source, id, options) {
27980
+ const checkMtime = options?.checkMtime ?? true;
27902
27981
  return injectWevuPageFeaturesInJsWithResolver(source, {
27903
27982
  id,
27904
27983
  resolver: {
@@ -27912,10 +27991,7 @@ async function injectWevuPageFeaturesInJsWithViteResolver(ctx, source, id) {
27912
27991
  return void 0;
27913
27992
  }
27914
27993
  try {
27915
- if (await fs23.pathExists(clean)) {
27916
- return await fs23.readFile(clean, "utf8");
27917
- }
27918
- return void 0;
27994
+ return await readFile2(clean, { checkMtime });
27919
27995
  } catch {
27920
27996
  return void 0;
27921
27997
  }
@@ -27930,7 +28006,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
27930
28006
  import { parse as babelParse7 } from "@babel/parser";
27931
28007
  import * as t15 from "@babel/types";
27932
28008
  import { removeExtensionDeep as removeExtensionDeep8 } from "@weapp-core/shared";
27933
- import fs24 from "fs-extra";
28009
+ import fs21 from "fs-extra";
27934
28010
  import path37 from "pathe";
27935
28011
  function normalizeResolvedFilePath(id) {
27936
28012
  const clean = getSourceFromVirtualId(id).split("?", 1)[0];
@@ -27956,15 +28032,13 @@ async function resolveUsingComponentPath(ctx, configService, reExportResolutionC
27956
28032
  return void 0;
27957
28033
  }
27958
28034
  try {
27959
- if (await fs24.pathExists(clean)) {
27960
- const stat5 = await fs24.stat(clean);
27961
- if (stat5.isDirectory()) {
27962
- for (const ext2 of ["ts", "js", "mjs", "cjs"]) {
27963
- const indexPath = path37.join(clean, `index.${ext2}`);
27964
- if (await fs24.pathExists(indexPath)) {
27965
- clean = indexPath;
27966
- break;
27967
- }
28035
+ const stat5 = await fs21.stat(clean);
28036
+ if (stat5.isDirectory()) {
28037
+ for (const ext2 of ["ts", "js", "mjs", "cjs"]) {
28038
+ const indexPath = path37.join(clean, `index.${ext2}`);
28039
+ if (await pathExists2(indexPath, { ttlMs: configService.isDev ? 250 : 6e4 })) {
28040
+ clean = indexPath;
28041
+ break;
27968
28042
  }
27969
28043
  }
27970
28044
  }
@@ -27990,7 +28064,7 @@ async function resolveUsingComponentPath(ctx, configService, reExportResolutionC
27990
28064
  visited.add(exporterFile);
27991
28065
  let code;
27992
28066
  try {
27993
- code = await fs24.readFile(exporterFile, "utf8");
28067
+ code = await readFile2(exporterFile, { checkMtime: configService.isDev });
27994
28068
  } catch {
27995
28069
  return void 0;
27996
28070
  }
@@ -28076,7 +28150,7 @@ function createVueTransformPlugin(ctx) {
28076
28150
  const sourceId = getSourceFromVirtualId(id);
28077
28151
  const filename = path38.isAbsolute(sourceId) ? sourceId : path38.resolve(configService.cwd, sourceId);
28078
28152
  try {
28079
- const source = code || await fs25.readFile(filename, "utf-8");
28153
+ const source = code || await fs22.readFile(filename, "utf-8");
28080
28154
  if (ctx.runtimeState.scan.isDirty) {
28081
28155
  pageMatcher.markDirty();
28082
28156
  }
@@ -28090,7 +28164,9 @@ function createVueTransformPlugin(ctx) {
28090
28164
  }
28091
28165
  });
28092
28166
  if (isPage && result.script) {
28093
- const injected = await injectWevuPageFeaturesInJsWithViteResolver(this, result.script, filename);
28167
+ const injected = await injectWevuPageFeaturesInJsWithViteResolver(this, result.script, filename, {
28168
+ checkMtime: configService.isDev
28169
+ });
28094
28170
  if (injected.transformed) {
28095
28171
  result.script = injected.code;
28096
28172
  }
@@ -28143,11 +28219,11 @@ function createVueTransformPlugin(ctx) {
28143
28219
  if (compilationCache.has(vuePath)) {
28144
28220
  continue;
28145
28221
  }
28146
- if (!await fs25.pathExists(vuePath)) {
28222
+ if (!await fs22.pathExists(vuePath)) {
28147
28223
  continue;
28148
28224
  }
28149
28225
  try {
28150
- const source = await fs25.readFile(vuePath, "utf-8");
28226
+ const source = await fs22.readFile(vuePath, "utf-8");
28151
28227
  const result = await compileVueFile(source, vuePath, {
28152
28228
  isPage: true,
28153
28229
  autoUsingComponents: {
@@ -28157,7 +28233,9 @@ function createVueTransformPlugin(ctx) {
28157
28233
  }
28158
28234
  });
28159
28235
  if (result.script) {
28160
- const injected = await injectWevuPageFeaturesInJsWithViteResolver(this, result.script, vuePath);
28236
+ const injected = await injectWevuPageFeaturesInJsWithViteResolver(this, result.script, vuePath, {
28237
+ checkMtime: configService.isDev
28238
+ });
28161
28239
  if (injected.transformed) {
28162
28240
  result.script = injected.code;
28163
28241
  }
@@ -28245,7 +28323,7 @@ var wevu = wevuPlugin;
28245
28323
  init_esm_shims();
28246
28324
  import { createHash as createHash2 } from "crypto";
28247
28325
  import { removeExtension as removeExtension2 } from "@weapp-core/shared";
28248
- import fs26 from "fs-extra";
28326
+ import fs23 from "fs-extra";
28249
28327
  import path39 from "pathe";
28250
28328
  async function resolveWorkerEntry(ctx, entry) {
28251
28329
  const { configService, scanService } = ctx;
@@ -28253,7 +28331,7 @@ async function resolveWorkerEntry(ctx, entry) {
28253
28331
  const key = removeExtension2(relativeEntryPath);
28254
28332
  const absoluteEntry = path39.resolve(configService.absoluteSrcRoot, relativeEntryPath);
28255
28333
  if (isJsOrTs(entry)) {
28256
- const exists = await fs26.exists(absoluteEntry);
28334
+ const exists = await fs23.exists(absoluteEntry);
28257
28335
  if (!exists) {
28258
28336
  logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
28259
28337
  return { key };
@@ -28308,7 +28386,7 @@ function workers(ctx) {
28308
28386
  // src/plugins/wxs.ts
28309
28387
  init_esm_shims();
28310
28388
  import { removeExtension as removeExtension3 } from "@weapp-core/shared";
28311
- import fs27 from "fs-extra";
28389
+ import fs24 from "fs-extra";
28312
28390
  import path40 from "pathe";
28313
28391
  var wxsCodeCache = new LRUCache({
28314
28392
  max: 512
@@ -28317,7 +28395,7 @@ async function transformWxsFile(state, wxsPath) {
28317
28395
  const { ctx } = state;
28318
28396
  const { configService } = ctx;
28319
28397
  this.addWatchFile(wxsPath);
28320
- if (!await fs27.exists(wxsPath)) {
28398
+ if (!await fs24.exists(wxsPath)) {
28321
28399
  return;
28322
28400
  }
28323
28401
  const suffixMatch = wxsPath.match(/\.wxs(\.[jt]s)?$/);
@@ -28325,7 +28403,7 @@ async function transformWxsFile(state, wxsPath) {
28325
28403
  if (suffixMatch) {
28326
28404
  isRaw = !suffixMatch[1];
28327
28405
  }
28328
- const rawCode = await fs27.readFile(wxsPath, "utf8");
28406
+ const rawCode = await fs24.readFile(wxsPath, "utf8");
28329
28407
  let code = wxsCodeCache.get(rawCode);
28330
28408
  if (code === void 0) {
28331
28409
  const { result, importees } = transformWxsCode(rawCode, {
@@ -28991,7 +29069,7 @@ init_esm_shims();
28991
29069
  import { createRequire as createRequire5 } from "module";
28992
29070
  import process9 from "process";
28993
29071
  import { parse as parseJson3 } from "comment-json";
28994
- import fs28 from "fs-extra";
29072
+ import fs25 from "fs-extra";
28995
29073
  import { bundleRequire as bundleRequire3 } from "rolldown-require";
28996
29074
  function parseCommentJson(json) {
28997
29075
  return parseJson3(json, void 0, true);
@@ -29057,7 +29135,7 @@ function createJsonService(ctx) {
29057
29135
  });
29058
29136
  resultJson = typeof mod.default === "function" ? await mod.default(ctx) : mod.default;
29059
29137
  } else {
29060
- resultJson = parseCommentJson(await fs28.readFile(filepath, "utf8"));
29138
+ resultJson = parseCommentJson(await fs25.readFile(filepath, "utf8"));
29061
29139
  }
29062
29140
  cache2.set(filepath, resultJson);
29063
29141
  return resultJson;
@@ -29091,7 +29169,7 @@ init_esm_shims();
29091
29169
  import { isBuiltin } from "module";
29092
29170
  import process10 from "process";
29093
29171
  import { defu as defu5, isObject as isObject8, objectHash } from "@weapp-core/shared";
29094
- import fs29 from "fs-extra";
29172
+ import fs26 from "fs-extra";
29095
29173
  import path43 from "pathe";
29096
29174
  import { build as viteBuild } from "vite";
29097
29175
  function createNpmService(ctx) {
@@ -29113,22 +29191,22 @@ function createNpmService(ctx) {
29113
29191
  return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
29114
29192
  }
29115
29193
  async function shouldSkipBuild(outDir, isOutdated) {
29116
- return !isOutdated && await fs29.exists(outDir);
29194
+ return !isOutdated && await fs26.exists(outDir);
29117
29195
  }
29118
29196
  async function writeDependenciesCache(root) {
29119
29197
  if (!ctx.configService) {
29120
29198
  throw new Error("configService must be initialized before writing npm cache");
29121
29199
  }
29122
29200
  if (ctx.configService.weappViteConfig?.npm?.cache) {
29123
- await fs29.outputJSON(getDependenciesCacheFilePath(root), {
29201
+ await fs26.outputJSON(getDependenciesCacheFilePath(root), {
29124
29202
  hash: dependenciesCacheHash()
29125
29203
  });
29126
29204
  }
29127
29205
  }
29128
29206
  async function readDependenciesCache(root) {
29129
29207
  const cachePath = getDependenciesCacheFilePath(root);
29130
- if (await fs29.exists(cachePath)) {
29131
- return await fs29.readJson(cachePath, { throws: false });
29208
+ if (await fs26.exists(cachePath)) {
29209
+ return await fs26.readJson(cachePath, { throws: false });
29132
29210
  }
29133
29211
  }
29134
29212
  async function checkDependenciesCacheOutdate(root) {
@@ -29210,7 +29288,7 @@ function createNpmService(ctx) {
29210
29288
  }
29211
29289
  }
29212
29290
  async function copyBuild({ from, to }) {
29213
- await fs29.copy(
29291
+ await fs26.copy(
29214
29292
  from,
29215
29293
  to
29216
29294
  );
@@ -29255,10 +29333,10 @@ function createNpmService(ctx) {
29255
29333
  logger_default.warn(`[npm] \u65E0\u6CD5\u89E3\u6790\u6A21\u5757 \`${dep}\`\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
29256
29334
  return;
29257
29335
  }
29258
- if (!isDependenciesCacheOutdate && await fs29.exists(destOutDir)) {
29336
+ if (!isDependenciesCacheOutdate && await fs26.exists(destOutDir)) {
29259
29337
  const destEntry = path43.resolve(destOutDir, "index.js");
29260
- if (await fs29.exists(destEntry)) {
29261
- const [srcStat, destStat] = await Promise.all([fs29.stat(index), fs29.stat(destEntry)]);
29338
+ if (await fs26.exists(destEntry)) {
29339
+ const [srcStat, destStat] = await Promise.all([fs26.stat(index), fs26.stat(destEntry)]);
29262
29340
  if (srcStat.mtimeMs <= destStat.mtimeMs) {
29263
29341
  logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
29264
29342
  return;
@@ -29313,8 +29391,8 @@ function createNpmService(ctx) {
29313
29391
  const packNpmRelationList = getPackNpmRelationList();
29314
29392
  const [mainRelation, ...subRelations] = packNpmRelationList;
29315
29393
  const packageJsonPath = path43.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
29316
- if (await fs29.exists(packageJsonPath)) {
29317
- const pkgJson = await fs29.readJson(packageJsonPath);
29394
+ if (await fs26.exists(packageJsonPath)) {
29395
+ const pkgJson = await fs26.readJson(packageJsonPath);
29318
29396
  const outDir = path43.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
29319
29397
  if (pkgJson.dependencies) {
29320
29398
  const dependencies = Object.keys(pkgJson.dependencies);
@@ -29349,8 +29427,8 @@ function createNpmService(ctx) {
29349
29427
  await Promise.all(targetDirs.map(async (x) => {
29350
29428
  if (x.root) {
29351
29429
  const isDependenciesCacheOutdate2 = await checkDependenciesCacheOutdate(x.root);
29352
- if (isDependenciesCacheOutdate2 || !await fs29.exists(x.npmDistDir)) {
29353
- await fs29.copy(outDir, x.npmDistDir, {
29430
+ if (isDependenciesCacheOutdate2 || !await fs26.exists(x.npmDistDir)) {
29431
+ await fs26.copy(outDir, x.npmDistDir, {
29354
29432
  overwrite: true,
29355
29433
  filter: (src) => {
29356
29434
  if (Array.isArray(x.dependencies)) {
@@ -29366,7 +29444,7 @@ function createNpmService(ctx) {
29366
29444
  }
29367
29445
  await writeDependenciesCache(x.root);
29368
29446
  } else {
29369
- await fs29.copy(outDir, x.npmDistDir, {
29447
+ await fs26.copy(outDir, x.npmDistDir, {
29370
29448
  overwrite: true,
29371
29449
  filter: (src) => {
29372
29450
  if (Array.isArray(x.dependencies)) {
@@ -30126,7 +30204,7 @@ init_esm_shims();
30126
30204
 
30127
30205
  // src/cache/file.ts
30128
30206
  init_esm_shims();
30129
- import fs30 from "fs-extra";
30207
+ import fs27 from "fs-extra";
30130
30208
  var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
30131
30209
  var FNV_PRIME = 0x100000001B3n;
30132
30210
  var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
@@ -30176,7 +30254,7 @@ var FileCache = class {
30176
30254
  async isInvalidate(id, options) {
30177
30255
  let mtimeMs;
30178
30256
  try {
30179
- const stat5 = await fs30.stat(id);
30257
+ const stat5 = await fs27.stat(id);
30180
30258
  mtimeMs = stat5.mtimeMs;
30181
30259
  } catch (error) {
30182
30260
  if (error && error.code === "ENOENT") {
@@ -30338,7 +30416,7 @@ function createRuntimeState() {
30338
30416
  // src/runtime/scanPlugin.ts
30339
30417
  init_esm_shims();
30340
30418
  import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep9 } from "@weapp-core/shared";
30341
- import fs31 from "fs-extra";
30419
+ import fs28 from "fs-extra";
30342
30420
  import path44 from "pathe";
30343
30421
  var SUPPORTED_SHARED_STYLE_EXTENSIONS = [
30344
30422
  ".wxss",
@@ -30438,9 +30516,6 @@ function toArray(value) {
30438
30516
  }
30439
30517
  return Array.isArray(value) ? value : [value];
30440
30518
  }
30441
- function normalizeRoot2(root) {
30442
- return toPosixPath(root).replace(/^\/+|\/+$/g, "");
30443
- }
30444
30519
  function normalizePattern(pattern, normalizedRoot) {
30445
30520
  const trimmed = pattern.trim();
30446
30521
  if (!trimmed) {
@@ -30568,7 +30643,7 @@ function appendDefaultScopedStyleEntries(root, normalizedRoot, service, dedupe,
30568
30643
  for (const ext2 of DEFAULT_SCOPED_EXTENSIONS) {
30569
30644
  const filename = `${base}${ext2}`;
30570
30645
  const absolutePath = path44.resolve(absoluteSubRoot, filename);
30571
- if (!fs31.existsSync(absolutePath)) {
30646
+ if (!fs28.existsSync(absolutePath)) {
30572
30647
  continue;
30573
30648
  }
30574
30649
  const descriptor = {
@@ -30599,7 +30674,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
30599
30674
  return void 0;
30600
30675
  }
30601
30676
  const list = styles === void 0 ? [] : Array.isArray(styles) ? styles : [styles];
30602
- const normalizedRoot = normalizeRoot2(root);
30677
+ const normalizedRoot = normalizeRoot(root);
30603
30678
  const normalized = [];
30604
30679
  const dedupe = /* @__PURE__ */ new Set();
30605
30680
  for (const entry of list) {
@@ -30613,7 +30688,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
30613
30688
  logger_default.warn(`[subpackages] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u5FFD\u7565\u3002`);
30614
30689
  continue;
30615
30690
  }
30616
- if (!fs31.existsSync(absolutePath)) {
30691
+ if (!fs28.existsSync(absolutePath)) {
30617
30692
  logger_default.warn(`[subpackages] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5BF9\u5E94\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u5DF2\u5FFD\u7565\u3002`);
30618
30693
  continue;
30619
30694
  }
@@ -30657,7 +30732,7 @@ function createScanService(ctx) {
30657
30732
  let configFromVue;
30658
30733
  let vueAppPath;
30659
30734
  if (!appConfigFile) {
30660
- const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-AP6E5UEG.mjs");
30735
+ const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-4WEK4X45.mjs");
30661
30736
  vueAppPath = await findVueEntry(appBasename);
30662
30737
  if (vueAppPath) {
30663
30738
  configFromVue = await extractConfigFromVue2(vueAppPath);
@@ -30978,7 +31053,7 @@ function createWebServicePlugin(ctx) {
30978
31053
  // src/runtime/wxmlPlugin.ts
30979
31054
  init_esm_shims();
30980
31055
  import { removeExtensionDeep as removeExtensionDeep10 } from "@weapp-core/shared";
30981
- import fs32 from "fs-extra";
31056
+ import fs29 from "fs-extra";
30982
31057
  import path45 from "pathe";
30983
31058
 
30984
31059
  // src/wxml/index.ts
@@ -33584,9 +33659,9 @@ function createWxmlService(ctx) {
33584
33659
  if (!ctx.configService) {
33585
33660
  throw new Error("configService must be initialized before scanning wxml");
33586
33661
  }
33587
- if (await fs32.exists(filepath)) {
33662
+ if (await fs29.exists(filepath)) {
33588
33663
  const dirname5 = path45.dirname(filepath);
33589
- const wxml = await fs32.readFile(filepath, "utf8");
33664
+ const wxml = await fs29.readFile(filepath, "utf8");
33590
33665
  const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
33591
33666
  if (!shouldRescan) {
33592
33667
  const cached = cache2.get(filepath);