@croct/eslint-plugin
Version:
ESLint rules and presets applied to all Croct JavaScript projects.
1,341 lines • 12 MB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
let _typescript_eslint_utils = require("@typescript-eslint/utils");
let _typescript_eslint_utils_ast_utils = require("@typescript-eslint/utils/ast-utils");
let _eslint_compat = require("@eslint/compat");
let globals = require("globals");
globals = __toESM(globals);
let eslint_plugin_jest = require("eslint-plugin-jest");
eslint_plugin_jest = __toESM(eslint_plugin_jest);
let node_module = require("node:module");
node_module = __toESM(node_module, 1);
let node_path = require("node:path");
node_path = __toESM(node_path, 1);
let unrs_resolver = require("unrs-resolver");
let node_fs = require("node:fs");
node_fs = __toESM(node_fs, 1);
let eslint = require("eslint");
let node_url = require("node:url");
let node_vm = require("node:vm");
node_vm = __toESM(node_vm, 1);
let eslint_use_at_your_own_risk = require("eslint/use-at-your-own-risk");
eslint_use_at_your_own_risk = __toESM(eslint_use_at_your_own_risk, 1);
let _eslint_community_eslint_plugin_eslint_comments = require("@eslint-community/eslint-plugin-eslint-comments");
_eslint_community_eslint_plugin_eslint_comments = __toESM(_eslint_community_eslint_plugin_eslint_comments);
let eslint_plugin_import_newlines = require("eslint-plugin-import-newlines");
eslint_plugin_import_newlines = __toESM(eslint_plugin_import_newlines);
let eslint_plugin_newline_destructuring = require("eslint-plugin-newline-destructuring");
eslint_plugin_newline_destructuring = __toESM(eslint_plugin_newline_destructuring);
let _stylistic_eslint_plugin = require("@stylistic/eslint-plugin");
_stylistic_eslint_plugin = __toESM(_stylistic_eslint_plugin);
let typescript_eslint = require("typescript-eslint");
typescript_eslint = __toESM(typescript_eslint);
let _typescript_eslint_parser = require("@typescript-eslint/parser");
_typescript_eslint_parser = __toESM(_typescript_eslint_parser);
let eslint_plugin_testing_library = require("eslint-plugin-testing-library");
eslint_plugin_testing_library = __toESM(eslint_plugin_testing_library);
let eslint_plugin_cypress = require("eslint-plugin-cypress");
eslint_plugin_cypress = __toESM(eslint_plugin_cypress);
//#region src/rules/createRule.ts
const createRule$1 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/croct-tech/coding-standard-js/tree/master/docs/${name}.md`);
//#endregion
//#region src/rules/argument-spacing/index.ts
const argumentSpacing = createRule$1({
name: "argument-spacing",
meta: {
type: "suggestion",
docs: { description: "Enforces a surrounding line break before and after the argument list in multiline functional calls." },
fixable: "whitespace",
schema: [],
messages: { missing: "Missing new line." }
},
create: (context) => {
function check(node) {
const { sourceCode } = context;
if (node.arguments.length === 0) return;
const lastArgument = node.arguments[node.arguments.length - 1];
const firstToken = sourceCode.getTokenBefore(node.arguments[0], { filter: (token) => token.value === "(" });
const lastToken = sourceCode.getTokenAfter(lastArgument, { filter: (token) => token.value === ")" });
if (firstToken.loc.start.line === lastToken.loc.end.line) return;
const lastArgumentFirstToken = sourceCode.getFirstToken(lastArgument);
if ((lastArgument.type !== _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression || lastArgument.body.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.BlockStatement) && firstToken.loc.start.line === lastArgumentFirstToken.loc.start.line) return;
const tokens = [
firstToken,
...node.arguments,
lastToken
];
for (let i = 1; i < tokens.length; i++) {
const previousToken = tokens[i - 1];
const currentToken = tokens[i];
if (previousToken.loc.end.line === currentToken.loc.start.line) {
const tokenBefore = sourceCode.getTokenBefore(currentToken, { includeComments: true });
context.report({
node,
loc: {
start: tokenBefore.loc.end,
end: currentToken.loc.start
},
messageId: "missing",
fix: (fixer) => fixer.replaceTextRange([tokenBefore.range[1], currentToken.range[0]], "\n")
});
}
}
}
return {
CallExpression: check,
NewExpression: check
};
}
});
//#endregion
//#region src/rules/jsx-attribute-spacing/index.ts
const jsxAttributeSpacing = createRule$1({
name: "jsx-attribute-spacing",
meta: {
type: "suggestion",
docs: { description: "Enforces a surrounding line break in multiline JSX attributes." },
fixable: "whitespace",
schema: [],
messages: { missing: "Missing new line." }
},
create: (context) => {
const { sourceCode } = context;
function check(node) {
const { value } = node;
if (value?.type !== _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.JSXExpressionContainer) return;
const firstToken = sourceCode.getFirstToken(value.expression);
const lastToken = sourceCode.getLastToken(value.expression);
if (firstToken.type === _typescript_eslint_utils.TSESTree.AST_TOKEN_TYPES.Punctuator && lastToken.type === _typescript_eslint_utils.TSESTree.AST_TOKEN_TYPES.Punctuator || firstToken.loc.start.line === lastToken.loc.end.line) return;
const leftBrace = sourceCode.getFirstToken(value);
const rightBrace = sourceCode.getLastToken(value);
const tokens = [[leftBrace, firstToken], [lastToken, rightBrace]];
for (const [previousToken, currentToken] of tokens) {
if (previousToken.loc.end.line !== currentToken.loc.start.line) continue;
const tokenBefore = sourceCode.getTokenBefore(currentToken, { includeComments: true });
context.report({
node,
loc: {
start: tokenBefore.loc.end,
end: currentToken.loc.start
},
messageId: "missing",
fix: (fixer) => fixer.replaceTextRange([tokenBefore.range[1], currentToken.range[0]], "\n")
});
}
}
return { JSXAttribute: check };
}
});
//#endregion
//#region src/rules/complex-expression-spacing/index.ts
const complexExpressionSpacing = createRule$1({
name: "complex-expression-spacing",
meta: {
type: "suggestion",
docs: { description: "Enforces a surrounding line break in complex expression." },
fixable: "whitespace",
schema: [],
messages: { missing: "Missing new line." }
},
create: (context) => {
const { sourceCode } = context;
function check(node) {
const parentPreviousToken = sourceCode.getTokenBefore(node, { filter: (token) => token.type === _typescript_eslint_utils.TSESTree.AST_TOKEN_TYPES.Punctuator });
const parentNextToken = sourceCode.getTokenAfter(node, { filter: (token) => token.type === _typescript_eslint_utils.TSESTree.AST_TOKEN_TYPES.Punctuator });
if (parentPreviousToken.loc.end.line === parentNextToken.loc.start.line) return;
const firstToken = sourceCode.getFirstToken(node);
const lastToken = sourceCode.getLastToken(node);
const tokens = [[parentPreviousToken, firstToken], [lastToken, parentNextToken]];
for (const [previousToken, currentToken] of tokens) {
if (previousToken.loc.end.line !== currentToken.loc.start.line) continue;
const tokenBefore = sourceCode.getTokenBefore(currentToken, { includeComments: true });
context.report({
node,
loc: {
start: tokenBefore.loc.end,
end: currentToken.loc.start
},
messageId: "missing",
fix: (fixer) => fixer.replaceTextRange([tokenBefore.range[1], currentToken.range[0]], "\n")
});
}
}
return {
ArrowFunctionExpression: (node) => {
const { body } = node;
if (body.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.ConditionalExpression) check(body);
},
IfStatement: (node) => {
check(node.test);
}
};
}
});
//#endregion
//#region src/rules/newline-per-chained-call/index.ts
const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/u;
//#endregion
//#region src/rules/index.ts
const rules = {
"argument-spacing": argumentSpacing,
"jsx-attribute-spacing": jsxAttributeSpacing,
"complex-expression-spacing": complexExpressionSpacing,
"newline-per-chained-call": createRule$1({
name: "newline-per-chained-call",
meta: {
type: "layout",
docs: { description: "Require a newline after each call in a method chain" },
fixable: "whitespace",
schema: [{
type: "object",
properties: { ignoreChainDeeperThan: {
type: "integer",
minimum: 1,
maximum: 10,
description: "The minimum chain depth at which to ignore the rule."
} },
additionalProperties: false
}],
defaultOptions: [{ ignoreChainDeeperThan: 2 }],
messages: { expectedLineBreak: "Expected line break before `{{propertyName}}`." }
},
create: (context) => {
const ignoreChainWithDepth = (context.options[0] ?? {}).ignoreChainDeeperThan ?? 2;
const { sourceCode } = context;
function getPropertyText(node) {
return "." + sourceCode.getText(node.property).split(LINEBREAK_MATCHER)[0];
}
function hasObjectAndPropertyOnSameLine(node) {
return node.object.loc.end.line === node.property.loc.start.line;
}
function isNotClosingParenToken(token) {
return token.value !== ")" || token.type !== _typescript_eslint_utils.TSESTree.AST_TOKEN_TYPES.Punctuator;
}
function validateCallExpressionIgnoreDepth(node) {
let hasCallExpression = false;
if (node.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.CallExpression) hasCallExpression = true;
if (node.parent != null && node.parent.type !== _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.CallExpression && node.parent.type !== _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression) {
const memberExpressions = [];
let currentNode = "callee" in node ? node.callee : node;
while (currentNode.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.CallExpression || currentNode.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression) if (currentNode.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression) {
if (currentNode.property.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.Identifier && !currentNode.computed) memberExpressions.push(currentNode);
currentNode = currentNode.object;
} else if (currentNode.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.CallExpression) currentNode = currentNode.callee;
if (memberExpressions.length > ignoreChainWithDepth && hasCallExpression && memberExpressions.some(hasObjectAndPropertyOnSameLine)) {
const expressionsOnSameLine = memberExpressions.filter(hasObjectAndPropertyOnSameLine);
const rootNode = expressionsOnSameLine[expressionsOnSameLine.length - 1];
if (rootNode.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression && rootNode.parent != null && (rootNode.parent.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.CallExpression || rootNode.parent.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression) && (rootNode.object.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.ThisExpression || rootNode.object.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.Identifier)) expressionsOnSameLine.pop();
expressionsOnSameLine.forEach((memberExpression) => {
context.report({
node: memberExpression.property,
loc: memberExpression.property.loc.start,
messageId: "expectedLineBreak",
data: { propertyName: getPropertyText(memberExpression) },
fix: (fixer) => {
const firstTokenAfterObject = sourceCode.getTokenAfter(memberExpression.object, isNotClosingParenToken);
return fixer.insertTextBefore(firstTokenAfterObject, "\n");
}
});
});
}
}
}
return {
CallExpression: (node) => {
if (node.callee?.type === _typescript_eslint_utils.TSESTree.AST_NODE_TYPES.MemberExpression) validateCallExpressionIgnoreDepth(node);
},
MemberExpression: (node) => {
validateCallExpressionIgnoreDepth(node);
}
};
}
}),
"min-chained-call-depth": createRule$1({
name: "min-chained-call-depth",
meta: {
type: "layout",
docs: { description: "Enforces a minimum depth for multiline chained calls." },
fixable: "whitespace",
schema: [{
type: "object",
properties: {
maxLineLength: {
type: "integer",
minimum: 1,
description: "The maximum line length allowed for inlining chained calls."
},
ignoreChainDeeperThan: {
type: "integer",
minimum: 1,
maximum: 10,
description: "The minimum chain depth at which to ignore the rule."
}
},
additionalProperties: false
}],
defaultOptions: [{
maxLineLength: 100,
ignoreChainDeeperThan: 2
}],
messages: { unexpectedLineBreak: "Unexpected line break." }
},
create: (context) => {
const { sourceCode } = context;
let maxDepth = 0;
function getDepth(node) {
let depth = 0;
let currentNode = node;
while (currentNode.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression || currentNode.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) if (currentNode.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) {
currentNode = currentNode.object;
depth += 1;
} else if (currentNode.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) currentNode = currentNode.callee;
return depth;
}
function check(node) {
if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && node.parent?.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return;
const callee = node.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression ? node.callee : node;
if (callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression || callee.computed || callee.object.type === _typescript_eslint_utils.AST_NODE_TYPES.NewExpression || callee.object.loc.end.line === callee.property.loc.start.line) return;
const currentDepth = getDepth(callee);
maxDepth = Math.max(maxDepth, currentDepth);
if (currentDepth > 1) return;
const { maxLineLength = 100, ignoreChainDeeperThan = 2 } = context.options[0] ?? {};
if (maxDepth > ignoreChainDeeperThan) return;
const { property } = callee;
const lastToken = sourceCode.getLastToken(node, { filter: (token) => token.loc.end.line === property.loc.start.line });
const semicolon = sourceCode.getLastToken(node.parent, { filter: (token) => token.loc.start.line === property.loc.start.line && token.type === _typescript_eslint_utils.AST_TOKEN_TYPES.Punctuator && token.value === ";" });
const lineLength = callee.object.loc.end.column + lastToken.loc.end.column - property.loc.start.column + 1 + (semicolon !== null ? 1 : 0);
if (maxLineLength !== null && lineLength > maxLineLength) return;
const punctuator = sourceCode.getTokenBefore(callee.property);
const previousToken = sourceCode.getTokenBefore(punctuator, { includeComments: true });
const nextToken = sourceCode.getTokenAfter(punctuator, { includeComments: true });
if ((0, _typescript_eslint_utils_ast_utils.isCommentToken)(previousToken) || (0, _typescript_eslint_utils_ast_utils.isCommentToken)(nextToken)) return;
context.report({
node,
loc: {
start: callee.object.loc.end,
end: callee.property.loc.start
},
messageId: "unexpectedLineBreak",
fix: (fixer) => fixer.replaceTextRange([previousToken.range[1], nextToken.range[0]], punctuator.value)
});
}
return {
CallExpression: (node) => {
check(node);
},
MemberExpression: (node) => {
check(node);
}
};
}
}),
"parameter-destructuring": createRule$1({
name: "parameter-destructuring",
meta: {
type: "layout",
docs: { description: "Prevent noisy destructuring on parameters" },
hasSuggestions: true,
schema: [],
messages: { unexpectedDestructuring: "Destructuring should not be done in the parameters. Bind to a variable and destructure inside the function." }
},
create: (context) => {
const { sourceCode } = context;
return { ObjectPattern: function checkObjectPattern(node) {
const { parent } = node;
if (parent?.type !== _typescript_eslint_utils.AST_NODE_TYPES.FunctionExpression && parent?.type !== _typescript_eslint_utils.AST_NODE_TYPES.FunctionDeclaration && parent?.type !== _typescript_eslint_utils.AST_NODE_TYPES.ArrowFunctionExpression) return;
if (node.loc.start.line === node.loc.end.line) return;
const { body } = parent;
context.report({
node,
messageId: "unexpectedDestructuring",
suggest: body.type === _typescript_eslint_utils.AST_NODE_TYPES.BlockStatement ? [{
messageId: "unexpectedDestructuring",
fix: (fixer) => [fixer.replaceText(node, "value"), fixer.insertTextAfter(sourceCode.getFirstToken(body), `\nconst ${sourceCode.getText(node)} = value;\n`)]
}] : null
});
} };
}
})
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/electron.js
var electron_default$1 = { settings: { "import-x/core-modules": ["electron"] } };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/errors.js
var errors_default$1 = {
plugins: ["import-x"],
rules: {
"import-x/no-unresolved": 2,
"import-x/named": 2,
"import-x/namespace": 2,
"import-x/default": 2,
"import-x/export": 2
}
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/electron.js
var electron_default = { settings: { "import-x/core-modules": ["electron"] } };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/errors.js
var errors_default = { rules: {
"import-x/no-unresolved": 2,
"import-x/named": 2,
"import-x/namespace": 2,
"import-x/default": 2,
"import-x/export": 2
} };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/react-native.js
var react_native_default$1 = { settings: { "import-x/resolver": { node: { extensions: [
".js",
".web.js",
".ios.js",
".android.js"
] } } } };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/react.js
var react_default$1 = {
settings: { "import-x/extensions": [
".js",
".jsx",
".mjs",
".cjs"
] },
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/recommended.js
var recommended_default$1 = { rules: {
"import-x/no-unresolved": "error",
"import-x/named": "error",
"import-x/namespace": "error",
"import-x/default": "error",
"import-x/export": "error",
"import-x/no-named-as-default": "warn",
"import-x/no-named-as-default-member": "warn",
"import-x/no-duplicates": "warn"
} };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/stage-0.js
var stage_0_default$1 = { rules: { "import-x/no-deprecated": 1 } };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/typescript.js
const typeScriptExtensions$1 = [
".ts",
".tsx",
".cts",
".mts"
];
var typescript_default$1 = {
settings: {
"import-x/extensions": [
...typeScriptExtensions$1,
".js",
".jsx",
".cjs",
".mjs"
],
"import-x/external-module-folders": ["node_modules", "node_modules/@types"],
"import-x/parsers": { "@typescript-eslint/parser": [...typeScriptExtensions$1] },
"import-x/resolver": { typescript: true }
},
rules: { "import-x/named": "off" }
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/flat/warnings.js
var warnings_default$1 = { rules: {
"import-x/no-named-as-default": 1,
"import-x/no-named-as-default-member": 1,
"import-x/no-rename-default": 1,
"import-x/no-duplicates": 1
} };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/react-native.js
var react_native_default = { settings: { "import-x/resolver": { node: { extensions: [
".js",
".web.js",
".ios.js",
".android.js"
] } } } };
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/react.js
var react_default = {
settings: { "import-x/extensions": [".js", ".jsx"] },
parserOptions: { ecmaFeatures: { jsx: true } }
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/recommended.js
var recommended_default = {
plugins: ["import-x"],
rules: {
"import-x/no-unresolved": "error",
"import-x/named": "error",
"import-x/namespace": "error",
"import-x/default": "error",
"import-x/export": "error",
"import-x/no-named-as-default": "warn",
"import-x/no-named-as-default-member": "warn",
"import-x/no-duplicates": "warn"
},
parserOptions: {
sourceType: "module",
ecmaVersion: 2018
}
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/stage-0.js
var stage_0_default = {
plugins: ["import-x"],
rules: { "import-x/no-deprecated": 1 }
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/typescript.js
const typeScriptExtensions = [
".ts",
".tsx",
".cts",
".mts"
];
var typescript_default = {
settings: {
"import-x/extensions": [
...typeScriptExtensions,
".js",
".jsx",
".cjs",
".mjs"
],
"import-x/external-module-folders": ["node_modules", "node_modules/@types"],
"import-x/parsers": { "@typescript-eslint/parser": [...typeScriptExtensions] },
"import-x/resolver": { typescript: true }
},
rules: { "import-x/named": "off" }
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/config/warnings.js
var warnings_default = {
plugins: ["import-x"],
rules: {
"import-x/no-named-as-default": 1,
"import-x/no-named-as-default-member": 1,
"import-x/no-rename-default": 1,
"import-x/no-duplicates": 1
}
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/require.js
const importMetaUrl$1 = require("url").pathToFileURL(__filename).href;
const cjsRequire = importMetaUrl$1 ? (0, node_module.createRequire)(importMetaUrl$1) : require;
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/meta.js
const { name, version } = {
"name": "eslint-plugin-import-x",
"version": "4.16.2",
"type": "module",
"description": "Import with sanity.",
"repository": "https://github.com/un-ts/eslint-plugin-import-x",
"homepage": "https://github.com/un-ts/eslint-plugin-import-x#readme",
"author": "JounQin <admin@1stg.me> (https://www.1stG.me)",
"funding": "https://opencollective.com/eslint-plugin-import-x",
"license": "MIT",
"engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" },
"main": "lib/index.cjs",
"types": "lib/index.d.cts",
"module": "lib/index.js",
"exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./lib/index.d.cts",
"default": "./lib/index.cjs"
}
},
"./utils": "./lib/utils/index.js",
"./package.json": "./package.json",
"./*": "./lib/*.js"
},
"files": ["lib", "!lib/*.tsbuildinfo"],
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin",
"es6",
"jsnext",
"modules",
"import",
"export"
],
"peerDependencies": {
"@typescript-eslint/utils": "^8.56.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"eslint-import-resolver-node": "*"
},
"peerDependenciesMeta": {
"@typescript-eslint/utils": { "optional": true },
"eslint-import-resolver-node": { "optional": true }
},
"dependencies": {
"@package-json/types": "^0.0.12",
"@typescript-eslint/types": "^8.56.0",
"comment-parser": "^1.4.1",
"debug": "^4.4.1",
"eslint-import-context": "^0.1.9",
"is-glob": "^4.0.3",
"minimatch": "^9.0.3 || ^10.1.2",
"semver": "^7.7.2",
"stable-hash-x": "^0.2.0",
"unrs-resolver": "^1.9.2"
}
};
const meta = {
name,
version
};
//#endregion
//#region node_modules/eslint-plugin-import-x/lib/node-resolver.js
function createNodeResolver({ extensions = [
".mjs",
".cjs",
".js",
".json",
".node"
], conditionNames = [
"import",
"require",
"default"
], mainFields = ["module", "main"], ...restOptions } = {}) {
const resolver = new unrs_resolver.ResolverFactory({
extensions,
conditionNames,
mainFields,
...restOptions
});
return {
interfaceVersion: 3,
name: "eslint-plugin-import-x:node",
resolve(modulePath, sourceFile) {
if ((0, node_module.isBuiltin)(modulePath) || modulePath.startsWith("data:")) return {
found: true,
path: null
};
try {
const resolved = resolver.sync(node_path.default.dirname(sourceFile), modulePath);
if (resolved.path) return {
found: true,
path: resolved.path
};
} catch {}
return { found: false };
}
};
}
//#endregion
//#region node_modules/resolve-pkg-maps/dist/index.cjs
var require_dist$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
Object.defineProperty(exports, "__esModule", { value: !0 });
const d = (r) => r !== null && typeof r == "object", s = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r }), g = "ERR_INVALID_PACKAGE_CONFIG", E = "ERR_INVALID_PACKAGE_TARGET", I = "ERR_PACKAGE_PATH_NOT_EXPORTED", P = "ERR_PACKAGE_IMPORT_NOT_DEFINED", R = /^\d+$/, O = /^(\.{1,2}|node_modules)$/i, u = /\/|\\/;
var h = ((r) => (r.Export = "exports", r.Import = "imports", r))(h || {});
const f = (r, t, n, o, c) => {
if (t == null) return [];
if (typeof t == "string") {
const [e, ...i] = t.split(u);
if (e === ".." || i.some((l) => O.test(l))) throw s(E, `Invalid "${r}" target "${t}" defined in the package config`);
return [c ? t.replace(/\*/g, c) : t];
}
if (Array.isArray(t)) return t.flatMap((e) => f(r, e, n, o, c));
if (d(t)) {
for (const e of Object.keys(t)) {
if (R.test(e)) throw s(g, "Cannot contain numeric property keys");
if (e === "default" || o.includes(e)) return f(r, t[e], n, o, c);
}
return [];
}
throw s(E, `Invalid "${r}" target "${t}"`);
}, a = "*", v = (r, t) => {
const n = r.indexOf(a), o = t.indexOf(a);
return n === o ? t.length > r.length : o > n;
};
function A(r, t) {
if (!t.includes(a) && r.hasOwnProperty(t)) return [t];
let n, o;
for (const c of Object.keys(r)) if (c.includes(a)) {
const [e, i, l] = c.split(a);
if (l === void 0 && t.startsWith(e) && t.endsWith(i)) {
const _ = t.slice(e.length, -i.length || void 0);
_ && (!n || v(n, c)) && (n = c, o = _);
}
}
return [n, o];
}
const p = (r) => Object.keys(r).reduce((t, n) => {
const o = n === "" || n[0] !== ".";
if (t === void 0 || t === o) return o;
throw s(g, "\"exports\" cannot contain some keys starting with \".\" and some not");
}, void 0), w = /^\w+:/, m = (r, t, n) => {
if (!r) throw new Error("\"exports\" is required");
t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || d(r) && p(r)) && (r = { ".": r });
const [o, c] = A(r, t), e = f(h.Export, r[o], t, n, c);
if (e.length === 0) throw s(I, t === "." ? "No \"exports\" main defined" : `Package subpath '${t}' is not defined by "exports"`);
for (const i of e) if (!i.startsWith("./") && !w.test(i)) throw s(E, `Invalid "exports" target "${i}" defined in the package config`);
return e;
}, T = (r, t, n) => {
if (!r) throw new Error("\"imports\" is required");
const [o, c] = A(r, t), e = f(h.Import, r[o], t, n, c);
if (e.length === 0) throw s(P, `Package import specifier "${t}" is not defined in package`);
return e;
};
exports.resolveExports = m, exports.resolveImports = T;
}));
//#endregion
//#region node_modules/get-tsconfig/dist/index.cjs
var require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
var Be = Object.defineProperty;
var r = (e, t) => Be(e, "name", {
value: t,
configurable: !0
});
var d = require("node:path"), ce = require("node:fs"), xe = require("node:module"), Ie = require_dist$4(), $e = require("fs"), Ue = require("os"), Re = require("path");
function h(e) {
return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
}
r(h, "slash");
const K = r((e) => {
const t = ce[e];
return (s, ...n) => {
const i = `${e}:${n.join(":")}`;
let l = s == null ? void 0 : s.get(i);
return l === void 0 && (l = Reflect.apply(t, ce, n), s?.set(i, l)), l;
};
}, "cacheFs"), B = K("existsSync"), Se = K("readFileSync"), q = K("statSync"), O = r((e, t, s) => {
for (;;) {
const n = d.posix.join(e, t);
if (B(s, n)) return n;
const i = d.dirname(e);
if (i === e) return;
e = i;
}
}, "findUp"), C = /^\.{1,2}(\/.*)?$/, Q = r((e) => {
const t = h(e);
return C.test(t) ? t : `./${t}`;
}, "normalizeRelativePath");
function Ne(e, t = !1) {
const s = e.length;
let n = 0, i = "", l = 0, o = 16, f = 0, u = 0, g = 0, m = 0, w = 0;
function _(c, j) {
let y = 0, T = 0;
for (; y < c;) {
let k = e.charCodeAt(n);
if (k >= 48 && k <= 57) T = T * 16 + k - 48;
else if (k >= 65 && k <= 70) T = T * 16 + k - 65 + 10;
else if (k >= 97 && k <= 102) T = T * 16 + k - 97 + 10;
else break;
n++, y++;
}
return y < c && (T = -1), T;
}
r(_, "scanHexDigits");
function b(c) {
n = c, i = "", l = 0, o = 16, w = 0;
}
r(b, "setPosition");
function p() {
let c = n;
if (e.charCodeAt(n) === 48) n++;
else for (n++; n < e.length && R(e.charCodeAt(n));) n++;
if (n < e.length && e.charCodeAt(n) === 46) if (n++, n < e.length && R(e.charCodeAt(n))) for (n++; n < e.length && R(e.charCodeAt(n));) n++;
else return w = 3, e.substring(c, n);
let j = n;
if (n < e.length && (e.charCodeAt(n) === 69 || e.charCodeAt(n) === 101)) if (n++, (n < e.length && e.charCodeAt(n) === 43 || e.charCodeAt(n) === 45) && n++, n < e.length && R(e.charCodeAt(n))) {
for (n++; n < e.length && R(e.charCodeAt(n));) n++;
j = n;
} else w = 3;
return e.substring(c, j);
}
r(p, "scanNumber");
function L() {
let c = "", j = n;
for (;;) {
if (n >= s) {
c += e.substring(j, n), w = 2;
break;
}
const y = e.charCodeAt(n);
if (y === 34) {
c += e.substring(j, n), n++;
break;
}
if (y === 92) {
if (c += e.substring(j, n), n++, n >= s) {
w = 2;
break;
}
switch (e.charCodeAt(n++)) {
case 34:
c += "\"";
break;
case 92:
c += "\\";
break;
case 47:
c += "/";
break;
case 98:
c += "\b";
break;
case 102:
c += "\f";
break;
case 110:
c += `
`;
break;
case 114:
c += "\r";
break;
case 116:
c += " ";
break;
case 117:
const k = _(4);
k >= 0 ? c += String.fromCharCode(k) : w = 4;
break;
default: w = 5;
}
j = n;
continue;
}
if (y >= 0 && y <= 31) if (M(y)) {
c += e.substring(j, n), w = 2;
break;
} else w = 6;
n++;
}
return c;
}
r(L, "scanString");
function A() {
if (i = "", w = 0, l = n, u = f, m = g, n >= s) return l = s, o = 17;
let c = e.charCodeAt(n);
if (ee(c)) {
do
n++, i += String.fromCharCode(c), c = e.charCodeAt(n);
while (ee(c));
return o = 15;
}
if (M(c)) return n++, i += String.fromCharCode(c), c === 13 && e.charCodeAt(n) === 10 && (n++, i += `
`), f++, g = n, o = 14;
switch (c) {
case 123: return n++, o = 1;
case 125: return n++, o = 2;
case 91: return n++, o = 3;
case 93: return n++, o = 4;
case 58: return n++, o = 6;
case 44: return n++, o = 5;
case 34: return n++, i = L(), o = 10;
case 47:
const j = n - 1;
if (e.charCodeAt(n + 1) === 47) {
for (n += 2; n < s && !M(e.charCodeAt(n));) n++;
return i = e.substring(j, n), o = 12;
}
if (e.charCodeAt(n + 1) === 42) {
n += 2;
const y = s - 1;
let T = !1;
for (; n < y;) {
const k = e.charCodeAt(n);
if (k === 42 && e.charCodeAt(n + 1) === 47) {
n += 2, T = !0;
break;
}
n++, M(k) && (k === 13 && e.charCodeAt(n) === 10 && n++, f++, g = n);
}
return T || (n++, w = 1), i = e.substring(j, n), o = 13;
}
return i += String.fromCharCode(c), n++, o = 16;
case 45: if (i += String.fromCharCode(c), n++, n === s || !R(e.charCodeAt(n))) return o = 16;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57: return i += p(), o = 11;
default:
for (; n < s && D(c);) n++, c = e.charCodeAt(n);
if (l !== n) {
switch (i = e.substring(l, n), i) {
case "true": return o = 8;
case "false": return o = 9;
case "null": return o = 7;
}
return o = 16;
}
return i += String.fromCharCode(c), n++, o = 16;
}
}
r(A, "scanNext");
function D(c) {
if (ee(c) || M(c)) return !1;
switch (c) {
case 125:
case 93:
case 123:
case 91:
case 34:
case 58:
case 44:
case 47: return !1;
}
return !0;
}
r(D, "isUnknownContentCharacter");
function x() {
let c;
do
c = A();
while (c >= 12 && c <= 15);
return c;
}
return r(x, "scanNextNonTrivia"), {
setPosition: b,
getPosition: r(() => n, "getPosition"),
scan: t ? x : A,
getToken: r(() => o, "getToken"),
getTokenValue: r(() => i, "getTokenValue"),
getTokenOffset: r(() => l, "getTokenOffset"),
getTokenLength: r(() => n - l, "getTokenLength"),
getTokenStartLine: r(() => u, "getTokenStartLine"),
getTokenStartCharacter: r(() => l - m, "getTokenStartCharacter"),
getTokenError: r(() => w, "getTokenError")
};
}
r(Ne, "createScanner");
function ee(e) {
return e === 32 || e === 9;
}
r(ee, "isWhiteSpace");
function M(e) {
return e === 10 || e === 13;
}
r(M, "isLineBreak");
function R(e) {
return e >= 48 && e <= 57;
}
r(R, "isDigit");
var ge;
(function(e) {
e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
})(ge || (ge = {})), new Array(20).fill(0).map((e, t) => " ".repeat(t));
const S = 200;
new Array(S).fill(0).map((e, t) => `
` + " ".repeat(t)), new Array(S).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(S).fill(0).map((e, t) => `\r
` + " ".repeat(t)), new Array(S).fill(0).map((e, t) => `
` + " ".repeat(t)), new Array(S).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(S).fill(0).map((e, t) => `\r
` + " ".repeat(t));
var H;
(function(e) {
e.DEFAULT = { allowTrailingComma: !1 };
})(H || (H = {}));
function Pe(e, t = [], s = H.DEFAULT) {
let n = null, i = [];
const l = [];
function o(u) {
Array.isArray(i) ? i.push(u) : n !== null && (i[n] = u);
}
return r(o, "onValue"), We(e, {
onObjectBegin: r(() => {
const u = {};
o(u), l.push(i), i = u, n = null;
}, "onObjectBegin"),
onObjectProperty: r((u) => {
n = u;
}, "onObjectProperty"),
onObjectEnd: r(() => {
i = l.pop();
}, "onObjectEnd"),
onArrayBegin: r(() => {
const u = [];
o(u), l.push(i), i = u, n = null;
}, "onArrayBegin"),
onArrayEnd: r(() => {
i = l.pop();
}, "onArrayEnd"),
onLiteralValue: o,
onError: r((u, g, m) => {
t.push({
error: u,
offset: g,
length: m
});
}, "onError")
}, s), i[0];
}
r(Pe, "parse$1");
function We(e, t, s = H.DEFAULT) {
const n = Ne(e, !1), i = [];
let l = 0;
function o(v) {
return v ? () => l === 0 && v(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
}
r(o, "toNoArgVisit");
function f(v) {
return v ? (F) => l === 0 && v(F, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
}
r(f, "toOneArgVisit");
function u(v) {
return v ? (F) => l === 0 && v(F, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => i.slice()) : () => !0;
}
r(u, "toOneArgVisitWithPath");
function g(v) {
return v ? () => {
l > 0 ? l++ : v(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => i.slice()) === !1 && (l = 1);
} : () => !0;
}
r(g, "toBeginVisit");
function m(v) {
return v ? () => {
l > 0 && l--, l === 0 && v(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter());
} : () => !0;
}
r(m, "toEndVisit");
const w = g(t.onObjectBegin), _ = u(t.onObjectProperty), b = m(t.onObjectEnd), p = g(t.onArrayBegin), L = m(t.onArrayEnd), A = u(t.onLiteralValue), D = f(t.onSeparator), x = o(t.onComment), c = f(t.onError), j = s && s.disallowComments, y = s && s.allowTrailingComma;
function T() {
for (;;) {
const v = n.scan();
switch (n.getTokenError()) {
case 4:
k(14);
break;
case 5:
k(15);
break;
case 3:
k(13);
break;
case 1:
j || k(11);
break;
case 2:
k(12);
break;
case 6:
k(16);
break;
}
switch (v) {
case 12:
case 13:
j ? k(10) : x();
break;
case 16:
k(1);
break;
case 15:
case 14: break;
default: return v;
}
}
}
r(T, "scanNext");
function k(v, F = [], W = []) {
if (c(v), F.length + W.length > 0) {
let $ = n.getToken();
for (; $ !== 17;) {
if (F.indexOf($) !== -1) {
T();
break;
} else if (W.indexOf($) !== -1) break;
$ = T();
}
}
}
r(k, "handleError");
function P(v) {
const F = n.getTokenValue();
return v ? A(F) : (_(F), i.push(F)), T(), !0;
}
r(P, "parseString");
function J() {
switch (n.getToken()) {
case 11:
const v = n.getTokenValue();
let F = Number(v);
isNaN(F) && (k(2), F = 0), A(F);
break;
case 7:
A(null);
break;
case 8:
A(!0);
break;
case 9:
A(!1);
break;
default: return !1;
}
return T(), !0;
}
r(J, "parseLiteral");
function V() {
return n.getToken() !== 10 ? (k(3, [], [2, 5]), !1) : (P(!1), n.getToken() === 6 ? (D(":"), T(), U() || k(4, [], [2, 5])) : k(5, [], [2, 5]), i.pop(), !0);
}
r(V, "parseProperty");
function z() {
w(), T();
let v = !1;
for (; n.getToken() !== 2 && n.getToken() !== 17;) {
if (n.getToken() === 5) {
if (v || k(4, [], []), D(","), T(), n.getToken() === 2 && y) break;
} else v && k(6, [], []);
V() || k(4, [], [2, 5]), v = !0;
}
return b(), n.getToken() !== 2 ? k(7, [2], []) : T(), !0;
}
r(z, "parseObject");
function G() {
p(), T();
let v = !0, F = !1;
for (; n.getToken() !== 4 && n.getToken() !== 17;) {
if (n.getToken() === 5) {
if (F || k(4, [], []), D(","), T(), n.getToken() === 4 && y) break;
} else F && k(6, [], []);
v ? (i.push(0), v = !1) : i[i.length - 1]++, U() || k(4, [], [4, 5]), F = !0;
}
return L(), v || i.pop(), n.getToken() !== 4 ? k(8, [4], []) : T(), !0;
}
r(G, "parseArray");
function U() {
switch (n.getToken()) {
case 3: return G();
case 1: return z();
case 10: return P(!0);
default: return J();
}
}
return r(U, "parseValue"), T(), n.getToken() === 17 ? s.allowEmptyContent ? !0 : (k(4, [], []), !1) : U() ? (n.getToken() !== 17 && k(9, [], []), !0) : (k(4, [], []), !1);
}
r(We, "visit");
var ke;
(function(e) {
e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
})(ke || (ke = {}));
var de;
(function(e) {
e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
})(de || (de = {}));
const Me = Pe;
var we;
(function(e) {
e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
})(we || (we = {}));
const me = r((e, t) => Me(Se(t, e, "utf8")), "readJsonc"), ne = Symbol("implicitBaseUrl"), E = "${configDir}", Je = r(() => {
const { findPnpApi: e } = xe;
return e && e(process.cwd());
}, "getPnpApi"), te = r((e, t, s, n) => {
const i = `resolveFromPackageJsonPath:${e}:${t}:${s}`;
if (n != null && n.has(i)) return n.get(i);
const l = me(e, n);
if (!l) return;
let o = t || "tsconfig.json";
if (!s && l.exports) try {
const [f] = Ie.resolveExports(l.exports, t, ["require", "types"]);
o = f;
} catch {
return !1;
}
else !t && l.tsconfig && (o = l.tsconfig);
return o = d.join(e, "..", o), n?.set(i, o), o;
}, "resolveFromPackageJsonPath"), se = "package.json", le = "tsconfig.json", Ve = r((e, t, s) => {
let n = e;
if (e === ".." && (n = d.join(n, le)), e[0] === "." && (n = d.resolve(t, n)), d.isAbsolute(n)) {
if (B(s, n)) {
if (q(s, n).isFile()) return n;
} else if (!n.endsWith(".json")) {
const b = `${n}.json`;
if (B(s, b)) return b;
}
return;
}
const [i, ...l] = e.split("/"), o = i[0] === "@" ? `${i}/${l.shift()}` : i, f = l.join("/"), u = Je();
if (u) {
const { resolveRequest: b } = u;
try {
if (o === e) {
const p = b(d.join(o, se), t);
if (p) {
const L = te(p, f, !1, s);
if (L && B(s, L)) return L;
}
} else {
let p;
try {
p = b(e, t, { extensions: [".json"] });
} catch {
p = b(d.join(e, le), t);
}
if (p) return p;
}
} catch {}
}
const g = O(d.resolve(t), d.join("node_modules", o), s);
if (!g || !q(s, g).isDirectory()) return;
const m = d.join(g, se);
if (B(s, m)) {
const b = te(m, f, !1, s);
if (b === !1) return;
if (b && B(s, b) && q(s, b).isFile()) return b;
}
const w = d.join(g, f), _ = w.endsWith(".json");
if (!_) {
const b = `${w}.json`;
if (B(s, b)) return b;
}
if (B(s, w)) {
if (q(s, w).isDirectory()) {
const b = d.join(w, se);
if (B(s, b)) {
const L = te(b, "", !0, s);
if (L && B(s, L)) return L;
}
const p = d.join(w, le);
if (B(s, p)) return p;
} else if (_) return w;
}
}, "resolveExtendsPath"), ie = r((e, t) => Q(d.relative(e, t)), "pathRelative"), ve = [
"files",
"include",
"exclude"
], N = r((e, t, s) => {
const n = d.join(t, s);
return h(d.relative(e, n)) || "./";
}, "resolveAndRelativize"), ze = r((e, t, s) => {
const n = d.relative(e, t);
if (!n) return s;
return h(`${n}/${s.startsWith("./") ? s.slice(2) : s}`);
}, "prefixPattern"), Ge = r((e, t, s, n) => {
const i = Ve(e, t, n);
if (!i) throw new Error(`File '${e}' not found.`);
if (s.has(i)) throw new Error(`Circularity detected while resolving configuration: ${i}`);
s.add(i);
const l = d.dirname(i), o = pe(i, n, s);
delete o.references;
const { compilerOptions: f } = o;
if (f) {
const { baseUrl: u } = f;
u && !u.startsWith(E) && (f.baseUrl = N(t, l, u));
const { outDir: g } = f;
g && !g.startsWith(E) && (f.outDir = N(t, l, g));
const { declarationDir: m } = f;
m && !m.startsWith(E) && (f.declarationDir = N(t, l, m));
const { rootDir: w } = f;
w && !w.startsWith(E) && (f.rootDir = N(t, l, w));
const { rootDirs: _ } = f;
_ && (f.rootDirs = _.map((p) => p.startsWith(E) ? p : N(t, l, p)));
const { typeRoots: b } = f;
b && (f.typeRoots = b.map((p) => p.startsWith(E) ? p : N(t, l, p)));
}
for (const u of ve) {
const g = o[u];
g && (o[u] = g.map((m) => m.startsWith(E) ? m : ze(t, l, m)));
}
return o;
}, "resolveExtends"), be = ["outDir", "declarationDir"], pe = r((e, t, s = /* @__PURE__ */ new Set()) => {
let n;
try {
n = me(e, t) || {};
} catch {
throw new Error(`Cannot resolve tsconfig at path: ${e}`);
}
if (typeof n != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);
const i = d.dirname(e);
if (n.compilerOptions) {
const { compilerOptions: l } = n;
l.paths && !l.baseUrl && (l[ne] = i);
}
if (n.extends) {
const l = Array.isArray(n.extends) ? n.extends : [n.extends];
delete n.extends;
for (const o of l.reverse()) {
const f = Ge(o, i, new Set(s), t), u = {
...f,
...n,
compilerOptions: {
...f.compilerOptions,
...n.compilerOptions
}
};
f.watchOptions && (u.watchOptions = {
...f.watchOptions,
...n.watchOptions
}), n = u;
}
}
if (n.compilerOptions) {
const { compilerOptions: l } = n;
for (const f of ["baseUrl", "rootDir"]) {
const u = l[f];
if (u && !u.startsWith(E)) l[f] = ie(i, d.resolve(i, u));
}
for (const f of be) {
let u = l[f];
u && (Array.isArray(n.exclude) || (n.exclude = be.map((g) => l[g]).filter(Boolean)), u.startsWith(E) || (u = Q(u)), l[f] = u);
}
} else n.compilerOptions = {};
if (n.include && (n.include = n.include.map(h)), n.files && (n.files = n.files.map((l) => l.startsWith(E) ? l : Q(l))), n.watchOptions) {
const { watchOptions: l } = n;
l.excludeDirectories && (l.excludeDirectories = l.excludeDirectories.map((o) => h(d.resolve(i, o)))), l.excludeFiles && (l.excludeFiles = l.excludeFiles.map((o) => h(d.resolve(i, o)))), l.watchFile && (l.watchFile = l.watchFile.toLowerCase()), l.watchDirectory && (l.watchDirectory = l.watchDirectory.toLowerCase()), l.fallbackPolling && (l.fallbackPolling = l.fallbackPolling.toLowerCase());
}
return n;
}, "_parseTsconfig"), X = r((e, t) => {
if (e.startsWith(E)) return h(d.join(t, e.slice(12)));
}, "interpolateConfigDir"), qe = [
"outDir",
"declarationDir",
"outFile",
"rootDir",
"baseUrl",
"tsBuildInfoFile"
], Qe = r((e) => {
if (e.strict) for (const I of [
"noImplicitAny",
"noImplicitThis",
"strictNullChecks",
"strictFunctionTypes",
"strictBindCallApply",
"strictPropertyInitialization",
"strictBuiltinIteratorReturn",
"alwaysStrict",
"useUnknownInCatchVariables"
]) e[I] === void 0 && (e[I] = !0);
if (e.composite && (e.declaration ??= !0, e.incremental ??= !0), e.target) {
let a = e.target.toLowerCase();
a === "es2015" && (a = "es6"), e.target = a, a === "esnext" && (e.module ?