@umijs/preset-umi 4.4.11 → 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/dev/dev.js
CHANGED
|
@@ -63,13 +63,6 @@ var dev_default = (api) => {
|
|
|
63
63
|
return;
|
|
64
64
|
if (process.env.BIGFISH_INFO)
|
|
65
65
|
return;
|
|
66
|
-
if (process.env.MAKO_AD === "none")
|
|
67
|
-
return;
|
|
68
|
-
console.info(
|
|
69
|
-
import_utils.chalk.yellow.bold(
|
|
70
|
-
"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."
|
|
71
|
-
)
|
|
72
|
-
);
|
|
73
66
|
});
|
|
74
67
|
api.registerCommand({
|
|
75
68
|
name: "dev",
|
|
@@ -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,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"),
|
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-
|
|
47
|
-
"@umijs/bundler-
|
|
48
|
-
"@umijs/bundler-
|
|
49
|
-
"@umijs/bundler-
|
|
50
|
-
"@umijs/
|
|
51
|
-
"@umijs/
|
|
52
|
-
"@umijs/
|
|
53
|
-
"@umijs/server": "4.4.
|
|
54
|
-
"@umijs/renderer-react": "4.4.11",
|
|
55
|
-
"@umijs/plugin-run": "4.4.11",
|
|
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/utils": "4.4.
|
|
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",
|