@umijs/bundler-webpack 4.0.7 → 4.0.10

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.
Files changed (69) hide show
  1. package/{dist → client}/client/client.d.ts +0 -0
  2. package/client/client/client.js +295 -194
  3. package/client/constants.d.ts +15 -0
  4. package/client/constants.js +28 -19
  5. package/client/utils/formatWebpackMessages.d.ts +12 -0
  6. package/client/utils/formatWebpackMessages.js +68 -86
  7. package/dist/build.d.ts +1 -1
  8. package/dist/build.js +105 -68
  9. package/dist/cli.js +77 -69
  10. package/dist/config/_sampleFeature.js +33 -9
  11. package/dist/config/assetRules.js +45 -36
  12. package/dist/config/bundleAnalyzerPlugin.js +39 -17
  13. package/dist/config/compressPlugin.js +114 -95
  14. package/dist/config/config.d.ts +1 -0
  15. package/dist/config/config.js +204 -215
  16. package/dist/config/copyPlugin.js +59 -40
  17. package/dist/config/cssRules.js +136 -131
  18. package/dist/config/definePlugin.js +71 -35
  19. package/dist/config/detectDeadCode.js +120 -108
  20. package/dist/config/detectDeadCodePlugin.js +78 -63
  21. package/dist/config/fastRefreshPlugin.js +39 -20
  22. package/dist/config/forkTSCheckerPlugin.js +38 -19
  23. package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
  24. package/dist/config/ignorePlugin.js +38 -14
  25. package/dist/config/javaScriptRules.js +147 -173
  26. package/dist/config/manifestPlugin.js +51 -15
  27. package/dist/config/miniCSSExtractPlugin.js +42 -22
  28. package/dist/config/nodePolyfill.js +65 -26
  29. package/dist/config/nodePrefixPlugin.js +36 -12
  30. package/dist/config/progressPlugin.js +37 -13
  31. package/dist/config/purgecssWebpackPlugin.js +41 -19
  32. package/dist/config/speedMeasureWebpackPlugin.js +41 -20
  33. package/dist/config/ssrPlugin.js +83 -63
  34. package/dist/config/svgRules.js +74 -46
  35. package/dist/constants.js +57 -22
  36. package/dist/dev.d.ts +1 -1
  37. package/dist/dev.js +174 -134
  38. package/dist/index.js +22 -20
  39. package/dist/loader/svgr.js +73 -54
  40. package/dist/loader/swc.js +110 -69
  41. package/dist/parcelCSS.js +31 -27
  42. package/dist/plugins/ProgressPlugin.js +66 -43
  43. package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
  44. package/dist/plugins/_SamplePlugin.js +39 -14
  45. package/dist/requireHook.js +37 -27
  46. package/dist/schema.js +123 -96
  47. package/dist/server/server.d.ts +0 -1
  48. package/dist/server/server.js +214 -184
  49. package/dist/server/ws.d.ts +0 -2
  50. package/dist/server/ws.js +63 -38
  51. package/dist/swcPlugins/autoCSSModules.js +50 -31
  52. package/dist/swcPlugins/changeImportFromString.js +31 -9
  53. package/dist/swcPlugins/lockCoreJS.js +44 -20
  54. package/dist/types.d.ts +2 -1
  55. package/dist/types.js +61 -30
  56. package/dist/utils/browsersList.js +31 -8
  57. package/dist/utils/depMatch.js +63 -39
  58. package/dist/utils/formatWebpackMessages.js +93 -91
  59. package/dist/utils/getEsBuildTarget.d.ts +3 -1
  60. package/dist/utils/getEsBuildTarget.js +39 -11
  61. package/package.json +12 -16
  62. package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
  63. package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
  64. package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
  65. package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
  66. package/compiled/react-refresh/LICENSE +0 -21
  67. package/compiled/react-refresh/index.js +0 -21
  68. package/compiled/react-refresh/package.json +0 -1
  69. package/dist/client/client.js +0 -245
File without changes
@@ -1,230 +1,331 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import stripAnsi from '@umijs/utils/compiled/strip-ansi';
11
- // @ts-ignore
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
5
+ import stripAnsi from '@umijs/utils/compiled/strip-ansi'; // @ts-ignore
6
+
12
7
  import * as ErrorOverlay from 'react-error-overlay';
13
- import { MESSAGE_TYPE } from '../constants';
14
- import { formatWebpackMessages } from '../utils/formatWebpackMessages';
8
+ import { MESSAGE_TYPE } from "../constants";
9
+ import { formatWebpackMessages } from "../utils/formatWebpackMessages";
15
10
  console.log('[webpack] connecting...');
11
+
16
12
  function getHost() {
17
- if (process.env.SOCKET_SERVER) {
18
- return new URL(process.env.SOCKET_SERVER);
19
- }
20
- return location;
13
+ if (process.env.SOCKET_SERVER) {
14
+ return new URL(process.env.SOCKET_SERVER);
15
+ }
16
+
17
+ return location;
21
18
  }
19
+
22
20
  function getSocketUrl() {
23
- let h = getHost();
24
- const host = h.host;
25
- const isHttps = h.protocol === 'https:';
26
- return `${isHttps ? 'wss' : 'ws'}://${host}`;
21
+ var h = getHost();
22
+ var host = h.host;
23
+ var isHttps = h.protocol === 'https:';
24
+ return "".concat(isHttps ? 'wss' : 'ws', "://").concat(host);
27
25
  }
26
+
28
27
  function getPingUrl() {
29
- const h = getHost();
30
- return `${h.protocol}//${h.host}/__umi_ping`;
28
+ var h = getHost();
29
+ return "".concat(h.protocol, "//").concat(h.host, "/__umi_ping");
31
30
  }
32
- let pingTimer = null;
33
- let isFirstCompilation = true;
34
- let mostRecentCompilationHash = null;
35
- let hasCompileErrors = false;
36
- let hadRuntimeError = false;
37
- const pingUrl = getPingUrl();
38
- const socket = new WebSocket(getSocketUrl(), 'webpack-hmr');
39
- socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
40
- data = JSON.parse(data);
41
- if (data.type === 'connected') {
42
- console.log(`[webpack] connected.`);
43
- // proxy(nginx, docker) hmr ws maybe caused timeout,
44
- // so send ping package let ws keep alive.
45
- pingTimer = setInterval(() => socket.send('ping'), 30000);
46
- }
47
- else {
48
- handleMessage(data).catch(console.error);
49
- }
50
- }));
51
- function waitForSuccessfulPing(ms = 1000) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- // eslint-disable-next-line no-constant-condition
54
- while (true) {
55
- try {
56
- yield fetch(pingUrl);
57
- break;
31
+
32
+ var pingTimer = null;
33
+ var isFirstCompilation = true;
34
+ var mostRecentCompilationHash = null;
35
+ var hasCompileErrors = false;
36
+ var hadRuntimeError = false;
37
+ var pingUrl = getPingUrl();
38
+ var socket = new WebSocket(getSocketUrl(), 'webpack-hmr');
39
+ socket.addEventListener('message', /*#__PURE__*/function () {
40
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
41
+ var data;
42
+ return regeneratorRuntime.wrap(function _callee$(_context) {
43
+ while (1) {
44
+ switch (_context.prev = _context.next) {
45
+ case 0:
46
+ data = _ref.data;
47
+ data = JSON.parse(data);
48
+
49
+ if (data.type === 'connected') {
50
+ console.log("[webpack] connected."); // proxy(nginx, docker) hmr ws maybe caused timeout,
51
+ // so send ping package let ws keep alive.
52
+
53
+ pingTimer = setInterval(function () {
54
+ return socket.send('ping');
55
+ }, 30000);
56
+ } else {
57
+ handleMessage(data).catch(console.error);
58
58
  }
59
- catch (e) {
60
- yield new Promise((resolve) => setTimeout(resolve, ms));
59
+
60
+ case 3:
61
+ case "end":
62
+ return _context.stop();
63
+ }
64
+ }
65
+ }, _callee);
66
+ }));
67
+
68
+ return function (_x) {
69
+ return _ref2.apply(this, arguments);
70
+ };
71
+ }());
72
+
73
+ function waitForSuccessfulPing() {
74
+ return _waitForSuccessfulPing.apply(this, arguments);
75
+ }
76
+
77
+ function _waitForSuccessfulPing() {
78
+ _waitForSuccessfulPing = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
79
+ var ms,
80
+ _args3 = arguments;
81
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
82
+ while (1) {
83
+ switch (_context3.prev = _context3.next) {
84
+ case 0:
85
+ ms = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 1000;
86
+
87
+ case 1:
88
+ if (!true) {
89
+ _context3.next = 14;
90
+ break;
61
91
  }
92
+
93
+ _context3.prev = 2;
94
+ _context3.next = 5;
95
+ return fetch(pingUrl);
96
+
97
+ case 5:
98
+ return _context3.abrupt("break", 14);
99
+
100
+ case 8:
101
+ _context3.prev = 8;
102
+ _context3.t0 = _context3["catch"](2);
103
+ _context3.next = 12;
104
+ return new Promise(function (resolve) {
105
+ return setTimeout(resolve, ms);
106
+ });
107
+
108
+ case 12:
109
+ _context3.next = 1;
110
+ break;
111
+
112
+ case 14:
113
+ case "end":
114
+ return _context3.stop();
62
115
  }
63
- });
116
+ }
117
+ }, _callee3, null, [[2, 8]]);
118
+ }));
119
+ return _waitForSuccessfulPing.apply(this, arguments);
64
120
  }
65
- socket.addEventListener('close', () => __awaiter(void 0, void 0, void 0, function* () {
66
- if (pingTimer)
67
- clearInterval(pingTimer);
68
- console.info('[webpack] Dev server disconnected. Polling for restart...');
69
- yield waitForSuccessfulPing();
70
- location.reload();
71
- }));
121
+
122
+ socket.addEventListener('close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
123
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
124
+ while (1) {
125
+ switch (_context2.prev = _context2.next) {
126
+ case 0:
127
+ if (pingTimer) clearInterval(pingTimer);
128
+ console.info('[webpack] Dev server disconnected. Polling for restart...');
129
+ _context2.next = 4;
130
+ return waitForSuccessfulPing();
131
+
132
+ case 4:
133
+ location.reload();
134
+
135
+ case 5:
136
+ case "end":
137
+ return _context2.stop();
138
+ }
139
+ }
140
+ }, _callee2);
141
+ })));
72
142
  ErrorOverlay.startReportingRuntimeErrors({
73
- onError: function () {
74
- hadRuntimeError = true;
75
- },
76
- filename: '/static/js/bundle.js',
77
- });
78
- // @ts-ignore
143
+ onError: function onError() {
144
+ hadRuntimeError = true;
145
+ },
146
+ filename: '/static/js/bundle.js'
147
+ }); // @ts-ignore
148
+
79
149
  if (module.hot && typeof module.hot.dispose === 'function') {
80
- // @ts-ignore
81
- module.hot.dispose(function () {
82
- // TODO: why do we need this?
83
- ErrorOverlay.stopReportingRuntimeErrors();
84
- });
85
- }
86
- // There is a newer version of the code available.
150
+ // @ts-ignore
151
+ module.hot.dispose(function () {
152
+ // TODO: why do we need this?
153
+ ErrorOverlay.stopReportingRuntimeErrors();
154
+ });
155
+ } // There is a newer version of the code available.
156
+
157
+
87
158
  function handleAvailableHash(hash) {
88
- // Update last known compilation hash.
89
- mostRecentCompilationHash = hash;
159
+ // Update last known compilation hash.
160
+ mostRecentCompilationHash = hash;
90
161
  }
162
+
91
163
  function handleSuccess() {
92
- const isHotUpdate = !isFirstCompilation;
93
- isFirstCompilation = false;
94
- hasCompileErrors = false;
95
- // Attempt to apply hot updates or reload.
96
- if (isHotUpdate) {
97
- tryApplyUpdates(function onHotUpdateSuccess() {
98
- // Only dismiss it when we're sure it's a hot update.
99
- // Otherwise it would flicker right before the reload.
100
- tryDismissErrorOverlay();
101
- });
102
- }
164
+ var isHotUpdate = !isFirstCompilation;
165
+ isFirstCompilation = false;
166
+ hasCompileErrors = false; // Attempt to apply hot updates or reload.
167
+
168
+ if (isHotUpdate) {
169
+ tryApplyUpdates(function onHotUpdateSuccess() {
170
+ // Only dismiss it when we're sure it's a hot update.
171
+ // Otherwise it would flicker right before the reload.
172
+ tryDismissErrorOverlay();
173
+ });
174
+ }
103
175
  }
176
+
104
177
  function handleWarnings(warnings) {
105
- const isHotUpdate = !isFirstCompilation;
106
- isFirstCompilation = false;
107
- hasCompileErrors = false;
108
- const formatted = formatWebpackMessages({
109
- warnings,
110
- errors: [],
111
- });
112
- // print warnings
113
- if (typeof console !== 'undefined' && typeof console.warn === 'function') {
114
- for (let i = 0; i < formatted.warnings.length; i++) {
115
- if (i === 5) {
116
- console.warn('There were more warnings in other files.\n' +
117
- 'You can find a complete log in the terminal.');
118
- break;
119
- }
120
- console.warn(stripAnsi(formatted.warnings[i]));
121
- }
122
- }
123
- // Attempt to apply hot updates or reload.
124
- if (isHotUpdate) {
125
- tryApplyUpdates(function onSuccessfulHotUpdate() {
126
- // Only dismiss it when we're sure it's a hot update.
127
- // Otherwise it would flicker right before the reload.
128
- tryDismissErrorOverlay();
129
- });
178
+ var isHotUpdate = !isFirstCompilation;
179
+ isFirstCompilation = false;
180
+ hasCompileErrors = false;
181
+ var formatted = formatWebpackMessages({
182
+ warnings: warnings,
183
+ errors: []
184
+ }); // print warnings
185
+
186
+ if (typeof console !== 'undefined' && typeof console.warn === 'function') {
187
+ for (var i = 0; i < formatted.warnings.length; i++) {
188
+ if (i === 5) {
189
+ console.warn('There were more warnings in other files.\n' + 'You can find a complete log in the terminal.');
190
+ break;
191
+ }
192
+
193
+ console.warn(stripAnsi(formatted.warnings[i]));
130
194
  }
195
+ } // Attempt to apply hot updates or reload.
196
+
197
+
198
+ if (isHotUpdate) {
199
+ tryApplyUpdates(function onSuccessfulHotUpdate() {
200
+ // Only dismiss it when we're sure it's a hot update.
201
+ // Otherwise it would flicker right before the reload.
202
+ tryDismissErrorOverlay();
203
+ });
204
+ }
131
205
  }
206
+
132
207
  function handleErrors(errors) {
133
- isFirstCompilation = false;
134
- hasCompileErrors = true;
135
- const formatted = formatWebpackMessages({
136
- warnings: [],
137
- errors,
138
- });
139
- // Only show the first error.
140
- ErrorOverlay.reportBuildError(formatted.errors[0]);
141
- // Also log them to the console.
142
- if (typeof console !== 'undefined' && typeof console.error === 'function') {
143
- for (let i = 0; i < formatted.errors.length; i++) {
144
- console.error(stripAnsi(formatted.errors[i]));
145
- }
208
+ isFirstCompilation = false;
209
+ hasCompileErrors = true;
210
+ var formatted = formatWebpackMessages({
211
+ warnings: [],
212
+ errors: errors
213
+ }); // Only show the first error.
214
+
215
+ ErrorOverlay.reportBuildError(formatted.errors[0]); // Also log them to the console.
216
+
217
+ if (typeof console !== 'undefined' && typeof console.error === 'function') {
218
+ for (var i = 0; i < formatted.errors.length; i++) {
219
+ console.error(stripAnsi(formatted.errors[i]));
146
220
  }
221
+ }
147
222
  }
223
+
148
224
  function tryDismissErrorOverlay() {
149
- if (!hasCompileErrors) {
150
- ErrorOverlay.dismissBuildError();
151
- }
152
- }
153
- // Is there a newer version of this code available?
225
+ if (!hasCompileErrors) {
226
+ ErrorOverlay.dismissBuildError();
227
+ }
228
+ } // Is there a newer version of this code available?
229
+
230
+
154
231
  function isUpdateAvailable() {
155
- // @ts-ignore
156
- return mostRecentCompilationHash !== __webpack_hash__;
232
+ // @ts-ignore
233
+ return mostRecentCompilationHash !== __webpack_hash__;
157
234
  }
235
+
158
236
  function canApplyUpdates() {
159
- // @ts-ignore
160
- return module.hot.status() === 'idle';
237
+ // @ts-ignore
238
+ return module.hot.status() === 'idle';
161
239
  }
240
+
162
241
  function canAcceptErrors() {
163
- // NOTE: This var is injected by Webpack's DefinePlugin, and is a boolean instead of string.
164
- const hasReactRefresh = process.env.FAST_REFRESH;
165
- // @ts-ignore
166
- const status = module.hot.status();
167
- // React refresh can handle hot-reloading over errors.
168
- // However, when hot-reload status is abort or fail,
169
- // it indicates the current update cannot be applied safely,
170
- // and thus we should bail out to a forced reload for consistency.
171
- return hasReactRefresh && ['abort', 'fail'].indexOf(status) === -1;
242
+ // NOTE: This var is injected by Webpack's DefinePlugin, and is a boolean instead of string.
243
+ var hasReactRefresh = process.env.FAST_REFRESH; // @ts-ignore
244
+
245
+ var status = module.hot.status(); // React refresh can handle hot-reloading over errors.
246
+ // However, when hot-reload status is abort or fail,
247
+ // it indicates the current update cannot be applied safely,
248
+ // and thus we should bail out to a forced reload for consistency.
249
+
250
+ return hasReactRefresh && ['abort', 'fail'].indexOf(status) === -1;
172
251
  }
252
+
173
253
  function tryApplyUpdates(onHotUpdateSuccess) {
174
- // @ts-ignore
175
- if (!module.hot) {
176
- window.location.reload();
177
- return;
254
+ // @ts-ignore
255
+ if (!module.hot) {
256
+ window.location.reload();
257
+ return;
258
+ }
259
+
260
+ if (!isUpdateAvailable() || !canApplyUpdates()) {
261
+ return;
262
+ }
263
+
264
+ function handleApplyUpdates(err, updatedModules) {
265
+ var haveErrors = err || hadRuntimeError; // When there is no error but updatedModules is unavailable,
266
+ // it indicates a critical failure in hot-reloading,
267
+ // e.g. server is not ready to serve new bundle,
268
+ // and hence we need to do a forced reload.
269
+
270
+ var needsForcedReload = !err && !updatedModules;
271
+
272
+ if (haveErrors && !canAcceptErrors() || needsForcedReload) {
273
+ window.location.reload();
178
274
  }
179
- if (!isUpdateAvailable() || !canApplyUpdates()) {
180
- return;
275
+
276
+ if (onHotUpdateSuccess) onHotUpdateSuccess(); // While we were updating, there was a new update! Do it again.
277
+
278
+ if (isUpdateAvailable()) {
279
+ tryApplyUpdates();
181
280
  }
182
- function handleApplyUpdates(err, updatedModules) {
183
- const haveErrors = err || hadRuntimeError;
184
- // When there is no error but updatedModules is unavailable,
185
- // it indicates a critical failure in hot-reloading,
186
- // e.g. server is not ready to serve new bundle,
187
- // and hence we need to do a forced reload.
188
- const needsForcedReload = !err && !updatedModules;
189
- if ((haveErrors && !canAcceptErrors()) || needsForcedReload) {
190
- window.location.reload();
191
- }
192
- if (onHotUpdateSuccess)
193
- onHotUpdateSuccess();
194
- // While we were updating, there was a new update! Do it again.
195
- if (isUpdateAvailable()) {
196
- tryApplyUpdates();
197
- }
198
- }
199
- // @ts-ignore
200
- module.hot
201
- .check(/* autoApply */ true)
202
- .then((updatedModules) => {
203
- handleApplyUpdates(null, updatedModules);
204
- })
205
- .catch((err) => {
206
- handleApplyUpdates(err, null);
207
- });
281
+ } // @ts-ignore
282
+
283
+
284
+ module.hot.check(
285
+ /* autoApply */
286
+ true).then(function (updatedModules) {
287
+ handleApplyUpdates(null, updatedModules);
288
+ }).catch(function (err) {
289
+ handleApplyUpdates(err, null);
290
+ });
208
291
  }
209
- function handleMessage(payload) {
210
- return __awaiter(this, void 0, void 0, function* () {
211
- // console.log('[payload]', payload);
212
- switch (payload.type) {
213
- case MESSAGE_TYPE.hash:
214
- handleAvailableHash(payload.data);
215
- break;
216
- case MESSAGE_TYPE.stillOk:
217
- case MESSAGE_TYPE.ok:
218
- handleSuccess();
219
- break;
220
- case MESSAGE_TYPE.errors:
221
- handleErrors(payload.data);
222
- break;
223
- case MESSAGE_TYPE.warnings:
224
- handleWarnings(payload.data);
225
- break;
226
- default:
227
- // Do nothing
228
- }
229
- });
292
+
293
+ function handleMessage(_x2) {
294
+ return _handleMessage.apply(this, arguments);
230
295
  }
296
+
297
+ function _handleMessage() {
298
+ _handleMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(payload) {
299
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
300
+ while (1) {
301
+ switch (_context4.prev = _context4.next) {
302
+ case 0:
303
+ _context4.t0 = payload.type;
304
+ _context4.next = _context4.t0 === MESSAGE_TYPE.hash ? 3 : _context4.t0 === MESSAGE_TYPE.stillOk ? 5 : _context4.t0 === MESSAGE_TYPE.ok ? 5 : _context4.t0 === MESSAGE_TYPE.errors ? 7 : _context4.t0 === MESSAGE_TYPE.warnings ? 9 : 11;
305
+ break;
306
+
307
+ case 3:
308
+ handleAvailableHash(payload.data);
309
+ return _context4.abrupt("break", 11);
310
+
311
+ case 5:
312
+ handleSuccess();
313
+ return _context4.abrupt("break", 11);
314
+
315
+ case 7:
316
+ handleErrors(payload.data);
317
+ return _context4.abrupt("break", 11);
318
+
319
+ case 9:
320
+ handleWarnings(payload.data);
321
+ return _context4.abrupt("break", 11);
322
+
323
+ case 11:
324
+ case "end":
325
+ return _context4.stop();
326
+ }
327
+ }
328
+ }, _callee4);
329
+ }));
330
+ return _handleMessage.apply(this, arguments);
331
+ }
@@ -0,0 +1,15 @@
1
+ export declare const DEFAULT_DEVTOOL = "cheap-module-source-map";
2
+ export declare const DEFAULT_OUTPUT_PATH = "dist";
3
+ export declare const MFSU_NAME = "MFSU";
4
+ export declare enum MESSAGE_TYPE {
5
+ ok = "ok",
6
+ warnings = "warnings",
7
+ errors = "errors",
8
+ hash = "hash",
9
+ stillOk = "still-ok",
10
+ invalid = "invalid"
11
+ }
12
+ export declare const DEFAULT_BROWSER_TARGETS: {
13
+ chrome: number;
14
+ };
15
+ export declare const DEFAULT_ESBUILD_TARGET_KEYS: string[];
@@ -1,21 +1,30 @@
1
- export const DEFAULT_DEVTOOL = 'cheap-module-source-map';
2
- export const DEFAULT_OUTPUT_PATH = 'dist';
3
- export const MFSU_NAME = 'MFSU';
4
- export var MESSAGE_TYPE;
5
- (function (MESSAGE_TYPE) {
6
- MESSAGE_TYPE["ok"] = "ok";
7
- MESSAGE_TYPE["warnings"] = "warnings";
8
- MESSAGE_TYPE["errors"] = "errors";
9
- MESSAGE_TYPE["hash"] = "hash";
10
- MESSAGE_TYPE["stillOk"] = "still-ok";
11
- MESSAGE_TYPE["invalid"] = "invalid";
12
- })(MESSAGE_TYPE || (MESSAGE_TYPE = {}));
13
- export const DEFAULT_BROWSER_TARGETS = {
14
- chrome: 80,
1
+ // src/constants.ts
2
+ var DEFAULT_DEVTOOL = "cheap-module-source-map";
3
+ var DEFAULT_OUTPUT_PATH = "dist";
4
+ var MFSU_NAME = "MFSU";
5
+ var MESSAGE_TYPE = /* @__PURE__ */ ((MESSAGE_TYPE2) => {
6
+ MESSAGE_TYPE2["ok"] = "ok";
7
+ MESSAGE_TYPE2["warnings"] = "warnings";
8
+ MESSAGE_TYPE2["errors"] = "errors";
9
+ MESSAGE_TYPE2["hash"] = "hash";
10
+ MESSAGE_TYPE2["stillOk"] = "still-ok";
11
+ MESSAGE_TYPE2["invalid"] = "invalid";
12
+ return MESSAGE_TYPE2;
13
+ })(MESSAGE_TYPE || {});
14
+ var DEFAULT_BROWSER_TARGETS = {
15
+ chrome: 80
15
16
  };
16
- export const DEFAULT_ESBUILD_TARGET_KEYS = [
17
- 'chrome',
18
- 'firefox',
19
- 'edge',
20
- 'safari',
17
+ var DEFAULT_ESBUILD_TARGET_KEYS = [
18
+ "chrome",
19
+ "firefox",
20
+ "edge",
21
+ "safari"
21
22
  ];
23
+ export {
24
+ DEFAULT_BROWSER_TARGETS,
25
+ DEFAULT_DEVTOOL,
26
+ DEFAULT_ESBUILD_TARGET_KEYS,
27
+ DEFAULT_OUTPUT_PATH,
28
+ MESSAGE_TYPE,
29
+ MFSU_NAME
30
+ };
@@ -0,0 +1,12 @@
1
+ export declare function formatMessage(message: string | {
2
+ message: string;
3
+ } | {
4
+ message: string;
5
+ }[]): string;
6
+ export declare function formatWebpackMessages(json: {
7
+ errors: string[];
8
+ warnings: string[];
9
+ }): {
10
+ errors: string[];
11
+ warnings: string[];
12
+ };