@gsc-basic/vite-config 2.0.1 → 2.0.3
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 +2 -1
- package/dist/index.js +3 -3
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
import * as _$vite from "vite";
|
|
2
3
|
import { ConfigEnv, PluginOption, UserConfig } from "vite";
|
|
3
4
|
import { PluginOptions } from "@intlify/unplugin-vue-i18n";
|
|
4
5
|
|
|
@@ -150,7 +151,7 @@ type DefineConfig = (config?: ConfigEnv) => Promise<{
|
|
|
150
151
|
declare function createVitePlugins(options: ApplicationOptions): Promise<PluginOption[]>;
|
|
151
152
|
//#endregion
|
|
152
153
|
//#region src/config/index.d.ts
|
|
153
|
-
declare function defineConfig(config?: DefineConfig):
|
|
154
|
+
declare function defineConfig(config?: DefineConfig): _$vite.UserConfigFnPromise;
|
|
154
155
|
//#endregion
|
|
155
156
|
//#region src/utils/index.d.ts
|
|
156
157
|
declare function generateProjectInfo({
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@ You shall not disclose such Confidential Information and shall use it only in
|
|
|
7
7
|
accordance with the terms of the license agreement.
|
|
8
8
|
|
|
9
9
|
--- Build Info ---
|
|
10
|
-
Version: 2.0.
|
|
11
|
-
Build Time: 2026/
|
|
12
|
-
Build Commit:
|
|
10
|
+
Version: 2.0.2
|
|
11
|
+
Build Time: 2026/5/15 11:07:19
|
|
12
|
+
Build Commit: 2fcaec97eb3ec329da1739c52df51ff63c73fa62
|
|
13
13
|
*/
|
|
14
14
|
import e from"@vitejs/plugin-vue";import t from"@vitejs/plugin-vue-jsx";import n from"@vitejs/plugin-legacy";import r from"@intlify/unplugin-vue-i18n/vite";import{mockDevServerPlugin as i}from"vite-plugin-mock-dev-server";import a from"unplugin-info/vite";import o from"unplugin-turbo-console/vite";import s from"vite-plugin-vue-devtools";import c from"unplugin-icons/vite";import{compression as l,tarball as u}from"vite-plugin-compression2";import d,{resolve as f}from"node:path";import p from"unplugin-svg-component/vite";import{analyzer as m}from"vite-bundle-analyzer";import{webUpdateNotice as h}from"@plugin-web-update-notification/vite";import{defineConfig as g,mergeConfig as _}from"vite";import v from"autoprefixer";import y from"ansis";import{regexpMap as b}from"@gsc-basic/utils";function x(e=`GSC Scaffolding`,t){return{name:`html-injection`,transformIndexHtml(n){let r=`${t.lastBuildTime}(v${t.pkg.version})`;return n.replace(`</head>`,`<title>${e}</title>\n<meta name="revised" content="${r}" />\n<script>window.${t.DEPLOY_ENV_VAR_NAME} = "@DEPLOY__ENV";<\/script>\n</head>`)}}}function S(e){let{compressList:t=[],tarballResult:n=!1,deleteOriginalAssets:r=!1}=e,i=[];return t.length>0&&i.push(l({algorithms:t,deleteOriginalAssets:r,skipIfLargerOrEqual:!1,exclude:[/\.(br)$/,/\.(gz)$/]})),n&&i.length>0&&i.push(u()),i}function C({prefixClass:e=`lenovo`,iconDir:t=`src/assets/icons`,componentName:n=`SvgIcon`,preserveColorDir:r}){let i={treeShaking:!1};return r&&(i.preserveColor=d.resolve(process.cwd(),r)),p({iconDir:[d.resolve(process.cwd(),t)],projectType:`vue`,vueVersion:3,dts:!1,componentName:n,prefix:void 0,symbolIdFormatter:(e,t)=>{let n=e.split(`/`);return t&&n.unshift(t),n.join(`-`).replace(/\.svg$/,``)},componentStyle:`width: 1em;height: 1em;fill: currentColor;vertical-align: -0.125em;`,svgSpriteDomId:`${e}-svg-dom`,domInsertionStrategy:`dynamic`,...i})}function w(e=``,t=8080){return m({reportTitle:`${e} Analyzer`,analyzerMode:`server`,analyzerPort:t+200,openAnalyzer:!0})}function T({base:e,primaryColor:t}){return h({checkInterval:1800*1e3,checkOnWindowFocus:!0,checkImmediately:!1,checkOnLoadFileError:!0,hiddenDefaultNotification:!1,logVersion:!1,notificationConfig:{primaryColor:t},injectFileBase:e??`/`})}function E(e,t){return Math.floor(Math.random()*(t-e+1))+e}function D(e){return import(e)}async function O(l){let u=[e({template:{compilerOptions:{isCustomElement:e=>e.startsWith(`micro-app`)}}}),t()];if(l.vueRouter)try{let{default:e}=await D(`vue-router/vite`);u.unshift(e(l.vueRouterOptions||{}))}catch(e){console.warn("[vite-config] `vueRouter` is enabled but `vue-router 5.x` is not installed, skip VueRouter plugin.",e)}if(l.unocss)try{let{default:e}=await D(`unocss/vite`);u.push(e({mode:`global`}))}catch(e){console.warn("[vite-config] `unocss` is enabled but `unocss` is not installed, skip UnoCSS plugin.",e)}if(l.iconify&&u.push(c({compiler:`vue3`,autoInstall:!0})),l.injectMetadata&&u.push(a({meta:{themeToken:l.themeToken,appInfo:l.appInfo},package:{dependencies:!0,devDependencies:!0}})),l.i18n&&u.push(r({fullInstall:!0,runtimeOnly:!0,...l.i18nOptions||{}})),l.isBuild?(l.legacy&&u.push(n({targets:[`> 0.2%`,`not dead`,`not op_mini all`]})),l.compress&&u.push(...S(l.compressOptions||{})),l.updateNotice&&u.push(T({base:l.base,primaryColor:l.themeToken?.colorPrimary}))):(l.turboConsole&&u.push(o({server:{port:(l.serverPort??8080)+E(100,1e3)},launchEditor:!0})),l.devtools&&u.push(s({launchEditor:`code`}))),l.svgIcon){let e=l.svgIconOptions??{};u.push(C({prefixClass:l.prefixClass,iconDir:e.iconDir,preserveColorDir:e.preserveColorDir}))}return l.html&&u.push(x(l.appTitle,l.appInfo)),l.mock&&u.push(i({})),l.analyzer&&u.push(w(l.appTitle,l.serverPort)),u}function k({pkg:e}={}){return`/**\n * version: v${e?.version}\n * author: ${typeof e?.author==`string`?e.author:e?.author&&e.author.name||``} \n * build time: ${new Date().toLocaleString()}\n */`}function A(e,t=!1){let n={};for(let r of e){let{prefix:e,target:i,rewrite:a}=r;a===void 0&&(a=!0),n[e]={target:i,changeOrigin:!0,ws:!0,rewrite:t=>a?t.replace(RegExp(`^${e}`),``):t,...b.httpsUrl.test(i)?{secure:!1}:{},...t?{configure:e=>{e.on(`proxyRes`,(e,t)=>{console.log(`proxy: `,y.red(t.originalUrl),` ===> `,y.green(e.client.servername+t.url))})}}:{}}}return n}function j(e){return f(process.cwd(),`.`,e)}function M(e){return g(async t=>{let{command:n}=t,r=await e?.(t),i={appInfo:{},devtools:!1,injectMetadata:!0,analyzer:!1,unocss:!0,iconify:!0,svgIcon:!0,html:!0,i18n:!0,license:!0,legacy:!0,updateNotice:!0,mock:!0,turboConsole:!0,...r?.application||{}},a=n===`build`;return _({base:i.base??`/`,logLevel:`info`,resolve:{alias:[{find:/@\//,replacement:`${j(`src`)}/`}]},server:{host:!0,port:i.serverPort??8080,open:i.openPage??!0,hmr:!0,proxy:A(i.proxyConfig||[],i.showProxyLog??!1),headers:{"Access-Control-Allow-Origin":`*`}},preview:{port:(i.serverPort??8080)+100,proxy:A(i.previewProxyConfig||[],i.showPreviewProxyLog??!1)},build:{outDir:`dist`,reportCompressedSize:!1,chunkSizeWarningLimit:5e3,assetsInlineLimit:1024,rolldownOptions:{output:{postBanner:i.license?k(i.appInfo):void 0}}},define:{__APP_INFO__:JSON.stringify(i.appInfo??{}),"import.meta.vitest":`undefined`},css:{preprocessorOptions:{less:{modifyVars:i.lessModifyVars||{},javascriptEnabled:!0}},postcss:{plugins:a?[v()]:[]}},plugins:await O({...i,isBuild:a})},r?.vite||{})})}function N(e){return M(e)}export{A as createProxy,O as createVitePlugins,N as defineConfig,k as generateProjectInfo};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsc-basic/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "Vite Config for GSC Basic Service",
|
|
6
6
|
"author": "Lenovo SSG BASD <-GSC_Scaffolding_Support@lenovo.com>",
|
|
7
7
|
"license": "LicenseRef-Proprietary",
|
|
@@ -28,29 +28,29 @@
|
|
|
28
28
|
"./dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@iconify/json": "^2.2.
|
|
31
|
+
"@iconify/json": "^2.2.472",
|
|
32
32
|
"unocss": "^66.6.8",
|
|
33
|
-
"vite": "^8.0.
|
|
34
|
-
"vue-router": "^5.0.
|
|
33
|
+
"vite": "^8.0.12",
|
|
34
|
+
"vue-router": "^5.0.7"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@intlify/unplugin-vue-i18n": "^11.0
|
|
37
|
+
"@intlify/unplugin-vue-i18n": "^11.2.0",
|
|
38
38
|
"@plugin-web-update-notification/vite": "^2.0.2",
|
|
39
39
|
"@vitejs/plugin-legacy": "^8.0.1",
|
|
40
40
|
"@vitejs/plugin-vue": "^6.0.6",
|
|
41
41
|
"@vitejs/plugin-vue-jsx": "^5.1.4",
|
|
42
|
-
"ansis": "^4.
|
|
43
|
-
"autoprefixer": "^10.
|
|
42
|
+
"ansis": "^4.3.0",
|
|
43
|
+
"autoprefixer": "^10.5.0",
|
|
44
44
|
"unplugin-icons": "^23.0.1",
|
|
45
45
|
"unplugin-info": "^1.3.2",
|
|
46
|
-
"unplugin-svg-component": "^0.12.
|
|
47
|
-
"unplugin-turbo-console": "^2.3.
|
|
46
|
+
"unplugin-svg-component": "^0.12.6",
|
|
47
|
+
"unplugin-turbo-console": "^2.3.2",
|
|
48
48
|
"unplugin-vue-components": "^32.0.0",
|
|
49
|
-
"vite-bundle-analyzer": "^1.3.
|
|
49
|
+
"vite-bundle-analyzer": "^1.3.8",
|
|
50
50
|
"vite-plugin-compression2": "^2.5.3",
|
|
51
|
-
"vite-plugin-mock-dev-server": "^2.
|
|
52
|
-
"vite-plugin-vue-devtools": "^8.1.
|
|
53
|
-
"@gsc-basic/utils": "1.3.
|
|
51
|
+
"vite-plugin-mock-dev-server": "^2.2.1",
|
|
52
|
+
"vite-plugin-vue-devtools": "^8.1.2",
|
|
53
|
+
"@gsc-basic/utils": "1.3.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown",
|