@umijs/bundler-webpack 4.0.50 → 4.0.52
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.js +33 -71
- package/compiled/webpack/BasicEvaluatedExpression.js +1 -0
- package/compiled/webpack/ExternalsPlugin.js +1 -0
- package/compiled/webpack/FetchCompileAsyncWasmPlugin.js +1 -0
- package/compiled/webpack/FetchCompileWasmPlugin.js +1 -0
- package/compiled/webpack/LimitChunkCountPlugin.js +1 -0
- package/compiled/webpack/NodeTargetPlugin.js +1 -0
- package/compiled/webpack/NodeTemplatePlugin.js +1 -0
- package/compiled/webpack/StringXor.js +1 -0
- package/compiled/webpack/WebWorkerTemplatePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +10 -1
- package/compiled/webpack/index.js +2796 -2728
- package/compiled/webpack/package.json +5 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.js +22 -5
- package/dist/cli.js +4 -0
- package/dist/config/bundleAnalyzerPlugin.js +1 -0
- package/dist/config/compressPlugin.js +5 -0
- package/dist/config/config.js +10 -2
- package/dist/config/copyPlugin.js +2 -0
- package/dist/config/cssRules.js +7 -0
- package/dist/config/detectDeadCode.js +4 -0
- package/dist/config/detectDeadCodePlugin.js +4 -0
- package/dist/config/fastRefreshPlugin.js +4 -0
- package/dist/config/forkTSCheckerPlugin.js +4 -0
- package/dist/config/javaScriptRules.js +19 -0
- package/dist/config/miniCSSExtractPlugin.js +8 -1
- package/dist/config/progressPlugin.js +4 -0
- package/dist/config/speedMeasureWebpackPlugin.js +4 -0
- package/dist/config/svgRules.js +4 -0
- package/dist/dev.d.ts +6 -0
- package/dist/dev.js +31 -18
- package/dist/loader/svgr.js +4 -0
- package/dist/loader/swc.js +7 -0
- package/dist/parcelCSS.d.ts +1 -1
- package/dist/parcelCSS.js +5 -1
- package/dist/requireHook.js +4 -0
- package/dist/schema.js +1 -0
- package/dist/server/server.js +6 -0
- package/dist/server/ws.d.ts +1 -1
- package/dist/server/ws.js +4 -0
- package/dist/swcPlugins/autoCSSModules.js +9 -0
- package/dist/swcPlugins/lockCoreJS.js +4 -0
- package/dist/utils/depMatch.js +2 -1
- package/dist/utils/formatWebpackMessages.js +4 -0
- package/package.json +6 -6
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -69,13 +73,16 @@ async function build(opts) {
|
|
|
69
73
|
import_utils.rimraf.sync(webpackConfig.output.path);
|
|
70
74
|
}
|
|
71
75
|
const compiler = (0, import_webpack.default)(webpackConfig);
|
|
72
|
-
|
|
76
|
+
let closeWatching;
|
|
77
|
+
const handler = (err, stats) => {
|
|
73
78
|
var _a;
|
|
74
79
|
(_a = opts.onBuildComplete) == null ? void 0 : _a.call(opts, {
|
|
75
80
|
err,
|
|
76
81
|
stats,
|
|
77
82
|
isFirstCompile,
|
|
78
|
-
time: stats ? stats.endTime - stats.startTime : null
|
|
83
|
+
time: stats ? stats.endTime - stats.startTime : null,
|
|
84
|
+
// pass close function to close watching
|
|
85
|
+
...opts.watch ? { close: closeWatching } : {}
|
|
79
86
|
});
|
|
80
87
|
isFirstCompile = false;
|
|
81
88
|
if (err || (stats == null ? void 0 : stats.hasErrors())) {
|
|
@@ -89,9 +96,19 @@ async function build(opts) {
|
|
|
89
96
|
} else {
|
|
90
97
|
resolve2(stats);
|
|
91
98
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
if (!opts.watch)
|
|
100
|
+
compiler.close(() => {
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
if (opts.watch) {
|
|
104
|
+
const watching = compiler.watch(
|
|
105
|
+
webpackConfig.watchOptions || {},
|
|
106
|
+
handler
|
|
107
|
+
);
|
|
108
|
+
closeWatching = watching.close.bind(watching);
|
|
109
|
+
} else {
|
|
110
|
+
compiler.run(handler);
|
|
111
|
+
}
|
|
95
112
|
});
|
|
96
113
|
}
|
|
97
114
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
return to;
|
|
14
14
|
};
|
|
15
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
16
20
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
17
21
|
mod
|
|
18
22
|
));
|
|
@@ -26,6 +26,7 @@ var import_webpack_bundle_analyzer = require("@umijs/bundler-webpack/compiled/we
|
|
|
26
26
|
async function addBundleAnalyzerPlugin(opts) {
|
|
27
27
|
const { config } = opts;
|
|
28
28
|
config.plugin("webpack-bundle-analyzer").use(import_webpack_bundle_analyzer.BundleAnalyzerPlugin, [
|
|
29
|
+
// https://github.com/webpack-contrib/webpack-bundle-analyzer
|
|
29
30
|
{
|
|
30
31
|
analyzerMode: "server",
|
|
31
32
|
analyzerPort: process.env.ANALYZE_PORT || 8888,
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -54,6 +58,7 @@ async function addCompressPlugin(opts) {
|
|
|
54
58
|
minify = import_terser_webpack_plugin.default.esbuildMinify;
|
|
55
59
|
terserOptions = {
|
|
56
60
|
target: esbuildTarget,
|
|
61
|
+
// remove all comments
|
|
57
62
|
legalComments: "none"
|
|
58
63
|
};
|
|
59
64
|
} else if (jsMinifier === import_types.JSMinifier.terser) {
|
package/dist/config/config.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -153,14 +157,18 @@ async function getConfig(opts) {
|
|
|
153
157
|
buildDependencies: {
|
|
154
158
|
config: opts.cache.buildDependencies || []
|
|
155
159
|
},
|
|
156
|
-
cacheDirectory: opts.cache.cacheDirectory ||
|
|
160
|
+
cacheDirectory: opts.cache.cacheDirectory || // 使用 rootDir 是在有 APP_ROOT 时,把 cache 目录放在根目录下
|
|
161
|
+
(0, import_path.join)(
|
|
157
162
|
opts.rootDir || opts.cwd,
|
|
158
163
|
"node_modules",
|
|
159
164
|
".cache",
|
|
160
165
|
"bundler-webpack"
|
|
161
166
|
)
|
|
162
167
|
});
|
|
163
|
-
if (
|
|
168
|
+
if (
|
|
169
|
+
/*isTnpm*/
|
|
170
|
+
require("@umijs/utils/package").__npminstall_done
|
|
171
|
+
) {
|
|
164
172
|
const nodeModulesPath = opts.cache.absNodeModulesPath || (0, import_path.join)(opts.rootDir || opts.cwd, "node_modules");
|
|
165
173
|
const localLinkedNodeModules = Object.keys(
|
|
166
174
|
Object.assign(
|
|
@@ -31,6 +31,8 @@ async function addCopyPlugin(opts) {
|
|
|
31
31
|
const copyPatterns = [
|
|
32
32
|
(0, import_fs.existsSync)(publicDir) && (0, import_fs.readdirSync)(publicDir).length && {
|
|
33
33
|
from: publicDir,
|
|
34
|
+
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
|
35
|
+
// Set minimized so terser will not do minimize
|
|
34
36
|
info: { minimized: true }
|
|
35
37
|
},
|
|
36
38
|
...userConfig.copy ? (_a = userConfig.copy) == null ? void 0 : _a.map((pattern) => {
|
package/dist/config/cssRules.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -94,6 +98,9 @@ async function addCSSRules(opts) {
|
|
|
94
98
|
modules: {
|
|
95
99
|
localIdentName: "[local]___[hash:base64:5]",
|
|
96
100
|
...userConfig.cssLoaderModules,
|
|
101
|
+
// If SSR is enabled, we need to handling the css modules name hashing
|
|
102
|
+
// and save the class names mapping into opts.cssModulesMapping
|
|
103
|
+
// so the esbuild can use it to generate the correct name for the server side
|
|
97
104
|
getLocalIdent: userConfig.ssr && ((context, localIdentName, localName, opt) => {
|
|
98
105
|
const classIdent = ((0, import_utils.winPath)(context.resourcePath).replace(
|
|
99
106
|
(0, import_utils.winPath)(ensureLastSlash(opt.context)),
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -44,10 +48,13 @@ async function addJavaScriptRules(opts) {
|
|
|
44
48
|
const srcRules = [
|
|
45
49
|
config.module.rule("src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
46
50
|
cwd,
|
|
51
|
+
// import module out of cwd using APP_ROOT
|
|
52
|
+
// issue: https://github.com/umijs/umi/issues/5594
|
|
47
53
|
...process.env.APP_ROOT ? [process.cwd()] : []
|
|
48
54
|
]).end().exclude.add(/node_modules/).end(),
|
|
49
55
|
config.module.rule("jsx-ts-tsx").test(/\.(jsx|ts|tsx)$/),
|
|
50
56
|
config.module.rule("extra-src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
57
|
+
// support extraBabelIncludes
|
|
51
58
|
...opts.extraBabelIncludes.map((p) => {
|
|
52
59
|
if (import_utils.lodash.isRegExp(p)) {
|
|
53
60
|
return p;
|
|
@@ -62,6 +69,8 @@ async function addJavaScriptRules(opts) {
|
|
|
62
69
|
return (0, import_path.dirname)(
|
|
63
70
|
import_utils.resolve.sync(`${p}/package.json`, {
|
|
64
71
|
basedir: cwd,
|
|
72
|
+
// same behavior as webpack, to ensure `include` paths matched
|
|
73
|
+
// ref: https://webpack.js.org/configuration/resolve/#resolvesymlinks
|
|
65
74
|
preserveSymlinks: false
|
|
66
75
|
})
|
|
67
76
|
);
|
|
@@ -74,6 +83,7 @@ async function addJavaScriptRules(opts) {
|
|
|
74
83
|
throw e;
|
|
75
84
|
}
|
|
76
85
|
}),
|
|
86
|
+
// support es5ImcompatibleVersions
|
|
77
87
|
(path) => {
|
|
78
88
|
try {
|
|
79
89
|
if (path.includes("client/client/client"))
|
|
@@ -105,10 +115,18 @@ async function addJavaScriptRules(opts) {
|
|
|
105
115
|
var _a2, _b2;
|
|
106
116
|
if (srcTranspiler === import_types.Transpiler.babel) {
|
|
107
117
|
rule.use("babel-loader").loader(require.resolve("../../compiled/babel-loader")).options({
|
|
118
|
+
// Tell babel to guess the type, instead assuming all files are modules
|
|
119
|
+
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
|
|
108
120
|
sourceType: "unambiguous",
|
|
109
121
|
babelrc: false,
|
|
122
|
+
configFile: false,
|
|
110
123
|
cacheDirectory: false,
|
|
124
|
+
browserslistConfigFile: false,
|
|
125
|
+
// process.env.BABEL_CACHE !== 'none'
|
|
126
|
+
// ? join(cwd, `.umi/.cache/babel-loader`)
|
|
127
|
+
// : false,
|
|
111
128
|
targets: userConfig.targets,
|
|
129
|
+
// 解决 vue MFSU 解析 需要
|
|
112
130
|
customize: userConfig.babelLoaderCustomize,
|
|
113
131
|
presets: [
|
|
114
132
|
opts.babelPreset || [
|
|
@@ -135,6 +153,7 @@ async function addJavaScriptRules(opts) {
|
|
|
135
153
|
} else if (srcTranspiler === import_types.Transpiler.swc) {
|
|
136
154
|
rule.use("swc-loader").loader(require.resolve("../loader/swc")).options({
|
|
137
155
|
excludeFiles: [
|
|
156
|
+
// exclude MFSU virtual entry files, because swc not support top level await
|
|
138
157
|
new RegExp(`/${import_mfsu.VIRTUAL_ENTRY_DIR}/[^\\/]+\\.js$`)
|
|
139
158
|
],
|
|
140
159
|
enableAutoCssModulesPlugin: userConfig.autoCSSModules,
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -36,7 +40,10 @@ async function addMiniCSSExtractPlugin(opts) {
|
|
|
36
40
|
config.plugin("mini-css-extract-plugin").use(import_mini_css_extract_plugin.default, [
|
|
37
41
|
{
|
|
38
42
|
filename: `[name]${hash}.css`,
|
|
39
|
-
chunkFilename: opts.userConfig.ssr ?
|
|
43
|
+
chunkFilename: opts.userConfig.ssr ? (
|
|
44
|
+
// TODO: FIXME
|
|
45
|
+
`umi${hash}.css`
|
|
46
|
+
) : `[name]${hash}.chunk.css`,
|
|
40
47
|
ignoreOrder: true
|
|
41
48
|
}
|
|
42
49
|
]);
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/config/svgRules.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { MFSU } from '@umijs/mfsu';
|
|
2
3
|
import type { Worker } from 'worker_threads';
|
|
4
|
+
import webpack from '../compiled/webpack';
|
|
3
5
|
import { IOpts as IConfigOpts } from './config/config';
|
|
4
6
|
import { IConfig } from './types';
|
|
5
7
|
declare type IOpts = {
|
|
@@ -30,4 +32,8 @@ declare type IOpts = {
|
|
|
30
32
|
} & Pick<IConfigOpts, 'cache' | 'pkg'>;
|
|
31
33
|
export declare function ensureSerializableValue(obj: any): any;
|
|
32
34
|
export declare function dev(opts: IOpts): Promise<void>;
|
|
35
|
+
export declare function setup(opts: IOpts): Promise<{
|
|
36
|
+
mfsu: MFSU | null;
|
|
37
|
+
webpackConfig: webpack.Configuration;
|
|
38
|
+
}>;
|
|
33
39
|
export {};
|
package/dist/dev.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -26,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
30
|
var dev_exports = {};
|
|
27
31
|
__export(dev_exports, {
|
|
28
32
|
dev: () => dev,
|
|
29
|
-
ensureSerializableValue: () => ensureSerializableValue
|
|
33
|
+
ensureSerializableValue: () => ensureSerializableValue,
|
|
34
|
+
setup: () => setup
|
|
30
35
|
});
|
|
31
36
|
module.exports = __toCommonJS(dev_exports);
|
|
32
37
|
var import_mfsu = require("@umijs/mfsu");
|
|
@@ -53,6 +58,25 @@ function ensureSerializableValue(obj) {
|
|
|
53
58
|
);
|
|
54
59
|
}
|
|
55
60
|
async function dev(opts) {
|
|
61
|
+
const { mfsu, webpackConfig } = await setup(opts);
|
|
62
|
+
await (0, import_server.createServer)({
|
|
63
|
+
webpackConfig,
|
|
64
|
+
userConfig: opts.config,
|
|
65
|
+
cwd: opts.cwd,
|
|
66
|
+
beforeMiddlewares: [
|
|
67
|
+
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
68
|
+
...opts.beforeMiddlewares || []
|
|
69
|
+
],
|
|
70
|
+
port: opts.port,
|
|
71
|
+
host: opts.host,
|
|
72
|
+
ip: opts.ip,
|
|
73
|
+
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
74
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
75
|
+
onProgress: opts.onProgress,
|
|
76
|
+
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async function setup(opts) {
|
|
56
80
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
57
81
|
const cacheDirectoryPath = (0, import_path.resolve)(
|
|
58
82
|
opts.rootDir || opts.cwd,
|
|
@@ -164,25 +188,14 @@ async function dev(opts) {
|
|
|
164
188
|
import_utils.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
165
189
|
}
|
|
166
190
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
beforeMiddlewares: [
|
|
172
|
-
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
173
|
-
...opts.beforeMiddlewares || []
|
|
174
|
-
],
|
|
175
|
-
port: opts.port,
|
|
176
|
-
host: opts.host,
|
|
177
|
-
ip: opts.ip,
|
|
178
|
-
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
179
|
-
onDevCompileDone: opts.onDevCompileDone,
|
|
180
|
-
onProgress: opts.onProgress,
|
|
181
|
-
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
182
|
-
});
|
|
191
|
+
return {
|
|
192
|
+
mfsu,
|
|
193
|
+
webpackConfig
|
|
194
|
+
};
|
|
183
195
|
}
|
|
184
196
|
// Annotate the CommonJS export names for ESM import in node:
|
|
185
197
|
0 && (module.exports = {
|
|
186
198
|
dev,
|
|
187
|
-
ensureSerializableValue
|
|
199
|
+
ensureSerializableValue,
|
|
200
|
+
setup
|
|
188
201
|
});
|
package/dist/loader/svgr.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/loader/swc.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -37,6 +41,7 @@ function getBaseOpts({ filename }) {
|
|
|
37
41
|
const isDev = process.env.NODE_ENV === import_types.Env.development;
|
|
38
42
|
const swcOpts = {
|
|
39
43
|
module: {
|
|
44
|
+
// @ts-ignore
|
|
40
45
|
type: "es6",
|
|
41
46
|
ignoreDynamic: true
|
|
42
47
|
},
|
|
@@ -93,8 +98,10 @@ function swcLoader(contents, inputSourceMap) {
|
|
|
93
98
|
...getBaseOpts({
|
|
94
99
|
filename
|
|
95
100
|
}),
|
|
101
|
+
// filename
|
|
96
102
|
filename,
|
|
97
103
|
sourceFileName: filename,
|
|
104
|
+
// source map
|
|
98
105
|
sourceMaps: this.sourceMap,
|
|
99
106
|
...inputSourceMap ? {
|
|
100
107
|
inputSourceMap
|
package/dist/parcelCSS.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as parcelCSS from '
|
|
1
|
+
import * as parcelCSS from 'lightningcss';
|
|
2
2
|
export { parcelCSS };
|
package/dist/parcelCSS.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -28,7 +32,7 @@ __export(parcelCSS_exports, {
|
|
|
28
32
|
parcelCSS: () => parcelCSS
|
|
29
33
|
});
|
|
30
34
|
module.exports = __toCommonJS(parcelCSS_exports);
|
|
31
|
-
var parcelCSS = __toESM(require("
|
|
35
|
+
var parcelCSS = __toESM(require("lightningcss"));
|
|
32
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
37
|
0 && (module.exports = {
|
|
34
38
|
parcelCSS
|
package/dist/requireHook.js
CHANGED
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
return to;
|
|
14
14
|
};
|
|
15
15
|
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
16
20
|
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
17
21
|
mod2
|
|
18
22
|
));
|
package/dist/schema.js
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -95,6 +99,7 @@ async function createServer(opts) {
|
|
|
95
99
|
publicPath: userConfig.publicPath || "/",
|
|
96
100
|
writeToDisk: userConfig.writeToDisk,
|
|
97
101
|
stats: "none"
|
|
102
|
+
// watchOptions: { ignored }
|
|
98
103
|
});
|
|
99
104
|
app.use(compilerMiddleware);
|
|
100
105
|
let stats;
|
|
@@ -178,6 +183,7 @@ async function createServer(opts) {
|
|
|
178
183
|
httpsOpts.hosts = import_utils.lodash.uniq(
|
|
179
184
|
[
|
|
180
185
|
...httpsOpts.hosts || [],
|
|
186
|
+
// always add localhost, 127.0.0.1, ip and host
|
|
181
187
|
"127.0.0.1",
|
|
182
188
|
"localhost",
|
|
183
189
|
opts.ip,
|
package/dist/server/ws.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ import { Server as HttpsServer } from 'https';
|
|
|
8
8
|
import WebSocket from '../../compiled/ws';
|
|
9
9
|
export declare function createWebSocketServer(server: HttpServer | HttpsServer | Http2Server | Server): {
|
|
10
10
|
send(message: string): void;
|
|
11
|
-
wss: WebSocket.Server
|
|
11
|
+
wss: WebSocket.Server;
|
|
12
12
|
close(): void;
|
|
13
13
|
};
|
package/dist/server/ws.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -35,6 +39,11 @@ var AutoCSSModule = class extends import_Visitor.default {
|
|
|
35
39
|
visitTsType(expression) {
|
|
36
40
|
return expression;
|
|
37
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* call path:
|
|
44
|
+
* visitProgram -> visitModule -> visitModuleItems -> visitModuleItem -> visitImportDeclaration
|
|
45
|
+
* @see https://github.com/swc-project/swc/blob/main/node-swc/src/Visitor.ts#L189
|
|
46
|
+
*/
|
|
38
47
|
visitModuleItem(n) {
|
|
39
48
|
if (n.type === "ImportDeclaration") {
|
|
40
49
|
return this.visitImportDeclaration(n);
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/utils/depMatch.js
CHANGED
|
@@ -58,7 +58,8 @@ function es5ImcompatibleVersionsToPkg() {
|
|
|
58
58
|
config: { "es5-imcompatible-versions": config }
|
|
59
59
|
} = require("es5-imcompatible-versions/package.json");
|
|
60
60
|
return Object.keys(config).reduce((memo, key) => {
|
|
61
|
-
memo[key] =
|
|
61
|
+
memo[key] = /* versions */
|
|
62
|
+
Object.keys(config[key]);
|
|
62
63
|
return memo;
|
|
63
64
|
}, {});
|
|
64
65
|
}
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|