Skip to main content
Version: 1.0.0

@farmfe/js-plugin-dts

Support Generate .d.ts files for Farm. This plugin is used for building tools and libraries, generate .d.ts for your typescript code.

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.