@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,42 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
// copyPlugin.ts
|
|
20
|
+
var copyPlugin_exports = {};
|
|
21
|
+
__export(copyPlugin_exports, {
|
|
22
|
+
addCopyPlugin: () => addCopyPlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(copyPlugin_exports);
|
|
25
|
+
var import_fs = require("fs");
|
|
26
|
+
var import_path = require("path");
|
|
6
27
|
async function addCopyPlugin(opts) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
patterns: copyPatterns,
|
|
38
|
-
},
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
28
|
+
var _a;
|
|
29
|
+
const { config, userConfig, cwd } = opts;
|
|
30
|
+
const publicDir = (0, import_path.join)(cwd, "public");
|
|
31
|
+
const copyPatterns = [
|
|
32
|
+
(0, import_fs.existsSync)(publicDir) && (0, import_fs.readdirSync)(publicDir).length && {
|
|
33
|
+
from: publicDir,
|
|
34
|
+
info: { minimized: true }
|
|
35
|
+
},
|
|
36
|
+
...userConfig.copy ? (_a = userConfig.copy) == null ? void 0 : _a.map((pattern) => {
|
|
37
|
+
if (typeof pattern === "string") {
|
|
38
|
+
return {
|
|
39
|
+
from: (0, import_path.resolve)(cwd, pattern),
|
|
40
|
+
info: { minimized: true }
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
from: (0, import_path.resolve)(cwd, pattern.from),
|
|
45
|
+
to: (0, import_path.resolve)(cwd, pattern.to),
|
|
46
|
+
info: { minimized: true }
|
|
47
|
+
};
|
|
48
|
+
}) : []
|
|
49
|
+
].filter(Boolean);
|
|
50
|
+
if (copyPatterns.length) {
|
|
51
|
+
config.plugin("copy").use(require("@umijs/bundler-webpack/compiled/copy-webpack-plugin"), [
|
|
52
|
+
{
|
|
53
|
+
patterns: copyPatterns
|
|
54
|
+
}
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
41
57
|
}
|
|
42
|
-
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
addCopyPlugin
|
|
61
|
+
});
|
package/dist/config/cssRules.js
CHANGED
|
@@ -1,137 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
|
|
39
|
+
// cssRules.ts
|
|
40
|
+
var cssRules_exports = {};
|
|
41
|
+
__export(cssRules_exports, {
|
|
42
|
+
addCSSRules: () => addCSSRules
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(cssRules_exports);
|
|
45
|
+
var import_utils = require("@umijs/utils");
|
|
5
46
|
async function addCSSRules(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
const { config, userConfig } = opts;
|
|
48
|
+
const rulesConfig = [
|
|
49
|
+
{ name: "css", test: /\.css(\?.*)?$/ },
|
|
50
|
+
{
|
|
51
|
+
name: "less",
|
|
52
|
+
test: /\.less(\?.*)?$/,
|
|
53
|
+
loader: require.resolve("@umijs/bundler-webpack/compiled/less-loader"),
|
|
54
|
+
loaderOptions: {
|
|
55
|
+
implementation: require.resolve("@umijs/bundler-utils/compiled/less"),
|
|
56
|
+
lessOptions: __spreadValues({
|
|
57
|
+
modifyVars: userConfig.theme,
|
|
58
|
+
javascriptEnabled: true
|
|
59
|
+
}, userConfig.lessLoader)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "sass",
|
|
64
|
+
test: /\.(sass|scss)(\?.*)?$/,
|
|
65
|
+
loader: require.resolve("@umijs/bundler-webpack/compiled/sass-loader"),
|
|
66
|
+
loaderOptions: userConfig.sassLoader || {}
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
for (const { name, test, loader, loaderOptions } of rulesConfig) {
|
|
70
|
+
const rule = config.module.rule(name);
|
|
71
|
+
const nestRulesConfig = [
|
|
72
|
+
userConfig.autoCSSModules && {
|
|
73
|
+
rule: rule.test(test).oneOf("css-modules").resourceQuery(/modules/),
|
|
74
|
+
isCSSModules: true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
rule: rule.test(test).oneOf("css").sideEffects(true),
|
|
78
|
+
isCSSModules: false
|
|
79
|
+
}
|
|
80
|
+
].filter(Boolean);
|
|
81
|
+
for (const { rule: rule2, isCSSModules } of nestRulesConfig) {
|
|
82
|
+
if (userConfig.styleLoader) {
|
|
83
|
+
rule2.use("style-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/style-loader")).options(__spreadValues({ base: 0, esModule: true }, userConfig.styleLoader));
|
|
84
|
+
} else {
|
|
85
|
+
rule2.use("mini-css-extract-plugin").loader(require.resolve("@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader")).options({
|
|
86
|
+
publicPath: "./",
|
|
87
|
+
emit: true,
|
|
88
|
+
esModule: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
rule2.use("css-loader").loader(require.resolve("css-loader")).options(__spreadValues(__spreadValues({
|
|
92
|
+
importLoaders: 1,
|
|
93
|
+
esModule: true,
|
|
94
|
+
url: {
|
|
95
|
+
filter: (url) => {
|
|
96
|
+
if (url.startsWith("/"))
|
|
97
|
+
return false;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
27
100
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
rule
|
|
63
|
-
.use('css-loader')
|
|
64
|
-
.loader(require.resolve('css-loader'))
|
|
65
|
-
.options({
|
|
66
|
-
importLoaders: 1,
|
|
67
|
-
esModule: true,
|
|
68
|
-
url: {
|
|
69
|
-
filter: (url) => {
|
|
70
|
-
// Don't parse absolute URLs
|
|
71
|
-
// ref: https://github.com/webpack-contrib/css-loader#url
|
|
72
|
-
if (url.startsWith('/'))
|
|
73
|
-
return false;
|
|
74
|
-
return true;
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
import: true,
|
|
78
|
-
...(isCSSModules
|
|
79
|
-
? {
|
|
80
|
-
modules: {
|
|
81
|
-
localIdentName: '[local]___[hash:base64:5]',
|
|
82
|
-
...userConfig.cssLoaderModules,
|
|
83
|
-
// If SSR is enabled, we need to handling the css modules name hashing
|
|
84
|
-
// and save the class names mapping into opts.cssModulesMapping
|
|
85
|
-
// so the esbuild can use it to generate the correct name for the server side
|
|
86
|
-
getLocalIdent: userConfig.ssr &&
|
|
87
|
-
((context, localIdentName, localName, opt) => {
|
|
88
|
-
const classIdent = ((0, utils_1.winPath)(context.resourcePath).replace((0, utils_1.winPath)(ensureLastSlash(opt.context)), '') +
|
|
89
|
-
'@' +
|
|
90
|
-
localName).trim();
|
|
91
|
-
let hash = Buffer.from(classIdent)
|
|
92
|
-
.toString('base64')
|
|
93
|
-
.replace(/=/g, '');
|
|
94
|
-
hash = hash.substring(hash.length - 5);
|
|
95
|
-
const result = localIdentName
|
|
96
|
-
.replace(/\[local]/g, localName)
|
|
97
|
-
.replace(/\[hash[^\[]*?]/g, hash);
|
|
98
|
-
return result;
|
|
99
|
-
}),
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
: {}),
|
|
103
|
-
...userConfig.cssLoader,
|
|
104
|
-
});
|
|
105
|
-
rule
|
|
106
|
-
.use('postcss-loader')
|
|
107
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
|
|
108
|
-
.options({
|
|
109
|
-
postcssOptions: {
|
|
110
|
-
ident: 'postcss',
|
|
111
|
-
plugins: [
|
|
112
|
-
require('@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes'),
|
|
113
|
-
require('postcss-preset-env')({
|
|
114
|
-
browsers: opts.browsers,
|
|
115
|
-
autoprefixer: {
|
|
116
|
-
flexbox: 'no-2009',
|
|
117
|
-
...userConfig.autoprefixer,
|
|
118
|
-
},
|
|
119
|
-
stage: 3,
|
|
120
|
-
}),
|
|
121
|
-
].concat(userConfig.extraPostCSSPlugins || []),
|
|
122
|
-
...userConfig.postcssLoader,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
if (loader) {
|
|
126
|
-
rule
|
|
127
|
-
.use(loader)
|
|
128
|
-
.loader(typeof loader === 'string' ? require.resolve(loader) : loader)
|
|
129
|
-
.options(loaderOptions || {});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
101
|
+
import: true
|
|
102
|
+
}, isCSSModules ? {
|
|
103
|
+
modules: __spreadProps(__spreadValues({
|
|
104
|
+
localIdentName: "[local]___[hash:base64:5]"
|
|
105
|
+
}, userConfig.cssLoaderModules), {
|
|
106
|
+
getLocalIdent: userConfig.ssr && ((context, localIdentName, localName, opt) => {
|
|
107
|
+
const classIdent = ((0, import_utils.winPath)(context.resourcePath).replace((0, import_utils.winPath)(ensureLastSlash(opt.context)), "") + "@" + localName).trim();
|
|
108
|
+
let hash = Buffer.from(classIdent).toString("base64").replace(/=/g, "");
|
|
109
|
+
hash = hash.substring(hash.length - 5);
|
|
110
|
+
const result = localIdentName.replace(/\[local]/g, localName).replace(/\[hash[^\[]*?]/g, hash);
|
|
111
|
+
return result;
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
} : {}), userConfig.cssLoader));
|
|
115
|
+
rule2.use("postcss-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/postcss-loader")).options({
|
|
116
|
+
postcssOptions: __spreadValues({
|
|
117
|
+
ident: "postcss",
|
|
118
|
+
plugins: [
|
|
119
|
+
require("@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes"),
|
|
120
|
+
require("postcss-preset-env")({
|
|
121
|
+
browsers: opts.browsers,
|
|
122
|
+
autoprefixer: __spreadValues({
|
|
123
|
+
flexbox: "no-2009"
|
|
124
|
+
}, userConfig.autoprefixer),
|
|
125
|
+
stage: 3
|
|
126
|
+
})
|
|
127
|
+
].concat(userConfig.extraPostCSSPlugins || [])
|
|
128
|
+
}, userConfig.postcssLoader)
|
|
129
|
+
});
|
|
130
|
+
if (loader) {
|
|
131
|
+
rule2.use(loader).loader(typeof loader === "string" ? require.resolve(loader) : loader).options(loaderOptions || {});
|
|
132
|
+
}
|
|
132
133
|
}
|
|
134
|
+
}
|
|
133
135
|
}
|
|
134
|
-
exports.addCSSRules = addCSSRules;
|
|
135
136
|
function ensureLastSlash(path) {
|
|
136
|
-
|
|
137
|
+
return path.endsWith("/") ? path : path + "/";
|
|
137
138
|
}
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
addCSSRules
|
|
142
|
+
});
|
|
@@ -1,41 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// definePlugin.ts
|
|
34
|
+
var definePlugin_exports = {};
|
|
35
|
+
__export(definePlugin_exports, {
|
|
36
|
+
addDefinePlugin: () => addDefinePlugin,
|
|
37
|
+
resolveDefine: () => resolveDefine
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(definePlugin_exports);
|
|
40
|
+
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
41
|
+
var prefixRE = /^UMI_APP_/;
|
|
42
|
+
var ENV_SHOULD_PASS = ["NODE_ENV", "HMR", "SOCKET_SERVER", "ERROR_OVERLAY"];
|
|
7
43
|
function resolveDefine(opts) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
// Useful for resolving the correct path to static assets in `public`.
|
|
15
|
-
// For example, <img src={process.env.PUBLIC_PATH + '/img/logo.png'} />.
|
|
16
|
-
env.PUBLIC_PATH = opts.publicPath || '/';
|
|
17
|
-
for (const key in env) {
|
|
18
|
-
env[key] = JSON.stringify(env[key]);
|
|
44
|
+
const env = {};
|
|
45
|
+
Object.keys(process.env).forEach((key) => {
|
|
46
|
+
if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
|
|
47
|
+
env[key] = process.env[key];
|
|
19
48
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
49
|
+
});
|
|
50
|
+
env.PUBLIC_PATH = opts.publicPath || "/";
|
|
51
|
+
for (const key in env) {
|
|
52
|
+
env[key] = JSON.stringify(env[key]);
|
|
53
|
+
}
|
|
54
|
+
const define = {};
|
|
55
|
+
if (opts.define) {
|
|
56
|
+
for (const key in opts.define) {
|
|
57
|
+
define[key] = JSON.stringify(opts.define[key]);
|
|
25
58
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
59
|
+
}
|
|
60
|
+
return __spreadValues({
|
|
61
|
+
"process.env": env
|
|
62
|
+
}, define);
|
|
30
63
|
}
|
|
31
|
-
exports.resolveDefine = resolveDefine;
|
|
32
64
|
async function addDefinePlugin(opts) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
65
|
+
const { config, userConfig } = opts;
|
|
66
|
+
config.plugin("define").use(import_webpack.DefinePlugin, [
|
|
67
|
+
resolveDefine({
|
|
68
|
+
define: userConfig.define || {},
|
|
69
|
+
publicPath: userConfig.publicPath
|
|
70
|
+
})
|
|
71
|
+
]);
|
|
40
72
|
}
|
|
41
|
-
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
addDefinePlugin,
|
|
76
|
+
resolveDefine
|
|
77
|
+
});
|