@umijs/bundler-webpack 4.0.0-canary.20220718.1 → 4.0.0-canary.20220727.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.d.ts +1 -0
- package/client/client/client.js +172 -192
- 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 -2
- package/dist/build.js +105 -68
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +77 -69
- package/dist/config/_sampleFeature.d.ts +0 -1
- package/dist/config/_sampleFeature.js +33 -9
- package/dist/config/assetRules.d.ts +0 -1
- package/dist/config/assetRules.js +45 -36
- package/dist/config/bundleAnalyzerPlugin.d.ts +0 -1
- package/dist/config/bundleAnalyzerPlugin.js +39 -17
- package/dist/config/compressPlugin.d.ts +0 -1
- package/dist/config/compressPlugin.js +113 -95
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.js +204 -218
- package/dist/config/copyPlugin.d.ts +0 -1
- package/dist/config/copyPlugin.js +59 -40
- package/dist/config/cssRules.d.ts +0 -1
- package/dist/config/cssRules.js +136 -131
- package/dist/config/definePlugin.d.ts +0 -1
- package/dist/config/definePlugin.js +71 -35
- package/dist/config/detectDeadCode.d.ts +0 -1
- package/dist/config/detectDeadCode.js +120 -108
- package/dist/config/detectDeadCodePlugin.d.ts +0 -1
- package/dist/config/detectDeadCodePlugin.js +78 -63
- package/dist/config/fastRefreshPlugin.d.ts +0 -1
- package/dist/config/fastRefreshPlugin.js +39 -20
- package/dist/config/forkTSCheckerPlugin.d.ts +0 -1
- package/dist/config/forkTSCheckerPlugin.js +38 -18
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +0 -1
- package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
- package/dist/config/ignorePlugin.d.ts +0 -1
- package/dist/config/ignorePlugin.js +38 -14
- package/dist/config/javaScriptRules.d.ts +0 -1
- package/dist/config/javaScriptRules.js +147 -175
- package/dist/config/manifestPlugin.d.ts +0 -1
- package/dist/config/manifestPlugin.js +51 -15
- package/dist/config/miniCSSExtractPlugin.d.ts +0 -1
- package/dist/config/miniCSSExtractPlugin.js +42 -22
- package/dist/config/nodePolyfill.d.ts +0 -1
- package/dist/config/nodePolyfill.js +65 -26
- package/dist/config/nodePrefixPlugin.d.ts +0 -1
- package/dist/config/nodePrefixPlugin.js +36 -12
- package/dist/config/progressPlugin.d.ts +0 -1
- package/dist/config/progressPlugin.js +37 -13
- package/dist/config/purgecssWebpackPlugin.d.ts +0 -1
- package/dist/config/purgecssWebpackPlugin.js +41 -19
- package/dist/config/speedMeasureWebpackPlugin.d.ts +0 -1
- package/dist/config/speedMeasureWebpackPlugin.js +41 -20
- package/dist/config/ssrPlugin.d.ts +0 -1
- package/dist/config/ssrPlugin.js +83 -63
- package/dist/config/svgRules.d.ts +0 -1
- package/dist/config/svgRules.js +74 -46
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +57 -22
- package/dist/dev.d.ts +1 -2
- package/dist/dev.js +170 -135
- package/dist/index.d.ts +0 -1
- package/dist/index.js +22 -20
- package/dist/loader/svgr.d.ts +0 -1
- package/dist/loader/svgr.js +73 -54
- package/dist/loader/swc.d.ts +0 -1
- package/dist/loader/swc.js +110 -69
- package/dist/parcelCSS.d.ts +0 -1
- package/dist/parcelCSS.js +31 -27
- package/dist/plugins/ProgressPlugin.d.ts +0 -1
- package/dist/plugins/ProgressPlugin.js +66 -43
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +0 -1
- package/dist/plugins/RuntimePublicPathPlugin.js +42 -25
- package/dist/plugins/_SamplePlugin.d.ts +0 -1
- package/dist/plugins/_SamplePlugin.js +39 -14
- package/dist/requireHook.d.ts +0 -1
- package/dist/requireHook.js +37 -27
- package/dist/schema.d.ts +0 -1
- package/dist/schema.js +120 -97
- package/dist/server/server.d.ts +0 -2
- package/dist/server/server.js +214 -184
- package/dist/server/ws.d.ts +0 -3
- package/dist/server/ws.js +63 -38
- package/dist/swcPlugins/autoCSSModules.d.ts +0 -1
- package/dist/swcPlugins/autoCSSModules.js +50 -31
- package/dist/swcPlugins/changeImportFromString.d.ts +0 -1
- package/dist/swcPlugins/changeImportFromString.js +31 -9
- package/dist/swcPlugins/lockCoreJS.d.ts +0 -1
- package/dist/swcPlugins/lockCoreJS.js +44 -20
- package/dist/types.d.ts +2 -2
- package/dist/types.js +61 -30
- package/dist/utils/browsersList.d.ts +0 -1
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.d.ts +0 -1
- package/dist/utils/depMatch.js +63 -39
- package/dist/utils/formatWebpackMessages.d.ts +0 -1
- package/dist/utils/formatWebpackMessages.js +93 -91
- package/dist/utils/getEsBuildTarget.d.ts +0 -1
- package/dist/utils/getEsBuildTarget.js +32 -10
- package/package.json +10 -15
- 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/build.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/client/client.d.ts +0 -2
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js +0 -245
- package/dist/config/_sampleFeature.d.ts.map +0 -1
- package/dist/config/assetRules.d.ts.map +0 -1
- package/dist/config/bundleAnalyzerPlugin.d.ts.map +0 -1
- package/dist/config/compressPlugin.d.ts.map +0 -1
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/copyPlugin.d.ts.map +0 -1
- package/dist/config/cssRules.d.ts.map +0 -1
- package/dist/config/definePlugin.d.ts.map +0 -1
- package/dist/config/detectDeadCode.d.ts.map +0 -1
- package/dist/config/detectDeadCodePlugin.d.ts.map +0 -1
- package/dist/config/fastRefreshPlugin.d.ts.map +0 -1
- package/dist/config/forkTSCheckerPlugin.d.ts.map +0 -1
- package/dist/config/harmonyLinkingErrorPlugin.d.ts.map +0 -1
- package/dist/config/ignorePlugin.d.ts.map +0 -1
- package/dist/config/javaScriptRules.d.ts.map +0 -1
- package/dist/config/manifestPlugin.d.ts.map +0 -1
- package/dist/config/miniCSSExtractPlugin.d.ts.map +0 -1
- package/dist/config/nodePolyfill.d.ts.map +0 -1
- package/dist/config/nodePrefixPlugin.d.ts.map +0 -1
- package/dist/config/progressPlugin.d.ts.map +0 -1
- package/dist/config/purgecssWebpackPlugin.d.ts.map +0 -1
- package/dist/config/speedMeasureWebpackPlugin.d.ts.map +0 -1
- package/dist/config/ssrPlugin.d.ts.map +0 -1
- package/dist/config/svgRules.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/dev.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/loader/svgr.d.ts.map +0 -1
- package/dist/loader/swc.d.ts.map +0 -1
- package/dist/parcelCSS.d.ts.map +0 -1
- package/dist/plugins/ProgressPlugin.d.ts.map +0 -1
- package/dist/plugins/RuntimePublicPathPlugin.d.ts.map +0 -1
- package/dist/plugins/_SamplePlugin.d.ts.map +0 -1
- package/dist/requireHook.d.ts.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/server/server.d.ts.map +0 -1
- package/dist/server/ws.d.ts.map +0 -1
- package/dist/swcPlugins/autoCSSModules.d.ts.map +0 -1
- package/dist/swcPlugins/changeImportFromString.d.ts.map +0 -1
- package/dist/swcPlugins/lockCoreJS.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/browsersList.d.ts.map +0 -1
- package/dist/utils/depMatch.d.ts.map +0 -1
- package/dist/utils/formatWebpackMessages.d.ts.map +0 -1
- package/dist/utils/getEsBuildTarget.d.ts.map +0 -1
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
e.source.raw = `'${v}'`;
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// changeImportFromString.ts
|
|
20
|
+
var changeImportFromString_exports = {};
|
|
21
|
+
__export(changeImportFromString_exports, {
|
|
22
|
+
changeImportFromString: () => changeImportFromString
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(changeImportFromString_exports);
|
|
25
|
+
var changeImportFromString = (e, v) => {
|
|
26
|
+
e.source.value = v;
|
|
27
|
+
e.source.raw = `'${v}'`;
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
changeImportFromString
|
|
32
|
+
});
|
|
@@ -1,24 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
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));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// lockCoreJS.ts
|
|
23
|
+
var lockCoreJS_exports = {};
|
|
24
|
+
__export(lockCoreJS_exports, {
|
|
25
|
+
default: () => lockCoreJS_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(lockCoreJS_exports);
|
|
28
|
+
var import_Visitor = __toESM(require("@swc/core/Visitor"));
|
|
29
|
+
var import_utils = require("@umijs/utils");
|
|
30
|
+
var import_path = require("path");
|
|
31
|
+
var import_changeImportFromString = require("./changeImportFromString");
|
|
10
32
|
function addLastSlash(path) {
|
|
11
|
-
|
|
33
|
+
return path.endsWith("/") ? path : `${path}/`;
|
|
12
34
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return expression;
|
|
35
|
+
var LockCoreJS = class extends import_Visitor.default {
|
|
36
|
+
visitImportDeclaration(expression) {
|
|
37
|
+
const { source } = expression;
|
|
38
|
+
let { value, type } = source;
|
|
39
|
+
if (type === "StringLiteral" && value.startsWith("core-js/")) {
|
|
40
|
+
const newValue = value.replace(/^core-js\//, addLastSlash((0, import_utils.winPath)((0, import_path.dirname)(require.resolve("core-js/package.json")))));
|
|
41
|
+
(0, import_changeImportFromString.changeImportFromString)(expression, newValue);
|
|
22
42
|
}
|
|
23
|
-
|
|
24
|
-
|
|
43
|
+
return expression;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var lockCoreJS_default = LockCoreJS;
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {});
|
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 {
|
|
@@ -117,4 +118,3 @@ export interface SwcOptions extends SwcConfig {
|
|
|
117
118
|
parseMap?: boolean;
|
|
118
119
|
}
|
|
119
120
|
export {};
|
|
120
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -1,30 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
var
|
|
10
|
-
(function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// types.ts
|
|
20
|
+
var types_exports = {};
|
|
21
|
+
__export(types_exports, {
|
|
22
|
+
CSSMinifier: () => CSSMinifier,
|
|
23
|
+
Env: () => Env,
|
|
24
|
+
JSMinifier: () => JSMinifier,
|
|
25
|
+
Transpiler: () => Transpiler
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(types_exports);
|
|
28
|
+
var Env = /* @__PURE__ */ ((Env2) => {
|
|
29
|
+
Env2["development"] = "development";
|
|
30
|
+
Env2["production"] = "production";
|
|
31
|
+
return Env2;
|
|
32
|
+
})(Env || {});
|
|
33
|
+
var Transpiler = /* @__PURE__ */ ((Transpiler2) => {
|
|
34
|
+
Transpiler2["babel"] = "babel";
|
|
35
|
+
Transpiler2["swc"] = "swc";
|
|
36
|
+
Transpiler2["esbuild"] = "esbuild";
|
|
37
|
+
Transpiler2["none"] = "none";
|
|
38
|
+
return Transpiler2;
|
|
39
|
+
})(Transpiler || {});
|
|
40
|
+
var JSMinifier = /* @__PURE__ */ ((JSMinifier2) => {
|
|
41
|
+
JSMinifier2["terser"] = "terser";
|
|
42
|
+
JSMinifier2["swc"] = "swc";
|
|
43
|
+
JSMinifier2["esbuild"] = "esbuild";
|
|
44
|
+
JSMinifier2["uglifyJs"] = "uglifyJs";
|
|
45
|
+
JSMinifier2["none"] = "none";
|
|
46
|
+
return JSMinifier2;
|
|
47
|
+
})(JSMinifier || {});
|
|
48
|
+
var CSSMinifier = /* @__PURE__ */ ((CSSMinifier2) => {
|
|
49
|
+
CSSMinifier2["esbuild"] = "esbuild";
|
|
50
|
+
CSSMinifier2["cssnano"] = "cssnano";
|
|
51
|
+
CSSMinifier2["parcelCSS"] = "parcelCSS";
|
|
52
|
+
CSSMinifier2["none"] = "none";
|
|
53
|
+
return CSSMinifier2;
|
|
54
|
+
})(CSSMinifier || {});
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
CSSMinifier,
|
|
58
|
+
Env,
|
|
59
|
+
JSMinifier,
|
|
60
|
+
Transpiler
|
|
61
|
+
});
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// browsersList.ts
|
|
20
|
+
var browsersList_exports = {};
|
|
21
|
+
__export(browsersList_exports, {
|
|
22
|
+
getBrowsersList: () => getBrowsersList
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(browsersList_exports);
|
|
4
25
|
function getBrowsersList({ targets }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}));
|
|
26
|
+
return targets.browsers || Object.keys(targets).map((key) => {
|
|
27
|
+
return `${key} >= ${targets[key] === true ? "0" : targets[key]}`;
|
|
28
|
+
});
|
|
9
29
|
}
|
|
10
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getBrowsersList
|
|
33
|
+
});
|
package/dist/utils/depMatch.d.ts
CHANGED
package/dist/utils/depMatch.js
CHANGED
|
@@ -1,46 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// depMatch.ts
|
|
20
|
+
var depMatch_exports = {};
|
|
21
|
+
__export(depMatch_exports, {
|
|
22
|
+
cleanCache: () => cleanCache,
|
|
23
|
+
es5ImcompatibleVersionsToPkg: () => es5ImcompatibleVersionsToPkg,
|
|
24
|
+
isMatch: () => isMatch
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(depMatch_exports);
|
|
27
|
+
var import_utils = require("@umijs/utils");
|
|
28
|
+
var import_path = require("path");
|
|
29
|
+
var cache = /* @__PURE__ */ new Map();
|
|
7
30
|
function cleanCache() {
|
|
8
|
-
|
|
31
|
+
cache.clear();
|
|
9
32
|
}
|
|
10
|
-
exports.cleanCache = cleanCache;
|
|
11
33
|
function isMatch(opts) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
ret = false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
cache.set(dir, ret);
|
|
35
|
-
return ret;
|
|
34
|
+
const dir = (0, import_utils.winPath)((0, import_path.dirname)(opts.path));
|
|
35
|
+
if (cache.has(dir)) {
|
|
36
|
+
return !!cache.get(dir);
|
|
37
|
+
} else {
|
|
38
|
+
const pkgPath = import_utils.pkgUp.pkgUpSync({ cwd: opts.path });
|
|
39
|
+
let ret;
|
|
40
|
+
if (!pkgPath) {
|
|
41
|
+
ret = false;
|
|
42
|
+
} else {
|
|
43
|
+
const { name, version } = require(pkgPath);
|
|
44
|
+
if (opts.pkgs[name]) {
|
|
45
|
+
ret = opts.pkgs[name].some((v) => {
|
|
46
|
+
return import_utils.semver.satisfies(version, v);
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
ret = false;
|
|
50
|
+
}
|
|
36
51
|
}
|
|
52
|
+
cache.set(dir, ret);
|
|
53
|
+
return ret;
|
|
54
|
+
}
|
|
37
55
|
}
|
|
38
|
-
exports.isMatch = isMatch;
|
|
39
56
|
function es5ImcompatibleVersionsToPkg() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const {
|
|
58
|
+
config: { "es5-imcompatible-versions": config }
|
|
59
|
+
} = require("es5-imcompatible-versions/package.json");
|
|
60
|
+
return Object.keys(config).reduce((memo, key) => {
|
|
61
|
+
memo[key] = Object.keys(config[key]);
|
|
62
|
+
return memo;
|
|
63
|
+
}, {});
|
|
45
64
|
}
|
|
46
|
-
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
cleanCache,
|
|
68
|
+
es5ImcompatibleVersionsToPkg,
|
|
69
|
+
isMatch
|
|
70
|
+
});
|
|
@@ -1,100 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
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));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// formatWebpackMessages.ts
|
|
23
|
+
var formatWebpackMessages_exports = {};
|
|
24
|
+
__export(formatWebpackMessages_exports, {
|
|
25
|
+
formatMessage: () => formatMessage,
|
|
26
|
+
formatWebpackMessages: () => formatWebpackMessages
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(formatWebpackMessages_exports);
|
|
29
|
+
var import_strip_ansi = __toESM(require("@umijs/utils/compiled/strip-ansi"));
|
|
30
|
+
var friendlySyntaxErrorLabel = "Syntax error:";
|
|
9
31
|
function isLikelyASyntaxError(message) {
|
|
10
|
-
|
|
32
|
+
return (0, import_strip_ansi.default)(message).indexOf(friendlySyntaxErrorLabel) !== -1;
|
|
11
33
|
}
|
|
12
34
|
function formatMessage(message) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
message.
|
|
22
|
-
|
|
23
|
-
lines = message['message'].split('\n');
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
// Strip webpack-added headers off errors/warnings
|
|
28
|
-
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
29
|
-
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
30
|
-
// Transform parsing error into syntax error
|
|
31
|
-
// TODO: move this to our ESLint formatter?
|
|
32
|
-
lines = lines.map((line) => {
|
|
33
|
-
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
34
|
-
if (!parsingError) {
|
|
35
|
-
return line;
|
|
36
|
-
}
|
|
37
|
-
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
38
|
-
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
35
|
+
let lines = [];
|
|
36
|
+
if (typeof message === "string") {
|
|
37
|
+
lines = message.split("\n");
|
|
38
|
+
} else if ("message" in message) {
|
|
39
|
+
lines = message["message"].split("\n");
|
|
40
|
+
} else if (Array.isArray(message)) {
|
|
41
|
+
message.forEach((message2) => {
|
|
42
|
+
if ("message" in message2) {
|
|
43
|
+
lines = message2["message"].split("\n");
|
|
44
|
+
}
|
|
39
45
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);
|
|
47
|
-
lines = message.split('\n');
|
|
48
|
-
// Remove leading newline
|
|
49
|
-
if (lines.length > 2 && lines[1].trim() === '') {
|
|
50
|
-
lines.splice(1, 1);
|
|
51
|
-
}
|
|
52
|
-
// Clean up file name
|
|
53
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');
|
|
54
|
-
// Cleans up verbose "module not found" messages for files and packages.
|
|
55
|
-
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
|
|
56
|
-
lines = [
|
|
57
|
-
lines[0],
|
|
58
|
-
lines[1]
|
|
59
|
-
.replace('Error: ', '')
|
|
60
|
-
.replace('Module not found: Cannot find file:', 'Cannot find file:'),
|
|
61
|
-
];
|
|
46
|
+
}
|
|
47
|
+
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
48
|
+
lines = lines.map((line) => {
|
|
49
|
+
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
50
|
+
if (!parsingError) {
|
|
51
|
+
return line;
|
|
62
52
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
lines =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
54
|
+
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
55
|
+
});
|
|
56
|
+
message = lines.join("\n");
|
|
57
|
+
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)
|
|
58
|
+
`);
|
|
59
|
+
message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`);
|
|
60
|
+
message = message.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`);
|
|
61
|
+
message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);
|
|
62
|
+
lines = message.split("\n");
|
|
63
|
+
if (lines.length > 2 && lines[1].trim() === "") {
|
|
64
|
+
lines.splice(1, 1);
|
|
65
|
+
}
|
|
66
|
+
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
|
|
67
|
+
if (lines[1] && lines[1].indexOf("Module not found: ") === 0) {
|
|
68
|
+
lines = [
|
|
69
|
+
lines[0],
|
|
70
|
+
lines[1].replace("Error: ", "").replace("Module not found: Cannot find file:", "Cannot find file:")
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
if (lines[1] && lines[1].match(/Cannot find module.+sass/)) {
|
|
74
|
+
lines[1] = "To import Sass files, you first need to install sass.\n";
|
|
75
|
+
lines[1] += "Run `npm install sass` or `yarn add sass` inside your workspace.";
|
|
76
|
+
}
|
|
77
|
+
message = lines.join("\n");
|
|
78
|
+
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, "");
|
|
79
|
+
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
|
|
80
|
+
lines = message.split("\n");
|
|
81
|
+
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim());
|
|
82
|
+
message = lines.join("\n");
|
|
83
|
+
return message.trim();
|
|
84
84
|
}
|
|
85
|
-
exports.formatMessage = formatMessage;
|
|
86
85
|
function formatWebpackMessages(json) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return result;
|
|
86
|
+
const formattedErrors = json.errors.map(function(message) {
|
|
87
|
+
return formatMessage(message);
|
|
88
|
+
});
|
|
89
|
+
const formattedWarnings = json.warnings.map(function(message) {
|
|
90
|
+
return formatMessage(message);
|
|
91
|
+
});
|
|
92
|
+
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
93
|
+
if (result.errors.some(isLikelyASyntaxError)) {
|
|
94
|
+
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
99
97
|
}
|
|
100
|
-
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
formatMessage,
|
|
101
|
+
formatWebpackMessages
|
|
102
|
+
});
|