UNPKG

rsbuild-plugin-dts

Version:

Rsbuild plugin that supports emitting declaration files for TypeScript.

26 lines (25 loc) 2.12 kB
import { type RsbuildConfig } from '@rsbuild/core'; import { type MatchPath } from 'tsconfig-paths'; import ts from 'typescript'; import type { DtsEntry, DtsRedirect } from './index'; export declare const JS_EXTENSIONS_PATTERN: RegExp; export declare function loadTsconfig(tsconfigPath: string): ts.ParsedCommandLine; export declare const TEMP_FOLDER = ".rslib"; export declare const TEMP_DTS_DIR: string; export declare function ensureTempDeclarationDir(cwd: string, name: string): string; export declare function pathExists(path: string): Promise<boolean>; export declare function isDirectory(filePath: string): Promise<boolean>; export declare function emptyDir(dir: string): Promise<void>; export declare function clearTempDeclarationDir(cwd: string): Promise<void>; export declare function getFileLoc(diagnostic: ts.Diagnostic, configPath: string): string; export declare const prettyTime: (seconds: number) => string; export declare function getTimeCost(start: number): string; export declare function addBannerAndFooter(dtsFile: string, banner?: string, footer?: string): Promise<void>; export declare function redirectDtsImports(dtsFile: string, dtsExtension: string, redirect: DtsRedirect, matchPath: MatchPath, outDir: string, rootDir: string): Promise<void>; export declare function processDtsFiles(bundle: boolean, dir: string, dtsExtension: string, redirect: DtsRedirect, tsconfigPath: string, rootDir: string, banner?: string, footer?: string): Promise<void>; export declare function processSourceEntry(bundle: boolean, entryConfig: NonNullable<RsbuildConfig['source']>['entry']): DtsEntry[]; export declare function calcLongestCommonPath(absPaths: string[]): Promise<string | null>; export declare function cleanDtsFiles(dir: string): Promise<void>; export declare function cleanTsBuildInfoFile(tsconfigPath: string, compilerOptions: ts.CompilerOptions): Promise<void>; export declare function getDtsEmitPath(pathFromPlugin: string | undefined, declarationDir: string | undefined, distPath: string): string; export declare function warnIfOutside(cwd: string, dir: string | undefined, label: string): void;