oxc-transform 0.30.3 → 0.30.5
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 +13 -13
- 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
|
@@ -124,8 +124,14 @@ export interface ReactBindingOptions {
|
|
|
124
124
|
* @default false
|
|
125
125
|
*/
|
|
126
126
|
useSpread?: boolean
|
|
127
|
-
/**
|
|
128
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Enable React Fast Refresh .
|
|
129
|
+
*
|
|
130
|
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/main/packages/react-refresh}
|
|
131
|
+
*
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
refresh?: boolean | ReactRefreshBindingOptions
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
export interface ReactRefreshBindingOptions {
|
|
@@ -146,11 +152,11 @@ export interface ReactRefreshBindingOptions {
|
|
|
146
152
|
|
|
147
153
|
export interface SourceMap {
|
|
148
154
|
file?: string
|
|
149
|
-
mappings
|
|
150
|
-
names
|
|
155
|
+
mappings: string
|
|
156
|
+
names: Array<string>
|
|
151
157
|
sourceRoot?: string
|
|
152
|
-
sources
|
|
153
|
-
sourcesContent?: Array<string
|
|
158
|
+
sources: Array<string>
|
|
159
|
+
sourcesContent?: Array<string>
|
|
154
160
|
version: number
|
|
155
161
|
x_google_ignoreList?: Array<number>
|
|
156
162
|
}
|
|
@@ -181,18 +187,12 @@ export interface TransformOptions {
|
|
|
181
187
|
* options.
|
|
182
188
|
*/
|
|
183
189
|
cwd?: string
|
|
184
|
-
/**
|
|
185
|
-
* Force jsx parsing,
|
|
186
|
-
*
|
|
187
|
-
* @default false
|
|
188
|
-
*/
|
|
189
|
-
jsx?: boolean
|
|
190
190
|
/** Configure how TypeScript is transformed. */
|
|
191
191
|
typescript?: TypeScriptBindingOptions
|
|
192
192
|
/** Configure how TSX and JSX are transformed. */
|
|
193
193
|
react?: ReactBindingOptions
|
|
194
194
|
/** Enable ES2015 transformations. */
|
|
195
|
-
es2015?:
|
|
195
|
+
es2015?: ES2015BindingOptions
|
|
196
196
|
/**
|
|
197
197
|
* Enable source map generation.
|
|
198
198
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-transform",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.5",
|
|
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.5",
|
|
27
|
+
"@oxc-transform/binding-win32-arm64-msvc": "0.30.5",
|
|
28
|
+
"@oxc-transform/binding-linux-x64-gnu": "0.30.5",
|
|
29
|
+
"@oxc-transform/binding-linux-arm64-gnu": "0.30.5",
|
|
30
|
+
"@oxc-transform/binding-linux-x64-musl": "0.30.5",
|
|
31
|
+
"@oxc-transform/binding-linux-arm64-musl": "0.30.5",
|
|
32
|
+
"@oxc-transform/binding-darwin-x64": "0.30.5",
|
|
33
|
+
"@oxc-transform/binding-darwin-arm64": "0.30.5"
|
|
34
34
|
}
|
|
35
35
|
}
|