@umijs/bundler-webpack 4.0.6 → 4.0.9
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 → client}/client/client.d.ts +0 -0
- package/client/client/client.js +295 -194
- package/client/constants.d.ts +15 -0
- package/client/constants.js +28 -19
- package/client/utils/formatWebpackMessages.d.ts +12 -0
- package/client/utils/formatWebpackMessages.js +68 -86
- package/dist/build.d.ts +1 -1
- package/dist/build.js +105 -61
- package/dist/cli.js +77 -69
- package/dist/config/_sampleFeature.js +33 -9
- package/dist/config/assetRules.js +45 -36
- package/dist/config/bundleAnalyzerPlugin.js +39 -17
- package/dist/config/compressPlugin.js +113 -95
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +204 -215
- package/dist/config/copyPlugin.js +59 -40
- package/dist/config/cssRules.js +136 -131
- package/dist/config/definePlugin.d.ts +1 -0
- package/dist/config/definePlugin.js +71 -31
- package/dist/config/detectDeadCode.js +120 -108
- package/dist/config/detectDeadCodePlugin.js +78 -63
- package/dist/config/fastRefreshPlugin.js +39 -20
- package/dist/config/forkTSCheckerPlugin.js +38 -19
- package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
- package/dist/config/ignorePlugin.js +38 -14
- package/dist/config/javaScriptRules.js +147 -173
- package/dist/config/manifestPlugin.js +51 -15
- package/dist/config/miniCSSExtractPlugin.js +42 -22
- package/dist/config/nodePolyfill.js +65 -26
- package/dist/config/nodePrefixPlugin.js +36 -12
- package/dist/config/progressPlugin.js +37 -13
- package/dist/config/purgecssWebpackPlugin.js +41 -19
- package/dist/config/speedMeasureWebpackPlugin.js +41 -20
- package/dist/config/ssrPlugin.js +83 -63
- package/dist/config/svgRules.js +74 -46
- package/dist/constants.js +57 -22
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +170 -129
- package/dist/index.js +22 -20
- package/dist/loader/svgr.js +73 -54
- package/dist/loader/swc.js +110 -69
- package/dist/parcelCSS.js +31 -27
- package/dist/plugins/ProgressPlugin.js +66 -43
- package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
- package/dist/plugins/_SamplePlugin.js +39 -14
- package/dist/requireHook.js +37 -27
- package/dist/schema.js +120 -95
- package/dist/server/server.d.ts +0 -1
- package/dist/server/server.js +214 -184
- package/dist/server/ws.d.ts +0 -2
- package/dist/server/ws.js +63 -38
- package/dist/swcPlugins/autoCSSModules.js +50 -31
- package/dist/swcPlugins/changeImportFromString.js +31 -9
- package/dist/swcPlugins/lockCoreJS.js +44 -20
- package/dist/types.d.ts +2 -1
- package/dist/types.js +61 -30
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.js +63 -39
- package/dist/utils/formatWebpackMessages.js +93 -91
- package/dist/utils/getEsBuildTarget.js +32 -10
- package/package.json +12 -16
- package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
- package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
- package/compiled/react-refresh/LICENSE +0 -21
- package/compiled/react-refresh/index.js +0 -21
- package/compiled/react-refresh/package.json +0 -1
- package/dist/client/client.js +0 -245
|
File without changes
|
package/client/client/client.js
CHANGED
|
@@ -1,230 +1,331 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
14
|
-
import { formatWebpackMessages } from
|
|
8
|
+
import { MESSAGE_TYPE } from "../constants";
|
|
9
|
+
import { formatWebpackMessages } from "../utils/formatWebpackMessages";
|
|
15
10
|
console.log('[webpack] connecting...');
|
|
11
|
+
|
|
16
12
|
function getHost() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
30
|
-
|
|
28
|
+
var h = getHost();
|
|
29
|
+
return "".concat(h.protocol, "//").concat(h.host, "/__umi_ping");
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
socket
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
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
|
-
|
|
89
|
-
|
|
159
|
+
// Update last known compilation hash.
|
|
160
|
+
mostRecentCompilationHash = hash;
|
|
90
161
|
}
|
|
162
|
+
|
|
91
163
|
function handleSuccess() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
225
|
+
if (!hasCompileErrors) {
|
|
226
|
+
ErrorOverlay.dismissBuildError();
|
|
227
|
+
}
|
|
228
|
+
} // Is there a newer version of this code available?
|
|
229
|
+
|
|
230
|
+
|
|
154
231
|
function isUpdateAvailable() {
|
|
155
|
-
|
|
156
|
-
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
return mostRecentCompilationHash !== __webpack_hash__;
|
|
157
234
|
}
|
|
235
|
+
|
|
158
236
|
function canApplyUpdates() {
|
|
159
|
-
|
|
160
|
-
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
return module.hot.status() === 'idle';
|
|
161
239
|
}
|
|
240
|
+
|
|
162
241
|
function canAcceptErrors() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
180
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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[];
|
package/client/constants.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// 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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
};
|