@moneko/core 2.0.52 → 2.0.53-beta.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/build/common.js +1 -1
- package/build/webpack.prod.js +1 -1
- package/lib/menu.js +1 -1
- package/package.json +17 -16
- package/typings/global.d.ts +16 -9
package/build/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _export(e,
|
|
1
|
+
"use strict";function _export(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}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 _customConf_minifier,_customConf_minifier_js,_customConf_minifier1,_customConf_minifier_css,_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",bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{js:{},css:{}},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),customConf.minifier.js||(customConf.minifier.js={}),(null==customConf?void 0:null==(_customConf_minifier=customConf.minifier)?void 0:null==(_customConf_minifier_js=_customConf_minifier.js)?void 0:_customConf_minifier_js.type)||(customConf.minifier.js.type="swc"===customConf.compiler?"swc":"terser"),customConf.minifier.css||(customConf.minifier.css={}),(null==customConf?void 0:null==(_customConf_minifier1=customConf.minifier)?void 0:null==(_customConf_minifier_css=_customConf_minifier1.css)?void 0:_customConf_minifier_css.type)||(customConf.minifier.css.type="swc"===customConf.compiler?"swc":"cssnano"),!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/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 h}});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"),a=require("webpack-bundle-analyzer"),c=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:t.swcMinify,lightningCss:t.lightningCssMinify,cssnano:t.cssnanoMinify},C={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)||"swc",null==(n=s.CONFIG.minifier.js)?void 0:n.options)),new t.default({minify:y[(null==(i=s.CONFIG.minifier.css)?void 0:i.type)||"swc"],minimizerOptions:null==(r=s.CONFIG.minifier.css)?void 0:r.options})]},O=!1;s.CONFIG.cacheDirectory&&(O={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.CONFIG.cacheDirectory});var h=(0,c.merge)(m.default,{devtool:!1===s.CONFIG.devtool||s.CONFIG.devtool?s.CONFIG.devtool:"cheap-module-source-map",mode:"production",cache:O,optimization:C,plugins:[new u.default({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.CONFIG.bundleAnalyzer&&new a.BundleAnalyzerPlugin(s.CONFIG.bundleAnalyzer),s.CONFIG.splitChunk&&new l.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/lib/menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function t(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}import{isEqual as n,isFunction as o,persistence as a}from"@moneko/common";import i from"shared-store-object";import u from"./persistentKey";var l=a.load,f=i({activeKey:l(u.menuActiveKey,"home"),expandKey:l(u.menuExpandKey,[]),menus:l(u.menuMenus,[]),kv:l(u.menuKv,{}),tabs:l(u.menuTabs,[])}),c=function(e,r){if(void 0===r&&(r=[]),0===e.length)return r;var n=e[0],o=n.children,a=void 0===o?[]:o,i=n.i18n,u=n.label,l=n.hideMenu,f=t(n,["children","i18n","label","hideMenu"]),s=Object.create(null);return Object.assign(s,f,{label:i||u,props:void 0,element:void 0}),a.length&&(s.children=c(a)),l||r.push(s),c(e.slice(1),r)},s=function(e,r){for(var n,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=unsupportedIterableToArray(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(n=o()).done;){var a=n.value,i=a.children,u=t(a,["children"]);r[a.key]=u,(null==i?void 0:i.length)&&s(i,r)}};export function setMenu(e){var r=c(e),t={};s(r,t),f.menus=r,f.kv=t}export function addTab(t){var o=f.kv[t.key];if(o&&!f.tabs.find(function(e){return e.key===t.key})){var a,i=((function(r){if(Array.isArray(r))return e(r)})(a=f.tabs)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||function(r,t){if(r){if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if("Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([r({},o,{i18n:o.i18n||"route-"+o.key},t)]);n(i,f.tabs)||(f.tabs=i)}}export function openTab(e){f.activeKey=e.key,addTab(e)}export function closeTab(e,r,t){if(void 0===r&&(r="self"),e){for(var n=f.tabs,
|
|
1
|
+
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function t(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}import{isEqual as n,isFunction as o,persistence as a}from"@moneko/common";import i from"shared-store-object";import u from"./persistentKey";var l=a.load,f=i({activeKey:l(u.menuActiveKey,"home"),expandKey:l(u.menuExpandKey,[]),menus:l(u.menuMenus,[]),kv:l(u.menuKv,{}),tabs:l(u.menuTabs,[])}),c=function(e,r){if(void 0===r&&(r=[]),0===e.length)return r;var n=e[0],o=n.children,a=void 0===o?[]:o,i=n.i18n,u=n.label,l=n.hideMenu,f=t(n,["children","i18n","label","hideMenu"]),s=Object.create(null);return Object.assign(s,f,{label:i||u,props:void 0,element:void 0}),a.length&&(s.children=c(a)),l||r.push(s),c(e.slice(1),r)},s=function(e,r){for(var n,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=unsupportedIterableToArray(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(n=o()).done;){var a=n.value,i=a.children,u=t(a,["children"]);r[a.key]=u,(null==i?void 0:i.length)&&s(i,r)}};export function setMenu(e){var r=c(e),t={};s(r,t),f.menus=r,f.kv=t}export function addTab(t){var o=f.kv[t.key];if(o&&!f.tabs.find(function(e){return e.key===t.key})){var a,i=((function(r){if(Array.isArray(r))return e(r)})(a=f.tabs)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||function(r,t){if(r){if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if("Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([r({},o,{i18n:o.i18n||"route-"+o.key},t)]);n(i,f.tabs)||(f.tabs=i)}}export function openTab(e){f.activeKey=e.key,addTab(e)}export function closeTab(e,r,t){if(void 0===r&&(r="self"),e){for(var n,a=f.tabs,i=f.activeKey,u=[],l=[],c="self"===r,s=a.findIndex(function(r){return r.key===e}),y=0,d=a.length;y<d;y++){var b,p=a[y],v=(b=y,!1===p.closable||({left:b>=s,right:b<=s,other:b===s,self:e!==p.key})[r]);if(c){if(!v&&e===i){var m=y?y-1:y+1;a[m]&&(i=a[m].key,n=a[m])}}else v&&p.key===e&&i!==e&&(i=e,n=p);v||u.push(p),v&&l.push(p)}if(f.tabs=l,f.activeKey=i,o(t)){t(u,n);return}}}export function expandMenu(e){n(e,f.expandKey)||(f.expandKey=e)}export default f;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.53-beta.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,48 +18,49 @@
|
|
|
18
18
|
"@emotion/css": "11.10.6",
|
|
19
19
|
"@mapbox/rehype-prism": "0.8.0",
|
|
20
20
|
"@mdx-js/loader": "2.3.0",
|
|
21
|
-
"@moneko/common": "1.0.
|
|
22
|
-
"@parcel/css": "1.14.0",
|
|
21
|
+
"@moneko/common": "1.0.32",
|
|
23
22
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
24
23
|
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
25
24
|
"@swc/core": "1.3.37",
|
|
26
|
-
"@swc/
|
|
25
|
+
"@swc/css": "0.0.20",
|
|
26
|
+
"@swc/helpers": "0.5.0",
|
|
27
27
|
"add-asset-html-webpack-plugin": "5.0.2",
|
|
28
|
-
"core-js": "3.
|
|
28
|
+
"core-js": "3.30.0",
|
|
29
29
|
"cross-env": "7.0.3",
|
|
30
30
|
"css-loader": "6.7.3",
|
|
31
|
-
"css-minimizer-webpack-plugin": "
|
|
31
|
+
"css-minimizer-webpack-plugin": "5.0.0",
|
|
32
32
|
"css-unicode-loader": "1.0.3",
|
|
33
33
|
"external-remotes-plugin": "1.0.0",
|
|
34
34
|
"html-webpack-plugin": "5.5.0",
|
|
35
35
|
"less": "4.1.3",
|
|
36
36
|
"less-loader": "11.1.0",
|
|
37
|
-
"
|
|
37
|
+
"lightningcss": "1.19.0",
|
|
38
|
+
"mini-css-extract-plugin": "2.7.5",
|
|
38
39
|
"mini-svg-data-uri": "1.4.4",
|
|
39
40
|
"path-to-regexp": "6.2.1",
|
|
40
41
|
"portfinder": "1.0.32",
|
|
41
|
-
"react-activation": "0.12.
|
|
42
|
+
"react-activation": "0.12.4",
|
|
42
43
|
"react-refresh": "0.14.0",
|
|
43
|
-
"react-refresh-typescript": "2.0.
|
|
44
|
-
"react-router": "6.
|
|
45
|
-
"react-router-dom": "6.
|
|
44
|
+
"react-refresh-typescript": "2.0.9",
|
|
45
|
+
"react-router": "6.10.0",
|
|
46
|
+
"react-router-dom": "6.10.0",
|
|
46
47
|
"rehype-accessible-emojis": "0.3.2",
|
|
47
48
|
"rehype-figure": "1.0.1",
|
|
48
49
|
"shared-store-object": "1.0.4",
|
|
49
|
-
"style-loader": "3.3.
|
|
50
|
+
"style-loader": "3.3.2",
|
|
50
51
|
"style-resources-loader": "1.5.0",
|
|
51
52
|
"swc-loader": "0.2.3",
|
|
52
53
|
"swc-plugin-another-transform-imports": "0.2.1",
|
|
53
54
|
"ts-import-plugin": "2.0.0",
|
|
54
55
|
"ts-loader": "9.4.2",
|
|
55
|
-
"typescript": "
|
|
56
|
-
"webpack": "5.
|
|
56
|
+
"typescript": "5.0.4",
|
|
57
|
+
"webpack": "5.78.0",
|
|
57
58
|
"webpack-bundle-analyzer": "4.8.0",
|
|
58
59
|
"webpack-cli": "5.0.1",
|
|
59
|
-
"webpack-dev-server": "4.
|
|
60
|
+
"webpack-dev-server": "4.13.2",
|
|
60
61
|
"webpack-merge": "5.8.0",
|
|
61
62
|
"webpackbar": "5.0.2",
|
|
62
|
-
"xml2js": "0.
|
|
63
|
+
"xml2js": "0.5.0"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"@swc/cli": "0.1.62",
|
package/typings/global.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
|
3
3
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
4
4
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
5
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
6
|
+
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
6
7
|
import type { MinifyOptions } from 'terser';
|
|
7
8
|
import type { Options } from 'ts-import-plugin';
|
|
8
9
|
import type { RuleSetRule, WebpackPluginInstance, Configuration } from 'webpack';
|
|
@@ -30,6 +31,7 @@ export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
|
30
31
|
[key: string]: string | null | boolean | number;
|
|
31
32
|
}[];
|
|
32
33
|
};
|
|
34
|
+
export type CssMinify = 'swc' | 'cssnano' | 'lightningCss';
|
|
33
35
|
export interface Theme {
|
|
34
36
|
primaryColor?: string;
|
|
35
37
|
infoColor?: string;
|
|
@@ -65,15 +67,20 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
65
67
|
entry?: Record<string, string>;
|
|
66
68
|
/** 压缩配置 */
|
|
67
69
|
minifier: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
js?: {
|
|
71
|
+
/**
|
|
72
|
+
* @default 'swc'
|
|
73
|
+
*/
|
|
74
|
+
type?: MinifierType;
|
|
75
|
+
options?: SwcOptions | TerserOptions;
|
|
76
|
+
};
|
|
77
|
+
css?: {
|
|
78
|
+
/**
|
|
79
|
+
* @default 'lightningCss'
|
|
80
|
+
*/
|
|
81
|
+
type?: CssMinify;
|
|
82
|
+
options?: CssNanoOptionsExtended;
|
|
83
|
+
};
|
|
77
84
|
};
|
|
78
85
|
/** 环境变量, 可通过 process.env 获取 */
|
|
79
86
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|