@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
package/dist/dev.js
CHANGED
|
@@ -1,143 +1,178 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
35
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
// dev.ts
|
|
40
|
+
var dev_exports = {};
|
|
41
|
+
__export(dev_exports, {
|
|
42
|
+
dev: () => dev,
|
|
43
|
+
stripUndefined: () => stripUndefined
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(dev_exports);
|
|
46
|
+
var import_mfsu = require("@umijs/mfsu");
|
|
47
|
+
var import_utils = require("@umijs/utils");
|
|
48
|
+
var import_fs = require("fs");
|
|
49
|
+
var import_path = require("path");
|
|
50
|
+
var import_webpack = __toESM(require("../compiled/webpack"));
|
|
51
|
+
var import_config = require("./config/config");
|
|
52
|
+
var import_constants = require("./constants");
|
|
53
|
+
var import_server = require("./server/server");
|
|
54
|
+
var import_types = require("./types");
|
|
16
55
|
function stripUndefined(obj) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
56
|
+
Object.keys(obj).forEach((key) => {
|
|
57
|
+
if (obj[key] === void 0) {
|
|
58
|
+
delete obj[key];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return obj;
|
|
23
62
|
}
|
|
24
|
-
exports.stripUndefined = stripUndefined;
|
|
25
63
|
async function dev(opts) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
utils_1.logger.warn(`Swc currently not supported for use with mfsu, recommended you use srcTranspiler: 'esbuild' in dev.`);
|
|
34
|
-
}
|
|
35
|
-
mfsu = new mfsu_1.MFSU({
|
|
36
|
-
strategy: opts.mfsuStrategy,
|
|
37
|
-
include: opts.mfsuInclude || [],
|
|
38
|
-
srcCodeCache: opts.srcCodeCache,
|
|
39
|
-
implementor: webpack_1.default,
|
|
40
|
-
buildDepWithESBuild: (_a = opts.config.mfsu) === null || _a === void 0 ? void 0 : _a.esbuild,
|
|
41
|
-
depBuildConfig: {
|
|
42
|
-
extraPostCSSPlugins: ((_b = opts.config) === null || _b === void 0 ? void 0 : _b.extraPostCSSPlugins) || [],
|
|
43
|
-
},
|
|
44
|
-
mfName: (_c = opts.config.mfsu) === null || _c === void 0 ? void 0 : _c.mfName,
|
|
45
|
-
runtimePublicPath: opts.config.runtimePublicPath,
|
|
46
|
-
tmpBase: ((_d = opts.config.mfsu) === null || _d === void 0 ? void 0 : _d.cacheDirectory) || (0, path_1.join)(cacheDirectoryPath, 'mfsu'),
|
|
47
|
-
onMFSUProgress: opts.onMFSUProgress,
|
|
48
|
-
unMatchLibs: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.exclude,
|
|
49
|
-
getCacheDependency() {
|
|
50
|
-
return stripUndefined({
|
|
51
|
-
version: require('../package.json').version,
|
|
52
|
-
mfsu: opts.config.mfsu,
|
|
53
|
-
alias: opts.config.alias,
|
|
54
|
-
externals: opts.config.externals,
|
|
55
|
-
theme: opts.config.theme,
|
|
56
|
-
runtimePublicPath: opts.config.runtimePublicPath,
|
|
57
|
-
publicPath: opts.config.publicPath,
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
});
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
65
|
+
const cacheDirectoryPath = (0, import_path.resolve)(opts.rootDir || opts.cwd, opts.config.cacheDirectoryPath || "node_modules/.cache");
|
|
66
|
+
const enableMFSU = opts.config.mfsu !== false;
|
|
67
|
+
let mfsu = null;
|
|
68
|
+
if (enableMFSU) {
|
|
69
|
+
if (opts.config.srcTranspiler === import_types.Transpiler.swc) {
|
|
70
|
+
import_utils.logger.warn(`Swc currently not supported for use with mfsu, recommended you use srcTranspiler: 'esbuild' in dev.`);
|
|
61
71
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
cacheDirectory: (0, path_1.join)(cacheDirectoryPath, 'bundler-webpack'),
|
|
88
|
-
}
|
|
89
|
-
: undefined,
|
|
90
|
-
});
|
|
91
|
-
const depConfig = await (0, config_1.getConfig)({
|
|
92
|
-
cwd: opts.cwd,
|
|
93
|
-
rootDir: opts.rootDir,
|
|
94
|
-
env: types_1.Env.development,
|
|
95
|
-
entry: opts.entry,
|
|
96
|
-
userConfig: opts.config,
|
|
97
|
-
hash: true,
|
|
98
|
-
staticPathPrefix: mfsu_1.MF_DEP_PREFIX,
|
|
99
|
-
name: constants_1.MFSU_NAME,
|
|
100
|
-
chainWebpack: (_f = opts.config.mfsu) === null || _f === void 0 ? void 0 : _f.chainWebpack,
|
|
101
|
-
cache: {
|
|
102
|
-
buildDependencies: (_g = opts.cache) === null || _g === void 0 ? void 0 : _g.buildDependencies,
|
|
103
|
-
cacheDirectory: (0, path_1.join)(cacheDirectoryPath, 'mfsu-deps'),
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
(_h = webpackConfig.resolve).alias || (_h.alias = {});
|
|
107
|
-
// TODO: REMOVE ME
|
|
108
|
-
['@umijs/utils/compiled/strip-ansi', 'react-error-overlay'].forEach((dep) => {
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
webpackConfig.resolve.alias[dep] = require.resolve(dep);
|
|
72
|
+
mfsu = new import_mfsu.MFSU({
|
|
73
|
+
strategy: opts.mfsuStrategy,
|
|
74
|
+
include: opts.mfsuInclude || [],
|
|
75
|
+
srcCodeCache: opts.srcCodeCache,
|
|
76
|
+
implementor: import_webpack.default,
|
|
77
|
+
buildDepWithESBuild: (_a = opts.config.mfsu) == null ? void 0 : _a.esbuild,
|
|
78
|
+
depBuildConfig: {
|
|
79
|
+
extraPostCSSPlugins: ((_b = opts.config) == null ? void 0 : _b.extraPostCSSPlugins) || []
|
|
80
|
+
},
|
|
81
|
+
mfName: (_c = opts.config.mfsu) == null ? void 0 : _c.mfName,
|
|
82
|
+
runtimePublicPath: opts.config.runtimePublicPath,
|
|
83
|
+
tmpBase: ((_d = opts.config.mfsu) == null ? void 0 : _d.cacheDirectory) || (0, import_path.join)(cacheDirectoryPath, "mfsu"),
|
|
84
|
+
onMFSUProgress: opts.onMFSUProgress,
|
|
85
|
+
unMatchLibs: (_e = opts.config.mfsu) == null ? void 0 : _e.exclude,
|
|
86
|
+
getCacheDependency() {
|
|
87
|
+
return stripUndefined({
|
|
88
|
+
version: require("../package.json").version,
|
|
89
|
+
mfsu: opts.config.mfsu,
|
|
90
|
+
alias: opts.config.alias,
|
|
91
|
+
externals: opts.config.externals,
|
|
92
|
+
theme: opts.config.theme,
|
|
93
|
+
runtimePublicPath: opts.config.runtimePublicPath,
|
|
94
|
+
publicPath: opts.config.publicPath
|
|
95
|
+
});
|
|
96
|
+
}
|
|
111
97
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
98
|
+
}
|
|
99
|
+
const webpackConfig = await (0, import_config.getConfig)({
|
|
100
|
+
cwd: opts.cwd,
|
|
101
|
+
rootDir: opts.rootDir,
|
|
102
|
+
env: import_types.Env.development,
|
|
103
|
+
entry: opts.entry,
|
|
104
|
+
userConfig: opts.config,
|
|
105
|
+
babelPreset: opts.babelPreset,
|
|
106
|
+
extraBabelPlugins: [
|
|
107
|
+
...opts.beforeBabelPlugins || [],
|
|
108
|
+
...(mfsu == null ? void 0 : mfsu.getBabelPlugins()) || [],
|
|
109
|
+
...opts.extraBabelPlugins || []
|
|
110
|
+
],
|
|
111
|
+
extraBabelPresets: [
|
|
112
|
+
...opts.beforeBabelPresets || [],
|
|
113
|
+
...opts.extraBabelPresets || []
|
|
114
|
+
],
|
|
115
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
116
|
+
extraEsbuildLoaderHandler: (mfsu == null ? void 0 : mfsu.getEsbuildLoaderHandler()) || [],
|
|
117
|
+
chainWebpack: opts.chainWebpack,
|
|
118
|
+
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
119
|
+
hmr: process.env.HMR !== "none",
|
|
120
|
+
analyze: process.env.ANALYZE,
|
|
121
|
+
cache: opts.cache ? __spreadProps(__spreadValues({}, opts.cache), {
|
|
122
|
+
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "bundler-webpack")
|
|
123
|
+
}) : void 0,
|
|
124
|
+
pkg: opts.pkg
|
|
125
|
+
});
|
|
126
|
+
const depConfig = await (0, import_config.getConfig)({
|
|
127
|
+
cwd: opts.cwd,
|
|
128
|
+
rootDir: opts.rootDir,
|
|
129
|
+
env: import_types.Env.development,
|
|
130
|
+
entry: opts.entry,
|
|
131
|
+
userConfig: opts.config,
|
|
132
|
+
hash: true,
|
|
133
|
+
staticPathPrefix: import_mfsu.MF_DEP_PREFIX,
|
|
134
|
+
name: import_constants.MFSU_NAME,
|
|
135
|
+
chainWebpack: (_f = opts.config.mfsu) == null ? void 0 : _f.chainWebpack,
|
|
136
|
+
cache: {
|
|
137
|
+
buildDependencies: (_g = opts.cache) == null ? void 0 : _g.buildDependencies,
|
|
138
|
+
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
139
|
+
},
|
|
140
|
+
pkg: opts.pkg
|
|
141
|
+
});
|
|
142
|
+
(_h = webpackConfig.resolve).alias || (_h.alias = {});
|
|
143
|
+
["@umijs/utils/compiled/strip-ansi", "react-error-overlay"].forEach((dep) => {
|
|
144
|
+
webpackConfig.resolve.alias[dep] = require.resolve(dep);
|
|
145
|
+
});
|
|
146
|
+
await (mfsu == null ? void 0 : mfsu.setWebpackConfig({
|
|
147
|
+
config: webpackConfig,
|
|
148
|
+
depConfig
|
|
149
|
+
}));
|
|
150
|
+
if (mfsu && webpackConfig.cache && typeof webpackConfig.cache === "object" && webpackConfig.cache.type === "filesystem") {
|
|
151
|
+
const webpackCachePath = (0, import_path.join)(webpackConfig.cache.cacheDirectory, `default-development`, "index.pack");
|
|
152
|
+
const mfsuCacheExists = (0, import_fs.existsSync)(mfsu.getCacheFilePath());
|
|
153
|
+
const webpackCacheExists = (0, import_fs.existsSync)(webpackCachePath);
|
|
154
|
+
if (webpackCacheExists && !mfsuCacheExists) {
|
|
155
|
+
import_utils.logger.warn(`Invalidate webpack cache since mfsu cache is missing`);
|
|
156
|
+
import_utils.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
127
157
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
158
|
+
}
|
|
159
|
+
await (0, import_server.createServer)({
|
|
160
|
+
webpackConfig,
|
|
161
|
+
userConfig: opts.config,
|
|
162
|
+
cwd: opts.cwd,
|
|
163
|
+
beforeMiddlewares: [
|
|
164
|
+
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
165
|
+
...opts.beforeMiddlewares || []
|
|
166
|
+
],
|
|
167
|
+
port: opts.port,
|
|
168
|
+
host: opts.host,
|
|
169
|
+
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
170
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
171
|
+
onProgress: opts.onProgress
|
|
172
|
+
});
|
|
142
173
|
}
|
|
143
|
-
|
|
174
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
175
|
+
0 && (module.exports = {
|
|
176
|
+
dev,
|
|
177
|
+
stripUndefined
|
|
178
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
var import_requireHook = require("./requireHook");
|
|
20
|
+
__reExport(src_exports, require("./build"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./config/config"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./dev"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./schema"), module.exports);
|
package/dist/loader/svgr.d.ts
CHANGED
package/dist/loader/svgr.js
CHANGED
|
@@ -1,58 +1,77 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
// svgr.ts
|
|
23
|
+
var svgr_exports = {};
|
|
24
|
+
__export(svgr_exports, {
|
|
25
|
+
default: () => svgr_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(svgr_exports);
|
|
28
|
+
var import_core = require("@svgr/core");
|
|
29
|
+
var import_plugin_jsx = __toESM(require("@svgr/plugin-jsx"));
|
|
30
|
+
var import_plugin_svgo = __toESM(require("@svgr/plugin-svgo"));
|
|
31
|
+
var import_esbuild = require("@umijs/bundler-utils/compiled/esbuild");
|
|
32
|
+
var import_path = require("path");
|
|
33
|
+
var import_util = require("util");
|
|
34
|
+
var tranformSvg = (0, import_util.callbackify)(async (contents, options, state) => {
|
|
35
|
+
const jsCode = await (0, import_core.transform)(contents, options, state);
|
|
36
|
+
const result = await (0, import_esbuild.transform)(jsCode, {
|
|
37
|
+
loader: "tsx",
|
|
38
|
+
target: "es2015"
|
|
39
|
+
});
|
|
40
|
+
if (!(result == null ? void 0 : result.code)) {
|
|
41
|
+
throw new Error(`Error while transforming using Esbuild`);
|
|
42
|
+
}
|
|
43
|
+
return result.code;
|
|
26
44
|
});
|
|
27
45
|
function svgrLoader(contents) {
|
|
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
|
-
}
|
|
46
|
+
this.cacheable && this.cacheable();
|
|
47
|
+
const callback = this.async();
|
|
48
|
+
const options = this.getOptions();
|
|
49
|
+
const previousExport = (() => {
|
|
50
|
+
if (contents.startsWith("export "))
|
|
51
|
+
return contents;
|
|
52
|
+
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
53
|
+
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
54
|
+
})();
|
|
55
|
+
const state = {
|
|
56
|
+
caller: {
|
|
57
|
+
name: "svgr-loader",
|
|
58
|
+
previousExport,
|
|
59
|
+
defaultPlugins: [import_plugin_svgo.default, import_plugin_jsx.default]
|
|
60
|
+
},
|
|
61
|
+
filePath: (0, import_path.normalize)(this.resourcePath)
|
|
62
|
+
};
|
|
63
|
+
if (!previousExport) {
|
|
64
|
+
tranformSvg(contents, options, state, callback);
|
|
65
|
+
} else {
|
|
66
|
+
this.fs.readFile(this.resourcePath, (err, result) => {
|
|
67
|
+
if (err) {
|
|
68
|
+
callback(err);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
tranformSvg(String(result), options, state, callback);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
57
74
|
}
|
|
58
|
-
|
|
75
|
+
var svgr_default = svgrLoader;
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {});
|
package/dist/loader/swc.d.ts
CHANGED