@umijs/mfsu 4.0.41 → 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.
- package/compiled/is-absolute-url/LICENSE +1 -1
- package/compiled/is-absolute-url/index.d.ts +2 -4
- package/compiled/is-absolute-url/index.js +1 -1
- package/compiled/is-absolute-url/package.json +1 -1
- package/compiled/mrmime/package.json +1 -1
- package/compiled/webpack-virtual-modules/index.js +1 -1
- package/compiled/webpack-virtual-modules/package.json +1 -1
- package/dist/babelPlugins/awaitImport/checkMatch.js +10 -5
- package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +2 -5
- package/dist/babelPlugins/awaitImport/getAliasedPath.js +9 -26
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -2
- package/dist/depBuilder/depBuilder.js +33 -27
- package/dist/mfsu/mfsu.js +1 -1
- package/dist/mfsu/strategyStaticAnalyze.js +4 -4
- package/dist/staticDepInfo/staticDepInfo.d.ts +1 -0
- package/dist/webpackPlugins/buildDepPlugin.js +7 -1
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +1 -1
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +8 -5
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +21 -12
- 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
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
export = isAbsoluteUrl;
|
|
20
|
+
export default function isAbsoluteUrl(url: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var e={
|
|
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={
|
|
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(
|
|
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)(
|
|
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 =
|
|
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
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 =
|
|
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(
|
|
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
|
});
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -25,7 +25,8 @@ __export(constants_exports, {
|
|
|
25
25
|
MF_STATIC_PREFIX: () => MF_STATIC_PREFIX,
|
|
26
26
|
MF_VA_PREFIX: () => MF_VA_PREFIX,
|
|
27
27
|
REMOTE_FILE: () => REMOTE_FILE,
|
|
28
|
-
REMOTE_FILE_FULL: () => REMOTE_FILE_FULL
|
|
28
|
+
REMOTE_FILE_FULL: () => REMOTE_FILE_FULL,
|
|
29
|
+
VIRTUAL_ENTRY_DIR: () => VIRTUAL_ENTRY_DIR
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(constants_exports);
|
|
31
32
|
var MF_VA_PREFIX = "mf-va_";
|
|
@@ -35,6 +36,7 @@ var DEFAULT_MF_NAME = "mf";
|
|
|
35
36
|
var DEFAULT_TMP_DIR_NAME = ".mfsu";
|
|
36
37
|
var REMOTE_FILE = "remoteEntry.js";
|
|
37
38
|
var REMOTE_FILE_FULL = `${MF_VA_PREFIX}${REMOTE_FILE}`;
|
|
39
|
+
var VIRTUAL_ENTRY_DIR = `mfsu-virtual-entry`;
|
|
38
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
41
|
0 && (module.exports = {
|
|
40
42
|
DEFAULT_MF_NAME,
|
|
@@ -43,5 +45,6 @@ var REMOTE_FILE_FULL = `${MF_VA_PREFIX}${REMOTE_FILE}`;
|
|
|
43
45
|
MF_STATIC_PREFIX,
|
|
44
46
|
MF_VA_PREFIX,
|
|
45
47
|
REMOTE_FILE,
|
|
46
|
-
REMOTE_FILE_FULL
|
|
48
|
+
REMOTE_FILE_FULL,
|
|
49
|
+
VIRTUAL_ENTRY_DIR
|
|
47
50
|
});
|
|
@@ -82,7 +82,9 @@ var DepBuilder = class {
|
|
|
82
82
|
},
|
|
83
83
|
inlineStyle: true
|
|
84
84
|
});
|
|
85
|
-
import_utils.logger.event(
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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), '"
|
|
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(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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/mfsu/mfsu.js
CHANGED
|
@@ -102,7 +102,7 @@ var MFSU = class {
|
|
|
102
102
|
entry[key] = entryObject[key];
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
-
const virtualPath =
|
|
105
|
+
const virtualPath = `./${import_constants.VIRTUAL_ENTRY_DIR}/${key}.js`;
|
|
106
106
|
const virtualContent = [];
|
|
107
107
|
let index = 1;
|
|
108
108
|
let hasDefaultExport = false;
|
|
@@ -122,16 +122,16 @@ var StaticAnalyzeStrategy = class {
|
|
|
122
122
|
},
|
|
123
123
|
onFileChange: async (c) => {
|
|
124
124
|
import_utils.logger.debug("webpack found changes modified:", c.modifiedFiles, "removed:", c.removedFiles);
|
|
125
|
-
const
|
|
125
|
+
const srcPath = this.staticDepInfo.opts.srcCodeCache.getSrcPath();
|
|
126
126
|
const fileEvents = [
|
|
127
127
|
...this.staticDepInfo.opts.srcCodeCache.replayChangeEvents(),
|
|
128
|
-
...extractJSCodeFiles(
|
|
128
|
+
...extractJSCodeFiles(srcPath, c.modifiedFiles).map((f) => {
|
|
129
129
|
return {
|
|
130
130
|
event: "change",
|
|
131
131
|
path: f
|
|
132
132
|
};
|
|
133
133
|
}),
|
|
134
|
-
...extractJSCodeFiles(
|
|
134
|
+
...extractJSCodeFiles(srcPath, c.removedFiles).map((f) => {
|
|
135
135
|
return {
|
|
136
136
|
event: "unlink",
|
|
137
137
|
path: f
|
|
@@ -168,7 +168,7 @@ function extractJSCodeFiles(folderBase, files) {
|
|
|
168
168
|
return jsFiles;
|
|
169
169
|
}
|
|
170
170
|
for (let file of files.values()) {
|
|
171
|
-
if (file.startsWith(folderBase) && REG_CODE_EXT.test(file)) {
|
|
171
|
+
if (file.startsWith(folderBase) && REG_CODE_EXT.test(file) && file.indexOf("node_modules") === -1) {
|
|
172
172
|
jsFiles.push(file);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -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(
|
|
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, () => {
|
|
@@ -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(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
chunk
|
|
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(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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.
|
|
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.
|
|
27
|
-
"@umijs/bundler-utils": "4.0.
|
|
28
|
-
"@umijs/utils": "4.0.
|
|
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": "^
|
|
34
|
-
"mrmime": "1.0.
|
|
35
|
-
"webpack": "5.
|
|
36
|
-
"webpack-virtual-modules": "0.
|
|
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"
|