Class: Oxc::Transformer

Inherits:
Object
  • Object
show all
Defined in:
lib/oxc/transformer.rb,
sig/oxc/transformer.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Transformer

: (?filename: String?, ?lang: String?, ?source_type: String?, ?cwd: String?, ?target: targets?, ?jsx: jsx?, ?typescript: typescript?, ?assumptions: assumptions?, ?decorator: decorator?, ?helpers: helpers?, ?define: Hash[String, String]?, ?inject: inject?, ?minify: minify?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> void

Parameters:

  • filename: (String, nil)
  • lang: (String, nil)
  • source_type: (String, nil)
  • cwd: (String, nil)
  • target: (targets, nil)
  • jsx: (jsx, nil)
  • typescript: (typescript, nil)
  • assumptions: (assumptions, nil)
  • decorator: (decorator, nil)
  • helpers: (helpers, nil)
  • define: (Hash[String, String], nil)
  • inject: (inject, nil)
  • minify: (minify, nil)
  • codegen: (codegen, nil)
  • sourcemap: (Boolean)
  • strict: (Boolean)


8
9
10
11
12
# File 'lib/oxc/transformer.rb', line 8

def initialize(**options)
  @options = options.transform_keys(&:to_sym).freeze

  freeze
end

Instance Attribute Details

#optionsHash[Symbol, untyped] (readonly)

Signature:

  • Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


5
6
7
# File 'lib/oxc/transformer.rb', line 5

def options
  @options
end

Instance Method Details

#inspectString

: () -> String

Returns:

  • (String)


27
28
29
# File 'lib/oxc/transformer.rb', line 27

def inspect
  "#<#{self.class.name} #{options.inspect}>"
end

#transform(source, **overrides) ⇒ Oxc::TransformResult Also known as: call

: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?cwd: String?, ?target: targets?, ?jsx: jsx?, ?typescript: typescript?, ?assumptions: assumptions?, ?decorator: decorator?, ?helpers: helpers?, ?define: Hash[String, String]?, ?inject: inject?, ?minify: minify?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::TransformResult

Parameters:

  • (String)
  • filename: (String, nil)
  • lang: (String, nil)
  • source_type: (String, nil)
  • cwd: (String, nil)
  • target: (targets, nil)
  • jsx: (jsx, nil)
  • typescript: (typescript, nil)
  • assumptions: (assumptions, nil)
  • decorator: (decorator, nil)
  • helpers: (helpers, nil)
  • define: (Hash[String, String], nil)
  • inject: (inject, nil)
  • minify: (minify, nil)
  • codegen: (codegen, nil)
  • sourcemap: (Boolean)
  • strict: (Boolean)

Returns:



15
16
17
# File 'lib/oxc/transformer.rb', line 15

def transform(source, **overrides)
  Oxc.transform(source, **options, **overrides)
end

#with(**overrides) ⇒ Oxc::Transformer

: (?filename: String?, ?lang: String?, ?source_type: String?, ?cwd: String?, ?target: targets?, ?jsx: jsx?, ?typescript: typescript?, ?assumptions: assumptions?, ?decorator: decorator?, ?helpers: helpers?, ?define: Hash[String, String]?, ?inject: inject?, ?minify: minify?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::Transformer

Parameters:

  • filename: (String, nil)
  • lang: (String, nil)
  • source_type: (String, nil)
  • cwd: (String, nil)
  • target: (targets, nil)
  • jsx: (jsx, nil)
  • typescript: (typescript, nil)
  • assumptions: (assumptions, nil)
  • decorator: (decorator, nil)
  • helpers: (helpers, nil)
  • define: (Hash[String, String], nil)
  • inject: (inject, nil)
  • minify: (minify, nil)
  • codegen: (codegen, nil)
  • sourcemap: (Boolean)
  • strict: (Boolean)

Returns:



22
23
24
# File 'lib/oxc/transformer.rb', line 22

def with(**overrides)
  self.class.new(**options, **overrides)
end