Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions napi/transform/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface ArrowFunctionsBindingOptions {
export interface ArrowFunctionsOptions {
/**
* This option enables the following:
* * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
Expand All @@ -12,9 +12,9 @@ export interface ArrowFunctionsBindingOptions {
spec?: boolean
}

export interface Es2015BindingOptions {
export interface Es2015Options {
/** Transform arrow functions into function expressions. */
arrowFunction?: ArrowFunctionsBindingOptions
arrowFunction?: ArrowFunctionsOptions
}

/** TypeScript Isolated Declarations for Standalone DTS Emit */
Expand Down Expand Up @@ -202,7 +202,7 @@ export interface TransformOptions {
/** Configure how TSX and JSX are transformed. */
jsx?: JsxOptions
/** Enable ES2015 transformations. */
es2015?: ES2015BindingOptions
es2015?: Es2015Options
/** Define Plugin */
define?: Record<string, string>
/** Inject Plugin */
Expand Down
22 changes: 11 additions & 11 deletions napi/transform/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use napi::Either;
use napi_derive::napi;
use rustc_hash::FxHashMap;

use oxc_transformer::{ArrowFunctionsOptions, ES2015Options, JsxRuntime, RewriteExtensionsMode};
use oxc_transformer::{JsxRuntime, RewriteExtensionsMode};

use crate::IsolatedDeclarationsOptions;

Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct TransformOptions {
pub jsx: Option<JsxOptions>,

/// Enable ES2015 transformations.
pub es2015: Option<ES2015BindingOptions>,
pub es2015: Option<Es2015Options>,

/// Define Plugin
#[napi(ts_type = "Record<string, string>")]
Expand Down Expand Up @@ -258,7 +258,7 @@ impl From<ReactRefreshOptions> for oxc_transformer::ReactRefreshOptions {
}

#[napi(object)]
pub struct ArrowFunctionsBindingOptions {
pub struct ArrowFunctionsOptions {
/// This option enables the following:
/// * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
/// * Add a runtime check to ensure the functions are not instantiated.
Expand All @@ -268,20 +268,20 @@ pub struct ArrowFunctionsBindingOptions {
pub spec: Option<bool>,
}

impl From<ArrowFunctionsBindingOptions> for ArrowFunctionsOptions {
fn from(options: ArrowFunctionsBindingOptions) -> Self {
ArrowFunctionsOptions { spec: options.spec.unwrap_or_default() }
impl From<ArrowFunctionsOptions> for oxc_transformer::ArrowFunctionsOptions {
fn from(options: ArrowFunctionsOptions) -> Self {
oxc_transformer::ArrowFunctionsOptions { spec: options.spec.unwrap_or_default() }
}
}

#[napi(object)]
pub struct ES2015BindingOptions {
pub struct Es2015Options {
/// Transform arrow functions into function expressions.
pub arrow_function: Option<ArrowFunctionsBindingOptions>,
pub arrow_function: Option<ArrowFunctionsOptions>,
}

impl From<ES2015BindingOptions> for ES2015Options {
fn from(options: ES2015BindingOptions) -> Self {
ES2015Options { arrow_function: options.arrow_function.map(Into::into) }
impl From<Es2015Options> for oxc_transformer::ES2015Options {
fn from(options: Es2015Options) -> Self {
oxc_transformer::ES2015Options { arrow_function: options.arrow_function.map(Into::into) }
}
}
4 changes: 2 additions & 2 deletions napi/transform/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ pub struct TransformResult {
///
/// If parsing failed and `declaration` is set, this will be an empty string.
///
/// @see {@link TypeScriptBindingOptions#declaration}
/// @see {@link TypeScriptOptions#declaration}
/// @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
pub declaration: Option<String>,

/// Declaration source map. Only generated if both
/// {@link TypeScriptBindingOptions#declaration declaration} and
/// {@link TypeScriptOptions#declaration declaration} and
/// {@link TransformOptions#sourcemap sourcemap} are set to `true`.
pub declaration_map: Option<SourceMap>,

Expand Down