@umijs/bundler-webpack 4.2.6-alpha.5 → 4.2.6-alpha.6
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/package.json +5 -5
- package/dist/build.d.ts +0 -22
- package/dist/build.js +0 -151
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -96
- package/dist/config/_sampleFeature.d.ts +0 -10
- package/dist/config/_sampleFeature.js +0 -35
- package/dist/config/assetRules.d.ts +0 -11
- package/dist/config/assetRules.js +0 -48
- package/dist/config/bundleAnalyzerPlugin.d.ts +0 -10
- package/dist/config/bundleAnalyzerPlugin.js +0 -43
- package/dist/config/compressPlugin.d.ts +0 -10
- package/dist/config/compressPlugin.js +0 -128
- package/dist/config/config.d.ts +0 -31
- package/dist/config/config.js +0 -243
- package/dist/config/copyPlugin.d.ts +0 -10
- package/dist/config/copyPlugin.js +0 -63
- package/dist/config/cssRules.d.ts +0 -11
- package/dist/config/cssRules.js +0 -165
- package/dist/config/definePlugin.d.ts +0 -16
- package/dist/config/definePlugin.js +0 -80
- package/dist/config/detectCssModulesInDependence.d.ts +0 -10
- package/dist/config/detectCssModulesInDependence.js +0 -151
- package/dist/config/detectDeadCode.d.ts +0 -12
- package/dist/config/detectDeadCode.js +0 -191
- package/dist/config/detectDeadCodePlugin.d.ts +0 -9
- package/dist/config/detectDeadCodePlugin.js +0 -82
- package/dist/config/fastRefreshPlugin.d.ts +0 -12
- package/dist/config/fastRefreshPlugin.js +0 -49
- package/dist/config/forkTSCheckerPlugin.d.ts +0 -11
- package/dist/config/forkTSCheckerPlugin.js +0 -49
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +0 -6
- package/dist/config/harmonyLinkingErrorPlugin.js +0 -53
- package/dist/config/ignorePlugin.d.ts +0 -10
- package/dist/config/ignorePlugin.js +0 -40
- package/dist/config/javaScriptRules.d.ts +0 -16
- package/dist/config/javaScriptRules.js +0 -191
- package/dist/config/manifestPlugin.d.ts +0 -11
- package/dist/config/manifestPlugin.js +0 -40
- package/dist/config/miniCSSExtractPlugin.d.ts +0 -11
- package/dist/config/miniCSSExtractPlugin.js +0 -55
- package/dist/config/nodePolyfill.d.ts +0 -10
- package/dist/config/nodePolyfill.js +0 -51
- package/dist/config/nodePrefixPlugin.d.ts +0 -11
- package/dist/config/nodePrefixPlugin.js +0 -38
- package/dist/config/progressPlugin.d.ts +0 -11
- package/dist/config/progressPlugin.js +0 -53
- package/dist/config/purgecssWebpackPlugin.d.ts +0 -10
- package/dist/config/purgecssWebpackPlugin.js +0 -43
- package/dist/config/speedMeasureWebpackPlugin.d.ts +0 -6
- package/dist/config/speedMeasureWebpackPlugin.js +0 -59
- package/dist/config/ssrPlugin.d.ts +0 -11
- package/dist/config/ssrPlugin.js +0 -98
- package/dist/config/svgRules.d.ts +0 -12
- package/dist/config/svgRules.js +0 -70
- package/dist/constants.d.ts +0 -15
- package/dist/constants.js +0 -59
- package/dist/dev.d.ts +0 -40
- package/dist/dev.js +0 -208
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -32
- package/dist/loader/svgr.d.ts +0 -4
- package/dist/loader/svgr.js +0 -84
- package/dist/loader/swc.d.ts +0 -4
- package/dist/loader/swc.js +0 -149
- package/dist/parcelCSS.d.ts +0 -2
- package/dist/parcelCSS.js +0 -39
- package/dist/plugins/EsbuildMinifyFix.d.ts +0 -8
- package/dist/plugins/EsbuildMinifyFix.js +0 -136
- package/dist/plugins/ProgressPlugin.d.ts +0 -15
- package/dist/plugins/ProgressPlugin.js +0 -69
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +0 -4
- package/dist/plugins/RuntimePublicPathPlugin.js +0 -45
- package/dist/plugins/_SamplePlugin.d.ts +0 -9
- package/dist/plugins/_SamplePlugin.js +0 -37
- package/dist/requireHook.d.ts +0 -1
- package/dist/requireHook.js +0 -49
- package/dist/schema.d.ts +0 -4
- package/dist/schema.js +0 -178
- package/dist/server/server.d.ts +0 -17
- package/dist/server/server.js +0 -223
- package/dist/server/ws.d.ts +0 -13
- package/dist/server/ws.js +0 -76
- package/dist/swcPlugins/autoCSSModules.d.ts +0 -17
- package/dist/swcPlugins/autoCSSModules.js +0 -63
- package/dist/swcPlugins/changeImportFromString.d.ts +0 -2
- package/dist/swcPlugins/changeImportFromString.js +0 -32
- package/dist/swcPlugins/lockCoreJS.d.ts +0 -6
- package/dist/swcPlugins/lockCoreJS.js +0 -56
- package/dist/types.d.ts +0 -144
- package/dist/types.js +0 -61
- package/dist/utils/browsersList.d.ts +0 -5
- package/dist/utils/browsersList.js +0 -33
- package/dist/utils/depMatch.d.ts +0 -6
- package/dist/utils/depMatch.js +0 -72
- package/dist/utils/formatWebpackMessages.d.ts +0 -12
- package/dist/utils/formatWebpackMessages.js +0 -128
- package/dist/utils/getEsBuildTarget.d.ts +0 -7
- package/dist/utils/getEsBuildTarget.js +0 -46
- package/dist/utils/pkgUpContainsName.d.ts +0 -1
- package/dist/utils/pkgUpContainsName.js +0 -50
|
@@ -1,56 +0,0 @@
|
|
|
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 });
|
|
10
|
-
};
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/swcPlugins/lockCoreJS.ts
|
|
30
|
-
var lockCoreJS_exports = {};
|
|
31
|
-
__export(lockCoreJS_exports, {
|
|
32
|
-
default: () => lockCoreJS_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(lockCoreJS_exports);
|
|
35
|
-
var import_Visitor = __toESM(require("@swc/core/Visitor"));
|
|
36
|
-
var import_utils = require("@umijs/utils");
|
|
37
|
-
var import_path = require("path");
|
|
38
|
-
var import_changeImportFromString = require("./changeImportFromString");
|
|
39
|
-
function addLastSlash(path) {
|
|
40
|
-
return path.endsWith("/") ? path : `${path}/`;
|
|
41
|
-
}
|
|
42
|
-
var LockCoreJS = class extends import_Visitor.default {
|
|
43
|
-
visitImportDeclaration(expression) {
|
|
44
|
-
const { source } = expression;
|
|
45
|
-
let { value, type } = source;
|
|
46
|
-
if (type === "StringLiteral" && value.startsWith("core-js/")) {
|
|
47
|
-
const newValue = value.replace(
|
|
48
|
-
/^core-js\//,
|
|
49
|
-
addLastSlash((0, import_utils.winPath)((0, import_path.dirname)(require.resolve("core-js/package.json"))))
|
|
50
|
-
);
|
|
51
|
-
(0, import_changeImportFromString.changeImportFromString)(expression, newValue);
|
|
52
|
-
}
|
|
53
|
-
return expression;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var lockCoreJS_default = LockCoreJS;
|
package/dist/types.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { Options as SwcConfig } from '@swc/core';
|
|
2
|
-
import type { HttpsServerOptions, ProxyOptions } from '@umijs/bundler-utils';
|
|
3
|
-
import type { TransformOptions as EsbuildOptions } from '@umijs/bundler-utils/compiled/esbuild';
|
|
4
|
-
import type { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
|
-
import webpack, { Configuration } from '../compiled/webpack';
|
|
6
|
-
import Config from '../compiled/webpack-5-chain';
|
|
7
|
-
export declare enum Env {
|
|
8
|
-
development = "development",
|
|
9
|
-
production = "production"
|
|
10
|
-
}
|
|
11
|
-
export declare enum Transpiler {
|
|
12
|
-
babel = "babel",
|
|
13
|
-
swc = "swc",
|
|
14
|
-
esbuild = "esbuild",
|
|
15
|
-
none = "none"
|
|
16
|
-
}
|
|
17
|
-
export declare enum JSMinifier {
|
|
18
|
-
terser = "terser",
|
|
19
|
-
swc = "swc",
|
|
20
|
-
esbuild = "esbuild",
|
|
21
|
-
uglifyJs = "uglifyJs",
|
|
22
|
-
none = "none"
|
|
23
|
-
}
|
|
24
|
-
export declare enum CSSMinifier {
|
|
25
|
-
esbuild = "esbuild",
|
|
26
|
-
cssnano = "cssnano",
|
|
27
|
-
parcelCSS = "parcelCSS",
|
|
28
|
-
none = "none"
|
|
29
|
-
}
|
|
30
|
-
export interface ICopy {
|
|
31
|
-
from: string;
|
|
32
|
-
to: string;
|
|
33
|
-
}
|
|
34
|
-
declare type WebpackConfig = Required<Configuration>;
|
|
35
|
-
declare type IBabelPlugin = Function | string | [string, {
|
|
36
|
-
[key: string]: any;
|
|
37
|
-
}] | [string, {
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}, string];
|
|
40
|
-
export interface DeadCodeParams {
|
|
41
|
-
patterns?: string[];
|
|
42
|
-
exclude?: string[];
|
|
43
|
-
failOnHint?: boolean;
|
|
44
|
-
detectUnusedFiles?: boolean;
|
|
45
|
-
detectUnusedExport?: boolean;
|
|
46
|
-
context?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface IConfig {
|
|
49
|
-
alias?: Record<string, string>;
|
|
50
|
-
autoCSSModules?: boolean;
|
|
51
|
-
base?: string;
|
|
52
|
-
chainWebpack?: {
|
|
53
|
-
(memo: Config, args: {
|
|
54
|
-
env: keyof typeof Env;
|
|
55
|
-
webpack: typeof webpack;
|
|
56
|
-
}): void;
|
|
57
|
-
};
|
|
58
|
-
copy?: ICopy[] | string[];
|
|
59
|
-
cssLoader?: {
|
|
60
|
-
[key: string]: any;
|
|
61
|
-
};
|
|
62
|
-
cssLoaderModules?: {
|
|
63
|
-
[key: string]: any;
|
|
64
|
-
};
|
|
65
|
-
cssMinifier?: `${CSSMinifier}`;
|
|
66
|
-
cssMinifierOptions?: {
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
};
|
|
69
|
-
define?: {
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
};
|
|
72
|
-
depTranspiler?: `${Transpiler}`;
|
|
73
|
-
devtool?: Config.DevTool;
|
|
74
|
-
deadCode?: DeadCodeParams;
|
|
75
|
-
https?: HttpsServerOptions;
|
|
76
|
-
externals?: WebpackConfig['externals'];
|
|
77
|
-
esm?: {
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
};
|
|
80
|
-
extraBabelPlugins?: IBabelPlugin[];
|
|
81
|
-
extraBabelPresets?: IBabelPlugin[];
|
|
82
|
-
extraBabelIncludes?: Array<string | RegExp>;
|
|
83
|
-
extraPostCSSPlugins?: any[];
|
|
84
|
-
hash?: boolean;
|
|
85
|
-
ignoreMomentLocale?: boolean;
|
|
86
|
-
jsMinifier?: `${JSMinifier}`;
|
|
87
|
-
jsMinifierOptions?: {
|
|
88
|
-
[key: string]: any;
|
|
89
|
-
};
|
|
90
|
-
lessLoader?: {
|
|
91
|
-
[key: string]: any;
|
|
92
|
-
};
|
|
93
|
-
normalCSSLoaderModules?: {
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
outputPath?: string;
|
|
97
|
-
postcssLoader?: {
|
|
98
|
-
[key: string]: any;
|
|
99
|
-
};
|
|
100
|
-
proxy?: {
|
|
101
|
-
[key: string]: ProxyOptions;
|
|
102
|
-
} | ProxyOptions[];
|
|
103
|
-
publicPath?: string;
|
|
104
|
-
purgeCSS?: {
|
|
105
|
-
[key: string]: any;
|
|
106
|
-
};
|
|
107
|
-
sassLoader?: {
|
|
108
|
-
[key: string]: any;
|
|
109
|
-
};
|
|
110
|
-
srcTranspiler?: `${Transpiler}`;
|
|
111
|
-
srcTranspilerOptions?: ISrcTranspilerOpts;
|
|
112
|
-
styleLoader?: {
|
|
113
|
-
[key: string]: any;
|
|
114
|
-
};
|
|
115
|
-
svgr?: {
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
};
|
|
118
|
-
svgo?: {
|
|
119
|
-
[key: string]: any;
|
|
120
|
-
} | false;
|
|
121
|
-
targets?: {
|
|
122
|
-
[key: string]: any;
|
|
123
|
-
};
|
|
124
|
-
writeToDisk?: boolean;
|
|
125
|
-
babelLoaderCustomize?: string;
|
|
126
|
-
analyze?: BundleAnalyzerPlugin.Options;
|
|
127
|
-
esbuildMinifyIIFE?: boolean;
|
|
128
|
-
checkDepCssModules?: boolean;
|
|
129
|
-
[key: string]: any;
|
|
130
|
-
}
|
|
131
|
-
export interface ISrcTranspilerOpts {
|
|
132
|
-
swc?: Partial<SwcConfig>;
|
|
133
|
-
esbuild?: Partial<EsbuildOptions>;
|
|
134
|
-
}
|
|
135
|
-
export interface ISwcPluginOpts {
|
|
136
|
-
enableAutoCssModulesPlugin?: boolean;
|
|
137
|
-
}
|
|
138
|
-
export interface SwcOptions extends SwcConfig, ISwcPluginOpts {
|
|
139
|
-
sync?: boolean;
|
|
140
|
-
parseMap?: boolean;
|
|
141
|
-
excludeFiles?: Array<string | RegExp>;
|
|
142
|
-
mergeConfigs?: Partial<SwcConfig>;
|
|
143
|
-
}
|
|
144
|
-
export {};
|
package/dist/types.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
// src/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,33 +0,0 @@
|
|
|
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
|
-
// src/utils/browsersList.ts
|
|
20
|
-
var browsersList_exports = {};
|
|
21
|
-
__export(browsersList_exports, {
|
|
22
|
-
getBrowsersList: () => getBrowsersList
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(browsersList_exports);
|
|
25
|
-
function getBrowsersList({ targets }) {
|
|
26
|
-
return targets.browsers || Object.keys(targets).map((key) => {
|
|
27
|
-
return `${key} >= ${targets[key] === true ? "0" : targets[key]}`;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
getBrowsersList
|
|
33
|
-
});
|
package/dist/utils/depMatch.d.ts
DELETED
package/dist/utils/depMatch.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
// src/utils/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 import_pkgUpContainsName = require("./pkgUpContainsName");
|
|
30
|
-
var cache = /* @__PURE__ */ new Map();
|
|
31
|
-
function cleanCache() {
|
|
32
|
-
cache.clear();
|
|
33
|
-
}
|
|
34
|
-
function isMatch(opts) {
|
|
35
|
-
const dir = (0, import_utils.winPath)((0, import_path.dirname)(opts.path));
|
|
36
|
-
if (cache.has(dir)) {
|
|
37
|
-
return !!cache.get(dir);
|
|
38
|
-
} else {
|
|
39
|
-
const pkgPath = (0, import_pkgUpContainsName.pkgUpContainsName)(opts.path);
|
|
40
|
-
let ret;
|
|
41
|
-
if (!pkgPath) {
|
|
42
|
-
ret = false;
|
|
43
|
-
} else {
|
|
44
|
-
const { name, version } = require(pkgPath);
|
|
45
|
-
if (opts.pkgs[name]) {
|
|
46
|
-
ret = opts.pkgs[name].some((v) => {
|
|
47
|
-
return import_utils.semver.satisfies(version, v);
|
|
48
|
-
});
|
|
49
|
-
} else {
|
|
50
|
-
ret = false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
cache.set(dir, ret);
|
|
54
|
-
return ret;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function es5ImcompatibleVersionsToPkg() {
|
|
58
|
-
const {
|
|
59
|
-
config: { "es5-imcompatible-versions": config }
|
|
60
|
-
} = require("es5-imcompatible-versions/package.json");
|
|
61
|
-
return Object.keys(config).reduce((memo, key) => {
|
|
62
|
-
memo[key] = /* versions */
|
|
63
|
-
Object.keys(config[key]);
|
|
64
|
-
return memo;
|
|
65
|
-
}, {});
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
cleanCache,
|
|
70
|
-
es5ImcompatibleVersionsToPkg,
|
|
71
|
-
isMatch
|
|
72
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function formatMessage(message: string | {
|
|
2
|
-
message: string;
|
|
3
|
-
} | {
|
|
4
|
-
message: string;
|
|
5
|
-
}[]): string;
|
|
6
|
-
export declare function formatWebpackMessages(json: {
|
|
7
|
-
errors: string[];
|
|
8
|
-
warnings: string[];
|
|
9
|
-
}): {
|
|
10
|
-
errors: string[];
|
|
11
|
-
warnings: string[];
|
|
12
|
-
};
|
|
@@ -1,128 +0,0 @@
|
|
|
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 });
|
|
10
|
-
};
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/utils/formatWebpackMessages.ts
|
|
30
|
-
var formatWebpackMessages_exports = {};
|
|
31
|
-
__export(formatWebpackMessages_exports, {
|
|
32
|
-
formatMessage: () => formatMessage,
|
|
33
|
-
formatWebpackMessages: () => formatWebpackMessages
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(formatWebpackMessages_exports);
|
|
36
|
-
var import_strip_ansi = __toESM(require("@umijs/utils/compiled/strip-ansi"));
|
|
37
|
-
var friendlySyntaxErrorLabel = "Syntax error:";
|
|
38
|
-
function isLikelyASyntaxError(message) {
|
|
39
|
-
return (0, import_strip_ansi.default)(message).indexOf(friendlySyntaxErrorLabel) !== -1;
|
|
40
|
-
}
|
|
41
|
-
function formatMessage(message) {
|
|
42
|
-
let lines = [];
|
|
43
|
-
if (typeof message === "string") {
|
|
44
|
-
lines = message.split("\n");
|
|
45
|
-
} else if ("message" in message) {
|
|
46
|
-
lines = message["message"].split("\n");
|
|
47
|
-
} else if (Array.isArray(message)) {
|
|
48
|
-
message.forEach((message2) => {
|
|
49
|
-
if ("message" in message2) {
|
|
50
|
-
lines = message2["message"].split("\n");
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
55
|
-
lines = lines.map((line) => {
|
|
56
|
-
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
|
|
57
|
-
line
|
|
58
|
-
);
|
|
59
|
-
if (!parsingError) {
|
|
60
|
-
return line;
|
|
61
|
-
}
|
|
62
|
-
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
63
|
-
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
64
|
-
});
|
|
65
|
-
message = lines.join("\n");
|
|
66
|
-
message = message.replace(
|
|
67
|
-
/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
|
|
68
|
-
`${friendlySyntaxErrorLabel} $3 ($1:$2)
|
|
69
|
-
`
|
|
70
|
-
);
|
|
71
|
-
message = message.replace(
|
|
72
|
-
/^.*export '(.+?)' was not found in '(.+?)'.*$/gm,
|
|
73
|
-
`Attempted import error: '$1' is not exported from '$2'.`
|
|
74
|
-
);
|
|
75
|
-
message = message.replace(
|
|
76
|
-
/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
|
|
77
|
-
`Attempted import error: '$2' does not contain a default export (imported as '$1').`
|
|
78
|
-
);
|
|
79
|
-
message = message.replace(
|
|
80
|
-
/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
|
|
81
|
-
`Attempted import error: '$1' is not exported from '$3' (imported as '$2').`
|
|
82
|
-
);
|
|
83
|
-
lines = message.split("\n");
|
|
84
|
-
if (lines.length > 2 && lines[1].trim() === "") {
|
|
85
|
-
lines.splice(1, 1);
|
|
86
|
-
}
|
|
87
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
|
|
88
|
-
if (lines[1] && lines[1].indexOf("Module not found: ") === 0) {
|
|
89
|
-
lines = [
|
|
90
|
-
lines[0],
|
|
91
|
-
lines[1].replace("Error: ", "").replace("Module not found: Cannot find file:", "Cannot find file:")
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
if (lines[1] && lines[1].match(/Cannot find module.+sass/)) {
|
|
95
|
-
lines[1] = "To import Sass files, you first need to install sass.\n";
|
|
96
|
-
lines[1] += "Run `npm install sass` or `yarn add sass` inside your workspace.";
|
|
97
|
-
}
|
|
98
|
-
message = lines.join("\n");
|
|
99
|
-
message = message.replace(
|
|
100
|
-
/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
|
|
101
|
-
""
|
|
102
|
-
);
|
|
103
|
-
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
|
|
104
|
-
lines = message.split("\n");
|
|
105
|
-
lines = lines.filter(
|
|
106
|
-
(line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
|
|
107
|
-
);
|
|
108
|
-
message = lines.join("\n");
|
|
109
|
-
return message.trim();
|
|
110
|
-
}
|
|
111
|
-
function formatWebpackMessages(json) {
|
|
112
|
-
const formattedErrors = json.errors.map(function(message) {
|
|
113
|
-
return formatMessage(message);
|
|
114
|
-
});
|
|
115
|
-
const formattedWarnings = json.warnings.map(function(message) {
|
|
116
|
-
return formatMessage(message);
|
|
117
|
-
});
|
|
118
|
-
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
119
|
-
if (result.errors.some(isLikelyASyntaxError)) {
|
|
120
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
121
|
-
}
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
-
0 && (module.exports = {
|
|
126
|
-
formatMessage,
|
|
127
|
-
formatWebpackMessages
|
|
128
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
// src/utils/getEsBuildTarget.ts
|
|
20
|
-
var getEsBuildTarget_exports = {};
|
|
21
|
-
__export(getEsBuildTarget_exports, {
|
|
22
|
-
getEsBuildTarget: () => getEsBuildTarget
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(getEsBuildTarget_exports);
|
|
25
|
-
var import_utils = require("@umijs/utils");
|
|
26
|
-
var import_constants = require("../constants");
|
|
27
|
-
var import_types = require("../types");
|
|
28
|
-
function getEsBuildTarget({ targets, jsMinifier }) {
|
|
29
|
-
if (targets["ie"] && jsMinifier === import_types.JSMinifier.esbuild) {
|
|
30
|
-
import_utils.logger.error(
|
|
31
|
-
`${import_utils.chalk.red(
|
|
32
|
-
`jsMinifier: esbuild`
|
|
33
|
-
)} is not supported when there is ie in the targets, you can use ${import_utils.chalk.green(
|
|
34
|
-
`jsMinifier: 'terser'`
|
|
35
|
-
)}`
|
|
36
|
-
);
|
|
37
|
-
throw new Error("IE is not supported");
|
|
38
|
-
}
|
|
39
|
-
return Object.keys(targets).filter((key) => import_constants.DEFAULT_ESBUILD_TARGET_KEYS.includes(key)).map((key) => {
|
|
40
|
-
return `${key}${targets[key] === true ? "0" : targets[key]}`;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
getEsBuildTarget
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function pkgUpContainsName(file: string): string | null;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 });
|
|
10
|
-
};
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/utils/pkgUpContainsName.ts
|
|
30
|
-
var pkgUpContainsName_exports = {};
|
|
31
|
-
__export(pkgUpContainsName_exports, {
|
|
32
|
-
pkgUpContainsName: () => pkgUpContainsName
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(pkgUpContainsName_exports);
|
|
35
|
-
var import_utils = require("@umijs/utils");
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
function pkgUpContainsName(file) {
|
|
38
|
-
let pkgPath = import_utils.pkgUp.pkgUpSync({ cwd: file });
|
|
39
|
-
if (!pkgPath)
|
|
40
|
-
return null;
|
|
41
|
-
const { name } = require(pkgPath);
|
|
42
|
-
if (!name) {
|
|
43
|
-
return pkgUpContainsName(import_path.default.resolve(pkgPath, "../.."));
|
|
44
|
-
}
|
|
45
|
-
return pkgPath;
|
|
46
|
-
}
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
pkgUpContainsName
|
|
50
|
-
});
|