Type Alias GenerateConfig
bundlePackageExports?: boolean;
checkDefaultPath?: boolean;
compilerOptions?: TsConfigJson.CompilerOptions;
conditionImports?: resolve_exports.Options;
dtsReplace?: Record<string, string>;
emitCTS?: boolean;
filterTags?: string | Iterable<string> | false | null;
importsExternal?: boolean | ImportsPluginOptions;
importsLocal?: boolean | ImportsPluginOptions;
importsResolve?: boolean | ImportsResolvePluginOptions;
input: string;
logLevel?: LogLevel;
output?: string;
outputExt?: string;
outputGraph?: string;
outputGraphIndentation?: number;
outputPostprocess?: string;
plugins?: Iterable<string>;
postprocess?: Iterable<ProcessorFunction>;
prependFiles?: Iterable<string>;
prependString?: Iterable<string>;
prettier?: boolean | prettier.Options;
removePrivateStatic?: boolean;
rollupExternal?:
| (string | RegExp)[]
| RegExp
| string
| ((id: string, parentId: string, isResolved: boolean) => boolean);
rollupOnwarn?: (
warning: rollup.RollupLog,
defaultHandler: (warning: string | rollup.RollupLog) => void,
) => void;
rollupPaths?: Record<string, string> | ((id: string) => string);
tsCheckJs?: boolean;
tsconfig?: string;
tsDiagnosticExternal?: boolean;
tsDiagnosticFilter?: (
params: { diagnostic: Diagnostic; message?: string },
) => boolean;
tsDiagnosticLog?: boolean;
tsFileWalk?: boolean;
tsTransformers?: Iterable<
TransformerFactory<Bundle | SourceFile>
| CustomTransformerFactory,
>;
}
Index
Properties
Properties
OptionalbundlePackageExports
When true attempt to bundle types of top level exported packages. This is useful for re-bundling libraries.
OptionalcheckDefaultPath
When true and bundling top level package exports via bundlePackageExports check for index.d.ts in the package
root; this is off by default as usually this is indicative of and older package not updated for exports
in package.json.
OptionalcompilerOptions
Typescript compiler options. https://www.typescriptlang.org/tsconfig
OptionalconditionImports
resolve.exports conditional options for package.json imports field type.
OptionaldtsReplace
Options for naive text replacement operating on the final bundled TS declaration file. The keys are converted into RegExp instances so may be a valid pattern to match.
OptionalemitCTS
Output additional '.d.cts' file for strict Typescript adherence for packages that are dual ESM / CJS.
OptionalfilterTags
By default, jsdocRemoveNodeByTags('internal') transformer is automatically added removing all AST nodes that
have the @internal tag. To generate declarations with internal tags set to false / null / undefined.
OptionalimportsExternal
When defined enables importsExternal from the @typhonjs-build-test/rollup-plugin-pkg-imports package.
OptionalimportsLocal
When defined enables importsLocal from the @typhonjs-build-test/rollup-plugin-pkg-imports package.
OptionalimportsResolve
When defined enables importsResolve from the @typhonjs-build-test/rollup-plugin-pkg-imports package.
input
The input entry source file path.
OptionallogLevel
Defines the logging level; default: info.
Optionaloutput
The output file path for the bundled TS declarations.
OptionaloutputExt
The bundled output TS declaration file extension. Normally a complete output path is provided when using
generateDTS, but this can be useful when using the Rollup plugin to change the extension as desired.
OptionaloutputGraph
Outputs the package dependency graph to the given file path. The graph JSON is suitable for use in various graph libraries like cytoscape / Svelte Flow / amongst others.
OptionaloutputGraphIndentation
When outputting the dependency graph use this indentation value for the JSON output.
OptionaloutputPostprocess
When postprocessing is configured this is a helpful debugging mechanism to output the postprocessed declarations to a separate file making it easier to compare the results of any additional processing. You must specify a valid file path.
Optionalplugins
An iterable list of NPM package names or local source files providing ESM plugins to load for additional file
type support. Official 1st party plugins installed will automatically load. Use plugins to load any 3rd party
plugins.
Optionalpostprocess
An iterable list of postprocessing functions. Note: This is experimental!
OptionalprependFiles
Directly prepend these files to the bundled output. The files are first attempted to be resolved relative to the entry point folder allowing a common configuration to be applied across multiple subpath exports. Then a second attempt is made with the path provided.
OptionalprependString
Directly prepend these strings to the bundled output.
Optionalprettier
When defined as "false" prettier is not executed on the bundled declaration output. Otherwise, you may provide
a custom prettier configuration object.
OptionalremovePrivateStatic
When processing ESM and this option is true a custom transformer is added to remove the renaming of private
static class members that Typescript currently renames and improperly passes through to bundled declarations.
Default: true.
OptionalrollupExternal
| (string | RegExp)[]
| RegExp
| string
| ((id: string, parentId: string, isResolved: boolean) => boolean)
Rollup external option.
https://rollupjs.org/configuration-options/#external
OptionalrollupOnwarn
warning: rollup.RollupLog,
defaultHandler: (warning: string | rollup.RollupLog) => void,
) => void
Rollup onwarn option.
https://rollupjs.org/configuration-options/#onwarn
Type Declaration
- (
warning: rollup.RollupLog,
defaultHandler: (warning: string | rollup.RollupLog) => void,
): void Parameters
- warning: rollup.RollupLog
RollupLog warning.
- defaultHandler: (warning: string | rollup.RollupLog) => void
Default Rollup warning handler.
Returns void
- warning: rollup.RollupLog
- (
OptionalrollupPaths
Rollup paths option.
https://rollupjs.org/configuration-options/#output-paths
OptionaltsCheckJs
When true set checkJs to default compiler options. This is a convenience parameter to quickly turn checkJs
on / off. Default: false.
Optionaltsconfig
Provide a file path to a tsconfig.json for custom compilerOptions configuration.
OptionaltsDiagnosticExternal
By default, all diagnostic errors that are external to the common root path from the input source file will be
filtered from diagnostic logging. Set to true to include all diagnostic errors in logging. If you set an
explicit diagnostic filter function via the tsDiagnosticFilter this option is ignored.
OptionaltsDiagnosticFilter
params: { diagnostic: Diagnostic; message?: string },
) => boolean
Optional filter function to handle diagnostic messages in a similar manner as the onwarn Rollup callback.
Return true to filter the given diagnostic from posting to console.error otherwise return false to include.
Type Declaration
- (params: { diagnostic: Diagnostic; message?: string }): boolean
Parameters
- params: { diagnostic: Diagnostic; message?: string }
The TS Diagnostic to filter and associated message.
Returns boolean
- params: { diagnostic: Diagnostic; message?: string }
OptionaltsDiagnosticLog
When generating a DTS bundle you may opt to turn off any emitted TS compiler diagnostic messages; Default: true.
OptionaltsFileWalk
When processing an ESM entry point and set to true all TS files located at the input path and all
subdirectories are included as synthetic exports in the generated declarations. Setting to false only includes
TS files in the direct input path.
OptionaltsTransformers
A list of TransformerFactory or CustomTransformerFactory functions to process generated declaration AST while emitting intermediate types for bundling. https://github.com/itsdouges/typescript-transformer-handbook
Data used to generate the bundled TS declaration.