@pubinfo/vite 0.6.8 → 0.6.10
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +140 -233
- package/package.json +19 -19
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { UserConfig } from 'vite';
|
|
2
|
+
import { UserConfig, UserConfigFnObject } from 'vite';
|
|
3
3
|
|
|
4
|
-
declare function defineConfig(defineOptions?: UserConfig): vite.UserConfigExport;
|
|
4
|
+
declare function defineConfig(defineOptions?: UserConfig | UserConfigFnObject): vite.UserConfigExport;
|
|
5
5
|
|
|
6
6
|
export { defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/// <reference types="unplugin-icons/types/vue" />
|
|
4
4
|
|
|
5
5
|
import * as vite from 'vite';
|
|
6
|
-
import { UserConfig } from 'vite';
|
|
6
|
+
import { UserConfig, UserConfigFnObject } from 'vite';
|
|
7
7
|
|
|
8
|
-
declare function defineConfig(defineOptions?: UserConfig): vite.UserConfigExport;
|
|
8
|
+
declare function defineConfig(defineOptions?: UserConfig | UserConfigFnObject): vite.UserConfigExport;
|
|
9
9
|
|
|
10
10
|
export { defineConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,90 @@
|
|
|
1
|
+
import path, { resolve as resolve$1 } from 'node:path';
|
|
1
2
|
import process from 'node:process';
|
|
2
|
-
import path, { resolve as resolve$1, relative, join } from 'node:path';
|
|
3
3
|
import { defineConfig as defineConfig$1, loadEnv, mergeConfig } from 'vite';
|
|
4
|
+
import fs from 'node:fs/promises';
|
|
5
|
+
import { readPackageJSON } from 'pkg-types';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import consola from 'consola';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import vueLegacy from '@vitejs/plugin-legacy';
|
|
4
10
|
import vue from '@vitejs/plugin-vue';
|
|
5
11
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
6
|
-
import vueLegacy from '@vitejs/plugin-legacy';
|
|
7
12
|
import autoImport from 'unplugin-auto-import/vite';
|
|
8
13
|
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
|
|
9
14
|
import IconsResolver from 'unplugin-icons/resolver';
|
|
15
|
+
import banner from 'vite-plugin-banner';
|
|
10
16
|
import components from 'unplugin-vue-components/vite';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
17
|
+
import compression from 'vite-plugin-compression';
|
|
18
|
+
import TurboConsole from 'unplugin-turbo-console/vite';
|
|
13
19
|
import vueI18n from '@intlify/unplugin-vue-i18n/vite';
|
|
14
|
-
import { existsSync
|
|
20
|
+
import { existsSync } from 'node:fs';
|
|
15
21
|
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
|
|
16
|
-
import compression from 'vite-plugin-compression';
|
|
17
|
-
import banner from 'vite-plugin-banner';
|
|
18
|
-
import dayjs from 'dayjs';
|
|
19
22
|
import fg from 'fast-glob';
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import fse from 'fs-extra/esm';
|
|
23
|
-
import consola$1, { consola } from 'consola';
|
|
23
|
+
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|
24
|
+
import Unocss from 'unocss/vite';
|
|
24
25
|
import Icons from 'unplugin-icons/vite';
|
|
25
|
-
import TurboConsole from 'unplugin-turbo-console/vite';
|
|
26
26
|
import VueDevTools from 'vite-plugin-vue-devtools';
|
|
27
27
|
import OpenAPI from '@pubinfo/unplugin-openapi/vite';
|
|
28
|
-
import EnvRuntime from 'vite-plugin-env-runtime';
|
|
29
28
|
import boxen from 'boxen';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
|
|
30
|
+
function cleanse() {
|
|
31
|
+
return {
|
|
32
|
+
name: "esbuild-plugin-cleanse",
|
|
33
|
+
setup(build) {
|
|
34
|
+
build.onLoad({ filter: /\/dist\/alova\.esm\.js$/ }, async (args) => {
|
|
35
|
+
let alovaContnet = await fs.readFile(args.path, "utf-8");
|
|
36
|
+
alovaContnet = alovaContnet.replace(/\/\* c8 ignore start \*\/[\s\S]*?\/\* c8 ignore stop \*\//g, "");
|
|
37
|
+
return {
|
|
38
|
+
contents: `${alovaContnet}`
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function createDefineSystemInfo(root) {
|
|
46
|
+
try {
|
|
47
|
+
const pkgJson = await readPackageJSON(root);
|
|
48
|
+
const { dependencies, devDependencies, version } = pkgJson;
|
|
49
|
+
const lastBuildTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
50
|
+
const SYSTEM_INFO = {
|
|
51
|
+
pkg: {
|
|
52
|
+
dependencies,
|
|
53
|
+
devDependencies,
|
|
54
|
+
version
|
|
55
|
+
},
|
|
56
|
+
lastBuildTime
|
|
57
|
+
};
|
|
58
|
+
return JSON.stringify(SYSTEM_INFO);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function getServerProxy(env, isProxy, rewrite = true) {
|
|
64
|
+
if (!isProxy) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
const targetPrefix = "VITE_APP_API_";
|
|
68
|
+
const proxyKey = Object.keys(env).filter((key) => key.startsWith(targetPrefix));
|
|
69
|
+
const serverProxy = {};
|
|
70
|
+
for (const envKey of proxyKey) {
|
|
71
|
+
const url = env[envKey];
|
|
72
|
+
const { pathname } = new URL(url);
|
|
73
|
+
const pk = `${pathname}/proxy`;
|
|
74
|
+
if (pk in serverProxy) {
|
|
75
|
+
consola.error(`The proxy key ${chalk.bold.redBright(envKey)} \u279C ${chalk.bold.yellowBright(url)} already exists`);
|
|
76
|
+
} else {
|
|
77
|
+
serverProxy[pk] = {
|
|
78
|
+
target: url,
|
|
79
|
+
changeOrigin: rewrite,
|
|
80
|
+
rewrite: (path) => {
|
|
81
|
+
return path.replace(pk, "");
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return serverProxy;
|
|
87
|
+
}
|
|
33
88
|
|
|
34
89
|
function resolve(name) {
|
|
35
90
|
if (!name.startsWith("usePub")) {
|
|
@@ -76,6 +131,17 @@ function createAutoImport() {
|
|
|
76
131
|
});
|
|
77
132
|
}
|
|
78
133
|
|
|
134
|
+
const deploymentTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
135
|
+
function createBanner() {
|
|
136
|
+
return banner(`
|
|
137
|
+
/**
|
|
138
|
+
* \u7531 \u793E\u4F1A\u6CBB\u7406\u4E8B\u4E1A\u90E8 \u63D0\u4F9B\u6280\u672F\u652F\u6301
|
|
139
|
+
* Powered by wsy-admin
|
|
140
|
+
* ${deploymentTime}
|
|
141
|
+
*/
|
|
142
|
+
`);
|
|
143
|
+
}
|
|
144
|
+
|
|
79
145
|
function resolveComponent(componentName) {
|
|
80
146
|
if (!componentName.match(/^Pub[A-Z]/)) {
|
|
81
147
|
return;
|
|
@@ -132,15 +198,33 @@ function createComponents() {
|
|
|
132
198
|
});
|
|
133
199
|
}
|
|
134
200
|
|
|
135
|
-
function
|
|
136
|
-
|
|
201
|
+
function createCompression(env) {
|
|
202
|
+
const { VITE_BUILD_COMPRESS } = env;
|
|
203
|
+
const compressList = VITE_BUILD_COMPRESS?.split(",") ?? [];
|
|
204
|
+
const plugin = [];
|
|
205
|
+
if (compressList.includes("gzip")) {
|
|
206
|
+
plugin.push(
|
|
207
|
+
compression({
|
|
208
|
+
ext: ".gz",
|
|
209
|
+
deleteOriginFile: false
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
if (compressList.includes("brotli")) {
|
|
214
|
+
plugin.push(
|
|
215
|
+
compression({
|
|
216
|
+
ext: ".br",
|
|
217
|
+
algorithm: "brotliCompress",
|
|
218
|
+
deleteOriginFile: false
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return plugin;
|
|
137
223
|
}
|
|
138
224
|
|
|
139
|
-
function
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
symbolId: "icon-[dir]-[name]",
|
|
143
|
-
svgoOptions: isBuild
|
|
225
|
+
function createConsole() {
|
|
226
|
+
return TurboConsole({
|
|
227
|
+
disableLaunchEditor: true
|
|
144
228
|
});
|
|
145
229
|
}
|
|
146
230
|
|
|
@@ -166,53 +250,18 @@ function createMock(env, isBuild) {
|
|
|
166
250
|
});
|
|
167
251
|
}
|
|
168
252
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (compressList.includes("gzip")) {
|
|
174
|
-
plugin.push(
|
|
175
|
-
compression({
|
|
176
|
-
ext: ".gz",
|
|
177
|
-
deleteOriginFile: false
|
|
178
|
-
})
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
if (compressList.includes("brotli")) {
|
|
182
|
-
plugin.push(
|
|
183
|
-
compression({
|
|
184
|
-
ext: ".br",
|
|
185
|
-
algorithm: "brotliCompress",
|
|
186
|
-
deleteOriginFile: false
|
|
187
|
-
})
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
return plugin;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const deploymentTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
194
|
-
function createBanner() {
|
|
195
|
-
return banner(`
|
|
196
|
-
/**
|
|
197
|
-
* \u7531 \u793E\u4F1A\u6CBB\u7406\u4E8B\u4E1A\u90E8 \u63D0\u4F9B\u6280\u672F\u652F\u6301
|
|
198
|
-
* Powered by wsy-admin
|
|
199
|
-
* ${deploymentTime}
|
|
200
|
-
*/
|
|
201
|
-
`);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
var __defProp$2 = Object.defineProperty;
|
|
205
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
206
|
-
var __publicField$2 = (obj, key, value) => {
|
|
207
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
253
|
+
var __defProp$1 = Object.defineProperty;
|
|
254
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
255
|
+
var __publicField$1 = (obj, key, value) => {
|
|
256
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
208
257
|
return value;
|
|
209
258
|
};
|
|
210
|
-
let Ctx$
|
|
259
|
+
let Ctx$1 = class Ctx {
|
|
211
260
|
constructor(options) {
|
|
212
|
-
__publicField$
|
|
213
|
-
__publicField$
|
|
214
|
-
__publicField$
|
|
215
|
-
__publicField$
|
|
261
|
+
__publicField$1(this, "root");
|
|
262
|
+
__publicField$1(this, "globs");
|
|
263
|
+
__publicField$1(this, "sourcePath");
|
|
264
|
+
__publicField$1(this, "path");
|
|
216
265
|
this.globs = options.globs;
|
|
217
266
|
}
|
|
218
267
|
setRoot(root) {
|
|
@@ -235,7 +284,7 @@ let Ctx$2 = class Ctx {
|
|
|
235
284
|
}
|
|
236
285
|
};
|
|
237
286
|
function scssPreprocessor(options) {
|
|
238
|
-
const ctx = new Ctx$
|
|
287
|
+
const ctx = new Ctx$1(options);
|
|
239
288
|
return {
|
|
240
289
|
name: "vite-plugin-scssPreprocessor",
|
|
241
290
|
enforce: "pre",
|
|
@@ -260,91 +309,16 @@ function createPreprocessor() {
|
|
|
260
309
|
});
|
|
261
310
|
}
|
|
262
311
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
let Ctx$1 = class Ctx {
|
|
270
|
-
constructor() {
|
|
271
|
-
__publicField$1(this, "root");
|
|
272
|
-
__publicField$1(this, "outDirName");
|
|
273
|
-
__publicField$1(this, "dir");
|
|
274
|
-
__publicField$1(this, "outDir");
|
|
275
|
-
}
|
|
276
|
-
setOptions(options) {
|
|
277
|
-
this.root = options.root;
|
|
278
|
-
this.outDirName = options.outDirName;
|
|
279
|
-
this.getDirPath();
|
|
280
|
-
}
|
|
281
|
-
getDirPath() {
|
|
282
|
-
const dir = resolve$1(this.root, this.outDirName);
|
|
283
|
-
const outDir = `${dir}.zip`;
|
|
284
|
-
this.dir = dir;
|
|
285
|
-
this.outDir = outDir;
|
|
286
|
-
}
|
|
287
|
-
async clean() {
|
|
288
|
-
const pathExists = await fse.pathExists(this.outDir);
|
|
289
|
-
if (pathExists) {
|
|
290
|
-
fse.remove(this.outDir);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
async compress() {
|
|
294
|
-
const zip = new JSZip();
|
|
295
|
-
const files = this.getAllFiles(this.dir);
|
|
296
|
-
if (files && Array.isArray(files) && files.length) {
|
|
297
|
-
files.forEach((file) => {
|
|
298
|
-
const fileData = readFileSync(file, { encoding: "binary" });
|
|
299
|
-
zip.file(relative(this.dir, file), fileData, { binary: true });
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
const content = await zip.generateAsync({ type: "arraybuffer" });
|
|
303
|
-
writeFileSync(this.outDir, Buffer.from(content));
|
|
304
|
-
}
|
|
305
|
-
getAllFiles(dirPath) {
|
|
306
|
-
const files = readdirSync(dirPath);
|
|
307
|
-
const result = [];
|
|
308
|
-
for (const file of files) {
|
|
309
|
-
const filePath = join(dirPath, file);
|
|
310
|
-
if (statSync(filePath).isDirectory()) {
|
|
311
|
-
result.push(...this.getAllFiles(filePath));
|
|
312
|
-
} else {
|
|
313
|
-
result.push(filePath);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return result;
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
const ctx$1 = new Ctx$1();
|
|
320
|
-
function zipPack() {
|
|
321
|
-
return {
|
|
322
|
-
name: "vite-plugin-zip",
|
|
323
|
-
apply: "build",
|
|
324
|
-
enforce: "post",
|
|
325
|
-
configResolved(configuration) {
|
|
326
|
-
const outDirName = configuration.build.outDir;
|
|
327
|
-
const root = configuration.root;
|
|
328
|
-
ctx$1.setOptions({ root, outDirName });
|
|
329
|
-
},
|
|
330
|
-
buildEnd() {
|
|
331
|
-
let isCompress = false;
|
|
332
|
-
process.on("beforeExit", async () => {
|
|
333
|
-
if (isCompress) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
consola.start("\u5C06\u6587\u4EF6\u5305\u538B\u7F29\u6210zip...");
|
|
337
|
-
isCompress = true;
|
|
338
|
-
await ctx$1.clean();
|
|
339
|
-
await ctx$1.compress();
|
|
340
|
-
consola.success("\u6587\u4EF6\u538B\u7F29\u5B8C\u6210");
|
|
341
|
-
consola.success("\u6253\u5305\u6D41\u7A0B\u7ED3\u675F!");
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
};
|
|
312
|
+
function createSvgIcon(isBuild) {
|
|
313
|
+
return createSvgIconsPlugin({
|
|
314
|
+
iconDirs: [path.resolve(process.cwd(), "src/assets/icons/")],
|
|
315
|
+
symbolId: "icon-[dir]-[name]",
|
|
316
|
+
svgoOptions: isBuild
|
|
317
|
+
});
|
|
345
318
|
}
|
|
346
|
-
|
|
347
|
-
|
|
319
|
+
|
|
320
|
+
function createUnocss() {
|
|
321
|
+
return Unocss();
|
|
348
322
|
}
|
|
349
323
|
|
|
350
324
|
function createIcons() {
|
|
@@ -353,12 +327,6 @@ function createIcons() {
|
|
|
353
327
|
});
|
|
354
328
|
}
|
|
355
329
|
|
|
356
|
-
function createConsole() {
|
|
357
|
-
return TurboConsole({
|
|
358
|
-
disableLaunchEditor: true
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
330
|
function createInspector(env) {
|
|
363
331
|
const { VITE_APP_INSPECTOR } = env;
|
|
364
332
|
if (VITE_APP_INSPECTOR && VITE_APP_INSPECTOR === "true") {
|
|
@@ -372,17 +340,6 @@ function createOpenAPI() {
|
|
|
372
340
|
return OpenAPI();
|
|
373
341
|
}
|
|
374
342
|
|
|
375
|
-
function createConfig() {
|
|
376
|
-
return EnvRuntime({
|
|
377
|
-
name: "__PRODUCTION__PUBINFO__CONFIG__",
|
|
378
|
-
filename: "config.js",
|
|
379
|
-
include: [
|
|
380
|
-
"VITE_APP_TITLE",
|
|
381
|
-
"VITE_APP_API_BASEURL"
|
|
382
|
-
]
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
343
|
var __defProp = Object.defineProperty;
|
|
387
344
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
388
345
|
var __publicField = (obj, key, value) => {
|
|
@@ -442,7 +399,13 @@ function createVitePlugins(viteEnv, isBuild = false) {
|
|
|
442
399
|
const vitePlugins = [
|
|
443
400
|
vue(),
|
|
444
401
|
vueJsx(),
|
|
445
|
-
vueLegacy(
|
|
402
|
+
vueLegacy({
|
|
403
|
+
modernPolyfills: [
|
|
404
|
+
"es.array.at",
|
|
405
|
+
"es.array.find-last"
|
|
406
|
+
],
|
|
407
|
+
additionalLegacyPolyfills: ["abort-controller/polyfill"]
|
|
408
|
+
}),
|
|
446
409
|
createAutoImport(),
|
|
447
410
|
createComponents(),
|
|
448
411
|
createUnocss(),
|
|
@@ -452,11 +415,11 @@ function createVitePlugins(viteEnv, isBuild = false) {
|
|
|
452
415
|
createMock(viteEnv, isBuild),
|
|
453
416
|
createBanner(),
|
|
454
417
|
createPreprocessor(),
|
|
455
|
-
createZip(),
|
|
418
|
+
// createZip(),
|
|
456
419
|
createConsole(),
|
|
457
420
|
createInspector(viteEnv),
|
|
458
421
|
createOpenAPI(),
|
|
459
|
-
createConfig(),
|
|
422
|
+
// createConfig(),
|
|
460
423
|
appInfo()
|
|
461
424
|
];
|
|
462
425
|
const buildPlugins = () => [
|
|
@@ -468,65 +431,6 @@ function createVitePlugins(viteEnv, isBuild = false) {
|
|
|
468
431
|
return vitePlugins.filter(Boolean);
|
|
469
432
|
}
|
|
470
433
|
|
|
471
|
-
async function createDefineSystemInfo(root) {
|
|
472
|
-
try {
|
|
473
|
-
const pkgJson = await readPackageJSON(root);
|
|
474
|
-
const { dependencies, devDependencies, version } = pkgJson;
|
|
475
|
-
const lastBuildTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
476
|
-
const SYSTEM_INFO = {
|
|
477
|
-
pkg: {
|
|
478
|
-
dependencies,
|
|
479
|
-
devDependencies,
|
|
480
|
-
version
|
|
481
|
-
},
|
|
482
|
-
lastBuildTime
|
|
483
|
-
};
|
|
484
|
-
return JSON.stringify(SYSTEM_INFO);
|
|
485
|
-
} catch (error) {
|
|
486
|
-
return "";
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
function getServerProxy(env, isProxy, rewrite = true) {
|
|
490
|
-
if (!isProxy) {
|
|
491
|
-
return {};
|
|
492
|
-
}
|
|
493
|
-
const targetPrefix = "VITE_APP_API_";
|
|
494
|
-
const proxyKey = Object.keys(env).filter((key) => key.startsWith(targetPrefix));
|
|
495
|
-
const serverProxy = {};
|
|
496
|
-
for (const envKey of proxyKey) {
|
|
497
|
-
const url = env[envKey];
|
|
498
|
-
const { pathname } = new URL(url);
|
|
499
|
-
const pk = `${pathname}/proxy`;
|
|
500
|
-
if (pk in serverProxy) {
|
|
501
|
-
consola$1.error(`The proxy key ${chalk.bold.redBright(envKey)} \u279C ${chalk.bold.yellowBright(url)} already exists`);
|
|
502
|
-
} else {
|
|
503
|
-
serverProxy[pk] = {
|
|
504
|
-
target: url,
|
|
505
|
-
changeOrigin: rewrite,
|
|
506
|
-
rewrite: (path) => {
|
|
507
|
-
return path.replace(pk, "");
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
return serverProxy;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function cleanse() {
|
|
516
|
-
return {
|
|
517
|
-
name: "esbuild-plugin-cleanse",
|
|
518
|
-
setup(build) {
|
|
519
|
-
build.onLoad({ filter: /\/dist\/alova\.esm\.js$/ }, async (args) => {
|
|
520
|
-
let alovaContnet = await fs.readFile(args.path, "utf-8");
|
|
521
|
-
alovaContnet = alovaContnet.replace(/\/\* c8 ignore start \*\/[\s\S]*?\/\* c8 ignore stop \*\//g, "");
|
|
522
|
-
return {
|
|
523
|
-
contents: `${alovaContnet}`
|
|
524
|
-
};
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
|
|
530
434
|
function defineConfig(defineOptions = {}) {
|
|
531
435
|
return defineConfig$1(async ({ mode, command }) => {
|
|
532
436
|
const root = process.cwd();
|
|
@@ -608,7 +512,10 @@ function defineConfig(defineOptions = {}) {
|
|
|
608
512
|
},
|
|
609
513
|
plugins: createVitePlugins(env, isBuild)
|
|
610
514
|
};
|
|
611
|
-
return mergeConfig(
|
|
515
|
+
return mergeConfig(
|
|
516
|
+
applicationConfig,
|
|
517
|
+
typeof defineOptions === "function" ? defineOptions({ mode, command }) : defineOptions
|
|
518
|
+
);
|
|
612
519
|
});
|
|
613
520
|
}
|
|
614
521
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.10",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -20,38 +20,38 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@intlify/unplugin-vue-i18n": "^4.0.0",
|
|
23
|
-
"@pubinfo/unplugin-openapi": "^0.
|
|
24
|
-
"@vitejs/plugin-legacy": "^5.4.
|
|
25
|
-
"@vitejs/plugin-vue": "^5.
|
|
26
|
-
"@vitejs/plugin-vue-jsx": "^4.0.
|
|
27
|
-
"
|
|
23
|
+
"@pubinfo/unplugin-openapi": "^0.7.0",
|
|
24
|
+
"@vitejs/plugin-legacy": "^5.4.2",
|
|
25
|
+
"@vitejs/plugin-vue": "^5.1.4",
|
|
26
|
+
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
27
|
+
"abort-controller": "^3.0.0",
|
|
28
|
+
"boxen": "^8.0.1",
|
|
28
29
|
"chalk": "^5.3.0",
|
|
29
30
|
"consola": "^3.2.3",
|
|
30
|
-
"dayjs": "^1.11.
|
|
31
|
+
"dayjs": "^1.11.13",
|
|
31
32
|
"fast-glob": "^3.3.2",
|
|
32
33
|
"fs-extra": "^11.2.0",
|
|
33
34
|
"jszip": "^3.10.1",
|
|
34
|
-
"pkg-types": "^1.
|
|
35
|
-
"terser": "^5.31.
|
|
36
|
-
"unocss": "^0.
|
|
37
|
-
"unplugin-auto-import": "^0.
|
|
38
|
-
"unplugin-icons": "^0.19.
|
|
39
|
-
"unplugin-turbo-console": "^1.
|
|
40
|
-
"unplugin-vue-components": "^0.27.
|
|
35
|
+
"pkg-types": "^1.2.0",
|
|
36
|
+
"terser": "^5.31.6",
|
|
37
|
+
"unocss": "^0.62.3",
|
|
38
|
+
"unplugin-auto-import": "^0.18.2",
|
|
39
|
+
"unplugin-icons": "^0.19.2",
|
|
40
|
+
"unplugin-turbo-console": "^1.10.1",
|
|
41
|
+
"unplugin-vue-components": "^0.27.4",
|
|
41
42
|
"vite-plugin-banner": "^0.7.1",
|
|
42
43
|
"vite-plugin-compression": "^0.5.1",
|
|
43
44
|
"vite-plugin-env-runtime": "^0.3.5",
|
|
44
45
|
"vite-plugin-fake-server": "^2.1.1",
|
|
45
46
|
"vite-plugin-pages": "^0.32.3",
|
|
46
47
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
47
|
-
"vite-plugin-vue-devtools": "^7.3.
|
|
48
|
+
"vite-plugin-vue-devtools": "^7.3.9"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@types/fs-extra": "^11.0.4",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"vue": "^
|
|
54
|
-
"vue-i18n": "^9.13.1"
|
|
52
|
+
"vite": "^5.4.8",
|
|
53
|
+
"vue": "^3.5.12",
|
|
54
|
+
"vue-i18n": "^10.0.4"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"clean": "pnpm rimraf node_modules dist .turbo",
|