mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
chore(transformer): update examples to use the targets API
This commit is contained in:
parent
4c0861f694
commit
8d565d5b23
1 changed files with 6 additions and 15 deletions
|
|
@ -6,10 +6,7 @@ use oxc_codegen::CodeGenerator;
|
|||
use oxc_parser::Parser;
|
||||
use oxc_semantic::SemanticBuilder;
|
||||
use oxc_span::SourceType;
|
||||
use oxc_transformer::{
|
||||
ArrowFunctionsOptions, ES2015Options, ReactOptions, TransformOptions, Transformer,
|
||||
TypeScriptOptions,
|
||||
};
|
||||
use oxc_transformer::{EnvOptions, Targets, TransformOptions, Transformer};
|
||||
|
||||
// Instruction:
|
||||
// create a `test.tsx`,
|
||||
|
|
@ -37,17 +34,11 @@ fn main() {
|
|||
println!("{source_text}\n");
|
||||
|
||||
let mut program = ret.program;
|
||||
let transform_options = TransformOptions {
|
||||
typescript: TypeScriptOptions::default(),
|
||||
es2015: ES2015Options { arrow_function: Some(ArrowFunctionsOptions::default()) },
|
||||
react: ReactOptions {
|
||||
jsx_plugin: true,
|
||||
jsx_self_plugin: true,
|
||||
jsx_source_plugin: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
let transform_options = TransformOptions::from_preset_env(&EnvOptions {
|
||||
targets: Targets::from_query("chrome 51"),
|
||||
..EnvOptions::default()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let (symbols, scopes) = SemanticBuilder::new(&source_text, source_type)
|
||||
.build(&program)
|
||||
|
|
|
|||
Loading…
Reference in a new issue