@gsc-basic/vite-config 1.0.10 → 1.1.1
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/README.md +4 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +9 -4
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -19,3 +19,7 @@
|
|
|
19
19
|
- `defineConfig`: 用于创建 Vite 配置的工厂函数,接受一个返回应用层配置和 Vite 原生配置的异步函数。
|
|
20
20
|
|
|
21
21
|
使用文档:https://gsc-basic.lenovo.com/gsc-docs/zh_CN/gsc_basic/vue/vite-config.html
|
|
22
|
+
|
|
23
|
+
## Author & License
|
|
24
|
+
|
|
25
|
+
This package is maintained by Lenovo SSG BASD. It is distributed under the LicenseRef-Proprietary license; see LICENSE for details.
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ interface CommonPluginOptions {
|
|
|
47
47
|
* @default true
|
|
48
48
|
*/
|
|
49
49
|
unocss?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* 是否开启 Vue Router 自动路由支持
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
vueRouter?: boolean;
|
|
55
|
+
vueRouterOptions?: Record<string, any>;
|
|
50
56
|
/**
|
|
51
57
|
* 图标自动安装选项
|
|
52
58
|
* @description 配置图标自动安装功能
|
|
@@ -146,7 +152,7 @@ type DefineConfig = (config?: ConfigEnv) => Promise<{
|
|
|
146
152
|
vite?: UserConfig;
|
|
147
153
|
}>;
|
|
148
154
|
|
|
149
|
-
declare function createVitePlugins(options: ApplicationOptions): PluginOption[]
|
|
155
|
+
declare function createVitePlugins(options: ApplicationOptions): Promise<PluginOption[]>;
|
|
150
156
|
|
|
151
157
|
declare function defineConfig(config?: DefineConfig): vite.UserConfigFnPromise;
|
|
152
158
|
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,18 @@ Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
|
|
|
5
5
|
This software is the confidential and proprietary property of Lenovo SSG BASD.
|
|
6
6
|
You shall not disclose such Confidential Information and shall use it only in
|
|
7
7
|
accordance with the terms of the license agreement.
|
|
8
|
+
|
|
9
|
+
--- Build Info ---
|
|
10
|
+
Version: 1.1.0
|
|
11
|
+
Build Time: 2026/2/26 13:54:07
|
|
12
|
+
Build Commit: 146647e89e88d3fc8125f46aceb9a611688ea791
|
|
8
13
|
*/
|
|
9
|
-
import $ from"@vitejs/plugin-vue";import
|
|
14
|
+
import $ from"@vitejs/plugin-vue";import k from"@vitejs/plugin-vue-jsx";import L from"@vitejs/plugin-legacy";import N from"@intlify/unplugin-vue-i18n/vite";import R from"vite-plugin-banner";import{qrcode as z}from"vite-plugin-qrcode";import{mockDevServerPlugin as E}from"vite-plugin-mock-dev-server";import V from"unplugin-info/vite";import _ from"unplugin-turbo-console/vite";import U from"vite-plugin-vue-devtools";import j from"unplugin-icons/vite";function u(e="GSC Scaffolding",r){return{name:"html-injection",transformIndexHtml(t){let i=`${r.lastBuildTime}(v${r.pkg.version})`;return t.replace("</head>",`<title>${e}</title>
|
|
10
15
|
<meta name="revised" content="${i}" />
|
|
11
16
|
<script>window.${r.DEPLOY_ENV_VAR_NAME} = "@DEPLOY__ENV";</script>
|
|
12
|
-
</head>`)}}}import{compression as
|
|
17
|
+
</head>`)}}}import{compression as b,tarball as I}from"vite-plugin-compression2";function f(e){let{compressList:r=[],tarballResult:t=!1,deleteOriginalAssets:i=!1}=e,n=[];return r.length>0&&n.push(b({algorithms:r,deleteOriginalAssets:i,skipIfLargerOrEqual:!1,exclude:[/\.(br)$/,/\.(gz)$/]})),t&&n.length>0&&n.push(I()),n}import m from"path";import w from"unplugin-svg-component/vite";function g({prefixClass:e="lenovo",iconDir:r="src/assets/icons",componentName:t="SvgIcon",preserveColorDir:i}){let n={treeShaking:!1};return i&&(n.preserveColor=m.resolve(process.cwd(),i)),w({iconDir:[m.resolve(process.cwd(),r)],projectType:"vue",vueVersion:3,dts:!1,componentName:t,prefix:void 0,symbolIdFormatter:(o,s)=>{let p=o.split("/");return s&&p.unshift(s),p.join("-").replace(/\.svg$/,"")},componentStyle:"width: 1em;height: 1em;fill: currentColor;vertical-align: -0.125em;",svgSpriteDomId:`${e}-svg-dom`,domInsertionStrategy:"dynamic",...n})}import{analyzer as S}from"vite-bundle-analyzer";function d(e="",r=8080){return S({reportTitle:`${e} Analyzer`,analyzerMode:"server",analyzerPort:r+200,openAnalyzer:!0})}import{webUpdateNotice as A}from"@plugin-web-update-notification/vite";function y({base:e,primaryColor:r}){return A({checkInterval:1800*1e3,checkOnWindowFocus:!0,checkImmediately:!1,checkOnLoadFileError:!0,hiddenDefaultNotification:!1,logVersion:!1,notificationConfig:{primaryColor:r},injectFileBase:e??"/"})}import v from"ansis";import{regexpMap as D}from"@gsc-basic/utils";function h({pkg:e}={}){return`/**
|
|
13
18
|
* name: ${e?.name}
|
|
14
19
|
* version: v${e?.version}
|
|
15
|
-
* description: ${e?.description}
|
|
16
20
|
* author: ${typeof e?.author=="string"?e.author:e?.author&&e.author.name||""}
|
|
17
|
-
|
|
21
|
+
* build time: ${new Date().toLocaleString()}
|
|
22
|
+
*/`}function l(e,r=!1){let t={};for(let i of e){let{prefix:n,target:o,rewrite:s}=i;typeof s>"u"&&(s=!0);let p=D.httpsUrl.test(o);t[n]={target:o,changeOrigin:!0,ws:!0,rewrite:a=>s?a.replace(new RegExp(`^${n}`),""):a,...p?{secure:!1}:{},...r?{configure:a=>{a.on("proxyRes",(C,c)=>{console.log("proxy: ",v.red(c.originalUrl)," ===> ",v.green(C.client.servername+c.url))})}}:{}}}return t}function T(e,r){return Math.floor(Math.random()*(r-e+1))+e}function P(e){return import(e)}async function O(e){let r=[$({template:{compilerOptions:{isCustomElement:t=>t.startsWith("micro-app")}}}),k()];if(e.vueRouter)try{let{default:t}=await P("vue-router/vite");r.unshift(t(e.vueRouterOptions||{}))}catch(t){console.warn("[vite-config] `vueRouter` is enabled but `vue-router 5.x` is not installed, skip VueRouter plugin.",t)}if(e.unocss)try{let{default:t}=await P("unocss/vite");r.push(t({mode:"global"}))}catch(t){console.warn("[vite-config] `unocss` is enabled but `unocss` is not installed, skip UnoCSS plugin.",t)}if(e.iconify&&r.push(j({compiler:"vue3",autoInstall:!0})),e.injectMetadata&&r.push(V({meta:{themeToken:e.themeToken,appInfo:e.appInfo},package:{dependencies:!0,devDependencies:!0}})),e.i18n&&r.push(N({fullInstall:!0,runtimeOnly:!0,...e.i18nOptions||{}})),e.isBuild?(e.legacy&&r.push(L({targets:["> 0.2%","not dead","not op_mini all"]})),e.compress&&r.push(...f(e.compressOptions||{})),e.license&&r.push(R(h(e.appInfo))),e.updateNotice&&r.push(y({base:e.base,primaryColor:e.themeToken?.colorPrimary}))):(e.turboConsole&&r.push(_({server:{port:(e.serverPort??8080)+T(100,1e3)},launchEditor:!0})),e.devtools&&r.push(U({launchEditor:"code"})),e.qrcode&&r.push(z())),e.svgIcon){let t=e.svgIconOptions??{};r.push(g({prefixClass:e.prefixClass,iconDir:t.iconDir,preserveColorDir:t.preserveColorDir}))}return e.html&&r.push(u(e.appTitle,e.appInfo)),e.mock&&r.push(E({})),e.analyzer&&r.push(d(e.appTitle,e.serverPort)),r}import{resolve as M}from"path";import{defineConfig as F,mergeConfig as B}from"vite";import H from"autoprefixer";function q(e){return M(process.cwd(),".",e)}function x(e){return F(async r=>{let{command:t}=r,i=await e?.(r),o={...{appInfo:{},devtools:!1,injectMetadata:!0,analyzer:!1,unocss:!0,iconify:!0,svgIcon:!0,html:!0,i18n:!0,license:!0,legacy:!0,updateNotice:!0,qrcode:!1,mock:!0,turboConsole:!0},...i?.application||{}},s=t==="build",p={base:o.base??"/",root:process.cwd(),logLevel:"info",resolve:{alias:[{find:/@\//,replacement:`${q("src")}/`}]},server:{host:!0,port:o.serverPort??8080,open:o.openPage??!0,hmr:!0,proxy:l(o.proxyConfig||[],o.showProxyLog??!1),headers:{"Access-Control-Allow-Origin":"*"}},preview:{port:(o.serverPort??8080)+100,proxy:l(o.previewProxyConfig||[],o.showPreviewProxyLog??!1)},esbuild:{charset:"ascii"},build:{outDir:"dist",minify:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:5e3,assetsInlineLimit:1024},define:{__APP_INFO__:JSON.stringify(o.appInfo??{}),"import.meta.vitest":"undefined"},css:{preprocessorOptions:{less:{modifyVars:o.lessModifyVars||{},javascriptEnabled:!0}},postcss:{plugins:s?[H()]:[]}},plugins:await O({...o,isBuild:s})};return B(p,i?.vite||{})})}function ke(e){return x(e)}export{l as createProxy,O as createVitePlugins,ke as defineConfig,h as generateProjectInfo};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsc-basic/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "Vite Config for GSC Basic Service",
|
|
6
6
|
"author": "Lenovo SSG BASD <-GSC_Scaffolding_Support@lenovo.com>",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "LicenseRef-Proprietary",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://gitlab.xpaas.lenovo.com/tsd-basic/gsc-frontend-config.git"
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"./dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
31
|
+
"unocss": "^66.6.1",
|
|
32
|
+
"vite": "^7.3.1",
|
|
33
|
+
"vue-router": "^5.0.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@
|
|
36
|
+
"@iconify/json": "^2.2.443",
|
|
37
|
+
"@intlify/unplugin-vue-i18n": "^11.0.7",
|
|
37
38
|
"@plugin-web-update-notification/vite": "^2.0.2",
|
|
38
39
|
"@vitejs/plugin-legacy": "^7.2.1",
|
|
39
40
|
"@vitejs/plugin-vue": "^6.0.4",
|
|
40
41
|
"@vitejs/plugin-vue-jsx": "^5.1.4",
|
|
41
42
|
"ansis": "^4.2.0",
|
|
42
|
-
"autoprefixer": "^10.4.
|
|
43
|
+
"autoprefixer": "^10.4.27",
|
|
43
44
|
"unplugin-icons": "^23.0.1",
|
|
44
45
|
"unplugin-info": "^1.2.4",
|
|
45
46
|
"unplugin-svg-component": "^0.12.4",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"vite-plugin-mock-dev-server": "^2.0.7",
|
|
52
53
|
"vite-plugin-qrcode": "^0.3.0",
|
|
53
54
|
"vite-plugin-vue-devtools": "^8.0.6",
|
|
54
|
-
"@gsc-basic/utils": "1.
|
|
55
|
+
"@gsc-basic/utils": "1.3.0"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
58
|
"build": "tsup",
|