mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
## [0.30.3] - 2024-09-27 ### Bug Fixes - |
||
|---|---|---|
| .. | ||
| scripts | ||
| CHANGELOG.md | ||
| package.json | ||
| README.md | ||
Oxc Transform
Isolated Declarations for Standalone DTS Emit
Based on Oxc and conforms to TypeScript Compiler's --isolated-declaration .d.ts emit.
This is still in alpha and may yield incorrect results, feel free to submit a bug report.
Usage
import assert from 'assert';
import oxc from 'oxc-transform';
const { map, code, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}', { sourcemap: true });
assert.equal(code, 'declare class A {}\n');
assert.deepEqual(map, {
mappings: 'AAAA,cAAM,EAAE,CAAE',
names: [],
sources: ['test.ts'],
sourcesContent: ['class A {}'],
});
assert(errors.length == 0);
API
export function isolatedDeclaration(
filename: string,
sourceText: string,
options?: IsolatedDeclarationsOptions,
): IsolatedDeclarationsResult;
export interface IsolatedDeclarationsOptions {
stripInternal?: boolean;
sourcemap?: boolean;
}
export interface IsolatedDeclarationsResult {
code: string;
map?: SourceMap;
errors: Array<string>;
}