weapp-vite 5.2.3 → 5.3.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.
package/dist/cli.cjs CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkGMCAZZQYcjs = require('./chunk-GMCAZZQY.cjs');
6
+
7
+ var _chunkN2SUN4MXcjs = require('./chunk-N2SUN4MX.cjs');
7
8
 
8
9
 
9
10
  var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
@@ -12,6 +13,7 @@ var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
12
13
  _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
13
14
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
14
15
  var _init = require('@weapp-core/init');
16
+ var _shared = require('@weapp-core/shared');
15
17
 
16
18
  // ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
17
19
  _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
@@ -736,7 +738,7 @@ var _weappidecli = require('weapp-ide-cli');
736
738
  _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
737
739
 
738
740
  var _schematics = require('@weapp-core/schematics');
739
- var _shared = require('@weapp-core/shared');
741
+
740
742
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
741
743
 
742
744
  function composePath(outDir, filename) {
@@ -804,7 +806,7 @@ async function generate(options) {
804
806
  for (const { code, fileName: fileName2 } of files) {
805
807
  if (code !== void 0) {
806
808
  await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
807
- _chunkGMCAZZQYcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
809
+ _chunkN2SUN4MXcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
808
810
  }
809
811
  }
810
812
  }
@@ -842,18 +844,60 @@ async function readTemplateFile(templatePath, context) {
842
844
  // src/cli.ts
843
845
  var cli = cac("weapp-vite");
844
846
  try {
845
- _chunkGMCAZZQYcjs.checkRuntime.call(void 0, {
847
+ _chunkN2SUN4MXcjs.checkRuntime.call(void 0, {
846
848
  bun: "0.0.0",
847
849
  deno: "0.0.0",
848
850
  node: "20.19.0"
849
851
  });
850
852
  } catch (e) {
851
853
  }
852
- function loadConfig(configFile) {
853
- return _vite.loadConfigFromFile.call(void 0, {
854
+ async function loadConfig(configFile) {
855
+ const cwd = _process2.default.cwd();
856
+ let resolvedConfigFile = configFile;
857
+ if (resolvedConfigFile && !_pathe2.default.isAbsolute(resolvedConfigFile)) {
858
+ resolvedConfigFile = _pathe2.default.resolve(cwd, resolvedConfigFile);
859
+ }
860
+ const configEnv = {
854
861
  command: "serve",
855
862
  mode: "development"
856
- }, configFile, _process2.default.cwd());
863
+ };
864
+ const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
865
+ const weappConfigFilePath = await _chunkN2SUN4MXcjs.resolveWeappConfigFile.call(void 0, {
866
+ root: cwd,
867
+ specified: resolvedConfigFile
868
+ });
869
+ let weappLoaded;
870
+ if (weappConfigFilePath) {
871
+ const normalizedWeappPath = _pathe2.default.resolve(weappConfigFilePath);
872
+ const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess', _6 => _6.path]) ? _pathe2.default.resolve(loaded.path) : void 0;
873
+ if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
874
+ weappLoaded = loaded;
875
+ } else {
876
+ weappLoaded = await _vite.loadConfigFromFile.call(void 0, configEnv, weappConfigFilePath, cwd);
877
+ }
878
+ }
879
+ if (!loaded && !weappLoaded) {
880
+ return void 0;
881
+ }
882
+ const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _7 => _7.config]), () => ( (_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _8 => _8.config]), () => ( {})))));
883
+ if (_optionalChain([weappLoaded, 'optionalAccess', _9 => _9.config, 'optionalAccess', _10 => _10.weapp])) {
884
+ config.weapp = _shared.defu.call(void 0,
885
+ weappLoaded.config.weapp,
886
+ _nullishCoalesce(config.weapp, () => ( {}))
887
+ );
888
+ }
889
+ const dependencySet = /* @__PURE__ */ new Set();
890
+ for (const dependency of _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _11 => _11.dependencies]), () => ( []))) {
891
+ dependencySet.add(dependency);
892
+ }
893
+ for (const dependency of _nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _12 => _12.dependencies]), () => ( []))) {
894
+ dependencySet.add(dependency);
895
+ }
896
+ return {
897
+ config,
898
+ path: _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _13 => _13.path]), () => ( _optionalChain([loaded, 'optionalAccess', _14 => _14.path]))), () => ( resolvedConfigFile)),
899
+ dependencies: Array.from(dependencySet)
900
+ };
857
901
  }
858
902
  var logBuildAppFinishOnlyShowOnce = false;
859
903
  function logBuildAppFinish(configService) {
@@ -867,9 +911,9 @@ function logBuildAppFinish(configService) {
867
911
  args: ["run", "open"]
868
912
  }));
869
913
  const devCommand = `${command} ${args.join(" ")}`;
870
- _chunkGMCAZZQYcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
871
- _chunkGMCAZZQYcjs.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`);
872
- _chunkGMCAZZQYcjs.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");
914
+ _chunkN2SUN4MXcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
915
+ _chunkN2SUN4MXcjs.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`);
916
+ _chunkN2SUN4MXcjs.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");
873
917
  logBuildAppFinishOnlyShowOnce = true;
874
918
  }
875
919
  }
@@ -898,7 +942,7 @@ async function openIde() {
898
942
  try {
899
943
  await _weappidecli.parse.call(void 0, ["open", "-p"]);
900
944
  } catch (error) {
901
- _chunkGMCAZZQYcjs.logger_default.error(error);
945
+ _chunkN2SUN4MXcjs.logger_default.error(error);
902
946
  }
903
947
  }
904
948
  cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
@@ -907,7 +951,7 @@ cli.option("-c, --config <file>", `[string] use specified config file`).option("
907
951
  cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
908
952
  filterDuplicateOptions(options);
909
953
  const configFile = resolveConfigFile(options);
910
- const { buildService, configService } = await _chunkGMCAZZQYcjs.createCompilerContext.call(void 0, {
954
+ const { buildService, configService } = await _chunkN2SUN4MXcjs.createCompilerContext.call(void 0, {
911
955
  cwd: root,
912
956
  mode: _nullishCoalesce(options.mode, () => ( "development")),
913
957
  isDev: true,
@@ -931,7 +975,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
931
975
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
932
976
  filterDuplicateOptions(options);
933
977
  const configFile = resolveConfigFile(options);
934
- const { buildService, configService } = await _chunkGMCAZZQYcjs.createCompilerContext.call(void 0, {
978
+ const { buildService, configService } = await _chunkN2SUN4MXcjs.createCompilerContext.call(void 0, {
935
979
  cwd: root,
936
980
  mode: _nullishCoalesce(options.mode, () => ( "production")),
937
981
  configFile
@@ -948,7 +992,7 @@ cli.command("init").action(async () => {
948
992
  command: "weapp-vite"
949
993
  });
950
994
  } catch (error) {
951
- _chunkGMCAZZQYcjs.logger_default.error(error);
995
+ _chunkN2SUN4MXcjs.logger_default.error(error);
952
996
  }
953
997
  });
954
998
  cli.command("open").action(async () => {
@@ -958,7 +1002,7 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
958
1002
  try {
959
1003
  await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
960
1004
  } catch (error) {
961
- _chunkGMCAZZQYcjs.logger_default.error(error);
1005
+ _chunkN2SUN4MXcjs.logger_default.error(error);
962
1006
  }
963
1007
  });
964
1008
  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) => {
@@ -973,25 +1017,25 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
973
1017
  fileName = "app";
974
1018
  }
975
1019
  if (filepath === void 0) {
976
- _chunkGMCAZZQYcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
1020
+ _chunkN2SUN4MXcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
977
1021
  return;
978
1022
  }
979
1023
  if (options.page) {
980
1024
  type = "page";
981
1025
  }
982
- const generateOptions = _optionalChain([config, 'optionalAccess', _6 => _6.config, 'access', _7 => _7.weapp, 'optionalAccess', _8 => _8.generate]);
983
- fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _9 => _9.filenames, 'optionalAccess', _10 => _10[type]]), () => ( fileName));
1026
+ const generateOptions = _optionalChain([config, 'optionalAccess', _15 => _15.config, 'access', _16 => _16.weapp, 'optionalAccess', _17 => _17.generate]);
1027
+ fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _18 => _18.filenames, 'optionalAccess', _19 => _19[type]]), () => ( fileName));
984
1028
  await generate({
985
- outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _11 => _11.dirs, 'optionalAccess', _12 => _12[type]]), () => ( "")), filepath),
1029
+ outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _20 => _20.dirs, 'optionalAccess', _21 => _21[type]]), () => ( "")), filepath),
986
1030
  type,
987
1031
  fileName,
988
- extensions: _optionalChain([generateOptions, 'optionalAccess', _13 => _13.extensions]),
989
- templates: _optionalChain([generateOptions, 'optionalAccess', _14 => _14.templates])
1032
+ extensions: _optionalChain([generateOptions, 'optionalAccess', _22 => _22.extensions]),
1033
+ templates: _optionalChain([generateOptions, 'optionalAccess', _23 => _23.templates])
990
1034
  });
991
1035
  });
992
1036
  cli.command("create [outDir]", "create project").option("-t, --template <type>", "template type").action(async (outDir, options) => {
993
1037
  await _init.createProject.call(void 0, outDir, options.template);
994
1038
  });
995
1039
  cli.help();
996
- cli.version(_chunkGMCAZZQYcjs.VERSION);
1040
+ cli.version(_chunkN2SUN4MXcjs.VERSION);
997
1041
  cli.parse();
package/dist/cli.mjs CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  VERSION,
3
3
  checkRuntime,
4
4
  createCompilerContext,
5
- logger_default
6
- } from "./chunk-UTHLNBNC.mjs";
5
+ logger_default,
6
+ resolveWeappConfigFile
7
+ } from "./chunk-JGSE2EOU.mjs";
7
8
  import {
8
9
  init_esm_shims
9
10
  } from "./chunk-7MAZ2JUY.mjs";
@@ -12,6 +13,7 @@ import {
12
13
  init_esm_shims();
13
14
  import process3 from "process";
14
15
  import { createProject, initConfig } from "@weapp-core/init";
16
+ import { defu as defu2 } from "@weapp-core/shared";
15
17
 
16
18
  // ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
17
19
  init_esm_shims();
@@ -849,11 +851,53 @@ try {
849
851
  });
850
852
  } catch {
851
853
  }
852
- function loadConfig(configFile) {
853
- return loadConfigFromFile({
854
+ async function loadConfig(configFile) {
855
+ const cwd = process3.cwd();
856
+ let resolvedConfigFile = configFile;
857
+ if (resolvedConfigFile && !path2.isAbsolute(resolvedConfigFile)) {
858
+ resolvedConfigFile = path2.resolve(cwd, resolvedConfigFile);
859
+ }
860
+ const configEnv = {
854
861
  command: "serve",
855
862
  mode: "development"
856
- }, configFile, process3.cwd());
863
+ };
864
+ const loaded = await loadConfigFromFile(configEnv, resolvedConfigFile, cwd);
865
+ const weappConfigFilePath = await resolveWeappConfigFile({
866
+ root: cwd,
867
+ specified: resolvedConfigFile
868
+ });
869
+ let weappLoaded;
870
+ if (weappConfigFilePath) {
871
+ const normalizedWeappPath = path2.resolve(weappConfigFilePath);
872
+ const normalizedLoadedPath = loaded?.path ? path2.resolve(loaded.path) : void 0;
873
+ if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
874
+ weappLoaded = loaded;
875
+ } else {
876
+ weappLoaded = await loadConfigFromFile(configEnv, weappConfigFilePath, cwd);
877
+ }
878
+ }
879
+ if (!loaded && !weappLoaded) {
880
+ return void 0;
881
+ }
882
+ const config = loaded?.config ?? (weappLoaded?.config ?? {});
883
+ if (weappLoaded?.config?.weapp) {
884
+ config.weapp = defu2(
885
+ weappLoaded.config.weapp,
886
+ config.weapp ?? {}
887
+ );
888
+ }
889
+ const dependencySet = /* @__PURE__ */ new Set();
890
+ for (const dependency of loaded?.dependencies ?? []) {
891
+ dependencySet.add(dependency);
892
+ }
893
+ for (const dependency of weappLoaded?.dependencies ?? []) {
894
+ dependencySet.add(dependency);
895
+ }
896
+ return {
897
+ config,
898
+ path: weappLoaded?.path ?? loaded?.path ?? resolvedConfigFile,
899
+ dependencies: Array.from(dependencySet)
900
+ };
857
901
  }
858
902
  var logBuildAppFinishOnlyShowOnce = false;
859
903
  function logBuildAppFinish(configService) {
@@ -4,7 +4,7 @@ import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
4
4
  import { Options } from 'tsdown';
5
5
  import { WrapPluginOptions } from 'vite-plugin-performance';
6
6
  import { PluginOptions } from 'vite-tsconfig-paths';
7
- import { R as Resolver, a as ResolvedValue } from './types-D7SAXpSN.js';
7
+ import { R as Resolver, a as ResolvedValue } from './types-3q1Qq6Fe.js';
8
8
  import PQueue from 'p-queue';
9
9
  import { DetectResult } from 'package-manager-detector';
10
10
  import { PackageJson } from 'pkg-types';
@@ -125,6 +125,13 @@ interface AutoImportComponents {
125
125
  * 自动导入组件解析器
126
126
  */
127
127
  resolvers?: Resolver[];
128
+ /**
129
+ * 自动导入组件清单输出路径,默认输出到 `vite.config.ts` 同级目录的 `auto-import-components.json`
130
+ * - `true` 或未指定: 按默认路径输出
131
+ * - 传入字符串: 指定输出路径 (支持绝对/相对路径)
132
+ * - `false`: 不生成清单文件
133
+ */
134
+ output?: string | boolean;
128
135
  }
129
136
  type EnhanceWxmlOptions = ScanWxmlOptions & HandleWxmlOptions;
130
137
  interface ScanWxmlOptions {
@@ -355,6 +362,7 @@ interface LoadConfigResult {
355
362
  packageJsonPath: string;
356
363
  platform: MpPlatform;
357
364
  srcRoot: string;
365
+ configFilePath?: string;
358
366
  currentSubPackageRoot?: string;
359
367
  }
360
368
  interface PackageInfo {
@@ -390,6 +398,7 @@ interface ConfigService {
390
398
  readonly mode: string;
391
399
  readonly aliasEntries: ResolvedAlias[];
392
400
  readonly platform: MpPlatform;
401
+ readonly configFilePath?: string;
393
402
  relativeCwd: (p: string) => string;
394
403
  relativeSrcRoot: (p: string) => string;
395
404
  relativeAbsoluteSrcRoot: (p: string) => string;
@@ -572,6 +581,7 @@ interface AutoImportService {
572
581
  resolve: (componentName: string, importerBaseName?: string) => AutoImportMatch | undefined;
573
582
  filter: (id: string, meta?: SubPackageMetaValue) => boolean;
574
583
  getRegisteredLocalComponents: () => LocalAutoImportMatch[];
584
+ awaitManifestWrites: () => Promise<void>;
575
585
  }
576
586
 
577
587
  interface CompilerContext {
@@ -4,7 +4,7 @@ import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
4
4
  import { Options } from 'tsdown';
5
5
  import { WrapPluginOptions } from 'vite-plugin-performance';
6
6
  import { PluginOptions } from 'vite-tsconfig-paths';
7
- import { R as Resolver, a as ResolvedValue } from './types-D7SAXpSN.cjs';
7
+ import { R as Resolver, a as ResolvedValue } from './types-3q1Qq6Fe.cjs';
8
8
  import PQueue from 'p-queue';
9
9
  import { DetectResult } from 'package-manager-detector';
10
10
  import { PackageJson } from 'pkg-types';
@@ -125,6 +125,13 @@ interface AutoImportComponents {
125
125
  * 自动导入组件解析器
126
126
  */
127
127
  resolvers?: Resolver[];
128
+ /**
129
+ * 自动导入组件清单输出路径,默认输出到 `vite.config.ts` 同级目录的 `auto-import-components.json`
130
+ * - `true` 或未指定: 按默认路径输出
131
+ * - 传入字符串: 指定输出路径 (支持绝对/相对路径)
132
+ * - `false`: 不生成清单文件
133
+ */
134
+ output?: string | boolean;
128
135
  }
129
136
  type EnhanceWxmlOptions = ScanWxmlOptions & HandleWxmlOptions;
130
137
  interface ScanWxmlOptions {
@@ -355,6 +362,7 @@ interface LoadConfigResult {
355
362
  packageJsonPath: string;
356
363
  platform: MpPlatform;
357
364
  srcRoot: string;
365
+ configFilePath?: string;
358
366
  currentSubPackageRoot?: string;
359
367
  }
360
368
  interface PackageInfo {
@@ -390,6 +398,7 @@ interface ConfigService {
390
398
  readonly mode: string;
391
399
  readonly aliasEntries: ResolvedAlias[];
392
400
  readonly platform: MpPlatform;
401
+ readonly configFilePath?: string;
393
402
  relativeCwd: (p: string) => string;
394
403
  relativeSrcRoot: (p: string) => string;
395
404
  relativeAbsoluteSrcRoot: (p: string) => string;
@@ -572,6 +581,7 @@ interface AutoImportService {
572
581
  resolve: (componentName: string, importerBaseName?: string) => AutoImportMatch | undefined;
573
582
  filter: (id: string, meta?: SubPackageMetaValue) => boolean;
574
583
  getRegisteredLocalComponents: () => LocalAutoImportMatch[];
584
+ awaitManifestWrites: () => Promise<void>;
575
585
  }
576
586
 
577
587
  interface CompilerContext {
package/dist/config.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
2
- export { a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-CEyL0Mum.cjs';
2
+ export { W as WeappViteConfig, a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-j03AZAws.cjs';
3
3
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
4
4
  import 'rolldown';
5
5
  import 'tsdown';
6
6
  import 'vite-plugin-performance';
7
7
  import 'vite-tsconfig-paths';
8
- import './types-D7SAXpSN.cjs';
8
+ import './types-3q1Qq6Fe.cjs';
9
9
  import 'p-queue';
10
10
  import 'package-manager-detector';
11
11
  import 'pkg-types';
package/dist/config.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
2
- export { a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-9I2A4BU9.js';
2
+ export { W as WeappViteConfig, a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-BMJAZP6e.js';
3
3
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
4
4
  import 'rolldown';
5
5
  import 'tsdown';
6
6
  import 'vite-plugin-performance';
7
7
  import 'vite-tsconfig-paths';
8
- import './types-D7SAXpSN.js';
8
+ import './types-3q1Qq6Fe.js';
9
9
  import 'p-queue';
10
10
  import 'package-manager-detector';
11
11
  import 'pkg-types';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGMCAZZQYcjs = require('./chunk-GMCAZZQY.cjs');
3
+ var _chunkN2SUN4MXcjs = require('./chunk-N2SUN4MX.cjs');
4
4
 
5
5
 
6
6
  var _chunkDVVMF6NDcjs = require('./chunk-DVVMF6ND.cjs');
@@ -26,4 +26,4 @@ _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
26
26
 
27
27
 
28
28
 
29
- exports.createCompilerContext = _chunkGMCAZZQYcjs.createCompilerContext; exports.defineAppJson = _chunkBT7FLFCCcjs.defineAppJson; exports.defineComponentJson = _chunkBT7FLFCCcjs.defineComponentJson; exports.defineConfig = _chunkDVVMF6NDcjs.defineConfig; exports.definePageJson = _chunkBT7FLFCCcjs.definePageJson; exports.defineSitemapJson = _chunkBT7FLFCCcjs.defineSitemapJson; exports.defineThemeJson = _chunkBT7FLFCCcjs.defineThemeJson;
29
+ exports.createCompilerContext = _chunkN2SUN4MXcjs.createCompilerContext; exports.defineAppJson = _chunkBT7FLFCCcjs.defineAppJson; exports.defineComponentJson = _chunkBT7FLFCCcjs.defineComponentJson; exports.defineConfig = _chunkDVVMF6NDcjs.defineConfig; exports.definePageJson = _chunkBT7FLFCCcjs.definePageJson; exports.defineSitemapJson = _chunkBT7FLFCCcjs.defineSitemapJson; exports.defineThemeJson = _chunkBT7FLFCCcjs.defineThemeJson;
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { L as LoadConfigOptions, C as CompilerContext } from './config-CEyL0Mum.cjs';
2
- export { a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-CEyL0Mum.cjs';
1
+ import { L as LoadConfigOptions, C as CompilerContext } from './config-j03AZAws.cjs';
2
+ export { W as WeappViteConfig, a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-j03AZAws.cjs';
3
3
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
4
4
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, UserConfig, UserConfigExport, UserConfigFnObject, ViteDevServer } from 'vite';
5
5
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
6
6
  import 'tsdown';
7
7
  import 'vite-plugin-performance';
8
8
  import 'vite-tsconfig-paths';
9
- import './types-D7SAXpSN.cjs';
9
+ import './types-3q1Qq6Fe.cjs';
10
10
  import 'p-queue';
11
11
  import 'package-manager-detector';
12
12
  import 'pkg-types';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { L as LoadConfigOptions, C as CompilerContext } from './config-9I2A4BU9.js';
2
- export { a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-9I2A4BU9.js';
1
+ import { L as LoadConfigOptions, C as CompilerContext } from './config-BMJAZP6e.js';
2
+ export { W as WeappViteConfig, a as defineAppJson, c as defineComponentJson, d as defineConfig, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-BMJAZP6e.js';
3
3
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
4
4
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, UserConfig, UserConfigExport, UserConfigFnObject, ViteDevServer } from 'vite';
5
5
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
6
6
  import 'tsdown';
7
7
  import 'vite-plugin-performance';
8
8
  import 'vite-tsconfig-paths';
9
- import './types-D7SAXpSN.js';
9
+ import './types-3q1Qq6Fe.js';
10
10
  import 'p-queue';
11
11
  import 'package-manager-detector';
12
12
  import 'pkg-types';
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCompilerContext
3
- } from "./chunk-UTHLNBNC.mjs";
3
+ } from "./chunk-JGSE2EOU.mjs";
4
4
  import {
5
5
  defineConfig
6
6
  } from "./chunk-HVMR6H5Z.mjs";
package/dist/json.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
2
- export { a as defineAppJson, c as defineComponentJson, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-CEyL0Mum.cjs';
2
+ export { a as defineAppJson, c as defineComponentJson, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-j03AZAws.cjs';
3
3
  import 'vite';
4
4
  import 'rolldown';
5
5
  import 'tsdown';
6
6
  import 'vite-plugin-performance';
7
7
  import 'vite-tsconfig-paths';
8
- import './types-D7SAXpSN.cjs';
8
+ import './types-3q1Qq6Fe.cjs';
9
9
  import 'p-queue';
10
10
  import 'package-manager-detector';
11
11
  import 'pkg-types';
package/dist/json.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
2
- export { a as defineAppJson, c as defineComponentJson, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-9I2A4BU9.js';
2
+ export { a as defineAppJson, c as defineComponentJson, b as definePageJson, e as defineSitemapJson, f as defineThemeJson } from './config-BMJAZP6e.js';
3
3
  import 'vite';
4
4
  import 'rolldown';
5
5
  import 'tsdown';
6
6
  import 'vite-plugin-performance';
7
7
  import 'vite-tsconfig-paths';
8
- import './types-D7SAXpSN.js';
8
+ import './types-3q1Qq6Fe.js';
9
9
  import 'p-queue';
10
10
  import 'package-manager-detector';
11
11
  import 'pkg-types';
@@ -2,7 +2,13 @@ interface ResolvedValue {
2
2
  name: string;
3
3
  from: string;
4
4
  }
5
- type Resolver = (componentName: string, baseName: string) => ResolvedValue | void;
5
+ interface Resolver {
6
+ (componentName: string, baseName: string): ResolvedValue | void;
7
+ /**
8
+ * 解析器静态可用的组件映射
9
+ */
10
+ components?: Record<string, string>;
11
+ }
6
12
  interface ResolveOptions {
7
13
  name: string;
8
14
  prefix: string;
@@ -2,7 +2,13 @@ interface ResolvedValue {
2
2
  name: string;
3
3
  from: string;
4
4
  }
5
- type Resolver = (componentName: string, baseName: string) => ResolvedValue | void;
5
+ interface Resolver {
6
+ (componentName: string, baseName: string): ResolvedValue | void;
7
+ /**
8
+ * 解析器静态可用的组件映射
9
+ */
10
+ components?: Record<string, string>;
11
+ }
6
12
  interface ResolveOptions {
7
13
  name: string;
8
14
  prefix: string;
package/dist/types.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as CompilerContext } from './config-CEyL0Mum.cjs';
2
- export { A as Alias, g as AliasOptions, K as AppEntry, v as AutoImportComponents, I as BaseEntry, B as BuildNpmPackageMeta, O as ComponentEntry, F as ComponentsMap, u as CopyGlobs, t as CopyOptions, x as EnhanceOptions, E as EnhanceWxmlOptions, J as Entry, Q as EntryJsonFragment, h as GenerateDirsOptions, G as GenerateExtensionsOptions, j as GenerateFileType, i as GenerateFilenamesOptions, s as GenerateOptions, o as GenerateTemplate, k as GenerateTemplateContext, p as GenerateTemplateEntry, n as GenerateTemplateFactory, l as GenerateTemplateFileSource, m as GenerateTemplateInlineSource, q as GenerateTemplateScope, r as GenerateTemplatesConfig, H as HandleWxmlOptions, M as MpPlatform, N as PageEntry, P as ProjectConfig, R as ResolvedAlias, D as ScanComponentItem, w as ScanWxmlOptions, S as SubPackage, y as SubPackageMetaValue, U as UserConfig, W as WeappViteConfig, z as WxmlDep } from './config-CEyL0Mum.cjs';
1
+ import { C as CompilerContext } from './config-j03AZAws.cjs';
2
+ export { A as Alias, g as AliasOptions, K as AppEntry, v as AutoImportComponents, I as BaseEntry, B as BuildNpmPackageMeta, O as ComponentEntry, F as ComponentsMap, u as CopyGlobs, t as CopyOptions, x as EnhanceOptions, E as EnhanceWxmlOptions, J as Entry, Q as EntryJsonFragment, h as GenerateDirsOptions, G as GenerateExtensionsOptions, j as GenerateFileType, i as GenerateFilenamesOptions, s as GenerateOptions, o as GenerateTemplate, k as GenerateTemplateContext, p as GenerateTemplateEntry, n as GenerateTemplateFactory, l as GenerateTemplateFileSource, m as GenerateTemplateInlineSource, q as GenerateTemplateScope, r as GenerateTemplatesConfig, H as HandleWxmlOptions, M as MpPlatform, N as PageEntry, P as ProjectConfig, R as ResolvedAlias, D as ScanComponentItem, w as ScanWxmlOptions, S as SubPackage, y as SubPackageMetaValue, U as UserConfig, W as WeappViteConfig, z as WxmlDep } from './config-j03AZAws.cjs';
3
3
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
4
4
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
5
- export { R as Resolver } from './types-D7SAXpSN.cjs';
5
+ export { R as Resolver } from './types-3q1Qq6Fe.cjs';
6
6
  export { Options as NpmBuildOptions } from 'tsdown';
7
7
  import '@weapp-core/schematics';
8
8
  import 'vite-plugin-performance';
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as CompilerContext } from './config-9I2A4BU9.js';
2
- export { A as Alias, g as AliasOptions, K as AppEntry, v as AutoImportComponents, I as BaseEntry, B as BuildNpmPackageMeta, O as ComponentEntry, F as ComponentsMap, u as CopyGlobs, t as CopyOptions, x as EnhanceOptions, E as EnhanceWxmlOptions, J as Entry, Q as EntryJsonFragment, h as GenerateDirsOptions, G as GenerateExtensionsOptions, j as GenerateFileType, i as GenerateFilenamesOptions, s as GenerateOptions, o as GenerateTemplate, k as GenerateTemplateContext, p as GenerateTemplateEntry, n as GenerateTemplateFactory, l as GenerateTemplateFileSource, m as GenerateTemplateInlineSource, q as GenerateTemplateScope, r as GenerateTemplatesConfig, H as HandleWxmlOptions, M as MpPlatform, N as PageEntry, P as ProjectConfig, R as ResolvedAlias, D as ScanComponentItem, w as ScanWxmlOptions, S as SubPackage, y as SubPackageMetaValue, U as UserConfig, W as WeappViteConfig, z as WxmlDep } from './config-9I2A4BU9.js';
1
+ import { C as CompilerContext } from './config-BMJAZP6e.js';
2
+ export { A as Alias, g as AliasOptions, K as AppEntry, v as AutoImportComponents, I as BaseEntry, B as BuildNpmPackageMeta, O as ComponentEntry, F as ComponentsMap, u as CopyGlobs, t as CopyOptions, x as EnhanceOptions, E as EnhanceWxmlOptions, J as Entry, Q as EntryJsonFragment, h as GenerateDirsOptions, G as GenerateExtensionsOptions, j as GenerateFileType, i as GenerateFilenamesOptions, s as GenerateOptions, o as GenerateTemplate, k as GenerateTemplateContext, p as GenerateTemplateEntry, n as GenerateTemplateFactory, l as GenerateTemplateFileSource, m as GenerateTemplateInlineSource, q as GenerateTemplateScope, r as GenerateTemplatesConfig, H as HandleWxmlOptions, M as MpPlatform, N as PageEntry, P as ProjectConfig, R as ResolvedAlias, D as ScanComponentItem, w as ScanWxmlOptions, S as SubPackage, y as SubPackageMetaValue, U as UserConfig, W as WeappViteConfig, z as WxmlDep } from './config-BMJAZP6e.js';
3
3
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
4
4
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
5
- export { R as Resolver } from './types-D7SAXpSN.js';
5
+ export { R as Resolver } from './types-3q1Qq6Fe.js';
6
6
  export { Options as NpmBuildOptions } from 'tsdown';
7
7
  import '@weapp-core/schematics';
8
8
  import 'vite-plugin-performance';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "5.2.3",
4
+ "version": "5.3.0",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -98,9 +98,9 @@
98
98
  "vite": "npm:rolldown-vite@^7.1.16",
99
99
  "vite-tsconfig-paths": "^5.1.4",
100
100
  "@weapp-core/init": "3.0.1",
101
- "@weapp-core/schematics": "4.0.0",
102
101
  "@weapp-core/logger": "2.0.0",
103
102
  "@weapp-core/shared": "2.0.1",
103
+ "@weapp-core/schematics": "4.0.0",
104
104
  "@weapp-vite/volar": "0.0.1",
105
105
  "rolldown-require": "1.0.3",
106
106
  "vite-plugin-performance": "1.0.0",