import { TransformOptions } from "oxc-transform"; import { LoaderContext } from "webpack"; //#region src/index.d.ts interface OxcLoaderOptions extends Omit { /** * Enable source map generation. * When not specified, falls back to webpack's own `this.sourceMap` setting * (determined by the `devtool` option). * @default undefined (inherits from webpack) */ sourcemap?: boolean; /** * Enable React Fast Refresh for development. * Passed as `jsx.refresh` to oxc-transform when autoDetectJsx is active. * @default false */ refresh?: boolean; /** * Automatically detect and configure JSX based on file extension. * When enabled, `.jsx`/`.tsx` files receive `runtime: "automatic"` and * `development` is derived from webpack's `mode` (unless already set). * @default true */ autoDetectJsx?: boolean; /** * Enable automatic tsconfig.json detection and configuration. * @default true */ useTsconfig?: boolean; /** * Custom path to tsconfig.json file. * If not specified, will search for tsconfig.json from `rootContext`. */ tsconfigPath?: string; /** * Use the synchronous oxc-transform API (`transformSync`) instead of the * default asynchronous one. This avoids promise overhead and can be faster * in certain build pipelines. * * Note: the oxc-transform module is still loaded asynchronously the first * time the loader runs; subsequent calls reuse the cached module. * @default false */ sync?: boolean; } /** * Factory that produces a loader function. Exposed as `oxcLoader.custom` so * callers can create isolated loader instances with their own defaults. */ declare function makeLoader(): (this: LoaderContext, source: string) => Promise; declare const oxcLoader: (this: LoaderContext, source: string) => Promise; /** * Default export: the loader function ready to be used directly in webpack/rspack. * * @example * // webpack.config.js * module.exports = { * module: { rules: [{ test: /\.[jt]sx?$/, loader: 'oxc-loader' }] } * } */ //#endregion export { OxcLoaderOptions, oxcLoader as default, makeLoader };