oxc-transform-react-compiler-experimental 0.0.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 ADDED
@@ -0,0 +1,84 @@
1
+ # Oxc Transform
2
+
3
+ See [usage instructions](https://oxc.rs/docs/guide/usage/transformer).
4
+
5
+ ## TypeScript and React JSX Transform
6
+
7
+ ```javascript
8
+ import assert from "assert";
9
+ import { transformSync } from "oxc-transform";
10
+
11
+ const { code, declaration, errors } = transformSync("test.ts", "class A<T> {}", {
12
+ typescript: {
13
+ declaration: true, // With isolated declarations in a single step.
14
+ },
15
+ });
16
+ // or `await transform(filename, code, options)`
17
+
18
+ assert.equal(code, "class A {}\n");
19
+ assert.equal(declaration, "declare class A<T> {}\n");
20
+ assert(errors.length == 0);
21
+ ```
22
+
23
+ ## [Isolated Declarations for Standalone DTS Emit](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#isolated-declarations)
24
+
25
+ Conforms to TypeScript compiler's `--isolatedDeclarations` `.d.ts` emit.
26
+
27
+ ### Usage
28
+
29
+ ```javascript
30
+ import assert from "assert";
31
+ import { isolatedDeclarationSync } from "oxc-transform";
32
+
33
+ const { map, code, errors } = isolatedDeclarationSync("test.ts", "class A {}");
34
+ // or `await isolatedDeclaration(filename, code, options)`
35
+
36
+ assert.equal(code, "declare class A {}\n");
37
+ assert(errors.length == 0);
38
+ ```
39
+
40
+ ### API
41
+
42
+ #### Transform Functions
43
+
44
+ ```typescript
45
+ // Synchronous transform
46
+ transformSync(
47
+ filename: string,
48
+ sourceText: string,
49
+ options?: TransformOptions,
50
+ ): TransformResult
51
+
52
+ // Asynchronous transform
53
+ transform(
54
+ filename: string,
55
+ sourceText: string,
56
+ options?: TransformOptions,
57
+ ): Promise<TransformResult>
58
+ ```
59
+
60
+ #### Isolated Declaration Functions
61
+
62
+ ```typescript
63
+ // Synchronous isolated declaration
64
+ isolatedDeclarationSync(
65
+ filename: string,
66
+ sourceText: string,
67
+ options?: IsolatedDeclarationsOptions,
68
+ ): IsolatedDeclarationsResult
69
+
70
+ // Asynchronous isolated declaration
71
+ isolatedDeclaration(
72
+ filename: string,
73
+ sourceText: string,
74
+ options?: IsolatedDeclarationsOptions,
75
+ ): Promise<IsolatedDeclarationsResult>
76
+ ```
77
+
78
+ Use the `Sync` versions for synchronous operations. Use async versions for asynchronous operations, which can be beneficial in I/O-bound or concurrent scenarios, though they add async overhead.
79
+
80
+ See `index.d.ts` for complete type definitions.
81
+
82
+ ### Supports WASM
83
+
84
+ See https://stackblitz.com/edit/oxc-transform for usage example.
package/browser.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@oxc-transform/binding-wasm32-wasi'