Files
NapCatQQ/.pnpm-store/v3/files/ee/5c3a8c55a40164cdf47b8f133ecf457cb94deab8776e631e0feb688cf2072ee15adb809b4222e9b3f6f66fd82adacc65522fd1b4b3706bd24ec178d0502a5b
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

88 lines
2.2 KiB
Plaintext

import { PathCache, TrieNode } from './utils';
export interface ITSCAliasConfig {
replacers?: ReplacerOptions;
resolveFullPaths?: boolean;
verbose?: boolean;
fileExtensions?: Partial<FileExtensions>;
}
export type PathLike = {
[key: string]: string[];
};
export type StringReplacer = (importStatement: string) => string;
export interface FileExtensions {
inputGlob: string;
outputCheck: string[];
}
export interface ITSConfig {
baseUrl?: string;
outDir?: string;
declarationDir?: string;
paths?: PathLike;
replacers?: ReplacerOptions;
resolveFullPaths?: boolean;
verbose?: boolean;
fileExtensions?: Partial<FileExtensions>;
}
export interface IProjectConfig {
configFile: string;
baseUrl: string;
outDir: string;
configDir: string;
outPath: string;
confDirParentFolderName: string;
hasExtraModule: boolean;
configDirInOutPath: string;
relConfDirPathInOutPath: string;
pathCache: PathCache;
inputGlob: string;
}
export interface IConfig extends IProjectConfig {
output: IOutput;
aliasTrie: TrieNode<Alias>;
replacers: AliasReplacer[];
}
export interface ReplaceTscAliasPathsOptions {
configFile?: string;
outDir?: string;
declarationDir?: string;
watch?: boolean;
verbose?: boolean;
debug?: boolean;
resolveFullPaths?: boolean;
resolveFullExtension?: '.js' | '.mjs' | '.cjs';
replacers?: string[];
output?: IOutput;
aliasTrie?: TrieNode<Alias>;
fileExtensions?: Partial<FileExtensions>;
}
export interface Alias {
shouldPrefixMatchWildly: boolean;
prefix: string;
paths: AliasPath[];
}
export interface AliasPath {
basePath: string;
path: string;
isExtra: boolean;
}
export interface AliasReplacerArguments {
orig: string;
file: string;
config: IConfig;
}
export type AliasReplacer = (args: AliasReplacerArguments) => string;
export interface ReplacerOptions {
[key: string]: {
enabled: boolean;
file?: string;
};
}
export interface IOutput {
verbose: boolean;
debug: (message: string, obj?: unknown) => void;
info(message: string): void;
error(message: string, exitProcess?: boolean): void;
clear(): void;
assert(claim: unknown, message: string): void;
}