@umijs/preset-umi 4.4.10 → 4.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/build.js +18 -12
- package/dist/commands/dev/dev.js +17 -21
- package/dist/commands/dev/getBabelOpts.js +5 -2
- package/dist/features/aiDev/aiDev.d.ts +3 -0
- package/dist/features/aiDev/aiDev.js +93 -0
- package/dist/features/bundler/bundler.d.ts +3 -0
- package/dist/features/bundler/bundler.js +43 -0
- package/dist/features/stagewise/stagewise.d.ts +3 -0
- package/dist/features/stagewise/stagewise.js +72 -0
- package/dist/index.js +3 -0
- package/dist/registerMethods.js +4 -1
- package/dist/types.d.ts +23 -0
- package/package.json +16 -15
package/dist/commands/build.js
CHANGED
|
@@ -33,7 +33,6 @@ var import_getBabelOpts = require("./dev/getBabelOpts");
|
|
|
33
33
|
var import_getMarkupArgs = require("./dev/getMarkupArgs");
|
|
34
34
|
var import_printMemoryUsage = require("./dev/printMemoryUsage");
|
|
35
35
|
var bundlerWebpack = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-webpack");
|
|
36
|
-
var bundlerVite = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-vite");
|
|
37
36
|
var build_default = (api) => {
|
|
38
37
|
api.registerCommand({
|
|
39
38
|
name: "build",
|
|
@@ -109,7 +108,7 @@ umi build --clean
|
|
|
109
108
|
// it will break the config of externals, when externals
|
|
110
109
|
// does not handle the react/runtime
|
|
111
110
|
import_utils.semver.gte(api.appData.react.version, "17.0.0");
|
|
112
|
-
|
|
111
|
+
let opts = {
|
|
113
112
|
react: {
|
|
114
113
|
runtime: shouldUseAutomaticRuntime ? "automatic" : "classic"
|
|
115
114
|
},
|
|
@@ -136,22 +135,29 @@ umi build --clean
|
|
|
136
135
|
};
|
|
137
136
|
await api.applyPlugins({
|
|
138
137
|
key: "onBeforeCompiler",
|
|
139
|
-
args: { compiler: api.
|
|
138
|
+
args: { compiler: api.appData.bundler, opts }
|
|
140
139
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
opts = await api.applyPlugins({
|
|
141
|
+
key: "modifyUniBundlerOpts",
|
|
142
|
+
initialValue: opts,
|
|
143
|
+
args: {
|
|
144
|
+
bundler: api.appData.bundler
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const bundler = await api.applyPlugins({
|
|
148
|
+
key: "modifyUniBundler",
|
|
149
|
+
args: {
|
|
150
|
+
bundler: api.appData.bundler,
|
|
151
|
+
opts
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const stats = await bundler.build(opts);
|
|
155
|
+
if (!api.config.vite && !api.config.mako) {
|
|
149
156
|
const absOutputPath = (0, import_path.resolve)(
|
|
150
157
|
opts.cwd,
|
|
151
158
|
opts.config.outputPath || bundlerWebpack.DEFAULT_OUTPUT_PATH
|
|
152
159
|
);
|
|
153
160
|
const previousFileSizes = (0, import_fileSizeReporter.measureFileSizesBeforeBuild)(absOutputPath);
|
|
154
|
-
stats = await bundlerWebpack.build(opts);
|
|
155
161
|
console.log();
|
|
156
162
|
import_utils.logger.info("File sizes after gzip:\n");
|
|
157
163
|
(0, import_fileSizeReporter.printFileSizesAfterBuild)({
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -38,7 +38,6 @@ var import_path = require("path");
|
|
|
38
38
|
var import_worker_threads = require("worker_threads");
|
|
39
39
|
var import_constants = require("../../constants");
|
|
40
40
|
var import_LazySourceCodeCache = require("../../libs/folderCache/LazySourceCodeCache");
|
|
41
|
-
var import_lazyImportFromCurrentPkg = require("../../utils/lazyImportFromCurrentPkg");
|
|
42
41
|
var import_projectFileList = require("../../utils/projectFileList");
|
|
43
42
|
var import_createRouteMiddleware = require("./createRouteMiddleware");
|
|
44
43
|
var import_faviconMiddleware = require("./faviconMiddleware");
|
|
@@ -46,8 +45,6 @@ var import_getBabelOpts = require("./getBabelOpts");
|
|
|
46
45
|
var import_ViteHtmlPlugin = __toESM(require("./plugins/ViteHtmlPlugin"));
|
|
47
46
|
var import_printMemoryUsage = require("./printMemoryUsage");
|
|
48
47
|
var import_watch = require("./watch");
|
|
49
|
-
var bundlerWebpack = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-webpack");
|
|
50
|
-
var bundlerVite = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-vite");
|
|
51
48
|
var MFSU_EAGER_DEFAULT_INCLUDE = [
|
|
52
49
|
"react",
|
|
53
50
|
"react-error-overlay",
|
|
@@ -66,13 +63,6 @@ var dev_default = (api) => {
|
|
|
66
63
|
return;
|
|
67
64
|
if (process.env.BIGFISH_INFO)
|
|
68
65
|
return;
|
|
69
|
-
if (process.env.MAKO_AD === "none")
|
|
70
|
-
return;
|
|
71
|
-
console.info(
|
|
72
|
-
import_utils.chalk.yellow.bold(
|
|
73
|
-
"Mako https://makojs.dev is a new fast Rust based bundler from us, which is heavily optimized for umi and much faster than webpack. Visit https://makojs.dev/docs/getting-started#bundle-with-umi for more details if you want to give it a try."
|
|
74
|
-
)
|
|
75
|
-
);
|
|
76
66
|
});
|
|
77
67
|
api.registerCommand({
|
|
78
68
|
name: "dev",
|
|
@@ -341,7 +331,7 @@ PORT=8888 umi dev
|
|
|
341
331
|
}
|
|
342
332
|
});
|
|
343
333
|
const shouldUseAutomaticRuntime = ((_c = api.appData.react) == null ? void 0 : _c.version) && import_utils.semver.gte(api.appData.react.version, "17.0.0");
|
|
344
|
-
|
|
334
|
+
let opts = {
|
|
345
335
|
react: {
|
|
346
336
|
runtime: shouldUseAutomaticRuntime ? "automatic" : "classic"
|
|
347
337
|
},
|
|
@@ -411,19 +401,25 @@ PORT=8888 umi dev
|
|
|
411
401
|
});
|
|
412
402
|
}
|
|
413
403
|
};
|
|
404
|
+
opts = await api.applyPlugins({
|
|
405
|
+
key: "modifyUniBundlerOpts",
|
|
406
|
+
initialValue: opts,
|
|
407
|
+
args: {
|
|
408
|
+
bundler: api.appData.bundler
|
|
409
|
+
}
|
|
410
|
+
});
|
|
414
411
|
await api.applyPlugins({
|
|
415
412
|
key: "onBeforeCompiler",
|
|
416
|
-
args: { compiler:
|
|
413
|
+
args: { compiler: api.appData.bundler, opts }
|
|
417
414
|
});
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
}
|
|
415
|
+
const bundler = await api.applyPlugins({
|
|
416
|
+
key: "modifyUniBundler",
|
|
417
|
+
args: {
|
|
418
|
+
bundler: api.appData.bundler,
|
|
419
|
+
opts
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
await bundler.dev(opts);
|
|
427
423
|
}
|
|
428
424
|
});
|
|
429
425
|
api.modifyAppData(async (memo) => {
|
|
@@ -34,7 +34,10 @@ __export(getBabelOpts_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(getBabelOpts_exports);
|
|
35
35
|
var import_utils = require("@umijs/utils");
|
|
36
36
|
async function getBabelOpts(opts) {
|
|
37
|
-
const shouldUseAutomaticRuntime = import_utils.semver.gte(
|
|
37
|
+
const shouldUseAutomaticRuntime = import_utils.semver.gte(
|
|
38
|
+
opts.api.appData.react.version,
|
|
39
|
+
"17.0.0"
|
|
40
|
+
);
|
|
38
41
|
const babelPresetOpts = await opts.api.applyPlugins({
|
|
39
42
|
key: "modifyBabelPresetOpts",
|
|
40
43
|
initialValue: {
|
|
@@ -45,7 +48,7 @@ async function getBabelOpts(opts) {
|
|
|
45
48
|
...shouldUseAutomaticRuntime ? {} : { importSource: void 0 }
|
|
46
49
|
},
|
|
47
50
|
presetTypeScript: {},
|
|
48
|
-
pluginTransformRuntime: {},
|
|
51
|
+
pluginTransformRuntime: opts.api.config.transformRuntime || {},
|
|
49
52
|
pluginLockCoreJS: {},
|
|
50
53
|
pluginDynamicImportNode: false,
|
|
51
54
|
pluginAutoCSSModules: opts.api.config.autoCSSModules
|
|
@@ -0,0 +1,93 @@
|
|
|
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/features/aiDev/aiDev.ts
|
|
30
|
+
var aiDev_exports = {};
|
|
31
|
+
__export(aiDev_exports, {
|
|
32
|
+
default: () => aiDev_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(aiDev_exports);
|
|
35
|
+
var import_utils = require("@umijs/utils");
|
|
36
|
+
var import_child_process = require("child_process");
|
|
37
|
+
var import_fs = __toESM(require("fs"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
function checkBinExists(binName) {
|
|
40
|
+
try {
|
|
41
|
+
const command = process.platform === "win32" ? `where ${binName}` : `which ${binName}`;
|
|
42
|
+
(0, import_child_process.execSync)(command, { stdio: "ignore" });
|
|
43
|
+
return true;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var aiDev_default = (api) => {
|
|
49
|
+
api.describe({
|
|
50
|
+
key: "aiDev"
|
|
51
|
+
});
|
|
52
|
+
api.onDevCompileDone((args) => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if (api.config.mako) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!process.env.UMI_AI_COMMAND || !process.env.UMI_AI_PACKAGE)
|
|
58
|
+
return;
|
|
59
|
+
try {
|
|
60
|
+
const aiCommand = process.env.UMI_AI_COMMAND;
|
|
61
|
+
const aiPackage = process.env.UMI_AI_PACKAGE;
|
|
62
|
+
const aiCommandExists = checkBinExists(aiCommand);
|
|
63
|
+
const npmClient = api.appData.npmClient;
|
|
64
|
+
const hasErrors = ((_b = (_a = args.stats) == null ? void 0 : _a.hasErrors) == null ? void 0 : _b.call(_a)) || false;
|
|
65
|
+
if (hasErrors) {
|
|
66
|
+
const errorStats = args.stats.toString();
|
|
67
|
+
const errorFilePath = import_path.default.join(api.paths.absTmpPath, "devError.txt");
|
|
68
|
+
const relativeErrorFilePath = (0, import_utils.winPath)(
|
|
69
|
+
import_path.default.relative(api.paths.cwd, errorFilePath)
|
|
70
|
+
);
|
|
71
|
+
const prefix = aiCommandExists ? "" : `${npmClient} install -g ${aiPackage} && `;
|
|
72
|
+
try {
|
|
73
|
+
import_fs.default.writeFileSync(errorFilePath, errorStats);
|
|
74
|
+
console.log();
|
|
75
|
+
console.log(import_utils.chalk.red("🤖 AI Dev: Compilation errors detected!"));
|
|
76
|
+
console.log(`Error details saved to: ${errorFilePath}`);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.log();
|
|
79
|
+
console.log(import_utils.chalk.red("🤖 AI Dev: Compilation errors detected!"));
|
|
80
|
+
console.log(import_utils.chalk.yellow("⚠️ Could not save error details"));
|
|
81
|
+
}
|
|
82
|
+
console.log(
|
|
83
|
+
import_utils.chalk.yellow(
|
|
84
|
+
`💡 Suggestion: Run \`${prefix}${aiCommand} "fix error in ${relativeErrorFilePath}"\` to get AI assistance`
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
console.log();
|
|
88
|
+
}
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.log(`[AI Dev] Error: ${err}`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
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/features/bundler/bundler.ts
|
|
20
|
+
var bundler_exports = {};
|
|
21
|
+
__export(bundler_exports, {
|
|
22
|
+
default: () => bundler_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(bundler_exports);
|
|
25
|
+
var import_lazyImportFromCurrentPkg = require("../../utils/lazyImportFromCurrentPkg");
|
|
26
|
+
var bundlerWebpack = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-webpack");
|
|
27
|
+
var bundlerVite = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-vite");
|
|
28
|
+
var bundler_default = (api) => {
|
|
29
|
+
api.describe({
|
|
30
|
+
// Don't occupy proprietary terms
|
|
31
|
+
key: "preset-umi:bundler"
|
|
32
|
+
});
|
|
33
|
+
api.modifyUniBundler((_, { bundler }) => {
|
|
34
|
+
if (bundler === "mako") {
|
|
35
|
+
require("@umijs/bundler-webpack/dist/requireHook");
|
|
36
|
+
return require(process.env.OKAM);
|
|
37
|
+
}
|
|
38
|
+
if (bundler === "vite") {
|
|
39
|
+
return bundlerVite;
|
|
40
|
+
}
|
|
41
|
+
return bundlerWebpack;
|
|
42
|
+
});
|
|
43
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
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/features/stagewise/stagewise.ts
|
|
30
|
+
var stagewise_exports = {};
|
|
31
|
+
__export(stagewise_exports, {
|
|
32
|
+
default: () => stagewise_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(stagewise_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var stagewise_default = (api) => {
|
|
37
|
+
api.describe({
|
|
38
|
+
key: "stagewise",
|
|
39
|
+
config: {
|
|
40
|
+
schema(zod) {
|
|
41
|
+
return zod.any();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
enableBy: api.EnableBy.config
|
|
45
|
+
});
|
|
46
|
+
api.onGenerateFiles(() => {
|
|
47
|
+
const stagewiseToolbarPath = import_path.default.join(
|
|
48
|
+
import_path.default.dirname(require.resolve("@stagewise/toolbar")),
|
|
49
|
+
".."
|
|
50
|
+
);
|
|
51
|
+
api.writeTmpFile({
|
|
52
|
+
path: "stagewise.ts",
|
|
53
|
+
content: `
|
|
54
|
+
import { initToolbar } from '${stagewiseToolbarPath}';
|
|
55
|
+
const stagewiseConfig = ${JSON.stringify(api.config.stagewise, null, 2)};
|
|
56
|
+
function setupStagewise() {
|
|
57
|
+
// Only initialize once and only in development mode
|
|
58
|
+
if (process.env.NODE_ENV === 'development') {
|
|
59
|
+
initToolbar(stagewiseConfig);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
setupStagewise();
|
|
63
|
+
`
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
api.addEntryImports(() => {
|
|
67
|
+
if (api.name !== "dev" && api.name !== "setup") {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return [{ source: "@@/plugin-stagewise/stagewise.ts" }];
|
|
71
|
+
});
|
|
72
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ var src_default = () => {
|
|
|
40
40
|
// features
|
|
41
41
|
process.env.DID_YOU_KNOW !== "none" && require.resolve("@umijs/did-you-know/dist/plugin"),
|
|
42
42
|
require.resolve("./features/404/404"),
|
|
43
|
+
require.resolve("./features/aiDev/aiDev"),
|
|
43
44
|
require.resolve("./features/appData/appData"),
|
|
44
45
|
require.resolve("./features/appData/umiInfo"),
|
|
45
46
|
require.resolve("./features/check/check"),
|
|
@@ -64,6 +65,7 @@ var src_default = () => {
|
|
|
64
65
|
require.resolve("./features/polyfill/publicPathPolyfill"),
|
|
65
66
|
require.resolve("./features/prepare/prepare"),
|
|
66
67
|
require.resolve("./features/routePrefetch/routePrefetch"),
|
|
68
|
+
require.resolve("./features/stagewise/stagewise"),
|
|
67
69
|
require.resolve("./features/terminal/terminal"),
|
|
68
70
|
// 1. generate tmp files
|
|
69
71
|
require.resolve("./features/tmpFiles/tmpFiles"),
|
|
@@ -89,6 +91,7 @@ var src_default = () => {
|
|
|
89
91
|
require.resolve("./features/hmrGuardian/hmrGuardian"),
|
|
90
92
|
require.resolve("./features/routePreloadOnLoad/routePreloadOnLoad"),
|
|
91
93
|
require.resolve("./features/forget/forget"),
|
|
94
|
+
require.resolve("./features/bundler/bundler"),
|
|
92
95
|
// commands
|
|
93
96
|
require.resolve("./commands/build"),
|
|
94
97
|
require.resolve("./commands/config/config"),
|
package/dist/registerMethods.js
CHANGED
|
@@ -87,7 +87,10 @@ var registerMethods_default = (api) => {
|
|
|
87
87
|
"modifyServerRendererPath",
|
|
88
88
|
"modifyRoutes",
|
|
89
89
|
"modifyBabelPresetOpts",
|
|
90
|
-
"modifyTSConfig"
|
|
90
|
+
"modifyTSConfig",
|
|
91
|
+
// support custom bundler
|
|
92
|
+
"modifyUniBundler",
|
|
93
|
+
"modifyUniBundlerOpts"
|
|
91
94
|
].forEach((name) => {
|
|
92
95
|
api.registerMethod({ name });
|
|
93
96
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -82,6 +82,22 @@ export declare type GenerateFilesFn = (opts: IOnGenerateFiles) => Promise<void>;
|
|
|
82
82
|
export declare type OnConfigChangeFn = (opts: {
|
|
83
83
|
generate: GenerateFilesFn;
|
|
84
84
|
}) => void | Promise<void>;
|
|
85
|
+
export interface IUniBundlerInstance {
|
|
86
|
+
dev: (opts: any) => Promise<void>;
|
|
87
|
+
build: (opts: any) => Promise<any>;
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
}
|
|
90
|
+
export interface IBundlerOpts {
|
|
91
|
+
config: IConfig;
|
|
92
|
+
cwd: string;
|
|
93
|
+
entry: Record<string, string>;
|
|
94
|
+
pkg: Record<string, any>;
|
|
95
|
+
rootDir: string;
|
|
96
|
+
ip: string;
|
|
97
|
+
port: number;
|
|
98
|
+
host: string;
|
|
99
|
+
[key: string]: any;
|
|
100
|
+
}
|
|
85
101
|
export declare type IApi = PluginAPI & IServicePluginAPI & {
|
|
86
102
|
addApiMiddlewares: IAdd<null, IApiMiddleware>;
|
|
87
103
|
addBeforeBabelPlugins: IAdd<null, any>;
|
|
@@ -139,6 +155,13 @@ export declare type IApi = PluginAPI & IServicePluginAPI & {
|
|
|
139
155
|
modifyRoutes: IModify<Record<string, IRoute>, {}>;
|
|
140
156
|
modifyServerRendererPath: IModify<string, {}>;
|
|
141
157
|
modifyTSConfig: IModify<Record<string, any>, {}>;
|
|
158
|
+
modifyUniBundler: IModify<IUniBundlerInstance, {
|
|
159
|
+
bundler: string;
|
|
160
|
+
opts: IBundlerOpts;
|
|
161
|
+
}>;
|
|
162
|
+
modifyUniBundlerOpts: IModify<IBundlerOpts, {
|
|
163
|
+
bundler: string;
|
|
164
|
+
}>;
|
|
142
165
|
modifyViteConfig: IModify<ViteInlineConfig, {
|
|
143
166
|
env: Env;
|
|
144
167
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.12",
|
|
4
4
|
"description": "@umijs/preset-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@iconify/utils": "2.1.1",
|
|
23
|
+
"@stagewise/toolbar": "0.6.2",
|
|
23
24
|
"@svgr/core": "6.5.1",
|
|
24
25
|
"@umijs/bundler-mako": "0.11.10",
|
|
26
|
+
"@umijs/did-you-know": "^1.0.4",
|
|
25
27
|
"@umijs/es-module-parser": "0.0.7",
|
|
26
28
|
"@umijs/history": "5.3.1",
|
|
27
29
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
|
@@ -41,21 +43,20 @@
|
|
|
41
43
|
"react-router": "6.3.0",
|
|
42
44
|
"react-router-dom": "6.3.0",
|
|
43
45
|
"regenerator-runtime": "0.13.11",
|
|
44
|
-
"@umijs/ast": "4.4.
|
|
45
|
-
"@umijs/babel-preset-umi": "4.4.
|
|
46
|
-
"@umijs/bundler-utils": "4.4.
|
|
47
|
-
"@umijs/bundler-vite": "4.4.
|
|
48
|
-
"@umijs/bundler-webpack": "4.4.
|
|
49
|
-
"@umijs/
|
|
50
|
-
"@umijs/
|
|
51
|
-
"@umijs/
|
|
52
|
-
"@umijs/renderer-react": "4.4.
|
|
53
|
-
"@umijs/server": "4.4.
|
|
54
|
-
"@umijs/mfsu": "4.4.10",
|
|
55
|
-
"@umijs/utils": "4.4.10",
|
|
46
|
+
"@umijs/ast": "4.4.12",
|
|
47
|
+
"@umijs/babel-preset-umi": "4.4.12",
|
|
48
|
+
"@umijs/bundler-utils": "4.4.12",
|
|
49
|
+
"@umijs/bundler-vite": "4.4.12",
|
|
50
|
+
"@umijs/bundler-webpack": "4.4.12",
|
|
51
|
+
"@umijs/bundler-esbuild": "4.4.12",
|
|
52
|
+
"@umijs/plugin-run": "4.4.12",
|
|
53
|
+
"@umijs/core": "4.4.12",
|
|
54
|
+
"@umijs/renderer-react": "4.4.12",
|
|
55
|
+
"@umijs/server": "4.4.12",
|
|
56
56
|
"@umijs/ui": "3.0.1",
|
|
57
|
-
"@umijs/
|
|
58
|
-
"@umijs/zod2ts": "4.4.
|
|
57
|
+
"@umijs/utils": "4.4.12",
|
|
58
|
+
"@umijs/zod2ts": "4.4.12",
|
|
59
|
+
"@umijs/mfsu": "4.4.12"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@manypkg/get-packages": "1.1.3",
|