oxc-transform 0.39.0 → 0.40.1

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.
Files changed (3) hide show
  1. package/index.d.ts +63 -2
  2. package/index.js +2 -0
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -20,11 +20,45 @@ export interface CompilerAssumptions {
20
20
  setPublicClassFields?: boolean
21
21
  }
22
22
 
23
+ export interface ErrorLabel {
24
+ message?: string
25
+ start: number
26
+ end: number
27
+ }
28
+
23
29
  export interface Es2015Options {
24
30
  /** Transform arrow functions into function expressions. */
25
31
  arrowFunction?: ArrowFunctionsOptions
26
32
  }
27
33
 
34
+ export declare const enum HelperMode {
35
+ /**
36
+ * Runtime mode (default): Helper functions are imported from a runtime package.
37
+ *
38
+ * Example:
39
+ *
40
+ * ```js
41
+ * import helperName from "@babel/runtime/helpers/helperName";
42
+ * helperName(...arguments);
43
+ * ```
44
+ */
45
+ Runtime = 'Runtime',
46
+ /**
47
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
48
+ *
49
+ * Example:
50
+ *
51
+ * ```js
52
+ * babelHelpers.helperName(...arguments);
53
+ * ```
54
+ */
55
+ External = 'External'
56
+ }
57
+
58
+ export interface Helpers {
59
+ mode?: HelperMode
60
+ }
61
+
28
62
  /** TypeScript Isolated Declarations for Standalone DTS Emit */
29
63
  export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
30
64
 
@@ -44,7 +78,7 @@ export interface IsolatedDeclarationsOptions {
44
78
  export interface IsolatedDeclarationsResult {
45
79
  code: string
46
80
  map?: SourceMap
47
- errors: Array<string>
81
+ errors: Array<OxcError>
48
82
  }
49
83
 
50
84
  /**
@@ -142,6 +176,13 @@ export interface JsxOptions {
142
176
  refresh?: boolean | ReactRefreshOptions
143
177
  }
144
178
 
179
+ export interface OxcError {
180
+ severity: Severity
181
+ message: string
182
+ labels: Array<ErrorLabel>
183
+ helpMessage?: string
184
+ }
185
+
145
186
  export interface ReactRefreshOptions {
146
187
  /**
147
188
  * Specify the identifier of the refresh registration variable.
@@ -158,6 +199,12 @@ export interface ReactRefreshOptions {
158
199
  emitFullSignatures?: boolean
159
200
  }
160
201
 
202
+ export declare const enum Severity {
203
+ Error = 'Error',
204
+ Warning = 'Warning',
205
+ Advice = 'Advice'
206
+ }
207
+
161
208
  export interface SourceMap {
162
209
  file?: string
163
210
  mappings: string
@@ -228,6 +275,8 @@ export interface TransformOptions {
228
275
  * @see [esbuild#target](https://esbuild.github.io/api/#target)
229
276
  */
230
277
  target?: string | Array<string>
278
+ /** Behaviour for runtime helpers. */
279
+ helpers?: Helpers
231
280
  /** Define Plugin */
232
281
  define?: Record<string, string>
233
282
  /** Inject Plugin */
@@ -264,6 +313,18 @@ export interface TransformResult {
264
313
  * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
265
314
  */
266
315
  declarationMap?: SourceMap
316
+ /**
317
+ * Helpers used.
318
+ *
319
+ * @internal
320
+ *
321
+ * Example:
322
+ *
323
+ * ```text
324
+ * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
325
+ * ```
326
+ */
327
+ helpersUsed: Record<string, string>
267
328
  /**
268
329
  * Parse and transformation errors.
269
330
  *
@@ -271,7 +332,7 @@ export interface TransformResult {
271
332
  * transformed code may still be available even if there are errors in this
272
333
  * list.
273
334
  */
274
- errors: Array<string>
335
+ errors: Array<OxcError>
275
336
  }
276
337
 
277
338
  export interface TypeScriptOptions {
package/index.js CHANGED
@@ -361,5 +361,7 @@ if (!nativeBinding) {
361
361
  throw new Error(`Failed to load native binding`)
362
362
  }
363
363
 
364
+ module.exports.HelperMode = nativeBinding.HelperMode
364
365
  module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration
366
+ module.exports.Severity = nativeBinding.Severity
365
367
  module.exports.transform = nativeBinding.transform
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-transform",
3
- "version": "0.39.0",
3
+ "version": "0.40.1",
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.39.0",
27
- "@oxc-transform/binding-win32-arm64-msvc": "0.39.0",
28
- "@oxc-transform/binding-linux-x64-gnu": "0.39.0",
29
- "@oxc-transform/binding-linux-arm64-gnu": "0.39.0",
30
- "@oxc-transform/binding-linux-x64-musl": "0.39.0",
31
- "@oxc-transform/binding-linux-arm64-musl": "0.39.0",
32
- "@oxc-transform/binding-darwin-x64": "0.39.0",
33
- "@oxc-transform/binding-darwin-arm64": "0.39.0"
26
+ "@oxc-transform/binding-win32-x64-msvc": "0.40.1",
27
+ "@oxc-transform/binding-win32-arm64-msvc": "0.40.1",
28
+ "@oxc-transform/binding-linux-x64-gnu": "0.40.1",
29
+ "@oxc-transform/binding-linux-arm64-gnu": "0.40.1",
30
+ "@oxc-transform/binding-linux-x64-musl": "0.40.1",
31
+ "@oxc-transform/binding-linux-arm64-musl": "0.40.1",
32
+ "@oxc-transform/binding-darwin-x64": "0.40.1",
33
+ "@oxc-transform/binding-darwin-arm64": "0.40.1"
34
34
  }
35
35
  }