@umijs/bundler-webpack 4.0.8 → 4.0.11
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/client/constants.js +1 -1
- package/client/utils/formatWebpackMessages.js +1 -1
- package/dist/build.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/config/_sampleFeature.js +1 -1
- package/dist/config/assetRules.js +1 -1
- package/dist/config/bundleAnalyzerPlugin.js +1 -1
- package/dist/config/compressPlugin.js +3 -2
- package/dist/config/config.js +1 -1
- package/dist/config/copyPlugin.js +4 -3
- package/dist/config/cssRules.js +1 -1
- package/dist/config/definePlugin.js +1 -1
- package/dist/config/detectDeadCode.js +1 -1
- package/dist/config/detectDeadCodePlugin.js +1 -1
- package/dist/config/fastRefreshPlugin.js +1 -1
- package/dist/config/forkTSCheckerPlugin.js +1 -1
- package/dist/config/harmonyLinkingErrorPlugin.js +1 -1
- package/dist/config/ignorePlugin.js +1 -1
- package/dist/config/javaScriptRules.js +2 -1
- package/dist/config/manifestPlugin.js +1 -1
- package/dist/config/miniCSSExtractPlugin.js +1 -1
- package/dist/config/nodePolyfill.js +1 -1
- package/dist/config/nodePrefixPlugin.js +1 -1
- package/dist/config/progressPlugin.js +1 -1
- package/dist/config/purgecssWebpackPlugin.js +1 -1
- package/dist/config/speedMeasureWebpackPlugin.js +1 -1
- package/dist/config/ssrPlugin.js +1 -1
- package/dist/config/svgRules.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/dev.js +15 -7
- package/dist/index.js +1 -1
- package/dist/loader/svgr.js +1 -1
- package/dist/loader/swc.js +1 -1
- package/dist/parcelCSS.js +1 -1
- package/dist/plugins/ProgressPlugin.js +1 -1
- package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
- package/dist/plugins/_SamplePlugin.js +1 -1
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +5 -1
- package/dist/server/server.js +8 -1
- package/dist/server/ws.js +1 -1
- package/dist/swcPlugins/autoCSSModules.js +1 -1
- package/dist/swcPlugins/changeImportFromString.js +1 -1
- package/dist/swcPlugins/lockCoreJS.js +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -1
- package/dist/utils/browsersList.js +1 -1
- package/dist/utils/depMatch.js +1 -1
- package/dist/utils/formatWebpackMessages.js +1 -1
- package/dist/utils/getEsBuildTarget.d.ts +3 -1
- package/dist/utils/getEsBuildTarget.js +8 -2
- 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
|
+
}
|
package/client/constants.js
CHANGED
package/dist/build.js
CHANGED
|
@@ -36,7 +36,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
36
36
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
38
|
|
|
39
|
-
// build.ts
|
|
39
|
+
// src/build.ts
|
|
40
40
|
var build_exports = {};
|
|
41
41
|
__export(build_exports, {
|
|
42
42
|
build: () => build
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
14
|
};
|
|
15
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
16
16
|
|
|
17
|
-
// cli.ts
|
|
17
|
+
// src/cli.ts
|
|
18
18
|
var import_esbuild = __toESM(require("@umijs/bundler-utils/compiled/esbuild"));
|
|
19
19
|
var import_utils = require("@umijs/utils");
|
|
20
20
|
var import_assert = __toESM(require("assert"));
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// _sampleFeature.ts
|
|
19
|
+
// src/config/_sampleFeature.ts
|
|
20
20
|
var sampleFeature_exports = {};
|
|
21
21
|
__export(sampleFeature_exports, {
|
|
22
22
|
addSampleFeature: () => addSampleFeature
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// assetRules.ts
|
|
19
|
+
// src/config/assetRules.ts
|
|
20
20
|
var assetRules_exports = {};
|
|
21
21
|
__export(assetRules_exports, {
|
|
22
22
|
addAssetRules: () => addAssetRules
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// bundleAnalyzerPlugin.ts
|
|
19
|
+
// src/config/bundleAnalyzerPlugin.ts
|
|
20
20
|
var bundleAnalyzerPlugin_exports = {};
|
|
21
21
|
__export(bundleAnalyzerPlugin_exports, {
|
|
22
22
|
addBundleAnalyzerPlugin: () => addBundleAnalyzerPlugin
|
|
@@ -33,7 +33,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// compressPlugin.ts
|
|
36
|
+
// src/config/compressPlugin.ts
|
|
37
37
|
var compressPlugin_exports = {};
|
|
38
38
|
__export(compressPlugin_exports, {
|
|
39
39
|
addCompressPlugin: () => addCompressPlugin
|
|
@@ -53,7 +53,8 @@ async function addCompressPlugin(opts) {
|
|
|
53
53
|
}
|
|
54
54
|
config.optimization.minimize(true);
|
|
55
55
|
const esbuildTarget = (0, import_getEsBuildTarget.getEsBuildTarget)({
|
|
56
|
-
targets: userConfig.targets || {}
|
|
56
|
+
targets: userConfig.targets || {},
|
|
57
|
+
jsMinifier
|
|
57
58
|
});
|
|
58
59
|
let minify;
|
|
59
60
|
let terserOptions;
|
package/dist/config/config.js
CHANGED
|
@@ -33,7 +33,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// config.ts
|
|
36
|
+
// src/config/config.ts
|
|
37
37
|
var config_exports = {};
|
|
38
38
|
__export(config_exports, {
|
|
39
39
|
getConfig: () => getConfig
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// copyPlugin.ts
|
|
19
|
+
// src/config/copyPlugin.ts
|
|
20
20
|
var copyPlugin_exports = {};
|
|
21
21
|
__export(copyPlugin_exports, {
|
|
22
22
|
addCopyPlugin: () => addCopyPlugin
|
|
@@ -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/config/cssRules.js
CHANGED
|
@@ -36,7 +36,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
36
36
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
38
|
|
|
39
|
-
// cssRules.ts
|
|
39
|
+
// src/config/cssRules.ts
|
|
40
40
|
var cssRules_exports = {};
|
|
41
41
|
__export(cssRules_exports, {
|
|
42
42
|
addCSSRules: () => addCSSRules
|
|
@@ -30,7 +30,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
30
|
};
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// definePlugin.ts
|
|
33
|
+
// src/config/definePlugin.ts
|
|
34
34
|
var definePlugin_exports = {};
|
|
35
35
|
__export(definePlugin_exports, {
|
|
36
36
|
addDefinePlugin: () => addDefinePlugin,
|