@gsc-basic/vite-config 2.1.0 → 2.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 +4 -4
- package/dist/index.js +3 -3
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -154,13 +154,13 @@ type DefineConfig = (config?: ConfigEnv) => Promise<{
|
|
|
154
154
|
}>;
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/plugins/index.d.ts
|
|
157
|
-
declare function createVitePlugins(options: ApplicationOptions): Promise<PluginOption[]>;
|
|
157
|
+
export declare function createVitePlugins(options: ApplicationOptions): Promise<PluginOption[]>;
|
|
158
158
|
//#endregion
|
|
159
159
|
//#region src/config/index.d.ts
|
|
160
160
|
declare function defineConfig(config?: DefineConfig): import("vite").UserConfigFnPromise;
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/utils/index.d.ts
|
|
163
|
-
declare function generateProjectInfo({ pkg }?: {
|
|
163
|
+
export declare function generateProjectInfo({ pkg }?: {
|
|
164
164
|
pkg?: Record<string, string>;
|
|
165
165
|
}): string;
|
|
166
166
|
interface ProxyItem {
|
|
@@ -178,6 +178,6 @@ interface ProxyOptions {
|
|
|
178
178
|
configure?: (proxy: any) => void;
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
declare function createProxy(list: ProxyItem[], showProxyLog?: boolean): ProxyOptions;
|
|
181
|
+
export declare function createProxy(list: ProxyItem[], showProxyLog?: boolean): ProxyOptions;
|
|
182
182
|
//#endregion
|
|
183
|
-
export { type ApplicationOptions, type CommonPluginOptions, type CompressOptions, type DefineConfig, type ProxyItem, type ProxyOptions, type ProxySettingItem, type SvgIconOptions,
|
|
183
|
+
export { type ApplicationOptions, type CommonPluginOptions, type CompressOptions, type DefineConfig, type ProxyItem, type ProxyOptions, type ProxySettingItem, type SvgIconOptions, defineConfig };
|
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.1.0
|
|
11
|
+
Build Time: 2026/9/7 10:27:11
|
|
12
|
+
Build Commit: 6c6576331d6ac4b02ae9149236b3d981dd041ae7
|
|
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"vite-plugin-dayjs";import l from"unplugin-icons/vite";import{compression as u,tarball as d}from"vite-plugin-compression2";import f,{resolve as p}from"node:path";import m from"unplugin-svg-component/vite";import{analyzer as h}from"vite-bundle-analyzer";import{webUpdateNotice as g}from"@plugin-web-update-notification/vite";import{defineConfig as _,mergeConfig as v}from"vite";import y from"autoprefixer";import b from"ansis";import{regexpMap as x}from"@gsc-basic/utils";function S(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 C(e){let{compressList:t=[],tarballResult:n=!1,deleteOriginalAssets:r=!1}=e,i=[];return t.length>0&&i.push(u({algorithms:t,deleteOriginalAssets:r,skipIfLargerOrEqual:!1,exclude:[/\.(br)$/,/\.(gz)$/]})),n&&i.length>0&&i.push(d()),i}function w({prefixClass:e=`lenovo`,iconDir:t=`src/assets/icons`,componentName:n=`SvgIcon`,preserveColorDir:r}){let i={treeShaking:!1};return r&&(i.preserveColor=typeof r==`string`?f.resolve(process.cwd(),r):r),m({iconDir:[f.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 T(e=``,t=8080){return h({reportTitle:`${e} Analyzer`,analyzerMode:`server`,analyzerPort:t+200,openAnalyzer:!0})}function E({base:e,primaryColor:t}){return g({checkInterval:18e5,checkOnWindowFocus:!0,checkImmediately:!1,checkOnLoadFileError:!0,hiddenDefaultNotification:!1,logVersion:!1,notificationConfig:{primaryColor:t},injectFileBase:e??`/`})}function D(e,t){return Math.floor(Math.random()*(t-e+1))+e}function O(e){return import(e)}async function k(u){let d=[e({template:{compilerOptions:{isCustomElement:e=>e.startsWith(`micro-app`)}}}),t()];if(u.vueRouter)try{let{default:e}=await O(`vue-router/vite`);d.unshift(e(u.vueRouterOptions||{}))}catch(e){console.warn("[vite-config] `vueRouter` is enabled but `vue-router 5.x` is not installed, skip VueRouter plugin.",e)}if(u.unocss)try{let{default:e}=await O(`unocss/vite`);d.push(e({mode:`global`}))}catch(e){console.warn("[vite-config] `unocss` is enabled but `unocss` is not installed, skip UnoCSS plugin.",e)}if(u.iconify&&d.push(l({compiler:`vue3`,autoInstall:!0})),u.injectMetadata&&d.push(a({meta:{appTheme:u.appTheme,appInfo:u.appInfo},package:{dependencies:!0,devDependencies:!0}})),u.i18n&&d.push(r({fullInstall:!0,runtimeOnly:!0,...u.i18nOptions||{}})),u.isBuild?(u.legacy&&d.push(n({targets:[`> 0.2%`,`not dead`,`not op_mini all`]})),u.compress&&d.push(...C(u.compressOptions||{})),u.updateNotice&&d.push(E({base:u.base,primaryColor:u.appTheme?.color?.primary}))):(u.turboConsole&&d.push(o({server:{port:(u.serverPort??8080)+D(100,1e3)},launchEditor:!0})),u.devtools&&d.push(s({launchEditor:`code`}))),u.svgIcon){let e=u.svgIconOptions??{};d.push(w({prefixClass:u.prefixClass,iconDir:e.iconDir,preserveColorDir:e.preserveColorDir}))}return u.html&&d.push(S(u.appTitle,u.appInfo)),u.dayjs&&d.push(c()),u.mock&&d.push(i({})),u.analyzer&&d.push(T(u.appTitle,u.serverPort)),d}function A({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 j(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,...x.httpsUrl.test(i)?{secure:!1}:{},...t?{configure:e=>{e.on(`proxyRes`,(e,t)=>{console.log(`proxy: `,b.red(t.originalUrl),` ===> `,b.green(e.client.servername+t.url))})}}:{}}}return n}function M(e){return p(process.cwd(),`.`,e)}function N(e){return _(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,dayjs:!1,...r?.application||{}},a=n===`build`,o={base:i.base??`/`,logLevel:`info`,resolve:{alias:[{find:/@\//,replacement:`${M(`src`)}/`}]},server:{host:!0,port:i.serverPort??8080,open:i.openPage??!0,hmr:!0,proxy:j(i.proxyConfig||[],i.showProxyLog??!1),headers:{"Access-Control-Allow-Origin":`*`}},preview:{port:(i.serverPort??8080)+100,proxy:j(i.previewProxyConfig||[],i.showPreviewProxyLog??!1)},build:{outDir:`dist`,reportCompressedSize:!1,chunkSizeWarningLimit:5e3,assetsInlineLimit:1024,rolldownOptions:{output:{postBanner:i.license?A(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?[y()]:[]}},plugins:await k({...i,isBuild:a})};return v(o,r?.vite||{})})}function P(e){return N(e)}export{j as createProxy,k as createVitePlugins,P as defineConfig,A 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.1.
|
|
4
|
+
"version": "2.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",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"./dist"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@iconify/json": "^2.2.
|
|
33
|
-
"unocss": "^66.
|
|
32
|
+
"@iconify/json": "^2.2.525",
|
|
33
|
+
"unocss": "^66.10.0",
|
|
34
34
|
"vite": "^8.2.0",
|
|
35
35
|
"vue-router": "^5.0.7"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@gsc-basic/utils": "1.4.2",
|
|
38
39
|
"@intlify/unplugin-vue-i18n": "^11.2.5",
|
|
39
40
|
"@plugin-web-update-notification/vite": "^2.1.3",
|
|
40
41
|
"@vitejs/plugin-legacy": "^8.2.3",
|
|
@@ -46,13 +47,12 @@
|
|
|
46
47
|
"unplugin-info": "^1.3.2",
|
|
47
48
|
"unplugin-svg-component": "^0.12.6",
|
|
48
49
|
"unplugin-turbo-console": "^2.3.3",
|
|
49
|
-
"unplugin-vue-components": "^32.
|
|
50
|
+
"unplugin-vue-components": "^32.1.0",
|
|
50
51
|
"vite-bundle-analyzer": "^1.3.9",
|
|
51
52
|
"vite-plugin-compression2": "^2.5.3",
|
|
52
53
|
"vite-plugin-dayjs": "^1.0.3",
|
|
53
54
|
"vite-plugin-mock-dev-server": "^2.4.2",
|
|
54
|
-
"vite-plugin-vue-devtools": "^8.2.1"
|
|
55
|
-
"@gsc-basic/utils": "1.4.1"
|
|
55
|
+
"vite-plugin-vue-devtools": "^8.2.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|