weapp-vite 6.1.4 → 6.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkPO65WBH3cjs = require('./chunk-PO65WBH3.cjs');
4
- require('./chunk-DNJSS66X.cjs');
5
- require('./chunk-FDYEZH5I.cjs');
3
+ var _chunkT4I3WXLTcjs = require('./chunk-T4I3WXLT.cjs');
4
+ require('./chunk-DDRQJMF6.cjs');
5
+ require('./chunk-NZ2WCJDY.cjs');
6
6
  require('./chunk-HL25C7YQ.cjs');
7
7
  require('./chunk-2CHNKORP.cjs');
8
8
 
@@ -26,7 +26,7 @@ function createGetter(resolver) {
26
26
  get: resolver
27
27
  };
28
28
  }
29
- var ctx = _chunkPO65WBH3cjs.getCompilerContext.call(void 0, );
29
+ var ctx = _chunkT4I3WXLTcjs.getCompilerContext.call(void 0, );
30
30
  var service = ctx.autoRoutesService;
31
31
  var routes = {};
32
32
  Object.defineProperties(routes, {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getCompilerContext
3
- } from "./chunk-ZYMEFZ75.mjs";
4
- import "./chunk-AFJRLGGM.mjs";
5
- import "./chunk-TVEKQD2W.mjs";
3
+ } from "./chunk-M7AMHEBX.mjs";
4
+ import "./chunk-R6MS6UEQ.mjs";
5
+ import "./chunk-DLSOQZGD.mjs";
6
6
  import "./chunk-AZBN7A5I.mjs";
7
7
  import "./chunk-V5RMQ6TF.mjs";
8
8
  import {
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkPO65WBH3cjs = require('./chunk-PO65WBH3.cjs');
5
+ var _chunkT4I3WXLTcjs = require('./chunk-T4I3WXLT.cjs');
6
6
 
7
7
 
8
8
  var _chunkPFE2IVZ3cjs = require('./chunk-PFE2IVZ3.cjs');
@@ -12,10 +12,10 @@ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
12
12
  async function createCompilerContext(options) {
13
13
  const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.key]), () => ( "default"));
14
14
  if (!_optionalChain([options, 'optionalAccess', _2 => _2.key])) {
15
- _chunkPO65WBH3cjs.resetCompilerContext.call(void 0, key);
15
+ _chunkT4I3WXLTcjs.resetCompilerContext.call(void 0, key);
16
16
  }
17
- _chunkPO65WBH3cjs.setActiveCompilerContextKey.call(void 0, key);
18
- const ctx = _chunkPO65WBH3cjs.getCompilerContext.call(void 0, key);
17
+ _chunkT4I3WXLTcjs.setActiveCompilerContextKey.call(void 0, key);
18
+ const ctx = _chunkT4I3WXLTcjs.getCompilerContext.call(void 0, key);
19
19
  const { configService, scanService, autoRoutesService } = ctx;
20
20
  await configService.load(options);
21
21
  if (autoRoutesService) {
@@ -2,7 +2,7 @@ import {
2
2
  getCompilerContext,
3
3
  resetCompilerContext,
4
4
  setActiveCompilerContextKey
5
- } from "./chunk-ZYMEFZ75.mjs";
5
+ } from "./chunk-M7AMHEBX.mjs";
6
6
  import {
7
7
  init_esm_shims
8
8
  } from "./chunk-AOUAT7U3.mjs";
@@ -1,7 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkFDYEZH5Icjs = require('./chunk-FDYEZH5I.cjs');
4
+
5
+
6
+ var _chunkNZ2WCJDYcjs = require('./chunk-NZ2WCJDY.cjs');
5
7
 
6
8
 
7
9
 
@@ -492,7 +494,7 @@ var require_gte = _chunkPFE2IVZ3cjs.__commonJS.call(void 0, {
492
494
 
493
495
  // src/plugins/vue/transform/jsonMacros.ts
494
496
  _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
495
- var import_merge = _chunkPFE2IVZ3cjs.__toESM.call(void 0, _chunkFDYEZH5Icjs.require_src.call(void 0, ), 1);
497
+ var import_merge = _chunkPFE2IVZ3cjs.__toESM.call(void 0, _chunkNZ2WCJDYcjs.require_src.call(void 0, ), 1);
496
498
  var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
497
499
  var _types = require('@babel/types'); var t2 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types);
498
500
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
@@ -596,6 +598,55 @@ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
596
598
  // src/utils/index.ts
597
599
  _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
598
600
 
601
+ // src/utils/cachePolicy.ts
602
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
603
+ var DEV_PATH_EXISTS_TTL_MS = 250;
604
+ var PROD_PATH_EXISTS_TTL_MS = 6e4;
605
+ function getPathExistsTtlMs(config) {
606
+ return _optionalChain([config, 'optionalAccess', _2 => _2.isDev]) ? DEV_PATH_EXISTS_TTL_MS : PROD_PATH_EXISTS_TTL_MS;
607
+ }
608
+ function getReadFileCheckMtime(config) {
609
+ return Boolean(_optionalChain([config, 'optionalAccess', _3 => _3.isDev]));
610
+ }
611
+
612
+ // src/utils/entryResolve.ts
613
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
614
+
615
+
616
+ function buildCandidates(base, extensions) {
617
+ return extensions.map((ext) => _chunkNZ2WCJDYcjs.changeFileExtension.call(void 0, base, ext));
618
+ }
619
+ async function resolveEntryPath(input, options) {
620
+ if (!input || typeof input !== "string") {
621
+ return void 0;
622
+ }
623
+ if (_pathe2.default.extname(input)) {
624
+ return void 0;
625
+ }
626
+ const kind = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _4 => _4.kind]), () => ( "default"));
627
+ const exists = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _5 => _5.exists]), () => ( (async (p) => _fsextra2.default.pathExists(p))));
628
+ const stat = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _6 => _6.stat]), () => ( (async (p) => _fsextra2.default.stat(p))));
629
+ const indexBaseName = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _7 => _7.indexBaseName]), () => ( "index"));
630
+ let base = input;
631
+ let isDir = false;
632
+ try {
633
+ isDir = Boolean(await _asyncOptionalChain([(await stat(input)), 'optionalAccess', async _8 => _8.isDirectory, 'optionalCall', async _9 => _9()]));
634
+ } catch (e) {
635
+ isDir = false;
636
+ }
637
+ if (isDir) {
638
+ base = _pathe2.default.join(input, indexBaseName);
639
+ }
640
+ const jsFirst = kind === "named" || isDir;
641
+ const extensions = jsFirst ? [..._chunkNZ2WCJDYcjs.jsExtensions, ..._chunkNZ2WCJDYcjs.vueExtensions] : [..._chunkNZ2WCJDYcjs.vueExtensions, ..._chunkNZ2WCJDYcjs.jsExtensions];
642
+ for (const candidate of buildCandidates(base, extensions)) {
643
+ if (await exists(candidate)) {
644
+ return candidate;
645
+ }
646
+ }
647
+ return void 0;
648
+ }
649
+
599
650
  // src/utils/json.ts
600
651
  _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
601
652
  var _shared = require('@weapp-core/shared');
@@ -671,7 +722,7 @@ function resolveJson(entry, aliasEntries) {
671
722
  if (Array.isArray(subPackages)) {
672
723
  for (const subPackage of subPackages) {
673
724
  if (subPackage.entry) {
674
- subPackage.entry = _chunkFDYEZH5Icjs.changeFileExtension.call(void 0, subPackage.entry, "js");
725
+ subPackage.entry = _chunkNZ2WCJDYcjs.changeFileExtension.call(void 0, subPackage.entry, "js");
675
726
  }
676
727
  }
677
728
  }
@@ -726,20 +777,20 @@ async function getProjectConfig(root, options) {
726
777
  const privateJsonPath = _pathe2.default.resolve(root, "project.private.config.json");
727
778
  let baseJson = {};
728
779
  let privateJson = {};
729
- if (await _fsextra2.default.exists(baseJsonPath)) {
780
+ if (await _fsextra2.default.pathExists(baseJsonPath)) {
730
781
  try {
731
782
  baseJson = await _fsextra2.default.readJson(baseJsonPath) || {};
732
- } catch (e) {
783
+ } catch (e2) {
733
784
  throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
734
785
  }
735
786
  } else {
736
787
  throw new Error(`\u5728 ${root} \u76EE\u5F55\u4E0B\u627E\u4E0D\u5230 project.config.json`);
737
788
  }
738
- if (!_optionalChain([options, 'optionalAccess', _2 => _2.ignorePrivate])) {
739
- if (await _fsextra2.default.exists(privateJsonPath)) {
789
+ if (!_optionalChain([options, 'optionalAccess', _10 => _10.ignorePrivate])) {
790
+ if (await _fsextra2.default.pathExists(privateJsonPath)) {
740
791
  try {
741
792
  privateJson = await _fsextra2.default.readJson(privateJsonPath) || {};
742
- } catch (e2) {
793
+ } catch (e3) {
743
794
  throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.private.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
744
795
  }
745
796
  }
@@ -747,6 +798,106 @@ async function getProjectConfig(root, options) {
747
798
  return Object.assign({}, privateJson, baseJson);
748
799
  }
749
800
 
801
+ // src/utils/reExport.ts
802
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
803
+ function getExportedName(spec) {
804
+ const exported = _optionalChain([spec, 'optionalAccess', _11 => _11.exported]);
805
+ if (!exported) {
806
+ return void 0;
807
+ }
808
+ if (exported.type === "Identifier") {
809
+ return exported.name;
810
+ }
811
+ if (exported.type === "StringLiteral") {
812
+ return exported.value;
813
+ }
814
+ return void 0;
815
+ }
816
+ function getSourceValue(node) {
817
+ const source = _optionalChain([node, 'optionalAccess', _12 => _12.source]);
818
+ if (!source || source.type !== "StringLiteral") {
819
+ return void 0;
820
+ }
821
+ return source.value;
822
+ }
823
+ async function resolveReExportedInternal(exporterFile, exportName, depth, visited, options) {
824
+ if (depth <= 0) {
825
+ return void 0;
826
+ }
827
+ if (visited.has(exporterFile)) {
828
+ return void 0;
829
+ }
830
+ visited.add(exporterFile);
831
+ let entry = options.cache.get(exporterFile);
832
+ if (!entry) {
833
+ entry = /* @__PURE__ */ new Map();
834
+ options.cache.set(exporterFile, entry);
835
+ }
836
+ if (entry.has(exportName)) {
837
+ return entry.get(exportName);
838
+ }
839
+ let code;
840
+ try {
841
+ code = await options.readFile(exporterFile);
842
+ } catch (e4) {
843
+ entry.set(exportName, void 0);
844
+ return void 0;
845
+ }
846
+ let ast;
847
+ try {
848
+ ast = _parser.parse.call(void 0, code, BABEL_TS_MODULE_PARSER_OPTIONS);
849
+ } catch (e5) {
850
+ entry.set(exportName, void 0);
851
+ return void 0;
852
+ }
853
+ const exportAllSources = [];
854
+ for (const node of _nullishCoalesce(ast.program.body, () => ( []))) {
855
+ if (_optionalChain([node, 'optionalAccess', _13 => _13.type]) === "ExportNamedDeclaration") {
856
+ const source = getSourceValue(node);
857
+ if (!source) {
858
+ continue;
859
+ }
860
+ for (const spec of _nullishCoalesce(node.specifiers, () => ( []))) {
861
+ if (_optionalChain([spec, 'optionalAccess', _14 => _14.type]) !== "ExportSpecifier") {
862
+ continue;
863
+ }
864
+ const exportedName = getExportedName(spec);
865
+ if (!exportedName || exportedName !== exportName) {
866
+ continue;
867
+ }
868
+ const resolved = await options.resolveId(source, exporterFile);
869
+ if (resolved) {
870
+ entry.set(exportName, resolved);
871
+ return resolved;
872
+ }
873
+ }
874
+ }
875
+ if (_optionalChain([node, 'optionalAccess', _15 => _15.type]) === "ExportAllDeclaration") {
876
+ const source = getSourceValue(node);
877
+ if (source) {
878
+ exportAllSources.push(source);
879
+ }
880
+ }
881
+ }
882
+ for (const source of exportAllSources) {
883
+ const hopId = await options.resolveId(source, exporterFile);
884
+ if (!hopId) {
885
+ continue;
886
+ }
887
+ const nested = await resolveReExportedInternal(hopId, exportName, depth - 1, visited, options);
888
+ if (nested) {
889
+ entry.set(exportName, nested);
890
+ return nested;
891
+ }
892
+ }
893
+ entry.set(exportName, void 0);
894
+ return void 0;
895
+ }
896
+ async function resolveReExportedName(exporterFile, exportName, options) {
897
+ const maxDepth = _nullishCoalesce(options.maxDepth, () => ( 4));
898
+ return resolveReExportedInternal(exporterFile, exportName, maxDepth, /* @__PURE__ */ new Set(), options);
899
+ }
900
+
750
901
  // src/utils/regexp.ts
751
902
  _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
752
903
  var CSS_LANGS_RE = /\.(wxss|css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
@@ -762,7 +913,7 @@ function regExpTest(arr, str, options) {
762
913
  }
763
914
  for (const item of arr) {
764
915
  if (typeof item === "string") {
765
- if (_optionalChain([options, 'optionalAccess', _3 => _3.exact])) {
916
+ if (_optionalChain([options, 'optionalAccess', _16 => _16.exact])) {
766
917
  if (str === item) {
767
918
  return true;
768
919
  }
@@ -779,6 +930,100 @@ function regExpTest(arr, str, options) {
779
930
  return false;
780
931
  }
781
932
 
933
+ // src/utils/resolvedId.ts
934
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
935
+
936
+ // src/utils/viteId.ts
937
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
938
+ var _url = require('url');
939
+ var VUE_VIRTUAL_MODULE_PREFIX = "\0vue:";
940
+ function normalizeViteId(id, options) {
941
+ const stripQuery = _optionalChain([options, 'optionalAccess', _17 => _17.stripQuery]) !== false;
942
+ const fileProtocolToPathEnabled = _optionalChain([options, 'optionalAccess', _18 => _18.fileProtocolToPath]) !== false;
943
+ const stripAtFsPrefix = _optionalChain([options, 'optionalAccess', _19 => _19.stripAtFsPrefix]) !== false;
944
+ const stripVueVirtualPrefix = _optionalChain([options, 'optionalAccess', _20 => _20.stripVueVirtualPrefix]) === true;
945
+ const stripLeadingNullByte = _optionalChain([options, 'optionalAccess', _21 => _21.stripLeadingNullByte]) === true;
946
+ let clean = id;
947
+ if (stripVueVirtualPrefix && clean.startsWith(VUE_VIRTUAL_MODULE_PREFIX)) {
948
+ clean = clean.slice(VUE_VIRTUAL_MODULE_PREFIX.length);
949
+ }
950
+ if (stripQuery) {
951
+ clean = clean.split("?", 1)[0];
952
+ }
953
+ if (fileProtocolToPathEnabled && clean.startsWith("file://")) {
954
+ try {
955
+ clean = _url.fileURLToPath.call(void 0, clean);
956
+ } catch (e6) {
957
+ }
958
+ }
959
+ if (stripAtFsPrefix && clean.startsWith("/@fs/")) {
960
+ clean = clean.slice("/@fs".length);
961
+ }
962
+ if (stripLeadingNullByte && clean.startsWith("\0")) {
963
+ clean = clean.slice(1);
964
+ }
965
+ return clean;
966
+ }
967
+
968
+ // src/utils/resolvedId.ts
969
+ function isSkippableResolvedId(id) {
970
+ if (!id) {
971
+ return true;
972
+ }
973
+ return id.startsWith("\0") || id.startsWith("node:");
974
+ }
975
+ function normalizeFsResolvedId(id, options) {
976
+ const normalizeOptions = {
977
+ stripVueVirtualPrefix: true
978
+ };
979
+ if (_optionalChain([options, 'optionalAccess', _22 => _22.normalize])) {
980
+ Object.assign(normalizeOptions, options.normalize);
981
+ }
982
+ if (_optionalChain([options, 'optionalAccess', _23 => _23.stripLeadingNullByte])) {
983
+ normalizeOptions.stripLeadingNullByte = true;
984
+ }
985
+ return normalizeViteId(id, normalizeOptions);
986
+ }
987
+
988
+ // src/utils/toAbsoluteId.ts
989
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
990
+
991
+ function toAbsoluteId(id, configService, importer, options) {
992
+ const cleanId = normalizeFsResolvedId(id);
993
+ if (!cleanId || isSkippableResolvedId(cleanId)) {
994
+ return cleanId;
995
+ }
996
+ if (_pathe2.default.isAbsolute(cleanId)) {
997
+ return cleanId;
998
+ }
999
+ const cleanImporter = importer ? normalizeFsResolvedId(importer) : void 0;
1000
+ if (cleanImporter && !isSkippableResolvedId(cleanImporter) && _pathe2.default.isAbsolute(cleanImporter)) {
1001
+ return _pathe2.default.resolve(_pathe2.default.dirname(cleanImporter), cleanId);
1002
+ }
1003
+ const baseDir = _optionalChain([options, 'optionalAccess', _24 => _24.base]) === "cwd" ? configService.cwd : configService.absoluteSrcRoot;
1004
+ return _pathe2.default.resolve(baseDir, cleanId);
1005
+ }
1006
+
1007
+ // src/utils/usingComponentFrom.ts
1008
+ _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
1009
+
1010
+
1011
+ function usingComponentFromResolvedFile(resolvedFile, configService) {
1012
+ if (!resolvedFile) {
1013
+ return void 0;
1014
+ }
1015
+ const normalized = normalizeFsResolvedId(resolvedFile);
1016
+ if (!normalized || isSkippableResolvedId(normalized) || !_pathe2.default.isAbsolute(normalized)) {
1017
+ return void 0;
1018
+ }
1019
+ const base = _shared.removeExtensionDeep.call(void 0, normalized);
1020
+ const relative = configService.relativeOutputPath(base);
1021
+ if (!relative || relative.startsWith("..")) {
1022
+ return void 0;
1023
+ }
1024
+ return `/${toPosixPath(relative)}`;
1025
+ }
1026
+
782
1027
  // src/utils/version.ts
783
1028
  _chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
784
1029
  var import_gte = _chunkPFE2IVZ3cjs.__toESM.call(void 0, require_gte(), 1);
@@ -791,7 +1036,7 @@ var logger_default = _logger2.default;
791
1036
 
792
1037
  // src/utils/version.ts
793
1038
  function getRuntime() {
794
- if (typeof _process2.default !== "undefined" && _optionalChain([_process2.default, 'access', _4 => _4.versions, 'optionalAccess', _5 => _5.node])) {
1039
+ if (typeof _process2.default !== "undefined" && _optionalChain([_process2.default, 'access', _25 => _25.versions, 'optionalAccess', _26 => _26.node])) {
795
1040
  return {
796
1041
  runtime: "node",
797
1042
  version: _process2.default.version.replace(/^v/, "")
@@ -887,8 +1132,8 @@ function rewriteJsLikeImportsForTempDir(source, fromDir, tempDir) {
887
1132
  return;
888
1133
  }
889
1134
  const next = rewriteRelativeImportSource(originalSource, fromDir, tempDir);
890
- const start = _optionalChain([node, 'optionalAccess', _6 => _6.start]);
891
- const end = _optionalChain([node, 'optionalAccess', _7 => _7.end]);
1135
+ const start = _optionalChain([node, 'optionalAccess', _27 => _27.start]);
1136
+ const end = _optionalChain([node, 'optionalAccess', _28 => _28.end]);
892
1137
  if (typeof start === "number" && typeof end === "number") {
893
1138
  ms.overwrite(start, end, JSON.stringify(next));
894
1139
  mutated = true;
@@ -896,29 +1141,29 @@ function rewriteJsLikeImportsForTempDir(source, fromDir, tempDir) {
896
1141
  };
897
1142
  traverse(ast, {
898
1143
  ImportDeclaration(p) {
899
- const sourceNode = _optionalChain([p, 'access', _8 => _8.node, 'optionalAccess', _9 => _9.source]);
1144
+ const sourceNode = _optionalChain([p, 'access', _29 => _29.node, 'optionalAccess', _30 => _30.source]);
900
1145
  if (sourceNode && t.isStringLiteral(sourceNode)) {
901
1146
  rewriteLiteral(sourceNode, sourceNode.value);
902
1147
  }
903
1148
  },
904
1149
  ExportNamedDeclaration(p) {
905
- const sourceNode = _optionalChain([p, 'access', _10 => _10.node, 'optionalAccess', _11 => _11.source]);
1150
+ const sourceNode = _optionalChain([p, 'access', _31 => _31.node, 'optionalAccess', _32 => _32.source]);
906
1151
  if (sourceNode && t.isStringLiteral(sourceNode)) {
907
1152
  rewriteLiteral(sourceNode, sourceNode.value);
908
1153
  }
909
1154
  },
910
1155
  ExportAllDeclaration(p) {
911
- const sourceNode = _optionalChain([p, 'access', _12 => _12.node, 'optionalAccess', _13 => _13.source]);
1156
+ const sourceNode = _optionalChain([p, 'access', _33 => _33.node, 'optionalAccess', _34 => _34.source]);
912
1157
  if (sourceNode && t.isStringLiteral(sourceNode)) {
913
1158
  rewriteLiteral(sourceNode, sourceNode.value);
914
1159
  }
915
1160
  },
916
1161
  CallExpression(p) {
917
- const callee = _optionalChain([p, 'access', _14 => _14.node, 'optionalAccess', _15 => _15.callee]);
1162
+ const callee = _optionalChain([p, 'access', _35 => _35.node, 'optionalAccess', _36 => _36.callee]);
918
1163
  if (!callee) {
919
1164
  return;
920
1165
  }
921
- const arg0 = _optionalChain([p, 'access', _16 => _16.node, 'optionalAccess', _17 => _17.arguments, 'optionalAccess', _18 => _18[0]]);
1166
+ const arg0 = _optionalChain([p, 'access', _37 => _37.node, 'optionalAccess', _38 => _38.arguments, 'optionalAccess', _39 => _39[0]]);
922
1167
  if (!arg0 || !t.isStringLiteral(arg0)) {
923
1168
  return;
924
1169
  }
@@ -942,7 +1187,7 @@ var _os = require('os'); var _os2 = _interopRequireDefault(_os);
942
1187
 
943
1188
 
944
1189
  function getWevuConfigCacheRoot() {
945
- const env = _optionalChain([_process2.default, 'access', _19 => _19.env, 'access', _20 => _20.WEAPP_VITE_WEVU_CONFIG_DIR, 'optionalAccess', _21 => _21.trim, 'call', _22 => _22()]);
1190
+ const env = _optionalChain([_process2.default, 'access', _40 => _40.env, 'access', _41 => _41.WEAPP_VITE_WEVU_CONFIG_DIR, 'optionalAccess', _42 => _42.trim, 'call', _43 => _43()]);
946
1191
  if (env) {
947
1192
  return _pathe2.default.resolve(env);
948
1193
  }
@@ -1039,9 +1284,9 @@ function declaredNamesInStatement(statement) {
1039
1284
  }
1040
1285
  return out;
1041
1286
  }
1042
- function collectTopLevelReferencedNames(path8) {
1287
+ function collectTopLevelReferencedNames(path11) {
1043
1288
  const names = /* @__PURE__ */ new Set();
1044
- path8.traverse({
1289
+ path11.traverse({
1045
1290
  Identifier(p) {
1046
1291
  if (!p.isReferencedIdentifier()) {
1047
1292
  return;
@@ -1051,7 +1296,7 @@ function collectTopLevelReferencedNames(path8) {
1051
1296
  if (!binding) {
1052
1297
  return;
1053
1298
  }
1054
- if (_optionalChain([binding, 'access', _23 => _23.scope, 'optionalAccess', _24 => _24.block, 'optionalAccess', _25 => _25.type]) === "Program") {
1299
+ if (_optionalChain([binding, 'access', _44 => _44.scope, 'optionalAccess', _45 => _45.block, 'optionalAccess', _46 => _46.type]) === "Program") {
1055
1300
  names.add(name);
1056
1301
  }
1057
1302
  }
@@ -1069,15 +1314,15 @@ async function evaluateScriptSetupJsonMacro(originalContent, filename, lang) {
1069
1314
  let macroName;
1070
1315
  const macroStatements = [];
1071
1316
  traverse(ast, {
1072
- CallExpression(path8) {
1073
- const callee = path8.node.callee;
1317
+ CallExpression(path11) {
1318
+ const callee = path11.node.callee;
1074
1319
  if (!t2.isIdentifier(callee)) {
1075
1320
  return;
1076
1321
  }
1077
1322
  if (!JSON_MACROS.has(callee.name)) {
1078
1323
  return;
1079
1324
  }
1080
- const isTopLevelStatement = _optionalChain([path8, 'access', _26 => _26.parentPath, 'optionalAccess', _27 => _27.isExpressionStatement, 'call', _28 => _28()]) && _optionalChain([path8, 'access', _29 => _29.parentPath, 'access', _30 => _30.parentPath, 'optionalAccess', _31 => _31.isProgram, 'call', _32 => _32()]);
1325
+ const isTopLevelStatement = _optionalChain([path11, 'access', _47 => _47.parentPath, 'optionalAccess', _48 => _48.isExpressionStatement, 'call', _49 => _49()]) && _optionalChain([path11, 'access', _50 => _50.parentPath, 'access', _51 => _51.parentPath, 'optionalAccess', _52 => _52.isProgram, 'call', _53 => _53()]);
1081
1326
  if (!isTopLevelStatement) {
1082
1327
  throw new Error(`${callee.name}() must be used as a top-level statement in <script setup> (${filename})`);
1083
1328
  }
@@ -1085,7 +1330,7 @@ async function evaluateScriptSetupJsonMacro(originalContent, filename, lang) {
1085
1330
  if (macroName !== callee.name) {
1086
1331
  throw new Error(`Only one of ${Array.from(JSON_MACROS).join(", ")} can be used in a single <script setup> (${filename})`);
1087
1332
  }
1088
- macroStatements.push(path8.parentPath);
1333
+ macroStatements.push(path11.parentPath);
1089
1334
  }
1090
1335
  });
1091
1336
  if (!macroStatements.length) {
@@ -1093,9 +1338,9 @@ async function evaluateScriptSetupJsonMacro(originalContent, filename, lang) {
1093
1338
  }
1094
1339
  let programPath;
1095
1340
  traverse(ast, {
1096
- Program(path8) {
1097
- programPath = path8;
1098
- path8.stop();
1341
+ Program(path11) {
1342
+ programPath = path11;
1343
+ path11.stop();
1099
1344
  }
1100
1345
  });
1101
1346
  if (!programPath) {
@@ -1163,7 +1408,7 @@ async function evaluateScriptSetupJsonMacro(originalContent, filename, lang) {
1163
1408
  for (const statementPath of macroStatements) {
1164
1409
  const callPath = statementPath.get("expression");
1165
1410
  const calleePath = callPath.get("callee");
1166
- if (_optionalChain([calleePath, 'optionalAccess', _33 => _33.isIdentifier, 'call', _34 => _34()]) && typeof calleePath.node.start === "number" && typeof calleePath.node.end === "number") {
1411
+ if (_optionalChain([calleePath, 'optionalAccess', _54 => _54.isIdentifier, 'call', _55 => _55()]) && typeof calleePath.node.start === "number" && typeof calleePath.node.end === "number") {
1167
1412
  ms.overwrite(calleePath.node.start, calleePath.node.end, alias);
1168
1413
  }
1169
1414
  }
@@ -1199,7 +1444,7 @@ export default __weapp_json_macro_values
1199
1444
  filepath: tempFile,
1200
1445
  cwd: dir
1201
1446
  });
1202
- const resolved = _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _35 => _35.default]), () => ( mod));
1447
+ const resolved = _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _56 => _56.default]), () => ( mod));
1203
1448
  const values = Array.isArray(resolved) ? resolved : [resolved];
1204
1449
  const accumulator = {};
1205
1450
  for (const raw of values) {
@@ -1228,14 +1473,14 @@ export default __weapp_json_macro_values
1228
1473
  } finally {
1229
1474
  try {
1230
1475
  await _fsextra2.default.remove(tempFile);
1231
- } catch (e3) {
1476
+ } catch (e7) {
1232
1477
  }
1233
1478
  try {
1234
1479
  const remains = await _fsextra2.default.readdir(tempDir);
1235
1480
  if (remains.length === 0) {
1236
1481
  await _fsextra2.default.remove(tempDir);
1237
1482
  }
1238
- } catch (e4) {
1483
+ } catch (e8) {
1239
1484
  }
1240
1485
  }
1241
1486
  });
@@ -1252,15 +1497,15 @@ async function extractJsonMacroFromScriptSetup(content, filename, lang) {
1252
1497
  const macroNames = /* @__PURE__ */ new Set();
1253
1498
  const macroStatementSources = [];
1254
1499
  traverse(ast, {
1255
- CallExpression(path8) {
1256
- const callee = path8.node.callee;
1500
+ CallExpression(path11) {
1501
+ const callee = path11.node.callee;
1257
1502
  if (!t2.isIdentifier(callee)) {
1258
1503
  return;
1259
1504
  }
1260
1505
  if (!JSON_MACROS.has(callee.name)) {
1261
1506
  return;
1262
1507
  }
1263
- const isTopLevelStatement = _optionalChain([path8, 'access', _36 => _36.parentPath, 'optionalAccess', _37 => _37.isExpressionStatement, 'call', _38 => _38()]) && _optionalChain([path8, 'access', _39 => _39.parentPath, 'access', _40 => _40.parentPath, 'optionalAccess', _41 => _41.isProgram, 'call', _42 => _42()]);
1508
+ const isTopLevelStatement = _optionalChain([path11, 'access', _57 => _57.parentPath, 'optionalAccess', _58 => _58.isExpressionStatement, 'call', _59 => _59()]) && _optionalChain([path11, 'access', _60 => _60.parentPath, 'access', _61 => _61.parentPath, 'optionalAccess', _62 => _62.isProgram, 'call', _63 => _63()]);
1264
1509
  if (!isTopLevelStatement) {
1265
1510
  throw new Error(`${callee.name}() must be used as a top-level statement in <script setup> (${filename})`);
1266
1511
  }
@@ -1270,7 +1515,7 @@ async function extractJsonMacroFromScriptSetup(content, filename, lang) {
1270
1515
  if (macroNames.size > 1) {
1271
1516
  throw new Error(`Only one of ${Array.from(JSON_MACROS).join(", ")} can be used in a single <script setup> (${filename})`);
1272
1517
  }
1273
- const body = _nullishCoalesce(_optionalChain([ast, 'access', _43 => _43.program, 'optionalAccess', _44 => _44.body]), () => ( []));
1518
+ const body = _nullishCoalesce(_optionalChain([ast, 'access', _64 => _64.program, 'optionalAccess', _65 => _65.body]), () => ( []));
1274
1519
  for (const statement of body) {
1275
1520
  if (!t2.isExpressionStatement(statement)) {
1276
1521
  continue;
@@ -1311,16 +1556,16 @@ function stripJsonMacroCallsFromCode(code, filename) {
1311
1556
  }
1312
1557
  const ms = new (0, _magicstring2.default)(code);
1313
1558
  traverse(ast, {
1314
- ExpressionStatement(path8) {
1315
- const expr = path8.node.expression;
1559
+ ExpressionStatement(path11) {
1560
+ const expr = path11.node.expression;
1316
1561
  if (!t2.isCallExpression(expr) || !t2.isIdentifier(expr.callee)) {
1317
1562
  return;
1318
1563
  }
1319
1564
  if (!JSON_MACROS.has(expr.callee.name)) {
1320
1565
  return;
1321
1566
  }
1322
- const start = path8.node.start;
1323
- const end = path8.node.end;
1567
+ const start = path11.node.start;
1568
+ const end = path11.node.end;
1324
1569
  if (typeof start === "number" && typeof end === "number") {
1325
1570
  ms.remove(start, end);
1326
1571
  }
@@ -1358,4 +1603,12 @@ function stripJsonMacroCallsFromCode(code, filename) {
1358
1603
 
1359
1604
 
1360
1605
 
1361
- exports.logger_default = logger_default; exports.parse = _parser.parse; exports.BABEL_TS_MODULE_PARSER_OPTIONS = BABEL_TS_MODULE_PARSER_OPTIONS; exports.traverse = traverse; exports.generate = generate; exports.getVisitorKeys = getVisitorKeys; exports.parseJsLike = parseJsLike; exports.withTempDirLock = withTempDirLock; exports.rewriteJsLikeImportsForTempDir = rewriteJsLikeImportsForTempDir; exports.resolveWevuConfigTempDir = resolveWevuConfigTempDir; exports.extractJsonMacroFromScriptSetup = extractJsonMacroFromScriptSetup; exports.stripJsonMacroCallsFromCode = stripJsonMacroCallsFromCode; exports.parseCommentJson = parseCommentJson; exports.jsonFileRemoveJsExtension = jsonFileRemoveJsExtension; exports.matches = matches; exports.getAliasEntries = getAliasEntries; exports.resolveJson = resolveJson; exports.toPosixPath = toPosixPath; exports.fromPosixPath = fromPosixPath; exports.stripLeadingSlashes = stripLeadingSlashes; exports.normalizeRoot = normalizeRoot; exports.isPathInside = isPathInside; exports.getProjectConfig = getProjectConfig; exports.isCSSRequest = isCSSRequest; exports.isRegexp = isRegexp; exports.regExpTest = regExpTest; exports.checkRuntime = checkRuntime; exports.resolveWeappConfigFile = resolveWeappConfigFile;
1606
+
1607
+
1608
+
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+ exports.logger_default = logger_default; exports.parse = _parser.parse; exports.BABEL_TS_MODULE_PARSER_OPTIONS = BABEL_TS_MODULE_PARSER_OPTIONS; exports.traverse = traverse; exports.generate = generate; exports.getVisitorKeys = getVisitorKeys; exports.parseJsLike = parseJsLike; exports.getPathExistsTtlMs = getPathExistsTtlMs; exports.getReadFileCheckMtime = getReadFileCheckMtime; exports.withTempDirLock = withTempDirLock; exports.rewriteJsLikeImportsForTempDir = rewriteJsLikeImportsForTempDir; exports.resolveWevuConfigTempDir = resolveWevuConfigTempDir; exports.extractJsonMacroFromScriptSetup = extractJsonMacroFromScriptSetup; exports.stripJsonMacroCallsFromCode = stripJsonMacroCallsFromCode; exports.resolveEntryPath = resolveEntryPath; exports.parseCommentJson = parseCommentJson; exports.jsonFileRemoveJsExtension = jsonFileRemoveJsExtension; exports.matches = matches; exports.getAliasEntries = getAliasEntries; exports.resolveJson = resolveJson; exports.toPosixPath = toPosixPath; exports.fromPosixPath = fromPosixPath; exports.stripLeadingSlashes = stripLeadingSlashes; exports.normalizeRoot = normalizeRoot; exports.isPathInside = isPathInside; exports.getProjectConfig = getProjectConfig; exports.resolveReExportedName = resolveReExportedName; exports.isCSSRequest = isCSSRequest; exports.isRegexp = isRegexp; exports.regExpTest = regExpTest; exports.isSkippableResolvedId = isSkippableResolvedId; exports.normalizeFsResolvedId = normalizeFsResolvedId; exports.toAbsoluteId = toAbsoluteId; exports.usingComponentFromResolvedFile = usingComponentFromResolvedFile; exports.checkRuntime = checkRuntime; exports.resolveWeappConfigFile = resolveWeappConfigFile;