first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

21
node_modules/eslint-import-context/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-present UnTS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

83
node_modules/eslint-import-context/README.md generated vendored Normal file
View File

@@ -0,0 +1,83 @@
# eslint-import-context
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/eslint-import-context/ci.yml?branch=main)](https://github.com/un-ts/eslint-import-context/actions/workflows/ci.yml?query=branch%3Amain)
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/eslint-import-context.svg)](https://codecov.io/gh/un-ts/eslint-import-context)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Feslint-import-context%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/eslint-import-context)](https://coderabbit.ai)
[![npm](https://img.shields.io/npm/v/eslint-import-context.svg)](https://www.npmjs.com/package/eslint-import-context)
[![GitHub Release](https://img.shields.io/github/release/un-ts/eslint-import-context)](https://github.com/un-ts/eslint-import-context/releases)
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/changesets/changesets)
Provide context info for eslint-plugin-import-x, so no extra arguments need to be added.
## TOC <!-- omit in toc -->
- [Usage](#usage)
- [Install](#install)
- [API](#api)
- [Sponsors and Backers](#sponsors-and-backers)
- [Sponsors](#sponsors)
- [Backers](#backers)
- [Changelog](#changelog)
- [License](#license)
## Usage
### Install
```sh
# pnpm
pnpm add eslint-import-context
# yarn
yarn add eslint-import-context
# npm
npm i eslint-import-context
# bun
bun add eslint-import-context
```
### API
```js
import { useRuleContext, getTsconfigWithContext } from 'eslint-import-context'
const ruleContext = useRuleContext()
const tsconfig = getTsconfigWithContext(ruleContext)
```
## Sponsors and Backers
[![Sponsors](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)
### Sponsors
| 1stG | RxTS | UnTS |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [![1stG Open Collective sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |
### Backers
| 1stG | RxTS | UnTS |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| [![1stG Open Collective backers](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |
## Changelog
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
## License
[MIT][] © [JounQin][]@[1stG.me][]
[1stG.me]: https://www.1stG.me
[JounQin]: https://github.com/JounQin
[MIT]: http://opensource.org/licenses/MIT

5
node_modules/eslint-import-context/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import type { ChildContext, RuleContext } from './types.js';
export type * from './types.js';
export * from './utils.js';
export declare const setRuleContext: <T = void>(nextRuleContext: ChildContext | RuleContext, callback: () => T) => T;
export declare const useRuleContext: () => ChildContext | RuleContext<string, readonly unknown[]> | undefined;

30
node_modules/eslint-import-context/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useRuleContext = exports.setRuleContext = void 0;
__exportStar(require("./utils.js"), exports);
let ruleContext;
const setRuleContext = (nextRuleContext, callback) => {
const currentValue = ruleContext;
ruleContext = nextRuleContext;
const result = callback();
ruleContext = currentValue;
return result;
};
exports.setRuleContext = setRuleContext;
const useRuleContext = () => ruleContext;
exports.useRuleContext = useRuleContext;
//# sourceMappingURL=index.js.map

1
node_modules/eslint-import-context/lib/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAA0B;AAE1B,IAAI,WAAmD,CAAA;AAEhD,MAAM,cAAc,GAAG,CAC5B,eAA2C,EAC3C,QAAiB,EACjB,EAAE;IACF,MAAM,YAAY,GAAG,WAAW,CAAA;IAChC,WAAW,GAAG,eAAe,CAAA;IAC7B,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAA;IACzB,WAAW,GAAG,YAAY,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,cAAc,kBAS1B;AAEM,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,WAAW,CAAA;AAAlC,QAAA,cAAc,kBAAoB"}

119
node_modules/eslint-import-context/lib/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import type { TSESLint } from '@typescript-eslint/utils';
import type { KebabCase, LiteralUnion } from 'type-fest';
import type { NapiResolveOptions } from 'unrs-resolver';
import type { PluginName } from './utils.js';
export type FileExtension = `.${string}`;
export type DocStyle = 'jsdoc' | 'tomdoc';
export interface ResultNotFound {
found: false;
path?: undefined;
}
export interface ResultFound {
found: true;
path: string | null;
}
export type NewResolverResolve = (modulePath: string, sourceFile: string) => ResolvedResult;
export interface NewResolver {
interfaceVersion: 3;
name?: string;
resolve: NewResolverResolve;
}
export type Resolver = LegacyResolver | NewResolver;
export type ResolvedResult = ResultFound | ResultNotFound;
export interface NodeResolverOptions extends Omit<NapiResolveOptions, 'extensions'> {
basedir?: string;
includeCoreModules?: boolean;
extensions?: string | readonly string[];
paths?: string | readonly string[];
moduleDirectory?: string | readonly string[];
preserveSymlinks?: boolean;
package?: unknown;
packageFilter?: unknown;
pathFilter?: unknown;
packageIterator?: unknown;
}
export interface WebpackResolverOptions {
config?: string | {
resolve: NapiResolveOptions;
};
'config-index'?: number;
env?: Record<string, unknown>;
argv?: Record<string, unknown>;
}
export interface TsResolverOptions extends NapiResolveOptions {
alwaysTryTypes?: boolean;
project?: string[] | string;
extensions?: string[];
}
export type LegacyResolverName = LiteralUnion<'node' | 'typescript' | 'webpack', string>;
export type LegacyResolverResolveImport<T = unknown> = (modulePath: string, sourceFile: string, config: T) => string | undefined;
export type LegacyResolverResolve<T = unknown> = (modulePath: string, sourceFile: string, config: T) => ResolvedResult;
export interface LegacyResolverV1<T> {
interfaceVersion?: 1;
resolveImport: LegacyResolverResolveImport<T>;
}
export interface LegacyResolverV2<T> {
interfaceVersion: 2;
resolve: LegacyResolverResolve<T>;
}
export type LegacyResolver<T = unknown, U = T> = LegacyResolverV1<U> | LegacyResolverV2<T>;
export interface LegacyResolverObjectBase {
name: LegacyResolverName;
enable?: boolean;
options?: unknown;
resolver: LegacyResolver;
}
export interface LegacyNodeResolverObject extends LegacyResolverObjectBase {
name: 'node';
options?: NodeResolverOptions | boolean;
}
export interface LegacyTsResolverObject extends LegacyResolverObjectBase {
name: 'typescript';
options?: TsResolverOptions | boolean;
}
export interface LegacyWebpackResolverObject extends LegacyResolverObjectBase {
name: 'webpack';
options?: WebpackResolverOptions | boolean;
}
export type LegacyResolverObject = LegacyNodeResolverObject | LegacyResolverObjectBase | LegacyTsResolverObject | LegacyWebpackResolverObject;
export interface LegacyResolverRecord {
[resolve: string]: unknown;
node?: NodeResolverOptions | boolean;
typescript?: TsResolverOptions | boolean;
webpack?: WebpackResolverOptions | boolean;
}
export type LegacyImportResolver = LegacyResolverName | LegacyResolverName[] | LegacyResolverObject | LegacyResolverObject[] | LegacyResolverRecord | LegacyResolverRecord[];
export interface ImportSettings {
cache?: {
lifetime?: number | '∞' | 'Infinity';
};
coreModules?: string[];
docstyle?: DocStyle[];
extensions?: readonly FileExtension[];
externalModuleFolders?: string[];
ignore?: string[];
internalRegex?: string;
parsers?: Record<string, readonly FileExtension[]>;
resolve?: NodeResolverOptions;
resolver?: LegacyImportResolver;
'resolver-legacy'?: LegacyImportResolver;
'resolver-next'?: NewResolver | NewResolver[];
}
export type WithPluginName<T extends object | string> = T extends string ? `${PluginName}/${KebabCase<T>}` : {
[K in keyof T as WithPluginName<`${KebabCase<K & string>}`>]: T[K];
};
export type PluginSettings = WithPluginName<ImportSettings>;
export interface RuleContext<TMessageIds extends string = string, TOptions extends readonly unknown[] = readonly unknown[]> extends Omit<TSESLint.RuleContext<TMessageIds, TOptions>, 'settings'> {
settings: PluginSettings;
}
export interface ChildContext {
cacheKey: string;
settings: PluginSettings;
parserPath?: string | null;
parserOptions?: TSESLint.ParserOptions;
languageOptions?: TSESLint.FlatConfig.LanguageOptions;
path: string;
cwd: string;
filename: string;
physicalFilename: string;
}

3
node_modules/eslint-import-context/lib/types.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

1
node_modules/eslint-import-context/lib/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}

13
node_modules/eslint-import-context/lib/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { ChildContext, RuleContext } from './types.js';
export declare const pluginName = "import-x";
export type PluginName = typeof pluginName;
export declare function getTsconfigWithContext(context: ChildContext | RuleContext): {
compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
compileOnSave?: boolean | undefined;
files?: string[] | undefined;
exclude?: string[] | undefined;
include?: string[] | undefined;
references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
} | null | undefined;

47
node_modules/eslint-import-context/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.pluginName = void 0;
exports.getTsconfigWithContext = getTsconfigWithContext;
const node_path_1 = __importDefault(require("node:path"));
const get_tsconfig_1 = require("get-tsconfig");
const stable_hash_x_1 = require("stable-hash-x");
exports.pluginName = 'import-x';
const tsconfigCache = new Map();
function getTsconfigWithContext(context) {
var _a;
const parserOptions = ((_a = context.languageOptions) === null || _a === void 0 ? void 0 : _a.parserOptions) || context.parserOptions;
let tsconfigRootDir = parserOptions === null || parserOptions === void 0 ? void 0 : parserOptions.tsconfigRootDir;
const project = parserOptions === null || parserOptions === void 0 ? void 0 : parserOptions.project;
const cacheKey = (0, stable_hash_x_1.stableHash)([tsconfigRootDir, project]);
let tsconfig;
if (tsconfigCache.has(cacheKey)) {
tsconfig = tsconfigCache.get(cacheKey);
}
else {
tsconfigRootDir =
tsconfigRootDir ||
process.cwd();
let tsconfigResult;
if (project) {
const projects = Array.isArray(project) ? project : [project];
for (const project of projects) {
tsconfigResult = (0, get_tsconfig_1.getTsconfig)(project === true
? context.physicalFilename
: node_path_1.default.resolve(tsconfigRootDir, project));
if (tsconfigResult) {
break;
}
}
}
else {
tsconfigResult = (0, get_tsconfig_1.getTsconfig)(tsconfigRootDir);
}
tsconfig = tsconfigResult === null || tsconfigResult === void 0 ? void 0 : tsconfigResult.config;
tsconfigCache.set(cacheKey, tsconfig);
}
return tsconfig;
}
//# sourceMappingURL=utils.js.map

1
node_modules/eslint-import-context/lib/utils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAeA,wDAmCC;AAlDD,0DAA4B;AAE5B,+CAA0C;AAE1C,iDAA0C;AAI7B,QAAA,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AC/C,CAAC;QACD,QAAQ,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAA;QACjC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC"}

38
node_modules/eslint-import-context/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "eslint-import-context",
"version": "0.1.9",
"type": "commonjs",
"description": "Provide context info for eslint-plugin-import-x, so no extra arguments need to be added.",
"repository": "git+https://github.com/un-ts/eslint-import-context.git",
"author": "JounQin <admin@1stg.me> (https://www.1stG.me)",
"funding": "https://opencollective.com/eslint-import-context",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"files": [
"lib",
"!**/*.tsbuildinfo"
],
"peerDependencies": {
"unrs-resolver": "^1.0.0"
},
"peerDependenciesMeta": {
"unrs-resolver": {
"optional": true
}
},
"dependencies": {
"get-tsconfig": "^4.10.1",
"stable-hash-x": "^0.2.0"
}
}