@gsc-basic/vite-config 1.0.8 → 1.0.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/LICENSE +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -12
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
|
|
2
|
+
@license Proprietary
|
|
3
|
+
|
|
4
|
+
This software is the confidential and proprietary property of Lenovo SSG BASD.
|
|
5
|
+
You shall not disclose such Confidential Information and shall use it only in
|
|
6
|
+
accordance with the terms of the license agreement.
|
package/dist/index.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ declare function createVitePlugins(options: ApplicationOptions): PluginOption[];
|
|
|
150
150
|
|
|
151
151
|
declare function defineConfig(config?: DefineConfig): vite.UserConfigFnPromise;
|
|
152
152
|
|
|
153
|
-
declare function generateProjectInfo(
|
|
153
|
+
declare function generateProjectInfo({ pkg }?: {
|
|
154
154
|
pkg?: Record<string, string>;
|
|
155
155
|
}): string;
|
|
156
156
|
interface ProxyItem {
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
|
|
3
|
+
@license Proprietary
|
|
4
|
+
|
|
5
|
+
This software is the confidential and proprietary property of Lenovo SSG BASD.
|
|
6
|
+
You shall not disclose such Confidential Information and shall use it only in
|
|
7
|
+
accordance with the terms of the license agreement.
|
|
8
|
+
*/
|
|
9
|
+
import $ from"@vitejs/plugin-vue";import D from"@vitejs/plugin-vue-jsx";import N from"@vitejs/plugin-legacy";import z from"@intlify/unplugin-vue-i18n/vite";import E from"vite-plugin-banner";import{qrcode as L}from"vite-plugin-qrcode";import{mockDevServerPlugin as _}from"vite-plugin-mock-dev-server";import k from"unplugin-info/vite";import V from"unplugin-turbo-console/vite";import j from"vite-plugin-vue-devtools";import T from"unocss/vite";import U from"unplugin-icons/vite";function c(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>
|
|
2
10
|
<meta name="revised" content="${i}" />
|
|
3
11
|
<script>window.${r.DEPLOY_ENV_VAR_NAME} = "@DEPLOY__ENV";</script>
|
|
4
|
-
</head>`)}}}import{compression as C,tarball as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`:""} * name: ${r?.name}
|
|
11
|
-
* version: v${r?.version}
|
|
12
|
-
* description: ${r?.description}
|
|
13
|
-
* author: ${typeof r?.author=="string"?r.author:r?.author&&r.author.name||""}
|
|
14
|
-
*/`}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=S.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",(x,f)=>{console.log("proxy: ",v.red(f.originalUrl)," ===> ",v.green(x.client.servername+f.url))})}}:{}}}return t}function R(e,r){return Math.floor(Math.random()*(r-e+1))+e}function P(e){let r=[$({template:{compilerOptions:{isCustomElement:t=>t.startsWith("micro-app")}}}),D()];if(e.unocss&&r.push(U({mode:"global"})),e.iconify&&r.push(M({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(...m(e.compressOptions||{})),e.license&&r.push(z(h(!0,e.appInfo))),e.updateNotice&&r.push(y({base:e.base,primaryColor:e.themeToken?.colorPrimary}))):(e.turboConsole&&r.push(j({server:{port:(e.serverPort??8080)+R(100,1e3)},launchEditor:!0})),e.devtools&&r.push(T({launchEditor:"code"})),e.qrcode&&r.push(E())),e.svgIcon){let t=e.svgIconOptions??{};r.push(g({prefixClass:e.prefixClass,iconDir:t.iconDir,preserveColorDir:t.preserveColorDir}))}return e.html&&r.push(c(e.appTitle,e.appInfo)),e.mock&&r.push(k({})),e.analyzer&&r.push(d(e.appTitle,e.serverPort)),r}import{resolve as F}from"path";import{defineConfig as B,mergeConfig as H}from"vite";import q from"autoprefixer";function W(e){return F(process.cwd(),".",e)}function O(e){return B(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:`${W("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?[q()]:[]}},plugins:P({...o,isBuild:s})};return H(p,i?.vite||{})})}function Ne(e){return O(e)}export{l as createProxy,P as createVitePlugins,Ne as defineConfig,h as generateProjectInfo};
|
|
12
|
+
</head>`)}}}import{compression as C,tarball as I}from"vite-plugin-compression2";function m(e){let{compressList:r=[],tarballResult:t=!1,deleteOriginalAssets:i=!1}=e,n=[];return r.length>0&&n.push(C({algorithms:r,deleteOriginalAssets:i,skipIfLargerOrEqual:!1,exclude:[/\.(br)$/,/\.(gz)$/]})),t&&n.length>0&&n.push(I()),n}import u from"path";import b 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=u.resolve(process.cwd(),i)),b({iconDir:[u.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 w}from"vite-bundle-analyzer";function d(e="",r=8080){return w({reportTitle:`${e} Analyzer`,analyzerMode:"server",analyzerPort:r+200,openAnalyzer:!0})}import{webUpdateNotice as S}from"@plugin-web-update-notification/vite";function y({base:e,primaryColor:r}){return S({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 A}from"@gsc-basic/utils";function h({pkg:e}={}){return`/**
|
|
13
|
+
* name: ${e?.name}
|
|
14
|
+
* version: v${e?.version}
|
|
15
|
+
* description: ${e?.description}
|
|
16
|
+
* author: ${typeof e?.author=="string"?e.author:e?.author&&e.author.name||""}
|
|
17
|
+
*/`}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=A.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",(x,f)=>{console.log("proxy: ",v.red(f.originalUrl)," ===> ",v.green(x.client.servername+f.url))})}}:{}}}return t}function M(e,r){return Math.floor(Math.random()*(r-e+1))+e}function P(e){let r=[$({template:{compilerOptions:{isCustomElement:t=>t.startsWith("micro-app")}}}),D()];if(e.unocss&&r.push(T({mode:"global"})),e.iconify&&r.push(U({compiler:"vue3",autoInstall:!0})),e.injectMetadata&&r.push(k({meta:{themeToken:e.themeToken,appInfo:e.appInfo},package:{dependencies:!0,devDependencies:!0}})),e.i18n&&r.push(z({fullInstall:!0,runtimeOnly:!0,...e.i18nOptions||{}})),e.isBuild?(e.legacy&&r.push(N({targets:["> 0.2%","not dead","not op_mini all"]})),e.compress&&r.push(...m(e.compressOptions||{})),e.license&&r.push(E(h(e.appInfo))),e.updateNotice&&r.push(y({base:e.base,primaryColor:e.themeToken?.colorPrimary}))):(e.turboConsole&&r.push(V({server:{port:(e.serverPort??8080)+M(100,1e3)},launchEditor:!0})),e.devtools&&r.push(j({launchEditor:"code"})),e.qrcode&&r.push(L())),e.svgIcon){let t=e.svgIconOptions??{};r.push(g({prefixClass:e.prefixClass,iconDir:t.iconDir,preserveColorDir:t.preserveColorDir}))}return e.html&&r.push(c(e.appTitle,e.appInfo)),e.mock&&r.push(_({})),e.analyzer&&r.push(d(e.appTitle,e.serverPort)),r}import{resolve as R}from"path";import{defineConfig as F,mergeConfig as B}from"vite";import H from"autoprefixer";function q(e){return R(process.cwd(),".",e)}function O(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:P({...o,isBuild:s})};return B(p,i?.vite||{})})}function ze(e){return O(e)}export{l as createProxy,P as createVitePlugins,ze 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.0.
|
|
4
|
+
"version": "1.0.10",
|
|
5
5
|
"description": "Vite Config for GSC Basic Service",
|
|
6
|
-
"author": "
|
|
7
|
-
"license": "
|
|
6
|
+
"author": "Lenovo SSG BASD <-GSC_Scaffolding_Support@lenovo.com>",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://gitlab.xpaas.lenovo.com/tsd-basic/gsc-frontend-config.git"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@iconify/json": "^2.2.
|
|
31
|
+
"@iconify/json": "^2.2.438",
|
|
32
32
|
"unocss": "^66.6.0",
|
|
33
33
|
"vite": "^7.3.1"
|
|
34
34
|
},
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
37
37
|
"@plugin-web-update-notification/vite": "^2.0.2",
|
|
38
38
|
"@vitejs/plugin-legacy": "^7.2.1",
|
|
39
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
40
|
-
"@vitejs/plugin-vue-jsx": "^5.1.
|
|
39
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
40
|
+
"@vitejs/plugin-vue-jsx": "^5.1.4",
|
|
41
41
|
"ansis": "^4.2.0",
|
|
42
|
-
"autoprefixer": "^10.4.
|
|
42
|
+
"autoprefixer": "^10.4.24",
|
|
43
43
|
"unplugin-icons": "^23.0.1",
|
|
44
44
|
"unplugin-info": "^1.2.4",
|
|
45
45
|
"unplugin-svg-component": "^0.12.4",
|
|
46
46
|
"unplugin-turbo-console": "^2.3.0",
|
|
47
47
|
"unplugin-vue-components": "^31.0.0",
|
|
48
|
-
"vite-bundle-analyzer": "^1.3.
|
|
48
|
+
"vite-bundle-analyzer": "^1.3.6",
|
|
49
49
|
"vite-plugin-banner": "^0.8.1",
|
|
50
50
|
"vite-plugin-compression2": "^2.4.0",
|
|
51
51
|
"vite-plugin-mock-dev-server": "^2.0.7",
|
|
52
52
|
"vite-plugin-qrcode": "^0.3.0",
|
|
53
|
-
"vite-plugin-vue-devtools": "^8.0.
|
|
54
|
-
"@gsc-basic/utils": "1.2.
|
|
53
|
+
"vite-plugin-vue-devtools": "^8.0.6",
|
|
54
|
+
"@gsc-basic/utils": "1.2.10"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsup",
|