@umijs/mfsu 4.0.42 → 4.0.44

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.
Files changed (33) hide show
  1. package/compiled/is-absolute-url/LICENSE +1 -1
  2. package/compiled/is-absolute-url/index.d.ts +2 -4
  3. package/compiled/is-absolute-url/index.js +1 -1
  4. package/compiled/is-absolute-url/package.json +1 -1
  5. package/compiled/mrmime/package.json +1 -1
  6. package/compiled/webpack-virtual-modules/index.js +1 -1
  7. package/compiled/webpack-virtual-modules/package.json +1 -1
  8. package/dist/babelPlugins/awaitImport/MFImport.js +4 -1
  9. package/dist/babelPlugins/awaitImport/awaitImport.js +4 -1
  10. package/dist/babelPlugins/awaitImport/checkMatch.js +10 -5
  11. package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +2 -5
  12. package/dist/babelPlugins/awaitImport/getAliasedPath.js +9 -26
  13. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +26 -18
  14. package/dist/dep/dep.js +13 -4
  15. package/dist/dep/getCJSExports.js +48 -25
  16. package/dist/dep/getExposeFromContent.js +11 -3
  17. package/dist/depBuilder/depBuilder.js +33 -27
  18. package/dist/depInfo.js +15 -6
  19. package/dist/esbuildHandlers/autoCssModules.js +4 -1
  20. package/dist/mfsu/mfsu.js +39 -18
  21. package/dist/mfsu/strategyCompileTime.js +7 -2
  22. package/dist/mfsu/strategyStaticAnalyze.js +16 -4
  23. package/dist/moduleGraph.js +3 -1
  24. package/dist/staticDepInfo/simulations/babel-plugin-import.js +12 -3
  25. package/dist/staticDepInfo/staticDepInfo.js +37 -12
  26. package/dist/utils/resolveUtils.js +14 -3
  27. package/dist/utils/webpackUtils.js +18 -9
  28. package/dist/webpackPlugins/buildDepPlugin.js +7 -1
  29. package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +1 -1
  30. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +8 -5
  31. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +21 -12
  32. package/dist/webpackPlugins/writeCachePlugin.js +6 -3
  33. package/package.json +8 -8
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -5,7 +5,7 @@ Check if a URL is absolute.
5
5
 
6
6
  @example
7
7
  ```
8
- import isAbsoluteUrl = require('./is-absolute-url');
8
+ import isAbsoluteUrl from './is-absolute-url';
9
9
 
10
10
  isAbsoluteUrl('http://sindresorhus.com/foo/bar');
11
11
  //=> true
@@ -17,6 +17,4 @@ isAbsoluteUrl('foo/bar');
17
17
  //=> false
18
18
  ```
19
19
  */
20
- declare function isAbsoluteUrl(url: string): boolean;
21
-
22
- export = isAbsoluteUrl;
20
+ export default function isAbsoluteUrl(url: string): boolean;
@@ -1 +1 @@
1
- (function(){"use strict";var e={442:function(e){e.exports=e=>{if(typeof e!=="string"){throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``)}if(/^[a-zA-Z]:\\/.test(e)){return false}return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)}}};var r={};function __nccwpck_require__(t){var _=r[t];if(_!==undefined){return _.exports}var a=r[t]={exports:{}};var i=true;try{e[t](a,a.exports,__nccwpck_require__);i=false}finally{if(i)delete r[t]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(442);module.exports=t})();
1
+ (function(){"use strict";var e={};!function(){e.d=function(t,n){for(var o in n){if(e.o(n,o)&&!e.o(t,o)){Object.defineProperty(t,o,{enumerable:true,get:n[o]})}}}}();!function(){e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}();!function(){e.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();if(typeof e!=="undefined")e.ab=__dirname+"/";var t={};e.r(t);e.d(t,{default:function(){return isAbsoluteUrl}});const n=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/;const o=/^[a-zA-Z]:\\/;function isAbsoluteUrl(e){if(typeof e!=="string"){throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``)}if(o.test(e)){return false}return n.test(e)}module.exports=t})();
@@ -1 +1 @@
1
- {"name":"is-absolute-url","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"license":"MIT"}
1
+ {"name":"is-absolute-url","version":"4.0.1","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT"}
@@ -1 +1 @@
1
- {"name":"mrmime","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"license":"MIT","types":"index.d.ts"}
1
+ {"name":"mrmime","version":"1.0.1","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"license":"MIT","types":"index.d.ts"}
@@ -1 +1 @@
1
- (function(){"use strict";var e={636:function(e,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const a=i(r(622));const s=r(570);let n=45e6;function checkActivation(e){if(!e._compiler){throw new Error("You must use this plugin only after creating webpack instance!")}}function getModulePath(e,t){return a.default.isAbsolute(e)?e:a.default.join(t.context,e)}function createWebpackData(e){return t=>{if(t._data){const r=t._currentLevel;const i=t._levels[r];return{result:e,level:i}}return[null,e]}}function getData(e,t){if(e._data instanceof Map){return e._data.get(t)}else if(e._data){return e.data[t]}else if(e.data instanceof Map){return e.data.get(t)}else{return e.data[t]}}function setData(e,t,r){const i=r(e);if(e._data instanceof Map){e._data.set(t,i)}else if(e._data){e.data[t]=i}else if(e.data instanceof Map){e.data.set(t,i)}else{e.data[t]=i}}function getStatStorage(e){if(e._statStorage){return e._statStorage}else if(e._statBackend){return e._statBackend}else{throw new Error("Couldn't find a stat storage")}}function getFileStorage(e){if(e._readFileStorage){return e._readFileStorage}else if(e._readFileBackend){return e._readFileBackend}else{throw new Error("Couldn't find a readFileStorage")}}function getReadDirBackend(e){if(e._readdirBackend){return e._readdirBackend}else if(e._readdirStorage){return e._readdirStorage}else{throw new Error("Couldn't find a readDirStorage from Webpack Internals")}}class VirtualModulesPlugin{constructor(e){this._compiler=null;this._watcher=null;this._staticModules=e||null}writeModule(e,t){if(!this._compiler){throw new Error(`Plugin has not been initialized`)}checkActivation(this);const r=t?t.length:0;const i=Date.now();const a=new Date(i);const o=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:33188,size:r,blocks:Math.floor(r/4096),atime:a,mtime:a,ctime:a,birthtime:a});const l=getModulePath(e,this._compiler);if(process.env.WVM_DEBUG)console.log(this._compiler.name,"Write virtual module:",l,t);let c=this._watcher&&this._watcher.watchFileSystem;while(c&&c.wfs){c=c.wfs}let u=this._compiler.inputFileSystem;while(u&&u._inputFileSystem){u=u._inputFileSystem}u._writeVirtualFile(l,o,t);if(c&&(c.watcher.fileWatchers.size||c.watcher.fileWatchers.length)){const t=c.watcher.fileWatchers instanceof Map?Array.from(c.watcher.fileWatchers.values()):c.watcher.fileWatchers;for(const r of t){if(r.path===l){if(process.env.DEBUG)console.log(this._compiler.name,"Emit file change:",l,i);delete r.directoryWatcher._cachedTimeInfoEntries;r.directoryWatcher.setFileTime(e,i,false,false,null);r.emit("change",i,null)}}}}apply(e){this._compiler=e;const afterEnvironmentHook=()=>{let t=e.inputFileSystem;while(t&&t._inputFileSystem){t=t._inputFileSystem}if(!t._writeVirtualFile){const e=t.purge;t.purge=()=>{e.apply(t,[]);if(t._virtualFiles){Object.keys(t._virtualFiles).forEach((e=>{const r=t._virtualFiles[e];t._writeVirtualFile(e,r.stats,r.contents)}))}};t._writeVirtualFile=(e,r,i)=>{const o=getStatStorage(t);const l=getFileStorage(t);const c=getReadDirBackend(t);t._virtualFiles=t._virtualFiles||{};t._virtualFiles[e]={stats:r,contents:i};setData(o,e,createWebpackData(r));setData(l,e,createWebpackData(i));const u=e.split(/[\\/]/);let d=u.length-1;const _=u[0]?1:0;while(d>_){const e=u.slice(0,d).join(a.default.sep)||a.default.sep;try{t.readdirSync(e)}catch(t){const i=Date.now();const a=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:16877,size:r.size,blocks:Math.floor(r.size/4096),atime:i,mtime:i,ctime:i,birthtime:i});setData(c,e,createWebpackData([]));setData(o,e,createWebpackData(a))}let i=getData(getReadDirBackend(t),e);i=i[1]||i.result;const l=u[d];if(i.indexOf(l)<0){const r=i.concat([l]).sort();setData(getReadDirBackend(t),e,createWebpackData(r))}else{break}d--}}}};const afterResolversHook=()=>{if(this._staticModules){for(const[e,t]of Object.entries(this._staticModules)){this.writeModule(e,t)}this._staticModules=null}};const watchRunHook=(t,r)=>{this._watcher=t.compiler||t;const i=e.inputFileSystem._virtualFiles;const a=e.fileTimestamps;if(i&&a&&typeof a.set==="function"){Object.keys(i).forEach((e=>{a.set(e,+i[e].stats.mtime)}))}r()};if(e.hooks){e.hooks.afterEnvironment.tap("VirtualModulesPlugin",afterEnvironmentHook);e.hooks.afterResolvers.tap("VirtualModulesPlugin",afterResolversHook);e.hooks.watchRun.tapAsync("VirtualModulesPlugin",watchRunHook)}else{e.plugin("after-environment",afterEnvironmentHook);e.plugin("after-resolvers",afterResolversHook);e.plugin("watch-run",watchRunHook)}}}e.exports=VirtualModulesPlugin},570:function(e,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.VirtualStats=void 0;const a=i(r(619));class VirtualStats{constructor(e){for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t)){continue}this[t]=e[t]}}_checkModeProperty(e){return(this.mode&a.default.S_IFMT)===e}isDirectory(){return this._checkModeProperty(a.default.S_IFDIR)}isFile(){return this._checkModeProperty(a.default.S_IFREG)}isBlockDevice(){return this._checkModeProperty(a.default.S_IFBLK)}isCharacterDevice(){return this._checkModeProperty(a.default.S_IFCHR)}isSymbolicLink(){return this._checkModeProperty(a.default.S_IFLNK)}isFIFO(){return this._checkModeProperty(a.default.S_IFIFO)}isSocket(){return this._checkModeProperty(a.default.S_IFSOCK)}}t.VirtualStats=VirtualStats},619:function(e){e.exports=require("constants")},622:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var a=t[r]={exports:{}};var s=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(636);module.exports=r})();
1
+ (function(){"use strict";var e={984:function(e,t,i){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const a=r(i(17));const s=i(584);let n=45e6;function checkActivation(e){if(!e._compiler){throw new Error("You must use this plugin only after creating webpack instance!")}}function getModulePath(e,t){return a.default.isAbsolute(e)?e:a.default.join(t.context,e)}function createWebpackData(e){return t=>{if(t._data){const i=t._currentLevel;const r=t._levels[i];return{result:e,level:r}}return[null,e]}}function getData(e,t){if(e._data instanceof Map){return e._data.get(t)}else if(e._data){return e.data[t]}else if(e.data instanceof Map){return e.data.get(t)}else{return e.data[t]}}function setData(e,t,i){const r=i(e);if(e._data instanceof Map){e._data.set(t,r)}else if(e._data){e.data[t]=r}else if(e.data instanceof Map){e.data.set(t,r)}else{e.data[t]=r}}function getStatStorage(e){if(e._statStorage){return e._statStorage}else if(e._statBackend){return e._statBackend}else{throw new Error("Couldn't find a stat storage")}}function getFileStorage(e){if(e._readFileStorage){return e._readFileStorage}else if(e._readFileBackend){return e._readFileBackend}else{throw new Error("Couldn't find a readFileStorage")}}function getReadDirBackend(e){if(e._readdirBackend){return e._readdirBackend}else if(e._readdirStorage){return e._readdirStorage}else{throw new Error("Couldn't find a readDirStorage from Webpack Internals")}}class VirtualModulesPlugin{constructor(e){this._compiler=null;this._watcher=null;this._staticModules=e||null}writeModule(e,t){if(!this._compiler){throw new Error(`Plugin has not been initialized`)}checkActivation(this);const i=t?t.length:0;const r=Date.now();const a=new Date(r);const o=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:33188,size:i,blocks:Math.floor(i/4096),atime:a,mtime:a,ctime:a,birthtime:a});const l=getModulePath(e,this._compiler);if(process.env.WVM_DEBUG)console.log(this._compiler.name,"Write virtual module:",l,t);let c=this._watcher&&this._watcher.watchFileSystem;while(c&&c.wfs){c=c.wfs}let u=this._compiler.inputFileSystem;while(u&&u._inputFileSystem){u=u._inputFileSystem}u._writeVirtualFile(l,o,t);if(c&&(c.watcher.fileWatchers.size||c.watcher.fileWatchers.length)){const e=c.watcher.fileWatchers instanceof Map?Array.from(c.watcher.fileWatchers.values()):c.watcher.fileWatchers;for(let t of e){if("watcher"in t){t=t.watcher}if(t.path===l){if(process.env.DEBUG)console.log(this._compiler.name,"Emit file change:",l,r);delete t.directoryWatcher._cachedTimeInfoEntries;t.emit("change",r,null)}}}}apply(e){this._compiler=e;const afterEnvironmentHook=()=>{let t=e.inputFileSystem;while(t&&t._inputFileSystem){t=t._inputFileSystem}if(!t._writeVirtualFile){const e=t.purge;t.purge=()=>{e.apply(t,[]);if(t._virtualFiles){Object.keys(t._virtualFiles).forEach((e=>{const i=t._virtualFiles[e];t._writeVirtualFile(e,i.stats,i.contents)}))}};t._writeVirtualFile=(e,i,r)=>{const o=getStatStorage(t);const l=getFileStorage(t);const c=getReadDirBackend(t);t._virtualFiles=t._virtualFiles||{};t._virtualFiles[e]={stats:i,contents:r};setData(o,e,createWebpackData(i));setData(l,e,createWebpackData(r));const u=e.split(/[\\/]/);let d=u.length-1;const f=u[0]?1:0;while(d>f){const e=u.slice(0,d).join(a.default.sep)||a.default.sep;try{t.readdirSync(e)}catch(t){const r=Date.now();const a=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:16877,size:i.size,blocks:Math.floor(i.size/4096),atime:r,mtime:r,ctime:r,birthtime:r});setData(c,e,createWebpackData([]));setData(o,e,createWebpackData(a))}let r=getData(getReadDirBackend(t),e);r=r[1]||r.result;const l=u[d];if(r.indexOf(l)<0){const i=r.concat([l]).sort();setData(getReadDirBackend(t),e,createWebpackData(i))}else{break}d--}}}};const afterResolversHook=()=>{if(this._staticModules){for(const[e,t]of Object.entries(this._staticModules)){this.writeModule(e,t)}this._staticModules=null}};const t=typeof e.webpack==="undefined"?4:5;const watchRunHook=(i,r)=>{this._watcher=i.compiler||i;const a=e.inputFileSystem._virtualFiles;const s=e.fileTimestamps;if(a&&s&&typeof s.set==="function"){Object.keys(a).forEach((e=>{const i=+a[e].stats.mtime;s.set(e,t===4?i:{safeTime:i,timestamp:i})}))}r()};if(e.hooks){e.hooks.afterEnvironment.tap("VirtualModulesPlugin",afterEnvironmentHook);e.hooks.afterResolvers.tap("VirtualModulesPlugin",afterResolversHook);e.hooks.watchRun.tapAsync("VirtualModulesPlugin",watchRunHook)}else{e.plugin("after-environment",afterEnvironmentHook);e.plugin("after-resolvers",afterResolversHook);e.plugin("watch-run",watchRunHook)}}}e.exports=VirtualModulesPlugin},584:function(e,t,i){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.VirtualStats=void 0;const a=r(i(57));class VirtualStats{constructor(e){for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t)){continue}this[t]=e[t]}}_checkModeProperty(e){return(this.mode&a.default.S_IFMT)===e}isDirectory(){return this._checkModeProperty(a.default.S_IFDIR)}isFile(){return this._checkModeProperty(a.default.S_IFREG)}isBlockDevice(){return this._checkModeProperty(a.default.S_IFBLK)}isCharacterDevice(){return this._checkModeProperty(a.default.S_IFCHR)}isSymbolicLink(){return this._checkModeProperty(a.default.S_IFLNK)}isFIFO(){return this._checkModeProperty(a.default.S_IFIFO)}isSocket(){return this._checkModeProperty(a.default.S_IFSOCK)}}t.VirtualStats=VirtualStats},57:function(e){e.exports=require("constants")},17:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(i){var r=t[i];if(r!==undefined){return r.exports}var a=t[i]={exports:{}};var s=true;try{e[i].call(a.exports,a,a.exports,__nccwpck_require__);s=false}finally{if(s)delete t[i]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(984);module.exports=i})();
@@ -1 +1 @@
1
- {"name":"webpack-virtual-modules","author":"SysGears INC","license":"MIT"}
1
+ {"name":"webpack-virtual-modules","version":"0.5.0","author":"SysGears INC","license":"MIT"}
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/babelPlugins/awaitImport/MFImport.ts
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/babelPlugins/awaitImport/awaitImport.ts
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/babelPlugins/awaitImport/checkMatch.ts
@@ -29,7 +32,6 @@ module.exports = __toCommonJS(checkMatch_exports);
29
32
  var import_utils = require("@umijs/utils");
30
33
  var import_assert = __toESM(require("assert"));
31
34
  var import_path = require("path");
32
- var import_getAliasedPath = require("./getAliasedPath");
33
35
  var import_isExternals = require("./isExternals");
34
36
  var RE_NODE_MODULES = /node_modules/;
35
37
  function isUmiLocalDev(path) {
@@ -62,7 +64,10 @@ function checkMatch({
62
64
  let isMatch;
63
65
  let replaceValue = "";
64
66
  depth = depth || 1;
65
- (0, import_assert.default)(depth <= 10, `endless loop detected in checkMatch, please check your alias config.`);
67
+ (0, import_assert.default)(
68
+ depth <= 10,
69
+ `endless loop detected in checkMatch, please check your alias config.`
70
+ );
66
71
  opts = opts || {};
67
72
  const remoteName = opts.remoteName || "mf";
68
73
  value = value.replace(/^@fs\//, "/");
@@ -75,8 +80,8 @@ function checkMatch({
75
80
  } else if ((0, import_path.isAbsolute)(value)) {
76
81
  isMatch = RE_NODE_MODULES.test(value) || isUmiLocalDev(value);
77
82
  } else {
78
- const aliasedPath = (0, import_getAliasedPath.getAliasedPath)({
79
- value,
83
+ const aliasedPath = import_utils.aliasUtils.getAliasValue({
84
+ imported: value,
80
85
  alias: opts.alias || {}
81
86
  });
82
87
  if (aliasedPath) {
@@ -1,7 +1,4 @@
1
- declare type Opts = {
1
+ export declare function getAliasedPathWithLoopDetect({ value, alias, }: {
2
2
  value: string;
3
3
  alias: Record<string, string>;
4
- };
5
- export declare function getAliasedPath({ value, alias }: Opts): string | undefined;
6
- export declare function getAliasedPathWithLoopDetect({ value, alias }: Opts): string;
7
- export {};
4
+ }): string;
@@ -19,45 +19,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/babelPlugins/awaitImport/getAliasedPath.ts
20
20
  var getAliasedPath_exports = {};
21
21
  __export(getAliasedPath_exports, {
22
- getAliasedPath: () => getAliasedPath,
23
22
  getAliasedPathWithLoopDetect: () => getAliasedPathWithLoopDetect
24
23
  });
25
24
  module.exports = __toCommonJS(getAliasedPath_exports);
26
- function getAliasedPath({ value, alias }) {
27
- const importValue = value;
28
- if (alias[value]) {
29
- return alias[value];
30
- }
31
- for (const key of Object.keys(alias)) {
32
- const aliasValue = alias[key];
33
- if (key.endsWith("$")) {
34
- if (importValue === key.slice(0, -1))
35
- return aliasValue;
36
- else
37
- continue;
38
- }
39
- if (importValue.startsWith(addLastSlash(key))) {
40
- return importValue.replace(key, aliasValue);
41
- }
42
- }
43
- }
44
- function addLastSlash(path) {
45
- return path.endsWith("/") ? path : `${path}/`;
46
- }
47
- function getAliasedPathWithLoopDetect({ value, alias }) {
25
+ var import_utils = require("@umijs/utils");
26
+ function getAliasedPathWithLoopDetect({
27
+ value,
28
+ alias
29
+ }) {
48
30
  let needUnAlias = value;
49
31
  for (let i = 0; i < 10; i++) {
50
- let unAliased = getAliasedPath({ value: needUnAlias, alias });
32
+ let unAliased = import_utils.aliasUtils.getAliasValue({ imported: needUnAlias, alias });
51
33
  if (unAliased) {
52
34
  needUnAlias = unAliased;
53
35
  } else {
54
36
  return needUnAlias;
55
37
  }
56
38
  }
57
- throw Error(`endless loop detected in resolve alias for '${value}', please check your alias config.`);
39
+ throw Error(
40
+ `endless loop detected in resolve alias for '${value}', please check your alias config.`
41
+ );
58
42
  }
59
43
  // Annotate the CommonJS export names for ESM import in node:
60
44
  0 && (module.exports = {
61
- getAliasedPath,
62
45
  getAliasedPathWithLoopDetect
63
46
  });
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/babelPlugins/awaitImport/parseSpecifiers.ts
@@ -28,25 +31,30 @@ module.exports = __toCommonJS(parseSpecifiers_exports);
28
31
  var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
29
32
  var DEFAULT = "default";
30
33
  function parseSpecifiers(specifiers) {
31
- return specifiers.reduce((memo, s) => {
32
- if (t.isImportDefaultSpecifier(s)) {
33
- memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.local));
34
- } else if (t.isExportDefaultSpecifier(s)) {
35
- memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.exported));
36
- } else if (t.isExportSpecifier(s)) {
37
- if (t.isIdentifier(s.exported, { name: DEFAULT })) {
38
- memo.defaultIdentifier = s.local.name;
39
- memo.properties.push(t.objectProperty(s.local, s.local));
34
+ return specifiers.reduce(
35
+ (memo, s) => {
36
+ if (t.isImportDefaultSpecifier(s)) {
37
+ memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.local));
38
+ } else if (t.isExportDefaultSpecifier(s)) {
39
+ memo.properties.push(
40
+ t.objectProperty(t.identifier(DEFAULT), s.exported)
41
+ );
42
+ } else if (t.isExportSpecifier(s)) {
43
+ if (t.isIdentifier(s.exported, { name: DEFAULT })) {
44
+ memo.defaultIdentifier = s.local.name;
45
+ memo.properties.push(t.objectProperty(s.local, s.local));
46
+ } else {
47
+ memo.properties.push(t.objectProperty(s.local, s.exported));
48
+ }
49
+ } else if (t.isImportNamespaceSpecifier(s)) {
50
+ memo.namespaceIdentifier = s.local;
40
51
  } else {
41
- memo.properties.push(t.objectProperty(s.local, s.exported));
52
+ memo.properties.push(t.objectProperty(s.imported, s.local));
42
53
  }
43
- } else if (t.isImportNamespaceSpecifier(s)) {
44
- memo.namespaceIdentifier = s.local;
45
- } else {
46
- memo.properties.push(t.objectProperty(s.imported, s.local));
47
- }
48
- return memo;
49
- }, { properties: [], namespaceIdentifier: null, defaultIdentifier: null });
54
+ return memo;
55
+ },
56
+ { properties: [], namespaceIdentifier: null, defaultIdentifier: null }
57
+ );
50
58
  }
51
59
  // Annotate the CommonJS export names for ESM import in node:
52
60
  0 && (module.exports = {
package/dist/dep/dep.js CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/dep/dep.ts
@@ -47,18 +50,24 @@ var Dep = class {
47
50
  async buildExposeContent() {
48
51
  const isNodeNatives = !!process.binding("natives")[this.file];
49
52
  if (isNodeNatives) {
50
- return (0, import_trimFileContent.trimFileContent)(this.excludeNodeNatives ? `
53
+ return (0, import_trimFileContent.trimFileContent)(
54
+ this.excludeNodeNatives ? `
51
55
  const _ = require('${this.file}');
52
56
  module.exports = _;
53
57
  ` : `
54
58
  import _ from '${this.file}';
55
59
  export default _;
56
60
  export * from '${this.file}';
57
- `);
61
+ `
62
+ );
58
63
  }
59
64
  const realFile = await this.getRealFile();
60
65
  if (!realFile) {
61
- import_utils.logger.error(`Can not resolve dependence : '${import_utils.chalk.red(this.file)}', please install it`);
66
+ import_utils.logger.error(
67
+ `Can not resolve dependence : '${import_utils.chalk.red(
68
+ this.file
69
+ )}', please install it`
70
+ );
62
71
  }
63
72
  (0, import_assert.default)(realFile, `dependence not found: ${this.file}`);
64
73
  const content = (0, import_fs.readFileSync)(realFile, "utf-8");
@@ -23,33 +23,56 @@ __export(getCJSExports_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(getCJSExports_exports);
25
25
  function getCJSExports({ content }) {
26
- return matchAll(/Object\.defineProperty\(\s*exports\s*\,\s*[\"|\'](\w+)[\"|\']/g, content).concat(matchAll(/exports(?:\.|\[(?:\'|\"))(\w+)(?:\s*|(?:\'|\")\])\s*\=/g, content)).concat(matchAll(/__webpack_exports__\[(?:\"|\')(\w+)(?:\"|\')\]\s*\=/g, content)).concat(matchAll(/__webpack_require__\.d\(\s*__webpack_exports__\s*,\s*(?:\"|\')(\w+)(?:\"|\')\s*,/g, content)).concat(...matchAll(/__webpack_require__\.d\(\s*__webpack_exports__\s*,\s*(\{)/g, content).map((matchResult) => {
27
- const { index } = matchResult;
28
- let idx = index;
29
- let deep = 0;
30
- let isMeetSymbol = false;
31
- let symbolBeginIndex = index;
32
- while (idx < content.length) {
33
- if (!deep && isMeetSymbol) {
34
- break;
35
- }
36
- if (content[idx] === "{") {
37
- if (!isMeetSymbol) {
38
- isMeetSymbol = true;
39
- symbolBeginIndex = idx;
26
+ return matchAll(
27
+ /Object\.defineProperty\(\s*exports\s*\,\s*[\"|\'](\w+)[\"|\']/g,
28
+ content
29
+ ).concat(
30
+ matchAll(
31
+ /exports(?:\.|\[(?:\'|\"))(\w+)(?:\s*|(?:\'|\")\])\s*\=/g,
32
+ content
33
+ )
34
+ ).concat(
35
+ matchAll(/__webpack_exports__\[(?:\"|\')(\w+)(?:\"|\')\]\s*\=/g, content)
36
+ ).concat(
37
+ matchAll(
38
+ /__webpack_require__\.d\(\s*__webpack_exports__\s*,\s*(?:\"|\')(\w+)(?:\"|\')\s*,/g,
39
+ content
40
+ )
41
+ ).concat(
42
+ ...matchAll(
43
+ /__webpack_require__\.d\(\s*__webpack_exports__\s*,\s*(\{)/g,
44
+ content
45
+ ).map((matchResult) => {
46
+ const { index } = matchResult;
47
+ let idx = index;
48
+ let deep = 0;
49
+ let isMeetSymbol = false;
50
+ let symbolBeginIndex = index;
51
+ while (idx < content.length) {
52
+ if (!deep && isMeetSymbol) {
53
+ break;
40
54
  }
41
- deep++;
42
- }
43
- if (content[idx] === "}") {
44
- deep--;
55
+ if (content[idx] === "{") {
56
+ if (!isMeetSymbol) {
57
+ isMeetSymbol = true;
58
+ symbolBeginIndex = idx;
59
+ }
60
+ deep++;
61
+ }
62
+ if (content[idx] === "}") {
63
+ deep--;
64
+ }
65
+ idx++;
45
66
  }
46
- idx++;
47
- }
48
- let result = content.slice(symbolBeginIndex, idx);
49
- return [
50
- ...matchAll(/(?:\"|\')(\w+)(?:\"|\')\s*\:\s*(?:function|\()/g, result)
51
- ];
52
- })).map((result) => result[1]);
67
+ let result = content.slice(symbolBeginIndex, idx);
68
+ return [
69
+ ...matchAll(
70
+ /(?:\"|\')(\w+)(?:\"|\')\s*\:\s*(?:function|\()/g,
71
+ result
72
+ )
73
+ ];
74
+ })
75
+ ).map((result) => result[1]);
53
76
  }
54
77
  function matchAll(regexp, str) {
55
78
  const result = [];
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/dep/getExposeFromContent.ts
@@ -34,12 +37,17 @@ async function getExposeFromContent(opts) {
34
37
  if (opts.filePath && /\.(css|less|scss|sass|stylus|styl)$/.test(opts.filePath)) {
35
38
  return `import '${importPath}';`;
36
39
  }
37
- if (opts.filePath && /\.(json|svg|png|jpe?g|avif|gif|webp|ico|eot|woff|woff2|ttf|txt|text|mdx?)$/.test(opts.filePath)) {
40
+ if (opts.filePath && /\.(json|svg|png|jpe?g|avif|gif|webp|ico|eot|woff|woff2|ttf|txt|text|mdx?)$/.test(
41
+ opts.filePath
42
+ )) {
38
43
  return `
39
44
  import _ from '${importPath}';
40
45
  export default _;`.trim();
41
46
  }
42
- (0, import_assert.default)(/(js|jsx|mjs|ts|tsx)$/.test(opts.filePath), `file type not supported for ${(0, import_path.basename)(opts.filePath)}.`);
47
+ (0, import_assert.default)(
48
+ /(js|jsx|mjs|ts|tsx)$/.test(opts.filePath),
49
+ `file type not supported for ${(0, import_path.basename)(opts.filePath)}.`
50
+ );
43
51
  const { exports, isCJS } = await (0, import_getModuleExports.getModuleExports)({
44
52
  content: opts.content,
45
53
  filePath: opts.filePath
@@ -82,7 +82,9 @@ var DepBuilder = class {
82
82
  },
83
83
  inlineStyle: true
84
84
  });
85
- import_utils.logger.event(`[mfsu] compiled with esbuild successfully in ${+new Date() - date} ms`);
85
+ import_utils.logger.event(
86
+ `[mfsu] compiled with esbuild successfully in ${+new Date() - date} ms`
87
+ );
86
88
  opts.onBuildComplete();
87
89
  }
88
90
  async buildWithWorker(opts) {
@@ -91,19 +93,17 @@ var DepBuilder = class {
91
93
  return new Promise((resolve, reject) => {
92
94
  const onMessage = ({
93
95
  progress,
94
- done,
95
- error
96
+ done
96
97
  }) => {
97
98
  if (done) {
98
99
  opts.onBuildComplete();
99
100
  worker.off("message", onMessage);
100
- resolve();
101
- }
102
- if (error) {
103
- worker.off("message", onMessage);
104
- opts.onBuildComplete();
105
- import_utils.logger.error("[MFSU][eager] build failed", error);
106
- reject(error);
101
+ if (done.withError) {
102
+ import_utils.logger.debug("[MFSU][eager][main] build failed", done.withError);
103
+ reject(done.withError);
104
+ } else {
105
+ resolve();
106
+ }
107
107
  }
108
108
  if (progress) {
109
109
  this.opts.mfsu.onProgress(progress);
@@ -158,7 +158,7 @@ var DepBuilder = class {
158
158
  const content = await dep.buildExposeContent();
159
159
  (0, import_fs.writeFileSync)((0, import_path.join)(tmpBase, dep.filePath), content, "utf-8");
160
160
  }
161
- (0, import_fs.writeFileSync)((0, import_path.join)(tmpBase, MF_ENTRY), '"\u{1F61B}"', "utf-8");
161
+ (0, import_fs.writeFileSync)((0, import_path.join)(tmpBase, MF_ENTRY), '"😛"', "utf-8");
162
162
  }
163
163
  getWebpackConfig(opts) {
164
164
  var _a, _b;
@@ -193,26 +193,32 @@ var DepBuilder = class {
193
193
  };
194
194
  depConfig.plugins = depConfig.plugins || [];
195
195
  depConfig.plugins.push(new import_depChunkIdPrefixPlugin.DepChunkIdPrefixPlugin());
196
- depConfig.plugins.push(new import_stripSourceMapUrlPlugin.StripSourceMapUrlPlugin({
197
- webpack: this.opts.mfsu.opts.implementor
198
- }));
199
- depConfig.plugins.push(new this.opts.mfsu.opts.implementor.ProgressPlugin((percent, msg) => {
200
- this.opts.mfsu.onProgress({ percent, status: msg });
201
- }));
196
+ depConfig.plugins.push(
197
+ new import_stripSourceMapUrlPlugin.StripSourceMapUrlPlugin({
198
+ webpack: this.opts.mfsu.opts.implementor
199
+ })
200
+ );
201
+ depConfig.plugins.push(
202
+ new this.opts.mfsu.opts.implementor.ProgressPlugin((percent, msg) => {
203
+ this.opts.mfsu.onProgress({ percent, status: msg });
204
+ })
205
+ );
202
206
  const exposes = opts.deps.reduce((memo, dep) => {
203
207
  memo[`./${dep.file}`] = (0, import_path.join)(this.opts.mfsu.opts.tmpBase, dep.filePath);
204
208
  return memo;
205
209
  }, {});
206
- depConfig.plugins.push(new this.opts.mfsu.opts.implementor.container.ModuleFederationPlugin({
207
- library: {
208
- type: "global",
209
- name: mfName
210
- },
211
- name: mfName,
212
- filename: import_constants.REMOTE_FILE_FULL,
213
- exposes,
214
- shared: this.opts.mfsu.opts.shared || {}
215
- }));
210
+ depConfig.plugins.push(
211
+ new this.opts.mfsu.opts.implementor.container.ModuleFederationPlugin({
212
+ library: {
213
+ type: "global",
214
+ name: mfName
215
+ },
216
+ name: mfName,
217
+ filename: import_constants.REMOTE_FILE_FULL,
218
+ exposes,
219
+ shared: this.opts.mfsu.opts.shared || {}
220
+ })
221
+ );
216
222
  return depConfig;
217
223
  }
218
224
  };
package/dist/depInfo.js CHANGED
@@ -34,7 +34,10 @@ var DepInfo = class {
34
34
  this.cacheFilePath = (0, import_path.join)(this.opts.mfsu.opts.tmpBase, "MFSU_CACHE.json");
35
35
  }
36
36
  shouldBuild() {
37
- if (!import_utils.lodash.isEqual(this.cacheDependency, this.opts.mfsu.opts.getCacheDependency())) {
37
+ if (!import_utils.lodash.isEqual(
38
+ this.cacheDependency,
39
+ this.opts.mfsu.opts.getCacheDependency()
40
+ )) {
38
41
  return "cacheDependency has changed";
39
42
  }
40
43
  if (this.moduleGraph.hasDepChanged()) {
@@ -50,7 +53,9 @@ var DepInfo = class {
50
53
  if ((0, import_fs.existsSync)(this.cacheFilePath)) {
51
54
  import_utils.logger.info("[MFSU] restore cache");
52
55
  try {
53
- const { cacheDependency, moduleGraph } = JSON.parse((0, import_fs.readFileSync)(this.cacheFilePath, "utf-8"));
56
+ const { cacheDependency, moduleGraph } = JSON.parse(
57
+ (0, import_fs.readFileSync)(this.cacheFilePath, "utf-8")
58
+ );
54
59
  this.cacheDependency = cacheDependency;
55
60
  this.moduleGraph.restore(moduleGraph);
56
61
  } catch (e) {
@@ -62,10 +67,14 @@ var DepInfo = class {
62
67
  }
63
68
  writeCache() {
64
69
  import_utils.fsExtra.mkdirpSync((0, import_path.dirname)(this.cacheFilePath));
65
- const newContent = JSON.stringify({
66
- cacheDependency: this.cacheDependency,
67
- moduleGraph: this.moduleGraph.toJSON()
68
- }, null, 2);
70
+ const newContent = JSON.stringify(
71
+ {
72
+ cacheDependency: this.cacheDependency,
73
+ moduleGraph: this.moduleGraph.toJSON()
74
+ },
75
+ null,
76
+ 2
77
+ );
69
78
  if ((0, import_fs.existsSync)(this.cacheFilePath) && (0, import_fs.readFileSync)(this.cacheFilePath, "utf-8") === newContent) {
70
79
  return;
71
80
  }
@@ -32,7 +32,10 @@ function autoCssModulesHandler(opts) {
32
32
  if (i.d < 0 && (0, import_utils.isStyleFile)({ filename: i.n })) {
33
33
  const importSegment = code.substring(i.ss + offset, i.s + offset);
34
34
  if (~importSegment.indexOf(" from")) {
35
- code = `${code.substring(0, i.e + offset)}${CSS_MODULES_QUERY}${code.substring(i.e + offset)}`;
35
+ code = `${code.substring(
36
+ 0,
37
+ i.e + offset
38
+ )}${CSS_MODULES_QUERY}${code.substring(i.e + offset)}`;
36
39
  offset += QUERY_LENGTH;
37
40
  }
38
41
  }
package/dist/mfsu/mfsu.js CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/mfsu/mfsu.ts
@@ -76,7 +79,9 @@ var MFSU = class {
76
79
  srcCodeCache: opts.srcCodeCache
77
80
  });
78
81
  } else {
79
- import_utils.logger.warn("fallback to MFSU normal strategy, due to srcCache is not provided");
82
+ import_utils.logger.warn(
83
+ "fallback to MFSU normal strategy, due to srcCache is not provided"
84
+ );
80
85
  this.strategy = new import_strategyCompileTime.StrategyCompileTime({ mfsu: this });
81
86
  }
82
87
  } else {
@@ -96,7 +101,10 @@ var MFSU = class {
96
101
  const entry = {};
97
102
  const virtualModules = {};
98
103
  const entryObject = import_utils.lodash.isString(opts.config.entry) ? { default: [opts.config.entry] } : opts.config.entry;
99
- (0, import_assert.default)(import_utils.lodash.isPlainObject(entryObject), `webpack config 'entry' value must be a string or an object.`);
104
+ (0, import_assert.default)(
105
+ import_utils.lodash.isPlainObject(entryObject),
106
+ `webpack config 'entry' value must be a string or an object.`
107
+ );
100
108
  for (const key of Object.keys(entryObject)) {
101
109
  if (key === this.opts.remoteName) {
102
110
  entry[key] = entryObject[key];
@@ -110,7 +118,10 @@ var MFSU = class {
110
118
  const resolver = (0, import_webpackUtils.getResolver)(opts.config);
111
119
  for (let entry2 of entryFiles) {
112
120
  const realEntry = resolver(entry2);
113
- (0, import_assert.default)(realEntry, `entry file not found (${entry2}), please configure the specific entry path. (e.g. 'src/index.tsx')`);
121
+ (0, import_assert.default)(
122
+ realEntry,
123
+ `entry file not found (${entry2}), please configure the specific entry path. (e.g. 'src/index.tsx')`
124
+ );
114
125
  entry2 = realEntry;
115
126
  const content = (0, import_fs.readFileSync)(entry2, "utf-8");
116
127
  const [_imports, exports] = await (0, import_bundler_utils.parseModule)({ content, path: entry2 });
@@ -121,7 +132,9 @@ var MFSU = class {
121
132
  hasDefaultExport = true;
122
133
  virtualContent.push(`export default k${index}.${exportName}`);
123
134
  } else {
124
- virtualContent.push(`export const ${exportName} = k${index}.${exportName}`);
135
+ virtualContent.push(
136
+ `export const ${exportName} = k${index}.${exportName}`
137
+ );
125
138
  }
126
139
  }
127
140
  } else {
@@ -139,13 +152,14 @@ var MFSU = class {
139
152
  opts.config.plugins = opts.config.plugins || [];
140
153
  let publicPath = resolvePublicPath(opts.config);
141
154
  this.publicPath = publicPath;
142
- opts.config.plugins.push(...[
143
- new import_webpack_virtual_modules.default(virtualModules),
144
- new this.opts.implementor.container.ModuleFederationPlugin({
145
- name: "__",
146
- shared: this.opts.shared || {},
147
- remotes: {
148
- [mfName]: this.opts.runtimePublicPath ? `
155
+ opts.config.plugins.push(
156
+ ...[
157
+ new import_webpack_virtual_modules.default(virtualModules),
158
+ new this.opts.implementor.container.ModuleFederationPlugin({
159
+ name: "__",
160
+ shared: this.opts.shared || {},
161
+ remotes: {
162
+ [mfName]: this.opts.runtimePublicPath ? `
149
163
  promise new Promise(resolve => {
150
164
  const remoteUrlWithVersion = (window.publicPath || '/') + '${import_constants.REMOTE_FILE_FULL}';
151
165
  const script = document.createElement('script');
@@ -169,10 +183,11 @@ promise new Promise(resolve => {
169
183
  document.head.appendChild(script);
170
184
  })
171
185
  `.trimLeft() : `${mfName}@${publicPath}${import_constants.REMOTE_FILE_FULL}`
172
- }
173
- }),
174
- new import_buildDepPlugin.BuildDepPlugin(this.strategy.getBuildDepPlugConfig())
175
- ]);
186
+ }
187
+ }),
188
+ new import_buildDepPlugin.BuildDepPlugin(this.strategy.getBuildDepPlugConfig())
189
+ ]
190
+ );
176
191
  import_utils.lodash.set(opts.config, "experiments.topLevelAwait", true);
177
192
  this.depConfig = opts.depConfig;
178
193
  this.strategy.init(opts.config);
@@ -221,8 +236,14 @@ promise new Promise(resolve => {
221
236
  if (!req.path.includes(import_constants.REMOTE_FILE)) {
222
237
  res.setHeader("cache-control", "max-age=31536000,immutable");
223
238
  }
224
- res.setHeader("content-type", (0, import_mrmime.lookup)((0, import_path.extname)(req.path)) || "text/plain");
225
- const relativePath = req.path.replace(new RegExp(`^${relativePublicPath}`), "/");
239
+ res.setHeader(
240
+ "content-type",
241
+ (0, import_mrmime.lookup)((0, import_path.extname)(req.path)) || "text/plain"
242
+ );
243
+ const relativePath = req.path.replace(
244
+ new RegExp(`^${relativePublicPath}`),
245
+ "/"
246
+ );
226
247
  const realFilePath = (0, import_path.join)(this.opts.tmpBase, relativePath);
227
248
  if (!(0, import_fs.existsSync)(realFilePath)) {
228
249
  import_utils.logger.error(`MFSU dist file: ${realFilePath} not found`);
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/mfsu/strategyCompileTime.ts
@@ -84,7 +87,9 @@ var StrategyCompileTime = class {
84
87
  const mfsu = this.mfsu;
85
88
  const userUnMatches = mfsuOpts.unMatchLibs || [];
86
89
  const sharedUnMatches = Object.keys(mfsuOpts.shared || {});
87
- const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map((str) => new RegExp(`^${str}`));
90
+ const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map(
91
+ (str) => new RegExp(`^${str}`)
92
+ );
88
93
  const unMatches = [
89
94
  ...userUnMatches,
90
95
  ...sharedUnMatches,
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/mfsu/strategyStaticAnalyze.ts
@@ -63,7 +66,9 @@ var StaticAnalyzeStrategy = class {
63
66
  const mfsuOpts = this.mfsu.opts;
64
67
  const userUnMatches = mfsuOpts.unMatchLibs || [];
65
68
  const sharedUnMatches = Object.keys(mfsuOpts.shared || {});
66
- const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map((str) => new RegExp(`^${str}`));
69
+ const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map(
70
+ (str) => new RegExp(`^${str}`)
71
+ );
67
72
  const unMatches = [
68
73
  ...userUnMatches,
69
74
  ...sharedUnMatches,
@@ -121,7 +126,12 @@ var StaticAnalyzeStrategy = class {
121
126
  }
122
127
  },
123
128
  onFileChange: async (c) => {
124
- import_utils.logger.debug("webpack found changes modified:", c.modifiedFiles, "removed:", c.removedFiles);
129
+ import_utils.logger.debug(
130
+ "webpack found changes modified:",
131
+ c.modifiedFiles,
132
+ "removed:",
133
+ c.removedFiles
134
+ );
125
135
  const srcPath = this.staticDepInfo.opts.srcCodeCache.getSrcPath();
126
136
  const fileEvents = [
127
137
  ...this.staticDepInfo.opts.srcCodeCache.replayChangeEvents(),
@@ -144,7 +154,9 @@ var StaticAnalyzeStrategy = class {
144
154
  }
145
155
  const start = Date.now();
146
156
  try {
147
- await this.staticDepInfo.opts.srcCodeCache.handleFileChangeEvents(fileEvents);
157
+ await this.staticDepInfo.opts.srcCodeCache.handleFileChangeEvents(
158
+ fileEvents
159
+ );
148
160
  } catch (e) {
149
161
  import_utils.logger.error("MFSU[eager] analyze dependencies failed with error", e);
150
162
  }
@@ -99,7 +99,9 @@ var ModuleGraph = class {
99
99
  });
100
100
  this.fileToModules.forEach((value, key) => {
101
101
  fileModules[key] = {
102
- importedModules: Array.from(value.importedModules).map((item) => item.file)
102
+ importedModules: Array.from(value.importedModules).map(
103
+ (item) => item.file
104
+ )
103
105
  };
104
106
  if (value.isRoot) {
105
107
  fileModules[key].isRoot = true;
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/staticDepInfo/simulations/babel-plugin-import.ts
@@ -83,7 +86,11 @@ function createHandle(importOptions) {
83
86
  continue;
84
87
  }
85
88
  const transformedName = transformName(importVariableName);
86
- const importFsPath = (0, import_path.join)(libraryName, libraryDirectory, transformedName);
89
+ const importFsPath = (0, import_path.join)(
90
+ libraryName,
91
+ libraryDirectory,
92
+ transformedName
93
+ );
87
94
  addToMatches(importFsPath);
88
95
  }
89
96
  return retMatched;
@@ -96,7 +103,9 @@ function transCamel(_str, symbol) {
96
103
  return str.replace(/([A-Z])/g, ($1) => `${symbol}${$1.toLowerCase()}`);
97
104
  }
98
105
  function errorLogForSpaceImport(libraryName) {
99
- import_utils.logger.error(`"import * as ant from 'antd'" or "export * from '${libraryName}'" are not allowed in mfsu#strategy='eager'`);
106
+ import_utils.logger.error(
107
+ `"import * as ant from 'antd'" or "export * from '${libraryName}'" are not allowed in mfsu#strategy='eager'`
108
+ );
100
109
  import_utils.logger.error(`solutions:`);
101
110
  import_utils.logger.error(` change to "import { Xxx } from '${libraryName}'" or`);
102
111
  import_utils.logger.error(` "export { Xxx } from '${libraryName}'" syntax`);
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/staticDepInfo/staticDepInfo.ts
@@ -41,7 +44,10 @@ var StaticDepInfo = class {
41
44
  this.mfsu = opts.mfsu;
42
45
  this.include = this.mfsu.opts.include || [];
43
46
  this.opts = opts;
44
- this.cacheFilePath = (0, import_path.join)(this.opts.mfsu.opts.tmpBase, "MFSU_CACHE_v4.json");
47
+ this.cacheFilePath = (0, import_path.join)(
48
+ this.opts.mfsu.opts.tmpBase,
49
+ "MFSU_CACHE_v4.json"
50
+ );
45
51
  this.cwd = this.mfsu.opts.cwd;
46
52
  opts.srcCodeCache.register((info) => {
47
53
  this.currentDep = this._getDependencies(info.code, info.imports);
@@ -59,7 +65,10 @@ var StaticDepInfo = class {
59
65
  if (!import_utils.lodash.isEqual(this.cacheDependency, currentCacheDep)) {
60
66
  if (process.env.DEBUG_UMI) {
61
67
  const reason = (0, import_why.default)(this.cacheDependency, currentCacheDep);
62
- import_utils.logger.info("[MFSU][eager]: isEqual(cacheDependency,currentCacheDep) === false, because ", reason);
68
+ import_utils.logger.info(
69
+ "[MFSU][eager]: isEqual(cacheDependency,currentCacheDep) === false, because ",
70
+ reason
71
+ );
63
72
  }
64
73
  return "cacheDependency has changed";
65
74
  }
@@ -68,7 +77,10 @@ var StaticDepInfo = class {
68
77
  } else {
69
78
  if (process.env.DEBUG_UMI) {
70
79
  const reason = (0, import_why.default)(this.builtWithDep, this.currentDep);
71
- import_utils.logger.info("[MFSU][eager]: isEqual(oldDep,newDep) === false, because ", reason);
80
+ import_utils.logger.info(
81
+ "[MFSU][eager]: isEqual(oldDep,newDep) === false, because ",
82
+ reason
83
+ );
72
84
  }
73
85
  return "dependencies changed";
74
86
  }
@@ -92,21 +104,30 @@ var StaticDepInfo = class {
92
104
  loadCache() {
93
105
  if ((0, import_fs.existsSync)(this.cacheFilePath)) {
94
106
  try {
95
- const { dep = {}, cacheDependency = {} } = JSON.parse((0, import_fs.readFileSync)(this.cacheFilePath, "utf-8"));
107
+ const { dep = {}, cacheDependency = {} } = JSON.parse(
108
+ (0, import_fs.readFileSync)(this.cacheFilePath, "utf-8")
109
+ );
96
110
  this.builtWithDep = dep;
97
111
  this.cacheDependency = cacheDependency;
98
112
  import_utils.logger.info("[MFSU][eager] restored cache");
99
113
  } catch (e) {
100
- import_utils.logger.warn("[MFSU][eager] restore cache failed, fallback to Empty dependency", e);
114
+ import_utils.logger.warn(
115
+ "[MFSU][eager] restore cache failed, fallback to Empty dependency",
116
+ e
117
+ );
101
118
  }
102
119
  }
103
120
  }
104
121
  writeCache() {
105
122
  import_utils.fsExtra.mkdirpSync((0, import_path.dirname)(this.cacheFilePath));
106
- const newContent = JSON.stringify({
107
- dep: this.builtWithDep,
108
- cacheDependency: this.cacheDependency
109
- }, null, 2);
123
+ const newContent = JSON.stringify(
124
+ {
125
+ dep: this.builtWithDep,
126
+ cacheDependency: this.cacheDependency
127
+ },
128
+ null,
129
+ 2
130
+ );
110
131
  if ((0, import_fs.existsSync)(this.cacheFilePath) && (0, import_fs.readFileSync)(this.cacheFilePath, "utf-8") === newContent) {
111
132
  return;
112
133
  }
@@ -129,7 +150,9 @@ var StaticDepInfo = class {
129
150
  const mfsuOpts = this.mfsu.opts;
130
151
  const userUnMatches = mfsuOpts.unMatchLibs || [];
131
152
  const sharedUnMatches = Object.keys(mfsuOpts.shared || {});
132
- const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map((str) => new RegExp(`^${str}`));
153
+ const remoteAliasUnMatches = (mfsuOpts.remoteAliases || []).map(
154
+ (str) => new RegExp(`^${str}`)
155
+ );
133
156
  const unMatches = [
134
157
  ...userUnMatches,
135
158
  ...sharedUnMatches,
@@ -144,7 +167,9 @@ var StaticDepInfo = class {
144
167
  };
145
168
  const matched = {};
146
169
  const unMatched = /* @__PURE__ */ new Set();
147
- const pkgNames = this.runtimeSimulations.map(({ packageName }) => packageName);
170
+ const pkgNames = this.runtimeSimulations.map(
171
+ ({ packageName }) => packageName
172
+ );
148
173
  const groupedMockImports = {};
149
174
  for (const imp of imports) {
150
175
  if (!imp.n) {
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/utils/resolveUtils.ts
@@ -52,7 +55,11 @@ var cjsResolver = import_enhanced_resolve.default.create({
52
55
  });
53
56
  async function resolveWith(resolver, context, path) {
54
57
  return new Promise((resolve2, reject) => {
55
- resolver(context, path, (err, result) => err ? reject(err) : resolve2(result));
58
+ resolver(
59
+ context,
60
+ path,
61
+ (err, result) => err ? reject(err) : resolve2(result)
62
+ );
56
63
  });
57
64
  }
58
65
  async function tryResolvers(rs, context, path) {
@@ -72,7 +79,11 @@ async function tryResolvers(rs, context, path) {
72
79
  return result;
73
80
  }
74
81
  async function resolve(context, path) {
75
- return await tryResolvers([browserResolver, esmResolver, cjsResolver], context, path);
82
+ return await tryResolvers(
83
+ [browserResolver, esmResolver, cjsResolver],
84
+ context,
85
+ path
86
+ );
76
87
  }
77
88
  async function resolveFromContexts(contexts, path) {
78
89
  for (const context of contexts) {
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/utils/webpackUtils.ts
@@ -33,14 +36,20 @@ var { property, compact, flatMap } = import_utils.lodash;
33
36
  function extractBabelPluginImportOptions(webpackConfig) {
34
37
  var _a;
35
38
  const rules = ((_a = webpackConfig.module) == null ? void 0 : _a.rules) || [];
36
- const uses = compact(flatMap(rules, property(["use"]))).filter((u) => {
37
- var _a2;
38
- return ((_a2 = u == null ? void 0 : u.loader) == null ? void 0 : _a2.indexOf("babel-loader")) >= 0;
39
- });
40
- const pluginConfigs = compact(flatMap(uses, property(["options", "plugins"]))).filter((p) => {
41
- var _a2, _b;
42
- return Array.isArray(p) && ((_b = (_a2 = p[0]) == null ? void 0 : _a2.indexOf) == null ? void 0 : _b.call(_a2, "babel-plugin-import")) >= 0;
43
- });
39
+ const uses = compact(flatMap(rules, property(["use"]))).filter(
40
+ (u) => {
41
+ var _a2;
42
+ return ((_a2 = u == null ? void 0 : u.loader) == null ? void 0 : _a2.indexOf("babel-loader")) >= 0;
43
+ }
44
+ );
45
+ const pluginConfigs = compact(
46
+ flatMap(uses, property(["options", "plugins"]))
47
+ ).filter(
48
+ (p) => {
49
+ var _a2, _b;
50
+ return Array.isArray(p) && ((_b = (_a2 = p[0]) == null ? void 0 : _a2.indexOf) == null ? void 0 : _b.call(_a2, "babel-plugin-import")) >= 0;
51
+ }
52
+ );
44
53
  const configs = /* @__PURE__ */ new Map();
45
54
  for (const c of pluginConfigs) {
46
55
  !configs.has(c[1].libraryName) && configs.set(c[1].libraryName, c[1]);
@@ -31,7 +31,13 @@ var BuildDepPlugin = class {
31
31
  apply(compiler) {
32
32
  compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, (c) => {
33
33
  var _a, _b;
34
- import_utils.logger.debug("webpack watched change", "modified: ", c.modifiedFiles, "removed: ", c.removedFiles);
34
+ import_utils.logger.debug(
35
+ "webpack watched change",
36
+ "modified: ",
37
+ c.modifiedFiles,
38
+ "removed: ",
39
+ c.removedFiles
40
+ );
35
41
  return ((_b = (_a = this.opts).onFileChange) == null ? void 0 : _b.call(_a, c)) || Promise.resolve();
36
42
  });
37
43
  compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
@@ -1,4 +1,4 @@
1
- import { Compiler } from 'webpack';
1
+ import type { Compiler } from 'webpack';
2
2
  export declare class DepChunkIdPrefixPlugin {
3
3
  constructor();
4
4
  apply(compiler: Compiler): void;
@@ -29,12 +29,15 @@ var DepChunkIdPrefixPlugin = class {
29
29
  }
30
30
  apply(compiler) {
31
31
  compiler.hooks.compilation.tap(pluginId, (compilation) => {
32
- compilation.hooks.afterOptimizeChunkIds.tap(pluginId, (chunks) => {
33
- for (const chunk of chunks) {
34
- chunk.id = import_constants.MF_DEP_PREFIX + chunk.id;
35
- chunk.ids = [chunk.id];
32
+ compilation.hooks.afterOptimizeChunkIds.tap(
33
+ pluginId,
34
+ (chunks) => {
35
+ for (const chunk of chunks) {
36
+ chunk.id = import_constants.MF_DEP_PREFIX + chunk.id;
37
+ chunk.ids = [chunk.id];
38
+ }
36
39
  }
37
- });
40
+ );
38
41
  });
39
42
  }
40
43
  };
@@ -27,18 +27,27 @@ var StripSourceMapUrlPlugin = class {
27
27
  this.opts = opts;
28
28
  }
29
29
  apply(compiler) {
30
- compiler.hooks.compilation.tap("StripSourceMapUrlPlugin", (compilation) => {
31
- compilation.hooks.processAssets.tap({
32
- name: "StripSourceMapUrlPlugin",
33
- stage: this.opts.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVE
34
- }, (assets) => {
35
- Object.keys(assets).filter((filename) => /\.js$/.test(filename)).forEach((filename) => {
36
- const asset = assets[filename];
37
- const source = asset.source().toString().replace(/# sourceMappingURL=(.+?\.map)/g, "# $1");
38
- compilation.updateAsset(filename, new this.opts.webpack.sources.RawSource(source));
39
- });
40
- });
41
- });
30
+ compiler.hooks.compilation.tap(
31
+ "StripSourceMapUrlPlugin",
32
+ (compilation) => {
33
+ compilation.hooks.processAssets.tap(
34
+ {
35
+ name: "StripSourceMapUrlPlugin",
36
+ stage: this.opts.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVE
37
+ },
38
+ (assets) => {
39
+ Object.keys(assets).filter((filename) => /\.js$/.test(filename)).forEach((filename) => {
40
+ const asset = assets[filename];
41
+ const source = asset.source().toString().replace(/# sourceMappingURL=(.+?\.map)/g, "# $1");
42
+ compilation.updateAsset(
43
+ filename,
44
+ new this.opts.webpack.sources.RawSource(source)
45
+ );
46
+ });
47
+ }
48
+ );
49
+ }
50
+ );
42
51
  }
43
52
  };
44
53
  // Annotate the CommonJS export names for ESM import in node:
@@ -28,9 +28,12 @@ var WriteCachePlugin = class {
28
28
  this.opts = opts;
29
29
  }
30
30
  apply(compiler) {
31
- compiler.cache.hooks.store.tap({ name: PLUGIN_NAME, stage: 10 }, () => {
32
- this.opts.onWriteCache();
33
- });
31
+ compiler.cache.hooks.store.tap(
32
+ { name: PLUGIN_NAME, stage: 10 },
33
+ () => {
34
+ this.opts.onWriteCache();
35
+ }
36
+ );
34
37
  }
35
38
  };
36
39
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.42",
3
+ "version": "4.0.44",
4
4
  "description": "@umijs/mfsu",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/mfsu#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -23,17 +23,17 @@
23
23
  "test": "umi-scripts jest-turbo"
24
24
  },
25
25
  "dependencies": {
26
- "@umijs/bundler-esbuild": "4.0.42",
27
- "@umijs/bundler-utils": "4.0.42",
28
- "@umijs/utils": "4.0.42",
26
+ "@umijs/bundler-esbuild": "4.0.44",
27
+ "@umijs/bundler-utils": "4.0.44",
28
+ "@umijs/utils": "4.0.44",
29
29
  "enhanced-resolve": "5.9.3",
30
30
  "is-equal": "^1.6.4"
31
31
  },
32
32
  "devDependencies": {
33
- "is-absolute-url": "^3.0.3",
34
- "mrmime": "1.0.0",
35
- "webpack": "5.72.1",
36
- "webpack-virtual-modules": "0.4.3"
33
+ "is-absolute-url": "^4.0.1",
34
+ "mrmime": "1.0.1",
35
+ "webpack": "5.75.0",
36
+ "webpack-virtual-modules": "0.5.0"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"