weapp-vite 5.6.1 → 5.6.2

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.
@@ -4483,6 +4483,7 @@ function createAutoRoutesServicePlugin(ctx) {
4483
4483
 
4484
4484
  // src/runtime/buildPlugin.ts
4485
4485
  init_esm_shims();
4486
+ import fs7 from "fs";
4486
4487
  import process3 from "process";
4487
4488
 
4488
4489
  // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
@@ -9536,8 +9537,8 @@ var PathScurryBase = class {
9536
9537
  *
9537
9538
  * @internal
9538
9539
  */
9539
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs25 = defaultFS } = {}) {
9540
- this.#fs = fsFromOption(fs25);
9540
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs26 = defaultFS } = {}) {
9541
+ this.#fs = fsFromOption(fs26);
9541
9542
  if (cwd instanceof URL || cwd.startsWith("file://")) {
9542
9543
  cwd = fileURLToPath(cwd);
9543
9544
  }
@@ -10095,8 +10096,8 @@ var PathScurryWin32 = class extends PathScurryBase {
10095
10096
  /**
10096
10097
  * @internal
10097
10098
  */
10098
- newRoot(fs25) {
10099
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs25 });
10099
+ newRoot(fs26) {
10100
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs26 });
10100
10101
  }
10101
10102
  /**
10102
10103
  * Return true if the provided path string is an absolute path
@@ -10124,8 +10125,8 @@ var PathScurryPosix = class extends PathScurryBase {
10124
10125
  /**
10125
10126
  * @internal
10126
10127
  */
10127
- newRoot(fs25) {
10128
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs25 });
10128
+ newRoot(fs26) {
10129
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs26 });
10129
10130
  }
10130
10131
  /**
10131
10132
  * Return true if the provided path string is an absolute path
@@ -12537,11 +12538,45 @@ function createBuildService(ctx) {
12537
12538
  ignoreInitial: true
12538
12539
  }
12539
12540
  );
12541
+ const logWorkerEvent = (type, target, level = "info") => {
12542
+ if (!target) {
12543
+ return;
12544
+ }
12545
+ const relative3 = configService.relativeCwd(target);
12546
+ const message = `[workers:${type}] ${relative3}`;
12547
+ if (level === "success") {
12548
+ logger_default.success(message);
12549
+ } else {
12550
+ logger_default.info(message);
12551
+ }
12552
+ };
12540
12553
  watcher2.on("all", (event, id) => {
12554
+ if (!id) {
12555
+ return;
12556
+ }
12541
12557
  if (event === "add") {
12542
- logger_default.success(`[workers:${event}] ${configService.relativeCwd(id)}`);
12558
+ logWorkerEvent(event, id, "success");
12543
12559
  void devWorkers(workersDir);
12560
+ return;
12544
12561
  }
12562
+ logWorkerEvent(event, id);
12563
+ });
12564
+ watcher2.on("raw", (eventName, rawPath, details) => {
12565
+ if (eventName !== "rename") {
12566
+ return;
12567
+ }
12568
+ const candidate = typeof rawPath === "string" ? rawPath : rawPath && typeof rawPath.toString === "function" ? rawPath.toString() : "";
12569
+ if (!candidate) {
12570
+ return;
12571
+ }
12572
+ const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absWorkerRoot : absWorkerRoot;
12573
+ const resolved = path11.isAbsolute(candidate) ? candidate : path11.resolve(baseDir, candidate);
12574
+ const exists = fs7.existsSync(resolved);
12575
+ if (exists) {
12576
+ logWorkerEvent("rename->add", resolved);
12577
+ return;
12578
+ }
12579
+ logWorkerEvent("rename->unlink", resolved);
12545
12580
  });
12546
12581
  watcherService.sidecarWatcherMap.set(absWorkerRoot, {
12547
12582
  close: () => watcher2.close()
@@ -12660,7 +12695,7 @@ import { defu as defu5 } from "@weapp-core/shared";
12660
12695
 
12661
12696
  // ../../node_modules/.pnpm/local-pkg@1.1.2/node_modules/local-pkg/dist/index.mjs
12662
12697
  init_esm_shims();
12663
- import fs8 from "fs";
12698
+ import fs9 from "fs";
12664
12699
  import { createRequire as createRequire2 } from "module";
12665
12700
  import path13, { dirname as dirname4, join as join3, win32 as win322 } from "path";
12666
12701
  import process4 from "process";
@@ -18282,7 +18317,7 @@ Parser.acorn = {
18282
18317
 
18283
18318
  // ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
18284
18319
  import { builtinModules, createRequire } from "module";
18285
- import fs7, { realpathSync as realpathSync2, statSync as statSync2, promises as promises2 } from "fs";
18320
+ import fs8, { realpathSync as realpathSync2, statSync as statSync2, promises as promises2 } from "fs";
18286
18321
 
18287
18322
  // ../../node_modules/.pnpm/ufo@1.6.1/node_modules/ufo/dist/index.mjs
18288
18323
  init_esm_shims();
@@ -18686,7 +18721,7 @@ function read(jsonPath, { base, specifier }) {
18686
18721
  }
18687
18722
  let string;
18688
18723
  try {
18689
- string = fs7.readFileSync(path12.toNamespacedPath(jsonPath), "utf8");
18724
+ string = fs8.readFileSync(path12.toNamespacedPath(jsonPath), "utf8");
18690
18725
  } catch (error) {
18691
18726
  const exception = (
18692
18727
  /** @type {ErrnoException} */
@@ -19821,7 +19856,7 @@ function findUpSync(name, {
19821
19856
  while (directory) {
19822
19857
  const filePath = isAbsoluteName ? name : path13.join(directory, name);
19823
19858
  try {
19824
- const stats = fs8.statSync(filePath, { throwIfNoEntry: false });
19859
+ const stats = fs9.statSync(filePath, { throwIfNoEntry: false });
19825
19860
  if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
19826
19861
  return filePath;
19827
19862
  }
@@ -19867,8 +19902,8 @@ function getPackageJsonPath(name, options = {}) {
19867
19902
  return searchPackageJSON(entry);
19868
19903
  }
19869
19904
  var readFile = quansync2({
19870
- async: (id) => fs8.promises.readFile(id, "utf8"),
19871
- sync: (id) => fs8.readFileSync(id, "utf8")
19905
+ async: (id) => fs9.promises.readFile(id, "utf8"),
19906
+ sync: (id) => fs9.readFileSync(id, "utf8")
19872
19907
  });
19873
19908
  var getPackageInfo = quansync2(function* (name, options = {}) {
19874
19909
  const packageJsonPath = getPackageJsonPath(name, options);
@@ -19907,7 +19942,7 @@ function searchPackageJSON(dir) {
19907
19942
  return;
19908
19943
  dir = newDir;
19909
19944
  packageJsonPath = join3(dir, "package.json");
19910
- if (fs8.existsSync(packageJsonPath))
19945
+ if (fs9.existsSync(packageJsonPath))
19911
19946
  break;
19912
19947
  }
19913
19948
  return packageJsonPath;
@@ -19918,7 +19953,7 @@ var findUp = quansync2({
19918
19953
  });
19919
19954
  var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
19920
19955
  const path36 = yield findUp("package.json", { cwd });
19921
- if (!path36 || !fs8.existsSync(path36))
19956
+ if (!path36 || !fs9.existsSync(path36))
19922
19957
  return null;
19923
19958
  return JSON.parse(yield readFile(path36));
19924
19959
  });
@@ -19931,7 +19966,7 @@ var isPackageListedSync = isPackageListed.sync;
19931
19966
 
19932
19967
  // ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
19933
19968
  init_esm_shims();
19934
- import fs9 from "fs/promises";
19969
+ import fs10 from "fs/promises";
19935
19970
  import path14 from "path";
19936
19971
  import process5 from "process";
19937
19972
 
@@ -19975,7 +20010,7 @@ var INSTALL_METADATA = {
19975
20010
  // ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
19976
20011
  async function pathExists(path210, type) {
19977
20012
  try {
19978
- const stat6 = await fs9.stat(path210);
20013
+ const stat6 = await fs10.stat(path210);
19979
20014
  return type === "file" ? stat6.isFile() : stat6.isDirectory();
19980
20015
  } catch {
19981
20016
  return false;
@@ -20062,7 +20097,7 @@ function getNameAndVer(pkg) {
20062
20097
  }
20063
20098
  async function handlePackageManager(filepath, onUnknown) {
20064
20099
  try {
20065
- const pkg = JSON.parse(await fs9.readFile(filepath, "utf8"));
20100
+ const pkg = JSON.parse(await fs10.readFile(filepath, "utf8"));
20066
20101
  let agent;
20067
20102
  const nameAndVer = getNameAndVer(pkg);
20068
20103
  if (nameAndVer) {
@@ -20096,7 +20131,7 @@ import path32 from "pathe";
20096
20131
 
20097
20132
  // src/runtime/oxcRuntime.ts
20098
20133
  init_esm_shims();
20099
- import fs10 from "fs-extra";
20134
+ import fs11 from "fs-extra";
20100
20135
  import path15 from "pathe";
20101
20136
  var NULL_BYTE = "\0";
20102
20137
  var OXC_RUNTIME_HELPER_ALIAS = new RegExp(`^(?:${NULL_BYTE})?@oxc-project(?:/|\\+)runtime(?:@[^/]+)?/helpers/(.+)\\.js$`);
@@ -20206,9 +20241,9 @@ function createOxcRuntimeSupport() {
20206
20241
  const helperName = getOxcHelperName(id);
20207
20242
  if (helperName) {
20208
20243
  const helperPath = id.startsWith(NULL_BYTE) ? path15.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
20209
- if (await fs10.pathExists(helperPath)) {
20210
- console.warn("[weapp-vite] resolving oxc helper via Rolldown plugin:", helperName);
20211
- return fs10.readFile(helperPath, "utf8");
20244
+ if (await fs11.pathExists(helperPath)) {
20245
+ logger_default.warn(`[weapp-vite] resolving oxc helper via Rolldown plugin: ${helperName}`);
20246
+ return fs11.readFile(helperPath, "utf8");
20212
20247
  }
20213
20248
  const fallback = fallbackHelpers[helperName];
20214
20249
  if (fallback) {
@@ -20226,7 +20261,7 @@ function createOxcRuntimeSupport() {
20226
20261
  return null;
20227
20262
  }
20228
20263
  if (source.includes("@oxc-project/runtime/helpers")) {
20229
- console.warn("[weapp-vite] resolveId intercepted:", source);
20264
+ logger_default.warn(`[weapp-vite] resolveId intercepted: ${source}`);
20230
20265
  }
20231
20266
  const helperName = getOxcHelperName(source);
20232
20267
  if (helperName) {
@@ -20243,8 +20278,8 @@ function createOxcRuntimeSupport() {
20243
20278
  return null;
20244
20279
  }
20245
20280
  const helperPath = path15.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20246
- console.warn("[weapp-vite] resolving oxc helper via Vite plugin:", helperName);
20247
- return fs10.readFile(helperPath, "utf8");
20281
+ logger_default.warn(`[weapp-vite] resolving oxc helper via Vite plugin: ${helperName}`);
20282
+ return fs11.readFile(helperPath, "utf8");
20248
20283
  }
20249
20284
  };
20250
20285
  return {
@@ -20337,7 +20372,7 @@ function createAliasManager(oxcAlias, builtinAliases) {
20337
20372
  // src/runtime/config/internal/loadConfig.ts
20338
20373
  init_esm_shims();
20339
20374
  import { defu } from "@weapp-core/shared";
20340
- import fs11 from "fs-extra";
20375
+ import fs12 from "fs-extra";
20341
20376
  import path18 from "pathe";
20342
20377
  import { loadConfigFromFile } from "vite";
20343
20378
  import tsconfigPaths from "vite-tsconfig-paths";
@@ -20646,8 +20681,8 @@ function createLoadConfig(options) {
20646
20681
  }
20647
20682
  const packageJsonPath = path18.resolve(cwd, "package.json");
20648
20683
  let packageJson = {};
20649
- if (await fs11.exists(packageJsonPath)) {
20650
- const content = await fs11.readJson(packageJsonPath, {
20684
+ if (await fs12.exists(packageJsonPath)) {
20685
+ const content = await fs12.readJson(packageJsonPath, {
20651
20686
  throws: false
20652
20687
  }) || {};
20653
20688
  packageJson = content;
@@ -20834,42 +20869,10 @@ import { wrapPlugin } from "vite-plugin-performance";
20834
20869
  // src/plugins/asset.ts
20835
20870
  init_esm_shims();
20836
20871
  import { fdir as Fdir2 } from "fdir";
20837
- import fs12 from "fs-extra";
20872
+ import fs13 from "fs-extra";
20838
20873
  import path19 from "pathe";
20839
- function asset(ctx) {
20840
- const state = { ctx };
20841
- return [createAssetCollector(state)];
20842
- }
20843
- function createAssetCollector(state) {
20844
- const { ctx } = state;
20845
- const { configService } = ctx;
20846
- return {
20847
- name: "weapp-vite:asset",
20848
- enforce: "pre",
20849
- configResolved(config) {
20850
- state.resolvedConfig = config;
20851
- },
20852
- buildStart() {
20853
- if (!state.resolvedConfig) {
20854
- state.pendingAssets = Promise.resolve([]);
20855
- return;
20856
- }
20857
- state.pendingAssets = scanAssetFiles(configService, state.resolvedConfig);
20858
- },
20859
- async buildEnd() {
20860
- const assets = await state.pendingAssets;
20861
- if (!assets?.length) {
20862
- return;
20863
- }
20864
- for (const candidate of assets) {
20865
- this.emitFile({
20866
- type: "asset",
20867
- fileName: configService.relativeAbsoluteSrcRoot(candidate.file),
20868
- source: candidate.buffer
20869
- });
20870
- }
20871
- }
20872
- };
20874
+ function normalizeCopyGlobs(globs) {
20875
+ return Array.isArray(globs) ? globs : [];
20873
20876
  }
20874
20877
  function scanAssetFiles(configService, config) {
20875
20878
  const weappViteConfig = configService.weappViteConfig;
@@ -20909,14 +20912,46 @@ function scanAssetFiles(configService, config) {
20909
20912
  Array.from(files).filter(filter3).map(async (file) => {
20910
20913
  return {
20911
20914
  file,
20912
- buffer: await fs12.readFile(file)
20915
+ buffer: await fs13.readFile(file)
20913
20916
  };
20914
20917
  })
20915
20918
  );
20916
20919
  });
20917
20920
  }
20918
- function normalizeCopyGlobs(globs) {
20919
- return Array.isArray(globs) ? globs : [];
20921
+ function createAssetCollector(state) {
20922
+ const { ctx } = state;
20923
+ const { configService } = ctx;
20924
+ return {
20925
+ name: "weapp-vite:asset",
20926
+ enforce: "pre",
20927
+ configResolved(config) {
20928
+ state.resolvedConfig = config;
20929
+ },
20930
+ buildStart() {
20931
+ if (!state.resolvedConfig) {
20932
+ state.pendingAssets = Promise.resolve([]);
20933
+ return;
20934
+ }
20935
+ state.pendingAssets = scanAssetFiles(configService, state.resolvedConfig);
20936
+ },
20937
+ async buildEnd() {
20938
+ const assets = await state.pendingAssets;
20939
+ if (!assets?.length) {
20940
+ return;
20941
+ }
20942
+ for (const candidate of assets) {
20943
+ this.emitFile({
20944
+ type: "asset",
20945
+ fileName: configService.relativeAbsoluteSrcRoot(candidate.file),
20946
+ source: candidate.buffer
20947
+ });
20948
+ }
20949
+ }
20950
+ };
20951
+ }
20952
+ function asset(ctx) {
20953
+ const state = { ctx };
20954
+ return [createAssetCollector(state)];
20920
20955
  }
20921
20956
 
20922
20957
  // src/plugins/autoImport.ts
@@ -21125,13 +21160,13 @@ function autoRoutes(ctx) {
21125
21160
  // src/plugins/core.ts
21126
21161
  init_esm_shims();
21127
21162
  import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
21128
- import fs16 from "fs-extra";
21163
+ import fs17 from "fs-extra";
21129
21164
  import path26 from "pathe";
21130
21165
 
21131
21166
  // src/plugins/css/shared/preprocessor.ts
21132
21167
  init_esm_shims();
21133
21168
  import { createHash } from "crypto";
21134
- import fs13 from "fs-extra";
21169
+ import fs14 from "fs-extra";
21135
21170
  import path21 from "pathe";
21136
21171
  import { preprocessCSS } from "vite";
21137
21172
 
@@ -21301,7 +21336,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
21301
21336
  const cacheKey = `${absolutePath}:${resolvedConfig ? "resolved" : "raw"}`;
21302
21337
  let stats;
21303
21338
  try {
21304
- stats = await fs13.stat(absolutePath);
21339
+ stats = await fs14.stat(absolutePath);
21305
21340
  } catch (error) {
21306
21341
  const reason = error instanceof Error ? error.message : String(error);
21307
21342
  throw new Error(`[subpackages] \u7F16\u8BD1\u5171\u4EAB\u6837\u5F0F \`${entry.source}\` \u5931\u8D25\uFF1A${reason}`);
@@ -21314,7 +21349,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
21314
21349
  };
21315
21350
  }
21316
21351
  try {
21317
- const css2 = await fs13.readFile(absolutePath, "utf8");
21352
+ const css2 = await fs14.readFile(absolutePath, "utf8");
21318
21353
  if (!resolvedConfig) {
21319
21354
  const result2 = {
21320
21355
  css: css2,
@@ -21461,7 +21496,7 @@ function createJsonEmitManager(configService) {
21461
21496
  init_esm_shims();
21462
21497
  import { performance as performance3 } from "perf_hooks";
21463
21498
  import { removeExtensionDeep as removeExtensionDeep3 } from "@weapp-core/shared";
21464
- import fs14 from "fs-extra";
21499
+ import fs15 from "fs-extra";
21465
21500
 
21466
21501
  // ../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
21467
21502
  init_esm_shims();
@@ -22627,7 +22662,7 @@ async function addWatchTarget(pluginCtx, target, existsCache) {
22627
22662
  pluginCtx.addWatchFile(target);
22628
22663
  return cached;
22629
22664
  }
22630
- const exists = await fs14.exists(target);
22665
+ const exists = await fs15.exists(target);
22631
22666
  pluginCtx.addWatchFile(target);
22632
22667
  existsCache.set(target, exists);
22633
22668
  return exists;
@@ -22819,7 +22854,7 @@ function createEntryLoader(options) {
22819
22854
  type: "plugin"
22820
22855
  });
22821
22856
  }
22822
- const code = await fs14.readFile(id, "utf8");
22857
+ const code = await fs15.readFile(id, "utf8");
22823
22858
  const styleImports = await collectStyleImports(this, id, existsCache);
22824
22859
  debug4?.(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
22825
22860
  if (styleImports.length === 0) {
@@ -22842,22 +22877,6 @@ function createEntryLoader(options) {
22842
22877
  init_esm_shims();
22843
22878
  import { isObject as isObject5 } from "@weapp-core/shared";
22844
22879
  import path24 from "pathe";
22845
- function createEntryNormalizer(configService) {
22846
- return function normalizeEntry(entry, jsonPath) {
22847
- if (/plugin:\/\//.test(entry)) {
22848
- return entry;
22849
- }
22850
- const tokens = entry.split("/");
22851
- if (tokens[0] && isObject5(configService.packageJson.dependencies) && hasDependencyPrefix(configService.packageJson.dependencies, tokens)) {
22852
- return `npm:${entry}`;
22853
- }
22854
- if (tokens[0] === "") {
22855
- return entry.substring(1);
22856
- }
22857
- const normalized = resolveImportee2(entry, jsonPath, configService);
22858
- return configService.relativeAbsoluteSrcRoot(normalized);
22859
- };
22860
- }
22861
22880
  function resolveImportee2(importee, jsonPath, configService) {
22862
22881
  let updated = importee;
22863
22882
  if (jsonPath && Array.isArray(configService.aliasEntries)) {
@@ -22880,6 +22899,22 @@ function hasDependencyPrefix(dependencies, tokens) {
22880
22899
  return true;
22881
22900
  });
22882
22901
  }
22902
+ function createEntryNormalizer(configService) {
22903
+ return function normalizeEntry(entry, jsonPath) {
22904
+ if (/plugin:\/\//.test(entry)) {
22905
+ return entry;
22906
+ }
22907
+ const tokens = entry.split("/");
22908
+ if (tokens[0] && isObject5(configService.packageJson.dependencies) && hasDependencyPrefix(configService.packageJson.dependencies, tokens)) {
22909
+ return `npm:${entry}`;
22910
+ }
22911
+ if (tokens[0] === "") {
22912
+ return entry.substring(1);
22913
+ }
22914
+ const normalized = resolveImportee2(entry, jsonPath, configService);
22915
+ return configService.relativeAbsoluteSrcRoot(normalized);
22916
+ };
22917
+ }
22883
22918
 
22884
22919
  // src/plugins/hooks/useLoadEntry/template.ts
22885
22920
  init_esm_shims();
@@ -22956,15 +22991,19 @@ function collectRequireTokens(ast) {
22956
22991
 
22957
22992
  // src/plugins/utils/invalidateEntry.ts
22958
22993
  init_esm_shims();
22959
- import fs15 from "fs";
22994
+ import fs16 from "fs";
22960
22995
  import process6 from "process";
22961
22996
  import path25 from "pathe";
22962
22997
  var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
22998
+ var watchedTemplateExts = new Set(templateExtensions.map((ext2) => `.${ext2}`));
22963
22999
  var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
22964
- var sidecarSuffixes = [...configSuffixes, ...watchedCssExts];
23000
+ var sidecarSuffixes = [...configSuffixes, ...watchedCssExts, ...watchedTemplateExts];
22965
23001
  var watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
22966
23002
  var importProtocols = /^(?:https?:|data:|blob:|\/)/i;
22967
- var cssImportRE = /@(import|wv-keep-import)\s+(?:url\()?['"]?([^'")\s]+)['"]?\)?/gi;
23003
+ var cssImportRE = /@(?:import|wv-keep-import)\s+(?:url\()?['"]?([^'")\s]+)['"]?\)?/gi;
23004
+ function isSidecarFile(filePath) {
23005
+ return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
23006
+ }
22968
23007
  function isWatchLimitError(error) {
22969
23008
  if (!error || typeof error !== "object") {
22970
23009
  return false;
@@ -23038,7 +23077,7 @@ function registerCssImports(ctx, importer, dependencies) {
23038
23077
  }
23039
23078
  async function extractCssImportDependencies(ctx, importer) {
23040
23079
  try {
23041
- const stats = await fs15.promises.stat(importer);
23080
+ const stats = await fs16.promises.stat(importer);
23042
23081
  if (!stats.isFile()) {
23043
23082
  cleanupImporterGraph(ctx, importer);
23044
23083
  return;
@@ -23049,7 +23088,7 @@ async function extractCssImportDependencies(ctx, importer) {
23049
23088
  }
23050
23089
  let cssContent;
23051
23090
  try {
23052
- cssContent = await fs15.promises.readFile(importer, "utf8");
23091
+ cssContent = await fs16.promises.readFile(importer, "utf8");
23053
23092
  } catch {
23054
23093
  cleanupImporterGraph(ctx, importer);
23055
23094
  return;
@@ -23062,7 +23101,7 @@ async function extractCssImportDependencies(ctx, importer) {
23062
23101
  if (!match2) {
23063
23102
  break;
23064
23103
  }
23065
- const rawSpecifier = match2[2]?.trim();
23104
+ const rawSpecifier = match2[1]?.trim();
23066
23105
  if (!rawSpecifier) {
23067
23106
  continue;
23068
23107
  }
@@ -23172,6 +23211,8 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
23172
23211
  scriptBasePath = filePath.slice(0, -configSuffix.length);
23173
23212
  } else if (ext2 && watchedCssExts.has(ext2)) {
23174
23213
  scriptBasePath = filePath.slice(0, -ext2.length);
23214
+ } else if (ext2 && watchedTemplateExts.has(ext2)) {
23215
+ scriptBasePath = filePath.slice(0, -ext2.length);
23175
23216
  }
23176
23217
  if (!scriptBasePath) {
23177
23218
  return;
@@ -23192,6 +23233,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
23192
23233
  }
23193
23234
  }
23194
23235
  const isCssSidecar = Boolean(ext2 && watchedCssExts.has(ext2));
23236
+ const isTemplateSidecar = Boolean(ext2 && watchedTemplateExts.has(ext2));
23195
23237
  const configService = ctx.configService;
23196
23238
  const relativeSource = configService.relativeCwd(normalizedPath);
23197
23239
  for (const target of touchedTargets) {
@@ -23207,7 +23249,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
23207
23249
  }
23208
23250
  }
23209
23251
  if (!touchedTargets.size && !touchedScripts.size) {
23210
- if (event === "create" && isCssSidecar) {
23252
+ if (event === "create" && (isCssSidecar || isTemplateSidecar)) {
23211
23253
  logger_default.info(`[sidecar:${event}] ${relativeSource} \u65B0\u589E\uFF0C\u4F46\u672A\u627E\u5230\u5F15\u7528\u65B9\uFF0C\u7B49\u5F85\u540E\u7EED\u5173\u8054`);
23212
23254
  }
23213
23255
  return;
@@ -23228,7 +23270,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
23228
23270
  }
23229
23271
  const { sidecarWatcherMap } = ctx.runtimeState.watcher;
23230
23272
  const absRoot = path25.normalize(rootDir);
23231
- if (!fs15.existsSync(absRoot)) {
23273
+ if (!fs16.existsSync(absRoot)) {
23232
23274
  return;
23233
23275
  }
23234
23276
  if (sidecarWatcherMap.has(absRoot)) {
@@ -23244,23 +23286,25 @@ function ensureSidecarWatcher(ctx, rootDir) {
23244
23286
  if (isCssFile && (event === "create" || event === "update")) {
23245
23287
  void extractCssImportDependencies(ctx, filePath);
23246
23288
  }
23247
- const shouldInvalidate = event === "create" && ready || event === "delete";
23289
+ const isDeleteEvent = event === "delete";
23290
+ const shouldInvalidate = event === "create" && ready || isDeleteEvent;
23248
23291
  if (shouldInvalidate) {
23249
23292
  void (async () => {
23250
23293
  await invalidateEntryForSidecar(ctx, filePath, event);
23251
- if (isCssFile && event === "delete") {
23294
+ if (isCssFile && isDeleteEvent) {
23252
23295
  cleanupImporterGraph(ctx, filePath);
23253
23296
  }
23254
23297
  })();
23255
23298
  return;
23256
23299
  }
23257
- if (isCssFile && event === "delete") {
23300
+ if (isCssFile && isDeleteEvent) {
23258
23301
  cleanupImporterGraph(ctx, filePath);
23259
23302
  }
23260
23303
  };
23261
23304
  const patterns = [
23262
23305
  ...configExtensions.map((ext2) => path25.join(absRoot, `**/*.${ext2}`)),
23263
- ...supportedCssLangs.map((ext2) => path25.join(absRoot, `**/*.${ext2}`))
23306
+ ...supportedCssLangs.map((ext2) => path25.join(absRoot, `**/*.${ext2}`)),
23307
+ ...templateExtensions.map((ext2) => path25.join(absRoot, `**/*.${ext2}`))
23264
23308
  ];
23265
23309
  const watcher = esm_default.watch(patterns, {
23266
23310
  ignoreInitial: false,
@@ -23270,11 +23314,15 @@ function ensureSidecarWatcher(ctx, rootDir) {
23270
23314
  pollInterval: 20
23271
23315
  }
23272
23316
  });
23273
- const forwardChange = (event, input) => {
23317
+ const forwardChange = (event, input, options) => {
23274
23318
  if (!input) {
23275
23319
  return;
23276
23320
  }
23277
- handleSidecarChange(event, path25.normalize(input), isReady);
23321
+ const normalizedPath = path25.normalize(input);
23322
+ if (!options?.silent) {
23323
+ logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
23324
+ }
23325
+ handleSidecarChange(event, normalizedPath, isReady);
23278
23326
  };
23279
23327
  watcher.on("add", (path36) => forwardChange("create", path36));
23280
23328
  watcher.on("change", (path36) => forwardChange("update", path36));
@@ -23289,7 +23337,11 @@ function ensureSidecarWatcher(ctx, rootDir) {
23289
23337
  }
23290
23338
  const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absRoot : absRoot;
23291
23339
  const resolved = path25.isAbsolute(candidate) ? candidate : path25.resolve(baseDir, candidate);
23292
- forwardChange("create", resolved);
23340
+ const exists = fs16.existsSync(resolved);
23341
+ const derivedEvent = exists ? "create" : "delete";
23342
+ const relativeResolved = ctx.configService.relativeCwd(resolved);
23343
+ logger_default.info(`[watch:rename->${derivedEvent}] ${relativeResolved}`);
23344
+ forwardChange(derivedEvent, resolved, { silent: true });
23293
23345
  });
23294
23346
  watcher.on("ready", () => {
23295
23347
  isReady = true;
@@ -23306,9 +23358,6 @@ function ensureSidecarWatcher(ctx, rootDir) {
23306
23358
  close: () => void watcher.close()
23307
23359
  });
23308
23360
  }
23309
- function isSidecarFile(filePath) {
23310
- return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
23311
- }
23312
23361
 
23313
23362
  // src/plugins/utils/parse.ts
23314
23363
  init_esm_shims();
@@ -23748,8 +23797,8 @@ function createCoreLifecyclePlugin(state) {
23748
23797
  if (parsed.query.wxss) {
23749
23798
  const realPath = getCssRealPath(parsed);
23750
23799
  this.addWatchFile(realPath);
23751
- if (await fs16.exists(realPath)) {
23752
- const css2 = await fs16.readFile(realPath, "utf8");
23800
+ if (await fs17.exists(realPath)) {
23801
+ const css2 = await fs17.readFile(realPath, "utf8");
23753
23802
  return { code: css2 };
23754
23803
  }
23755
23804
  }
@@ -23956,7 +24005,7 @@ async function flushIndependentBuilds(state) {
23956
24005
 
23957
24006
  // src/plugins/css.ts
23958
24007
  init_esm_shims();
23959
- import fs17 from "fs-extra";
24008
+ import fs18 from "fs-extra";
23960
24009
  import path28 from "pathe";
23961
24010
 
23962
24011
  // src/plugins/css/shared/sharedStyles.ts
@@ -24174,7 +24223,7 @@ async function handleBundleEntry(bundle, bundleKey, asset2, configService, share
24174
24223
  }
24175
24224
  if (fileName && fileName !== bundleKey) {
24176
24225
  delete bundle[bundleKey];
24177
- const css2 = await fs17.readFile(absOriginal, "utf8");
24226
+ const css2 = await fs18.readFile(absOriginal, "utf8");
24178
24227
  this.emitFile({
24179
24228
  type: "asset",
24180
24229
  fileName,
@@ -24235,7 +24284,7 @@ async function emitSharedStyleEntries(sharedStyles, emitted, configService, bund
24235
24284
  if (typeof this.addWatchFile === "function") {
24236
24285
  this.addWatchFile(absolutePath);
24237
24286
  }
24238
- if (!await fs17.pathExists(absolutePath)) {
24287
+ if (!await fs18.pathExists(absolutePath)) {
24239
24288
  continue;
24240
24289
  }
24241
24290
  const { css: renderedCss, dependencies } = await renderSharedStyleEntry(entry, configService, resolvedConfig);
@@ -24338,9 +24387,6 @@ init_esm_shims();
24338
24387
  import { isObject as isObject7 } from "@weapp-core/shared";
24339
24388
  var debug3 = createDebugger("weapp-vite:preflight");
24340
24389
  var removePlugins = ["vite:build-import-analysis"];
24341
- function preflight(ctx) {
24342
- return [createPluginPruner(), createEnvSynchronizer(ctx)];
24343
- }
24344
24390
  function createPluginPruner() {
24345
24391
  return {
24346
24392
  name: "weapp-vite:preflight",
@@ -24373,18 +24419,35 @@ function createEnvSynchronizer({ configService }) {
24373
24419
  }
24374
24420
  };
24375
24421
  }
24422
+ function preflight(ctx) {
24423
+ return [createPluginPruner(), createEnvSynchronizer(ctx)];
24424
+ }
24376
24425
 
24377
24426
  // src/plugins/workers.ts
24378
24427
  init_esm_shims();
24379
24428
  import { createHash as createHash2 } from "crypto";
24380
24429
  import { removeExtension as removeExtension2 } from "@weapp-core/shared";
24381
- import fs18 from "fs-extra";
24430
+ import fs19 from "fs-extra";
24382
24431
  import path29 from "pathe";
24383
- function workers(ctx) {
24384
- if (!ctx.scanService.workersDir) {
24385
- return [];
24432
+ async function resolveWorkerEntry(ctx, entry) {
24433
+ const { configService, scanService } = ctx;
24434
+ const relativeEntryPath = path29.join(scanService.workersDir, entry);
24435
+ const key = removeExtension2(relativeEntryPath);
24436
+ const absoluteEntry = path29.resolve(configService.absoluteSrcRoot, relativeEntryPath);
24437
+ if (isJsOrTs(entry)) {
24438
+ const exists = await fs19.exists(absoluteEntry);
24439
+ if (!exists) {
24440
+ logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
24441
+ return { key };
24442
+ }
24443
+ return { key, value: absoluteEntry };
24386
24444
  }
24387
- return [createWorkerBuildPlugin(ctx)];
24445
+ const { path: discovered } = await findJsEntry(absoluteEntry);
24446
+ if (!discovered) {
24447
+ logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
24448
+ return { key };
24449
+ }
24450
+ return { key, value: discovered };
24388
24451
  }
24389
24452
  function createWorkerBuildPlugin(ctx) {
24390
24453
  const { configService, scanService } = ctx;
@@ -24417,86 +24480,26 @@ function createWorkerBuildPlugin(ctx) {
24417
24480
  }
24418
24481
  };
24419
24482
  }
24420
- async function resolveWorkerEntry(ctx, entry) {
24421
- const { configService, scanService } = ctx;
24422
- const relativeEntryPath = path29.join(scanService.workersDir, entry);
24423
- const key = removeExtension2(relativeEntryPath);
24424
- const absoluteEntry = path29.resolve(configService.absoluteSrcRoot, relativeEntryPath);
24425
- if (isJsOrTs(entry)) {
24426
- const exists = await fs18.exists(absoluteEntry);
24427
- if (!exists) {
24428
- logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
24429
- return { key };
24430
- }
24431
- return { key, value: absoluteEntry };
24432
- }
24433
- const { path: discovered } = await findJsEntry(absoluteEntry);
24434
- if (!discovered) {
24435
- logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
24436
- return { key };
24483
+ function workers(ctx) {
24484
+ if (!ctx.scanService.workersDir) {
24485
+ return [];
24437
24486
  }
24438
- return { key, value: discovered };
24487
+ return [createWorkerBuildPlugin(ctx)];
24439
24488
  }
24440
24489
 
24441
24490
  // src/plugins/wxs.ts
24442
24491
  init_esm_shims();
24443
24492
  import { removeExtension as removeExtension3 } from "@weapp-core/shared";
24444
- import fs19 from "fs-extra";
24493
+ import fs20 from "fs-extra";
24445
24494
  import path30 from "pathe";
24446
24495
  var wxsCodeCache = new LRUCache({
24447
24496
  max: 512
24448
24497
  });
24449
- function wxs(ctx) {
24450
- const state = {
24451
- ctx,
24452
- wxsMap: /* @__PURE__ */ new Map()
24453
- };
24454
- return [createWxsPlugin(state)];
24455
- }
24456
- function createWxsPlugin(state) {
24457
- const { ctx } = state;
24458
- const { wxmlService } = ctx;
24459
- return {
24460
- name: "weapp-vite:wxs",
24461
- enforce: "pre",
24462
- buildStart() {
24463
- state.wxsMap.clear();
24464
- },
24465
- async buildEnd() {
24466
- await Promise.all(
24467
- Array.from(wxmlService.tokenMap.entries()).map(([id, token]) => {
24468
- return handleWxsDeps.call(
24469
- // @ts-ignore rolldown context
24470
- this,
24471
- state,
24472
- token.deps,
24473
- id
24474
- );
24475
- })
24476
- );
24477
- for (const { emittedFile } of state.wxsMap.values()) {
24478
- this.emitFile(emittedFile);
24479
- }
24480
- }
24481
- };
24482
- }
24483
- async function handleWxsDeps(state, deps, absPath) {
24484
- await Promise.all(
24485
- deps.filter((dep) => dep.tagName === "wxs").map(async (dep) => {
24486
- const arr = dep.value.match(/\.wxs(\.[jt]s)?$/);
24487
- if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
24488
- return;
24489
- }
24490
- const wxsPath = path30.resolve(path30.dirname(absPath), dep.value);
24491
- await transformWxsFile.call(this, state, wxsPath);
24492
- })
24493
- );
24494
- }
24495
24498
  async function transformWxsFile(state, wxsPath) {
24496
24499
  const { ctx } = state;
24497
24500
  const { configService } = ctx;
24498
24501
  this.addWatchFile(wxsPath);
24499
- if (!await fs19.exists(wxsPath)) {
24502
+ if (!await fs20.exists(wxsPath)) {
24500
24503
  return;
24501
24504
  }
24502
24505
  const suffixMatch = wxsPath.match(/\.wxs(\.[jt]s)?$/);
@@ -24504,7 +24507,7 @@ async function transformWxsFile(state, wxsPath) {
24504
24507
  if (suffixMatch) {
24505
24508
  isRaw = !suffixMatch[1];
24506
24509
  }
24507
- const rawCode = await fs19.readFile(wxsPath, "utf8");
24510
+ const rawCode = await fs20.readFile(wxsPath, "utf8");
24508
24511
  let code = wxsCodeCache.get(rawCode);
24509
24512
  if (code === void 0) {
24510
24513
  const { result, importees } = transformWxsCode(rawCode, {
@@ -24538,6 +24541,52 @@ async function transformWxsFile(state, wxsPath) {
24538
24541
  });
24539
24542
  wxsCodeCache.set(rawCode, code);
24540
24543
  }
24544
+ async function handleWxsDeps(state, deps, absPath) {
24545
+ await Promise.all(
24546
+ deps.filter((dep) => dep.tagName === "wxs").map(async (dep) => {
24547
+ const arr = dep.value.match(/\.wxs(\.[jt]s)?$/);
24548
+ if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
24549
+ return;
24550
+ }
24551
+ const wxsPath = path30.resolve(path30.dirname(absPath), dep.value);
24552
+ await transformWxsFile.call(this, state, wxsPath);
24553
+ })
24554
+ );
24555
+ }
24556
+ function createWxsPlugin(state) {
24557
+ const { ctx } = state;
24558
+ const { wxmlService } = ctx;
24559
+ return {
24560
+ name: "weapp-vite:wxs",
24561
+ enforce: "pre",
24562
+ buildStart() {
24563
+ state.wxsMap.clear();
24564
+ },
24565
+ async buildEnd() {
24566
+ await Promise.all(
24567
+ Array.from(wxmlService.tokenMap.entries()).map(([id, token]) => {
24568
+ return handleWxsDeps.call(
24569
+ // @ts-ignore rolldown context
24570
+ this,
24571
+ state,
24572
+ token.deps,
24573
+ id
24574
+ );
24575
+ })
24576
+ );
24577
+ for (const { emittedFile } of state.wxsMap.values()) {
24578
+ this.emitFile(emittedFile);
24579
+ }
24580
+ }
24581
+ };
24582
+ }
24583
+ function wxs(ctx) {
24584
+ const state = {
24585
+ ctx,
24586
+ wxsMap: /* @__PURE__ */ new Map()
24587
+ };
24588
+ return [createWxsPlugin(state)];
24589
+ }
24541
24590
 
24542
24591
  // src/plugins/index.ts
24543
24592
  var RUNTIME_PLUGINS_SYMBOL = Symbol.for("weapp-runtime:plugins");
@@ -25010,7 +25059,7 @@ init_esm_shims();
25010
25059
  import { createRequire as createRequire3 } from "module";
25011
25060
  import process8 from "process";
25012
25061
  import { parse as parseJson2 } from "comment-json";
25013
- import fs20 from "fs-extra";
25062
+ import fs21 from "fs-extra";
25014
25063
  import { bundleRequire } from "rolldown-require";
25015
25064
  function parseCommentJson(json) {
25016
25065
  return parseJson2(json, void 0, true);
@@ -25075,7 +25124,7 @@ function createJsonService(ctx) {
25075
25124
  });
25076
25125
  resultJson = typeof mod.default === "function" ? await mod.default(ctx) : mod.default;
25077
25126
  } else {
25078
- resultJson = parseCommentJson(await fs20.readFile(filepath, "utf8"));
25127
+ resultJson = parseCommentJson(await fs21.readFile(filepath, "utf8"));
25079
25128
  }
25080
25129
  cache2.set(filepath, resultJson);
25081
25130
  return resultJson;
@@ -25108,7 +25157,7 @@ function createJsonServicePlugin(ctx) {
25108
25157
  init_esm_shims();
25109
25158
  import { isBuiltin } from "module";
25110
25159
  import { defu as defu6, isObject as isObject8, objectHash } from "@weapp-core/shared";
25111
- import fs21 from "fs-extra";
25160
+ import fs22 from "fs-extra";
25112
25161
  import path33 from "pathe";
25113
25162
  import { build as tsdownBuild } from "tsdown";
25114
25163
  function createNpmService(ctx) {
@@ -25130,22 +25179,22 @@ function createNpmService(ctx) {
25130
25179
  return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
25131
25180
  }
25132
25181
  async function shouldSkipBuild(outDir, isOutdated) {
25133
- return !isOutdated && await fs21.exists(outDir);
25182
+ return !isOutdated && await fs22.exists(outDir);
25134
25183
  }
25135
25184
  async function writeDependenciesCache(root) {
25136
25185
  if (!ctx.configService) {
25137
25186
  throw new Error("configService must be initialized before writing npm cache");
25138
25187
  }
25139
25188
  if (ctx.configService.weappViteConfig?.npm?.cache) {
25140
- await fs21.outputJSON(getDependenciesCacheFilePath(root), {
25189
+ await fs22.outputJSON(getDependenciesCacheFilePath(root), {
25141
25190
  hash: dependenciesCacheHash()
25142
25191
  });
25143
25192
  }
25144
25193
  }
25145
25194
  async function readDependenciesCache(root) {
25146
25195
  const cachePath = getDependenciesCacheFilePath(root);
25147
- if (await fs21.exists(cachePath)) {
25148
- return await fs21.readJson(cachePath, { throws: false });
25196
+ if (await fs22.exists(cachePath)) {
25197
+ return await fs22.readJson(cachePath, { throws: false });
25149
25198
  }
25150
25199
  }
25151
25200
  async function checkDependenciesCacheOutdate(root) {
@@ -25209,7 +25258,7 @@ function createNpmService(ctx) {
25209
25258
  }
25210
25259
  }
25211
25260
  async function copyBuild({ from, to }) {
25212
- await fs21.copy(
25261
+ await fs22.copy(
25213
25262
  from,
25214
25263
  to
25215
25264
  );
@@ -25302,8 +25351,8 @@ function createNpmService(ctx) {
25302
25351
  const packNpmRelationList = getPackNpmRelationList();
25303
25352
  const [mainRelation, ...subRelations] = packNpmRelationList;
25304
25353
  const packageJsonPath = path33.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
25305
- if (await fs21.exists(packageJsonPath)) {
25306
- const pkgJson = await fs21.readJson(packageJsonPath);
25354
+ if (await fs22.exists(packageJsonPath)) {
25355
+ const pkgJson = await fs22.readJson(packageJsonPath);
25307
25356
  const outDir = path33.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
25308
25357
  if (pkgJson.dependencies) {
25309
25358
  const dependencies = Object.keys(pkgJson.dependencies);
@@ -25338,8 +25387,8 @@ function createNpmService(ctx) {
25338
25387
  await Promise.all(targetDirs.map(async (x) => {
25339
25388
  if (x.root) {
25340
25389
  const isDependenciesCacheOutdate2 = await checkDependenciesCacheOutdate(x.root);
25341
- if (isDependenciesCacheOutdate2 || !await fs21.exists(x.npmDistDir)) {
25342
- await fs21.copy(outDir, x.npmDistDir, {
25390
+ if (isDependenciesCacheOutdate2 || !await fs22.exists(x.npmDistDir)) {
25391
+ await fs22.copy(outDir, x.npmDistDir, {
25343
25392
  overwrite: true,
25344
25393
  filter: (src) => {
25345
25394
  if (Array.isArray(x.dependencies)) {
@@ -25355,7 +25404,7 @@ function createNpmService(ctx) {
25355
25404
  }
25356
25405
  await writeDependenciesCache(x.root);
25357
25406
  } else {
25358
- await fs21.copy(outDir, x.npmDistDir, {
25407
+ await fs22.copy(outDir, x.npmDistDir, {
25359
25408
  overwrite: true,
25360
25409
  filter: (src) => {
25361
25410
  if (Array.isArray(x.dependencies)) {
@@ -26112,7 +26161,7 @@ init_esm_shims();
26112
26161
 
26113
26162
  // src/cache/file.ts
26114
26163
  init_esm_shims();
26115
- import fs22 from "fs-extra";
26164
+ import fs23 from "fs-extra";
26116
26165
  var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
26117
26166
  var FNV_PRIME = 0x100000001B3n;
26118
26167
  var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
@@ -26162,7 +26211,7 @@ var FileCache = class {
26162
26211
  async isInvalidate(id, options) {
26163
26212
  let mtimeMs;
26164
26213
  try {
26165
- const stat6 = await fs22.stat(id);
26214
+ const stat6 = await fs23.stat(id);
26166
26215
  mtimeMs = stat6.mtimeMs;
26167
26216
  } catch (error) {
26168
26217
  if (error && error.code === "ENOENT") {
@@ -26324,7 +26373,7 @@ function createRuntimeState() {
26324
26373
  // src/runtime/scanPlugin.ts
26325
26374
  init_esm_shims();
26326
26375
  import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
26327
- import fs23 from "fs-extra";
26376
+ import fs24 from "fs-extra";
26328
26377
  import path34 from "pathe";
26329
26378
  var SUPPORTED_SHARED_STYLE_EXTENSIONS = [
26330
26379
  ".wxss",
@@ -26562,7 +26611,7 @@ function appendDefaultScopedStyleEntries(root, normalizedRoot, service, dedupe,
26562
26611
  for (const ext2 of DEFAULT_SCOPED_EXTENSIONS) {
26563
26612
  const filename = `${base}${ext2}`;
26564
26613
  const absolutePath = path34.resolve(absoluteSubRoot, filename);
26565
- if (!fs23.existsSync(absolutePath)) {
26614
+ if (!fs24.existsSync(absolutePath)) {
26566
26615
  continue;
26567
26616
  }
26568
26617
  const descriptor = {
@@ -26607,7 +26656,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
26607
26656
  logger_default.warn(`[subpackages] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u5FFD\u7565\u3002`);
26608
26657
  continue;
26609
26658
  }
26610
- if (!fs23.existsSync(absolutePath)) {
26659
+ if (!fs24.existsSync(absolutePath)) {
26611
26660
  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`);
26612
26661
  continue;
26613
26662
  }
@@ -26953,7 +27002,7 @@ function createWebServicePlugin(ctx) {
26953
27002
  // src/runtime/wxmlPlugin.ts
26954
27003
  init_esm_shims();
26955
27004
  import { removeExtensionDeep as removeExtensionDeep7 } from "@weapp-core/shared";
26956
- import fs24 from "fs-extra";
27005
+ import fs25 from "fs-extra";
26957
27006
  import path35 from "pathe";
26958
27007
 
26959
27008
  // src/wxml/index.ts
@@ -29661,9 +29710,9 @@ function createWxmlService(ctx) {
29661
29710
  if (!ctx.configService) {
29662
29711
  throw new Error("configService must be initialized before scanning wxml");
29663
29712
  }
29664
- if (await fs24.exists(filepath)) {
29713
+ if (await fs25.exists(filepath)) {
29665
29714
  const dirname5 = path35.dirname(filepath);
29666
- const wxml = await fs24.readFile(filepath, "utf8");
29715
+ const wxml = await fs25.readFile(filepath, "utf8");
29667
29716
  const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
29668
29717
  if (!shouldRescan) {
29669
29718
  const cached = cache2.get(filepath);