@umijs/bundler-webpack 4.0.6 → 4.0.9
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/{dist → client}/client/client.d.ts +0 -0
- package/client/client/client.js +295 -194
- 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 -1
- package/dist/build.js +105 -61
- package/dist/cli.js +77 -69
- package/dist/config/_sampleFeature.js +33 -9
- package/dist/config/assetRules.js +45 -36
- package/dist/config/bundleAnalyzerPlugin.js +39 -17
- package/dist/config/compressPlugin.js +113 -95
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +204 -215
- package/dist/config/copyPlugin.js +59 -40
- package/dist/config/cssRules.js +136 -131
- package/dist/config/definePlugin.d.ts +1 -0
- package/dist/config/definePlugin.js +71 -31
- package/dist/config/detectDeadCode.js +120 -108
- package/dist/config/detectDeadCodePlugin.js +78 -63
- package/dist/config/fastRefreshPlugin.js +39 -20
- package/dist/config/forkTSCheckerPlugin.js +38 -19
- package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
- package/dist/config/ignorePlugin.js +38 -14
- package/dist/config/javaScriptRules.js +147 -173
- package/dist/config/manifestPlugin.js +51 -15
- package/dist/config/miniCSSExtractPlugin.js +42 -22
- package/dist/config/nodePolyfill.js +65 -26
- package/dist/config/nodePrefixPlugin.js +36 -12
- package/dist/config/progressPlugin.js +37 -13
- package/dist/config/purgecssWebpackPlugin.js +41 -19
- package/dist/config/speedMeasureWebpackPlugin.js +41 -20
- package/dist/config/ssrPlugin.js +83 -63
- package/dist/config/svgRules.js +74 -46
- package/dist/constants.js +57 -22
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +170 -129
- package/dist/index.js +22 -20
- package/dist/loader/svgr.js +73 -54
- package/dist/loader/swc.js +110 -69
- package/dist/parcelCSS.js +31 -27
- package/dist/plugins/ProgressPlugin.js +66 -43
- package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
- package/dist/plugins/_SamplePlugin.js +39 -14
- package/dist/requireHook.js +37 -27
- package/dist/schema.js +120 -95
- package/dist/server/server.d.ts +0 -1
- package/dist/server/server.js +214 -184
- package/dist/server/ws.d.ts +0 -2
- package/dist/server/ws.js +63 -38
- package/dist/swcPlugins/autoCSSModules.js +50 -31
- package/dist/swcPlugins/changeImportFromString.js +31 -9
- package/dist/swcPlugins/lockCoreJS.js +44 -20
- package/dist/types.d.ts +2 -1
- package/dist/types.js +61 -30
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.js +63 -39
- package/dist/utils/formatWebpackMessages.js +93 -91
- package/dist/utils/getEsBuildTarget.js +32 -10
- package/package.json +12 -16
- package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
- package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
- 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/client/client.js +0 -245
|
@@ -1,16 +1,40 @@
|
|
|
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
|
-
|
|
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
|
+
// progressPlugin.ts
|
|
23
|
+
var progressPlugin_exports = {};
|
|
24
|
+
__export(progressPlugin_exports, {
|
|
25
|
+
addProgressPlugin: () => addProgressPlugin
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(progressPlugin_exports);
|
|
28
|
+
var import_ProgressPlugin = __toESM(require("../plugins/ProgressPlugin"));
|
|
8
29
|
async function addProgressPlugin(opts) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
30
|
+
const { config, name } = opts;
|
|
31
|
+
config.plugin("progress-plugin").use(import_ProgressPlugin.default, [
|
|
32
|
+
{
|
|
33
|
+
name
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
15
36
|
}
|
|
16
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
addProgressPlugin
|
|
40
|
+
});
|
|
@@ -1,21 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
// purgecssWebpackPlugin.ts
|
|
20
|
+
var purgecssWebpackPlugin_exports = {};
|
|
21
|
+
__export(purgecssWebpackPlugin_exports, {
|
|
22
|
+
applyPurgeCSSWebpackPlugin: () => applyPurgeCSSWebpackPlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(purgecssWebpackPlugin_exports);
|
|
25
|
+
var import_types = require("../types");
|
|
5
26
|
async function applyPurgeCSSWebpackPlugin(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
27
|
+
const { config, userConfig, cwd, env } = opts;
|
|
28
|
+
config;
|
|
29
|
+
userConfig;
|
|
30
|
+
cwd;
|
|
31
|
+
env;
|
|
32
|
+
if (userConfig.purgeCSS && env === import_types.Env.production) {
|
|
33
|
+
config.plugin("purgecss-webpack-plugin").use(require("@umijs/bundler-webpack/compiled/purgecss-webpack-plugin"), [
|
|
34
|
+
{
|
|
35
|
+
paths: []
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
20
39
|
}
|
|
21
|
-
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
applyPurgeCSSWebpackPlugin
|
|
43
|
+
});
|
|
@@ -1,23 +1,44 @@
|
|
|
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
|
+
// speedMeasureWebpackPlugin.ts
|
|
23
|
+
var speedMeasureWebpackPlugin_exports = {};
|
|
24
|
+
__export(speedMeasureWebpackPlugin_exports, {
|
|
25
|
+
addSpeedMeasureWebpackPlugin: () => addSpeedMeasureWebpackPlugin
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(speedMeasureWebpackPlugin_exports);
|
|
28
|
+
var import_speed_measure_webpack_plugin = __toESM(require("@umijs/bundler-webpack/compiled/speed-measure-webpack-plugin"));
|
|
29
|
+
var import_path = require("path");
|
|
10
30
|
async function addSpeedMeasureWebpackPlugin(opts) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return webpackConfig;
|
|
31
|
+
let webpackConfig = opts.webpackConfig;
|
|
32
|
+
if (process.env.SPEED_MEASURE) {
|
|
33
|
+
const smpOption = process.env.SPEED_MEASURE === "JSON" ? {
|
|
34
|
+
outputFormat: "json",
|
|
35
|
+
outputTarget: (0, import_path.join)(process.cwd(), "SPEED_MEASURE.json")
|
|
36
|
+
} : { outputFormat: "human", outputTarget: console.log };
|
|
37
|
+
webpackConfig = new import_speed_measure_webpack_plugin.default(smpOption).wrap(webpackConfig);
|
|
38
|
+
}
|
|
39
|
+
return webpackConfig;
|
|
22
40
|
}
|
|
23
|
-
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
addSpeedMeasureWebpackPlugin
|
|
44
|
+
});
|
package/dist/config/ssrPlugin.js
CHANGED
|
@@ -1,66 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const assetsSource = JSON.stringify({
|
|
46
|
-
assets: Object.fromEntries(this.manifest),
|
|
47
|
-
}, null, 2);
|
|
48
|
-
if (process.env.NODE_ENV === 'production' ||
|
|
49
|
-
this.opts.userConfig.writeToDisk) {
|
|
50
|
-
compilation.emitAsset('build-manifest.json', new webpack_1.sources.RawSource(assetsSource, false));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const outputPath = compiler.options.output.path;
|
|
54
|
-
utils_1.fsExtra.mkdirpSync(outputPath);
|
|
55
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(outputPath, 'build-manifest.json'), assetsSource, 'utf-8');
|
|
56
|
-
}
|
|
57
|
-
});
|
|
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
|
+
// ssrPlugin.ts
|
|
20
|
+
var ssrPlugin_exports = {};
|
|
21
|
+
__export(ssrPlugin_exports, {
|
|
22
|
+
default: () => addSSRPlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ssrPlugin_exports);
|
|
25
|
+
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
26
|
+
var import_utils = require("@umijs/utils");
|
|
27
|
+
var import_fs = require("fs");
|
|
28
|
+
var import_path = require("path");
|
|
29
|
+
var import_constants = require("../constants");
|
|
30
|
+
var PLUGIN_NAME = "SSR_PLUGIN";
|
|
31
|
+
var SSRPlugin = class {
|
|
32
|
+
constructor(opts) {
|
|
33
|
+
this.opts = opts;
|
|
34
|
+
this.manifest = /* @__PURE__ */ new Map();
|
|
35
|
+
}
|
|
36
|
+
apply(compiler) {
|
|
37
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
38
|
+
compilation.hooks.processAssets.tap(PLUGIN_NAME, () => {
|
|
39
|
+
const publicPath = compiler.options.output.publicPath || "/";
|
|
40
|
+
const assets = compilation.getAssets().filter((asset) => {
|
|
41
|
+
if (asset.info.hotModuleReplacement) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
58
45
|
});
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
assets.forEach((asset) => {
|
|
47
|
+
if (asset.info.sourceFilename) {
|
|
48
|
+
this.manifest.set(asset.info.sourceFilename, publicPath + asset.name);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const stats = compilation.getStats().toJson({
|
|
52
|
+
all: false,
|
|
53
|
+
assets: true,
|
|
54
|
+
cachedAssets: true,
|
|
55
|
+
cachedModules: true
|
|
56
|
+
});
|
|
57
|
+
const { assetsByChunkName } = stats;
|
|
58
|
+
Object.keys(assetsByChunkName).forEach((chunkName) => {
|
|
59
|
+
assetsByChunkName[chunkName].forEach((filename) => {
|
|
60
|
+
const ext = (0, import_path.extname)(filename.split(/[?#]/)[0]);
|
|
61
|
+
if (!filename.includes(".hot-update.")) {
|
|
62
|
+
this.manifest.set(chunkName + ext, publicPath + filename);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const assetsSource = JSON.stringify({
|
|
67
|
+
assets: Object.fromEntries(this.manifest)
|
|
68
|
+
}, null, 2);
|
|
69
|
+
if (process.env.NODE_ENV === "production" || this.opts.userConfig.writeToDisk) {
|
|
70
|
+
compilation.emitAsset("build-manifest.json", new import_webpack.sources.RawSource(assetsSource, false));
|
|
71
|
+
} else {
|
|
72
|
+
const outputPath = compiler.options.output.path;
|
|
73
|
+
import_utils.fsExtra.mkdirpSync(outputPath);
|
|
74
|
+
(0, import_fs.writeFileSync)((0, import_path.join)(outputPath, "build-manifest.json"), assetsSource, "utf-8");
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
61
80
|
function addSSRPlugin(opts) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
81
|
+
if (opts.userConfig.ssr && opts.name !== import_constants.MFSU_NAME) {
|
|
82
|
+
opts.config.plugin("ssr-plugin").use(SSRPlugin, [opts]);
|
|
83
|
+
}
|
|
65
84
|
}
|
|
66
|
-
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {});
|
package/dist/config/svgRules.js
CHANGED
|
@@ -1,48 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
params: {
|
|
21
|
-
overrides: {
|
|
22
|
-
removeTitle: false,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
'prefixIds',
|
|
27
|
-
],
|
|
28
|
-
...svgo,
|
|
29
|
-
},
|
|
30
|
-
...svgr,
|
|
31
|
-
svgo: !!svgo,
|
|
32
|
-
})
|
|
33
|
-
.end()
|
|
34
|
-
.use('url-loader')
|
|
35
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'))
|
|
36
|
-
.end();
|
|
37
|
-
}
|
|
38
|
-
if (svgo !== false) {
|
|
39
|
-
const svgRule = config.module.rule('svg');
|
|
40
|
-
svgRule
|
|
41
|
-
.test(/\.svg$/)
|
|
42
|
-
.use('svgo-loader')
|
|
43
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/svgo-loader'))
|
|
44
|
-
.options({ configFile: false, ...svgo })
|
|
45
|
-
.end();
|
|
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]);
|
|
46
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
|
+
// svgRules.ts
|
|
40
|
+
var svgRules_exports = {};
|
|
41
|
+
__export(svgRules_exports, {
|
|
42
|
+
addSVGRules: () => addSVGRules
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(svgRules_exports);
|
|
45
|
+
async function addSVGRules(opts) {
|
|
46
|
+
const { config, userConfig } = opts;
|
|
47
|
+
const { svgr, svgo = {} } = userConfig;
|
|
48
|
+
if (svgr) {
|
|
49
|
+
const svgrRule = config.module.rule("svgr");
|
|
50
|
+
svgrRule.test(/\.svg$/).issuer(/\.[jt]sx?$/).type("javascript/auto").use("svgr-loader").loader(require.resolve("../loader/svgr")).options(__spreadProps(__spreadValues({
|
|
51
|
+
svgoConfig: __spreadValues({
|
|
52
|
+
plugins: [
|
|
53
|
+
{
|
|
54
|
+
name: "preset-default",
|
|
55
|
+
params: {
|
|
56
|
+
overrides: {
|
|
57
|
+
removeTitle: false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"prefixIds"
|
|
62
|
+
]
|
|
63
|
+
}, svgo)
|
|
64
|
+
}, svgr), {
|
|
65
|
+
svgo: !!svgo
|
|
66
|
+
})).end().use("url-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/url-loader")).end();
|
|
67
|
+
}
|
|
68
|
+
if (svgo !== false) {
|
|
69
|
+
const svgRule = config.module.rule("svg");
|
|
70
|
+
svgRule.test(/\.svg$/).use("svgo-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/svgo-loader")).options(__spreadValues({ configFile: false }, svgo)).end();
|
|
71
|
+
}
|
|
47
72
|
}
|
|
48
|
-
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
addSVGRules
|
|
76
|
+
});
|
package/dist/constants.js
CHANGED
|
@@ -1,24 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(function (MESSAGE_TYPE) {
|
|
9
|
-
MESSAGE_TYPE["ok"] = "ok";
|
|
10
|
-
MESSAGE_TYPE["warnings"] = "warnings";
|
|
11
|
-
MESSAGE_TYPE["errors"] = "errors";
|
|
12
|
-
MESSAGE_TYPE["hash"] = "hash";
|
|
13
|
-
MESSAGE_TYPE["stillOk"] = "still-ok";
|
|
14
|
-
MESSAGE_TYPE["invalid"] = "invalid";
|
|
15
|
-
})(MESSAGE_TYPE = exports.MESSAGE_TYPE || (exports.MESSAGE_TYPE = {}));
|
|
16
|
-
exports.DEFAULT_BROWSER_TARGETS = {
|
|
17
|
-
chrome: 80,
|
|
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 });
|
|
18
8
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
// constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
DEFAULT_BROWSER_TARGETS: () => DEFAULT_BROWSER_TARGETS,
|
|
23
|
+
DEFAULT_DEVTOOL: () => DEFAULT_DEVTOOL,
|
|
24
|
+
DEFAULT_ESBUILD_TARGET_KEYS: () => DEFAULT_ESBUILD_TARGET_KEYS,
|
|
25
|
+
DEFAULT_OUTPUT_PATH: () => DEFAULT_OUTPUT_PATH,
|
|
26
|
+
MESSAGE_TYPE: () => MESSAGE_TYPE,
|
|
27
|
+
MFSU_NAME: () => MFSU_NAME
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(constants_exports);
|
|
30
|
+
var DEFAULT_DEVTOOL = "cheap-module-source-map";
|
|
31
|
+
var DEFAULT_OUTPUT_PATH = "dist";
|
|
32
|
+
var MFSU_NAME = "MFSU";
|
|
33
|
+
var MESSAGE_TYPE = /* @__PURE__ */ ((MESSAGE_TYPE2) => {
|
|
34
|
+
MESSAGE_TYPE2["ok"] = "ok";
|
|
35
|
+
MESSAGE_TYPE2["warnings"] = "warnings";
|
|
36
|
+
MESSAGE_TYPE2["errors"] = "errors";
|
|
37
|
+
MESSAGE_TYPE2["hash"] = "hash";
|
|
38
|
+
MESSAGE_TYPE2["stillOk"] = "still-ok";
|
|
39
|
+
MESSAGE_TYPE2["invalid"] = "invalid";
|
|
40
|
+
return MESSAGE_TYPE2;
|
|
41
|
+
})(MESSAGE_TYPE || {});
|
|
42
|
+
var DEFAULT_BROWSER_TARGETS = {
|
|
43
|
+
chrome: 80
|
|
44
|
+
};
|
|
45
|
+
var DEFAULT_ESBUILD_TARGET_KEYS = [
|
|
46
|
+
"chrome",
|
|
47
|
+
"firefox",
|
|
48
|
+
"edge",
|
|
49
|
+
"safari"
|
|
24
50
|
];
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
DEFAULT_BROWSER_TARGETS,
|
|
54
|
+
DEFAULT_DEVTOOL,
|
|
55
|
+
DEFAULT_ESBUILD_TARGET_KEYS,
|
|
56
|
+
DEFAULT_OUTPUT_PATH,
|
|
57
|
+
MESSAGE_TYPE,
|
|
58
|
+
MFSU_NAME
|
|
59
|
+
});
|
package/dist/dev.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare type IOpts = {
|
|
|
22
22
|
mfsuStrategy?: 'eager' | 'normal';
|
|
23
23
|
mfsuInclude?: string[];
|
|
24
24
|
srcCodeCache?: any;
|
|
25
|
-
} & Pick<IConfigOpts, 'cache'>;
|
|
25
|
+
} & Pick<IConfigOpts, 'cache' | 'pkg'>;
|
|
26
26
|
export declare function stripUndefined(obj: any): any;
|
|
27
27
|
export declare function dev(opts: IOpts): Promise<void>;
|
|
28
28
|
export {};
|