@dlzn-ui/vite-config 2.0.15 → 2.0.21
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +37 -22
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ type Arrayable<T> = Array<T> | T;
|
|
|
6
6
|
interface Options {
|
|
7
7
|
autoImportResolvers?: Array<UnwrapArrayable<UnwrapArrayable<NonNullable<Parameters<typeof AutoImport>[0]['resolvers']>>>>;
|
|
8
8
|
autoImports?: AutoImports;
|
|
9
|
+
isPlay?: boolean;
|
|
9
10
|
root: string;
|
|
10
11
|
}
|
|
11
12
|
type UnwrapArrayable<T> = T extends Arrayable<infer U> ? U : never;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ type Arrayable<T> = Array<T> | T;
|
|
|
6
6
|
interface Options {
|
|
7
7
|
autoImportResolvers?: Array<UnwrapArrayable<UnwrapArrayable<NonNullable<Parameters<typeof AutoImport>[0]['resolvers']>>>>;
|
|
8
8
|
autoImports?: AutoImports;
|
|
9
|
+
isPlay?: boolean;
|
|
9
10
|
root: string;
|
|
10
11
|
}
|
|
11
12
|
type UnwrapArrayable<T> = T extends Arrayable<infer U> ? U : never;
|
package/dist/index.mjs
CHANGED
|
@@ -82,6 +82,7 @@ const optimizeDepsInclude = [
|
|
|
82
82
|
"dlzn-ui/router",
|
|
83
83
|
"dlzn-ui/store",
|
|
84
84
|
"dlzn-ui/views/system/user/index",
|
|
85
|
+
"dlzn-ui/layout/modules/LoginBg",
|
|
85
86
|
"dlzn-ui/plugins/echarts",
|
|
86
87
|
"dlzn-ui/main"
|
|
87
88
|
];
|
|
@@ -139,13 +140,18 @@ const tDesignAutoImportResolve = (options) => {
|
|
|
139
140
|
|
|
140
141
|
const VIRTUAL_ID = "virtual:dlzn-ui/app-params";
|
|
141
142
|
const RESOLVED_ID = `\0${VIRTUAL_ID}`;
|
|
142
|
-
const virtualAppParams = () => {
|
|
143
|
+
const virtualAppParams = ({ isPlay }) => {
|
|
143
144
|
return {
|
|
144
145
|
enforce: "pre",
|
|
145
146
|
load(id) {
|
|
146
147
|
if (id !== RESOLVED_ID) {
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
150
|
+
if (isPlay) {
|
|
151
|
+
return `
|
|
152
|
+
export default {}
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
149
155
|
return `
|
|
150
156
|
import user from "@/app-params.ts"
|
|
151
157
|
import layoutsEntryLazyImport from "@/layout/index.ts"
|
|
@@ -197,8 +203,11 @@ const virtualAppParams = () => {
|
|
|
197
203
|
const ENDPOINT = "/__dev__/save-folder-alias";
|
|
198
204
|
const OUTPUT_FILE_WATCH_IGNORE = "**/folder-alias.json";
|
|
199
205
|
const SKIP_COMPONENTS = /* @__PURE__ */ new Set(["Layout", "ParentView"]);
|
|
200
|
-
function devSaveFolderAlias(
|
|
201
|
-
|
|
206
|
+
function devSaveFolderAlias({
|
|
207
|
+
isPlay,
|
|
208
|
+
root
|
|
209
|
+
}) {
|
|
210
|
+
const OUTPUT_FILE = resolve(root, isPlay ? "play/folder-alias.json" : "folder-alias.json");
|
|
202
211
|
return {
|
|
203
212
|
apply: "serve",
|
|
204
213
|
// Vite 对插件 config() 的返回值会做深度合并(mergeConfig)
|
|
@@ -297,7 +306,7 @@ function toFolderAlias(routers) {
|
|
|
297
306
|
}
|
|
298
307
|
|
|
299
308
|
const vitePlugins = (options) => {
|
|
300
|
-
const { isProduction, root } = options;
|
|
309
|
+
const { isPlay, isProduction, root } = options;
|
|
301
310
|
if (isProduction) {
|
|
302
311
|
return [
|
|
303
312
|
viteImagemin({
|
|
@@ -374,7 +383,10 @@ const vitePlugins = (options) => {
|
|
|
374
383
|
},
|
|
375
384
|
name: "filter-vite-server-urls"
|
|
376
385
|
},
|
|
377
|
-
devSaveFolderAlias(
|
|
386
|
+
devSaveFolderAlias({
|
|
387
|
+
isPlay,
|
|
388
|
+
root
|
|
389
|
+
})
|
|
378
390
|
];
|
|
379
391
|
}
|
|
380
392
|
};
|
|
@@ -391,8 +403,9 @@ function needPort(target) {
|
|
|
391
403
|
}
|
|
392
404
|
const index = (_env, options) => {
|
|
393
405
|
const { command, mode } = _env;
|
|
394
|
-
const
|
|
395
|
-
const
|
|
406
|
+
const { isPlay = false, root } = options;
|
|
407
|
+
const resolvePath = (p) => resolve(root, p);
|
|
408
|
+
const envDir = isPlay ? "play/env" : "env";
|
|
396
409
|
const env = parseLoadedEnv(loadEnv(mode, envDir));
|
|
397
410
|
const {
|
|
398
411
|
VITE_API_PROXY_PORT_ARRAY,
|
|
@@ -422,7 +435,7 @@ const index = (_env, options) => {
|
|
|
422
435
|
};
|
|
423
436
|
return mergeConfig(
|
|
424
437
|
baseConfigFn({
|
|
425
|
-
tailwindAutoReferenceEntry: "node_modules/dlzn-ui/assets/css/tailwindcss-entry.css"
|
|
438
|
+
tailwindAutoReferenceEntry: isPlay ? "assets/css/tailwindcss-entry.css" : "node_modules/dlzn-ui/assets/css/tailwindcss-entry.css"
|
|
426
439
|
}),
|
|
427
440
|
{
|
|
428
441
|
build: {
|
|
@@ -458,9 +471,11 @@ const index = (_env, options) => {
|
|
|
458
471
|
// envParse({
|
|
459
472
|
// dtsPath: 'types/env.d.ts',
|
|
460
473
|
// }),
|
|
461
|
-
virtualAppParams(
|
|
474
|
+
virtualAppParams({
|
|
475
|
+
isPlay
|
|
476
|
+
}),
|
|
462
477
|
createHtmlPlugin({
|
|
463
|
-
entry: "/src/main.ts",
|
|
478
|
+
entry: isPlay ? "/play/main.play.ts" : "/src/main.ts",
|
|
464
479
|
// 必须绝对路径,否则类似system/log/operlog 二级页面打不开
|
|
465
480
|
inject: {
|
|
466
481
|
data: {
|
|
@@ -468,12 +483,12 @@ const index = (_env, options) => {
|
|
|
468
483
|
title: VITE_APP_NAME
|
|
469
484
|
},
|
|
470
485
|
ejsOptions: {
|
|
471
|
-
views: ["node_modules/dlzn-ui/assets/ejs"]
|
|
486
|
+
views: [isPlay ? "assets/ejs" : "node_modules/dlzn-ui/assets/ejs"]
|
|
472
487
|
}
|
|
473
488
|
},
|
|
474
489
|
minify: true,
|
|
475
490
|
// 相对消费方 root,closeBundle 整理 HTML 时比绝对路径更稳
|
|
476
|
-
template: "node_modules/dlzn-ui/index.html"
|
|
491
|
+
template: isPlay ? "index.html" : "node_modules/dlzn-ui/index.html"
|
|
477
492
|
}),
|
|
478
493
|
{
|
|
479
494
|
apply: "build",
|
|
@@ -503,7 +518,7 @@ const index = (_env, options) => {
|
|
|
503
518
|
name: "dlzn-ui:flatten-index-html"
|
|
504
519
|
},
|
|
505
520
|
VueRouter({
|
|
506
|
-
dts: "types/typed-router.d.ts
|
|
521
|
+
dts: `${isPlay ? "play/" : ""}types/typed-router.d.ts`
|
|
507
522
|
}),
|
|
508
523
|
AutoImport({
|
|
509
524
|
// 用于自动导入 函数/工具库 的 API
|
|
@@ -519,7 +534,7 @@ const index = (_env, options) => {
|
|
|
519
534
|
types: false
|
|
520
535
|
// Enable auto import the types under the directories
|
|
521
536
|
},
|
|
522
|
-
dts: "types/auto-imports.d.ts
|
|
537
|
+
dts: `${isPlay ? "play/" : ""}types/auto-imports.d.ts`,
|
|
523
538
|
// dtsMode: 'overwrite', // overwrite the whole existing .d.ts file with the new type definitions.
|
|
524
539
|
imports: [
|
|
525
540
|
"vue",
|
|
@@ -546,13 +561,13 @@ const index = (_env, options) => {
|
|
|
546
561
|
imports: ["PageListProps"],
|
|
547
562
|
type: true
|
|
548
563
|
},
|
|
549
|
-
autoImportStoreList(
|
|
564
|
+
autoImportStoreList(root),
|
|
550
565
|
...options.autoImports ?? []
|
|
551
566
|
],
|
|
552
567
|
resolvers: [
|
|
553
568
|
...options.autoImportResolvers ?? [],
|
|
554
569
|
...tDesignAutoImportResolve({
|
|
555
|
-
root
|
|
570
|
+
root
|
|
556
571
|
})
|
|
557
572
|
],
|
|
558
573
|
vueTemplate: true
|
|
@@ -561,28 +576,28 @@ const index = (_env, options) => {
|
|
|
561
576
|
Components({
|
|
562
577
|
deep: false,
|
|
563
578
|
// 用于自动导入 Vue 组件
|
|
564
|
-
dts: "types/components.d.ts
|
|
579
|
+
dts: `${isPlay ? "play/" : ""}types/components.d.ts`,
|
|
565
580
|
resolvers: [
|
|
566
581
|
...options.autoImportResolvers ?? [],
|
|
567
582
|
...tDesignAutoImportResolve({
|
|
568
|
-
root
|
|
583
|
+
root
|
|
569
584
|
})
|
|
570
585
|
]
|
|
571
586
|
// syncMode: 'overwrite',
|
|
572
587
|
}),
|
|
573
|
-
...vitePlugins({ isProduction, root
|
|
588
|
+
...vitePlugins({ isPlay, isProduction, root })
|
|
574
589
|
],
|
|
575
590
|
resolve: {
|
|
576
591
|
alias: [
|
|
577
592
|
{
|
|
578
593
|
find: "@",
|
|
579
|
-
replacement: resolvePath("src")
|
|
594
|
+
replacement: resolvePath(isPlay ? "" : "src")
|
|
580
595
|
// 使用绝对路径(官方推荐)
|
|
581
596
|
},
|
|
582
597
|
{
|
|
583
598
|
find: "img",
|
|
584
599
|
// 路径以 img 开头
|
|
585
|
-
replacement: resolvePath("src/assets/images")
|
|
600
|
+
replacement: resolvePath(isPlay ? "assets/images" : "src/assets/images")
|
|
586
601
|
}
|
|
587
602
|
// ...(isProduction
|
|
588
603
|
// ? []
|
|
@@ -600,7 +615,7 @@ const index = (_env, options) => {
|
|
|
600
615
|
extensions: [".ts", ".mjs", ".js"]
|
|
601
616
|
// js 和 mjs 打包chat包时需要
|
|
602
617
|
},
|
|
603
|
-
root
|
|
618
|
+
root,
|
|
604
619
|
server: {
|
|
605
620
|
// vite preview 也会走该代理
|
|
606
621
|
host: "0.0.0.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dlzn-ui/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.21",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"vite-plugin-imagemin": "^0.6.1",
|
|
38
38
|
"vite-plugin-vue-tailwind-auto-reference": "^2.0.2",
|
|
39
39
|
"vue-router": "^5.2.0",
|
|
40
|
-
"@dlzn-ui/node-utils": "2.0.
|
|
40
|
+
"@dlzn-ui/node-utils": "2.0.21"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"rimraf": "^6.1.3",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|
|
48
|
-
"clean": "rimraf dist",
|
|
49
48
|
"stub": "unbuild --stub"
|
|
50
49
|
}
|
|
51
50
|
}
|