oxc-transform 0.30.3 → 0.30.4
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 +33 -21
- package/index.d.ts +4 -4
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
# Oxc Transform
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is alpha software 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).
|
|
4
|
+
|
|
5
|
+
## TypeScript and React JSX Transform
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import assert from 'assert';
|
|
9
|
+
import oxc from 'oxc-transform';
|
|
10
|
+
|
|
11
|
+
const { code, declaration, errors } = oxc.transform(
|
|
12
|
+
'test.ts',
|
|
13
|
+
'class A<T> {}',
|
|
14
|
+
{
|
|
15
|
+
typescript: {
|
|
16
|
+
declaration: true, // With isolated declarations in a single step.
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
assert.equal(code, 'class A {}\n');
|
|
22
|
+
assert.equal(declaration, 'declare class A<T> {}\n');
|
|
23
|
+
assert(errors.length == 0);
|
|
24
|
+
```
|
|
4
25
|
|
|
5
|
-
|
|
26
|
+
## [Isolated Declarations for Standalone DTS Emit](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#isolated-declarations)
|
|
6
27
|
|
|
7
|
-
|
|
28
|
+
Conforms to TypeScript Compiler's `--isolated-declaration` `.d.ts` emit.
|
|
8
29
|
|
|
9
30
|
### Usage
|
|
10
31
|
|
|
@@ -12,35 +33,26 @@ This is still in alpha and may yield incorrect results, feel free to [submit a b
|
|
|
12
33
|
import assert from 'assert';
|
|
13
34
|
import oxc from 'oxc-transform';
|
|
14
35
|
|
|
15
|
-
const { map, code, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}'
|
|
36
|
+
const { map, code, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}');
|
|
16
37
|
|
|
17
38
|
assert.equal(code, 'declare class A {}\n');
|
|
18
|
-
assert.deepEqual(map, {
|
|
19
|
-
mappings: 'AAAA,cAAM,EAAE,CAAE',
|
|
20
|
-
names: [],
|
|
21
|
-
sources: ['test.ts'],
|
|
22
|
-
sourcesContent: ['class A {}'],
|
|
23
|
-
});
|
|
24
39
|
assert(errors.length == 0);
|
|
25
40
|
```
|
|
26
41
|
|
|
27
42
|
### API
|
|
28
43
|
|
|
44
|
+
See `index.d.ts`.
|
|
45
|
+
|
|
29
46
|
```typescript
|
|
47
|
+
export declare function transform(
|
|
48
|
+
filename: string,
|
|
49
|
+
sourceText: string,
|
|
50
|
+
options?: TransformOptions,
|
|
51
|
+
): TransformResult;
|
|
52
|
+
|
|
30
53
|
export function isolatedDeclaration(
|
|
31
54
|
filename: string,
|
|
32
55
|
sourceText: string,
|
|
33
56
|
options?: IsolatedDeclarationsOptions,
|
|
34
57
|
): IsolatedDeclarationsResult;
|
|
35
|
-
|
|
36
|
-
export interface IsolatedDeclarationsOptions {
|
|
37
|
-
stripInternal?: boolean;
|
|
38
|
-
sourcemap?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IsolatedDeclarationsResult {
|
|
42
|
-
code: string;
|
|
43
|
-
map?: SourceMap;
|
|
44
|
-
errors: Array<string>;
|
|
45
|
-
}
|
|
46
58
|
```
|
package/index.d.ts
CHANGED
|
@@ -146,11 +146,11 @@ export interface ReactRefreshBindingOptions {
|
|
|
146
146
|
|
|
147
147
|
export interface SourceMap {
|
|
148
148
|
file?: string
|
|
149
|
-
mappings
|
|
150
|
-
names
|
|
149
|
+
mappings: string
|
|
150
|
+
names: Array<string>
|
|
151
151
|
sourceRoot?: string
|
|
152
|
-
sources
|
|
153
|
-
sourcesContent?: Array<string
|
|
152
|
+
sources: Array<string>
|
|
153
|
+
sourcesContent?: Array<string>
|
|
154
154
|
version: number
|
|
155
155
|
x_google_ignoreList?: Array<number>
|
|
156
156
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-transform",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
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.30.
|
|
27
|
-
"@oxc-transform/binding-win32-arm64-msvc": "0.30.
|
|
28
|
-
"@oxc-transform/binding-linux-x64-gnu": "0.30.
|
|
29
|
-
"@oxc-transform/binding-linux-arm64-gnu": "0.30.
|
|
30
|
-
"@oxc-transform/binding-linux-x64-musl": "0.30.
|
|
31
|
-
"@oxc-transform/binding-linux-arm64-musl": "0.30.
|
|
32
|
-
"@oxc-transform/binding-darwin-x64": "0.30.
|
|
33
|
-
"@oxc-transform/binding-darwin-arm64": "0.30.
|
|
26
|
+
"@oxc-transform/binding-win32-x64-msvc": "0.30.4",
|
|
27
|
+
"@oxc-transform/binding-win32-arm64-msvc": "0.30.4",
|
|
28
|
+
"@oxc-transform/binding-linux-x64-gnu": "0.30.4",
|
|
29
|
+
"@oxc-transform/binding-linux-arm64-gnu": "0.30.4",
|
|
30
|
+
"@oxc-transform/binding-linux-x64-musl": "0.30.4",
|
|
31
|
+
"@oxc-transform/binding-linux-arm64-musl": "0.30.4",
|
|
32
|
+
"@oxc-transform/binding-darwin-x64": "0.30.4",
|
|
33
|
+
"@oxc-transform/binding-darwin-arm64": "0.30.4"
|
|
34
34
|
}
|
|
35
35
|
}
|