ebuilds-shared 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZIUN3ZQA.js → chunk-3YUIFF3J.js} +0 -1
- package/dist/{chunk-DDLZE36T.mjs → chunk-H523LVQA.mjs} +0 -1
- package/dist/{chunk-3GZJNH2K.mjs → chunk-T4RPUVUI.mjs} +138 -80
- package/dist/{chunk-3UCTPVIZ.js → chunk-XXY3WATJ.js} +138 -80
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/uno-config/index.js +2 -2
- package/dist/uno-config/index.mjs +1 -1
- package/dist/vite-config/index.js +2 -2
- package/dist/vite-config/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -56,7 +56,6 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
|
56
56
|
var LIB_ROOT_DIR = _path2.default.resolve(__dirname, ".");
|
|
57
57
|
var COMMON_ICONS_DIR = _path2.default.join(LIB_ROOT_DIR, "icons");
|
|
58
58
|
function createUnoConfig(iconCollections) {
|
|
59
|
-
console.log("createUnoConfig", COMMON_ICONS_DIR);
|
|
60
59
|
return _unocss.defineConfig.call(void 0, {
|
|
61
60
|
presets: [
|
|
62
61
|
_unocss.presetUno.call(void 0, ),
|
|
@@ -56,7 +56,6 @@ import path from "path";
|
|
|
56
56
|
var LIB_ROOT_DIR = path.resolve(__dirname, ".");
|
|
57
57
|
var COMMON_ICONS_DIR = path.join(LIB_ROOT_DIR, "icons");
|
|
58
58
|
function createUnoConfig(iconCollections) {
|
|
59
|
-
console.log("createUnoConfig", COMMON_ICONS_DIR);
|
|
60
59
|
return defineConfig({
|
|
61
60
|
presets: [
|
|
62
61
|
presetUno(),
|
|
@@ -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(
|
|
292
|
-
const isExtendedLengthPath =
|
|
291
|
+
function slash(path4) {
|
|
292
|
+
const isExtendedLengthPath = path4.startsWith("\\\\?\\");
|
|
293
293
|
if (isExtendedLengthPath) {
|
|
294
|
-
return
|
|
294
|
+
return path4;
|
|
295
295
|
}
|
|
296
|
-
return
|
|
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
|
|
734
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
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,
|
|
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:
|
|
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(
|
|
773
|
-
if (
|
|
774
|
-
return
|
|
775
|
-
const index =
|
|
776
|
-
return
|
|
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
|
|
814
|
+
let path4 = "";
|
|
815
815
|
for (let i = 1; i < pointer; i++) {
|
|
816
|
-
|
|
816
|
+
path4 += "/" + pieces[i];
|
|
817
817
|
}
|
|
818
|
-
if (!
|
|
819
|
-
|
|
818
|
+
if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
|
|
819
|
+
path4 += "/";
|
|
820
820
|
}
|
|
821
|
-
url.path =
|
|
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
|
|
863
|
-
if (!
|
|
862
|
+
const path4 = url.path.slice(1);
|
|
863
|
+
if (!path4)
|
|
864
864
|
return queryHash || ".";
|
|
865
|
-
if (isRelative(base || input) && !isRelative(
|
|
866
|
-
return "./" +
|
|
865
|
+
if (isRelative(base || input) && !isRelative(path4)) {
|
|
866
|
+
return "./" + path4 + queryHash;
|
|
867
867
|
}
|
|
868
|
-
return
|
|
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(
|
|
882
|
-
if (!
|
|
881
|
+
function stripFilename(path4) {
|
|
882
|
+
if (!path4)
|
|
883
883
|
return "";
|
|
884
|
-
const index =
|
|
885
|
-
return
|
|
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) {
|
|
@@ -2522,7 +2522,7 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2522
2522
|
);
|
|
2523
2523
|
}
|
|
2524
2524
|
},
|
|
2525
|
-
config(
|
|
2525
|
+
config(config2) {
|
|
2526
2526
|
const parseDefine = (v) => {
|
|
2527
2527
|
try {
|
|
2528
2528
|
return typeof v === "string" ? JSON.parse(v) : v;
|
|
@@ -2532,32 +2532,32 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2532
2532
|
};
|
|
2533
2533
|
return {
|
|
2534
2534
|
resolve: {
|
|
2535
|
-
dedupe:
|
|
2535
|
+
dedupe: config2.build?.ssr ? [] : ["vue"]
|
|
2536
2536
|
},
|
|
2537
2537
|
define: {
|
|
2538
|
-
__VUE_OPTIONS_API__: options.value.features?.optionsAPI ?? parseDefine(
|
|
2539
|
-
__VUE_PROD_DEVTOOLS__: (options.value.features?.prodDevtools || parseDefine(
|
|
2538
|
+
__VUE_OPTIONS_API__: options.value.features?.optionsAPI ?? parseDefine(config2.define?.__VUE_OPTIONS_API__) ?? true,
|
|
2539
|
+
__VUE_PROD_DEVTOOLS__: (options.value.features?.prodDevtools || parseDefine(config2.define?.__VUE_PROD_DEVTOOLS__)) ?? false,
|
|
2540
2540
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: (options.value.features?.prodHydrationMismatchDetails || parseDefine(
|
|
2541
|
-
|
|
2541
|
+
config2.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
|
|
2542
2542
|
)) ?? false
|
|
2543
2543
|
},
|
|
2544
2544
|
ssr: {
|
|
2545
2545
|
// @ts-ignore -- config.legacy.buildSsrCjsExternalHeuristics will be removed in Vite 5
|
|
2546
|
-
external:
|
|
2546
|
+
external: config2.legacy?.buildSsrCjsExternalHeuristics ? ["vue", "@vue/server-renderer"] : []
|
|
2547
2547
|
}
|
|
2548
2548
|
};
|
|
2549
2549
|
},
|
|
2550
|
-
configResolved(
|
|
2550
|
+
configResolved(config2) {
|
|
2551
2551
|
options.value = {
|
|
2552
2552
|
...options.value,
|
|
2553
|
-
root:
|
|
2554
|
-
sourceMap:
|
|
2555
|
-
cssDevSourcemap:
|
|
2556
|
-
isProduction:
|
|
2557
|
-
devToolsEnabled: !!(options.value.features?.prodDevtools ||
|
|
2553
|
+
root: config2.root,
|
|
2554
|
+
sourceMap: config2.command === "build" ? !!config2.build.sourcemap : true,
|
|
2555
|
+
cssDevSourcemap: config2.css?.devSourcemap ?? false,
|
|
2556
|
+
isProduction: config2.isProduction,
|
|
2557
|
+
devToolsEnabled: !!(options.value.features?.prodDevtools || config2.define.__VUE_PROD_DEVTOOLS__ || !config2.isProduction)
|
|
2558
2558
|
};
|
|
2559
|
-
const _warn =
|
|
2560
|
-
|
|
2559
|
+
const _warn = config2.logger.warn;
|
|
2560
|
+
config2.logger.warn = (...args) => {
|
|
2561
2561
|
const msg = args[0];
|
|
2562
2562
|
if (msg.match(
|
|
2563
2563
|
/\[lightningcss\] '(deep|slotted|global)' is not recognized as a valid pseudo-/
|
|
@@ -2566,7 +2566,7 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2566
2566
|
}
|
|
2567
2567
|
_warn(...args);
|
|
2568
2568
|
};
|
|
2569
|
-
transformCachedModule =
|
|
2569
|
+
transformCachedModule = config2.command === "build" && options.value.sourceMap && config2.build.watch != null;
|
|
2570
2570
|
},
|
|
2571
2571
|
shouldTransformCachedModule({ id }) {
|
|
2572
2572
|
if (transformCachedModule && parseVueRequest(id).query.vue) {
|
|
@@ -2799,7 +2799,7 @@ function convertProxyConfig(data, replaceFunction) {
|
|
|
2799
2799
|
// 启用origin头修改
|
|
2800
2800
|
secure: false,
|
|
2801
2801
|
// 路径重写:移除请求路径中的统一前缀(如/api)
|
|
2802
|
-
rewrite: replaceFunction || ((
|
|
2802
|
+
rewrite: replaceFunction || ((path4) => path4.replace(new RegExp(`${dev_prefix}`), ""))
|
|
2803
2803
|
};
|
|
2804
2804
|
}
|
|
2805
2805
|
return result;
|
|
@@ -2822,56 +2822,114 @@ function server_default(devPort = 5e3, proxyConfig, baseUrl = "/") {
|
|
|
2822
2822
|
}
|
|
2823
2823
|
|
|
2824
2824
|
// src/vite-config/build/index.ts
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2825
|
+
import path3 from "path";
|
|
2826
|
+
import { fileURLToPath } from "url";
|
|
2827
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
2828
|
+
var __dirname = path3.dirname(__filename);
|
|
2829
|
+
var config = (isProduction) => {
|
|
2830
|
+
return {
|
|
2831
|
+
/**
|
|
2832
|
+
* 1. 压缩配置
|
|
2833
|
+
* 使用 esbuild 进行压缩,速度极快。
|
|
2834
|
+
* legalComments: 'none' 可以移除注释,进一步减小体积。
|
|
2835
|
+
*/
|
|
2836
|
+
minify: isProduction ? "esbuild" : false,
|
|
2837
|
+
/** 2. Source Map 配置 */
|
|
2838
|
+
sourcemap: isProduction ? false : true,
|
|
2839
|
+
// 线上环境不生成 source map
|
|
2840
|
+
/** 3. 构建阈值优化 */
|
|
2841
|
+
chunkSizeWarningLimit: 1e3,
|
|
2842
|
+
// 建议调整为 1000KB,避免单个 chunk 过大影响首屏
|
|
2843
|
+
/** 4. 目标环境与缓存 */
|
|
2844
|
+
target: isProduction ? ["es2020", "chrome89", "edge88", "firefox78", "safari14"] : "esnext",
|
|
2845
|
+
/** 5. CSS 处理 */
|
|
2846
|
+
cssCodeSplit: true,
|
|
2847
|
+
// 启用 CSS 代码分割
|
|
2848
|
+
/** 6. 性能优化 */
|
|
2849
|
+
reportCompressedSize: false,
|
|
2850
|
+
// 关闭 gzip 体积计算,可小幅提升构建速度
|
|
2851
|
+
rollupOptions: {
|
|
2852
|
+
output: {
|
|
2853
|
+
/**
|
|
2854
|
+
* 优化分包策略:
|
|
2855
|
+
* 改进点:
|
|
2856
|
+
* 1. 使用正则匹配,更准确地提取 node_modules 中的包名。
|
|
2857
|
+
* 2. 引入 "framework" 概念,将基础框架与业务依赖分离,提升缓存命中率。
|
|
2858
|
+
* 3. UI 库通常较大,建议单独拆分。
|
|
2859
|
+
*/
|
|
2860
|
+
manualChunks(id) {
|
|
2861
|
+
const nodeModulesPath = path3.join(__dirname, "node_modules");
|
|
2862
|
+
if (id.includes(nodeModulesPath)) {
|
|
2863
|
+
const match = id.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/);
|
|
2864
|
+
const packageName = match ? match[1] : "";
|
|
2865
|
+
if (["vue", "react", "react-dom", "pinia", "vuex", "react-router-dom", "vue-router"].includes(packageName)) {
|
|
2866
|
+
return "framework";
|
|
2867
|
+
}
|
|
2868
|
+
if (["element-plus", "ant-design-vue", "arco-design", "antd", "@arco-design/web-vue"].includes(packageName)) {
|
|
2869
|
+
return "ui-lib";
|
|
2870
|
+
}
|
|
2871
|
+
if (["lodash-es", "lodash", "echarts", "moment", "axios", "three"].includes(packageName)) {
|
|
2872
|
+
return `lib-${packageName}`;
|
|
2873
|
+
}
|
|
2874
|
+
return "vendor";
|
|
2875
|
+
}
|
|
2876
|
+
if (id.includes("src/views/")) {
|
|
2877
|
+
const parts = id.split("src/views/");
|
|
2878
|
+
if (parts[1]) {
|
|
2879
|
+
const viewDir = parts[1].split("/")[0];
|
|
2880
|
+
return `page-${viewDir}`;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
},
|
|
2884
|
+
/** 入口文件命名规则:js目录/入口名.8位哈希.js */
|
|
2885
|
+
entryFileNames: `js/[name].[hash:8].js`,
|
|
2886
|
+
// 非入口 chunk 文件
|
|
2887
|
+
chunkFileNames: "js/[name].[hash:8].js",
|
|
2888
|
+
// 静态资源命名
|
|
2889
|
+
assetFileNames: (assetInfo) => {
|
|
2890
|
+
const ext = assetInfo.name?.split(".").pop() || "";
|
|
2891
|
+
if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "avif"].includes(ext)) {
|
|
2892
|
+
return `images/[name].[hash:8].[ext]`;
|
|
2893
|
+
}
|
|
2894
|
+
if (["woff", "woff2", "ttf", "eot", "otf"].includes(ext)) {
|
|
2895
|
+
return `fonts/[name].[hash:8].[ext]`;
|
|
2896
|
+
}
|
|
2897
|
+
if (["mp4", "webm", "ogg", "mp3", "wav", "flac"].includes(ext)) {
|
|
2898
|
+
return `media/[name].[hash:8].[ext]`;
|
|
2899
|
+
}
|
|
2900
|
+
if (ext === "css") {
|
|
2901
|
+
return `css/[name].[hash:8].[ext]`;
|
|
2902
|
+
}
|
|
2903
|
+
return `assets/[name].[hash:8].[ext]`;
|
|
2843
2904
|
}
|
|
2844
|
-
},
|
|
2845
|
-
/** 入口文件命名规则:js目录/入口名.8位哈希.js */
|
|
2846
|
-
entryFileNames: `js/[name].[hash:8].js`,
|
|
2847
|
-
/** 静态资源文件命名规则:按类型目录/原名.8位哈希.扩展名 */
|
|
2848
|
-
assetFileNames: `[ext]/[name].[hash:8].[ext]`,
|
|
2849
|
-
/**
|
|
2850
|
-
* 非入口 chunk 文件命名规则
|
|
2851
|
-
* @param chunkInfo - 包含 chunk 元信息的配置对象
|
|
2852
|
-
* @returns {string} 基于父级目录结构的文件路径
|
|
2853
|
-
*/
|
|
2854
|
-
chunkFileNames: (chunkInfo) => {
|
|
2855
|
-
const modulePath = chunkInfo.facadeModuleId?.split("/") || [];
|
|
2856
|
-
const fileName = modulePath[modulePath.length - 2] || "[name]";
|
|
2857
|
-
return `js/${fileName}/[name].[hash:8].js`;
|
|
2858
2905
|
}
|
|
2859
2906
|
}
|
|
2860
|
-
}
|
|
2907
|
+
};
|
|
2861
2908
|
};
|
|
2909
|
+
var build_default = config;
|
|
2862
2910
|
|
|
2863
2911
|
// src/vite-config/index.ts
|
|
2864
2912
|
function createBaseViteConfig(options) {
|
|
2865
|
-
return defineConfig((
|
|
2866
|
-
const env = loadEnv(
|
|
2867
|
-
const isDev =
|
|
2913
|
+
return defineConfig((config2) => {
|
|
2914
|
+
const env = loadEnv(config2.mode, process.cwd(), "VITE_");
|
|
2915
|
+
const isDev = config2.mode === "development";
|
|
2916
|
+
const isProd = config2.mode === "production";
|
|
2868
2917
|
const { port = 5e3, plugins = [], proxy, showDevTools = false, enableOptimizeDeps = true, baseUrl } = options;
|
|
2918
|
+
const buildConfig = build_default(isProd);
|
|
2869
2919
|
return {
|
|
2870
2920
|
plugins: createVitePlugins(plugins, showDevTools, isDev),
|
|
2871
2921
|
resolve: resolve_default,
|
|
2872
2922
|
base: env.VITE_APP_PUBLIC_URL || "",
|
|
2873
2923
|
server: server_default(port, proxy, baseUrl),
|
|
2874
|
-
build:
|
|
2924
|
+
build: buildConfig,
|
|
2925
|
+
esbuild: isProd ? {
|
|
2926
|
+
drop: ["console", "debugger"],
|
|
2927
|
+
legalComments: "none",
|
|
2928
|
+
// 移除注释中的版权信息等
|
|
2929
|
+
pure: ["console.log"]
|
|
2930
|
+
// 仅标记纯函数,配合 drop 使用
|
|
2931
|
+
} : void 0,
|
|
2932
|
+
treeshake: isProd ? { preset: "recommended" } : true,
|
|
2875
2933
|
optimizeDeps: {
|
|
2876
2934
|
include: enableOptimizeDeps ? ["vue", "vue-router", "pinia", "axios", "element-plus", "ant-design-vue", "echarts"] : []
|
|
2877
2935
|
}
|
|
@@ -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(
|
|
292
|
-
const isExtendedLengthPath =
|
|
291
|
+
function slash(path4) {
|
|
292
|
+
const isExtendedLengthPath = path4.startsWith("\\\\?\\");
|
|
293
293
|
if (isExtendedLengthPath) {
|
|
294
|
-
return
|
|
294
|
+
return path4;
|
|
295
295
|
}
|
|
296
|
-
return
|
|
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
|
|
734
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
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,
|
|
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:
|
|
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(
|
|
773
|
-
if (
|
|
774
|
-
return
|
|
775
|
-
const index =
|
|
776
|
-
return
|
|
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
|
|
814
|
+
let path4 = "";
|
|
815
815
|
for (let i = 1; i < pointer; i++) {
|
|
816
|
-
|
|
816
|
+
path4 += "/" + pieces[i];
|
|
817
817
|
}
|
|
818
|
-
if (!
|
|
819
|
-
|
|
818
|
+
if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
|
|
819
|
+
path4 += "/";
|
|
820
820
|
}
|
|
821
|
-
url.path =
|
|
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
|
|
863
|
-
if (!
|
|
862
|
+
const path4 = url.path.slice(1);
|
|
863
|
+
if (!path4)
|
|
864
864
|
return queryHash || ".";
|
|
865
|
-
if (isRelative(base || input) && !isRelative(
|
|
866
|
-
return "./" +
|
|
865
|
+
if (isRelative(base || input) && !isRelative(path4)) {
|
|
866
|
+
return "./" + path4 + queryHash;
|
|
867
867
|
}
|
|
868
|
-
return
|
|
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(
|
|
882
|
-
if (!
|
|
881
|
+
function stripFilename(path4) {
|
|
882
|
+
if (!path4)
|
|
883
883
|
return "";
|
|
884
|
-
const index =
|
|
885
|
-
return
|
|
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) {
|
|
@@ -2522,7 +2522,7 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2522
2522
|
);
|
|
2523
2523
|
}
|
|
2524
2524
|
},
|
|
2525
|
-
config(
|
|
2525
|
+
config(config2) {
|
|
2526
2526
|
const parseDefine = (v) => {
|
|
2527
2527
|
try {
|
|
2528
2528
|
return typeof v === "string" ? JSON.parse(v) : v;
|
|
@@ -2532,32 +2532,32 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2532
2532
|
};
|
|
2533
2533
|
return {
|
|
2534
2534
|
resolve: {
|
|
2535
|
-
dedupe: _optionalChain([
|
|
2535
|
+
dedupe: _optionalChain([config2, 'access', _68 => _68.build, 'optionalAccess', _69 => _69.ssr]) ? [] : ["vue"]
|
|
2536
2536
|
},
|
|
2537
2537
|
define: {
|
|
2538
|
-
__VUE_OPTIONS_API__: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'access', _70 => _70.value, 'access', _71 => _71.features, 'optionalAccess', _72 => _72.optionsAPI]), () => ( parseDefine(_optionalChain([
|
|
2539
|
-
__VUE_PROD_DEVTOOLS__: _nullishCoalesce((_optionalChain([options, 'access', _75 => _75.value, 'access', _76 => _76.features, 'optionalAccess', _77 => _77.prodDevtools]) || parseDefine(_optionalChain([
|
|
2538
|
+
__VUE_OPTIONS_API__: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'access', _70 => _70.value, 'access', _71 => _71.features, 'optionalAccess', _72 => _72.optionsAPI]), () => ( parseDefine(_optionalChain([config2, 'access', _73 => _73.define, 'optionalAccess', _74 => _74.__VUE_OPTIONS_API__])))), () => ( true)),
|
|
2539
|
+
__VUE_PROD_DEVTOOLS__: _nullishCoalesce((_optionalChain([options, 'access', _75 => _75.value, 'access', _76 => _76.features, 'optionalAccess', _77 => _77.prodDevtools]) || parseDefine(_optionalChain([config2, 'access', _78 => _78.define, 'optionalAccess', _79 => _79.__VUE_PROD_DEVTOOLS__]))), () => ( false)),
|
|
2540
2540
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: _nullishCoalesce((_optionalChain([options, 'access', _80 => _80.value, 'access', _81 => _81.features, 'optionalAccess', _82 => _82.prodHydrationMismatchDetails]) || parseDefine(
|
|
2541
|
-
_optionalChain([
|
|
2541
|
+
_optionalChain([config2, 'access', _83 => _83.define, 'optionalAccess', _84 => _84.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__])
|
|
2542
2542
|
)), () => ( false))
|
|
2543
2543
|
},
|
|
2544
2544
|
ssr: {
|
|
2545
2545
|
// @ts-ignore -- config.legacy.buildSsrCjsExternalHeuristics will be removed in Vite 5
|
|
2546
|
-
external: _optionalChain([
|
|
2546
|
+
external: _optionalChain([config2, 'access', _85 => _85.legacy, 'optionalAccess', _86 => _86.buildSsrCjsExternalHeuristics]) ? ["vue", "@vue/server-renderer"] : []
|
|
2547
2547
|
}
|
|
2548
2548
|
};
|
|
2549
2549
|
},
|
|
2550
|
-
configResolved(
|
|
2550
|
+
configResolved(config2) {
|
|
2551
2551
|
options.value = {
|
|
2552
2552
|
...options.value,
|
|
2553
|
-
root:
|
|
2554
|
-
sourceMap:
|
|
2555
|
-
cssDevSourcemap: _nullishCoalesce(_optionalChain([
|
|
2556
|
-
isProduction:
|
|
2557
|
-
devToolsEnabled: !!(_optionalChain([options, 'access', _89 => _89.value, 'access', _90 => _90.features, 'optionalAccess', _91 => _91.prodDevtools]) ||
|
|
2553
|
+
root: config2.root,
|
|
2554
|
+
sourceMap: config2.command === "build" ? !!config2.build.sourcemap : true,
|
|
2555
|
+
cssDevSourcemap: _nullishCoalesce(_optionalChain([config2, 'access', _87 => _87.css, 'optionalAccess', _88 => _88.devSourcemap]), () => ( false)),
|
|
2556
|
+
isProduction: config2.isProduction,
|
|
2557
|
+
devToolsEnabled: !!(_optionalChain([options, 'access', _89 => _89.value, 'access', _90 => _90.features, 'optionalAccess', _91 => _91.prodDevtools]) || config2.define.__VUE_PROD_DEVTOOLS__ || !config2.isProduction)
|
|
2558
2558
|
};
|
|
2559
|
-
const _warn =
|
|
2560
|
-
|
|
2559
|
+
const _warn = config2.logger.warn;
|
|
2560
|
+
config2.logger.warn = (...args) => {
|
|
2561
2561
|
const msg = args[0];
|
|
2562
2562
|
if (msg.match(
|
|
2563
2563
|
/\[lightningcss\] '(deep|slotted|global)' is not recognized as a valid pseudo-/
|
|
@@ -2566,7 +2566,7 @@ function vuePlugin(rawOptions = {}) {
|
|
|
2566
2566
|
}
|
|
2567
2567
|
_warn(...args);
|
|
2568
2568
|
};
|
|
2569
|
-
transformCachedModule =
|
|
2569
|
+
transformCachedModule = config2.command === "build" && options.value.sourceMap && config2.build.watch != null;
|
|
2570
2570
|
},
|
|
2571
2571
|
shouldTransformCachedModule({ id }) {
|
|
2572
2572
|
if (transformCachedModule && parseVueRequest(id).query.vue) {
|
|
@@ -2799,7 +2799,7 @@ function convertProxyConfig(data, replaceFunction) {
|
|
|
2799
2799
|
// 启用origin头修改
|
|
2800
2800
|
secure: false,
|
|
2801
2801
|
// 路径重写:移除请求路径中的统一前缀(如/api)
|
|
2802
|
-
rewrite: replaceFunction || ((
|
|
2802
|
+
rewrite: replaceFunction || ((path4) => path4.replace(new RegExp(`${dev_prefix}`), ""))
|
|
2803
2803
|
};
|
|
2804
2804
|
}
|
|
2805
2805
|
return result;
|
|
@@ -2822,56 +2822,114 @@ function server_default(devPort = 5e3, proxyConfig, baseUrl = "/") {
|
|
|
2822
2822
|
}
|
|
2823
2823
|
|
|
2824
2824
|
// src/vite-config/build/index.ts
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2825
|
+
|
|
2826
|
+
var _url = require('url');
|
|
2827
|
+
var __filename = _url.fileURLToPath.call(void 0, import.meta.url);
|
|
2828
|
+
var __dirname = _path2.default.dirname(__filename);
|
|
2829
|
+
var config = (isProduction) => {
|
|
2830
|
+
return {
|
|
2831
|
+
/**
|
|
2832
|
+
* 1. 压缩配置
|
|
2833
|
+
* 使用 esbuild 进行压缩,速度极快。
|
|
2834
|
+
* legalComments: 'none' 可以移除注释,进一步减小体积。
|
|
2835
|
+
*/
|
|
2836
|
+
minify: isProduction ? "esbuild" : false,
|
|
2837
|
+
/** 2. Source Map 配置 */
|
|
2838
|
+
sourcemap: isProduction ? false : true,
|
|
2839
|
+
// 线上环境不生成 source map
|
|
2840
|
+
/** 3. 构建阈值优化 */
|
|
2841
|
+
chunkSizeWarningLimit: 1e3,
|
|
2842
|
+
// 建议调整为 1000KB,避免单个 chunk 过大影响首屏
|
|
2843
|
+
/** 4. 目标环境与缓存 */
|
|
2844
|
+
target: isProduction ? ["es2020", "chrome89", "edge88", "firefox78", "safari14"] : "esnext",
|
|
2845
|
+
/** 5. CSS 处理 */
|
|
2846
|
+
cssCodeSplit: true,
|
|
2847
|
+
// 启用 CSS 代码分割
|
|
2848
|
+
/** 6. 性能优化 */
|
|
2849
|
+
reportCompressedSize: false,
|
|
2850
|
+
// 关闭 gzip 体积计算,可小幅提升构建速度
|
|
2851
|
+
rollupOptions: {
|
|
2852
|
+
output: {
|
|
2853
|
+
/**
|
|
2854
|
+
* 优化分包策略:
|
|
2855
|
+
* 改进点:
|
|
2856
|
+
* 1. 使用正则匹配,更准确地提取 node_modules 中的包名。
|
|
2857
|
+
* 2. 引入 "framework" 概念,将基础框架与业务依赖分离,提升缓存命中率。
|
|
2858
|
+
* 3. UI 库通常较大,建议单独拆分。
|
|
2859
|
+
*/
|
|
2860
|
+
manualChunks(id) {
|
|
2861
|
+
const nodeModulesPath = _path2.default.join(__dirname, "node_modules");
|
|
2862
|
+
if (id.includes(nodeModulesPath)) {
|
|
2863
|
+
const match = id.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/);
|
|
2864
|
+
const packageName = match ? match[1] : "";
|
|
2865
|
+
if (["vue", "react", "react-dom", "pinia", "vuex", "react-router-dom", "vue-router"].includes(packageName)) {
|
|
2866
|
+
return "framework";
|
|
2867
|
+
}
|
|
2868
|
+
if (["element-plus", "ant-design-vue", "arco-design", "antd", "@arco-design/web-vue"].includes(packageName)) {
|
|
2869
|
+
return "ui-lib";
|
|
2870
|
+
}
|
|
2871
|
+
if (["lodash-es", "lodash", "echarts", "moment", "axios", "three"].includes(packageName)) {
|
|
2872
|
+
return `lib-${packageName}`;
|
|
2873
|
+
}
|
|
2874
|
+
return "vendor";
|
|
2875
|
+
}
|
|
2876
|
+
if (id.includes("src/views/")) {
|
|
2877
|
+
const parts = id.split("src/views/");
|
|
2878
|
+
if (parts[1]) {
|
|
2879
|
+
const viewDir = parts[1].split("/")[0];
|
|
2880
|
+
return `page-${viewDir}`;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
},
|
|
2884
|
+
/** 入口文件命名规则:js目录/入口名.8位哈希.js */
|
|
2885
|
+
entryFileNames: `js/[name].[hash:8].js`,
|
|
2886
|
+
// 非入口 chunk 文件
|
|
2887
|
+
chunkFileNames: "js/[name].[hash:8].js",
|
|
2888
|
+
// 静态资源命名
|
|
2889
|
+
assetFileNames: (assetInfo) => {
|
|
2890
|
+
const ext = _optionalChain([assetInfo, 'access', _99 => _99.name, 'optionalAccess', _100 => _100.split, 'call', _101 => _101("."), 'access', _102 => _102.pop, 'call', _103 => _103()]) || "";
|
|
2891
|
+
if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "avif"].includes(ext)) {
|
|
2892
|
+
return `images/[name].[hash:8].[ext]`;
|
|
2893
|
+
}
|
|
2894
|
+
if (["woff", "woff2", "ttf", "eot", "otf"].includes(ext)) {
|
|
2895
|
+
return `fonts/[name].[hash:8].[ext]`;
|
|
2896
|
+
}
|
|
2897
|
+
if (["mp4", "webm", "ogg", "mp3", "wav", "flac"].includes(ext)) {
|
|
2898
|
+
return `media/[name].[hash:8].[ext]`;
|
|
2899
|
+
}
|
|
2900
|
+
if (ext === "css") {
|
|
2901
|
+
return `css/[name].[hash:8].[ext]`;
|
|
2902
|
+
}
|
|
2903
|
+
return `assets/[name].[hash:8].[ext]`;
|
|
2843
2904
|
}
|
|
2844
|
-
},
|
|
2845
|
-
/** 入口文件命名规则:js目录/入口名.8位哈希.js */
|
|
2846
|
-
entryFileNames: `js/[name].[hash:8].js`,
|
|
2847
|
-
/** 静态资源文件命名规则:按类型目录/原名.8位哈希.扩展名 */
|
|
2848
|
-
assetFileNames: `[ext]/[name].[hash:8].[ext]`,
|
|
2849
|
-
/**
|
|
2850
|
-
* 非入口 chunk 文件命名规则
|
|
2851
|
-
* @param chunkInfo - 包含 chunk 元信息的配置对象
|
|
2852
|
-
* @returns {string} 基于父级目录结构的文件路径
|
|
2853
|
-
*/
|
|
2854
|
-
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
2905
|
}
|
|
2859
2906
|
}
|
|
2860
|
-
}
|
|
2907
|
+
};
|
|
2861
2908
|
};
|
|
2909
|
+
var build_default = config;
|
|
2862
2910
|
|
|
2863
2911
|
// src/vite-config/index.ts
|
|
2864
2912
|
function createBaseViteConfig(options) {
|
|
2865
|
-
return _vite.defineConfig.call(void 0, (
|
|
2866
|
-
const env = _vite.loadEnv.call(void 0,
|
|
2867
|
-
const isDev =
|
|
2913
|
+
return _vite.defineConfig.call(void 0, (config2) => {
|
|
2914
|
+
const env = _vite.loadEnv.call(void 0, config2.mode, process.cwd(), "VITE_");
|
|
2915
|
+
const isDev = config2.mode === "development";
|
|
2916
|
+
const isProd = config2.mode === "production";
|
|
2868
2917
|
const { port = 5e3, plugins = [], proxy, showDevTools = false, enableOptimizeDeps = true, baseUrl } = options;
|
|
2918
|
+
const buildConfig = build_default(isProd);
|
|
2869
2919
|
return {
|
|
2870
2920
|
plugins: createVitePlugins(plugins, showDevTools, isDev),
|
|
2871
2921
|
resolve: resolve_default,
|
|
2872
2922
|
base: env.VITE_APP_PUBLIC_URL || "",
|
|
2873
2923
|
server: server_default(port, proxy, baseUrl),
|
|
2874
|
-
build:
|
|
2924
|
+
build: buildConfig,
|
|
2925
|
+
esbuild: isProd ? {
|
|
2926
|
+
drop: ["console", "debugger"],
|
|
2927
|
+
legalComments: "none",
|
|
2928
|
+
// 移除注释中的版权信息等
|
|
2929
|
+
pure: ["console.log"]
|
|
2930
|
+
// 仅标记纯函数,配合 drop 使用
|
|
2931
|
+
} : void 0,
|
|
2932
|
+
treeshake: isProd ? { preset: "recommended" } : true,
|
|
2875
2933
|
optimizeDeps: {
|
|
2876
2934
|
include: enableOptimizeDeps ? ["vue", "vue-router", "pinia", "axios", "element-plus", "ant-design-vue", "echarts"] : []
|
|
2877
2935
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk3YUIFF3Jjs = require('./chunk-3YUIFF3J.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ var _chunkZIUN3ZQAjs = require('./chunk-ZIUN3ZQA.js');
|
|
|
32
32
|
var _chunkWGOU4SV3js = require('./chunk-WGOU4SV3.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkXXY3WATJjs = require('./chunk-XXY3WATJ.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 =
|
|
67
|
+
exports.clamp = _chunkWGOU4SV3js.clamp; exports.createBaseViteConfig = _chunkXXY3WATJjs.createBaseViteConfig; exports.createFunctionalComponent = _chunkWGOU4SV3js.createFunctionalComponent; exports.createUnoConfig = _chunk3YUIFF3Jjs.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createUnoConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-H523LVQA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
clamp,
|
|
6
6
|
createFunctionalComponent,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
} from "./chunk-PTS5WW6S.mjs";
|
|
33
33
|
import {
|
|
34
34
|
createBaseViteConfig
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-T4RPUVUI.mjs";
|
|
36
36
|
import "./chunk-6DZX6EAA.mjs";
|
|
37
37
|
export {
|
|
38
38
|
clamp,
|
package/dist/uno-config/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk3YUIFF3Jjs = require('../chunk-3YUIFF3J.js');
|
|
5
5
|
require('../chunk-QGM4M3NI.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.createUnoConfig =
|
|
9
|
+
exports.createUnoConfig = _chunk3YUIFF3Jjs.createUnoConfig; exports.default = _chunk3YUIFF3Jjs.uno_config_default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXXY3WATJjs = require('../chunk-XXY3WATJ.js');
|
|
4
4
|
require('../chunk-QGM4M3NI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.createBaseViteConfig =
|
|
7
|
+
exports.createBaseViteConfig = _chunkXXY3WATJjs.createBaseViteConfig;
|