@umijs/bundler-webpack 4.0.0-beta.7 → 4.0.0-canary.202200505.1
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 +65 -37
- package/client/constants.js +9 -0
- package/compiled/autoprefixer/browserslist/index.d.ts +13 -7
- 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/container.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +55 -8
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/input.d.ts +26 -6
- package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +11 -10
- package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
- package/compiled/autoprefixer/postcss/lib/node.d.ts +38 -4
- package/compiled/autoprefixer/postcss/lib/postcss.d.ts +31 -30
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +5 -4
- package/compiled/autoprefixer/postcss/lib/result.d.ts +3 -2
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/warning.d.ts +37 -3
- 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/LICENSE +21 -0
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +42 -0
- package/compiled/fork-ts-checker-webpack-plugin/package.json +1 -0
- 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 +7970 -7445
- 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 +85 -24
- package/compiled/postcss-loader/index.js +1 -1
- package/compiled/react-refresh/LICENSE +21 -0
- package/compiled/react-refresh/index.js +9 -7
- package/compiled/react-refresh/package.json +1 -0
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/schema-utils/ajv/dist/ajv.d.ts +16 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/code.d.ts +39 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/errors.d.ts +13 -0
- package/compiled/schema-utils/ajv/dist/compile/index.d.ts +80 -0
- package/compiled/schema-utils/ajv/dist/compile/ref_error.d.ts +5 -0
- package/compiled/schema-utils/ajv/dist/compile/resolve.d.ts +12 -0
- package/compiled/schema-utils/ajv/dist/compile/rules.d.ts +28 -0
- package/compiled/schema-utils/ajv/dist/compile/util.d.ts +40 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/index.d.ts +42 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/compiled/schema-utils/ajv/dist/core.d.ts +171 -0
- package/compiled/schema-utils/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/compiled/schema-utils/ajv/dist/types/index.d.ts +177 -0
- package/compiled/schema-utils/ajv/dist/types/json-schema.d.ts +124 -0
- package/compiled/schema-utils/ajv/dist/types/jtd-schema.d.ts +168 -0
- package/compiled/schema-utils/declarations/validate.d.ts +4 -4
- package/compiled/schema-utils/index.js +8 -2
- package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -0
- package/compiled/style-loader/index.js +1 -1
- package/compiled/terser/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +393 -517
- package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +1 -0
- package/compiled/terser-webpack-plugin/minify.js +10 -3
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +183 -149
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +10 -15
- package/compiled/terser-webpack-plugin/utils.js +118 -25
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +6 -1
- package/compiled/webpack/index.js +13409 -5746
- package/compiled/webpack/types.d.ts +606 -171
- package/compiled/webpack-dev-middleware/index.js +11 -5
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/{tapable → webpack-manifest-plugin}/LICENSE +2 -2
- package/compiled/webpack-manifest-plugin/index.js +1 -0
- package/compiled/webpack-manifest-plugin/package.json +1 -0
- 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 +6 -3
- package/dist/build.js +48 -56
- package/dist/cli.js +10 -22
- package/dist/client/client.js +57 -51
- package/dist/config/_sampleFeature.js +6 -17
- package/dist/config/assetRules.js +44 -51
- package/dist/config/bundleAnalyzerPlugin.js +12 -23
- package/dist/config/compressPlugin.js +70 -64
- package/dist/config/config.d.ts +9 -2
- package/dist/config/config.js +184 -144
- package/dist/config/copyPlugin.js +29 -40
- package/dist/config/cssRules.js +93 -83
- package/dist/config/definePlugin.js +11 -19
- 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 +70 -0
- package/dist/config/fastRefreshPlugin.js +11 -22
- package/dist/config/forkTSCheckerPlugin.d.ts +11 -0
- package/dist/config/forkTSCheckerPlugin.js +23 -0
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +6 -0
- package/dist/config/harmonyLinkingErrorPlugin.js +31 -0
- package/dist/config/ignorePlugin.js +10 -21
- package/dist/config/javaScriptRules.d.ts +2 -0
- package/dist/config/javaScriptRules.js +153 -131
- package/dist/config/manifestPlugin.d.ts +11 -0
- package/dist/config/manifestPlugin.js +17 -0
- package/dist/config/miniCSSExtractPlugin.d.ts +1 -0
- package/dist/config/miniCSSExtractPlugin.js +12 -24
- package/dist/config/nodePolyfill.js +14 -20
- package/dist/config/nodePrefixPlugin.d.ts +11 -0
- package/dist/config/nodePrefixPlugin.js +14 -0
- package/dist/config/progressPlugin.js +7 -18
- package/dist/config/purgecssWebpackPlugin.js +15 -26
- package/dist/config/speedMeasureWebpackPlugin.js +12 -23
- package/dist/config/svgRules.d.ts +1 -0
- package/dist/config/svgRules.js +45 -48
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +10 -1
- package/dist/dev.d.ts +8 -2
- package/dist/dev.js +117 -66
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/loader/svgr.d.ts +4 -0
- package/dist/loader/svgr.js +58 -0
- package/dist/loader/swc.d.ts +4 -0
- package/dist/loader/swc.js +74 -0
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -36
- package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
- package/dist/plugins/ParcelCSSMinifyPlugin.js +73 -0
- package/dist/plugins/ProgressPlugin.js +2 -2
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +4 -0
- package/dist/plugins/RuntimePublicPathPlugin.js +20 -0
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +23 -11
- package/dist/server/server.d.ts +2 -1
- package/dist/server/server.js +165 -130
- package/dist/server/ws.d.ts +6 -3
- package/dist/server/ws.js +1 -1
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +16 -17
- package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
- package/dist/swcPlugins/changeImportFromString.js +10 -0
- package/dist/swcPlugins/lockCoreJS.d.ts +6 -0
- package/dist/swcPlugins/lockCoreJS.js +24 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.js +1 -0
- package/dist/utils/depMatch.js +1 -1
- package/dist/utils/getEsBuildTarget.d.ts +5 -0
- package/dist/utils/getEsBuildTarget.js +12 -0
- package/package.json +68 -67
- package/compiled/@svgr/webpack/.svgo.yml +0 -75
- package/compiled/@svgr/webpack/LICENSE +0 -7
- package/compiled/@svgr/webpack/index.js +0 -343
- package/compiled/@svgr/webpack/package.json +0 -1
- 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/compiled/swc-loader/LICENSE +0 -25
- package/compiled/swc-loader/index.js +0 -1
- package/compiled/swc-loader/package.json +0 -1
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
package/client/client/client.js
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
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';
|
|
4
13
|
import { MESSAGE_TYPE } from '../constants';
|
|
5
14
|
import { formatWebpackMessages } from '../utils/formatWebpackMessages';
|
|
6
15
|
console.log('[webpack] connecting...');
|
|
16
|
+
function getHost() {
|
|
17
|
+
if (process.env.SOCKET_SERVER) {
|
|
18
|
+
return new URL(process.env.SOCKET_SERVER);
|
|
19
|
+
}
|
|
20
|
+
return location;
|
|
21
|
+
}
|
|
22
|
+
function getSocketUrl() {
|
|
23
|
+
let h = getHost();
|
|
24
|
+
const host = h.host;
|
|
25
|
+
const isHttps = h.protocol === 'https:';
|
|
26
|
+
return `${isHttps ? 'wss' : 'ws'}://${host}`;
|
|
27
|
+
}
|
|
28
|
+
function getPingUrl() {
|
|
29
|
+
const h = getHost();
|
|
30
|
+
return `${h.protocol}//${h.host}/__umi_ping`;
|
|
31
|
+
}
|
|
7
32
|
let pingTimer = null;
|
|
8
|
-
const host = location.host;
|
|
9
|
-
const wsUrl = `ws://${host}`;
|
|
10
33
|
let isFirstCompilation = true;
|
|
11
34
|
let mostRecentCompilationHash = null;
|
|
12
35
|
let hasCompileErrors = false;
|
|
13
36
|
let hadRuntimeError = false;
|
|
14
|
-
const
|
|
15
|
-
socket
|
|
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* () {
|
|
16
40
|
data = JSON.parse(data);
|
|
17
41
|
if (data.type === 'connected') {
|
|
18
42
|
console.log(`[webpack] connected.`);
|
|
@@ -23,26 +47,28 @@ socket.addEventListener('message', async ({ data }) => {
|
|
|
23
47
|
else {
|
|
24
48
|
handleMessage(data).catch(console.error);
|
|
25
49
|
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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;
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
yield new Promise((resolve) => setTimeout(resolve, ms));
|
|
61
|
+
}
|
|
36
62
|
}
|
|
37
|
-
}
|
|
63
|
+
});
|
|
38
64
|
}
|
|
39
|
-
socket.addEventListener('close',
|
|
65
|
+
socket.addEventListener('close', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
66
|
if (pingTimer)
|
|
41
67
|
clearInterval(pingTimer);
|
|
42
68
|
console.info('[webpack] Dev server disconnected. Polling for restart...');
|
|
43
|
-
|
|
69
|
+
yield waitForSuccessfulPing();
|
|
44
70
|
location.reload();
|
|
45
|
-
});
|
|
71
|
+
}));
|
|
46
72
|
ErrorOverlay.startReportingRuntimeErrors({
|
|
47
73
|
onError: function () {
|
|
48
74
|
hadRuntimeError = true;
|
|
@@ -180,23 +206,25 @@ function tryApplyUpdates(onHotUpdateSuccess) {
|
|
|
180
206
|
handleApplyUpdates(err, null);
|
|
181
207
|
});
|
|
182
208
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
+
});
|
|
202
230
|
}
|
package/client/constants.js
CHANGED
|
@@ -10,3 +10,12 @@ export var MESSAGE_TYPE;
|
|
|
10
10
|
MESSAGE_TYPE["stillOk"] = "still-ok";
|
|
11
11
|
MESSAGE_TYPE["invalid"] = "invalid";
|
|
12
12
|
})(MESSAGE_TYPE || (MESSAGE_TYPE = {}));
|
|
13
|
+
export const DEFAULT_BROWSER_TARGETS = {
|
|
14
|
+
chrome: 80,
|
|
15
|
+
};
|
|
16
|
+
export const DEFAULT_ESBUILD_TARGET_KEYS = [
|
|
17
|
+
'chrome',
|
|
18
|
+
'firefox',
|
|
19
|
+
'edge',
|
|
20
|
+
'safari',
|
|
21
|
+
];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @param queries Browser queries.
|
|
9
9
|
* @returns Array with browser names in Can I Use.
|
|
10
10
|
*/
|
|
11
|
-
declare function browserslist
|
|
11
|
+
declare function browserslist(
|
|
12
12
|
queries?: string | readonly string[] | null,
|
|
13
13
|
opts?: browserslist.Options
|
|
14
14
|
): string[]
|
|
@@ -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
|
}
|
|
@@ -136,15 +142,15 @@ declare namespace browserslist {
|
|
|
136
142
|
* @param stats Which statistics should be used.
|
|
137
143
|
* @returns Total market coverage for all selected browsers.
|
|
138
144
|
*/
|
|
139
|
-
function coverage
|
|
145
|
+
function coverage(browsers: readonly string[], stats?: StatsOptions): number
|
|
140
146
|
|
|
141
|
-
function clearCaches
|
|
147
|
+
function clearCaches(): void
|
|
142
148
|
|
|
143
|
-
function parseConfig
|
|
149
|
+
function parseConfig(string: string): Config
|
|
144
150
|
|
|
145
|
-
function readConfig
|
|
151
|
+
function readConfig(file: string): Config
|
|
146
152
|
|
|
147
|
-
function findConfig
|
|
153
|
+
function findConfig(...pathSegments: string[]): Config | undefined
|
|
148
154
|
|
|
149
155
|
interface LoadConfigOptions {
|
|
150
156
|
config?: string
|
|
@@ -152,7 +158,7 @@ declare namespace browserslist {
|
|
|
152
158
|
env?: string
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
function loadConfig
|
|
161
|
+
function loadConfig(options: LoadConfigOptions): string[] | undefined
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
declare global {
|