ebuilds-shared 0.2.0 → 0.2.1

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.
@@ -194,7 +194,7 @@ var hmrCache = /* @__PURE__ */ new Map();
194
194
  var prevCache = /* @__PURE__ */ new Map();
195
195
  function createDescriptor(filename, source, {
196
196
  root,
197
- isProduction,
197
+ isProduction: isProduction2,
198
198
  sourceMap,
199
199
  compiler,
200
200
  template,
@@ -215,11 +215,11 @@ function createDescriptor(filename, source, {
215
215
  descriptor.id = componentIdGenerator(
216
216
  normalizedPath,
217
217
  source,
218
- isProduction,
218
+ isProduction2,
219
219
  getHash
220
220
  );
221
221
  } else {
222
- descriptor.id = getHash(normalizedPath + (isProduction ? source : ""));
222
+ descriptor.id = getHash(normalizedPath + (isProduction2 ? source : ""));
223
223
  }
224
224
  (hmr ? hmrCache : cache).set(filename, descriptor);
225
225
  return { descriptor, errors };
@@ -288,12 +288,12 @@ var hash = (
288
288
  function getHash(text) {
289
289
  return hash("sha256", text, "hex").substring(0, 8);
290
290
  }
291
- function slash(path3) {
292
- const isExtendedLengthPath = path3.startsWith("\\\\?\\");
291
+ function slash(path4) {
292
+ const isExtendedLengthPath = path4.startsWith("\\\\?\\");
293
293
  if (isExtendedLengthPath) {
294
- return path3;
294
+ return path4;
295
295
  }
296
- return path3.replace(/\\/g, "/");
296
+ return path4.replace(/\\/g, "/");
297
297
  }
298
298
  function createRollupError(id, error) {
299
299
  const { message, name, stack } = error;
@@ -730,16 +730,16 @@ function parseAbsoluteUrl(input) {
730
730
  }
731
731
  function parseFileUrl(input) {
732
732
  const match = fileRegex.exec(input);
733
- const path3 = match[2];
734
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path3) ? path3 : "/" + path3, match[3] || "", match[4] || "");
733
+ const path4 = match[2];
734
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
735
735
  }
736
- function makeUrl(scheme, user, host, port, path3, query, hash2) {
736
+ function makeUrl(scheme, user, host, port, path4, query, hash2) {
737
737
  return {
738
738
  scheme,
739
739
  user,
740
740
  host,
741
741
  port,
742
- path: path3,
742
+ path: path4,
743
743
  query,
744
744
  hash: hash2,
745
745
  type: 7
@@ -769,11 +769,11 @@ function parseUrl(input) {
769
769
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
770
770
  return url;
771
771
  }
772
- function stripPathFilename(path3) {
773
- if (path3.endsWith("/.."))
774
- return path3;
775
- const index = path3.lastIndexOf("/");
776
- return path3.slice(0, index + 1);
772
+ function stripPathFilename(path4) {
773
+ if (path4.endsWith("/.."))
774
+ return path4;
775
+ const index = path4.lastIndexOf("/");
776
+ return path4.slice(0, index + 1);
777
777
  }
778
778
  function mergePaths(url, base) {
779
779
  normalizePath(base, base.type);
@@ -811,14 +811,14 @@ function normalizePath(url, type) {
811
811
  pieces[pointer++] = piece;
812
812
  positive++;
813
813
  }
814
- let path3 = "";
814
+ let path4 = "";
815
815
  for (let i = 1; i < pointer; i++) {
816
- path3 += "/" + pieces[i];
816
+ path4 += "/" + pieces[i];
817
817
  }
818
- if (!path3 || addTrailingSlash && !path3.endsWith("/..")) {
819
- path3 += "/";
818
+ if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
819
+ path4 += "/";
820
820
  }
821
- url.path = path3;
821
+ url.path = path4;
822
822
  }
823
823
  function resolve$1(input, base) {
824
824
  if (!input && !base)
@@ -859,13 +859,13 @@ function resolve$1(input, base) {
859
859
  case 3:
860
860
  return queryHash;
861
861
  case 4: {
862
- const path3 = url.path.slice(1);
863
- if (!path3)
862
+ const path4 = url.path.slice(1);
863
+ if (!path4)
864
864
  return queryHash || ".";
865
- if (isRelative(base || input) && !isRelative(path3)) {
866
- return "./" + path3 + queryHash;
865
+ if (isRelative(base || input) && !isRelative(path4)) {
866
+ return "./" + path4 + queryHash;
867
867
  }
868
- return path3 + queryHash;
868
+ return path4 + queryHash;
869
869
  }
870
870
  case 5:
871
871
  return url.path + queryHash;
@@ -878,11 +878,11 @@ function resolve(input, base) {
878
878
  base += "/";
879
879
  return resolve$1(input, base);
880
880
  }
881
- function stripFilename(path3) {
882
- if (!path3)
881
+ function stripFilename(path4) {
882
+ if (!path4)
883
883
  return "";
884
- const index = path3.lastIndexOf("/");
885
- return path3.slice(0, index + 1);
884
+ const index = path4.lastIndexOf("/");
885
+ return path4.slice(0, index + 1);
886
886
  }
887
887
  var COLUMN$1 = 0;
888
888
  function maybeSort(mappings, owned) {
@@ -2005,7 +2005,7 @@ export default (sfc, props) => {
2005
2005
  }
2006
2006
  `;
2007
2007
  async function transformMain(code, filename, options, pluginContext, ssr, customElement) {
2008
- const { devServer, isProduction, devToolsEnabled } = options;
2008
+ const { devServer, isProduction: isProduction2, devToolsEnabled } = options;
2009
2009
  const prevDescriptor = getPrevDescriptor(filename);
2010
2010
  const { descriptor, errors } = createDescriptor(filename, code, options);
2011
2011
  if (fs.existsSync(filename)) {
@@ -2075,13 +2075,13 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
2075
2075
  if (hasScoped) {
2076
2076
  attachedProps.push([`__scopeId`, JSON.stringify(`data-v-${descriptor.id}`)]);
2077
2077
  }
2078
- if (devToolsEnabled || devServer && !isProduction) {
2078
+ if (devToolsEnabled || devServer && !isProduction2) {
2079
2079
  attachedProps.push([
2080
2080
  `__file`,
2081
- JSON.stringify(isProduction ? path.basename(filename) : filename)
2081
+ JSON.stringify(isProduction2 ? path.basename(filename) : filename)
2082
2082
  ]);
2083
2083
  }
2084
- if (devServer && devServer.config.server.hmr !== false && !ssr && !isProduction) {
2084
+ if (devServer && devServer.config.server.hmr !== false && !ssr && !isProduction2) {
2085
2085
  output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`);
2086
2086
  output.push(
2087
2087
  `typeof __VUE_HMR_RUNTIME__ !== 'undefined' && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
@@ -2799,7 +2799,7 @@ function convertProxyConfig(data, replaceFunction) {
2799
2799
  // 启用origin头修改
2800
2800
  secure: false,
2801
2801
  // 路径重写:移除请求路径中的统一前缀(如/api)
2802
- rewrite: replaceFunction || ((path3) => path3.replace(new RegExp(`${dev_prefix}`), ""))
2802
+ rewrite: replaceFunction || ((path4) => path4.replace(new RegExp(`${dev_prefix}`), ""))
2803
2803
  };
2804
2804
  }
2805
2805
  return result;
@@ -2822,30 +2822,66 @@ function server_default(devPort = 5e3, proxyConfig, baseUrl = "/") {
2822
2822
  }
2823
2823
 
2824
2824
  // src/vite-config/build/index.ts
2825
+ import path3 from "path";
2826
+ var isProduction = process.env.NODE_ENV === "production";
2825
2827
  var build_default = {
2826
2828
  /** 构建配置:设置 chunk 体积警告阈值为 1.5MB */
2827
- // minify: false, // 禁用代码压缩
2828
- sourcemap: true,
2829
+ minify: isProduction ? "esbuild" : false,
2830
+ // 禁用代码压缩
2831
+ esbuild: isProduction ? {
2832
+ drop: ["console", "debugger"],
2833
+ // 生产环境移除 console/debugger
2834
+ pure: ["console.log", "debugger"]
2835
+ // 标记纯函数,进一步压缩
2836
+ } : void 0,
2837
+ sourcemap: isProduction ? "hidden-source-map" : true,
2829
2838
  // 生成源映射文件
2830
2839
  chunkSizeWarningLimit: 1500,
2840
+ // 构建性能优化:启用缓存、指定目标环境
2841
+ cacheDir: path3.resolve(__dirname, "node_modules/.vite-cache"),
2842
+ // 缓存构建产物
2843
+ target: isProduction ? ["es2020", "chrome89", "safari14"] : "esnext",
2844
+ // 生产环境适配主流浏览器
2845
+ // Tree-Shaking 优化:强制开启生产环境 Tree-Shaking
2846
+ treeshake: isProduction ? { moduleSideEffects: false } : true,
2831
2847
  rollupOptions: {
2832
2848
  output: {
2833
2849
  /**
2834
- * 自定义模块分包策略
2835
- * @param id - 模块的完整路径
2850
+ * 优化分包策略:
2851
+ * 1. 大依赖(>100KB)单独分包
2852
+ * 2. 小依赖合并到 vendor,减少 chunk 数量
2853
+ * 3. 避免重复分包
2836
2854
  */
2837
2855
  manualChunks(id) {
2838
2856
  if (id.includes("node_modules")) {
2839
- if (id.includes("lodash")) return "lodash";
2840
- if (id.includes("moment")) return "moment";
2841
- if (id.includes("unocss")) return "unocss";
2857
+ const moduleName = id.split("node_modules/")[1]?.split("/")[0] || "";
2858
+ const largeDeps = ["lodash", "moment", "unocss", "axios", "echarts"];
2859
+ if (largeDeps.includes(moduleName)) {
2860
+ return `vendor-${moduleName}`;
2861
+ }
2842
2862
  return "vendor";
2843
2863
  }
2864
+ if (id.includes("src/views/")) {
2865
+ const viewName = id.split("src/views/")[1]?.split("/")[0] || "views";
2866
+ return `page-${viewName}`;
2867
+ }
2844
2868
  },
2845
2869
  /** 入口文件命名规则:js目录/入口名.8位哈希.js */
2846
- entryFileNames: `js/[name].[hash:8].js`,
2847
- /** 静态资源文件命名规则:按类型目录/原名.8位哈希.扩展名 */
2848
- assetFileNames: `[ext]/[name].[hash:8].[ext]`,
2870
+ entryFileNames: `js/[name].[contenthash:8].js`,
2871
+ // 静态资源命名:图片/字体/CSS 按类型分类
2872
+ assetFileNames: (assetInfo) => {
2873
+ const ext = assetInfo.name?.split(".").pop() || "";
2874
+ if (["png", "jpg", "jpeg", "gif", "svg", "webp"].includes(ext)) {
2875
+ return `images/[name].[contenthash:8].[ext]`;
2876
+ }
2877
+ if (["woff", "woff2", "ttf", "eot"].includes(ext)) {
2878
+ return `fonts/[name].[contenthash:8].[ext]`;
2879
+ }
2880
+ if (ext === "css") {
2881
+ return `css/[name].[contenthash:8].[ext]`;
2882
+ }
2883
+ return `assets/[name].[contenthash:8].[ext]`;
2884
+ },
2849
2885
  /**
2850
2886
  * 非入口 chunk 文件命名规则
2851
2887
  * @param chunkInfo - 包含 chunk 元信息的配置对象
@@ -2853,9 +2889,14 @@ var build_default = {
2853
2889
  */
2854
2890
  chunkFileNames: (chunkInfo) => {
2855
2891
  const modulePath = chunkInfo.facadeModuleId?.split("/") || [];
2856
- const fileName = modulePath[modulePath.length - 2] || "[name]";
2857
- return `js/${fileName}/[name].[hash:8].js`;
2858
- }
2892
+ const fileName = modulePath[modulePath.length - 3] || modulePath[modulePath.length - 2] || "[name]";
2893
+ return `js/${fileName}/[name].[contenthash:8].js`;
2894
+ },
2895
+ // 启用代码分割优化:保留模块结构,减少冗余
2896
+ preserveModules: !isProduction,
2897
+ // 开发环境保留模块结构,生产环境合并
2898
+ preserveModulesRoot: "src"
2899
+ // 保留 src 目录结构
2859
2900
  }
2860
2901
  }
2861
2902
  };
@@ -194,7 +194,7 @@ var hmrCache = /* @__PURE__ */ new Map();
194
194
  var prevCache = /* @__PURE__ */ new Map();
195
195
  function createDescriptor(filename, source, {
196
196
  root,
197
- isProduction,
197
+ isProduction: isProduction2,
198
198
  sourceMap,
199
199
  compiler,
200
200
  template,
@@ -215,11 +215,11 @@ function createDescriptor(filename, source, {
215
215
  descriptor.id = componentIdGenerator(
216
216
  normalizedPath,
217
217
  source,
218
- isProduction,
218
+ isProduction2,
219
219
  getHash
220
220
  );
221
221
  } else {
222
- descriptor.id = getHash(normalizedPath + (isProduction ? source : ""));
222
+ descriptor.id = getHash(normalizedPath + (isProduction2 ? source : ""));
223
223
  }
224
224
  (hmr ? hmrCache : cache).set(filename, descriptor);
225
225
  return { descriptor, errors };
@@ -288,12 +288,12 @@ var hash = (
288
288
  function getHash(text) {
289
289
  return hash("sha256", text, "hex").substring(0, 8);
290
290
  }
291
- function slash(path3) {
292
- const isExtendedLengthPath = path3.startsWith("\\\\?\\");
291
+ function slash(path4) {
292
+ const isExtendedLengthPath = path4.startsWith("\\\\?\\");
293
293
  if (isExtendedLengthPath) {
294
- return path3;
294
+ return path4;
295
295
  }
296
- return path3.replace(/\\/g, "/");
296
+ return path4.replace(/\\/g, "/");
297
297
  }
298
298
  function createRollupError(id, error) {
299
299
  const { message, name, stack } = error;
@@ -730,16 +730,16 @@ function parseAbsoluteUrl(input) {
730
730
  }
731
731
  function parseFileUrl(input) {
732
732
  const match = fileRegex.exec(input);
733
- const path3 = match[2];
734
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path3) ? path3 : "/" + path3, match[3] || "", match[4] || "");
733
+ const path4 = match[2];
734
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
735
735
  }
736
- function makeUrl(scheme, user, host, port, path3, query, hash2) {
736
+ function makeUrl(scheme, user, host, port, path4, query, hash2) {
737
737
  return {
738
738
  scheme,
739
739
  user,
740
740
  host,
741
741
  port,
742
- path: path3,
742
+ path: path4,
743
743
  query,
744
744
  hash: hash2,
745
745
  type: 7
@@ -769,11 +769,11 @@ function parseUrl(input) {
769
769
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
770
770
  return url;
771
771
  }
772
- function stripPathFilename(path3) {
773
- if (path3.endsWith("/.."))
774
- return path3;
775
- const index = path3.lastIndexOf("/");
776
- return path3.slice(0, index + 1);
772
+ function stripPathFilename(path4) {
773
+ if (path4.endsWith("/.."))
774
+ return path4;
775
+ const index = path4.lastIndexOf("/");
776
+ return path4.slice(0, index + 1);
777
777
  }
778
778
  function mergePaths(url, base) {
779
779
  normalizePath(base, base.type);
@@ -811,14 +811,14 @@ function normalizePath(url, type) {
811
811
  pieces[pointer++] = piece;
812
812
  positive++;
813
813
  }
814
- let path3 = "";
814
+ let path4 = "";
815
815
  for (let i = 1; i < pointer; i++) {
816
- path3 += "/" + pieces[i];
816
+ path4 += "/" + pieces[i];
817
817
  }
818
- if (!path3 || addTrailingSlash && !path3.endsWith("/..")) {
819
- path3 += "/";
818
+ if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
819
+ path4 += "/";
820
820
  }
821
- url.path = path3;
821
+ url.path = path4;
822
822
  }
823
823
  function resolve$1(input, base) {
824
824
  if (!input && !base)
@@ -859,13 +859,13 @@ function resolve$1(input, base) {
859
859
  case 3:
860
860
  return queryHash;
861
861
  case 4: {
862
- const path3 = url.path.slice(1);
863
- if (!path3)
862
+ const path4 = url.path.slice(1);
863
+ if (!path4)
864
864
  return queryHash || ".";
865
- if (isRelative(base || input) && !isRelative(path3)) {
866
- return "./" + path3 + queryHash;
865
+ if (isRelative(base || input) && !isRelative(path4)) {
866
+ return "./" + path4 + queryHash;
867
867
  }
868
- return path3 + queryHash;
868
+ return path4 + queryHash;
869
869
  }
870
870
  case 5:
871
871
  return url.path + queryHash;
@@ -878,11 +878,11 @@ function resolve(input, base) {
878
878
  base += "/";
879
879
  return resolve$1(input, base);
880
880
  }
881
- function stripFilename(path3) {
882
- if (!path3)
881
+ function stripFilename(path4) {
882
+ if (!path4)
883
883
  return "";
884
- const index = path3.lastIndexOf("/");
885
- return path3.slice(0, index + 1);
884
+ const index = path4.lastIndexOf("/");
885
+ return path4.slice(0, index + 1);
886
886
  }
887
887
  var COLUMN$1 = 0;
888
888
  function maybeSort(mappings, owned) {
@@ -2005,7 +2005,7 @@ export default (sfc, props) => {
2005
2005
  }
2006
2006
  `;
2007
2007
  async function transformMain(code, filename, options, pluginContext, ssr, customElement) {
2008
- const { devServer, isProduction, devToolsEnabled } = options;
2008
+ const { devServer, isProduction: isProduction2, devToolsEnabled } = options;
2009
2009
  const prevDescriptor = getPrevDescriptor(filename);
2010
2010
  const { descriptor, errors } = createDescriptor(filename, code, options);
2011
2011
  if (_fs2.default.existsSync(filename)) {
@@ -2075,13 +2075,13 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
2075
2075
  if (hasScoped) {
2076
2076
  attachedProps.push([`__scopeId`, JSON.stringify(`data-v-${descriptor.id}`)]);
2077
2077
  }
2078
- if (devToolsEnabled || devServer && !isProduction) {
2078
+ if (devToolsEnabled || devServer && !isProduction2) {
2079
2079
  attachedProps.push([
2080
2080
  `__file`,
2081
- JSON.stringify(isProduction ? _path2.default.basename(filename) : filename)
2081
+ JSON.stringify(isProduction2 ? _path2.default.basename(filename) : filename)
2082
2082
  ]);
2083
2083
  }
2084
- if (devServer && devServer.config.server.hmr !== false && !ssr && !isProduction) {
2084
+ if (devServer && devServer.config.server.hmr !== false && !ssr && !isProduction2) {
2085
2085
  output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`);
2086
2086
  output.push(
2087
2087
  `typeof __VUE_HMR_RUNTIME__ !== 'undefined' && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
@@ -2799,7 +2799,7 @@ function convertProxyConfig(data, replaceFunction) {
2799
2799
  // 启用origin头修改
2800
2800
  secure: false,
2801
2801
  // 路径重写:移除请求路径中的统一前缀(如/api)
2802
- rewrite: replaceFunction || ((path3) => path3.replace(new RegExp(`${dev_prefix}`), ""))
2802
+ rewrite: replaceFunction || ((path4) => path4.replace(new RegExp(`${dev_prefix}`), ""))
2803
2803
  };
2804
2804
  }
2805
2805
  return result;
@@ -2822,40 +2822,81 @@ function server_default(devPort = 5e3, proxyConfig, baseUrl = "/") {
2822
2822
  }
2823
2823
 
2824
2824
  // src/vite-config/build/index.ts
2825
+
2826
+ var isProduction = process.env.NODE_ENV === "production";
2825
2827
  var build_default = {
2826
2828
  /** 构建配置:设置 chunk 体积警告阈值为 1.5MB */
2827
- // minify: false, // 禁用代码压缩
2828
- sourcemap: true,
2829
+ minify: isProduction ? "esbuild" : false,
2830
+ // 禁用代码压缩
2831
+ esbuild: isProduction ? {
2832
+ drop: ["console", "debugger"],
2833
+ // 生产环境移除 console/debugger
2834
+ pure: ["console.log", "debugger"]
2835
+ // 标记纯函数,进一步压缩
2836
+ } : void 0,
2837
+ sourcemap: isProduction ? "hidden-source-map" : true,
2829
2838
  // 生成源映射文件
2830
2839
  chunkSizeWarningLimit: 1500,
2840
+ // 构建性能优化:启用缓存、指定目标环境
2841
+ cacheDir: _path2.default.resolve(__dirname, "node_modules/.vite-cache"),
2842
+ // 缓存构建产物
2843
+ target: isProduction ? ["es2020", "chrome89", "safari14"] : "esnext",
2844
+ // 生产环境适配主流浏览器
2845
+ // Tree-Shaking 优化:强制开启生产环境 Tree-Shaking
2846
+ treeshake: isProduction ? { moduleSideEffects: false } : true,
2831
2847
  rollupOptions: {
2832
2848
  output: {
2833
2849
  /**
2834
- * 自定义模块分包策略
2835
- * @param id - 模块的完整路径
2850
+ * 优化分包策略:
2851
+ * 1. 大依赖(>100KB)单独分包
2852
+ * 2. 小依赖合并到 vendor,减少 chunk 数量
2853
+ * 3. 避免重复分包
2836
2854
  */
2837
2855
  manualChunks(id) {
2838
2856
  if (id.includes("node_modules")) {
2839
- if (id.includes("lodash")) return "lodash";
2840
- if (id.includes("moment")) return "moment";
2841
- if (id.includes("unocss")) return "unocss";
2857
+ const moduleName = _optionalChain([id, 'access', _99 => _99.split, 'call', _100 => _100("node_modules/"), 'access', _101 => _101[1], 'optionalAccess', _102 => _102.split, 'call', _103 => _103("/"), 'access', _104 => _104[0]]) || "";
2858
+ const largeDeps = ["lodash", "moment", "unocss", "axios", "echarts"];
2859
+ if (largeDeps.includes(moduleName)) {
2860
+ return `vendor-${moduleName}`;
2861
+ }
2842
2862
  return "vendor";
2843
2863
  }
2864
+ if (id.includes("src/views/")) {
2865
+ const viewName = _optionalChain([id, 'access', _105 => _105.split, 'call', _106 => _106("src/views/"), 'access', _107 => _107[1], 'optionalAccess', _108 => _108.split, 'call', _109 => _109("/"), 'access', _110 => _110[0]]) || "views";
2866
+ return `page-${viewName}`;
2867
+ }
2844
2868
  },
2845
2869
  /** 入口文件命名规则:js目录/入口名.8位哈希.js */
2846
- entryFileNames: `js/[name].[hash:8].js`,
2847
- /** 静态资源文件命名规则:按类型目录/原名.8位哈希.扩展名 */
2848
- assetFileNames: `[ext]/[name].[hash:8].[ext]`,
2870
+ entryFileNames: `js/[name].[contenthash:8].js`,
2871
+ // 静态资源命名:图片/字体/CSS 按类型分类
2872
+ assetFileNames: (assetInfo) => {
2873
+ const ext = _optionalChain([assetInfo, 'access', _111 => _111.name, 'optionalAccess', _112 => _112.split, 'call', _113 => _113("."), 'access', _114 => _114.pop, 'call', _115 => _115()]) || "";
2874
+ if (["png", "jpg", "jpeg", "gif", "svg", "webp"].includes(ext)) {
2875
+ return `images/[name].[contenthash:8].[ext]`;
2876
+ }
2877
+ if (["woff", "woff2", "ttf", "eot"].includes(ext)) {
2878
+ return `fonts/[name].[contenthash:8].[ext]`;
2879
+ }
2880
+ if (ext === "css") {
2881
+ return `css/[name].[contenthash:8].[ext]`;
2882
+ }
2883
+ return `assets/[name].[contenthash:8].[ext]`;
2884
+ },
2849
2885
  /**
2850
2886
  * 非入口 chunk 文件命名规则
2851
2887
  * @param chunkInfo - 包含 chunk 元信息的配置对象
2852
2888
  * @returns {string} 基于父级目录结构的文件路径
2853
2889
  */
2854
2890
  chunkFileNames: (chunkInfo) => {
2855
- const modulePath = _optionalChain([chunkInfo, 'access', _99 => _99.facadeModuleId, 'optionalAccess', _100 => _100.split, 'call', _101 => _101("/")]) || [];
2856
- const fileName = modulePath[modulePath.length - 2] || "[name]";
2857
- return `js/${fileName}/[name].[hash:8].js`;
2858
- }
2891
+ const modulePath = _optionalChain([chunkInfo, 'access', _116 => _116.facadeModuleId, 'optionalAccess', _117 => _117.split, 'call', _118 => _118("/")]) || [];
2892
+ const fileName = modulePath[modulePath.length - 3] || modulePath[modulePath.length - 2] || "[name]";
2893
+ return `js/${fileName}/[name].[contenthash:8].js`;
2894
+ },
2895
+ // 启用代码分割优化:保留模块结构,减少冗余
2896
+ preserveModules: !isProduction,
2897
+ // 开发环境保留模块结构,生产环境合并
2898
+ preserveModulesRoot: "src"
2899
+ // 保留 src 目录结构
2859
2900
  }
2860
2901
  }
2861
2902
  };
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var _chunkZIUN3ZQAjs = require('./chunk-ZIUN3ZQA.js');
32
32
  var _chunkWGOU4SV3js = require('./chunk-WGOU4SV3.js');
33
33
 
34
34
 
35
- var _chunk3UCTPVIZjs = require('./chunk-3UCTPVIZ.js');
35
+ var _chunkMNVJK77Mjs = require('./chunk-MNVJK77M.js');
36
36
  require('./chunk-QGM4M3NI.js');
37
37
 
38
38
 
@@ -64,4 +64,4 @@ require('./chunk-QGM4M3NI.js');
64
64
 
65
65
 
66
66
 
67
- exports.clamp = _chunkWGOU4SV3js.clamp; exports.createBaseViteConfig = _chunk3UCTPVIZjs.createBaseViteConfig; exports.createFunctionalComponent = _chunkWGOU4SV3js.createFunctionalComponent; exports.createUnoConfig = _chunkZIUN3ZQAjs.createUnoConfig; exports.duplicateRemovalCompleteSort = _chunkWGOU4SV3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunkWGOU4SV3js.encryptPwd; exports.filterMenu = _chunkWGOU4SV3js.filterMenu; exports.formatNumber = _chunkWGOU4SV3js.formatNumber; exports.getDecimalPart = _chunkWGOU4SV3js.getDecimalPart; exports.getIntegerPart = _chunkWGOU4SV3js.getIntegerPart; exports.isInteger = _chunkWGOU4SV3js.isInteger; exports.isNumber = _chunkWGOU4SV3js.isNumber; exports.jsonp = _chunkWGOU4SV3js.jsonp; exports.listSort = _chunkWGOU4SV3js.listSort; exports.numberToChinese = _chunkWGOU4SV3js.numberToChinese; exports.padZero = _chunkWGOU4SV3js.padZero; exports.parseFormattedNumber = _chunkWGOU4SV3js.parseFormattedNumber; exports.prototypeInterceptor = _chunkWGOU4SV3js.prototypeInterceptor; exports.request = _chunkWGOU4SV3js.request; exports.roundOrTruncate = _chunkWGOU4SV3js.roundOrTruncate; exports.setupPermission = _chunkWGOU4SV3js.setupPermission; exports.store = _chunkWGOU4SV3js.store; exports.timeFix = _chunkWGOU4SV3js.timeFix; exports.updateDocumentTitle = _chunkWGOU4SV3js.updateDocumentTitle; exports.useCommonStore = _chunkWGOU4SV3js.useCommonStore; exports.useDbStore = _chunkWGOU4SV3js.useDbStore; exports.useLoginHook = _chunkWGOU4SV3js.useLoginHook; exports.useMenuStore = _chunkWGOU4SV3js.useMenuStore; exports.welcome = _chunkWGOU4SV3js.welcome;
67
+ exports.clamp = _chunkWGOU4SV3js.clamp; exports.createBaseViteConfig = _chunkMNVJK77Mjs.createBaseViteConfig; exports.createFunctionalComponent = _chunkWGOU4SV3js.createFunctionalComponent; exports.createUnoConfig = _chunkZIUN3ZQAjs.createUnoConfig; exports.duplicateRemovalCompleteSort = _chunkWGOU4SV3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunkWGOU4SV3js.encryptPwd; exports.filterMenu = _chunkWGOU4SV3js.filterMenu; exports.formatNumber = _chunkWGOU4SV3js.formatNumber; exports.getDecimalPart = _chunkWGOU4SV3js.getDecimalPart; exports.getIntegerPart = _chunkWGOU4SV3js.getIntegerPart; exports.isInteger = _chunkWGOU4SV3js.isInteger; exports.isNumber = _chunkWGOU4SV3js.isNumber; exports.jsonp = _chunkWGOU4SV3js.jsonp; exports.listSort = _chunkWGOU4SV3js.listSort; exports.numberToChinese = _chunkWGOU4SV3js.numberToChinese; exports.padZero = _chunkWGOU4SV3js.padZero; exports.parseFormattedNumber = _chunkWGOU4SV3js.parseFormattedNumber; exports.prototypeInterceptor = _chunkWGOU4SV3js.prototypeInterceptor; exports.request = _chunkWGOU4SV3js.request; exports.roundOrTruncate = _chunkWGOU4SV3js.roundOrTruncate; exports.setupPermission = _chunkWGOU4SV3js.setupPermission; exports.store = _chunkWGOU4SV3js.store; exports.timeFix = _chunkWGOU4SV3js.timeFix; exports.updateDocumentTitle = _chunkWGOU4SV3js.updateDocumentTitle; exports.useCommonStore = _chunkWGOU4SV3js.useCommonStore; exports.useDbStore = _chunkWGOU4SV3js.useDbStore; exports.useLoginHook = _chunkWGOU4SV3js.useLoginHook; exports.useMenuStore = _chunkWGOU4SV3js.useMenuStore; exports.welcome = _chunkWGOU4SV3js.welcome;
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  } from "./chunk-PTS5WW6S.mjs";
33
33
  import {
34
34
  createBaseViteConfig
35
- } from "./chunk-3GZJNH2K.mjs";
35
+ } from "./chunk-BRRQ7FAH.mjs";
36
36
  import "./chunk-6DZX6EAA.mjs";
37
37
  export {
38
38
  clamp,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk3UCTPVIZjs = require('../chunk-3UCTPVIZ.js');
3
+ var _chunkMNVJK77Mjs = require('../chunk-MNVJK77M.js');
4
4
  require('../chunk-QGM4M3NI.js');
5
5
 
6
6
 
7
- exports.createBaseViteConfig = _chunk3UCTPVIZjs.createBaseViteConfig;
7
+ exports.createBaseViteConfig = _chunkMNVJK77Mjs.createBaseViteConfig;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBaseViteConfig
3
- } from "../chunk-3GZJNH2K.mjs";
3
+ } from "../chunk-BRRQ7FAH.mjs";
4
4
  import "../chunk-6DZX6EAA.mjs";
5
5
  export {
6
6
  createBaseViteConfig
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.0",
6
+ "version": "0.2.1",
7
7
  "description": "共享工具库和类型定义",
8
8
  "author": "ebuilds",
9
9
  "license": "MIT",