@pubinfo/vite 0.6.7 → 0.6.8
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.ts +0 -1
- package/dist/index.mjs +27 -31
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -11,14 +11,13 @@ import components from 'unplugin-vue-components/vite';
|
|
|
11
11
|
import Unocss from 'unocss/vite';
|
|
12
12
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|
13
13
|
import vueI18n from '@intlify/unplugin-vue-i18n/vite';
|
|
14
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
|
|
14
15
|
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
|
|
15
|
-
import Layouts from 'vite-plugin-vue-meta-layouts';
|
|
16
16
|
import compression from 'vite-plugin-compression';
|
|
17
17
|
import banner from 'vite-plugin-banner';
|
|
18
18
|
import dayjs from 'dayjs';
|
|
19
19
|
import fg from 'fast-glob';
|
|
20
20
|
import { Buffer } from 'node:buffer';
|
|
21
|
-
import { readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
|
|
22
21
|
import JSZip from 'jszip';
|
|
23
22
|
import fse from 'fs-extra/esm';
|
|
24
23
|
import consola$1, { consola } from 'consola';
|
|
@@ -155,6 +154,10 @@ function createI18n() {
|
|
|
155
154
|
|
|
156
155
|
function createMock(env, isBuild) {
|
|
157
156
|
const { VITE_BUILD_MOCK } = env;
|
|
157
|
+
const root = process.cwd();
|
|
158
|
+
if (!existsSync(resolve$1(root, "src/mock"))) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
158
161
|
return vitePluginFakeServer({
|
|
159
162
|
logger: !isBuild,
|
|
160
163
|
include: "src/mock",
|
|
@@ -163,15 +166,9 @@ function createMock(env, isBuild) {
|
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
|
|
166
|
-
function createLayouts() {
|
|
167
|
-
return Layouts({
|
|
168
|
-
defaultLayout: "index"
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
169
|
function createCompression(env) {
|
|
173
170
|
const { VITE_BUILD_COMPRESS } = env;
|
|
174
|
-
const compressList = VITE_BUILD_COMPRESS
|
|
171
|
+
const compressList = VITE_BUILD_COMPRESS?.split(",") ?? [];
|
|
175
172
|
const plugin = [];
|
|
176
173
|
if (compressList.includes("gzip")) {
|
|
177
174
|
plugin.push(
|
|
@@ -453,7 +450,6 @@ function createVitePlugins(viteEnv, isBuild = false) {
|
|
|
453
450
|
createIcons(),
|
|
454
451
|
createI18n(),
|
|
455
452
|
createMock(viteEnv, isBuild),
|
|
456
|
-
createLayouts(),
|
|
457
453
|
createBanner(),
|
|
458
454
|
createPreprocessor(),
|
|
459
455
|
createZip(),
|
|
@@ -535,12 +531,12 @@ function defineConfig(defineOptions = {}) {
|
|
|
535
531
|
return defineConfig$1(async ({ mode, command }) => {
|
|
536
532
|
const root = process.cwd();
|
|
537
533
|
const pathResolve = (pathname) => resolve$1(root, ".", pathname);
|
|
538
|
-
const
|
|
539
|
-
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
534
|
+
const __SYSTEM_INFO__ = await createDefineSystemInfo(root);
|
|
540
535
|
const isBuild = command === "build";
|
|
536
|
+
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
537
|
+
const env = loadEnv(mode, root);
|
|
541
538
|
const { VITE_OPEN_PROXY, VITE_BUILD_SOURCEMAP } = env;
|
|
542
539
|
const serverProxy = getServerProxy(env, !isBuild && VITE_OPEN_PROXY === "true");
|
|
543
|
-
const __SYSTEM_INFO__ = await createDefineSystemInfo(root);
|
|
544
540
|
const applicationConfig = {
|
|
545
541
|
base: "./",
|
|
546
542
|
server: {
|
|
@@ -571,17 +567,17 @@ function defineConfig(defineOptions = {}) {
|
|
|
571
567
|
]
|
|
572
568
|
},
|
|
573
569
|
optimizeDeps: {
|
|
574
|
-
include: [
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
],
|
|
570
|
+
// include: [
|
|
571
|
+
// 'ant-design-vue/es/locale/zh_CN',
|
|
572
|
+
// 'ant-design-vue/es/locale/en_US',
|
|
573
|
+
// '@ant-design/icons-vue',
|
|
574
|
+
// 'dayjs',
|
|
575
|
+
// 'dayjs/locale/eu',
|
|
576
|
+
// 'dayjs/locale/zh-cn',
|
|
577
|
+
// '@pubinfo/pro-components',
|
|
578
|
+
// 'qrcode',
|
|
579
|
+
// '@pubinfo/headlessui',
|
|
580
|
+
// ],
|
|
585
581
|
esbuildOptions: {
|
|
586
582
|
plugins: [
|
|
587
583
|
cleanse()
|
|
@@ -595,13 +591,13 @@ function defineConfig(defineOptions = {}) {
|
|
|
595
591
|
chunkSizeWarningLimit: 2e3,
|
|
596
592
|
rollupOptions: {
|
|
597
593
|
output: {
|
|
598
|
-
entryFileNames: `assets/entry/[name]-[hash]-${timestamp}.js
|
|
599
|
-
manualChunks: {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
594
|
+
entryFileNames: `assets/entry/[name]-[hash]-${timestamp}.js`
|
|
595
|
+
// manualChunks: {
|
|
596
|
+
// vue: ['vue', 'pinia', 'vue-router'],
|
|
597
|
+
// lodash: ['lodash-es'],
|
|
598
|
+
// antd: ['ant-design-vue', '@ant-design/icons-vue'],
|
|
599
|
+
// lottie: ['lottie-web'],
|
|
600
|
+
// },
|
|
605
601
|
}
|
|
606
602
|
}
|
|
607
603
|
},
|
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.8",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"vite-plugin-fake-server": "^2.1.1",
|
|
45
45
|
"vite-plugin-pages": "^0.32.3",
|
|
46
46
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
47
|
-
"vite-plugin-vue-devtools": "^7.3.5"
|
|
48
|
-
"vite-plugin-vue-meta-layouts": "^0.4.3"
|
|
47
|
+
"vite-plugin-vue-devtools": "^7.3.5"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@types/fs-extra": "^11.0.4",
|