Oxc declarations plugin for obuild
npm install @obuild/plugin-oxc-dtsIsolated declarations plugin for obuild.
The oxc-dts plugin emits declarations for TS(X)/JS(X) files using the oxc-transform package under the hood.
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.
``ts
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
}),
],
},
],
});
`
The following interface describes the options you can pass to the plugin:
`ts [options.ts]
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.isolatedDeclarations
*
* If it fails to generate declarations for a file due to
* problems it will be ignored and no declaration file@obuild/plugin-tsc-dts
* will be generated for that file.
*
* You can use another plugin like 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 for more
* details.
*/
declarations?: Omit
/**
* 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;
}
``
š Released under the MIT license.
---
_š¤ auto updated with automd_