@umijs/preset-umi 4.7.16 → 4.7.18
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/lint/utlint.d.ts +1 -0
- package/dist/commands/lint/utlint.js +64 -0
- package/dist/commands/lint.js +27 -3
- package/package.json +16 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runUtlint(cwd: string, args: string[]): Promise<void>;
|
|
@@ -0,0 +1,64 @@
|
|
|
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/commands/lint/utlint.ts
|
|
20
|
+
var utlint_exports = {};
|
|
21
|
+
__export(utlint_exports, {
|
|
22
|
+
runUtlint: () => runUtlint
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utlint_exports);
|
|
25
|
+
var import_child_process = require("child_process");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
async function runUtlint(cwd, args) {
|
|
28
|
+
let binPath;
|
|
29
|
+
try {
|
|
30
|
+
const pkgPath = require.resolve("@utoo/lint/package.json", {
|
|
31
|
+
paths: [cwd]
|
|
32
|
+
});
|
|
33
|
+
binPath = (0, import_path.resolve)((0, import_path.dirname)(pkgPath), require(pkgPath).bin["utoo-lint"]);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"@utoo/lint is required for umi lint --utlint. Please install it in your project with npm install -D @utoo/lint (Node.js >=20).",
|
|
37
|
+
{ cause: err }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
await new Promise((resolve2, reject) => {
|
|
41
|
+
(0, import_child_process.fork)(binPath, args, {
|
|
42
|
+
cwd,
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
env: {
|
|
45
|
+
...process.env,
|
|
46
|
+
// The migration tool reads rule configs without loading ESLint plugins.
|
|
47
|
+
// Umi's ESLint resolution patch requires a real ESLint caller instead.
|
|
48
|
+
UMI_UTLINT_MIGRATE: args[0] === "migrate" && args[1] === "eslint" ? "1" : "0"
|
|
49
|
+
}
|
|
50
|
+
}).once("error", reject).once("exit", (code, signal) => {
|
|
51
|
+
if (signal) {
|
|
52
|
+
reject(new Error(`utoo-lint was terminated by ${signal}.`));
|
|
53
|
+
} else {
|
|
54
|
+
if (code)
|
|
55
|
+
process.exitCode = code;
|
|
56
|
+
resolve2();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
runUtlint
|
|
64
|
+
});
|
package/dist/commands/lint.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_utils = require("@umijs/utils");
|
|
|
36
36
|
var lint_default = (api) => {
|
|
37
37
|
api.registerCommand({
|
|
38
38
|
name: "lint",
|
|
39
|
-
description: "lint source code using eslint and stylelint",
|
|
39
|
+
description: "lint source code using eslint and stylelint, or utoo-lint",
|
|
40
40
|
configResolveMode: "loose",
|
|
41
41
|
details: `
|
|
42
42
|
umi lint
|
|
@@ -48,6 +48,11 @@ umi lint "**/*.{ts,scss}"
|
|
|
48
48
|
umi lint --eslint-only
|
|
49
49
|
umi lint --stylelint-only
|
|
50
50
|
|
|
51
|
+
# opt in to standalone utoo-lint (requires @utoo/lint)
|
|
52
|
+
umi lint --utlint
|
|
53
|
+
umi lint --utlint --fix src
|
|
54
|
+
umi lint --utlint migrate eslint --from .eslintrc.js
|
|
55
|
+
|
|
51
56
|
# automatically fix, where possible
|
|
52
57
|
umi lint --fix
|
|
53
58
|
|
|
@@ -55,9 +60,28 @@ umi lint --fix
|
|
|
55
60
|
umi lint --quiet
|
|
56
61
|
`,
|
|
57
62
|
fn: async function() {
|
|
58
|
-
const
|
|
59
|
-
|
|
63
|
+
const rawArgs = process.argv.slice(3);
|
|
64
|
+
const args = (0, import_utils.yParser)(rawArgs, {
|
|
65
|
+
boolean: ["quiet", "fix", "eslint-only", "stylelint-only", "utlint"]
|
|
60
66
|
});
|
|
67
|
+
if (args.utlint) {
|
|
68
|
+
if (args.eslintOnly || args.stylelintOnly || args.cssinjs) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
"--utlint cannot be combined with --eslint-only, --stylelint-only or --cssinjs. Run stylelint separately with umi lint --stylelint-only."
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const forwardedArgs = [...rawArgs];
|
|
74
|
+
for (let i = 0; i < forwardedArgs.length; i++) {
|
|
75
|
+
if (forwardedArgs[i] === "--")
|
|
76
|
+
break;
|
|
77
|
+
if (/^--(?:no-)?utlint(?:=.*)?$/.test(forwardedArgs[i])) {
|
|
78
|
+
const count = forwardedArgs[i] === "--utlint" && /^(true|false)$/.test(forwardedArgs[i + 1] || "") ? 2 : 1;
|
|
79
|
+
forwardedArgs.splice(i, count);
|
|
80
|
+
i--;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return require("./lint/utlint").runUtlint(api.cwd, forwardedArgs);
|
|
84
|
+
}
|
|
61
85
|
try {
|
|
62
86
|
require.resolve("@umijs/lint/package.json");
|
|
63
87
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.18",
|
|
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",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"react-router": "6.3.0",
|
|
44
44
|
"react-router-dom": "6.3.0",
|
|
45
45
|
"regenerator-runtime": "0.13.11",
|
|
46
|
-
"@umijs/ast": "4.7.
|
|
47
|
-
"@umijs/
|
|
48
|
-
"@umijs/
|
|
49
|
-
"@umijs/bundler-
|
|
50
|
-
"@umijs/bundler-
|
|
51
|
-
"@umijs/bundler-
|
|
52
|
-
"@umijs/bundler-webpack": "4.7.
|
|
53
|
-
"@umijs/
|
|
54
|
-
"@umijs/
|
|
55
|
-
"@umijs/
|
|
56
|
-
"@umijs/
|
|
57
|
-
"@umijs/
|
|
58
|
-
"@umijs/
|
|
59
|
-
"@umijs/
|
|
60
|
-
"@umijs/
|
|
46
|
+
"@umijs/ast": "4.7.18",
|
|
47
|
+
"@umijs/babel-preset-umi": "4.7.18",
|
|
48
|
+
"@umijs/bundler-esbuild": "4.7.18",
|
|
49
|
+
"@umijs/bundler-utils": "4.7.18",
|
|
50
|
+
"@umijs/bundler-utoopack": "4.7.18",
|
|
51
|
+
"@umijs/bundler-vite": "4.7.18",
|
|
52
|
+
"@umijs/bundler-webpack": "4.7.18",
|
|
53
|
+
"@umijs/mfsu": "4.7.18",
|
|
54
|
+
"@umijs/core": "4.7.18",
|
|
55
|
+
"@umijs/plugin-run": "4.7.18",
|
|
56
|
+
"@umijs/renderer-react": "4.7.18",
|
|
57
|
+
"@umijs/server": "4.7.18",
|
|
58
|
+
"@umijs/ui": "3.0.1",
|
|
59
|
+
"@umijs/utils": "4.7.18",
|
|
60
|
+
"@umijs/zod2ts": "4.7.18"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@manypkg/get-packages": "1.1.3",
|