weapp-vite 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/auto-import-components/resolvers.cjs +5 -5
  2. package/dist/auto-import-components/resolvers.d.cts +2 -2
  3. package/dist/auto-import-components/resolvers.d.ts +2 -2
  4. package/dist/auto-import-components/resolvers.mjs +1 -1
  5. package/dist/auto-routes.cjs +8 -8
  6. package/dist/auto-routes.mjs +4 -4
  7. package/dist/{chunk-T4MUKDMP.mjs → chunk-2JQYFUSO.mjs} +5185 -3829
  8. package/dist/{chunk-OWCDSB6F.cjs → chunk-2Q7K5AR4.cjs} +6 -6
  9. package/dist/{chunk-DVVMF6ND.cjs → chunk-ACNTFTT2.cjs} +2 -2
  10. package/dist/{chunk-7MAZ2JUY.mjs → chunk-C5ZVOPAJ.mjs} +10 -3
  11. package/dist/{chunk-HVMR6H5Z.mjs → chunk-DG5WTO5V.mjs} +1 -1
  12. package/dist/chunk-EKHZHEQK.cjs +6 -0
  13. package/dist/{chunk-NANSUN4W.mjs → chunk-JMKI52G2.mjs} +1 -1
  14. package/dist/{chunk-FUOZYLBR.mjs → chunk-JXSGMLN2.mjs} +1 -1
  15. package/dist/{chunk-QCLEMTCV.mjs → chunk-K2MHCVVB.mjs} +2 -2
  16. package/dist/{chunk-5GG5TEGR.cjs → chunk-KE6RSOKX.cjs} +5414 -4058
  17. package/dist/{chunk-OS76JPG2.cjs → chunk-WWFEREWV.cjs} +11 -4
  18. package/dist/{chunk-BT7FLFCC.cjs → chunk-ZIRGPJR5.cjs} +2 -2
  19. package/dist/cli.cjs +40 -40
  20. package/dist/cli.mjs +3 -3
  21. package/dist/{config-DepC4j8j.d.ts → config-BaoM7pt1.d.ts} +99 -7
  22. package/dist/{config-CzCzK7Jh.d.cts → config-D7WbfUyN.d.cts} +99 -7
  23. package/dist/config.cjs +4 -4
  24. package/dist/config.d.cts +4 -4
  25. package/dist/config.d.ts +4 -4
  26. package/dist/config.mjs +3 -3
  27. package/dist/index.cjs +8 -8
  28. package/dist/index.d.cts +5 -5
  29. package/dist/index.d.ts +5 -5
  30. package/dist/index.mjs +6 -6
  31. package/dist/json.cjs +3 -3
  32. package/dist/json.d.cts +5 -5
  33. package/dist/json.d.ts +5 -5
  34. package/dist/json.mjs +2 -2
  35. package/dist/{types-g_G_na7r.d.ts → types-3q1Qq6Fe.d.cts} +1 -1
  36. package/dist/{types-g_G_na7r.d.cts → types-3q1Qq6Fe.d.ts} +1 -1
  37. package/dist/types.cjs +11 -8
  38. package/dist/types.d.cts +13 -2
  39. package/dist/types.d.ts +13 -2
  40. package/dist/types.mjs +5 -2
  41. package/dist/volar.cjs +2 -2
  42. package/dist/volar.mjs +1 -1
  43. package/package.json +12 -12
  44. package/dist/chunk-U5ERJUOU.cjs +0 -6
@@ -4,10 +4,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
7
13
  var __esm = (fn, res) => function __init() {
8
14
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
15
  };
10
- var __commonJS = (cb, mod) => function __require() {
16
+ var __commonJS = (cb, mod) => function __require2() {
11
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
18
  };
13
19
  var __copyProps = (to, from, except, desc) => {
@@ -27,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
33
  mod
28
34
  ));
29
35
 
30
- // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.19_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.21_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
31
37
  var getImportMetaUrl, importMetaUrl;
32
38
  var init_cjs_shims = __esm({
33
- "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.19_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.21_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
34
40
  "use strict";
35
41
  getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
36
42
  importMetaUrl = exports.importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -42,4 +48,5 @@ var init_cjs_shims = __esm({
42
48
 
43
49
 
44
50
 
45
- exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.importMetaUrl = importMetaUrl; exports.init_cjs_shims = init_cjs_shims;
51
+
52
+ exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.importMetaUrl = importMetaUrl; exports.init_cjs_shims = init_cjs_shims;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
3
+ var _chunkWWFEREWVcjs = require('./chunk-WWFEREWV.cjs');
4
4
 
5
5
  // src/json.ts
6
- _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
6
+ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
7
7
  var defineAppJson = (config) => {
8
8
  return config;
9
9
  };
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict"; 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; }
2
2
 
3
- var _chunkOWCDSB6Fcjs = require('./chunk-OWCDSB6F.cjs');
3
+ var _chunk2Q7K5AR4cjs = require('./chunk-2Q7K5AR4.cjs');
4
4
 
5
5
 
6
6
 
@@ -9,19 +9,19 @@ var _chunkOWCDSB6Fcjs = require('./chunk-OWCDSB6F.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunk5GG5TEGRcjs = require('./chunk-5GG5TEGR.cjs');
12
+ var _chunkKE6RSOKXcjs = require('./chunk-KE6RSOKX.cjs');
13
13
 
14
14
 
15
- var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
15
+ var _chunkWWFEREWVcjs = require('./chunk-WWFEREWV.cjs');
16
16
 
17
17
  // src/cli.ts
18
- _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
18
+ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
19
19
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
20
20
  var _init = require('@weapp-core/init');
21
21
  var _shared = require('@weapp-core/shared');
22
22
 
23
23
  // ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
24
- _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
24
+ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
25
25
  var _events = require('events');
26
26
  function toArr(any) {
27
27
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -607,7 +607,7 @@ var CAC = class extends _events.EventEmitter {
607
607
  var cac = (name = "") => new CAC(name);
608
608
 
609
609
  // ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/commands.mjs
610
- _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
610
+ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
611
611
  function dashDashArg(agent, agentCommand) {
612
612
  return (args) => {
613
613
  if (args.length > 1) {
@@ -746,7 +746,7 @@ var _vite = require('vite');
746
746
  var _weappidecli = require('weapp-ide-cli');
747
747
 
748
748
  // src/schematics.ts
749
- _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
749
+ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
750
750
 
751
751
  var _schematics = require('@weapp-core/schematics');
752
752
 
@@ -817,7 +817,7 @@ async function generate(options) {
817
817
  for (const { code, fileName: fileName2 } of files) {
818
818
  if (code !== void 0) {
819
819
  await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
820
- _chunk5GG5TEGRcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
820
+ _chunkKE6RSOKXcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
821
821
  }
822
822
  }
823
823
  }
@@ -855,7 +855,7 @@ async function readTemplateFile(templatePath, context) {
855
855
  // src/cli.ts
856
856
  var cli = cac("weapp-vite");
857
857
  try {
858
- _chunk5GG5TEGRcjs.checkRuntime.call(void 0, {
858
+ _chunkKE6RSOKXcjs.checkRuntime.call(void 0, {
859
859
  bun: "0.0.0",
860
860
  deno: "0.0.0",
861
861
  node: "20.19.0"
@@ -873,7 +873,7 @@ async function loadConfig(configFile) {
873
873
  mode: "development"
874
874
  };
875
875
  const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
876
- const weappConfigFilePath = await _chunk5GG5TEGRcjs.resolveWeappConfigFile.call(void 0, {
876
+ const weappConfigFilePath = await _chunkKE6RSOKXcjs.resolveWeappConfigFile.call(void 0, {
877
877
  root: cwd,
878
878
  specified: resolvedConfigFile
879
879
  });
@@ -921,15 +921,15 @@ function logBuildAppFinish(configService, webServer, options = {}) {
921
921
  const urls = webServer.resolvedUrls;
922
922
  const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
923
923
  if (candidates.length > 0) {
924
- _chunk5GG5TEGRcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
924
+ _chunkKE6RSOKXcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
925
925
  for (const url of candidates) {
926
- _chunk5GG5TEGRcjs.logger_default.info(` \u279C ${url}`);
926
+ _chunkKE6RSOKXcjs.logger_default.info(` \u279C ${url}`);
927
927
  }
928
928
  } else {
929
- _chunk5GG5TEGRcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
929
+ _chunkKE6RSOKXcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
930
930
  }
931
931
  } else {
932
- _chunk5GG5TEGRcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
932
+ _chunkKE6RSOKXcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
933
933
  }
934
934
  logBuildAppFinishOnlyShowOnce = true;
935
935
  return;
@@ -943,19 +943,19 @@ function logBuildAppFinish(configService, webServer, options = {}) {
943
943
  args: ["run", "open"]
944
944
  }));
945
945
  const devCommand = `${command} ${args.join(" ")}`;
946
- _chunk5GG5TEGRcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
947
- _chunk5GG5TEGRcjs.logger_default.info(`\u6267\u884C \`${devCommand}\` \u53EF\u4EE5\u76F4\u63A5\u5728 \`\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
948
- _chunk5GG5TEGRcjs.logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
946
+ _chunkKE6RSOKXcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
947
+ _chunkKE6RSOKXcjs.logger_default.info(`\u6267\u884C \`${devCommand}\` \u53EF\u4EE5\u76F4\u63A5\u5728 \`\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
948
+ _chunkKE6RSOKXcjs.logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
949
949
  if (!skipWeb && webServer) {
950
950
  const urls = webServer.resolvedUrls;
951
951
  const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
952
952
  if (candidates.length > 0) {
953
- _chunk5GG5TEGRcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
953
+ _chunkKE6RSOKXcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
954
954
  for (const url of candidates) {
955
- _chunk5GG5TEGRcjs.logger_default.info(` \u279C ${url}`);
955
+ _chunkKE6RSOKXcjs.logger_default.info(` \u279C ${url}`);
956
956
  }
957
957
  } else {
958
- _chunk5GG5TEGRcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
958
+ _chunkKE6RSOKXcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
959
959
  }
960
960
  }
961
961
  logBuildAppFinishOnlyShowOnce = true;
@@ -985,11 +985,11 @@ async function openIde() {
985
985
  try {
986
986
  await _weappidecli.parse.call(void 0, ["open", "-p"]);
987
987
  } catch (error) {
988
- _chunk5GG5TEGRcjs.logger_default.error(error);
988
+ _chunkKE6RSOKXcjs.logger_default.error(error);
989
989
  }
990
990
  }
991
991
  function logRuntimeTarget(targets) {
992
- _chunk5GG5TEGRcjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
992
+ _chunkKE6RSOKXcjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
993
993
  }
994
994
  function resolveRuntimeTargets(options) {
995
995
  const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
@@ -997,17 +997,17 @@ function resolveRuntimeTargets(options) {
997
997
  return {
998
998
  runMini: true,
999
999
  runWeb: false,
1000
- mpPlatform: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM,
1001
- label: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM
1000
+ mpPlatform: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM,
1001
+ label: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM
1002
1002
  };
1003
1003
  }
1004
- const normalized = _chunk5GG5TEGRcjs.normalizeMiniPlatform.call(void 0, rawPlatform);
1004
+ const normalized = _chunkKE6RSOKXcjs.normalizeMiniPlatform.call(void 0, rawPlatform);
1005
1005
  if (!normalized) {
1006
1006
  return {
1007
1007
  runMini: true,
1008
1008
  runWeb: false,
1009
- mpPlatform: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM,
1010
- label: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM
1009
+ mpPlatform: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM,
1010
+ label: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM
1011
1011
  };
1012
1012
  }
1013
1013
  if (normalized === "h5" || normalized === "web") {
@@ -1018,7 +1018,7 @@ function resolveRuntimeTargets(options) {
1018
1018
  label: normalized === "h5" ? "h5" : "web"
1019
1019
  };
1020
1020
  }
1021
- const mpPlatform = _chunk5GG5TEGRcjs.resolveMiniPlatform.call(void 0, normalized);
1021
+ const mpPlatform = _chunkKE6RSOKXcjs.resolveMiniPlatform.call(void 0, normalized);
1022
1022
  if (mpPlatform) {
1023
1023
  return {
1024
1024
  runMini: true,
@@ -1027,12 +1027,12 @@ function resolveRuntimeTargets(options) {
1027
1027
  label: mpPlatform
1028
1028
  };
1029
1029
  }
1030
- _chunk5GG5TEGRcjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM}`);
1030
+ _chunkKE6RSOKXcjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM}`);
1031
1031
  return {
1032
1032
  runMini: true,
1033
1033
  runWeb: false,
1034
- mpPlatform: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM,
1035
- label: _chunk5GG5TEGRcjs.DEFAULT_MP_PLATFORM
1034
+ mpPlatform: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM,
1035
+ label: _chunkKE6RSOKXcjs.DEFAULT_MP_PLATFORM
1036
1036
  };
1037
1037
  }
1038
1038
  function createInlineConfig(mpPlatform) {
@@ -1054,7 +1054,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
1054
1054
  const targets = resolveRuntimeTargets(options);
1055
1055
  logRuntimeTarget(targets);
1056
1056
  const inlineConfig = createInlineConfig(targets.mpPlatform);
1057
- const { buildService, configService, webService } = await _chunkOWCDSB6Fcjs.createCompilerContext.call(void 0, {
1057
+ const { buildService, configService, webService } = await _chunk2Q7K5AR4cjs.createCompilerContext.call(void 0, {
1058
1058
  cwd: root,
1059
1059
  mode: _nullishCoalesce(options.mode, () => ( "development")),
1060
1060
  isDev: true,
@@ -1069,7 +1069,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
1069
1069
  try {
1070
1070
  webServer = await _optionalChain([webService, 'optionalAccess', _15 => _15.startDevServer, 'call', _16 => _16()]);
1071
1071
  } catch (error) {
1072
- _chunk5GG5TEGRcjs.logger_default.error(error);
1072
+ _chunkKE6RSOKXcjs.logger_default.error(error);
1073
1073
  throw error;
1074
1074
  }
1075
1075
  }
@@ -1097,7 +1097,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
1097
1097
  const targets = resolveRuntimeTargets(options);
1098
1098
  logRuntimeTarget(targets);
1099
1099
  const inlineConfig = createInlineConfig(targets.mpPlatform);
1100
- const { buildService, configService, webService } = await _chunkOWCDSB6Fcjs.createCompilerContext.call(void 0, {
1100
+ const { buildService, configService, webService } = await _chunk2Q7K5AR4cjs.createCompilerContext.call(void 0, {
1101
1101
  cwd: root,
1102
1102
  mode: _nullishCoalesce(options.mode, () => ( "production")),
1103
1103
  configFile,
@@ -1110,9 +1110,9 @@ cli.command("build [root]", "build for production").option("--target <target>",
1110
1110
  if (targets.runWeb && _optionalChain([webConfig, 'optionalAccess', _17 => _17.enabled])) {
1111
1111
  try {
1112
1112
  await _optionalChain([webService, 'optionalAccess', _18 => _18.build, 'call', _19 => _19()]);
1113
- _chunk5GG5TEGRcjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
1113
+ _chunkKE6RSOKXcjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
1114
1114
  } catch (error) {
1115
- _chunk5GG5TEGRcjs.logger_default.error(error);
1115
+ _chunkKE6RSOKXcjs.logger_default.error(error);
1116
1116
  throw error;
1117
1117
  }
1118
1118
  }
@@ -1129,7 +1129,7 @@ cli.command("init").action(async () => {
1129
1129
  command: "weapp-vite"
1130
1130
  });
1131
1131
  } catch (error) {
1132
- _chunk5GG5TEGRcjs.logger_default.error(error);
1132
+ _chunkKE6RSOKXcjs.logger_default.error(error);
1133
1133
  }
1134
1134
  });
1135
1135
  cli.command("open").action(async () => {
@@ -1139,7 +1139,7 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
1139
1139
  try {
1140
1140
  await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
1141
1141
  } catch (error) {
1142
- _chunk5GG5TEGRcjs.logger_default.error(error);
1142
+ _chunkKE6RSOKXcjs.logger_default.error(error);
1143
1143
  }
1144
1144
  });
1145
1145
  cli.command("g [filepath]", "generate component").alias("generate").option("-a, --app", "type app").option("-p, --page", "type app").option("-n, --name <name>", "filename").action(async (filepath, options) => {
@@ -1154,7 +1154,7 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
1154
1154
  fileName = "app";
1155
1155
  }
1156
1156
  if (filepath === void 0) {
1157
- _chunk5GG5TEGRcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
1157
+ _chunkKE6RSOKXcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
1158
1158
  return;
1159
1159
  }
1160
1160
  if (options.page) {
@@ -1174,5 +1174,5 @@ cli.command("create [outDir]", "create project").option("-t, --template <type>",
1174
1174
  await _init.createProject.call(void 0, outDir, options.template);
1175
1175
  });
1176
1176
  cli.help();
1177
- cli.version(_chunk5GG5TEGRcjs.VERSION);
1177
+ cli.version(_chunkKE6RSOKXcjs.VERSION);
1178
1178
  cli.parse();
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCompilerContext
3
- } from "./chunk-QCLEMTCV.mjs";
3
+ } from "./chunk-K2MHCVVB.mjs";
4
4
  import {
5
5
  DEFAULT_MP_PLATFORM,
6
6
  VERSION,
@@ -9,10 +9,10 @@ import {
9
9
  normalizeMiniPlatform,
10
10
  resolveMiniPlatform,
11
11
  resolveWeappConfigFile
12
- } from "./chunk-T4MUKDMP.mjs";
12
+ } from "./chunk-2JQYFUSO.mjs";
13
13
  import {
14
14
  init_esm_shims
15
- } from "./chunk-7MAZ2JUY.mjs";
15
+ } from "./chunk-C5ZVOPAJ.mjs";
16
16
 
17
17
  // src/cli.ts
18
18
  init_esm_shims();
@@ -1,17 +1,17 @@
1
- import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
2
1
  import { InlineConfig, UserConfig as UserConfig$1, ViteDevServer, build, UserConfigFnObject, UserConfigExport } from 'vite';
3
- import { A as AutoRoutes } from './routes-C9hKJjXs.js';
4
- import { a as Resolver, R as ResolvedValue } from './types-g_G_na7r.js';
5
- import { Options } from 'tsdown';
6
2
  import { GenerateType, Component, Theme, Sitemap, App, Page, Plugin } from '@weapp-core/schematics';
7
3
  import { WeappWebPluginOptions } from '@weapp-vite/web';
4
+ import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
5
+ import { Options } from 'tsdown';
8
6
  import { WrapPluginOptions } from 'vite-plugin-performance';
9
7
  import { PluginOptions } from 'vite-tsconfig-paths';
8
+ import { R as Resolver, a as ResolvedValue } from './types-3q1Qq6Fe.js';
10
9
  import PQueue from 'p-queue';
11
10
  import { DetectResult } from 'package-manager-detector';
12
11
  import { PackageJson } from 'pkg-types';
13
12
  import { Buffer } from 'node:buffer';
14
13
  import { LRUCache } from 'lru-cache';
14
+ import { A as AutoRoutes } from './routes-C9hKJjXs.js';
15
15
 
16
16
  interface Alias {
17
17
  find: string | RegExp;
@@ -57,6 +57,56 @@ interface SubPackage {
57
57
  dependencies?: (string | RegExp)[];
58
58
  inlineConfig?: Partial<InlineConfig>;
59
59
  }
60
+ type SubPackageStyleScope = 'all' | 'pages' | 'components';
61
+ interface SubPackageStyleConfigObject {
62
+ /** 样式文件路径,可以是相对分包 root、相对 `srcRoot` 或绝对路径 */
63
+ source: string;
64
+ /**
65
+ * 作用范围快捷配置:
66
+ *
67
+ * - `all`: 默认值,分包内所有页面与组件都会引入
68
+ * - `pages`: 仅匹配分包 `pages/**`
69
+ * - `components`: 仅匹配分包 `components/**`
70
+ *
71
+ * 可结合 `include` / `exclude` 进一步细分范围
72
+ */
73
+ scope?: SubPackageStyleScope;
74
+ /** 自定义包含路径,支持传入单个 glob 或数组,默认覆盖分包内所有文件 */
75
+ include?: string | string[];
76
+ /** 自定义排除路径,支持传入单个 glob 或数组 */
77
+ exclude?: string | string[];
78
+ }
79
+ type SubPackageStyleConfigEntry = string | SubPackageStyleConfigObject;
80
+ interface SubPackageStyleEntry {
81
+ /**
82
+ * 源配置字符串(便于诊断)
83
+ */
84
+ source: string;
85
+ /**
86
+ * 原始样式文件的绝对路径
87
+ */
88
+ absolutePath: string;
89
+ /**
90
+ * 相对于 `srcRoot` 的输出路径(已转换为目标平台样式后缀)
91
+ */
92
+ outputRelativePath: string;
93
+ /**
94
+ * 源文件扩展名(包含 `.`)
95
+ */
96
+ inputExtension: string;
97
+ /**
98
+ * 作用域快捷字段,便于诊断输出
99
+ */
100
+ scope: SubPackageStyleScope;
101
+ /**
102
+ * 允许生效的 glob 列表(基于分包 root 的相对路径)
103
+ */
104
+ include: string[];
105
+ /**
106
+ * 排除的 glob 列表(基于分包 root 的相对路径)
107
+ */
108
+ exclude: string[];
109
+ }
60
110
  type GenerateExtensionsOptions = Partial<{
61
111
  js: 'js' | 'ts' | (string & {});
62
112
  json: 'js' | 'ts' | 'json' | (string & {});
@@ -215,6 +265,11 @@ interface ChunksConfig {
215
265
  * @default 'duplicate'
216
266
  */
217
267
  sharedStrategy?: SharedChunkStrategy;
268
+ /**
269
+ * @description 是否输出分包优化日志,帮助确认共享模块被复制或回退的位置
270
+ * @default true
271
+ */
272
+ logOptimization?: boolean;
218
273
  }
219
274
  interface WeappViteConfig {
220
275
  /**
@@ -277,6 +332,15 @@ interface WeappViteConfig {
277
332
  */
278
333
  subPackages?: Record<string, Pick<SubPackage, 'independent' | 'dependencies' | 'inlineConfig'> & {
279
334
  autoImportComponents?: AutoImportComponents;
335
+ /** 分包文件变更时是否强制重新生成共享样式产物,默认启用 */
336
+ watchSharedStyles?: boolean;
337
+ /**
338
+ * 分包共享样式入口,支持传入一个或多个 `wxss`/`css` 文件路径
339
+ * - 相对路径默认基于当前分包的 `root`
340
+ * - 也可以传入绝对路径或相对 `srcRoot` 的路径
341
+ * - 支持传入对象配置 `scope`/`include`/`exclude` 精准控制注入范围
342
+ */
343
+ styles?: SubPackageStyleConfigEntry | SubPackageStyleConfigEntry[];
280
344
  }>;
281
345
  /**
282
346
  * 需要被额外包括的资源
@@ -363,6 +427,8 @@ interface ProjectConfig {
363
427
  interface SubPackageMetaValue {
364
428
  entries: string[];
365
429
  subPackage: SubPackage;
430
+ styleEntries?: SubPackageStyleEntry[];
431
+ watchSharedStyles?: boolean;
366
432
  }
367
433
 
368
434
  interface WxmlDep {
@@ -424,6 +490,9 @@ interface BuildOptions {
424
490
  interface BuildService {
425
491
  queue: PQueue;
426
492
  build: (options?: BuildOptions) => Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
493
+ buildIndependentBundle: (root: string, meta: SubPackageMetaValue) => Promise<RolldownOutput>;
494
+ getIndependentOutput: (root: string) => RolldownOutput | undefined;
495
+ invalidateIndependentOutput: (root: string) => void;
427
496
  }
428
497
 
429
498
  interface OutputExtensions {
@@ -477,6 +546,7 @@ interface ConfigService {
477
546
  mergeWorkers: (...configs: Partial<InlineConfig>[]) => InlineConfig;
478
547
  merge: (subPackageMeta?: SubPackageMetaValue, ...configs: Partial<InlineConfig | undefined>[]) => InlineConfig;
479
548
  mergeWeb: (...configs: Partial<InlineConfig | undefined>[]) => InlineConfig | undefined;
549
+ mergeInlineConfig: (...configs: Partial<InlineConfig>[]) => InlineConfig;
480
550
  readonly defineImportMetaEnv: Record<string, any>;
481
551
  readonly cwd: string;
482
552
  readonly isDev: boolean;
@@ -512,6 +582,12 @@ interface ResolvedWeappWebConfig {
512
582
  source?: WeappWebConfig;
513
583
  }
514
584
 
585
+ interface JsonResolvableEntry {
586
+ json?: any;
587
+ jsonPath?: string;
588
+ type?: 'app' | 'page' | 'component' | 'plugin';
589
+ }
590
+
515
591
  type HashInput = string | Buffer;
516
592
  declare class FileCache<T extends object> {
517
593
  cache: LRUCache<string, T>;
@@ -528,7 +604,7 @@ declare class FileCache<T extends object> {
528
604
 
529
605
  interface JsonService {
530
606
  read: (filepath: string) => Promise<any>;
531
- resolve: (entry: Partial<Pick<Entry, 'json' | 'jsonPath' | 'type'>>) => string | undefined;
607
+ resolve: (entry: JsonResolvableEntry) => string | undefined;
532
608
  cache: FileCache<any>;
533
609
  }
534
610
 
@@ -601,6 +677,13 @@ interface SidecarWatcher {
601
677
  close: () => void | Promise<void>;
602
678
  }
603
679
 
680
+ interface AutoRoutesCandidateState {
681
+ base: string;
682
+ files: Set<string>;
683
+ hasScript: boolean;
684
+ hasTemplate: boolean;
685
+ jsonPath?: string;
686
+ }
604
687
  interface RuntimeState {
605
688
  autoRoutes: {
606
689
  routes: AutoRoutes;
@@ -611,6 +694,8 @@ interface RuntimeState {
611
694
  watchDirs: Set<string>;
612
695
  dirty: boolean;
613
696
  initialized: boolean;
697
+ candidates: Map<string, AutoRoutesCandidateState>;
698
+ needsFullRescan: boolean;
614
699
  };
615
700
  autoImport: {
616
701
  registry: Map<string, LocalAutoImportMatch>;
@@ -620,6 +705,9 @@ interface RuntimeState {
620
705
  build: {
621
706
  queue: PQueue;
622
707
  npmBuilt: boolean;
708
+ independent: {
709
+ outputs: Map<string, RolldownOutput>;
710
+ };
623
711
  };
624
712
  json: {
625
713
  cache: FileCache<any>;
@@ -633,12 +721,14 @@ interface RuntimeState {
633
721
  tokenMap: Map<string, ScanWxmlResult>;
634
722
  componentsMap: Map<string, ComponentsMap>;
635
723
  cache: FileCache<ScanWxmlResult>;
724
+ emittedCode: Map<string, string>;
636
725
  };
637
726
  scan: {
638
727
  subPackageMap: Map<string, SubPackageMetaValue>;
639
728
  independentSubPackageMap: Map<string, SubPackageMetaValue>;
640
729
  appEntry?: AppEntry;
641
730
  pluginJson?: Plugin;
731
+ pluginJsonPath?: string;
642
732
  isDirty: boolean;
643
733
  independentDirtyRoots: Set<string>;
644
734
  };
@@ -653,6 +743,7 @@ interface RuntimeState {
653
743
  interface ScanService {
654
744
  appEntry?: AppEntry;
655
745
  pluginJson?: Plugin;
746
+ pluginJsonPath?: string;
656
747
  subPackageMap: Map<string, SubPackageMetaValue>;
657
748
  independentSubPackageMap: Map<string, SubPackageMetaValue>;
658
749
  loadAppEntry: () => Promise<AppEntry>;
@@ -709,6 +800,7 @@ interface AutoImportService {
709
800
  awaitManifestWrites: () => Promise<void>;
710
801
  }
711
802
 
803
+ type AutoRoutesFileEvent = ChangeEvent | 'rename';
712
804
  interface AutoRoutesService {
713
805
  ensureFresh: () => Promise<void>;
714
806
  markDirty: () => void;
@@ -718,7 +810,7 @@ interface AutoRoutesService {
718
810
  getWatchFiles: () => Iterable<string>;
719
811
  getWatchDirectories: () => Iterable<string>;
720
812
  isRouteFile: (filePath: string) => boolean;
721
- handleFileChange: (filePath: string, event?: ChangeEvent) => Promise<void>;
813
+ handleFileChange: (filePath: string, event?: AutoRoutesFileEvent) => Promise<void>;
722
814
  isInitialized: () => boolean;
723
815
  isEnabled: () => boolean;
724
816
  }
@@ -761,4 +853,4 @@ declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig
761
853
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
762
854
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
763
855
 
764
- export { type Alias as A, type BuildNpmPackageMeta as B, type CompilerContext as C, type ChunksConfig as D, type EnhanceWxmlOptions as E, type SubPackageMetaValue as F, type GenerateExtensionsOptions as G, type HandleWxmlOptions as H, type WxmlDep as I, type JsFormat as J, type ScanComponentItem as K, type LoadConfigOptions as L, type MpPlatform as M, type ComponentsMap as N, type BaseEntry as O, type ProjectConfig as P, type Entry as Q, type ResolvedAlias as R, type SubPackage as S, type AppEntry as T, type UserConfig as U, type PageEntry as V, type WeappViteConfig as W, type ComponentEntry as X, type EntryJsonFragment as Y, type WeappVitePluginApi as Z, type ChangeEvent as _, defineAppJson as a, definePageJson as b, defineComponentJson as c, defineConfig as d, defineSitemapJson as e, defineThemeJson as f, type AliasOptions as g, type GenerateDirsOptions as h, type GenerateFilenamesOptions as i, type GenerateFileType as j, type GenerateTemplateContext as k, type GenerateTemplateFileSource as l, type GenerateTemplateInlineSource as m, type GenerateTemplateFactory as n, type GenerateTemplate as o, type GenerateTemplateEntry as p, type GenerateTemplateScope as q, type GenerateTemplatesConfig as r, type GenerateOptions as s, type CopyOptions as t, type CopyGlobs as u, type WeappWebConfig as v, type AutoImportComponents as w, type ScanWxmlOptions as x, type EnhanceOptions as y, type SharedChunkStrategy as z };
856
+ export { type ComponentEntry as $, type Alias as A, type AutoImportComponents as B, type CompilerContext as C, type ScanWxmlOptions as D, type EnhanceWxmlOptions as E, type EnhanceOptions as F, type GenerateExtensionsOptions as G, type HandleWxmlOptions as H, type BuildNpmPackageMeta as I, type JsFormat as J, type SharedChunkStrategy as K, type LoadConfigOptions as L, type MpPlatform as M, type ChunksConfig as N, type SubPackageMetaValue as O, type ProjectConfig as P, type WxmlDep as Q, type ResolvedAlias as R, type SubPackage as S, type ScanComponentItem as T, type UserConfig as U, type ComponentsMap as V, type WeappViteConfig as W, type BaseEntry as X, type Entry as Y, type AppEntry as Z, type PageEntry as _, defineAppJson as a, type EntryJsonFragment as a0, type WeappVitePluginApi as a1, type ChangeEvent as a2, definePageJson as b, defineComponentJson as c, defineConfig as d, defineSitemapJson as e, defineThemeJson as f, type AliasOptions as g, type SubPackageStyleScope as h, type SubPackageStyleConfigObject as i, type SubPackageStyleConfigEntry as j, type SubPackageStyleEntry as k, type GenerateDirsOptions as l, type GenerateFilenamesOptions as m, type GenerateFileType as n, type GenerateTemplateContext as o, type GenerateTemplateFileSource as p, type GenerateTemplateInlineSource as q, type GenerateTemplateFactory as r, type GenerateTemplate as s, type GenerateTemplateEntry as t, type GenerateTemplateScope as u, type GenerateTemplatesConfig as v, type GenerateOptions as w, type CopyOptions as x, type CopyGlobs as y, type WeappWebConfig as z };