@umijs/bundler-webpack 4.0.0-canary.20221028.1 → 4.0.0-canary.20221103.1

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/dev.d.ts CHANGED
@@ -26,6 +26,7 @@ declare type IOpts = {
26
26
  mfsuInclude?: string[];
27
27
  srcCodeCache?: any;
28
28
  startBuildWorker?: (deps: any[]) => Worker;
29
+ onBeforeMiddleware?: Function;
29
30
  } & Pick<IConfigOpts, 'cache' | 'pkg'>;
30
31
  export declare function stripUndefined(obj: any): any;
31
32
  export declare function dev(opts: IOpts): Promise<void>;
package/dist/dev.js CHANGED
@@ -158,7 +158,8 @@ async function dev(opts) {
158
158
  ip: opts.ip,
159
159
  afterMiddlewares: [...opts.afterMiddlewares || []],
160
160
  onDevCompileDone: opts.onDevCompileDone,
161
- onProgress: opts.onProgress
161
+ onProgress: opts.onProgress,
162
+ onBeforeMiddleware: opts.onBeforeMiddleware
162
163
  });
163
164
  }
164
165
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type webpack from '../compiled/webpack';
2
2
  import './requireHook';
3
- export type { RequestHandler } from '@umijs/bundler-utils/compiled/express';
3
+ export type { RequestHandler, Express, } from '@umijs/bundler-utils/compiled/express';
4
4
  export type { Compiler, Stats } from '../compiled/webpack';
5
5
  export * from './build';
6
6
  export * from './config/config';
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { Configuration } from '@umijs/bundler-webpack/compiled/webpack';
3
4
  import http from 'http';
4
5
  import { IConfig } from '../types';
@@ -13,6 +14,7 @@ interface IOpts {
13
14
  afterMiddlewares?: any[];
14
15
  onDevCompileDone?: Function;
15
16
  onProgress?: Function;
17
+ onBeforeMiddleware?: Function;
16
18
  }
17
19
  export declare function createServer(opts: IOpts): Promise<http.Server | import("https").Server | null>;
18
20
  export {};
@@ -58,18 +58,23 @@ async function createServer(opts) {
58
58
  }
59
59
  });
60
60
  (opts.beforeMiddlewares || []).forEach((m) => app.use(m));
61
+ if (opts.onBeforeMiddleware) {
62
+ opts.onBeforeMiddleware(app);
63
+ }
61
64
  const configs = Array.isArray(webpackConfig) ? webpackConfig : [webpackConfig];
62
65
  const progresses = [];
63
66
  if (opts.onProgress) {
64
67
  configs.forEach((config) => {
65
68
  const progress = {
66
69
  percent: 0,
67
- status: "waiting"
70
+ status: "waiting",
71
+ details: []
68
72
  };
69
73
  progresses.push(progress);
70
- config.plugins.push(new import_webpack.default.ProgressPlugin((percent, msg) => {
74
+ config.plugins.push(new import_webpack.default.ProgressPlugin((percent, msg, ...details) => {
71
75
  progress.percent = percent;
72
76
  progress.status = msg;
77
+ progress.details = details;
73
78
  opts.onProgress({ progresses });
74
79
  }));
75
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-canary.20221028.1",
3
+ "version": "4.0.0-canary.20221103.1",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -34,11 +34,11 @@
34
34
  "@svgr/plugin-jsx": "^6.2.1",
35
35
  "@svgr/plugin-svgo": "^6.2.0",
36
36
  "@types/hapi__joi": "17.1.8",
37
- "@umijs/babel-preset-umi": "4.0.0-canary.20221028.1",
38
- "@umijs/bundler-utils": "4.0.0-canary.20221028.1",
37
+ "@umijs/babel-preset-umi": "4.0.0-canary.20221103.1",
38
+ "@umijs/bundler-utils": "4.0.0-canary.20221103.1",
39
39
  "@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
40
- "@umijs/mfsu": "4.0.0-canary.20221028.1",
41
- "@umijs/utils": "4.0.0-canary.20221028.1",
40
+ "@umijs/mfsu": "4.0.0-canary.20221103.1",
41
+ "@umijs/utils": "4.0.0-canary.20221103.1",
42
42
  "cors": "^2.8.5",
43
43
  "css-loader": "6.7.1",
44
44
  "es5-imcompatible-versions": "^0.1.73",