@storm-software/eslint 0.170.154 → 0.170.156

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.
@@ -1,2 +1,216 @@
1
- export { basename, correctPaths, dirname, extname, format, isAbsolute, joinPaths, normalizeString, normalizeWindowsPath, parse, relative, resolve, sep, toNamespacedPath } from '../chunk-ZODAKOU6.js';
2
- import '../chunk-DQLHUNSU.js';
1
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
+ function normalizeWindowsPath(input = "") {
3
+ if (!input) {
4
+ return input;
5
+ }
6
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
+ }
8
+ const _UNC_REGEX = /^[/\\]{2}/;
9
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
10
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
11
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
12
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
13
+ const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
14
+ const sep = "/";
15
+ const correctPaths = function(path) {
16
+ if (!path || path.length === 0) {
17
+ return ".";
18
+ }
19
+ path = normalizeWindowsPath(path);
20
+ const isUNCPath = path.match(_UNC_REGEX);
21
+ const isPathAbsolute = isAbsolute(path);
22
+ const trailingSeparator = path[path.length - 1] === "/";
23
+ path = normalizeString(path, !isPathAbsolute);
24
+ if (path.length === 0) {
25
+ if (isPathAbsolute) {
26
+ return "/";
27
+ }
28
+ return trailingSeparator ? "./" : ".";
29
+ }
30
+ if (trailingSeparator) {
31
+ path += "/";
32
+ }
33
+ if (_DRIVE_LETTER_RE.test(path)) {
34
+ path += "/";
35
+ }
36
+ if (isUNCPath) {
37
+ if (!isPathAbsolute) {
38
+ return `//./${path}`;
39
+ }
40
+ return `//${path}`;
41
+ }
42
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
43
+ };
44
+ const joinPaths = function(...segments) {
45
+ let path = "";
46
+ for (const seg of segments) {
47
+ if (!seg) {
48
+ continue;
49
+ }
50
+ if (path.length > 0) {
51
+ const pathTrailing = path[path.length - 1] === "/";
52
+ const segLeading = seg[0] === "/";
53
+ const both = pathTrailing && segLeading;
54
+ if (both) {
55
+ path += seg.slice(1);
56
+ } else {
57
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
58
+ }
59
+ } else {
60
+ path += seg;
61
+ }
62
+ }
63
+ return correctPaths(path);
64
+ };
65
+ function cwd() {
66
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
67
+ return process.cwd().replace(/\\/g, "/");
68
+ }
69
+ return "/";
70
+ }
71
+ const resolve = function(...arguments_) {
72
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
73
+ let resolvedPath = "";
74
+ let resolvedAbsolute = false;
75
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
76
+ const path = index >= 0 ? arguments_[index] : cwd();
77
+ if (!path || path.length === 0) {
78
+ continue;
79
+ }
80
+ resolvedPath = `${path}/${resolvedPath}`;
81
+ resolvedAbsolute = isAbsolute(path);
82
+ }
83
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
84
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
85
+ return `/${resolvedPath}`;
86
+ }
87
+ return resolvedPath.length > 0 ? resolvedPath : ".";
88
+ };
89
+ function normalizeString(path, allowAboveRoot) {
90
+ let res = "";
91
+ let lastSegmentLength = 0;
92
+ let lastSlash = -1;
93
+ let dots = 0;
94
+ let char = null;
95
+ for (let index = 0; index <= path.length; ++index) {
96
+ if (index < path.length) {
97
+ char = path[index];
98
+ } else if (char === "/") {
99
+ break;
100
+ } else {
101
+ char = "/";
102
+ }
103
+ if (char === "/") {
104
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
105
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
106
+ if (res.length > 2) {
107
+ const lastSlashIndex = res.lastIndexOf("/");
108
+ if (lastSlashIndex === -1) {
109
+ res = "";
110
+ lastSegmentLength = 0;
111
+ } else {
112
+ res = res.slice(0, lastSlashIndex);
113
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
114
+ }
115
+ lastSlash = index;
116
+ dots = 0;
117
+ continue;
118
+ } else if (res.length > 0) {
119
+ res = "";
120
+ lastSegmentLength = 0;
121
+ lastSlash = index;
122
+ dots = 0;
123
+ continue;
124
+ }
125
+ }
126
+ if (allowAboveRoot) {
127
+ res += res.length > 0 ? "/.." : "..";
128
+ lastSegmentLength = 2;
129
+ }
130
+ } else {
131
+ if (res.length > 0) {
132
+ res += `/${path.slice(lastSlash + 1, index)}`;
133
+ } else {
134
+ res = path.slice(lastSlash + 1, index);
135
+ }
136
+ lastSegmentLength = index - lastSlash - 1;
137
+ }
138
+ lastSlash = index;
139
+ dots = 0;
140
+ } else if (char === "." && dots !== -1) {
141
+ ++dots;
142
+ } else {
143
+ dots = -1;
144
+ }
145
+ }
146
+ return res;
147
+ }
148
+ const isAbsolute = function(p) {
149
+ return _IS_ABSOLUTE_RE.test(p);
150
+ };
151
+ const toNamespacedPath = function(p) {
152
+ return normalizeWindowsPath(p);
153
+ };
154
+ const extname = function(p) {
155
+ if (p === "..") return "";
156
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
157
+ return match && match[1] || "";
158
+ };
159
+ const relative = function(from, to) {
160
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
161
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
162
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
163
+ return _to.join("/");
164
+ }
165
+ const _fromCopy = [..._from];
166
+ for (const segment of _fromCopy) {
167
+ if (_to[0] !== segment) {
168
+ break;
169
+ }
170
+ _from.shift();
171
+ _to.shift();
172
+ }
173
+ return [..._from.map(() => ".."), ..._to].join("/");
174
+ };
175
+ const dirname = function(p) {
176
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
177
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
178
+ segments[0] += "/";
179
+ }
180
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
181
+ };
182
+ const format = function(p) {
183
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
184
+ const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
185
+ Boolean
186
+ );
187
+ return normalizeWindowsPath(
188
+ p.root ? resolve(...segments) : segments.join("/")
189
+ );
190
+ };
191
+ const basename = function(p, extension) {
192
+ const segments = normalizeWindowsPath(p).split("/");
193
+ let lastSegment = "";
194
+ for (let i = segments.length - 1; i >= 0; i--) {
195
+ const val = segments[i];
196
+ if (val) {
197
+ lastSegment = val;
198
+ break;
199
+ }
200
+ }
201
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
202
+ };
203
+ const parse = function(p) {
204
+ const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
205
+ const base = basename(p);
206
+ const extension = extname(base);
207
+ return {
208
+ root,
209
+ dir: dirname(p),
210
+ base,
211
+ ext: extension,
212
+ name: base.slice(0, base.length - extension.length)
213
+ };
214
+ };
215
+
216
+ export { basename, correctPaths, dirname, extname, format, isAbsolute, joinPaths, normalizeString, normalizeWindowsPath, parse, relative, resolve, sep, toNamespacedPath };
@@ -1,133 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var fs = require('fs');
4
- var path = require('path');
3
+ var node_fs = require('node:fs');
4
+ var node_path = require('node:path');
5
+ var correctPaths = require('./correct-paths');
5
6
 
6
- // src/utils/find-workspace-root.ts
7
-
8
- // src/utils/correct-paths.ts
9
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
10
- function normalizeWindowsPath(input = "") {
11
- if (!input) {
12
- return input;
13
- }
14
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
15
- }
16
- var _UNC_REGEX = /^[/\\]{2}/;
17
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
18
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
19
- var correctPaths = function(path) {
20
- if (!path || path.length === 0) {
21
- return ".";
22
- }
23
- path = normalizeWindowsPath(path);
24
- const isUNCPath = path.match(_UNC_REGEX);
25
- const isPathAbsolute = isAbsolute(path);
26
- const trailingSeparator = path[path.length - 1] === "/";
27
- path = normalizeString(path, !isPathAbsolute);
28
- if (path.length === 0) {
29
- if (isPathAbsolute) {
30
- return "/";
31
- }
32
- return trailingSeparator ? "./" : ".";
33
- }
34
- if (trailingSeparator) {
35
- path += "/";
36
- }
37
- if (_DRIVE_LETTER_RE.test(path)) {
38
- path += "/";
39
- }
40
- if (isUNCPath) {
41
- if (!isPathAbsolute) {
42
- return `//./${path}`;
43
- }
44
- return `//${path}`;
45
- }
46
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
47
- };
48
- function normalizeString(path, allowAboveRoot) {
49
- let res = "";
50
- let lastSegmentLength = 0;
51
- let lastSlash = -1;
52
- let dots = 0;
53
- let char = null;
54
- for (let index = 0; index <= path.length; ++index) {
55
- if (index < path.length) {
56
- char = path[index];
57
- } else if (char === "/") {
58
- break;
59
- } else {
60
- char = "/";
61
- }
62
- if (char === "/") {
63
- if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
64
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
65
- if (res.length > 2) {
66
- const lastSlashIndex = res.lastIndexOf("/");
67
- if (lastSlashIndex === -1) {
68
- res = "";
69
- lastSegmentLength = 0;
70
- } else {
71
- res = res.slice(0, lastSlashIndex);
72
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
73
- }
74
- lastSlash = index;
75
- dots = 0;
76
- continue;
77
- } else if (res.length > 0) {
78
- res = "";
79
- lastSegmentLength = 0;
80
- lastSlash = index;
81
- dots = 0;
82
- continue;
83
- }
84
- }
85
- if (allowAboveRoot) {
86
- res += res.length > 0 ? "/.." : "..";
87
- lastSegmentLength = 2;
88
- }
89
- } else {
90
- if (res.length > 0) {
91
- res += `/${path.slice(lastSlash + 1, index)}`;
92
- } else {
93
- res = path.slice(lastSlash + 1, index);
94
- }
95
- lastSegmentLength = index - lastSlash - 1;
96
- }
97
- lastSlash = index;
98
- dots = 0;
99
- } else if (char === "." && dots !== -1) {
100
- ++dots;
101
- } else {
102
- dots = -1;
103
- }
104
- }
105
- return res;
106
- }
107
- var isAbsolute = function(p) {
108
- return _IS_ABSOLUTE_RE.test(p);
109
- };
110
-
111
- // src/utils/find-workspace-root.ts
112
- var MAX_PATH_SEARCH_DEPTH = 30;
113
- var depth = 0;
7
+ const MAX_PATH_SEARCH_DEPTH = 30;
8
+ let depth = 0;
114
9
  function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
115
10
  const _startPath = startPath ?? process.cwd();
116
11
  if (endDirectoryNames.some(
117
- (endDirName) => fs.existsSync(path.join(_startPath, endDirName))
12
+ (endDirName) => node_fs.existsSync(node_path.join(_startPath, endDirName))
118
13
  )) {
119
14
  return _startPath;
120
15
  }
121
- if (endFileNames.some((endFileName) => fs.existsSync(path.join(_startPath, endFileName)))) {
16
+ if (endFileNames.some((endFileName) => node_fs.existsSync(node_path.join(_startPath, endFileName)))) {
122
17
  return _startPath;
123
18
  }
124
19
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
125
- const parent = path.join(_startPath, "..");
20
+ const parent = node_path.join(_startPath, "..");
126
21
  return findFolderUp(parent, endFileNames, endDirectoryNames);
127
22
  }
128
23
  return void 0;
129
24
  }
130
- var rootFiles = [
25
+ const rootFiles = [
131
26
  "storm-workspace.json",
132
27
  "storm-workspace.json",
133
28
  "storm-workspace.yaml",
@@ -162,7 +57,7 @@ var rootFiles = [
162
57
  "pnpm-lock.yml",
163
58
  "bun.lockb"
164
59
  ];
165
- var rootDirectories = [
60
+ const rootDirectories = [
166
61
  ".storm-workspace",
167
62
  ".nx",
168
63
  ".github",
@@ -171,11 +66,11 @@ var rootDirectories = [
171
66
  ];
172
67
  function findWorkspaceRootSafe(pathInsideMonorepo) {
173
68
  if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
174
- return correctPaths(
69
+ return correctPaths.correctPaths(
175
70
  process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
176
71
  );
177
72
  }
178
- return correctPaths(
73
+ return correctPaths.correctPaths(
179
74
  findFolderUp(
180
75
  pathInsideMonorepo ?? process.cwd(),
181
76
  rootFiles,
@@ -1,3 +1,93 @@
1
- export { findWorkspaceRoot, findWorkspaceRootSafe } from '../chunk-HHXJGKW3.js';
2
- import '../chunk-ZODAKOU6.js';
3
- import '../chunk-DQLHUNSU.js';
1
+ import { existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { correctPaths } from './correct-paths';
4
+
5
+ const MAX_PATH_SEARCH_DEPTH = 30;
6
+ let depth = 0;
7
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
8
+ const _startPath = startPath ?? process.cwd();
9
+ if (endDirectoryNames.some(
10
+ (endDirName) => existsSync(join(_startPath, endDirName))
11
+ )) {
12
+ return _startPath;
13
+ }
14
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
15
+ return _startPath;
16
+ }
17
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
18
+ const parent = join(_startPath, "..");
19
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
20
+ }
21
+ return void 0;
22
+ }
23
+ const rootFiles = [
24
+ "storm-workspace.json",
25
+ "storm-workspace.json",
26
+ "storm-workspace.yaml",
27
+ "storm-workspace.yml",
28
+ "storm-workspace.js",
29
+ "storm-workspace.ts",
30
+ ".storm-workspace.json",
31
+ ".storm-workspace.yaml",
32
+ ".storm-workspace.yml",
33
+ ".storm-workspace.js",
34
+ ".storm-workspace.ts",
35
+ "lerna.json",
36
+ "nx.json",
37
+ "turbo.json",
38
+ "npm-workspace.json",
39
+ "yarn-workspace.json",
40
+ "pnpm-workspace.json",
41
+ "npm-workspace.yaml",
42
+ "yarn-workspace.yaml",
43
+ "pnpm-workspace.yaml",
44
+ "npm-workspace.yml",
45
+ "yarn-workspace.yml",
46
+ "pnpm-workspace.yml",
47
+ "npm-lock.json",
48
+ "yarn-lock.json",
49
+ "pnpm-lock.json",
50
+ "npm-lock.yaml",
51
+ "yarn-lock.yaml",
52
+ "pnpm-lock.yaml",
53
+ "npm-lock.yml",
54
+ "yarn-lock.yml",
55
+ "pnpm-lock.yml",
56
+ "bun.lockb"
57
+ ];
58
+ const rootDirectories = [
59
+ ".storm-workspace",
60
+ ".nx",
61
+ ".github",
62
+ ".vscode",
63
+ ".verdaccio"
64
+ ];
65
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
66
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
67
+ return correctPaths(
68
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
69
+ );
70
+ }
71
+ return correctPaths(
72
+ findFolderUp(
73
+ pathInsideMonorepo ?? process.cwd(),
74
+ rootFiles,
75
+ rootDirectories
76
+ )
77
+ );
78
+ }
79
+ function findWorkspaceRoot(pathInsideMonorepo) {
80
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
81
+ if (!result) {
82
+ throw new Error(
83
+ `Cannot find workspace root upwards from known path. Files search list includes:
84
+ ${rootFiles.join(
85
+ "\n"
86
+ )}
87
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
88
+ );
89
+ }
90
+ return result;
91
+ }
92
+
93
+ export { findWorkspaceRoot, findWorkspaceRootSafe };
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // src/utils/format-config.ts
4
- var formatConfig = (name, config = []) => {
3
+ const formatConfig = (name, config = []) => {
5
4
  return config.map((config2, index) => {
6
5
  if (!config2 || config2.name) {
7
6
  return config2 ?? {};
@@ -1,8 +1,4 @@
1
- import { init_esm_shims } from '../chunk-DQLHUNSU.js';
2
-
3
- // src/utils/format-config.ts
4
- init_esm_shims();
5
- var formatConfig = (name, config = []) => {
1
+ const formatConfig = (name, config = []) => {
6
2
  return config.map((config2, index) => {
7
3
  if (!config2 || config2.name) {
8
4
  return config2 ?? {};
@@ -1,19 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  var localPkg = require('local-pkg');
4
- var process = require('process');
5
- var url = require('url');
4
+ var process = require('node:process');
5
+ var node_url = require('node:url');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var process__default = /*#__PURE__*/_interopDefault(process);
10
10
 
11
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=a9def7e06ce25c19654987ab91979289197bf4d3e7e124c514a4487c3e8d68c6__f89459d39c08990d42ec4dad446e797b/node_modules/tsup/assets/cjs_shims.js
12
11
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
13
12
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
14
- var scopeUrl = url.fileURLToPath(new URL(".", importMetaUrl));
15
- var isCwdInScope = localPkg.isPackageExists("@storm-software/eslint");
16
- var parserPlain = {
13
+ const scopeUrl = node_url.fileURLToPath(new URL(".", importMetaUrl));
14
+ const isCwdInScope = localPkg.isPackageExists("@storm-software/eslint");
15
+ const parserPlain = {
17
16
  meta: {
18
17
  name: "parser-plain"
19
18
  },
@@ -1,2 +1,72 @@
1
- export { ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, renameRules } from '../chunk-BJYTFC3E.js';
2
- import '../chunk-DQLHUNSU.js';
1
+ import { isPackageExists } from 'local-pkg';
2
+ import process from 'node:process';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
6
+ const isCwdInScope = isPackageExists("@storm-software/eslint");
7
+ const parserPlain = {
8
+ meta: {
9
+ name: "parser-plain"
10
+ },
11
+ parseForESLint: (code) => ({
12
+ ast: {
13
+ body: [],
14
+ comments: [],
15
+ loc: { end: code.length, start: 0 },
16
+ range: [0, code.length],
17
+ tokens: [],
18
+ type: "Program"
19
+ },
20
+ scopeManager: null,
21
+ services: { isPlain: true },
22
+ visitorKeys: {
23
+ Program: []
24
+ }
25
+ })
26
+ };
27
+ function isInGitHooksOrLintStaged() {
28
+ return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged") || process.env.npm_lifecycle_script?.startsWith("lefthook") || process.env.npm_lifecycle_script === "push");
29
+ }
30
+ function isInEditorEnv() {
31
+ if (process.env.CI) return false;
32
+ if (isInGitHooksOrLintStaged()) return false;
33
+ return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
34
+ }
35
+ async function interopDefault(m) {
36
+ const resolved = await m;
37
+ return resolved.default || resolved;
38
+ }
39
+ function isPackageInScope(name) {
40
+ return isPackageExists(name, { paths: [scopeUrl] });
41
+ }
42
+ async function ensurePackages(packages) {
43
+ if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
44
+ return;
45
+ const nonExistingPackages = packages.filter(
46
+ (i) => i && !isPackageInScope(i)
47
+ );
48
+ if (nonExistingPackages.length === 0) return;
49
+ const p = await import('@clack/prompts');
50
+ const result = await p.confirm({
51
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(
52
+ ", "
53
+ )}. Do you want to install them?`
54
+ });
55
+ if (result)
56
+ await import('@antfu/install-pkg').then(
57
+ (i) => i.installPackage(nonExistingPackages, { dev: true })
58
+ );
59
+ }
60
+ function renameRules(rules, map) {
61
+ return Object.fromEntries(
62
+ Object.entries(rules).map(([key, value]) => {
63
+ for (const [from, to] of Object.entries(map)) {
64
+ if (key.startsWith(`${from}/`))
65
+ return [to + key.slice(from.length), value];
66
+ }
67
+ return [key, value];
68
+ })
69
+ );
70
+ }
71
+
72
+ export { ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, renameRules };