@moneko/core 3.0.0-beta.29 → 3.0.0-beta.30
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/lib/common.js +1 -1
- package/lib/webpack.prod.js +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +22 -16
package/lib/common.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"fs";import t from"path";import o from"readline";import s from"chalk";import{merge as i}from"webpack-merge";import{APPTYPE as n,CUSTOMCONFIG as l,FRAMEWORK as r,jsxImportSource as a,pkgName as c,PROGRAMPATH as
|
|
1
|
+
import e from"fs";import t from"path";import o from"readline";import s from"chalk";import{merge as i}from"webpack-merge";import{APPTYPE as n,CUSTOMCONFIG as l,FRAMEWORK as r,jsxImportSource as a,pkgName as c,PROGRAMPATH as m}from"./process-env.js";import{isFunction as p,readConf as u}from"./utils.js";export const ENTRYPATH={mobile:"mobile",site:"site","back-stage":"back-stage","single-spa":"single-spa",library:"library","single-component":"single-component"};let d=[`@moneko/${r}`,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design"],f={chunks:"all",minSize:1024,minChunks:1};"single-component"===n&&(f=!1);let g={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",designSize:"mobile"===n?375:1680,fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{},layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:m+"/node_modules/.temp_cache",devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${c}/template/index.html`,favicon:`./node_modules/${c}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:f,runtimeChunk:"single-component"!==n&&"single",moduleFederation:[],rulesInclude:{less:d,css:d,js:d,media:d,fonts:d},mdx:{jsxImportSource:a,remarkPlugins:[],rehypePlugins:[]}};export const log=e=>{o.cursorTo(process.stdout,0),process.stdout.write(e)};let h=g,y=null,b={},w={};try{y=t.join(m,"./config/index.ts"),e.accessSync(y,e.constants.R_OK)}catch(e){y=null}if(y)try{let e=(await u(y,"index")).default;b=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}if(l){let o=null;try{o=t.join(m,`./config/${l}.ts`),e.accessSync(o,e.constants.R_OK)}catch(e){o=null}if(null!==o)try{let e=(await u(o,l)).default;w=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}}"tsc"===(h=i(h,b,w)).compiler&&h.minifier&&(h.minifier.js||Object.assign(h.minifier,{js:{type:"terser"}}),h.minifier.css||Object.assign(h.minifier,{css:{type:"cssnano"}})),!1===h.devtool&&(h.sourceMap=!1),!1===h.sourceMap&&(h.devtool=!1),h.fixBrowserRouter&&(h.htmlPluginOption.tags||(h.htmlPluginOption.tags=[]),h.htmlPluginOption.tags.push({textContent:`
|
|
2
2
|
(function(l) {
|
|
3
3
|
if (l.search[1] === '/' ) {
|
|
4
4
|
var decoded = l.search.slice(1).split('&').map(function(s) {
|
package/lib/webpack.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{CONFIG as s}from"./common.js";import{getMinifyOption as t}from"./minify.js";import c from"./webpack.common.js";let{cssnanoMinify:l,swcMinify:p}=e,a="swc"===s.compiler?"swc":"terser",u="swc"===s.compiler?"swc":"cssnano",
|
|
1
|
+
import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{CONFIG as s}from"./common.js";import{getMinifyOption as t}from"./minify.js";import c from"./webpack.common.js";let{cssnanoMinify:l,swcMinify:p}=e,a="swc"===s.compiler?"swc":"terser",u="swc"===s.compiler?"swc":"cssnano",f=[];s.minifier&&(s.minifier.js&&f.push(new n(t(s.minifier.js?.type||a,s.minifier.js?.options))),s.minifier.css&&f.push(new e({minify:{swc:p,cssnano:l}[s.minifier.css?.type||u],minimizerOptions:s.minifier.css?.options})));let d={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:f},h=!1;s.cacheDirectory&&(h={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory});export default r(c,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",cache:h,optimization:d,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.bundleAnalyzer&&new o(s.bundleAnalyzer),s.splitChunk&&new m.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -69,22 +69,28 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
69
69
|
**/
|
|
70
70
|
entry?: Record<string, string> | string;
|
|
71
71
|
/** 压缩配置 */
|
|
72
|
-
minifier:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
minifier:
|
|
73
|
+
| {
|
|
74
|
+
js?:
|
|
75
|
+
| {
|
|
76
|
+
/**
|
|
77
|
+
* @default 'swc'
|
|
78
|
+
*/
|
|
79
|
+
type?: MinifierType;
|
|
80
|
+
options?: SwcOptions | TerserOptions;
|
|
81
|
+
}
|
|
82
|
+
| false;
|
|
83
|
+
css?:
|
|
84
|
+
| {
|
|
85
|
+
/**
|
|
86
|
+
* @default 'swc'
|
|
87
|
+
*/
|
|
88
|
+
type?: CssMinify;
|
|
89
|
+
options?: CssNanoOptionsExtended;
|
|
90
|
+
}
|
|
91
|
+
| false;
|
|
92
|
+
}
|
|
93
|
+
| false;
|
|
88
94
|
/** 环境变量, 可通过 process.env 获取 */
|
|
89
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
96
|
env?: Record<string, any>;
|