Module: Oxc
- Defined in:
- lib/oxc.rb,
lib/oxc/node.rb,
lib/oxc/errors.rb,
lib/oxc/result.rb,
lib/oxc/backend.rb,
lib/oxc/options.rb,
lib/oxc/version.rb,
lib/oxc/visitor.rb,
lib/oxc/minifier.rb,
lib/oxc/diagnosed.rb,
lib/oxc/diagnostic.rb,
lib/oxc/transformer.rb,
lib/oxc/parse_result.rb,
lib/oxc/minify_result.rb,
lib/oxc/mutation_visitor.rb,
lib/oxc/transform_result.rb,
sig/oxc.rbs,
sig/oxc/node.rbs,
sig/oxc/types.rbs,
sig/oxc/errors.rbs,
sig/oxc/result.rbs,
sig/oxc/backend.rbs,
sig/oxc/options.rbs,
sig/oxc/version.rbs,
sig/oxc/visitor.rbs,
sig/oxc/minifier.rbs,
sig/oxc/diagnosed.rbs,
sig/oxc/diagnostic.rbs,
sig/oxc/transformer.rbs,
sig/oxc/parse_result.rbs,
sig/oxc/minify_result.rbs,
sig/oxc/mutation_visitor.rbs,
sig/oxc/transform_result.rbs,
ext/oxc/oxc.c
Defined Under Namespace
Modules: Backend, Diagnosed, _Diagnosed Classes: Comment, Diagnostic, EncodingError, Error, InternalError, Label, Minifier, MinifyResult, MutationVisitor, Node, OptionError, Options, PanicError, ParseResult, Result, SyntaxError, TransformError, TransformResult, Transformer, Visitor
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.minify(source, **options) ⇒ Oxc::MinifyResult
: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?compress: compress?, ?mangle: mangle?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::MinifyResult.
-
.oxc_version ⇒ String
: () -> String.
-
.parse(source, **options) ⇒ Oxc::ParseResult
: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?ast_type: String?, ?ast: bool, ?ranges: bool, ?preserve_parens: bool, ?comments: bool, ?module_record: bool, ?symbols: bool, ?semantic_errors: bool) -> Oxc::ParseResult.
-
.transform(source, **options) ⇒ Oxc::TransformResult
: (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.
Class Method Details
.minify(source, **options) ⇒ Oxc::MinifyResult
: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?compress: compress?, ?mangle: mangle?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::MinifyResult
31 32 33 34 35 |
# File 'lib/oxc.rb', line 31 def self.minify(source, **) serialized = Options.serialize(, Options::MINIFY, "minify") MinifyResult.from_json(Backend.minify(source.to_s, serialized)).validate!(strict: [:strict] ? true : false) end |
.oxc_version ⇒ String
: () -> String
52 53 54 |
# File 'lib/oxc.rb', line 52 def self.oxc_version Backend.oxc_version end |
.parse(source, **options) ⇒ Oxc::ParseResult
: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?ast_type: String?, ?ast: bool, ?ranges: bool, ?preserve_parens: bool, ?comments: bool, ?module_record: bool, ?symbols: bool, ?semantic_errors: bool) -> Oxc::ParseResult
45 46 47 48 49 |
# File 'lib/oxc.rb', line 45 def self.parse(source, **) serialized = Options.serialize(, Options::PARSE, "parse") ParseResult.from_json(Backend.parse(source.to_s, serialized), source.to_s) end |
.transform(source, **options) ⇒ Oxc::TransformResult
: (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
38 39 40 41 42 |
# File 'lib/oxc.rb', line 38 def self.transform(source, **) serialized = Options.serialize(, Options::TRANSFORM, "transform") TransformResult.from_json(Backend.transform(source.to_s, serialized)).validate!(strict: [:strict] ? true : false) end |