@obuild/plugin-oxc-minify
v0.0.2
Published
TypeScript/JSX/TSX minifier for obuild
Readme
📦 @obuild/plugin-oxc-minify 😯
Oxc minify plugin for obuild.
The oxc-minify plugin handles JavaScript file minifications using the oxc-minify 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.
import { defineBuildConfig } from "obuild/config";
import { oxcDts } from "@obuild/plugin-oxc-dts";
import { oxcTransform } from "@obuild/plugin-oxc-transform";
import { oxcMinify } from "@obuild/plugin-oxc-minify";
export default defineBuildConfig({
entries: [
{
type: "transform",
input: "./src/runtime/",
outDir: "./dist/runtime/",
plugins: [
oxcDts(), // Optional: Emit declarations for TS(X)/JS(X) files before transformation
oxcTransform(), // Optional: Transform TS(X)/JSX files to JS before minification
oxcMinify({
// Configuration options
}),
],
},
],
});Options
The following interface describes the options you can pass to the plugin:
import type { MinifyOptions } from "oxc-minify";
import type { Config, Extensions } from "./config.ts";
import type { CodeFile, InputFile, PluginContext } from "obuild";
export interface OxcMinifyPluginOptions {
/** The allowed file extensions for the minifier. */
extensions?: Extensions;
/**
* Minify options for `oxc-minify`.
*
* See [oxc-minify](https://www.npmjs.com/package/oxc-minify) for more
* details.
*/
minify?: MinifyOptions;
/**
* Configuration hook that allows you to modify the configuration for a
* specific file.
*
* @param file - The input 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 | CodeFile,
config: Config,
context: PluginContext,
) => Config | undefined;
}License
💛 Released under the MIT license.
🤖 auto updated with automd
