Skip to content

marmotte / vite/dts

vite/dts

Interfaces

PluginOptions

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:43

Properties

afterBuild?

optional afterBuild?: (emittedFiles) => MaybePromise<void>

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:237

Hook called after all declaration files are written.

It will be received a map (path -> content) that records those emitted files.

Parameters
emittedFiles

Map<string, string>

Returns

MaybePromise<void>

Default
ts
() => {}
afterDiagnostic?

optional afterDiagnostic?: (diagnostics) => MaybePromise<void>

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:210

Hook called after diagnostic is emitted.

According to the diagnostics.length, you can judge whether there is any type error.

Parameters
diagnostics

readonly Diagnostic[]

Returns

MaybePromise<void>

Default
ts
() => {}
afterRollup?

optional afterRollup?: (result) => MaybePromise<void>

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:229

Hook called after rolling up declaration files.

Parameters
result

ExtractorResult

Returns

MaybePromise<void>

Default
ts
() => {}
aliasesExclude?

optional aliasesExclude?: (string | RegExp)[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:108

Set which paths should be excluded when transforming aliases.

Default
ts
[]
beforeWriteFile?

optional beforeWriteFile?: (filePath, content) => MaybePromise<false | void | { content?: string; filePath?: string; }>

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:220

Hook called prior to writing each declaration file.

This allows you to transform the path or content.

The file will be skipped when the return value false or Promise<false>.

Parameters
filePath

string

content

string

Returns

MaybePromise<false | void | { content?: string; filePath?: string; }>

Default
ts
() => {}
bundledPackages?

optional bundledPackages?: string[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:167

Bundled packages for @microsoft/api-extractor.

Default
ts
[]
See

https://api-extractor.com/pages/configs/api-extractor_json/#bundledpackages

cleanVueFileName?

optional cleanVueFileName?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:116

Whether to transform file names ending in '.vue.d.ts' to '.d.ts'.

If there is a duplicate name after transform, it will fall back to the original name.

Default
ts
false
clearPureImport?

optional clearPureImport?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:142

Whether to remove import 'xxx'.

Default
ts
true
compilerOptions?

optional compilerOptions?: CompilerOptions | null

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:79

Override compilerOptions.

Default
ts
null
copyDtsFiles?

optional copyDtsFiles?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:188

Whether to copy .d.ts source files to outDir.

Default
ts
false
Remarks

Before 2.0, the default was true.

declarationOnly?

optional declarationOnly?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:196

Whether to emit declaration files only.

When true, all the original outputs of vite (rollup) will be force removed.

Default
ts
false
entryRoot?

optional entryRoot?: string

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:65

Override root path of entry files (useful in monorepos).

The output path of each file will be calculated based on the value provided.

The default is the smallest public path for all source files.

exclude?

optional exclude?: string | string[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:136

Override exclude glob.

Defaults to exclude property of tsconfig.json or 'node_modules/**' if not supplied.

include?

optional include?: string | string[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:130

Override include glob (relative to root).

Defaults to include property of tsconfig.json (relative to tsconfig.json located).

insertTypesEntry?

optional insertTypesEntry?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:152

Whether to generate types entry file(s).

When true, uses package.json types property if it exists or ${outDir}/index.d.ts.

Value is forced to true when rollupTypes is true.

Default
ts
false
logLevel?

optional logLevel?: LogLevel

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:202

Logging level for this plugin.

Defaults to the 'logLevel' property of your Vite config.

outDir?

optional outDir?: string | string[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:57

Output directory for declaration files.

Can be an array to output to multiple directories.

Defaults to 'build.outDir' of the Vite config, or outDir of tsconfig.json if using Rollup.

pathsToAliases?

optional pathsToAliases?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:102

Parsing paths of tsconfig.json to aliases.

Note that these aliases only use for declaration files.

Default
ts
true
Remarks

Only use first replacement of each path.

resolvers?

optional resolvers?: Resolver[]

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:93

Specify custom resolvers.

Default
ts
[]
rollupConfig?

optional rollupConfig?: RollupConfig

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:174

Override the config of @microsoft/api-extractor.

Default
ts
null
See

https://api-extractor.com/pages/setup/configure_api_report/

rollupOptions?

optional rollupOptions?: IExtractorInvokeOptions

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:181

Override the invoke options of @microsoft/api-extractor.

Default
ts
null
See

https://api-extractor.com/pages/setup/invoking/#invoking-from-a-build-script

rollupTypes?

optional rollupTypes?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:160

Rollup type declaration files after emitting them.

Powered by @microsoft/api-extractor - time-intensive operation.

Default
ts
false
root?

optional root?: string

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:49

Specify root directory.

Defaults to the 'root' of the Vite config, or process.cwd() if using Rollup.

staticImport?

optional staticImport?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:124

Whether to transform dynamic imports to static (eg import('vue').DefineComponent to import { DefineComponent } from 'vue').

Value is forced to true when rollupTypes is true.

Default
ts
false
strictOutput?

optional strictOutput?: boolean

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:73

Restrict declaration files output to outDir.

If true, generated declaration files outside outDir will be ignored.

Default
ts
true
tsconfigPath?

optional tsconfigPath?: string

Defined in: node_modules/vite-plugin-dts/dist/index.d.ts:87

Specify tsconfig.json path.

Plugin resolves include and exclude globs from tsconfig.json.

If not specified, plugin will find config file from root.

Functions

default()

default(options?): Plugin<{ options: PluginOptions; }>

Defined in: src/vite/dts.ts:14

A wrapper around vite-plugin-dts that also exposes the options so that other plugins can use the same TS config without having to copy paste settings

Parameters

options?

PluginOptions = {}

Returns

Plugin<{ options: PluginOptions; }>


getDTSPlugin()

getDTSPlugin(config): Plugin<{ options: PluginOptions; }>[]

Defined in: src/vite/dts.ts:26

Parameters

config

ResolvedConfig

Returns

Plugin<{ options: PluginOptions; }>[]


getDTSPluginOptions()

getDTSPluginOptions(config): PluginOptions

Defined in: src/vite/dts.ts:30

Parameters

config

ResolvedConfig

Returns

PluginOptions