@moneko/core 2.0.53-beta.1 → 2.0.53-beta.11
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/build/common.js +1 -1
- package/build/swcrc.js +1 -1
- package/build/webpack.prod.js +1 -1
- package/package.json +12 -12
- package/typings/global.d.ts +37 -2
package/build/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _export(e,
|
|
1
|
+
"use strict";function _export(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}Object.defineProperty(exports,"__esModule",{value:!0}),_export(exports,{ENTRYPATH:function(){return ENTRYPATH},log:function(){return log},CONFIG:function(){return CONFIG},PUBLICPATH:function(){return PUBLICPATH}});var _fs=_interopRequireDefault(require("fs")),_path=_interopRequireDefault(require("path")),_readline=_interopRequireDefault(require("readline")),_chalk=_interopRequireDefault(require("chalk")),_webpackMerge=require("webpack-merge"),_processEnv=require("./process-env"),_utils=require("./utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var ENTRYPATH={mobile:"mobile",site:"site","back-stage":"back-stage","single-spa":"single-spa",library:"library","single-component":"single-component"},includeModule=[_processEnv.pkgName,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design"],defaultSplitChunk={chunks:"all",minSize:1024,minChunks:1};"single-component"===_processEnv.APPTYPE&&(defaultSplitChunk=!1);var defaultConfig={seo:!1,mode:"csr",compiler:"swc",emotion:{},bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",designSize:"mobile"===_processEnv.APPTYPE?375:1680,fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{},layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:_processEnv.PROGRAMPATH+"/node_modules/.temp_cache",devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:"./node_modules/"+_processEnv.pkgName+"/template/index.html",favicon:"./node_modules/"+_processEnv.pkgName+"/template/favicon.ico",tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:defaultSplitChunk,runtimeChunk:"single-component"!==_processEnv.APPTYPE&&"single",moduleFederation:[],rulesInclude:{less:includeModule,css:includeModule,js:includeModule,media:includeModule,fonts:includeModule}},log=function(e){_readline.default.cursorTo(process.stdout,0),process.stdout.write(e)},customConf=defaultConfig,configPath=null,normalConf={},envConf={};try{configPath=_path.default.join(_processEnv.PROGRAMPATH,"./config/index.ts"),_fs.default.accessSync(configPath,_fs.default.constants.R_OK)}catch(error){configPath=null}if(configPath)try{var conf=eval((0,_utils.tfc)(configPath)).default;normalConf=(0,_utils.isFunction)(conf)?conf(process):conf}catch(error){process.stdout.write(_chalk.default.red(error))}if(_processEnv.CUSTOMCONFIG){var customConfigPath=null;try{customConfigPath=_path.default.join(_processEnv.PROGRAMPATH,"./config/"+_processEnv.CUSTOMCONFIG+".ts"),_fs.default.accessSync(customConfigPath,_fs.default.constants.R_OK)}catch(error){customConfigPath=null}if(null!==customConfigPath)try{var conf=eval((0,_utils.tfc)(customConfigPath)).default;envConf=(0,_utils.isFunction)(conf)?conf(process):conf}catch(error){process.stdout.write(_chalk.default.red(error))}}customConf=(0,_webpackMerge.merge)(customConf,normalConf,envConf),!1===customConf.devtool&&(customConf.sourceMap=!1),!1===customConf.sourceMap&&(customConf.devtool=!1),customConf.fixBrowserRouter&&(customConf.htmlPluginOption.tags||(customConf.htmlPluginOption.tags=[]),customConf.htmlPluginOption.tags.push({textContent:"\n (function(l) {\n if (l.search[1] === '/' ) {\n var decoded = l.search.slice(1).split('&').map(function(s) { \n return s.replace(/~and~/g, '&')\n }).join('?');\n window.history.replaceState(null, null,\n l.pathname.slice(0, -1) + decoded + l.hash\n );\n }\n }(window.location))\n "}));var CONFIG=customConf,PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG:CONFIG,log:log};
|
package/build/swcrc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,r){for(var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,r){for(var o in r)Object.defineProperty(e,o,{enumerable:!0,get:r[o]})}(exports,{swcMinifyOption:function(){return n},default:function(){return s}});var e=require("webpack-merge"),r=require("./common"),o=function(e){return e&&e.__esModule?e:{default:e}}(require("./envFlags")),t={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}},n={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0},s=function(n){void 0===n&&(n=!1);var s=Object.assign({module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:n,development:n},constModules:{globals:{"env-flags":o.default}},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(var r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=o[r]+"/"+e[o[r]].transform,e[o[r]].style&&(e[o[r]].style=o[r]+"/"+e[o[r]].style);return e}(r.CONFIG.importOnDemand||{})],["@swc/plugin-emotion",r.CONFIG.emotion]]}},sourceMaps:!0},!n&&t);return r.CONFIG.swcrc&&(s=(0,e.merge)(s,"function"==typeof r.CONFIG.swcrc?r.CONFIG.swcrc(n):r.CONFIG.swcrc)),s};
|
package/build/webpack.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return b}});var e,n,i,r,t=function(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var i=d(n);if(i&&i.has(e))return i.get(e);var r={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var o=t?Object.getOwnPropertyDescriptor(e,u):null;o&&(o.get||o.set)?Object.defineProperty(r,u,o):r[u]=e[u]}return r.default=e,i&&i.set(e,r),r}(require("css-minimizer-webpack-plugin")),u=f(require("mini-css-extract-plugin")),o=f(require("terser-webpack-plugin")),l=require("webpack"),c=require("webpack-bundle-analyzer"),a=require("webpack-merge"),s=require("./common"),p=require("./minify"),m=f(require("./webpack.common"));function f(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,i=new WeakMap;return(d=function(e){return e?i:n})(e)}var y="swc"===s.CONFIG.compiler?"swc":"terser",O="swc"===s.CONFIG.compiler?"swc":"cssnano",C={swc:t.swcMinify,cssnano:t.cssnanoMinify},w={splitChunks:s.CONFIG.splitChunk,runtimeChunk:s.CONFIG.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:[new o.default((0,p.getMinifyOption)((null==(e=s.CONFIG.minifier.js)?void 0:e.type)||y,null==(n=s.CONFIG.minifier.js)?void 0:n.options)),new t.default({minify:C[(null==(i=s.CONFIG.minifier.css)?void 0:i.type)||O],minimizerOptions:null==(r=s.CONFIG.minifier.css)?void 0:r.options})]},k=!1;s.CONFIG.cacheDirectory&&(k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.CONFIG.cacheDirectory});var b=(0,a.merge)(m.default,{devtool:!1===s.CONFIG.devtool||s.CONFIG.devtool?s.CONFIG.devtool:"cheap-module-source-map",mode:"production",cache:k,optimization:w,plugins:[new u.default({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.CONFIG.bundleAnalyzer&&new c.BundleAnalyzerPlugin(s.CONFIG.bundleAnalyzer),s.CONFIG.splitChunk&&new l.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "2.0.53-beta.
|
|
3
|
+
"version": "2.0.53-beta.11",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
24
24
|
"@swc/core": "1.3.37",
|
|
25
25
|
"@swc/css": "0.0.20",
|
|
26
|
-
"@swc/helpers": "0.
|
|
26
|
+
"@swc/helpers": "0.4.14",
|
|
27
|
+
"@swc/plugin-emotion": "2.5.46",
|
|
27
28
|
"add-asset-html-webpack-plugin": "5.0.2",
|
|
28
|
-
"core-js": "3.30.
|
|
29
|
+
"core-js": "3.30.1",
|
|
29
30
|
"cross-env": "7.0.3",
|
|
30
31
|
"css-loader": "6.7.3",
|
|
31
32
|
"css-minimizer-webpack-plugin": "5.0.0",
|
|
@@ -34,7 +35,6 @@
|
|
|
34
35
|
"html-webpack-plugin": "5.5.0",
|
|
35
36
|
"less": "4.1.3",
|
|
36
37
|
"less-loader": "11.1.0",
|
|
37
|
-
"lightningcss": "1.19.0",
|
|
38
38
|
"mini-css-extract-plugin": "2.7.5",
|
|
39
39
|
"mini-svg-data-uri": "1.4.4",
|
|
40
40
|
"path-to-regexp": "6.2.1",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-router-dom": "6.10.0",
|
|
47
47
|
"rehype-accessible-emojis": "0.3.2",
|
|
48
48
|
"rehype-figure": "1.0.1",
|
|
49
|
-
"shared-store-object": "1.0.
|
|
49
|
+
"shared-store-object": "1.0.5",
|
|
50
50
|
"style-loader": "3.3.2",
|
|
51
51
|
"style-resources-loader": "1.5.0",
|
|
52
52
|
"swc-loader": "0.2.3",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"ts-import-plugin": "2.0.0",
|
|
55
55
|
"ts-loader": "9.4.2",
|
|
56
56
|
"typescript": "5.0.4",
|
|
57
|
-
"webpack": "5.
|
|
57
|
+
"webpack": "5.80.0",
|
|
58
58
|
"webpack-bundle-analyzer": "4.8.0",
|
|
59
59
|
"webpack-cli": "5.0.1",
|
|
60
|
-
"webpack-dev-server": "4.13.
|
|
60
|
+
"webpack-dev-server": "4.13.3",
|
|
61
61
|
"webpack-merge": "5.8.0",
|
|
62
62
|
"webpackbar": "5.0.2",
|
|
63
63
|
"xml2js": "0.5.0"
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@swc/cli": "0.1.62",
|
|
67
67
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
68
|
-
"@types/react": "^18.0.
|
|
68
|
+
"@types/react": "^18.0.35",
|
|
69
69
|
"@types/react-dom": "^18.0.11",
|
|
70
70
|
"@types/react-router-dom": "^5.3.3",
|
|
71
|
-
"@types/shelljs": "^0.8.
|
|
71
|
+
"@types/shelljs": "^0.8.12",
|
|
72
72
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
73
73
|
"@types/webpack-env": "^1.18.0",
|
|
74
|
-
"antd": "5.
|
|
75
|
-
"eslint-config-neko": "^1.0.
|
|
74
|
+
"antd": "5.4.2",
|
|
75
|
+
"eslint-config-neko": "^1.0.22",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"shelljs": "^0.8.5",
|
|
78
|
-
"stylelint-config-moneko": "^1.0.
|
|
78
|
+
"stylelint-config-moneko": "^1.0.13"
|
|
79
79
|
},
|
|
80
80
|
"files": [
|
|
81
81
|
"lib",
|
package/typings/global.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
|
31
31
|
[key: string]: string | null | boolean | number;
|
|
32
32
|
}[];
|
|
33
33
|
};
|
|
34
|
-
export type CssMinify = 'swc' | 'cssnano'
|
|
34
|
+
export type CssMinify = 'swc' | 'cssnano';
|
|
35
|
+
|
|
35
36
|
export interface Theme {
|
|
36
37
|
primaryColor?: string;
|
|
37
38
|
infoColor?: string;
|
|
@@ -49,6 +50,40 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
49
50
|
* @default 'swc'
|
|
50
51
|
*/
|
|
51
52
|
compiler: 'tsc' | 'swc';
|
|
53
|
+
emotion: {
|
|
54
|
+
/** sourceMap: 默认开启, 当构建为生产时将禁用
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
sourceMap?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @description
|
|
60
|
+
* 自动将标签属性添加到样式中,以便由css或样式生成的类名包括结果分配到的变量的名称。
|
|
61
|
+
* @default 'dev-only'
|
|
62
|
+
*/
|
|
63
|
+
autoLabel?: 'never' | 'dev-only' | 'always';
|
|
64
|
+
/** 定义类名的格式
|
|
65
|
+
* @alias [local]: 样式表达式的结果被分配到的变量的名称。
|
|
66
|
+
* @alias [filename]: 样式表达式所在的文件名称(无扩展名)。
|
|
67
|
+
* @alias [dirname]: 包含样式表达式所在文件的目录的名称。
|
|
68
|
+
* @default '[local]'
|
|
69
|
+
* @description
|
|
70
|
+
* 此选项仅在autoLabel设置为 `dev-only` 或 `always` 时有效。
|
|
71
|
+
* 它允许您定义结果标签的格式。
|
|
72
|
+
* 格式通过字符串定义,其中变量部分用方括号括起来[]。
|
|
73
|
+
* 例如labelFormat:"my-classname--[local]",其中[local]将替换为结果分配给的变量的名称。
|
|
74
|
+
*/
|
|
75
|
+
labelFormat?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description
|
|
78
|
+
* 此选项假设您正在使用某些东西使 `@emotion/react` 的 jsx 函数适用于所有 jsx。如果您不这样做,并且不希望发生此类优化,请禁用此选项。
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
cssPropOptimization?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
importMap?: boolean;
|
|
86
|
+
};
|
|
52
87
|
/** swc 配置项,仅当编译器为 swc 时有效 */
|
|
53
88
|
swcrc?: SwcConfig | ((isDev: boolean) => SwcConfig);
|
|
54
89
|
/**
|
|
@@ -76,7 +111,7 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
76
111
|
};
|
|
77
112
|
css?: {
|
|
78
113
|
/**
|
|
79
|
-
* @default '
|
|
114
|
+
* @default 'swc'
|
|
80
115
|
*/
|
|
81
116
|
type?: CssMinify;
|
|
82
117
|
options?: CssNanoOptionsExtended;
|