@obuild/plugin-oxc-dts
v0.0.2
Published
Oxc declarations plugin for obuild
Downloads
4
Readme
📦 @obuild/plugin-oxc-dts 😯
Isolated declarations plugin for obuild.
The oxc-dts plugin emits declarations for TS(X)/JS(X) files using the oxc-transform package under the hood.
Usage
Import the plugin in your build configuration and add it to the plugins array. You can also configure it with options.
Make sure that your project is compatbile with the isolatedDeclarations TypeScript compiler option, and enable it in your tsconfig.json.
import { defineBuildConfig } from "obuild/config";
import { oxcDts } from "@obuild/plugin-oxc-dts";
export default defineBuildConfig({
entries: [
{
type: "transform",
input: "./src/runtime/",
outDir: "./dist/runtime/",
plugins: [
oxcDts({
// Configuration options
}),
],
},
],
});Options
The following interface describes the options you can pass to the plugin:
import type { IsolatedDeclarationsOptions } from "oxc-transform";
import type { InputFile, PluginContext } from "obuild";
import type { Config, Extensions, OutputExtension } from "./config.ts";
export interface OxcDtsPluginOptions {
/**
* Ignore `isolatedDeclarations` option in the TypeScript configuration.
*
* If it fails to generate declarations for a file due to
* `isolatedDeclarations` problems it will be ignored and no declaration file
* will be generated for that file.
*
* You can use another plugin like `@obuild/plugin-tsc-dts` to generate
* declarations for all missing files.
*/
force?: boolean;
/** Default output extension to use */
defaultExtension?: OutputExtension;
/** Configuration for processing source files based on their extensions. */
inputExtensions?: Extensions;
/**
* Isolated declarations options.
*
* See [oxc-transform](https://www.npmjs.com/package/oxc-transform) for more
* details.
*/
declarations?: Omit<IsolatedDeclarationsOptions, "sourcemap">;
/**
* Configuration hook that allows you to modify the configuration for a
* specific file.
*
* @param file - The input file or declaration source file.
* @param config - The current configuration for the plugin.
* @param context - The plugin context.
* @returns Modified configuration or undefined if the file should not be
* processed.
*/
fileConfig?: (
file: InputFile,
config: Config,
context: PluginContext,
) => Config | undefined;
}License
💛 Released under the MIT license.
🤖 auto updated with automd
