@umijs/mfsu 4.0.3 → 4.0.6

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,5 +1,4 @@
1
1
  import type { NextFunction, Request, Response } from '@umijs/bundler-utils/compiled/express';
2
- import type { AutoUpdateSrcCodeCache } from '@umijs/utils';
3
2
  import webpack, { Configuration } from 'webpack';
4
3
  import { DepBuilder } from '../depBuilder/depBuilder';
5
4
  import { DepModule } from '../depInfo';
@@ -21,7 +20,7 @@ interface IOpts {
21
20
  depBuildConfig: any;
22
21
  strategy?: 'eager' | 'normal';
23
22
  include?: string[];
24
- srcCodeCache?: AutoUpdateSrcCodeCache;
23
+ srcCodeCache?: any;
25
24
  }
26
25
  export declare class MFSU {
27
26
  opts: IOpts;
@@ -1,12 +1,11 @@
1
- import type { AutoUpdateSrcCodeCache } from '@umijs/utils';
2
1
  import { IBuildDepPluginOpts } from '../webpackPlugins/buildDepPlugin';
3
2
  import type { IMFSUStrategy, MFSU } from './mfsu';
4
3
  export declare class StaticAnalyzeStrategy implements IMFSUStrategy {
5
4
  private readonly mfsu;
6
5
  private staticDepInfo;
7
- constructor({ mfsu, srcCodeCache, }: {
6
+ constructor({ mfsu, srcCodeCache }: {
8
7
  mfsu: MFSU;
9
- srcCodeCache: AutoUpdateSrcCodeCache;
8
+ srcCodeCache: any;
10
9
  });
11
10
  init(): void;
12
11
  getDepModules(): Record<string, {
@@ -9,7 +9,7 @@ const getAliasedPath_1 = require("../babelPlugins/awaitImport/getAliasedPath");
9
9
  const MFImport_1 = __importDefault(require("../babelPlugins/awaitImport/MFImport"));
10
10
  const staticDepInfo_1 = require("../staticDepInfo/staticDepInfo");
11
11
  class StaticAnalyzeStrategy {
12
- constructor({ mfsu, srcCodeCache, }) {
12
+ constructor({ mfsu, srcCodeCache }) {
13
13
  this.mfsu = mfsu;
14
14
  this.staticDepInfo = new staticDepInfo_1.StaticDepInfo({
15
15
  mfsu,
@@ -92,7 +92,6 @@ class StaticAnalyzeStrategy {
92
92
  let event = this.staticDepInfo.getProducedEvent();
93
93
  while (event.length === 0) {
94
94
  await sleep(200);
95
- console.log('.');
96
95
  event = this.staticDepInfo.getProducedEvent();
97
96
  if (Date.now() - start > 5000) {
98
97
  utils_1.logger.warn('webpack wait mfsu deps too long');
@@ -1,6 +1,19 @@
1
- import type { AutoUpdateSrcCodeCache } from '@umijs/utils';
1
+ import { ImportSpecifier } from '@umijs/bundler-utils/compiled/es-module-lexer';
2
2
  import { checkMatch } from '../babelPlugins/awaitImport/checkMatch';
3
3
  import { MFSU } from '../mfsu/mfsu';
4
+ declare type FileChangeEvent = {
5
+ event: 'unlink' | 'change' | 'add';
6
+ path: string;
7
+ };
8
+ declare type MergedCodeInfo = {
9
+ imports: readonly ImportSpecifier[];
10
+ code: string;
11
+ events: FileChangeEvent[];
12
+ };
13
+ declare type AutoUpdateSrcCodeCache = {
14
+ register(listener: (info: MergedCodeInfo) => void): void;
15
+ getMergedCode(): MergedCodeInfo;
16
+ };
4
17
  interface IOpts {
5
18
  mfsu: MFSU;
6
19
  srcCodeCache: AutoUpdateSrcCodeCache;
@@ -35,6 +35,14 @@ class StaticDepInfo {
35
35
  libraryDirectory: 'es',
36
36
  }),
37
37
  },
38
+ {
39
+ packageName: '@alipay/bigfish/antd',
40
+ handleImports: (0, babel_plugin_import_1.default)({
41
+ libraryName: '@alipay/bigfish/antd',
42
+ style: true,
43
+ libraryDirectory: 'es',
44
+ }),
45
+ },
38
46
  ];
39
47
  }
40
48
  getProducedEvent() {
@@ -15,8 +15,10 @@ class BuildDepPlugin {
15
15
  var _a, _b;
16
16
  (_b = (_a = this.opts).beforeCompile) === null || _b === void 0 ? void 0 : _b.call(_a);
17
17
  });
18
- compiler.hooks.compile.tap(PLUGIN_NAME, () => {
19
- this.opts.onCompileDone();
18
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
19
+ if (!stats.hasErrors()) {
20
+ this.opts.onCompileDone();
21
+ }
20
22
  });
21
23
  }
22
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.3",
3
+ "version": "4.0.6",
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,9 +23,9 @@
23
23
  "test": "umi-scripts jest-turbo"
24
24
  },
25
25
  "dependencies": {
26
- "@umijs/bundler-esbuild": "4.0.3",
27
- "@umijs/bundler-utils": "4.0.3",
28
- "@umijs/utils": "4.0.3",
26
+ "@umijs/bundler-esbuild": "4.0.6",
27
+ "@umijs/bundler-utils": "4.0.6",
28
+ "@umijs/utils": "4.0.6",
29
29
  "enhanced-resolve": "5.9.3",
30
30
  "is-equal": "^1.6.4"
31
31
  },