oxc-transform 0.23.0 → 0.24.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/index.d.ts +163 -6
- package/package.json +9 -9
package/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export interface ArrowFunctionsBindingOptions {
|
|
4
|
+
/**
|
|
5
|
+
* This option enables the following:
|
|
6
|
+
* * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
|
|
7
|
+
* * Add a runtime check to ensure the functions are not instantiated.
|
|
8
|
+
* * Add names to arrow functions.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
4
12
|
spec?: boolean
|
|
5
13
|
}
|
|
6
14
|
|
|
7
15
|
export interface Es2015BindingOptions {
|
|
16
|
+
/** Transform arrow functions into function expressions. */
|
|
8
17
|
arrowFunction?: ArrowFunctionsBindingOptions
|
|
9
18
|
}
|
|
10
19
|
|
|
@@ -16,19 +25,92 @@ export interface IsolatedDeclarationsResult {
|
|
|
16
25
|
errors: Array<string>
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Configure how TSX and JSX are transformed.
|
|
30
|
+
*
|
|
31
|
+
* @see [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/babel-plugin-transform-react-jsx#options)
|
|
32
|
+
*/
|
|
19
33
|
export interface ReactBindingOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Decides which runtime to use.
|
|
36
|
+
*
|
|
37
|
+
* - 'automatic' - auto-import the correct JSX factories
|
|
38
|
+
* - 'classic' - no auto-import
|
|
39
|
+
*
|
|
40
|
+
* @default 'automatic'
|
|
41
|
+
*/
|
|
20
42
|
runtime?: 'classic' | 'automatic'
|
|
43
|
+
/**
|
|
44
|
+
* Emit development-specific information, such as `__source` and `__self`.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*
|
|
48
|
+
* @see [@babel/plugin-transform-react-jsx-development](https://babeljs.io/docs/babel-plugin-transform-react-jsx-development)
|
|
49
|
+
*/
|
|
21
50
|
development?: boolean
|
|
51
|
+
/**
|
|
52
|
+
* Toggles whether or not to throw an error if an XML namespaced tag name
|
|
53
|
+
* is used.
|
|
54
|
+
*
|
|
55
|
+
* Though the JSX spec allows this, it is disabled by default since React's
|
|
56
|
+
* JSX does not currently have support for it.
|
|
57
|
+
*
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
22
60
|
throwIfNamespace?: boolean
|
|
61
|
+
/**
|
|
62
|
+
* Enables [@babel/plugin-transform-react-pure-annotations](https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations).
|
|
63
|
+
*
|
|
64
|
+
* It will mark top-level React method calls as pure for tree shaking.
|
|
65
|
+
*
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
23
68
|
pure?: boolean
|
|
69
|
+
/**
|
|
70
|
+
* Replaces the import source when importing functions.
|
|
71
|
+
*
|
|
72
|
+
* @default 'react'
|
|
73
|
+
*/
|
|
24
74
|
importSource?: string
|
|
75
|
+
/**
|
|
76
|
+
* Replace the function used when compiling JSX expressions. It should be a
|
|
77
|
+
* qualified name (e.g. `React.createElement`) or an identifier (e.g.
|
|
78
|
+
* `createElement`).
|
|
79
|
+
*
|
|
80
|
+
* Only used for `classic` {@link runtime}.
|
|
81
|
+
*
|
|
82
|
+
* @default 'React.createElement'
|
|
83
|
+
*/
|
|
25
84
|
pragma?: string
|
|
85
|
+
/**
|
|
86
|
+
* Replace the component used when compiling JSX fragments. It should be a
|
|
87
|
+
* valid JSX tag name.
|
|
88
|
+
*
|
|
89
|
+
* Only used for `classic` {@link runtime}.
|
|
90
|
+
*
|
|
91
|
+
* @default 'React.Fragment'
|
|
92
|
+
*/
|
|
26
93
|
pragmaFrag?: string
|
|
94
|
+
/**
|
|
95
|
+
* When spreading props, use `Object.assign` directly instead of an extend helper.
|
|
96
|
+
*
|
|
97
|
+
* Only used for `classic` {@link runtime}.
|
|
98
|
+
*
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
27
101
|
useBuiltIns?: boolean
|
|
102
|
+
/**
|
|
103
|
+
* When spreading props, use inline object with spread elements directly
|
|
104
|
+
* instead of an extend helper or Object.assign.
|
|
105
|
+
*
|
|
106
|
+
* Only used for `classic` {@link runtime}.
|
|
107
|
+
*
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
28
110
|
useSpread?: boolean
|
|
29
111
|
}
|
|
30
112
|
|
|
31
|
-
export interface
|
|
113
|
+
export interface SourceMap {
|
|
32
114
|
file?: string
|
|
33
115
|
mappings?: string
|
|
34
116
|
sourceRoot?: string
|
|
@@ -37,28 +119,93 @@ export interface Sourcemap {
|
|
|
37
119
|
names?: Array<string>
|
|
38
120
|
}
|
|
39
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
124
|
+
*
|
|
125
|
+
* @param filename The name of the file being transformed. If this is a
|
|
126
|
+
* relative path, consider setting the {@link TransformOptions#cwd} option..
|
|
127
|
+
* @param sourceText the source code itself
|
|
128
|
+
* @param options The options for the transformation. See {@link
|
|
129
|
+
* TransformOptions} for more information.
|
|
130
|
+
*
|
|
131
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
132
|
+
* errors that occurred during parsing or transformation.
|
|
133
|
+
*/
|
|
40
134
|
export declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
|
|
41
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Options for transforming a JavaScript or TypeScript file.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link transform}
|
|
140
|
+
*/
|
|
42
141
|
export interface TransformOptions {
|
|
43
142
|
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
44
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* The current working directory. Used to resolve relative paths in other
|
|
145
|
+
* options.
|
|
146
|
+
*/
|
|
147
|
+
cwd?: string
|
|
148
|
+
/**
|
|
149
|
+
* Force jsx parsing,
|
|
150
|
+
*
|
|
151
|
+
* @default false
|
|
152
|
+
*/
|
|
45
153
|
jsx?: boolean
|
|
154
|
+
/** Configure how TypeScript is transformed. */
|
|
46
155
|
typescript?: TypeScriptBindingOptions
|
|
156
|
+
/** Configure how TSX and JSX are transformed. */
|
|
47
157
|
react?: ReactBindingOptions
|
|
158
|
+
/** Enable ES2015 transformations. */
|
|
48
159
|
es2015?: Es2015BindingOptions
|
|
49
160
|
/**
|
|
50
|
-
* Enable
|
|
161
|
+
* Enable source map generation.
|
|
162
|
+
*
|
|
163
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
51
164
|
*
|
|
52
|
-
*
|
|
165
|
+
* @default false
|
|
53
166
|
*
|
|
54
|
-
*
|
|
167
|
+
* @see {@link SourceMap}
|
|
55
168
|
*/
|
|
56
169
|
sourcemap?: boolean
|
|
57
170
|
}
|
|
58
171
|
|
|
59
172
|
export interface TransformResult {
|
|
173
|
+
/**
|
|
174
|
+
* The transformed code.
|
|
175
|
+
*
|
|
176
|
+
* If parsing failed, this will be an empty string.
|
|
177
|
+
*/
|
|
60
178
|
sourceText: string
|
|
61
|
-
|
|
179
|
+
/**
|
|
180
|
+
* The source map for the transformed code.
|
|
181
|
+
*
|
|
182
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
183
|
+
*/
|
|
184
|
+
sourceMap?: SourceMap
|
|
185
|
+
/**
|
|
186
|
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
187
|
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
188
|
+
* is provided.
|
|
189
|
+
*
|
|
190
|
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
191
|
+
*
|
|
192
|
+
* @see {@link TypeScriptBindingOptions#declaration}
|
|
193
|
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
194
|
+
*/
|
|
195
|
+
declaration?: string
|
|
196
|
+
/**
|
|
197
|
+
* Declaration source map. Only generated if both
|
|
198
|
+
* {@link TypeScriptBindingOptions#declaration declaration} and
|
|
199
|
+
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
200
|
+
*/
|
|
201
|
+
declarationMap?: SourceMap
|
|
202
|
+
/**
|
|
203
|
+
* Parse and transformation errors.
|
|
204
|
+
*
|
|
205
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
206
|
+
* transformed code may still be available even if there are errors in this
|
|
207
|
+
* list.
|
|
208
|
+
*/
|
|
62
209
|
errors: Array<string>
|
|
63
210
|
}
|
|
64
211
|
|
|
@@ -68,5 +215,15 @@ export interface TypeScriptBindingOptions {
|
|
|
68
215
|
onlyRemoveTypeImports?: boolean
|
|
69
216
|
allowNamespaces?: boolean
|
|
70
217
|
allowDeclareFields?: boolean
|
|
218
|
+
/**
|
|
219
|
+
* Also generate a `.d.ts` declaration file for TypeScript files.
|
|
220
|
+
*
|
|
221
|
+
* The source file must be compliant with all
|
|
222
|
+
* [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
|
223
|
+
* requirements.
|
|
224
|
+
*
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
declaration?: boolean
|
|
71
228
|
}
|
|
72
229
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-transform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.2",
|
|
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.
|
|
27
|
-
"@oxc-transform/binding-win32-arm64-msvc": "0.
|
|
28
|
-
"@oxc-transform/binding-linux-x64-gnu": "0.
|
|
29
|
-
"@oxc-transform/binding-linux-arm64-gnu": "0.
|
|
30
|
-
"@oxc-transform/binding-linux-x64-musl": "0.
|
|
31
|
-
"@oxc-transform/binding-linux-arm64-musl": "0.
|
|
32
|
-
"@oxc-transform/binding-darwin-x64": "0.
|
|
33
|
-
"@oxc-transform/binding-darwin-arm64": "0.
|
|
26
|
+
"@oxc-transform/binding-win32-x64-msvc": "0.24.2",
|
|
27
|
+
"@oxc-transform/binding-win32-arm64-msvc": "0.24.2",
|
|
28
|
+
"@oxc-transform/binding-linux-x64-gnu": "0.24.2",
|
|
29
|
+
"@oxc-transform/binding-linux-arm64-gnu": "0.24.2",
|
|
30
|
+
"@oxc-transform/binding-linux-x64-musl": "0.24.2",
|
|
31
|
+
"@oxc-transform/binding-linux-arm64-musl": "0.24.2",
|
|
32
|
+
"@oxc-transform/binding-darwin-x64": "0.24.2",
|
|
33
|
+
"@oxc-transform/binding-darwin-arm64": "0.24.2"
|
|
34
34
|
}
|
|
35
35
|
}
|