跳到主要内容
版本:1.0.0

@farmfe/js-plugin-dts

支持 .d.ts 文件。 该插件用于构建的工具库,为您的 ts 代码生成“.d.ts”

Installation

npm install @farmfe/js-plugin-dts

Usage

import { UserConfig } from '@farmfe/core';
import farmJsPluginDts from '@farmfe/js-plugin-dts';

const config: UserConfig = {
plugins: [
farmJsPluginDts({ /* options */ })
]
}

Options

import type { ts, Diagnostic } from 'ts-morph';

export interface DtsPluginOptions {
/**
* Depends on the root directory
*/
root?: string;

/**
* Declaration files output directory
*/
outputDir?: string | string[];

/**
* set the root path of the entry files
*/
entryRoot?: string;

/**
* Project init compilerOptions using by ts-morph
*/
compilerOptions?: ts.CompilerOptions | null;

/**
* Project init tsconfig.json file path by ts-morph
*/
tsConfigPath?: string;

/**
* set include glob
*/
include?: string | string[];

/**
* set exclude glob
*/
exclude?: string | string[];

/**
* Whether copy .d.ts source files into outputDir
*
* @default false
*/
copyDtsFiles?: boolean;

/**
* Whether emit nothing when has any diagnostic
*
* @default false
*/
noEmitOnError?: boolean;

/**
* Whether skip typescript diagnostics
*
* @default true
*/
skipDiagnostics?: boolean;

/**
* Customize typescript lib folder path
*
* @default undefined
*/
libFolderPath?: string;

/**
* According to the length to judge whether there is any type error
*/
afterDiagnostic?: (diagnostics: Diagnostic[]) => void | Promise<void>;
}

Extremely Fast Web Build Tool Written in Rust

Copyright © 2024 Farm Community. Built with Docusaurus.