@moneko/core 2.0.17-beta.5 → 2.0.18
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/done.d.ts +8 -0
- package/build/done.js +1 -0
- package/build/seo.js +1 -1
- package/build/webpack.common.js +1 -1
- package/build/webpack.prod.js +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +43 -10
package/build/done.d.ts
ADDED
package/build/done.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var DoneWebpackPlugin=function(){"use strict";function DoneWebpackPlugin(options){_classCallCheck(this,DoneWebpackPlugin);this.options=Object.assign({},options)}var _proto=DoneWebpackPlugin.prototype;_proto.apply=function apply(compiler){var that=this;compiler.hooks.done.tap("DoneWebpackPlugin",function(){var _that_options,_that_options_done;(_that_options_done=(_that_options=that.options).done)===null||_that_options_done===void 0?void 0:_that_options_done.call(_that_options)})};return DoneWebpackPlugin}();var _default=DoneWebpackPlugin;
|
package/build/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"seo",{enumerable:true,get:function(){return seo}});var _fs=require("fs");var _path=require("path");var _common=require("./common");var _processEnv=require("./process-env");var _webpackCommon=require("./webpack.common");function getLibDocsPages(dir,domain,basename){var results=[];var list=(0,_fs.readdirSync)(dir);list.forEach(function(_file){if(_file==="static"){return false}var file=dir+"/"+_file;var stat=(0,_fs.statSync)(file);if(stat&&stat.isDirectory()){results=results.concat(getLibDocsPages(file,domain,basename))}else if(file.endsWith("README.mdx")){results.push("https://"+domain+basename+file.replace(_processEnv.PROGRAMPATH+"/components/","").replace("/README.mdx",""))}});return results}var seo=function(){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"seo",{enumerable:true,get:function(){return seo}});var _fs=require("fs");var _path=require("path");var _common=require("./common");var _processEnv=require("./process-env");var _webpackCommon=require("./webpack.common");function getLibDocsPages(dir,domain,basename){var results=[];var list=(0,_fs.readdirSync)(dir);list.forEach(function(_file){if(_file==="static"){return false}var file=dir+"/"+_file;var stat=(0,_fs.statSync)(file);if(stat&&stat.isDirectory()){results=results.concat(getLibDocsPages(file,domain,basename))}else if(file.endsWith("README.mdx")){results.push("https://"+domain+basename+file.replace(_processEnv.PROGRAMPATH+"/components/","").replace("/README.mdx",""))}});return results}var seo=function(){var _ref=_common.CONFIG.seo||{},domain=_ref.domain,nojekyll=_ref.nojekyll;if(!domain){return}var baseDir=(_webpackCommon.outputConfig===null||_webpackCommon.outputConfig===void 0?void 0:_webpackCommon.outputConfig.path)||process.cwd();var call=function(err){if(err){throw err}};(0,_fs.writeFile)((0,_path.join)(baseDir,"CNAME"),domain,"utf-8",call);(0,_fs.writeFile)((0,_path.join)(baseDir,"robots"),"Sitemap: https://".concat(domain).concat(_common.CONFIG.routeBaseName,"sitemap.txt"),"utf-8",call);var sitemap="";switch(_processEnv.APPTYPE){case"library":sitemap=getLibDocsPages((0,_path.join)(_processEnv.PROGRAMPATH,"./components"),domain,_common.CONFIG.routeBaseName).join("\n");break;case"single-component":case"mobile":case"site":case"back-stage":case"single-spa":default:break}(0,_fs.writeFile)((0,_path.join)(baseDir,"sitemap.txt"),sitemap,"utf-8",call);if(nojekyll){(0,_fs.writeFile)((0,_path.join)(baseDir,".nojekyll"),"","utf-8",call)}};
|
package/build/webpack.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{outputConfig:function(){return outputConfig},default:function(){return _default}});var _fs=_interopRequireDefault(require("fs"));var _path=_interopRequireDefault(require("path"));var _addAssetHtmlWebpackPlugin=_interopRequireDefault(require("add-asset-html-webpack-plugin"));var _htmlWebpackPlugin=_interopRequireDefault(require("html-webpack-plugin"));var _webpack=require("webpack");var _webpackbar=_interopRequireDefault(require("webpackbar"));var _common=require("./common");var _envFlags=_interopRequireDefault(require("./envFlags"));var _htmlAddEntryAttr=_interopRequireDefault(require("./html-add-entry-attr"));var _htmlPluginOption=_interopRequireDefault(require("./html-plugin-option"));var _moduleFederation=require("./module-federation");var _moduleConfig=_interopRequireDefault(require("./module.config"));var _processEnv=require("./process-env");var _utils=require("./utils");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var eslintrc=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"];var stylelintrc=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"];var rootFiles=_fs.default.readdirSync(_processEnv.PROGRAMPATH);var hasEslint=false,hasStylelint=false;for(var i=0,len=rootFiles.length;i<len;i++){if(stylelintrc.includes(rootFiles[i])){hasStylelint=true}if(eslintrc.includes(rootFiles[i])){hasEslint=true}}if(!hasEslint){hasEslint=_processEnv.hasEslintConfig}if(!hasStylelint){hasStylelint=_processEnv.hasStylelintConfig}var StylelintPlugin=hasStylelint?require("stylelint-webpack-plugin"):null;var ESLintPlugin=hasEslint?require("eslint-webpack-plugin"):null;var alias={"@":(0,_utils.resolveProgramPath)("src")};Object.assign(alias,_common.CONFIG.alias);if(_processEnv.APPTYPE==="library"){Object.assign(alias,_defineProperty({"@":(0,_utils.resolveProgramPath)("site"),"@pkg":(0,_utils.resolveProgramPath)("components")},_processEnv.PACKAGENAME,(0,_utils.resolveProgramPath)("components")))}var assetHtmlOption=_common.CONFIG.assetHtml.map(function(item){return _objectSpread({publicPath:""},item)});var outputConfig={path:(0,_utils.resolveProgramPath)(_processEnv.APPTYPE==="library"?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:_processEnv.PACKAGENAME,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:"webpackJsonp_".concat(_processEnv.PACKAGENAME),pathinfo:false,clean:true,publicPath:_common.PUBLICPATH};var mainEntry=_path.default.join(__dirname,"../lib/packages/".concat(_common.ENTRYPATH[_processEnv.APPTYPE],"/index.js"));if(_processEnv.APPTYPE==="single-component"){Object.assign(alias,_defineProperty({},_processEnv.PACKAGENAME,(0,_utils.resolveProgramPath)("umd")));mainEntry=(0,_utils.resolveProgramPath)(_processEnv.DEV?"example/index.ts":"src/index.ts");outputConfig.path=(0,_utils.resolveProgramPath)(_processEnv.DEV?"dist":"umd");outputConfig.filename="index.js";outputConfig.library=_processEnv.PACKAGENAME;outputConfig.libraryTarget="umd";outputConfig.libraryExport="default"}var entryMap={main:mainEntry};if(_common.CONFIG.entry){if(typeof _common.CONFIG.entry==="string"){entryMap=_common.CONFIG.entry}else if(Object.keys(_common.CONFIG.entry)){Object.assign(entryMap,_common.CONFIG.entry)}}if(_common.CONFIG.output){if(typeof _common.CONFIG.output==="string"){outputConfig.path=_common.CONFIG.output}else if(Object.keys(_common.CONFIG.output)){Object.assign(outputConfig,_common.CONFIG.output)}}var dirDeep=_common.CONFIG.routeBaseName.split("/").filter(Boolean).length;var page404=Array(dirDeep).fill("..").join("/")+(dirDeep?"/":"")+"404.html";var config={entry:entryMap,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new _webpack.AutomaticPrefetchPlugin].concat(_toConsumableArray(_moduleFederation.moduleFederation),[ESLintPlugin&&new ESLintPlugin({threads:true,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),StylelintPlugin&&new StylelintPlugin({fix:true,threads:true,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new _htmlWebpackPlugin.default(_htmlPluginOption.default),_common.CONFIG.fixBrowserRouter&&new _htmlWebpackPlugin.default({filename:page404,inject:false,templateContent:function(){return"<html html><head><title>".concat(_htmlPluginOption.default.title,"</title><script>var pathSegmentsToKeep = 1;var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>")}}),new _addAssetHtmlWebpackPlugin.default(assetHtmlOption),_processEnv.APPTYPE==="single-spa"&&new _htmlAddEntryAttr.default(function(src){return!!(src.match(/main\.(.*)\.bundle.js$/)||src.match("main.bundle.js"))}),new _webpack.DefinePlugin(_envFlags.default),new _webpack.WatchIgnorePlugin({paths:[/\.d\.ts$/]}),_common.CONFIG.sourceMap&&new _webpack.SourceMapDevToolPlugin(_common.CONFIG.sourceMap),new _webpackbar.default({name:"编译中",color:"#6f42c1"})],_toConsumableArray(_common.CONFIG.plugins)).filter(Boolean),experiments:{topLevelAwait:true,syncWebAssembly:true,asyncWebAssembly:true},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:alias,fallback:{path:false,fs:false,crypto:false,assert:false}},module:_moduleConfig.default,externals:_common.CONFIG.externals,output:outputConfig};var _default=config;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{outputConfig:function(){return outputConfig},default:function(){return _default}});var _fs=_interopRequireDefault(require("fs"));var _path=_interopRequireDefault(require("path"));var _addAssetHtmlWebpackPlugin=_interopRequireDefault(require("add-asset-html-webpack-plugin"));var _htmlWebpackPlugin=_interopRequireDefault(require("html-webpack-plugin"));var _webpack=require("webpack");var _webpackbar=_interopRequireDefault(require("webpackbar"));var _common=require("./common");var _done=_interopRequireDefault(require("./done"));var _envFlags=_interopRequireDefault(require("./envFlags"));var _htmlAddEntryAttr=_interopRequireDefault(require("./html-add-entry-attr"));var _htmlPluginOption=_interopRequireDefault(require("./html-plugin-option"));var _moduleFederation=require("./module-federation");var _moduleConfig=_interopRequireDefault(require("./module.config"));var _processEnv=require("./process-env");var _seo=require("./seo");var _utils=require("./utils");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var eslintrc=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"];var stylelintrc=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"];var rootFiles=_fs.default.readdirSync(_processEnv.PROGRAMPATH);var hasEslint=false,hasStylelint=false;for(var i=0,len=rootFiles.length;i<len;i++){if(stylelintrc.includes(rootFiles[i])){hasStylelint=true}if(eslintrc.includes(rootFiles[i])){hasEslint=true}}if(!hasEslint){hasEslint=_processEnv.hasEslintConfig}if(!hasStylelint){hasStylelint=_processEnv.hasStylelintConfig}var StylelintPlugin=hasStylelint?require("stylelint-webpack-plugin"):null;var ESLintPlugin=hasEslint?require("eslint-webpack-plugin"):null;var alias={"@":(0,_utils.resolveProgramPath)("src")};Object.assign(alias,_common.CONFIG.alias);if(_processEnv.APPTYPE==="library"){Object.assign(alias,_defineProperty({"@":(0,_utils.resolveProgramPath)("site"),"@pkg":(0,_utils.resolveProgramPath)("components")},_processEnv.PACKAGENAME,(0,_utils.resolveProgramPath)("components")))}var assetHtmlOption=_common.CONFIG.assetHtml.map(function(item){return _objectSpread({publicPath:""},item)});var outputConfig={path:(0,_utils.resolveProgramPath)(_processEnv.APPTYPE==="library"?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:_processEnv.PACKAGENAME,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:"webpackJsonp_".concat(_processEnv.PACKAGENAME),pathinfo:false,clean:true,publicPath:_common.PUBLICPATH};var mainEntry=_path.default.join(__dirname,"../lib/packages/".concat(_common.ENTRYPATH[_processEnv.APPTYPE],"/index.js"));if(_processEnv.APPTYPE==="single-component"){Object.assign(alias,_defineProperty({},_processEnv.PACKAGENAME,(0,_utils.resolveProgramPath)("umd")));mainEntry=(0,_utils.resolveProgramPath)(_processEnv.DEV?"example/index.ts":"src/index.ts");outputConfig.path=(0,_utils.resolveProgramPath)(_processEnv.DEV?"dist":"umd");outputConfig.filename="index.js";outputConfig.library=_processEnv.PACKAGENAME;outputConfig.libraryTarget="umd";outputConfig.libraryExport="default"}var entryMap={main:mainEntry};if(_common.CONFIG.entry){if(typeof _common.CONFIG.entry==="string"){entryMap=_common.CONFIG.entry}else if(Object.keys(_common.CONFIG.entry)){Object.assign(entryMap,_common.CONFIG.entry)}}if(_common.CONFIG.output){if(typeof _common.CONFIG.output==="string"){outputConfig.path=_common.CONFIG.output}else if(Object.keys(_common.CONFIG.output)){Object.assign(outputConfig,_common.CONFIG.output)}}var dirDeep=_common.CONFIG.routeBaseName.split("/").filter(Boolean).length;var page404=Array(dirDeep).fill("..").join("/")+(dirDeep?"/":"")+"404.html";var config={entry:entryMap,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new _webpack.AutomaticPrefetchPlugin].concat(_toConsumableArray(_moduleFederation.moduleFederation),[ESLintPlugin&&new ESLintPlugin({threads:true,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),StylelintPlugin&&new StylelintPlugin({fix:true,threads:true,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new _htmlWebpackPlugin.default(_htmlPluginOption.default),_common.CONFIG.fixBrowserRouter&&new _htmlWebpackPlugin.default({filename:page404,inject:false,templateContent:function(){return"<html html><head><title>".concat(_htmlPluginOption.default.title,"</title><script>var pathSegmentsToKeep = 1;var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>")}}),new _addAssetHtmlWebpackPlugin.default(assetHtmlOption),_processEnv.APPTYPE==="single-spa"&&new _htmlAddEntryAttr.default(function(src){return!!(src.match(/main\.(.*)\.bundle.js$/)||src.match("main.bundle.js"))}),new _webpack.DefinePlugin(_envFlags.default),new _webpack.WatchIgnorePlugin({paths:[/\.d\.ts$/]}),_common.CONFIG.sourceMap&&new _webpack.SourceMapDevToolPlugin(_common.CONFIG.sourceMap),new _webpackbar.default({name:"编译中",color:"#6f42c1"}),new _done.default({done:function(){var _CONFIG_done;if(!_processEnv.DEV&&_common.CONFIG.seo){(0,_seo.seo)()}(_CONFIG_done=_common.CONFIG.done)===null||_CONFIG_done===void 0?void 0:_CONFIG_done.call(_common.CONFIG)}})],_toConsumableArray(_common.CONFIG.plugins)).filter(Boolean),experiments:{topLevelAwait:true,syncWebAssembly:true,asyncWebAssembly:true},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:alias,fallback:{path:false,fs:false,crypto:false,assert:false}},module:_moduleConfig.default,externals:_common.CONFIG.externals,output:outputConfig};var _default=config;
|
package/build/webpack.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _cssMinimizerWebpackPlugin=_interopRequireWildcard(require("css-minimizer-webpack-plugin"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _terserWebpackPlugin=_interopRequireDefault(require("terser-webpack-plugin"));var _webpack=require("webpack");var _webpackBundleAnalyzer=require("webpack-bundle-analyzer");var _webpackMerge=require("webpack-merge");var _common=require("./common");var _minify=require("./minify");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _cssMinimizerWebpackPlugin=_interopRequireWildcard(require("css-minimizer-webpack-plugin"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _terserWebpackPlugin=_interopRequireDefault(require("terser-webpack-plugin"));var _webpack=require("webpack");var _webpackBundleAnalyzer=require("webpack-bundle-analyzer");var _webpackMerge=require("webpack-merge");var _common=require("./common");var _minify=require("./minify");var _webpackCommon=_interopRequireDefault(require("./webpack.common"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var optimization={splitChunks:_common.CONFIG.splitChunk,runtimeChunk:_common.CONFIG.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:true,removeEmptyChunks:true,mergeDuplicateChunks:true,minimize:true,minimizer:[new _terserWebpackPlugin.default((0,_minify.getMinifyOption)(_common.CONFIG.minifier.type||"swc",_common.CONFIG.minifier.options)),new _cssMinimizerWebpackPlugin.default({minify:_common.CONFIG.minifier.css==="parcelCss"?_cssMinimizerWebpackPlugin.parcelCssMinify:_cssMinimizerWebpackPlugin.cssnanoMinify})]};var cacheConfig=false;if(_common.CONFIG.cacheDirectory){cacheConfig={type:"filesystem",allowCollectingMemory:true,cacheDirectory:_common.CONFIG.cacheDirectory}}var _default=(0,_webpackMerge.merge)(_webpackCommon.default,{devtool:_common.CONFIG.devtool===false||_common.CONFIG.devtool?_common.CONFIG.devtool:"cheap-module-source-map",mode:"production",cache:cacheConfig,optimization:optimization,plugins:[new _miniCssExtractPlugin.default({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:true}),_common.CONFIG.bundleAnalyzer&&new _webpackBundleAnalyzer.BundleAnalyzerPlugin(_common.CONFIG.bundleAnalyzer),_common.CONFIG.splitChunk&&new _webpack.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -31,9 +31,13 @@ export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
|
31
31
|
}[];
|
|
32
32
|
};
|
|
33
33
|
export declare type ConfigType<T = 'tsc'> = {
|
|
34
|
-
/** 渲染模式
|
|
34
|
+
/** 渲染模式
|
|
35
|
+
* @default 'csr'
|
|
36
|
+
*/
|
|
35
37
|
mode: 'ssr' | 'csr';
|
|
36
|
-
/** 编译器
|
|
38
|
+
/** 编译器
|
|
39
|
+
* @default 'swc'
|
|
40
|
+
*/
|
|
37
41
|
compiler: 'tsc' | 'swc';
|
|
38
42
|
/** swc 配置项,仅当编译器为 swc 时有效 */
|
|
39
43
|
swcrc?: SwcConfig | ((isDev: boolean) => SwcConfig);
|
|
@@ -53,14 +57,22 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
53
57
|
entry?: Record<string, string>;
|
|
54
58
|
/** 压缩配置 */
|
|
55
59
|
minifier: {
|
|
60
|
+
/**
|
|
61
|
+
* @default 'swc'
|
|
62
|
+
*/
|
|
56
63
|
type?: MinifierType;
|
|
57
64
|
options?: SwcOptions | TerserOptions;
|
|
65
|
+
/**
|
|
66
|
+
* @default 'parcelCss'
|
|
67
|
+
*/
|
|
58
68
|
css?: 'cssnano' | 'parcelCss';
|
|
59
69
|
};
|
|
60
70
|
/** 环境变量, 可通过 process.env 获取 */
|
|
61
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
72
|
env?: Record<string, any>;
|
|
63
|
-
/** persistence 持久化数据使用的key, 为 false 时关闭持久化
|
|
73
|
+
/** persistence 持久化数据使用的key, 为 false 时关闭持久化
|
|
74
|
+
* @default false
|
|
75
|
+
**/
|
|
64
76
|
persistence?: string | false;
|
|
65
77
|
devtool?: Configuration['devtool'];
|
|
66
78
|
sourceMap?: SourceMapDevToolPluginOptions | false;
|
|
@@ -70,15 +82,21 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
70
82
|
};
|
|
71
83
|
/** 根路由 */
|
|
72
84
|
routeBaseName: string;
|
|
73
|
-
/**
|
|
85
|
+
/** 输出目录前置路径
|
|
86
|
+
* @default /
|
|
87
|
+
* */
|
|
74
88
|
publicPath: string;
|
|
75
|
-
/** 设计图尺寸
|
|
89
|
+
/** 设计图尺寸
|
|
90
|
+
* @default 1680
|
|
91
|
+
* */
|
|
76
92
|
designSize: number;
|
|
77
93
|
/** 自定义降级组件 */
|
|
78
94
|
fallbackCompPath?: string | null;
|
|
79
95
|
/** less 全局变量 */
|
|
80
96
|
modifyVars: Record<string, string>;
|
|
81
|
-
/** 类名前缀
|
|
97
|
+
/** 类名前缀
|
|
98
|
+
* @default n
|
|
99
|
+
*/
|
|
82
100
|
prefixCls?: string;
|
|
83
101
|
/** 左侧菜单栏, 不需要时设置为 false, 仅 type: back-stage 时有效 */
|
|
84
102
|
layoutSider:
|
|
@@ -126,11 +144,16 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
126
144
|
htmlPluginOption: HtmlWebpackOption;
|
|
127
145
|
/** 自定义插入 html 的 js 和 css */
|
|
128
146
|
assetHtml: AssetHtmlOptions[];
|
|
129
|
-
/** 路由模式
|
|
147
|
+
/** 路由模式
|
|
148
|
+
* @description
|
|
130
149
|
* 当在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter,
|
|
131
|
-
* 则需要添加设置 fixBrowserRouter: true
|
|
150
|
+
* 则需要添加设置 fixBrowserRouter: true
|
|
151
|
+
* @default 'browser'
|
|
152
|
+
* */
|
|
132
153
|
routerMode: 'hash' | 'browser' | 'memory';
|
|
133
|
-
/** 在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter
|
|
154
|
+
/** 在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
134
157
|
fixBrowserRouter: boolean;
|
|
135
158
|
/** webpack 插件 */
|
|
136
159
|
plugins: WebpackPluginInstance[];
|
|
@@ -158,13 +181,23 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
158
181
|
fonts?: string[];
|
|
159
182
|
};
|
|
160
183
|
bundleAnalyzer: BundleAnalyzerPlugin.Options;
|
|
161
|
-
/** seo优化
|
|
184
|
+
/** seo优化
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
162
187
|
seo:
|
|
163
188
|
| {
|
|
164
189
|
/** 域名 */
|
|
165
190
|
domain: string;
|
|
191
|
+
/** 添加 .nojekyll 文件
|
|
192
|
+
* @description 告诉网站部署平台当前网站不是基于 Jekyll 构建的,
|
|
193
|
+
* 不要忽略掉下划线开头的文件和文件夹
|
|
194
|
+
* @default true
|
|
195
|
+
**/
|
|
196
|
+
nojekyll?: boolean;
|
|
166
197
|
}
|
|
167
198
|
| false;
|
|
199
|
+
/** 📦 打包完成 */
|
|
200
|
+
done?: () => void;
|
|
168
201
|
};
|
|
169
202
|
export declare interface ModuleFederationOption {
|
|
170
203
|
/** 模块名称,唯一性,不能重名 */
|