You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

414 lines
42 KiB

3 years ago
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __glob = (map) => (path) => {
var fn = map[path];
if (fn)
return fn();
throw new Error("Module not found in bundle: " + path);
};
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// vite-config/plugins/unplugin-auto-import.js
var unplugin_auto_import_exports = {};
__export(unplugin_auto_import_exports, {
AutoImport: () => AutoImport
});
import autoImport from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/unplugin-auto-import/dist/vite.js";
var AutoImport;
var init_unplugin_auto_import = __esm({
"vite-config/plugins/unplugin-auto-import.js"() {
AutoImport = (viteEnv = {}) => {
return autoImport({
imports: [
"vue",
// 全局自动导入vue
"vue-router",
// 全局自动导入路由插件
"vue-i18n",
// 全局自动导入国际化插件
"pinia",
// 全局自动导入pinia
{
"@/common/globalInitialize": ["$globalReady"],
// 全局自动导入初始化方法
"@/common/globalStore": ["$globalStore", "$globalRegisterStore"],
// 全局自动导入pinia处理函数
"@/common/globalEventBus": ["$globalEventBus"],
// 全局自动导入中央事件总线
"@/common/globalLocales": ["$globalLang"],
// 全局自动导入国际化方法
"@/common/globalConfigure": ["$globalConfigure"],
// 全局自动导入页面缓存初始化函数
"@/common/globalHttp": ["$globalHttp"],
// 全局自动导入请求拦截方法
"@/common/globalRequest": ["$globalRequestUrl", "$globalRequest"],
// 全局自动导入请求处理函数
"@/common/globalConstant": ["$globalConstant"],
// 全局自动导入常量
"@/common/globalRouter": ["$globalRouter"],
// 全局自动导入路由配置
"@/common/globalExpandRouter": ["$globalRouterModules", "$globalExpandRouter"]
// 全局自动导入路由处理方法
}
]
});
};
}
});
// vite-config/plugins/unplugin-vue-components.js
var unplugin_vue_components_exports = {};
__export(unplugin_vue_components_exports, {
Components: () => Components
});
import components from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/unplugin-vue-components/dist/vite.js";
import { VantResolver } from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/unplugin-vue-components/dist/resolvers.js";
var Components;
var init_unplugin_vue_components = __esm({
"vite-config/plugins/unplugin-vue-components.js"() {
Components = (viteEnv = {}) => {
return components({
resolvers: [VantResolver()],
// 自动导入vant库
dirs: ["src/components"],
extensions: ["vue"]
// 文件扩展名
});
};
}
});
// vite-config/plugins/vite-plugin-copy.js
var vite_plugin_copy_exports = {};
__export(vite_plugin_copy_exports, {
vitePluginCopy: () => vitePluginCopy
});
import { resolve, basename } from "path";
import fs from "fs";
var isDir, isFile, copyFile, copyFun, isObject, isArray, handleFile, viteConfig, vitePluginCopy;
var init_vite_plugin_copy = __esm({
"vite-config/plugins/vite-plugin-copy.js"() {
isDir = (dir) => {
try {
return fs.statSync(dir).isDirectory();
} catch (_) {
return false;
}
};
isFile = (dir) => {
try {
return fs.statSync(dir).isFile();
} catch (_) {
return false;
}
};
copyFile = (filePath, dist, file) => {
const readStream = fs.createReadStream(filePath);
const writeStrem = fs.createWriteStream(resolve(dist, file));
readStream.pipe(writeStrem);
};
copyFun = (from, dist, fileName) => {
if (!isDir(from) && !isFile(from))
return;
if (!isDir(dist)) {
fs.mkdirSync(dist);
}
if (isDir(from)) {
const dir = fs.readdirSync(from);
dir.forEach((file) => {
const filePath = resolve(from, file);
fs.stat(filePath, (_, stat) => {
if (stat.isFile()) {
copyFile(filePath, dist, file);
} else if (stat.isDirectory()) {
copyFun(filePath, resolve(dist, file));
}
});
});
}
if (isFile(from)) {
const file = fileName || basename(from);
copyFile(from, dist, file);
}
};
isObject = (obj) => {
return ["[object Object]"].includes(Object.prototype.toString.call(obj));
};
isArray = (obj) => {
return typeof Array.isArray === "function" ? Array.isArray(obj) : ["[object Array]"].includes(Object.prototype.toString.call(obj));
};
handleFile = (root, option) => {
const { from = "", to = "", fileName } = option;
if (!from || !to)
return;
try {
const fromDir = resolve(root, from);
const toDir = resolve(root, to);
copyFun(fromDir, toDir, fileName);
} catch (e) {
}
};
viteConfig = null;
vitePluginCopy = (viteEnv = {}) => {
const modeIndex = process.argv.indexOf("--mode");
const mode = modeIndex !== -1 ? process.argv[modeIndex + 1] : "";
const option = [
{
from: `vite-env/.env${mode ? `.${mode}` : ""}`,
// 写要复制的目录或者文件
to: "dist",
// 目标目录
fileName: ""
// 复制文件时重命名文件名
}
];
return {
name: "vite-plugin-copy",
apply: "build",
configResolved(resolvedConfig) {
viteConfig = resolvedConfig;
},
closeBundle: async () => {
const root = viteConfig.root;
if (isObject(option)) {
await handleFile(root, option);
}
if (isArray(option)) {
option.forEach(async (item) => {
await handleFile(root, item);
});
}
}
};
};
}
});
// vite-config/plugins/vite-plugin-legacy.js
var vite_plugin_legacy_exports = {};
__export(vite_plugin_legacy_exports, {
legacyPlugin: () => legacyPlugin
});
import legacy from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/@vitejs/plugin-legacy/dist/index.mjs";
var legacyPlugin;
var init_vite_plugin_legacy = __esm({
"vite-config/plugins/vite-plugin-legacy.js"() {
legacyPlugin = (viteEnv = {}) => {
return legacy();
};
}
});
// vite-config/plugins/vite-plugin-progress.js
var vite_plugin_progress_exports = {};
__export(vite_plugin_progress_exports, {
Progress: () => Progress
});
import progress from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/vite-plugin-progress/dist/index.mjs";
var Progress;
var init_vite_plugin_progress = __esm({
"vite-config/plugins/vite-plugin-progress.js"() {
Progress = (viteEnv = {}) => {
return progress();
};
}
});
// vite-config/plugins/vite-plugin-vue-setup-extend.js
var vite_plugin_vue_setup_extend_exports = {};
__export(vite_plugin_vue_setup_extend_exports, {
vueSetupExtend: () => vueSetupExtend
});
import setupExtend from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/vite-plugin-vue-setup-extend/dist/index.mjs";
var vueSetupExtend;
var init_vite_plugin_vue_setup_extend = __esm({
"vite-config/plugins/vite-plugin-vue-setup-extend.js"() {
vueSetupExtend = (viteEnv = {}) => {
return setupExtend();
};
}
});
// vite-config/plugins/vite-plugin-zip.js
var vite_plugin_zip_exports = {};
__export(vite_plugin_zip_exports, {
vitePluginZip: () => vitePluginZip
});
import { resolve as resolve2, join } from "path";
import fs2 from "fs";
import JSZip from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/jszip/lib/index.js";
var readDir, mkZip, viteConfig2, vitePluginZip;
var init_vite_plugin_zip = __esm({
"vite-config/plugins/vite-plugin-zip.js"() {
readDir = (zip, dirPath) => {
const files = fs2.readdirSync(dirPath);
files.forEach((item) => {
const filePath = join(dirPath, "./", item);
const file = fs2.statSync(filePath);
if (file.isDirectory()) {
const dirZip = zip.folder(item);
readDir(dirZip, filePath);
} else {
zip.file(item, fs2.readFileSync(filePath));
}
});
};
mkZip = async (root, viteEnv, option) => {
let { fileName = "dist", output = "" } = viteEnv;
if (!output) {
output = resolve2(root, "./dist");
}
fileName += ".zip";
const distPath = resolve2(output);
const zip = new JSZip();
readDir(zip, distPath);
zip.generateAsync(option).then((res) => {
const dist = join(distPath, `../${fileName}`);
fs2.writeFileSync(dist, res);
});
};
viteConfig2 = null;
vitePluginZip = (viteEnv = {}) => {
const option = {
type: "nodebuffer",
// 压缩类型
compression: "DEFLATE",
// 压缩算法
compressionOptions: {
level: 9
// 压缩等级
}
};
return {
name: "vite-plugin-zip",
apply: "build",
configResolved(resolvedConfig) {
viteConfig2 = resolvedConfig;
},
async closeBundle() {
const root = viteConfig2.root;
await mkZip(root, viteEnv, option);
}
};
};
}
});
// vite.config.js
import { defineConfig, loadEnv } from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/vite/dist/node/index.js";
import vue from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/@vitejs/plugin-vue/dist/index.mjs";
// vite-config/index.js
import { resolve as resolve3, join as join2, extname } from "path";
import fs3 from "fs";
import postCssPxToRem from "file:///D:/ZdxtProject/zdxtLawEnforcementCodeView/zdxtLawEnforcementCodeView/node_modules/postcss-pxtorem/index.js";
// import("./plugins/**/*") in vite-config/index.js
var globImport_plugins = __glob({
"./plugins/unplugin-auto-import.js": () => Promise.resolve().then(() => (init_unplugin_auto_import(), unplugin_auto_import_exports)),
"./plugins/unplugin-vue-components.js": () => Promise.resolve().then(() => (init_unplugin_vue_components(), unplugin_vue_components_exports)),
"./plugins/vite-plugin-copy.js": () => Promise.resolve().then(() => (init_vite_plugin_copy(), vite_plugin_copy_exports)),
"./plugins/vite-plugin-legacy.js": () => Promise.resolve().then(() => (init_vite_plugin_legacy(), vite_plugin_legacy_exports)),
"./plugins/vite-plugin-progress.js": () => Promise.resolve().then(() => (init_vite_plugin_progress(), vite_plugin_progress_exports)),
"./plugins/vite-plugin-vue-setup-extend.js": () => Promise.resolve().then(() => (init_vite_plugin_vue_setup_extend(), vite_plugin_vue_setup_extend_exports)),
"./plugins/vite-plugin-zip.js": () => Promise.resolve().then(() => (init_vite_plugin_zip(), vite_plugin_zip_exports))
});
// vite-config/index.js
var __vite_injected_original_dirname = "D:\\ZdxtProject\\zdxtLawEnforcementCodeView\\zdxtLawEnforcementCodeView\\vite-config";
var loadPluginModules = async () => {
return new Promise(async (success) => {
const modulesPath = resolve3(__vite_injected_original_dirname, "plugins");
const fileNames = fs3.readdirSync(modulesPath);
let modulesImprot = [];
fileNames.forEach(async (item) => {
const filePath = join2(modulesPath, item);
if (fs3.statSync(filePath).isFile() && [".js"].includes(extname(filePath))) {
modulesImprot.push(globImport_plugins(`./plugins/${item}`));
}
});
const modules = await Promise.all(modulesImprot);
success(modules);
});
};
var baseCfg = (viteEnv = {}) => {
const { VITE_BASE_URL } = viteEnv;
return {
base: "./",
envDir: "vite-env",
resolve: {
alias: {
"@": resolve3("./src"),
"~@": resolve3("./src")
},
extensions: [".js", ".mjs", ".vue", ".json", ".less", ".css"]
},
server: {
host: "0.0.0.0",
// 服务器主机名,如果允许外部访问,可设置为"0.0.0.0"
port: 3301,
open: false,
cors: true
},
build: {
outDir: "dist",
minify: "terser",
// esbuild 打包更快,但是不能去除 console.log,去除 console 使用 terser 模式
rollupOptions: {
output: {
chunkFileNames: "js/[name]-[hash].js",
// 引入文件名的名称
entryFileNames: "js/[name]-[hash].js",
// 包的入口文件名称
assetFileNames: "[ext]/[name]-[hash].[ext]"
// 资源文件像 字体,图片等
}
}
},
css: {
postcss: {
plugins: [
postCssPxToRem({
rootValue: 37.5,
// 自适应,px>rem转换
propList: ["*"],
// 需要转换的属性,这里选择全部都进行转换
selectorBlackList: ["norem"]
// 过滤掉norem-开头的class,不进行rem转换
})
]
}
}
};
};
var pluginCfg = async (viteEnv = {}) => {
const modulesArr = [];
const modules = await loadPluginModules();
modules.forEach((item) => {
const funcs = Object.values(item);
funcs.forEach((it) => {
modulesArr.push(it(viteEnv));
});
});
return modulesArr;
};
// vite.config.js
var vite_config_default = async ({ mode }) => {
const { VITE_BASE_URL } = loadEnv(mode, `${process.cwd()}/vite-env`);
return defineConfig({
...baseCfg({ VITE_BASE_URL }),
plugins: [vue(), ...await pluginCfg({ VITE_BASE_URL })]
});
};
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS1jb25maWcvcGx1Z2lucy91bnBsdWdpbi1hdXRvLWltcG9ydC5qcyIsICJ2aXRlLWNvbmZpZy9wbHVnaW5zL3VucGx1Z2luLXZ1ZS1jb21wb25lbnRzLmpzIiwgInZpdGUtY29uZmlnL3BsdWdpbnMvdml0ZS1wbHVnaW4tY29weS5qcyIsICJ2aXR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