UNPKG

ts-patch

Version:

Patch typescript to support custom transformers in tsconfig.json

44 lines (43 loc) 1.68 kB
import type { TsPackage } from '../ts-package'; import { ModuleSource } from './module-source'; import { ModuleFile } from './module-file'; export declare namespace TsModule { const knownNames: readonly ["tsc.js", "typescript.js", "tsserver.js", "tsserverlibrary.js"]; const patchableNames: readonly ["tsc.js", "typescript.js"]; const legacyServiceNames: readonly ["tsserver.js", "tsserverlibrary.js"]; const contentFileMap: Record<string, string>; function getContentFileName(moduleName: typeof knownNames[number]): string; function getContentFilePathForModulePath(modulePath: string): string; function normalizeName(name: string): string; function normalizePatchableName(name: string): typeof patchableNames[number]; } export interface TsModule { package: TsPackage; majorVer: number; minorVer: number; isPatched: boolean; moduleName: TsModule.Name; modulePath: string; moduleContentFilePath: string; moduleFile: ModuleFile; dtsPath: string | undefined; cacheKey: string; backupCachePaths: { js: string; dts?: string; }; patchedCachePaths: { js: string; dts?: string; }; getUnpatchedModuleFile(): ModuleFile; getUnpatchedSource(): ModuleSource; } export declare namespace TsModule { type Name = (typeof knownNames)[number] | string; } export interface GetTsModuleOptions { skipCache?: boolean; } export declare function getTsModule(tsPackage: TsPackage, moduleName: TsModule.Name, options?: GetTsModuleOptions): TsModule; export declare function getTsModule(tsPackage: TsPackage, moduleFile: ModuleFile, options?: GetTsModuleOptions): TsModule;