@umijs/mfsu 4.0.0-rc.11 → 4.0.0-rc.12

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 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
- // TODO: support exports
28
- // tried to add exports, but it don't work with swr
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,8 @@ export declare class MFSU {
26
27
  depBuilder: DepBuilder;
27
28
  depConfig: Configuration | null;
28
29
  buildDepsAgain: boolean;
30
+ progress: any;
31
+ onProgress: Function;
29
32
  constructor(opts: IOpts);
30
33
  asyncImport(content: string): string;
31
34
  setWebpackConfig(opts: {
package/dist/mfsu.js CHANGED
@@ -37,12 +37,18 @@ class MFSU {
37
37
  this.externals = [];
38
38
  this.depConfig = null;
39
39
  this.buildDepsAgain = false;
40
+ this.progress = { done: false };
40
41
  this.opts = opts;
41
42
  this.opts.mfName = this.opts.mfName || constants_1.DEFAULT_MF_NAME;
42
43
  this.opts.tmpBase =
43
44
  this.opts.tmpBase || (0, path_1.join)(process.cwd(), constants_1.DEFAULT_TMP_DIR_NAME);
44
45
  this.opts.mode = this.opts.mode || types_1.Mode.development;
45
46
  this.opts.getCacheDependency = this.opts.getCacheDependency || (() => ({}));
47
+ this.onProgress = (progress) => {
48
+ var _a, _b;
49
+ this.progress = Object.assign(Object.assign({}, this.progress), progress);
50
+ (_b = (_a = this.opts).onMFSUProgress) === null || _b === void 0 ? void 0 : _b.call(_a, this.progress);
51
+ };
46
52
  this.opts.cwd = this.opts.cwd || process.cwd();
47
53
  this.depInfo = new depInfo_1.DepInfo({ mfsu: this });
48
54
  this.depBuilder = new depBuilder_1.DepBuilder({ mfsu: this });
@@ -164,8 +170,17 @@ promise new Promise(resolve => {
164
170
  this.buildDepsAgain = true;
165
171
  }
166
172
  else {
167
- this.buildDeps().catch((e) => {
173
+ this.buildDeps()
174
+ .then(() => {
175
+ this.onProgress({
176
+ done: true,
177
+ });
178
+ })
179
+ .catch((e) => {
168
180
  utils_1.logger.error(e);
181
+ this.onProgress({
182
+ done: true,
183
+ });
169
184
  });
170
185
  }
171
186
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.0-rc.11",
3
+ "version": "4.0.0-rc.12",
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",
@@ -22,14 +22,14 @@
22
22
  "test": "jest -c ../../jest.turbo.config.ts"
23
23
  },
24
24
  "dependencies": {
25
- "@umijs/bundler-esbuild": "4.0.0-rc.11",
26
- "@umijs/bundler-utils": "4.0.0-rc.11",
27
- "@umijs/utils": "4.0.0-rc.11",
25
+ "@umijs/bundler-esbuild": "4.0.0-rc.12",
26
+ "@umijs/bundler-utils": "4.0.0-rc.12",
27
+ "@umijs/utils": "4.0.0-rc.12",
28
28
  "enhanced-resolve": "5.9.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "mrmime": "1.0.0",
32
- "webpack": "5.70.0",
32
+ "webpack": "5.72.0",
33
33
  "webpack-virtual-modules": "0.4.3"
34
34
  },
35
35
  "publishConfig": {