@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.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.
- package/client/client/client.js +49 -35
- package/client/constants.js +3 -0
- package/compiled/autoprefixer/browserslist/index.d.ts +6 -0
- package/compiled/autoprefixer/index.js +3 -3
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/node.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/babel-loader/index.js +2 -2
- package/compiled/copy-webpack-plugin/939.index.js +1171 -0
- package/compiled/copy-webpack-plugin/index.js +16 -10
- package/compiled/copy-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
- package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
- package/compiled/cssnano/index.js +12 -11
- package/compiled/cssnano/package.json +1 -1
- package/compiled/express.d.ts +2 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
- package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
- package/compiled/http-proxy-middleware/index.js +10 -10
- package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
- package/compiled/mini-css-extract-plugin/index.js +4523 -4036
- package/compiled/mini-css-extract-plugin/loader.js +179 -54
- package/compiled/mini-css-extract-plugin/package.json +1 -1
- package/compiled/mini-css-extract-plugin/utils.js +79 -23
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/terser/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +296 -297
- package/compiled/terser-webpack-plugin/minify.js +4 -2
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
- package/compiled/terser-webpack-plugin/utils.js +9 -12
- package/compiled/webpack/index.js +9855 -4185
- package/compiled/webpack-dev-middleware/index.js +7 -7
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/compiled/webpack-sources/index.js +1 -1
- package/compiled/ws/index.d.ts +1 -2
- package/compiled/ws/index.js +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.js +1 -1
- package/dist/client/client.js +7 -2
- package/dist/config/compressPlugin.js +6 -0
- package/dist/config/config.js +4 -3
- package/dist/config/cssRules.js +1 -1
- package/dist/config/detectDeadCode.d.ts +12 -0
- package/dist/config/detectDeadCode.js +120 -0
- package/dist/config/detectDeadCodePlugin.d.ts +9 -0
- package/dist/config/detectDeadCodePlugin.js +75 -0
- package/dist/config/javaScriptRules.js +7 -12
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +13 -5
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/loader/swc.js +14 -18
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +1 -3
- package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
- package/dist/plugins/ParcelCSSMinifyPlugin.js +75 -0
- package/dist/plugins/ProgressPlugin.js +2 -2
- package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +10 -6
- package/dist/server/server.d.ts +1 -2
- package/dist/server/server.js +27 -11
- package/dist/server/ws.d.ts +3 -2
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +14 -17
- package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
- package/dist/swcPlugins/changeImportFromString.js +10 -0
- package/dist/swcPlugins/lockCoreJS.d.ts +1 -1
- package/dist/swcPlugins/lockCoreJS.js +3 -2
- package/dist/types.d.ts +16 -12
- package/dist/types.js +1 -0
- package/dist/utils/depMatch.js +1 -1
- package/dist/utils/server.d.ts +5 -0
- package/dist/utils/server.js +93 -0
- package/package.json +38 -41
- package/compiled/css-loader/LICENSE +0 -20
- package/compiled/css-loader/api.js +0 -102
- package/compiled/css-loader/getUrl.js +0 -29
- package/compiled/css-loader/index.js +0 -2
- package/compiled/css-loader/noSourceMaps.js +0 -5
- package/compiled/css-loader/package.json +0 -1
- package/compiled/css-loader/sourceMaps.js +0 -22
- package/compiled/express/LICENSE +0 -24
- package/compiled/express/body-parser/index.d.ts +0 -104
- package/compiled/express/connect/index.d.ts +0 -93
- package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
- package/compiled/express/index.d.ts +0 -133
- package/compiled/express/index.js +0 -338
- package/compiled/express/mime/index.d.ts +0 -35
- package/compiled/express/package.json +0 -1
- package/compiled/express/qs/index.d.ts +0 -62
- package/compiled/express/range-parser/index.d.ts +0 -35
- package/compiled/express/serve-static/index.d.ts +0 -108
- package/compiled/less/index.js +0 -31
- package/compiled/less/package.json +0 -1
- package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
- package/dist/esbuildHandler/autoCssModules.js +0 -23
- package/dist/loader/esbuild.d.ts +0 -5
- package/dist/loader/esbuild.js +0 -53
package/client/client/client.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
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
|
+
};
|
|
1
10
|
import stripAnsi from '@umijs/utils/compiled/strip-ansi';
|
|
2
11
|
// @ts-ignore
|
|
3
12
|
import * as ErrorOverlay from 'react-error-overlay';
|
|
@@ -6,13 +15,14 @@ import { formatWebpackMessages } from '../utils/formatWebpackMessages';
|
|
|
6
15
|
console.log('[webpack] connecting...');
|
|
7
16
|
let pingTimer = null;
|
|
8
17
|
const host = location.host;
|
|
9
|
-
const
|
|
18
|
+
const isHttps = location.protocol === 'https:';
|
|
19
|
+
const wsUrl = `${isHttps ? 'wss' : 'ws'}://${host}`;
|
|
10
20
|
let isFirstCompilation = true;
|
|
11
21
|
let mostRecentCompilationHash = null;
|
|
12
22
|
let hasCompileErrors = false;
|
|
13
23
|
let hadRuntimeError = false;
|
|
14
24
|
const socket = new WebSocket(wsUrl, 'webpack-hmr');
|
|
15
|
-
socket.addEventListener('message',
|
|
25
|
+
socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
26
|
data = JSON.parse(data);
|
|
17
27
|
if (data.type === 'connected') {
|
|
18
28
|
console.log(`[webpack] connected.`);
|
|
@@ -23,26 +33,28 @@ socket.addEventListener('message', async ({ data }) => {
|
|
|
23
33
|
else {
|
|
24
34
|
handleMessage(data).catch(console.error);
|
|
25
35
|
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
}));
|
|
37
|
+
function waitForSuccessfulPing(ms = 1000) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
// eslint-disable-next-line no-constant-condition
|
|
40
|
+
while (true) {
|
|
41
|
+
try {
|
|
42
|
+
yield fetch(`/__umi_ping`);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
yield new Promise((resolve) => setTimeout(resolve, ms));
|
|
47
|
+
}
|
|
36
48
|
}
|
|
37
|
-
}
|
|
49
|
+
});
|
|
38
50
|
}
|
|
39
|
-
socket.addEventListener('close',
|
|
51
|
+
socket.addEventListener('close', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
52
|
if (pingTimer)
|
|
41
53
|
clearInterval(pingTimer);
|
|
42
54
|
console.info('[webpack] Dev server disconnected. Polling for restart...');
|
|
43
|
-
|
|
55
|
+
yield waitForSuccessfulPing();
|
|
44
56
|
location.reload();
|
|
45
|
-
});
|
|
57
|
+
}));
|
|
46
58
|
ErrorOverlay.startReportingRuntimeErrors({
|
|
47
59
|
onError: function () {
|
|
48
60
|
hadRuntimeError = true;
|
|
@@ -180,23 +192,25 @@ function tryApplyUpdates(onHotUpdateSuccess) {
|
|
|
180
192
|
handleApplyUpdates(err, null);
|
|
181
193
|
});
|
|
182
194
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
function handleMessage(payload) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
// console.log('[payload]', payload);
|
|
198
|
+
switch (payload.type) {
|
|
199
|
+
case MESSAGE_TYPE.hash:
|
|
200
|
+
handleAvailableHash(payload.data);
|
|
201
|
+
break;
|
|
202
|
+
case MESSAGE_TYPE.stillOk:
|
|
203
|
+
case MESSAGE_TYPE.ok:
|
|
204
|
+
handleSuccess();
|
|
205
|
+
break;
|
|
206
|
+
case MESSAGE_TYPE.errors:
|
|
207
|
+
handleErrors(payload.data);
|
|
208
|
+
break;
|
|
209
|
+
case MESSAGE_TYPE.warnings:
|
|
210
|
+
handleWarnings(payload.data);
|
|
211
|
+
break;
|
|
212
|
+
default:
|
|
213
|
+
// Do nothing
|
|
214
|
+
}
|
|
215
|
+
});
|
|
202
216
|
}
|
package/client/constants.js
CHANGED
|
@@ -36,6 +36,10 @@ declare namespace browserslist {
|
|
|
36
36
|
* Do not throw on unknown version in direct query.
|
|
37
37
|
*/
|
|
38
38
|
ignoreUnknownVersions?: boolean
|
|
39
|
+
/**
|
|
40
|
+
* Throw a error if env is not found.
|
|
41
|
+
*/
|
|
42
|
+
throwOnMissing?: boolean
|
|
39
43
|
/**
|
|
40
44
|
* Disable security checks for extend query.
|
|
41
45
|
*/
|
|
@@ -98,6 +102,8 @@ declare namespace browserslist {
|
|
|
98
102
|
| undefined
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
let nodeVersions: string[]
|
|
106
|
+
|
|
101
107
|
interface Usage {
|
|
102
108
|
[version: string]: number
|
|
103
109
|
}
|