@umijs/bundler-webpack 4.2.6-alpha.5 → 4.2.6-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/dist/build.d.ts +0 -22
- package/dist/build.js +0 -151
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -96
- package/dist/config/_sampleFeature.d.ts +0 -10
- package/dist/config/_sampleFeature.js +0 -35
- package/dist/config/assetRules.d.ts +0 -11
- package/dist/config/assetRules.js +0 -48
- package/dist/config/bundleAnalyzerPlugin.d.ts +0 -10
- package/dist/config/bundleAnalyzerPlugin.js +0 -43
- package/dist/config/compressPlugin.d.ts +0 -10
- package/dist/config/compressPlugin.js +0 -128
- package/dist/config/config.d.ts +0 -31
- package/dist/config/config.js +0 -243
- package/dist/config/copyPlugin.d.ts +0 -10
- package/dist/config/copyPlugin.js +0 -63
- package/dist/config/cssRules.d.ts +0 -11
- package/dist/config/cssRules.js +0 -165
- package/dist/config/definePlugin.d.ts +0 -16
- package/dist/config/definePlugin.js +0 -80
- package/dist/config/detectCssModulesInDependence.d.ts +0 -10
- package/dist/config/detectCssModulesInDependence.js +0 -151
- package/dist/config/detectDeadCode.d.ts +0 -12
- package/dist/config/detectDeadCode.js +0 -191
- package/dist/config/detectDeadCodePlugin.d.ts +0 -9
- package/dist/config/detectDeadCodePlugin.js +0 -82
- package/dist/config/fastRefreshPlugin.d.ts +0 -12
- package/dist/config/fastRefreshPlugin.js +0 -49
- package/dist/config/forkTSCheckerPlugin.d.ts +0 -11
- package/dist/config/forkTSCheckerPlugin.js +0 -49
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +0 -6
- package/dist/config/harmonyLinkingErrorPlugin.js +0 -53
- package/dist/config/ignorePlugin.d.ts +0 -10
- package/dist/config/ignorePlugin.js +0 -40
- package/dist/config/javaScriptRules.d.ts +0 -16
- package/dist/config/javaScriptRules.js +0 -191
- package/dist/config/manifestPlugin.d.ts +0 -11
- package/dist/config/manifestPlugin.js +0 -40
- package/dist/config/miniCSSExtractPlugin.d.ts +0 -11
- package/dist/config/miniCSSExtractPlugin.js +0 -55
- package/dist/config/nodePolyfill.d.ts +0 -10
- package/dist/config/nodePolyfill.js +0 -51
- package/dist/config/nodePrefixPlugin.d.ts +0 -11
- package/dist/config/nodePrefixPlugin.js +0 -38
- package/dist/config/progressPlugin.d.ts +0 -11
- package/dist/config/progressPlugin.js +0 -53
- package/dist/config/purgecssWebpackPlugin.d.ts +0 -10
- package/dist/config/purgecssWebpackPlugin.js +0 -43
- package/dist/config/speedMeasureWebpackPlugin.d.ts +0 -6
- package/dist/config/speedMeasureWebpackPlugin.js +0 -59
- package/dist/config/ssrPlugin.d.ts +0 -11
- package/dist/config/ssrPlugin.js +0 -98
- package/dist/config/svgRules.d.ts +0 -12
- package/dist/config/svgRules.js +0 -70
- package/dist/constants.d.ts +0 -15
- package/dist/constants.js +0 -59
- package/dist/dev.d.ts +0 -40
- package/dist/dev.js +0 -208
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -32
- package/dist/loader/svgr.d.ts +0 -4
- package/dist/loader/svgr.js +0 -84
- package/dist/loader/swc.d.ts +0 -4
- package/dist/loader/swc.js +0 -149
- package/dist/parcelCSS.d.ts +0 -2
- package/dist/parcelCSS.js +0 -39
- package/dist/plugins/EsbuildMinifyFix.d.ts +0 -8
- package/dist/plugins/EsbuildMinifyFix.js +0 -136
- package/dist/plugins/ProgressPlugin.d.ts +0 -15
- package/dist/plugins/ProgressPlugin.js +0 -69
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +0 -4
- package/dist/plugins/RuntimePublicPathPlugin.js +0 -45
- package/dist/plugins/_SamplePlugin.d.ts +0 -9
- package/dist/plugins/_SamplePlugin.js +0 -37
- package/dist/requireHook.d.ts +0 -1
- package/dist/requireHook.js +0 -49
- package/dist/schema.d.ts +0 -4
- package/dist/schema.js +0 -178
- package/dist/server/server.d.ts +0 -17
- package/dist/server/server.js +0 -223
- package/dist/server/ws.d.ts +0 -13
- package/dist/server/ws.js +0 -76
- package/dist/swcPlugins/autoCSSModules.d.ts +0 -17
- package/dist/swcPlugins/autoCSSModules.js +0 -63
- package/dist/swcPlugins/changeImportFromString.d.ts +0 -2
- package/dist/swcPlugins/changeImportFromString.js +0 -32
- package/dist/swcPlugins/lockCoreJS.d.ts +0 -6
- package/dist/swcPlugins/lockCoreJS.js +0 -56
- package/dist/types.d.ts +0 -144
- package/dist/types.js +0 -61
- package/dist/utils/browsersList.d.ts +0 -5
- package/dist/utils/browsersList.js +0 -33
- package/dist/utils/depMatch.d.ts +0 -6
- package/dist/utils/depMatch.js +0 -72
- package/dist/utils/formatWebpackMessages.d.ts +0 -12
- package/dist/utils/formatWebpackMessages.js +0 -128
- package/dist/utils/getEsBuildTarget.d.ts +0 -7
- package/dist/utils/getEsBuildTarget.js +0 -46
- package/dist/utils/pkgUpContainsName.d.ts +0 -1
- package/dist/utils/pkgUpContainsName.js +0 -50
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Config from '../../compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
name?: string;
|
|
5
|
-
config: Config;
|
|
6
|
-
userConfig: IConfig;
|
|
7
|
-
cwd: string;
|
|
8
|
-
env: Env;
|
|
9
|
-
}
|
|
10
|
-
export default function addSSRPlugin(opts: IOpts): void;
|
|
11
|
-
export {};
|
package/dist/config/ssrPlugin.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/config/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;
|
|
45
|
-
});
|
|
46
|
-
assets.forEach((asset) => {
|
|
47
|
-
if (asset.info.sourceFilename) {
|
|
48
|
-
this.manifest.set(
|
|
49
|
-
asset.info.sourceFilename,
|
|
50
|
-
publicPath + asset.name
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
const stats = compilation.getStats().toJson({
|
|
55
|
-
all: false,
|
|
56
|
-
assets: true,
|
|
57
|
-
cachedAssets: true,
|
|
58
|
-
cachedModules: true
|
|
59
|
-
});
|
|
60
|
-
const { assetsByChunkName } = stats;
|
|
61
|
-
Object.keys(assetsByChunkName).forEach((chunkName) => {
|
|
62
|
-
assetsByChunkName[chunkName].forEach((filename) => {
|
|
63
|
-
const ext = (0, import_path.extname)(filename.split(/[?#]/)[0]);
|
|
64
|
-
if (!filename.includes(".hot-update.")) {
|
|
65
|
-
this.manifest.set(chunkName + ext, publicPath + filename);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
const assetsSource = JSON.stringify(
|
|
70
|
-
{
|
|
71
|
-
assets: Object.fromEntries(this.manifest)
|
|
72
|
-
},
|
|
73
|
-
null,
|
|
74
|
-
2
|
|
75
|
-
);
|
|
76
|
-
if (process.env.NODE_ENV === "production" || this.opts.userConfig.writeToDisk) {
|
|
77
|
-
compilation.emitAsset(
|
|
78
|
-
"build-manifest.json",
|
|
79
|
-
new import_webpack.sources.RawSource(assetsSource, false)
|
|
80
|
-
);
|
|
81
|
-
} else {
|
|
82
|
-
const outputPath = compiler.options.output.path;
|
|
83
|
-
import_utils.fsExtra.mkdirpSync(outputPath);
|
|
84
|
-
(0, import_fs.writeFileSync)(
|
|
85
|
-
(0, import_path.join)(outputPath, "build-manifest.json"),
|
|
86
|
-
assetsSource,
|
|
87
|
-
"utf-8"
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
function addSSRPlugin(opts) {
|
|
95
|
-
if (opts.userConfig.ssr && opts.name !== import_constants.MFSU_NAME) {
|
|
96
|
-
opts.config.plugin("ssr-plugin").use(SSRPlugin, [opts]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
config: Config;
|
|
5
|
-
userConfig: IConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
env: Env;
|
|
8
|
-
browsers: any;
|
|
9
|
-
staticPathPrefix: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function addSVGRules(opts: IOpts): Promise<void>;
|
|
12
|
-
export {};
|
package/dist/config/svgRules.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/config/svgRules.ts
|
|
30
|
-
var svgRules_exports = {};
|
|
31
|
-
__export(svgRules_exports, {
|
|
32
|
-
addSVGRules: () => addSVGRules
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(svgRules_exports);
|
|
35
|
-
async function addSVGRules(opts) {
|
|
36
|
-
const { config, userConfig } = opts;
|
|
37
|
-
const { svgr, svgo = {} } = userConfig;
|
|
38
|
-
if (svgr) {
|
|
39
|
-
const svgrRule = config.module.rule("svgr");
|
|
40
|
-
svgrRule.test(/\.svg$/).issuer(/\.[jt]sx?$/).type("javascript/auto").use("svgr-loader").loader(require.resolve("../loader/svgr")).options({
|
|
41
|
-
svgoConfig: {
|
|
42
|
-
plugins: [
|
|
43
|
-
{
|
|
44
|
-
name: "preset-default",
|
|
45
|
-
params: {
|
|
46
|
-
overrides: {
|
|
47
|
-
removeTitle: false
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"prefixIds"
|
|
52
|
-
],
|
|
53
|
-
...svgo
|
|
54
|
-
},
|
|
55
|
-
...svgr,
|
|
56
|
-
svgo: !!svgo
|
|
57
|
-
}).end().use("url-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/url-loader")).options({
|
|
58
|
-
limit: userConfig.inlineLimit,
|
|
59
|
-
fallback: require.resolve("@umijs/bundler-webpack/compiled/file-loader")
|
|
60
|
-
}).end();
|
|
61
|
-
}
|
|
62
|
-
if (svgo !== false) {
|
|
63
|
-
const svgRule = config.module.rule("svg");
|
|
64
|
-
svgRule.test(/\.svg$/).use("svgo-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/svgo-loader")).options({ configFile: false, ...svgo }).end();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
addSVGRules
|
|
70
|
-
});
|
package/dist/constants.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_DEVTOOL = "cheap-module-source-map";
|
|
2
|
-
export declare const DEFAULT_OUTPUT_PATH = "dist";
|
|
3
|
-
export declare const MFSU_NAME = "MFSU";
|
|
4
|
-
export declare enum MESSAGE_TYPE {
|
|
5
|
-
ok = "ok",
|
|
6
|
-
warnings = "warnings",
|
|
7
|
-
errors = "errors",
|
|
8
|
-
hash = "hash",
|
|
9
|
-
stillOk = "still-ok",
|
|
10
|
-
invalid = "invalid"
|
|
11
|
-
}
|
|
12
|
-
export declare const DEFAULT_BROWSER_TARGETS: {
|
|
13
|
-
chrome: number;
|
|
14
|
-
};
|
|
15
|
-
export declare const DEFAULT_ESBUILD_TARGET_KEYS: string[];
|
package/dist/constants.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/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"
|
|
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
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { MFSU } from '@umijs/mfsu';
|
|
3
|
-
import type { Worker } from 'worker_threads';
|
|
4
|
-
import webpack from '../compiled/webpack';
|
|
5
|
-
import type { IOpts as IConfigOpts } from './config/config';
|
|
6
|
-
import { IConfig } from './types';
|
|
7
|
-
declare type IOpts = {
|
|
8
|
-
afterMiddlewares?: any[];
|
|
9
|
-
beforeMiddlewares?: any[];
|
|
10
|
-
onDevCompileDone?: Function;
|
|
11
|
-
onProgress?: Function;
|
|
12
|
-
onMFSUProgress?: Function;
|
|
13
|
-
port?: number;
|
|
14
|
-
host?: string;
|
|
15
|
-
ip?: string;
|
|
16
|
-
babelPreset?: any;
|
|
17
|
-
chainWebpack?: Function;
|
|
18
|
-
modifyWebpackConfig?: Function;
|
|
19
|
-
beforeBabelPlugins?: any[];
|
|
20
|
-
beforeBabelPresets?: any[];
|
|
21
|
-
extraBabelPlugins?: any[];
|
|
22
|
-
extraBabelPresets?: any[];
|
|
23
|
-
cwd: string;
|
|
24
|
-
rootDir?: string;
|
|
25
|
-
config: IConfig;
|
|
26
|
-
entry: Record<string, string>;
|
|
27
|
-
mfsuStrategy?: 'eager' | 'normal';
|
|
28
|
-
mfsuInclude?: string[];
|
|
29
|
-
srcCodeCache?: any;
|
|
30
|
-
startBuildWorker?: (deps: any[]) => Worker;
|
|
31
|
-
onBeforeMiddleware?: Function;
|
|
32
|
-
disableCopy?: boolean;
|
|
33
|
-
} & Pick<IConfigOpts, 'cache' | 'pkg'>;
|
|
34
|
-
export declare function ensureSerializableValue(obj: any): any;
|
|
35
|
-
export declare function dev(opts: IOpts): Promise<void>;
|
|
36
|
-
export declare function setup(opts: IOpts): Promise<{
|
|
37
|
-
mfsu: MFSU | null;
|
|
38
|
-
webpackConfig: webpack.Configuration;
|
|
39
|
-
}>;
|
|
40
|
-
export {};
|
package/dist/dev.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/dev.ts
|
|
30
|
-
var dev_exports = {};
|
|
31
|
-
__export(dev_exports, {
|
|
32
|
-
dev: () => dev,
|
|
33
|
-
ensureSerializableValue: () => ensureSerializableValue,
|
|
34
|
-
setup: () => setup
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(dev_exports);
|
|
37
|
-
var import_mfsu = require("@umijs/mfsu");
|
|
38
|
-
var import_utils = require("@umijs/utils");
|
|
39
|
-
var import_fs = require("fs");
|
|
40
|
-
var import_path = require("path");
|
|
41
|
-
var import_webpack = __toESM(require("../compiled/webpack"));
|
|
42
|
-
var import_constants = require("./constants");
|
|
43
|
-
var import_server = require("./server/server");
|
|
44
|
-
var import_types = require("./types");
|
|
45
|
-
var configModule = (0, import_utils.importLazy)(
|
|
46
|
-
require.resolve("./config/config")
|
|
47
|
-
);
|
|
48
|
-
function ensureSerializableValue(obj) {
|
|
49
|
-
return JSON.parse(
|
|
50
|
-
JSON.stringify(
|
|
51
|
-
obj,
|
|
52
|
-
(_key, value) => {
|
|
53
|
-
if (typeof value === "function" || import_utils.lodash.isRegExp(value)) {
|
|
54
|
-
return value.toString();
|
|
55
|
-
}
|
|
56
|
-
return value;
|
|
57
|
-
},
|
|
58
|
-
2
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
async function dev(opts) {
|
|
63
|
-
const { mfsu, webpackConfig } = await setup(opts);
|
|
64
|
-
await (0, import_server.createServer)({
|
|
65
|
-
webpackConfig,
|
|
66
|
-
userConfig: opts.config,
|
|
67
|
-
cwd: opts.cwd,
|
|
68
|
-
beforeMiddlewares: [
|
|
69
|
-
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
70
|
-
...opts.beforeMiddlewares || []
|
|
71
|
-
],
|
|
72
|
-
port: opts.port,
|
|
73
|
-
host: opts.host,
|
|
74
|
-
ip: opts.ip,
|
|
75
|
-
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
76
|
-
onDevCompileDone: opts.onDevCompileDone,
|
|
77
|
-
onProgress: opts.onProgress,
|
|
78
|
-
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async function setup(opts) {
|
|
82
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
83
|
-
const cacheDirectoryPath = (0, import_path.resolve)(
|
|
84
|
-
opts.rootDir || opts.cwd,
|
|
85
|
-
opts.config.cacheDirectoryPath || "node_modules/.cache"
|
|
86
|
-
);
|
|
87
|
-
const enableMFSU = opts.config.mfsu !== false;
|
|
88
|
-
let mfsu = null;
|
|
89
|
-
if (enableMFSU) {
|
|
90
|
-
mfsu = new import_mfsu.MFSU({
|
|
91
|
-
strategy: opts.mfsuStrategy,
|
|
92
|
-
include: opts.mfsuInclude || [],
|
|
93
|
-
srcCodeCache: opts.srcCodeCache,
|
|
94
|
-
implementor: import_webpack.default,
|
|
95
|
-
buildDepWithESBuild: (_a = opts.config.mfsu) == null ? void 0 : _a.esbuild,
|
|
96
|
-
depBuildConfig: {
|
|
97
|
-
extraPostCSSPlugins: ((_b = opts.config) == null ? void 0 : _b.extraPostCSSPlugins) || []
|
|
98
|
-
},
|
|
99
|
-
mfName: (_c = opts.config.mfsu) == null ? void 0 : _c.mfName,
|
|
100
|
-
runtimePublicPath: opts.config.runtimePublicPath,
|
|
101
|
-
tmpBase: ((_d = opts.config.mfsu) == null ? void 0 : _d.cacheDirectory) || (0, import_path.join)(cacheDirectoryPath, "mfsu"),
|
|
102
|
-
onMFSUProgress: opts.onMFSUProgress,
|
|
103
|
-
unMatchLibs: (_e = opts.config.mfsu) == null ? void 0 : _e.exclude,
|
|
104
|
-
shared: (_f = opts.config.mfsu) == null ? void 0 : _f.shared,
|
|
105
|
-
remoteAliases: (_g = opts.config.mfsu) == null ? void 0 : _g.remoteAliases,
|
|
106
|
-
remoteName: (_h = opts.config.mfsu) == null ? void 0 : _h.remoteName,
|
|
107
|
-
getCacheDependency() {
|
|
108
|
-
return ensureSerializableValue({
|
|
109
|
-
version: require("../package.json").version,
|
|
110
|
-
mfsu: opts.config.mfsu,
|
|
111
|
-
alias: opts.config.alias,
|
|
112
|
-
externals: opts.config.externals,
|
|
113
|
-
theme: opts.config.theme,
|
|
114
|
-
runtimePublicPath: opts.config.runtimePublicPath,
|
|
115
|
-
publicPath: opts.config.publicPath,
|
|
116
|
-
define: opts.config.define
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
startBuildWorker: opts.startBuildWorker,
|
|
120
|
-
cwd: opts.cwd
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
const webpackConfig = await configModule.getConfig({
|
|
124
|
-
cwd: opts.cwd,
|
|
125
|
-
rootDir: opts.rootDir,
|
|
126
|
-
env: import_types.Env.development,
|
|
127
|
-
entry: opts.entry,
|
|
128
|
-
userConfig: opts.config,
|
|
129
|
-
babelPreset: opts.babelPreset,
|
|
130
|
-
extraBabelPlugins: [
|
|
131
|
-
...opts.beforeBabelPlugins || [],
|
|
132
|
-
...(mfsu == null ? void 0 : mfsu.getBabelPlugins()) || [],
|
|
133
|
-
...opts.extraBabelPlugins || []
|
|
134
|
-
],
|
|
135
|
-
extraBabelPresets: [
|
|
136
|
-
...opts.beforeBabelPresets || [],
|
|
137
|
-
...opts.extraBabelPresets || []
|
|
138
|
-
],
|
|
139
|
-
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
140
|
-
extraEsbuildLoaderHandler: (mfsu == null ? void 0 : mfsu.getEsbuildLoaderHandler()) || [],
|
|
141
|
-
chainWebpack: opts.chainWebpack,
|
|
142
|
-
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
143
|
-
hmr: process.env.HMR !== "none",
|
|
144
|
-
analyze: process.env.ANALYZE,
|
|
145
|
-
cache: opts.cache ? {
|
|
146
|
-
...opts.cache,
|
|
147
|
-
cacheDirectory: (0, import_path.join)(
|
|
148
|
-
cacheDirectoryPath,
|
|
149
|
-
opts.mfsuStrategy === "eager" ? "bundler-webpack-eager" : "bundler-webpack"
|
|
150
|
-
)
|
|
151
|
-
} : void 0,
|
|
152
|
-
pkg: opts.pkg,
|
|
153
|
-
disableCopy: opts.disableCopy,
|
|
154
|
-
port: opts.port,
|
|
155
|
-
host: opts.host
|
|
156
|
-
});
|
|
157
|
-
const depConfig = await configModule.getConfig({
|
|
158
|
-
cwd: opts.cwd,
|
|
159
|
-
rootDir: opts.rootDir,
|
|
160
|
-
env: import_types.Env.development,
|
|
161
|
-
entry: opts.entry,
|
|
162
|
-
userConfig: { ...opts.config, forkTSChecker: false },
|
|
163
|
-
disableCopy: true,
|
|
164
|
-
hash: true,
|
|
165
|
-
staticPathPrefix: import_mfsu.MF_DEP_PREFIX,
|
|
166
|
-
name: import_constants.MFSU_NAME,
|
|
167
|
-
chainWebpack: (_i = opts.config.mfsu) == null ? void 0 : _i.chainWebpack,
|
|
168
|
-
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
169
|
-
cache: {
|
|
170
|
-
buildDependencies: (_j = opts.cache) == null ? void 0 : _j.buildDependencies,
|
|
171
|
-
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
172
|
-
},
|
|
173
|
-
pkg: opts.pkg,
|
|
174
|
-
port: opts.port,
|
|
175
|
-
host: opts.host
|
|
176
|
-
});
|
|
177
|
-
(_k = webpackConfig.resolve).alias || (_k.alias = {});
|
|
178
|
-
["@umijs/utils/compiled/strip-ansi", "react-error-overlay"].forEach((dep) => {
|
|
179
|
-
webpackConfig.resolve.alias[dep] = require.resolve(dep);
|
|
180
|
-
});
|
|
181
|
-
await (mfsu == null ? void 0 : mfsu.setWebpackConfig({
|
|
182
|
-
config: webpackConfig,
|
|
183
|
-
depConfig
|
|
184
|
-
}));
|
|
185
|
-
if (mfsu && webpackConfig.cache && typeof webpackConfig.cache === "object" && webpackConfig.cache.type === "filesystem") {
|
|
186
|
-
const webpackCachePath = (0, import_path.join)(
|
|
187
|
-
webpackConfig.cache.cacheDirectory,
|
|
188
|
-
`default-development`,
|
|
189
|
-
"index.pack"
|
|
190
|
-
);
|
|
191
|
-
const mfsuCacheExists = (0, import_fs.existsSync)(mfsu.getCacheFilePath());
|
|
192
|
-
const webpackCacheExists = (0, import_fs.existsSync)(webpackCachePath);
|
|
193
|
-
if (webpackCacheExists && !mfsuCacheExists) {
|
|
194
|
-
import_utils.logger.warn(`Invalidate webpack cache since mfsu cache is missing`);
|
|
195
|
-
import_utils.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
mfsu,
|
|
200
|
-
webpackConfig
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
204
|
-
0 && (module.exports = {
|
|
205
|
-
dev,
|
|
206
|
-
ensureSerializableValue,
|
|
207
|
-
setup
|
|
208
|
-
});
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type webpack from '../compiled/webpack';
|
|
2
|
-
import './requireHook';
|
|
3
|
-
export type { RequestHandler, Express, } from '@umijs/bundler-utils/compiled/express';
|
|
4
|
-
export type { Compiler, Stats } from '../compiled/webpack';
|
|
5
|
-
export * from './build';
|
|
6
|
-
export * from './config/config';
|
|
7
|
-
export * from './dev';
|
|
8
|
-
export * from './schema';
|
|
9
|
-
export * from './constants';
|
|
10
|
-
export { webpack };
|
package/dist/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __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;
|
|
12
|
-
};
|
|
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
|
-
// src/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);
|
|
24
|
-
__reExport(src_exports, require("./constants"), module.exports);
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
...require("./build"),
|
|
28
|
-
...require("./config/config"),
|
|
29
|
-
...require("./dev"),
|
|
30
|
-
...require("./schema"),
|
|
31
|
-
...require("./constants")
|
|
32
|
-
});
|
package/dist/loader/svgr.d.ts
DELETED
package/dist/loader/svgr.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/loader/svgr.ts
|
|
30
|
-
var svgr_exports = {};
|
|
31
|
-
__export(svgr_exports, {
|
|
32
|
-
default: () => svgr_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(svgr_exports);
|
|
35
|
-
var import_core = require("@svgr/core");
|
|
36
|
-
var import_plugin_jsx = __toESM(require("@svgr/plugin-jsx"));
|
|
37
|
-
var import_plugin_svgo = __toESM(require("@svgr/plugin-svgo"));
|
|
38
|
-
var import_esbuild = require("@umijs/bundler-utils/compiled/esbuild");
|
|
39
|
-
var import_path = require("path");
|
|
40
|
-
var import_util = require("util");
|
|
41
|
-
var tranformSvg = (0, import_util.callbackify)(
|
|
42
|
-
async (contents, options, state) => {
|
|
43
|
-
const jsCode = await (0, import_core.transform)(contents, options, state);
|
|
44
|
-
const result = await (0, import_esbuild.transform)(jsCode, {
|
|
45
|
-
loader: "tsx",
|
|
46
|
-
target: "es2015"
|
|
47
|
-
});
|
|
48
|
-
if (!(result == null ? void 0 : result.code)) {
|
|
49
|
-
throw new Error(`Error while transforming using Esbuild`);
|
|
50
|
-
}
|
|
51
|
-
return result.code;
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
function svgrLoader(contents) {
|
|
55
|
-
this.cacheable && this.cacheable();
|
|
56
|
-
const callback = this.async();
|
|
57
|
-
const options = this.getOptions();
|
|
58
|
-
const previousExport = (() => {
|
|
59
|
-
if (contents.startsWith("export "))
|
|
60
|
-
return contents;
|
|
61
|
-
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
62
|
-
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
63
|
-
})();
|
|
64
|
-
const state = {
|
|
65
|
-
caller: {
|
|
66
|
-
name: "svgr-loader",
|
|
67
|
-
previousExport,
|
|
68
|
-
defaultPlugins: [import_plugin_svgo.default, import_plugin_jsx.default]
|
|
69
|
-
},
|
|
70
|
-
filePath: (0, import_path.normalize)(this.resourcePath)
|
|
71
|
-
};
|
|
72
|
-
if (!previousExport) {
|
|
73
|
-
tranformSvg(contents, options, state, callback);
|
|
74
|
-
} else {
|
|
75
|
-
this.fs.readFile(this.resourcePath, (err, result) => {
|
|
76
|
-
if (err) {
|
|
77
|
-
callback(err);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
tranformSvg(String(result), options, state, callback);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
var svgr_default = svgrLoader;
|
package/dist/loader/swc.d.ts
DELETED