@umijs/mfsu 4.0.42 → 4.0.43

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.
@@ -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/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
  });
@@ -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
  };
@@ -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:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.42",
3
+ "version": "4.0.43",
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.43",
27
+ "@umijs/bundler-utils": "4.0.43",
28
+ "@umijs/utils": "4.0.43",
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"