@gsc-basic/vite-config 1.1.0 → 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/dist/index.d.ts +7 -1
- package/dist/index.js +6 -6
- package/package.json +7 -6
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
|
@@ -7,16 +7,16 @@ 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: 1.0
|
|
11
|
-
Build Time: 2026/2/
|
|
12
|
-
Build Commit:
|
|
10
|
+
Version: 1.1.0
|
|
11
|
+
Build Time: 2026/2/26 13:54:07
|
|
12
|
+
Build Commit: 146647e89e88d3fc8125f46aceb9a611688ea791
|
|
13
13
|
*/
|
|
14
|
-
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>
|
|
15
15
|
<meta name="revised" content="${i}" />
|
|
16
16
|
<script>window.${r.DEPLOY_ENV_VAR_NAME} = "@DEPLOY__ENV";</script>
|
|
17
|
-
</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`/**
|
|
18
18
|
* name: ${e?.name}
|
|
19
19
|
* version: v${e?.version}
|
|
20
20
|
* author: ${typeof e?.author=="string"?e.author:e?.author&&e.author.name||""}
|
|
21
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=
|
|
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsc-basic/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.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
7
|
"license": "LicenseRef-Proprietary",
|
|
@@ -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",
|