oxc-transform 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,30 @@
1
- # The JavaScript Oxidation Compiler
1
+ # Oxc Transform
2
2
 
3
- See index.d.ts for `parseSync` and `parseAsync` API.
3
+ ## [Isolated Declarations for Standalone DTS Emit](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#isolated-declarations)
4
4
 
5
- ## ESM
5
+ Based on Oxc and conforms to TypeScript Compiler's `--isolated-declaration` `.d.ts` emit.
6
+
7
+ This is still in alpha and may yield incorrect results, feel free to [submit a bug report](https://github.com/oxc-project/oxc/issues/new?assignees=&labels=C-bug&projects=&template=bug_report.md&title=isolated-declarations:).
8
+
9
+ ### Usage
6
10
 
7
11
  ```javascript
8
- import oxc from './index.js';
9
12
  import assert from 'assert';
13
+ import oxc from 'oxc-transform';
14
+
15
+ const { sourceText, errors } = oxc.isolatedDeclaration("test.ts", "class A {}");
16
+
17
+ assert.equal(sourceText, "declare class A {}\n");
18
+ assert(errors.length == 0);
19
+ ```
20
+
21
+ ### API
10
22
 
11
- test(oxc.isolatedDeclaration("test.ts", "class A {}"), "declare class A {}\n");
23
+ ```typescript
24
+ export function isolatedDeclaration(filename: string, sourceText: string): IsolatedDeclarationsResult
12
25
 
13
- function test(ret, expected) {
14
- assert.equal(ret.sourceText, expected);
15
- assert(ret.errors.length == 0);
26
+ export interface IsolatedDeclarationsResult {
27
+ sourceText: string
28
+ errors: Array<string>
16
29
  }
17
30
  ```
package/index.d.ts CHANGED
@@ -3,6 +3,49 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
+ export interface TypeScriptBindingOptions {
7
+ jsxPragma: string
8
+ jsxPragmaFrag: string
9
+ onlyRemoveTypeImports: boolean
10
+ allowNamespaces: boolean
11
+ allowDeclareFields: boolean
12
+ }
13
+ export interface ReactBindingOptions {
14
+ runtime: 'classic' | 'automatic'
15
+ development: boolean
16
+ throwIfNamespace: boolean
17
+ pure: boolean
18
+ importSource?: string
19
+ pragma?: string
20
+ pragmaFrag?: string
21
+ useBuiltIns?: boolean
22
+ useSpread?: boolean
23
+ }
24
+ export interface ArrowFunctionsBindingOptions {
25
+ spec: boolean
26
+ }
27
+ export interface Es2015BindingOptions {
28
+ arrowFunction?: ArrowFunctionsBindingOptions
29
+ }
30
+ export interface TransformBindingOptions {
31
+ typescript: TypeScriptBindingOptions
32
+ react: ReactBindingOptions
33
+ es2015: Es2015BindingOptions
34
+ }
35
+ export interface Sourcemap {
36
+ file?: string
37
+ mappings?: string
38
+ sourceRoot?: string
39
+ sources?: Array<string | undefined | null>
40
+ sourcesContent?: Array<string | undefined | null>
41
+ names?: Array<string>
42
+ }
43
+ export interface TransformResult {
44
+ sourceText: string
45
+ map?: Sourcemap
46
+ errors: Array<string>
47
+ }
48
+ export function transform(filename: string, sourceText: string, options: TransformBindingOptions): TransformResult
6
49
  export interface IsolatedDeclarationsResult {
7
50
  sourceText: string
8
51
  errors: Array<string>
package/index.js CHANGED
@@ -310,6 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { isolatedDeclaration } = nativeBinding
313
+ const { transform, isolatedDeclaration } = nativeBinding
314
314
 
315
+ module.exports.transform = transform
315
316
  module.exports.isolatedDeclaration = isolatedDeclaration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-transform",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Oxc transform Node API",
5
5
  "keywords": [
6
6
  "transform"
@@ -23,13 +23,13 @@
23
23
  "index.js"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@oxc-transform/binding-win32-x64-msvc": "0.15.0",
27
- "@oxc-transform/binding-win32-arm64-msvc": "0.15.0",
28
- "@oxc-transform/binding-linux-x64-gnu": "0.15.0",
29
- "@oxc-transform/binding-linux-arm64-gnu": "0.15.0",
30
- "@oxc-transform/binding-linux-x64-musl": "0.15.0",
31
- "@oxc-transform/binding-linux-arm64-musl": "0.15.0",
32
- "@oxc-transform/binding-darwin-x64": "0.15.0",
33
- "@oxc-transform/binding-darwin-arm64": "0.15.0"
26
+ "@oxc-transform/binding-win32-x64-msvc": "0.16.0",
27
+ "@oxc-transform/binding-win32-arm64-msvc": "0.16.0",
28
+ "@oxc-transform/binding-linux-x64-gnu": "0.16.0",
29
+ "@oxc-transform/binding-linux-arm64-gnu": "0.16.0",
30
+ "@oxc-transform/binding-linux-x64-musl": "0.16.0",
31
+ "@oxc-transform/binding-linux-arm64-musl": "0.16.0",
32
+ "@oxc-transform/binding-darwin-x64": "0.16.0",
33
+ "@oxc-transform/binding-darwin-arm64": "0.16.0"
34
34
  }
35
35
  }