Class: React::JSX::BabelTransformer
- Inherits:
-
Object
- Object
- React::JSX::BabelTransformer
- Defined in:
- lib/react/jsx/babel_transformer.rb
Constant Summary collapse
- DEPRECATED_OPTIONS =
[:harmony, :strip_types, :asset_path]
- DEFAULT_TRANSFORM_OPTIONS =
{ blacklist: ['spec.functionName', 'validation.react', 'strict'] }
Instance Method Summary collapse
-
#initialize(options) ⇒ BabelTransformer
constructor
A new instance of BabelTransformer.
- #transform(code) ⇒ Object
Constructor Details
#initialize(options) ⇒ BabelTransformer
Returns a new instance of BabelTransformer.
7 8 9 10 11 12 13 14 |
# File 'lib/react/jsx/babel_transformer.rb', line 7 def initialize() if (.keys & DEPRECATED_OPTIONS).any? ActiveSupport::Deprecation.warn("Setting config.react.jsx_transform_options for :harmony, :strip_types, and :asset_path keys is now deprecated and has no effect with the default Babel Transformer."+ "Please use new Babel Transformer options :whitelist, :plugin instead.") end @transform_options = DEFAULT_TRANSFORM_OPTIONS.merge() end |
Instance Method Details
#transform(code) ⇒ Object
16 17 18 |
# File 'lib/react/jsx/babel_transformer.rb', line 16 def transform(code) Babel::Transpiler.transform(code, @transform_options)['code'] end |