@umijs/bundler-webpack 4.0.8 → 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/client/client/client.js +311 -190
- package/dist/config/copyPlugin.js +3 -2
- package/dist/config/javaScriptRules.js +1 -0
- package/dist/schema.js +1 -0
- package/dist/types.d.ts +2 -1
- package/package.json +10 -12
- package/compiled/react-refresh/LICENSE +0 -21
- package/compiled/react-refresh/index.js +0 -21
- package/compiled/react-refresh/package.json +0 -1
package/client/client/client.js
CHANGED
|
@@ -1,210 +1,331 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
var __async = (__this, __arguments, generator) => {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
var fulfilled = (value) => {
|
|
8
|
-
try {
|
|
9
|
-
step(generator.next(value));
|
|
10
|
-
} catch (e) {
|
|
11
|
-
reject(e);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var rejected = (value) => {
|
|
15
|
-
try {
|
|
16
|
-
step(generator.throw(value));
|
|
17
|
-
} catch (e) {
|
|
18
|
-
reject(e);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
22
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
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); }); }; }
|
|
25
4
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
import * as ErrorOverlay from
|
|
5
|
+
import stripAnsi from '@umijs/utils/compiled/strip-ansi'; // @ts-ignore
|
|
6
|
+
|
|
7
|
+
import * as ErrorOverlay from 'react-error-overlay';
|
|
29
8
|
import { MESSAGE_TYPE } from "../constants";
|
|
30
9
|
import { formatWebpackMessages } from "../utils/formatWebpackMessages";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
10
|
+
console.log('[webpack] connecting...');
|
|
11
|
+
|
|
12
|
+
function getHost() {
|
|
13
|
+
if (process.env.SOCKET_SERVER) {
|
|
14
|
+
return new URL(process.env.SOCKET_SERVER);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return location;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getSocketUrl() {
|
|
21
|
+
var h = getHost();
|
|
22
|
+
var host = h.host;
|
|
23
|
+
var isHttps = h.protocol === 'https:';
|
|
24
|
+
return "".concat(isHttps ? 'wss' : 'ws', "://").concat(host);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getPingUrl() {
|
|
28
|
+
var h = getHost();
|
|
29
|
+
return "".concat(h.protocol, "//").concat(h.host, "/__umi_ping");
|
|
30
|
+
}
|
|
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
|
+
}
|
|
59
|
+
|
|
60
|
+
case 3:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
75
63
|
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
socket.addEventListener("close", () => __async(exports, null, function* () {
|
|
79
|
-
if (pingTimer)
|
|
80
|
-
clearInterval(pingTimer);
|
|
81
|
-
console.info("[webpack] Dev server disconnected. Polling for restart...");
|
|
82
|
-
yield waitForSuccessfulPing();
|
|
83
|
-
location.reload();
|
|
84
|
-
}));
|
|
85
|
-
ErrorOverlay.startReportingRuntimeErrors({
|
|
86
|
-
onError: function() {
|
|
87
|
-
hadRuntimeError = true;
|
|
88
|
-
},
|
|
89
|
-
filename: "/static/js/bundle.js"
|
|
90
|
-
});
|
|
91
|
-
if (module.hot && typeof module.hot.dispose === "function") {
|
|
92
|
-
module.hot.dispose(function() {
|
|
93
|
-
ErrorOverlay.stopReportingRuntimeErrors();
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function handleAvailableHash(hash) {
|
|
97
|
-
mostRecentCompilationHash = hash;
|
|
98
|
-
}
|
|
99
|
-
function handleSuccess() {
|
|
100
|
-
const isHotUpdate = !isFirstCompilation;
|
|
101
|
-
isFirstCompilation = false;
|
|
102
|
-
hasCompileErrors = false;
|
|
103
|
-
if (isHotUpdate) {
|
|
104
|
-
tryApplyUpdates(function onHotUpdateSuccess() {
|
|
105
|
-
tryDismissErrorOverlay();
|
|
106
|
-
});
|
|
107
64
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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;
|
|
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;
|
|
121
110
|
break;
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
|
|
112
|
+
case 14:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context3.stop();
|
|
124
115
|
}
|
|
125
116
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
}, _callee3, null, [[2, 8]]);
|
|
118
|
+
}));
|
|
119
|
+
return _waitForSuccessfulPing.apply(this, arguments);
|
|
120
|
+
}
|
|
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();
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
}, _callee2);
|
|
141
|
+
})));
|
|
142
|
+
ErrorOverlay.startReportingRuntimeErrors({
|
|
143
|
+
onError: function onError() {
|
|
144
|
+
hadRuntimeError = true;
|
|
145
|
+
},
|
|
146
|
+
filename: '/static/js/bundle.js'
|
|
147
|
+
}); // @ts-ignore
|
|
148
|
+
|
|
149
|
+
if (module.hot && typeof module.hot.dispose === 'function') {
|
|
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
|
+
|
|
158
|
+
function handleAvailableHash(hash) {
|
|
159
|
+
// Update last known compilation hash.
|
|
160
|
+
mostRecentCompilationHash = hash;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function handleSuccess() {
|
|
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
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function handleWarnings(warnings) {
|
|
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;
|
|
149
191
|
}
|
|
192
|
+
|
|
193
|
+
console.warn(stripAnsi(formatted.warnings[i]));
|
|
150
194
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function handleErrors(errors) {
|
|
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]));
|
|
156
220
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function tryDismissErrorOverlay() {
|
|
225
|
+
if (!hasCompileErrors) {
|
|
226
|
+
ErrorOverlay.dismissBuildError();
|
|
227
|
+
}
|
|
228
|
+
} // Is there a newer version of this code available?
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
function isUpdateAvailable() {
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
return mostRecentCompilationHash !== __webpack_hash__;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function canApplyUpdates() {
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
return module.hot.status() === 'idle';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function canAcceptErrors() {
|
|
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;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function tryApplyUpdates(onHotUpdateSuccess) {
|
|
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();
|
|
161
274
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
function handleApplyUpdates(err, updatedModules) {
|
|
171
|
-
const haveErrors = err || hadRuntimeError;
|
|
172
|
-
const needsForcedReload = !err && !updatedModules;
|
|
173
|
-
if (haveErrors && !canAcceptErrors() || needsForcedReload) {
|
|
174
|
-
window.location.reload();
|
|
175
|
-
}
|
|
176
|
-
if (onHotUpdateSuccess)
|
|
177
|
-
onHotUpdateSuccess();
|
|
178
|
-
if (isUpdateAvailable()) {
|
|
179
|
-
tryApplyUpdates();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
module.hot.check(true).then((updatedModules) => {
|
|
183
|
-
handleApplyUpdates(null, updatedModules);
|
|
184
|
-
}).catch((err) => {
|
|
185
|
-
handleApplyUpdates(err, null);
|
|
186
|
-
});
|
|
275
|
+
|
|
276
|
+
if (onHotUpdateSuccess) onHotUpdateSuccess(); // While we were updating, there was a new update! Do it again.
|
|
277
|
+
|
|
278
|
+
if (isUpdateAvailable()) {
|
|
279
|
+
tryApplyUpdates();
|
|
187
280
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function handleMessage(_x2) {
|
|
294
|
+
return _handleMessage.apply(this, arguments);
|
|
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;
|
|
193
305
|
break;
|
|
194
|
-
|
|
195
|
-
case
|
|
306
|
+
|
|
307
|
+
case 3:
|
|
308
|
+
handleAvailableHash(payload.data);
|
|
309
|
+
return _context4.abrupt("break", 11);
|
|
310
|
+
|
|
311
|
+
case 5:
|
|
196
312
|
handleSuccess();
|
|
197
|
-
break;
|
|
198
|
-
|
|
313
|
+
return _context4.abrupt("break", 11);
|
|
314
|
+
|
|
315
|
+
case 7:
|
|
199
316
|
handleErrors(payload.data);
|
|
200
|
-
break;
|
|
201
|
-
|
|
317
|
+
return _context4.abrupt("break", 11);
|
|
318
|
+
|
|
319
|
+
case 9:
|
|
202
320
|
handleWarnings(payload.data);
|
|
203
|
-
break;
|
|
204
|
-
|
|
321
|
+
return _context4.abrupt("break", 11);
|
|
322
|
+
|
|
323
|
+
case 11:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context4.stop();
|
|
205
326
|
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
327
|
+
}
|
|
328
|
+
}, _callee4);
|
|
329
|
+
}));
|
|
330
|
+
return _handleMessage.apply(this, arguments);
|
|
331
|
+
}
|
|
@@ -27,9 +27,10 @@ var import_path = require("path");
|
|
|
27
27
|
async function addCopyPlugin(opts) {
|
|
28
28
|
var _a;
|
|
29
29
|
const { config, userConfig, cwd } = opts;
|
|
30
|
+
const publicDir = (0, import_path.join)(cwd, "public");
|
|
30
31
|
const copyPatterns = [
|
|
31
|
-
(0, import_fs.existsSync)((0,
|
|
32
|
-
from:
|
|
32
|
+
(0, import_fs.existsSync)(publicDir) && (0, import_fs.readdirSync)(publicDir).length && {
|
|
33
|
+
from: publicDir,
|
|
33
34
|
info: { minimized: true }
|
|
34
35
|
},
|
|
35
36
|
...userConfig.copy ? (_a = userConfig.copy) == null ? void 0 : _a.map((pattern) => {
|
package/dist/schema.js
CHANGED
|
@@ -56,6 +56,7 @@ function getSchemas() {
|
|
|
56
56
|
alias: (Joi) => Joi.object(),
|
|
57
57
|
autoCSSModules: (Joi) => Joi.boolean(),
|
|
58
58
|
autoprefixer: (Joi) => Joi.object(),
|
|
59
|
+
babelLoaderCustomize: (Joi) => Joi.string(),
|
|
59
60
|
cacheDirectoryPath: (Joi) => Joi.string(),
|
|
60
61
|
chainWebpack: (Joi) => Joi.function(),
|
|
61
62
|
copy: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.object({
|
package/dist/types.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface IConfig {
|
|
|
75
75
|
extraPostCSSPlugins?: any[];
|
|
76
76
|
hash?: boolean;
|
|
77
77
|
ignoreMomentLocale?: boolean;
|
|
78
|
-
jsMinifier?: JSMinifier
|
|
78
|
+
jsMinifier?: `${JSMinifier}`;
|
|
79
79
|
jsMinifierOptions?: {
|
|
80
80
|
[key: string]: any;
|
|
81
81
|
};
|
|
@@ -110,6 +110,7 @@ export interface IConfig {
|
|
|
110
110
|
[key: string]: any;
|
|
111
111
|
};
|
|
112
112
|
writeToDisk?: boolean;
|
|
113
|
+
babelLoaderCustomize?: string;
|
|
113
114
|
[key: string]: any;
|
|
114
115
|
}
|
|
115
116
|
export interface SwcOptions extends SwcConfig {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
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",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "
|
|
24
|
+
"build": "umi-scripts father build",
|
|
25
25
|
"build:deps": "umi-scripts bundleDeps",
|
|
26
|
-
"dev": "
|
|
26
|
+
"dev": "umi-scripts father dev",
|
|
27
27
|
"generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs",
|
|
28
28
|
"test": "umi-scripts jest-turbo"
|
|
29
29
|
},
|
|
@@ -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.
|
|
38
|
-
"@umijs/bundler-utils": "4.0.
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.9",
|
|
38
|
+
"@umijs/bundler-utils": "4.0.9",
|
|
39
39
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
40
|
-
"@umijs/mfsu": "4.0.
|
|
41
|
-
"@umijs/utils": "4.0.
|
|
40
|
+
"@umijs/mfsu": "4.0.9",
|
|
41
|
+
"@umijs/utils": "4.0.9",
|
|
42
42
|
"cors": "^2.8.5",
|
|
43
43
|
"css-loader": "6.7.1",
|
|
44
44
|
"es5-imcompatible-versions": "^0.1.73",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"node-libs-browser": "2.2.1",
|
|
48
48
|
"postcss": "^8.4.13",
|
|
49
49
|
"postcss-preset-env": "7.5.0",
|
|
50
|
-
"react-error-overlay": "6.0.9"
|
|
50
|
+
"react-error-overlay": "6.0.9",
|
|
51
|
+
"react-refresh": "0.14.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@swc/core": "1.2.165",
|
|
@@ -67,7 +68,6 @@
|
|
|
67
68
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
68
69
|
"postcss-loader": "6.2.1",
|
|
69
70
|
"purgecss-webpack-plugin": "4.1.3",
|
|
70
|
-
"react-refresh": "0.12.0",
|
|
71
71
|
"sass-loader": "12.6.0",
|
|
72
72
|
"schema-utils": "4.0.0",
|
|
73
73
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
@@ -120,8 +120,7 @@
|
|
|
120
120
|
"webpack-manifest-plugin",
|
|
121
121
|
"webpack-sources",
|
|
122
122
|
"ws",
|
|
123
|
-
"./bundles/webpack/bundle"
|
|
124
|
-
"./bundles/react-refresh/babel"
|
|
123
|
+
"./bundles/webpack/bundle"
|
|
125
124
|
],
|
|
126
125
|
"externals": {
|
|
127
126
|
"@swc/core": "@swc/core",
|
|
@@ -173,7 +172,6 @@
|
|
|
173
172
|
"postcss-flexbugs-fixes",
|
|
174
173
|
"postcss-loader",
|
|
175
174
|
"purgecss-webpack-plugin",
|
|
176
|
-
"react-refresh",
|
|
177
175
|
"sass-loader",
|
|
178
176
|
"speed-measure-webpack-plugin",
|
|
179
177
|
"style-loader",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
(function(){"use strict";var e={653:function(e,t){
|
|
2
|
-
/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-refresh-runtime.development.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/
|
|
11
|
-
if(process.env.NODE_ENV!=="production"){(function(){"use strict";var e=Symbol.for("react.forward_ref");var r=Symbol.for("react.memo");var n=typeof WeakMap==="function"?WeakMap:Map;var o=new Map;var i=new n;var a=new n;var u=new n;var f=[];var s=new Map;var c=new Map;var l=new Set;var d=new Set;var p=typeof WeakMap==="function"?new WeakMap:null;var y=false;function computeFullKey(e){if(e.fullKey!==null){return e.fullKey}var t=e.ownKey;var r;try{r=e.getCustomHooks()}catch(r){e.forceReset=true;e.fullKey=t;return t}for(var n=0;n<r.length;n++){var o=r[n];if(typeof o!=="function"){e.forceReset=true;e.fullKey=t;return t}var i=a.get(o);if(i===undefined){continue}var u=computeFullKey(i);if(i.forceReset){e.forceReset=true}t+="\n---\n"+u}e.fullKey=t;return t}function haveEqualSignatures(e,t){var r=a.get(e);var n=a.get(t);if(r===undefined&&n===undefined){return true}if(r===undefined||n===undefined){return false}if(computeFullKey(r)!==computeFullKey(n)){return false}if(n.forceReset){return false}return true}function isReactClass(e){return e.prototype&&e.prototype.isReactComponent}function canPreserveStateBetween(e,t){if(isReactClass(e)||isReactClass(t)){return false}if(haveEqualSignatures(e,t)){return true}return false}function resolveFamily(e){return u.get(e)}function cloneMap(e){var t=new Map;e.forEach((function(e,r){t.set(r,e)}));return t}function cloneSet(e){var t=new Set;e.forEach((function(e){t.add(e)}));return t}function getProperty(e,t){try{return e[t]}catch(e){return undefined}}function performReactRefresh(){if(f.length===0){return null}if(y){return null}y=true;try{var e=new Set;var t=new Set;var r=f;f=[];r.forEach((function(r){var n=r[0],o=r[1];var i=n.current;u.set(i,n);u.set(o,n);n.current=o;if(canPreserveStateBetween(i,o)){t.add(n)}else{e.add(n)}}));var n={updatedFamilies:t,staleFamilies:e};s.forEach((function(e){e.setRefreshHandler(resolveFamily)}));var o=false;var i=null;var a=cloneSet(d);var h=cloneSet(l);var v=cloneMap(c);a.forEach((function(e){var t=v.get(e);if(t===undefined){throw new Error("Could not find helpers for a root. This is a bug in React Refresh.")}if(!d.has(e)){}if(p===null){return}if(!p.has(e)){return}var r=p.get(e);try{t.scheduleRoot(e,r)}catch(e){if(!o){o=true;i=e}}}));h.forEach((function(e){var t=v.get(e);if(t===undefined){throw new Error("Could not find helpers for a root. This is a bug in React Refresh.")}if(!l.has(e)){}try{t.scheduleRefresh(e,n)}catch(e){if(!o){o=true;i=e}}}));if(o){throw i}return n}finally{y=false}}function register(t,n){{if(t===null){return}if(typeof t!=="function"&&typeof t!=="object"){return}if(i.has(t)){return}var a=o.get(n);if(a===undefined){a={current:t};o.set(n,a)}else{f.push([a,t])}i.set(t,a);if(typeof t==="object"&&t!==null){switch(getProperty(t,"$$typeof")){case e:register(t.render,n+"$render");break;case r:register(t.type,n+"$type");break}}}}function setSignature(t,n){var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var i=arguments.length>3?arguments[3]:undefined;{if(!a.has(t)){a.set(t,{forceReset:o,ownKey:n,fullKey:null,getCustomHooks:i||function(){return[]}})}if(typeof t==="object"&&t!==null){switch(getProperty(t,"$$typeof")){case e:setSignature(t.render,n,o,i);break;case r:setSignature(t.type,n,o,i);break}}}}function collectCustomHooksForSignature(e){{var t=a.get(e);if(t!==undefined){computeFullKey(t)}}}function getFamilyByID(e){{return o.get(e)}}function getFamilyByType(e){{return i.get(e)}}function findAffectedHostInstances(e){{var t=new Set;l.forEach((function(r){var n=c.get(r);if(n===undefined){throw new Error("Could not find helpers for a root. This is a bug in React Refresh.")}var o=n.findHostInstancesForRefresh(r,e);o.forEach((function(e){t.add(e)}))}));return t}}function injectIntoGlobalHook(e){{var t=e.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t===undefined){var r=0;e.__REACT_DEVTOOLS_GLOBAL_HOOK__=t={renderers:new Map,supportsFiber:true,inject:function(e){return r++},onScheduleFiberRoot:function(e,t,r){},onCommitFiberRoot:function(e,t,r,n){},onCommitFiberUnmount:function(){}}}if(t.isDisabled){console["warn"]("Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). "+"Fast Refresh is not compatible with this shim and will be disabled.");return}var n=t.inject;t.inject=function(e){var t=n.apply(this,arguments);if(typeof e.scheduleRefresh==="function"&&typeof e.setRefreshHandler==="function"){s.set(t,e)}return t};t.renderers.forEach((function(e,t){if(typeof e.scheduleRefresh==="function"&&typeof e.setRefreshHandler==="function"){s.set(t,e)}}));var o=t.onCommitFiberRoot;var i=t.onScheduleFiberRoot||function(){};t.onScheduleFiberRoot=function(e,t,r){if(!y){d.delete(t);if(p!==null){p.set(t,r)}}return i.apply(this,arguments)};t.onCommitFiberRoot=function(e,t,r,n){var i=s.get(e);if(i!==undefined){c.set(t,i);var a=t.current;var u=a.alternate;if(u!==null){var f=u.memoizedState!=null&&u.memoizedState.element!=null&&l.has(t);var p=a.memoizedState!=null&&a.memoizedState.element!=null;if(!f&&p){l.add(t);d.delete(t)}else if(f&&p);else if(f&&!p){l.delete(t);if(n){d.add(t)}else{c.delete(t)}}else if(!f&&!p){if(n){d.add(t)}}}else{l.add(t)}}return o.apply(this,arguments)}}}function hasUnrecoverableErrors(){return false}function _getMountedRootCount(){{return l.size}}function createSignatureFunctionForTransform(){{var e;var t;var r=false;return function(n,o,i,a){if(typeof o==="string"){if(!e){e=n;t=typeof a==="function"}if(n!=null&&(typeof n==="function"||typeof n==="object")){setSignature(n,o,i,a)}return n}else{if(!r&&t){r=true;collectCustomHooksForSignature(e)}}}}}function isLikelyComponentType(t){{switch(typeof t){case"function":{if(t.prototype!=null){if(t.prototype.isReactComponent){return true}var n=Object.getOwnPropertyNames(t.prototype);if(n.length>1||n[0]!=="constructor"){return false}if(t.prototype.__proto__!==Object.prototype){return false}}var o=t.name||t.displayName;return typeof o==="string"&&/^[A-Z]/.test(o)}case"object":{if(t!=null){switch(getProperty(t,"$$typeof")){case e:case r:return true;default:return false}}return false}default:{return false}}}}t._getMountedRootCount=_getMountedRootCount;t.collectCustomHooksForSignature=collectCustomHooksForSignature;t.createSignatureFunctionForTransform=createSignatureFunctionForTransform;t.findAffectedHostInstances=findAffectedHostInstances;t.getFamilyByID=getFamilyByID;t.getFamilyByType=getFamilyByType;t.hasUnrecoverableErrors=hasUnrecoverableErrors;t.injectIntoGlobalHook=injectIntoGlobalHook;t.isLikelyComponentType=isLikelyComponentType;t.performReactRefresh=performReactRefresh;t.register=register;t.setSignature=setSignature})()}},665:function(){
|
|
12
|
-
/**
|
|
13
|
-
* @license React
|
|
14
|
-
* react-refresh-runtime.production.min.js
|
|
15
|
-
*
|
|
16
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/
|
|
21
|
-
throw Error("React Refresh runtime should not be included in the production bundle.")},999:function(e,t,r){if(process.env.NODE_ENV==="production"){e.exports=r(665)}else{e.exports=r(653)}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var i=true;try{e[r](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(999);module.exports=r})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"react-refresh","license":"MIT"}
|