oxc-transform-react-compiler-experimental 0.0.1 → 0.0.2
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/package.json +4 -39
- package/transform.darwin-arm64.node +0 -0
- package/README.md +0 -84
- package/webcontainer-fallback.cjs +0 -21
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-transform-react-compiler-experimental",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Oxc Transformer Node API",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Oxc Transformer Node API (React Compiler Experimental)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"babel",
|
|
7
7
|
"javascript",
|
|
8
8
|
"jsx",
|
|
9
9
|
"oxc",
|
|
10
|
+
"react-compiler",
|
|
10
11
|
"transform",
|
|
11
12
|
"transformer",
|
|
12
13
|
"tsx",
|
|
@@ -18,17 +19,13 @@
|
|
|
18
19
|
"author": "Boshen and oxc contributors",
|
|
19
20
|
"repository": {
|
|
20
21
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/
|
|
22
|
+
"url": "git+https://github.com/nicksrandall/oxc.git",
|
|
22
23
|
"directory": "napi/transform"
|
|
23
24
|
},
|
|
24
|
-
"funding": {
|
|
25
|
-
"url": "https://github.com/sponsors/Boshen"
|
|
26
|
-
},
|
|
27
25
|
"files": [
|
|
28
26
|
"browser.js",
|
|
29
27
|
"index.d.ts",
|
|
30
28
|
"index.js",
|
|
31
|
-
"webcontainer-fallback.cjs",
|
|
32
29
|
"transform.darwin-arm64.node"
|
|
33
30
|
],
|
|
34
31
|
"type": "module",
|
|
@@ -38,38 +35,6 @@
|
|
|
38
35
|
"access": "public",
|
|
39
36
|
"registry": "https://registry.npmjs.org/"
|
|
40
37
|
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build-dev": "napi build --esm --platform",
|
|
43
|
-
"build-test": "pnpm run build-dev --profile coverage",
|
|
44
|
-
"build": "pnpm run build-dev --features allocator --release",
|
|
45
|
-
"postbuild": "publint",
|
|
46
|
-
"postbuild-dev": "node scripts/patch.js",
|
|
47
|
-
"build-wasm": "pnpm run build-wasm-dev --release",
|
|
48
|
-
"build-wasm-dev": "pnpm run build-dev --target wasm32-wasip1-threads",
|
|
49
|
-
"test": "vitest run --dir ./test"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@napi-rs/cli": "catalog:",
|
|
53
|
-
"@testing-library/react": "^16.3.2",
|
|
54
|
-
"@types/node": "catalog:",
|
|
55
|
-
"jsdom": "^28.1.0",
|
|
56
|
-
"publint": "catalog:",
|
|
57
|
-
"react": "^19.2.4",
|
|
58
|
-
"react-dom": "^19.2.4",
|
|
59
|
-
"vitest": "catalog:"
|
|
60
|
-
},
|
|
61
|
-
"napi": {
|
|
62
|
-
"binaryName": "transform",
|
|
63
|
-
"packageName": "@oxc-transform/binding",
|
|
64
|
-
"targets": [
|
|
65
|
-
"aarch64-apple-darwin"
|
|
66
|
-
],
|
|
67
|
-
"wasm": {
|
|
68
|
-
"browser": {
|
|
69
|
-
"fs": false
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
38
|
"engines": {
|
|
74
39
|
"node": "^20.19.0 || >=22.12.0"
|
|
75
40
|
}
|
|
Binary file
|
package/README.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const fs = require("node:fs");
|
|
2
|
-
const childProcess = require("node:child_process");
|
|
3
|
-
|
|
4
|
-
const pkg = JSON.parse(fs.readFileSync(require.resolve("oxc-transform/package.json"), "utf-8"));
|
|
5
|
-
const { version } = pkg;
|
|
6
|
-
const baseDir = `/tmp/oxc-transform-${version}`;
|
|
7
|
-
const bindingEntry = `${baseDir}/node_modules/@oxc-transform/binding-wasm32-wasi/transform.wasi.cjs`;
|
|
8
|
-
|
|
9
|
-
if (!fs.existsSync(bindingEntry)) {
|
|
10
|
-
fs.rmSync(baseDir, { recursive: true, force: true });
|
|
11
|
-
fs.mkdirSync(baseDir, { recursive: true });
|
|
12
|
-
const bindingPkg = `@oxc-transform/binding-wasm32-wasi@${version}`;
|
|
13
|
-
// oxlint-disable-next-line no-console
|
|
14
|
-
console.log(`[oxc-transform] Downloading ${bindingPkg} on WebContainer...`);
|
|
15
|
-
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
|
|
16
|
-
cwd: baseDir,
|
|
17
|
-
stdio: "inherit",
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = require(bindingEntry);
|