@gsc-basic/vite-config 1.0.3 → 1.0.4
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 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { ConfigEnv, UserConfig, PluginOption } from 'vite';
|
|
3
|
+
import { PluginOptions } from '@intlify/unplugin-vue-i18n';
|
|
3
4
|
|
|
4
5
|
interface CompressOptions {
|
|
5
6
|
compressList?: Array<'gzip' | 'brotliCompress'>;
|
|
@@ -77,9 +78,10 @@ interface CommonPluginOptions {
|
|
|
77
78
|
html?: boolean;
|
|
78
79
|
/**
|
|
79
80
|
* 是否开启国际化
|
|
80
|
-
* @default
|
|
81
|
+
* @default true
|
|
81
82
|
*/
|
|
82
83
|
i18n?: boolean;
|
|
84
|
+
i18nOptions?: PluginOptions;
|
|
83
85
|
/**
|
|
84
86
|
* 是否注入版权信息
|
|
85
87
|
* @default true
|
|
@@ -87,7 +89,7 @@ interface CommonPluginOptions {
|
|
|
87
89
|
license?: boolean;
|
|
88
90
|
/**
|
|
89
91
|
* 是否开启 legacy 支持
|
|
90
|
-
* @default
|
|
92
|
+
* @default true
|
|
91
93
|
*/
|
|
92
94
|
legacy?: boolean;
|
|
93
95
|
/**
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,4 @@ ${e?`${A}
|
|
|
11
11
|
* version: v${r?.version}
|
|
12
12
|
* description: ${r?.description}
|
|
13
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",(C,f)=>{console.log("proxy: ",v.red(f.originalUrl)," ===> ",v.green(C.client.servername+f.url))})}}:{}}}return t}function U(e,r){return Math.floor(Math.random()*(r-e+1))+e}function x(e){let r=[$({template:{compilerOptions:{isCustomElement:t=>t.startsWith("micro-app")}}}),D()];if(e.unocss&&r.push(M({mode:"global"})),e.iconify&&r.push(R({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(z({fullInstall:!0,runtimeOnly:!0})),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(E(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)+U(100,1e3)},launchEditor:!0})),e.devtools&&r.push(T({launchEditor:"code"})),e.qrcode&&r.push(N())),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 P(e){return B(async r=>{let{command:t}=r,i=await e?.(r),o={...{appInfo:{},devtools:!1,injectMetadata:!0,analyzer:!
|
|
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",(C,f)=>{console.log("proxy: ",v.red(f.originalUrl)," ===> ",v.green(C.client.servername+f.url))})}}:{}}}return t}function U(e,r){return Math.floor(Math.random()*(r-e+1))+e}function x(e){let r=[$({template:{compilerOptions:{isCustomElement:t=>t.startsWith("micro-app")}}}),D()];if(e.unocss&&r.push(M({mode:"global"})),e.iconify&&r.push(R({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(z({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(E(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)+U(100,1e3)},launchEditor:!0})),e.devtools&&r.push(T({launchEditor:"code"})),e.qrcode&&r.push(N())),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 P(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:x({...o,isBuild:s})};return H(p,i?.vite||{})})}function ze(e){return P(e)}export{l as createProxy,x as createVitePlugins,ze as defineConfig,h as generateProjectInfo};
|