@umijs/mfsu 4.0.0-rc.11 → 4.0.0-rc.14
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/dist/dep/dep.js +2 -3
- package/dist/depBuilder/depBuilder.js +3 -0
- package/dist/mfsu.d.ts +4 -0
- package/dist/mfsu.js +19 -2
- package/package.json +7 -7
package/dist/dep/dep.js
CHANGED
|
@@ -24,9 +24,8 @@ const getExposeFromContent_1 = require("./getExposeFromContent");
|
|
|
24
24
|
const resolver = enhanced_resolve_1.default.create({
|
|
25
25
|
mainFields: ['module', 'browser', 'main'],
|
|
26
26
|
extensions: ['.js', '.json', '.mjs'],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exportsFields: [],
|
|
27
|
+
exportsFields: ['exports'],
|
|
28
|
+
conditionNames: ['import', 'module', 'require', 'node'],
|
|
30
29
|
});
|
|
31
30
|
function resolve(context, path) {
|
|
32
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -151,6 +151,9 @@ class DepBuilder {
|
|
|
151
151
|
depConfig.plugins.push(new stripSourceMapUrlPlugin_1.StripSourceMapUrlPlugin({
|
|
152
152
|
webpack: this.opts.mfsu.opts.implementor,
|
|
153
153
|
}));
|
|
154
|
+
depConfig.plugins.push(new this.opts.mfsu.opts.implementor.ProgressPlugin((percent, msg) => {
|
|
155
|
+
this.opts.mfsu.onProgress({ percent, status: msg });
|
|
156
|
+
}));
|
|
154
157
|
const exposes = opts.deps.reduce((memo, dep) => {
|
|
155
158
|
memo[`./${dep.file}`] = (0, path_1.join)(this.opts.mfsu.opts.tmpBase, dep.filePath);
|
|
156
159
|
return memo;
|
package/dist/mfsu.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ interface IOpts {
|
|
|
9
9
|
excludeNodeNatives?: boolean;
|
|
10
10
|
exportAllMembers?: Record<string, string[]>;
|
|
11
11
|
getCacheDependency?: Function;
|
|
12
|
+
onMFSUProgress?: Function;
|
|
12
13
|
mfName?: string;
|
|
13
14
|
mode?: Mode;
|
|
14
15
|
tmpBase?: string;
|
|
@@ -26,6 +27,9 @@ export declare class MFSU {
|
|
|
26
27
|
depBuilder: DepBuilder;
|
|
27
28
|
depConfig: Configuration | null;
|
|
28
29
|
buildDepsAgain: boolean;
|
|
30
|
+
progress: any;
|
|
31
|
+
onProgress: Function;
|
|
32
|
+
publicPath: string;
|
|
29
33
|
constructor(opts: IOpts);
|
|
30
34
|
asyncImport(content: string): string;
|
|
31
35
|
setWebpackConfig(opts: {
|
package/dist/mfsu.js
CHANGED
|
@@ -37,12 +37,19 @@ class MFSU {
|
|
|
37
37
|
this.externals = [];
|
|
38
38
|
this.depConfig = null;
|
|
39
39
|
this.buildDepsAgain = false;
|
|
40
|
+
this.progress = { done: false };
|
|
41
|
+
this.publicPath = '/';
|
|
40
42
|
this.opts = opts;
|
|
41
43
|
this.opts.mfName = this.opts.mfName || constants_1.DEFAULT_MF_NAME;
|
|
42
44
|
this.opts.tmpBase =
|
|
43
45
|
this.opts.tmpBase || (0, path_1.join)(process.cwd(), constants_1.DEFAULT_TMP_DIR_NAME);
|
|
44
46
|
this.opts.mode = this.opts.mode || types_1.Mode.development;
|
|
45
47
|
this.opts.getCacheDependency = this.opts.getCacheDependency || (() => ({}));
|
|
48
|
+
this.onProgress = (progress) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
this.progress = Object.assign(Object.assign({}, this.progress), progress);
|
|
51
|
+
(_b = (_a = this.opts).onMFSUProgress) === null || _b === void 0 ? void 0 : _b.call(_a, this.progress);
|
|
52
|
+
};
|
|
46
53
|
this.opts.cwd = this.opts.cwd || process.cwd();
|
|
47
54
|
this.depInfo = new depInfo_1.DepInfo({ mfsu: this });
|
|
48
55
|
this.depBuilder = new depBuilder_1.DepBuilder({ mfsu: this });
|
|
@@ -123,6 +130,7 @@ class MFSU {
|
|
|
123
130
|
if (publicPath === 'auto') {
|
|
124
131
|
publicPath = '/';
|
|
125
132
|
}
|
|
133
|
+
this.publicPath = publicPath;
|
|
126
134
|
opts.config.plugins.push(...[
|
|
127
135
|
new webpack_virtual_modules_1.default(virtualModules),
|
|
128
136
|
new this.opts.implementor.container.ModuleFederationPlugin({
|
|
@@ -164,8 +172,17 @@ promise new Promise(resolve => {
|
|
|
164
172
|
this.buildDepsAgain = true;
|
|
165
173
|
}
|
|
166
174
|
else {
|
|
167
|
-
this.buildDeps()
|
|
175
|
+
this.buildDeps()
|
|
176
|
+
.then(() => {
|
|
177
|
+
this.onProgress({
|
|
178
|
+
done: true,
|
|
179
|
+
});
|
|
180
|
+
})
|
|
181
|
+
.catch((e) => {
|
|
168
182
|
utils_1.logger.error(e);
|
|
183
|
+
this.onProgress({
|
|
184
|
+
done: true,
|
|
185
|
+
});
|
|
169
186
|
});
|
|
170
187
|
}
|
|
171
188
|
},
|
|
@@ -216,7 +233,7 @@ promise new Promise(resolve => {
|
|
|
216
233
|
getMiddlewares() {
|
|
217
234
|
return [
|
|
218
235
|
(req, res, next) => {
|
|
219
|
-
const publicPath =
|
|
236
|
+
const publicPath = this.publicPath;
|
|
220
237
|
const isMF = req.path.startsWith(`${publicPath}${constants_1.MF_VA_PREFIX}`) ||
|
|
221
238
|
req.path.startsWith(`${publicPath}${constants_1.MF_DEP_PREFIX}`) ||
|
|
222
239
|
req.path.startsWith(`${publicPath}${constants_1.MF_STATIC_PREFIX}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/mfsu",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.14",
|
|
4
4
|
"description": "@umijs/mfsu",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/mfsu#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "pnpm tsc",
|
|
20
|
-
"build:deps": "
|
|
20
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
21
21
|
"dev": "pnpm build -- --watch",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "umi-scripts jest-turbo"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@umijs/bundler-esbuild": "4.0.0-rc.
|
|
26
|
-
"@umijs/bundler-utils": "4.0.0-rc.
|
|
27
|
-
"@umijs/utils": "4.0.0-rc.
|
|
25
|
+
"@umijs/bundler-esbuild": "4.0.0-rc.14",
|
|
26
|
+
"@umijs/bundler-utils": "4.0.0-rc.14",
|
|
27
|
+
"@umijs/utils": "4.0.0-rc.14",
|
|
28
28
|
"enhanced-resolve": "5.9.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"mrmime": "1.0.0",
|
|
32
|
-
"webpack": "5.
|
|
32
|
+
"webpack": "5.72.0",
|
|
33
33
|
"webpack-virtual-modules": "0.4.3"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|