oxc 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -0
  3. data/README.md +437 -0
  4. data/ext/oxc/extconf.rb +123 -0
  5. data/ext/oxc/include/oxc.h +40 -0
  6. data/ext/oxc/oxc.c +136 -0
  7. data/lib/oxc/backend.rb +41 -0
  8. data/lib/oxc/diagnosed.rb +33 -0
  9. data/lib/oxc/diagnostic.rb +86 -0
  10. data/lib/oxc/errors.rb +26 -0
  11. data/lib/oxc/minifier.rb +31 -0
  12. data/lib/oxc/minify_result.rb +25 -0
  13. data/lib/oxc/options.rb +113 -0
  14. data/lib/oxc/parse_result.rb +106 -0
  15. data/lib/oxc/result.rb +51 -0
  16. data/lib/oxc/transform_result.rb +47 -0
  17. data/lib/oxc/transformer.rb +31 -0
  18. data/lib/oxc/version.rb +1 -1
  19. data/lib/oxc.rb +46 -0
  20. data/licenses/README.md +12 -0
  21. data/licenses/oxc-MIT.txt +22 -0
  22. data/licenses/oxc-THIRD-PARTY.txt +763 -0
  23. data/oxc.gemspec +14 -2
  24. data/rust/Cargo.lock +1436 -0
  25. data/rust/Cargo.toml +32 -0
  26. data/rust/build.rs +52 -0
  27. data/rust/cbindgen.toml +24 -0
  28. data/rust/rustfmt.toml +3 -0
  29. data/rust/src/diagnostic.rs +75 -0
  30. data/rust/src/lib.rs +288 -0
  31. data/rust/src/module_record.rs +262 -0
  32. data/rust/src/options.rs +744 -0
  33. data/rust/src/parse.rs +93 -0
  34. data/rust/src/result.rs +55 -0
  35. data/rust/src/source_type.rs +26 -0
  36. data/rust/src/symbols.rs +101 -0
  37. data/rust/src/transform.rs +116 -0
  38. data/sig/oxc/backend.rbs +29 -0
  39. data/sig/oxc/diagnosed.rbs +23 -0
  40. data/sig/oxc/diagnostic.rbs +57 -0
  41. data/sig/oxc/errors.rbs +31 -0
  42. data/sig/oxc/minifier.rbs +21 -0
  43. data/sig/oxc/minify_result.rbs +11 -0
  44. data/sig/oxc/options.rbs +42 -0
  45. data/sig/oxc/parse_result.rbs +61 -0
  46. data/sig/oxc/result.rbs +32 -0
  47. data/sig/oxc/transform_result.rbs +22 -0
  48. data/sig/oxc/transformer.rbs +21 -0
  49. data/sig/oxc/types.rbs +96 -0
  50. data/sig/oxc/version.rbs +5 -0
  51. data/sig/oxc.rbs +13 -2
  52. metadata +50 -2
@@ -0,0 +1,32 @@
1
+ # Generated from lib/oxc/result.rb with RBS::Inline
2
+
3
+ module Oxc
4
+ class Result
5
+ include Diagnosed
6
+
7
+ attr_reader code: String
8
+
9
+ attr_reader map: String?
10
+
11
+ attr_reader legal_comments: Array[String]
12
+
13
+ attr_reader diagnostics: Array[Oxc::Diagnostic]
14
+
15
+ # : (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?legal_comments: Array[String], ?panicked: bool) -> void
16
+ def initialize: (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?legal_comments: Array[String], ?panicked: bool) -> void
17
+
18
+ # : (?strict: untyped) -> self
19
+ def validate!: (?strict: untyped) -> self
20
+
21
+ # : () -> String
22
+ def to_s: () -> String
23
+
24
+ # : () -> String
25
+ def inspect: () -> String
26
+
27
+ private
28
+
29
+ # : () -> Array[String]
30
+ def parts: () -> Array[String]
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # Generated from lib/oxc/transform_result.rb with RBS::Inline
2
+
3
+ module Oxc
4
+ class TransformResult < Result
5
+ attr_reader declaration: String?
6
+
7
+ attr_reader declaration_map: String?
8
+
9
+ attr_reader helpers_used: Hash[String, String]
10
+
11
+ # : (String) -> Oxc::TransformResult
12
+ def self.from_json: (String) -> Oxc::TransformResult
13
+
14
+ # : (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?declaration: String?, ?declaration_map: String?, ?legal_comments: Array[String], ?helpers_used: Hash[String, String], ?panicked: bool) -> void
15
+ def initialize: (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?declaration: String?, ?declaration_map: String?, ?legal_comments: Array[String], ?helpers_used: Hash[String, String], ?panicked: bool) -> void
16
+
17
+ private
18
+
19
+ # : () -> Array[String]
20
+ def parts: () -> Array[String]
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ # Generated from lib/oxc/transformer.rb with RBS::Inline
2
+
3
+ module Oxc
4
+ class Transformer
5
+ attr_reader options: Hash[Symbol, untyped]
6
+
7
+ # : (?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
8
+ def initialize: (?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
9
+
10
+ # : (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
11
+ def transform: (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
12
+
13
+ alias call transform
14
+
15
+ # : (?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
16
+ def with: (?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
17
+
18
+ # : () -> String
19
+ def inspect: () -> String
20
+ end
21
+ end
data/sig/oxc/types.rbs ADDED
@@ -0,0 +1,96 @@
1
+ # Note: This file is hand written, `rbs-inline` does not generate this file.
2
+
3
+ module Oxc
4
+ interface _Diagnosed
5
+ def diagnostics: () -> Array[Oxc::Diagnostic]
6
+ end
7
+
8
+ type targets = String | Symbol | Array[String | Symbol]
9
+
10
+ type keep_names = { ?function: bool, ?class: bool }
11
+
12
+ type compress = bool | {
13
+ ?target: targets,
14
+ ?drop_console: bool,
15
+ ?drop_debugger: bool,
16
+ ?unused: bool | String | Symbol,
17
+ ?keep_names: keep_names,
18
+ ?join_vars: bool,
19
+ ?sequences: bool,
20
+ ?drop_labels: Array[String],
21
+ ?max_iterations: Integer,
22
+ ?treeshake: treeshake
23
+ }
24
+
25
+ type treeshake = {
26
+ ?annotations: bool,
27
+ ?manual_pure_functions: Array[String],
28
+ ?property_read_side_effects: bool,
29
+ ?property_write_side_effects: bool,
30
+ ?unknown_global_side_effects: bool,
31
+ ?invalid_import_side_effects: bool
32
+ }
33
+
34
+ type mangle = bool | {
35
+ ?top_level: bool,
36
+ ?keep_names: bool | keep_names,
37
+ ?reserved: Array[String],
38
+ ?debug: bool
39
+ }
40
+
41
+ type codegen = bool | {
42
+ ?remove_whitespace: bool,
43
+ ?legal_comments: String | Symbol | { linked: String }
44
+ }
45
+
46
+ type minify = bool | {
47
+ ?filename: String,
48
+ ?lang: String | Symbol,
49
+ ?source_type: String | Symbol,
50
+ ?compress: compress,
51
+ ?mangle: mangle,
52
+ ?codegen: codegen,
53
+ ?sourcemap: bool
54
+ }
55
+
56
+ type jsx = bool | {
57
+ ?runtime: String | Symbol,
58
+ ?development: bool,
59
+ ?throw_if_namespace: bool,
60
+ ?pure: bool,
61
+ ?import_source: String,
62
+ ?pragma: String,
63
+ ?pragma_frag: String
64
+ }
65
+
66
+ type typescript = {
67
+ ?jsx_pragma: String,
68
+ ?jsx_pragma_frag: String,
69
+ ?only_remove_type_imports: bool,
70
+ ?allow_namespaces: bool,
71
+ ?allow_declare_fields: bool,
72
+ ?optimize_const_enums: bool,
73
+ ?optimize_enums: bool,
74
+ ?remove_class_fields_without_initializer: bool,
75
+ ?rewrite_import_extensions: String | Symbol,
76
+ ?declaration: bool | { ?strip_internal: bool }
77
+ }
78
+
79
+ type assumptions = {
80
+ ?ignore_function_length: bool,
81
+ ?no_document_all: bool,
82
+ ?object_rest_no_symbols: bool,
83
+ ?pure_getters: bool,
84
+ ?set_public_class_fields: bool
85
+ }
86
+
87
+ type decorator = {
88
+ ?legacy: bool,
89
+ ?emit_decorator_metadata: bool,
90
+ ?strict_null_checks: bool
91
+ }
92
+
93
+ type helpers = { ?mode: String | Symbol }
94
+
95
+ type inject = Hash[String, String | Array[String]]
96
+ end
@@ -0,0 +1,5 @@
1
+ # Generated from lib/oxc/version.rb with RBS::Inline
2
+
3
+ module Oxc
4
+ VERSION: ::String
5
+ end
data/sig/oxc.rbs CHANGED
@@ -1,4 +1,15 @@
1
+ # Generated from lib/oxc.rb with RBS::Inline
2
+
1
3
  module Oxc
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ # : (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?compress: compress?, ?mangle: mangle?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::MinifyResult
5
+ def self.minify: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?compress: compress?, ?mangle: mangle?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::MinifyResult
6
+
7
+ # : (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
8
+ def self.transform: (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
9
+
10
+ # : (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
11
+ def self.parse: (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
12
+
13
+ # : () -> String
14
+ def self.oxc_version: () -> String
4
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
@@ -14,16 +14,64 @@ description: Ruby bindings for Oxc, the JavaScript Oxidation Compiler. A collect
14
14
  email:
15
15
  - marco.roth@intergga.ch
16
16
  executables: []
17
- extensions: []
17
+ extensions:
18
+ - ext/oxc/extconf.rb
18
19
  extra_rdoc_files: []
19
20
  files:
21
+ - LICENSE.txt
22
+ - README.md
23
+ - ext/oxc/extconf.rb
24
+ - ext/oxc/include/oxc.h
25
+ - ext/oxc/oxc.c
20
26
  - lib/oxc.rb
27
+ - lib/oxc/backend.rb
28
+ - lib/oxc/diagnosed.rb
29
+ - lib/oxc/diagnostic.rb
30
+ - lib/oxc/errors.rb
31
+ - lib/oxc/minifier.rb
32
+ - lib/oxc/minify_result.rb
33
+ - lib/oxc/options.rb
34
+ - lib/oxc/parse_result.rb
35
+ - lib/oxc/result.rb
36
+ - lib/oxc/transform_result.rb
37
+ - lib/oxc/transformer.rb
21
38
  - lib/oxc/version.rb
39
+ - licenses/README.md
40
+ - licenses/oxc-MIT.txt
41
+ - licenses/oxc-THIRD-PARTY.txt
22
42
  - oxc.gemspec
43
+ - rust/Cargo.lock
44
+ - rust/Cargo.toml
45
+ - rust/build.rs
46
+ - rust/cbindgen.toml
47
+ - rust/rustfmt.toml
48
+ - rust/src/diagnostic.rs
49
+ - rust/src/lib.rs
50
+ - rust/src/module_record.rs
51
+ - rust/src/options.rs
52
+ - rust/src/parse.rs
53
+ - rust/src/result.rs
54
+ - rust/src/source_type.rs
55
+ - rust/src/symbols.rs
56
+ - rust/src/transform.rs
23
57
  - sig/oxc.rbs
58
+ - sig/oxc/backend.rbs
59
+ - sig/oxc/diagnosed.rbs
60
+ - sig/oxc/diagnostic.rbs
61
+ - sig/oxc/errors.rbs
62
+ - sig/oxc/minifier.rbs
63
+ - sig/oxc/minify_result.rbs
64
+ - sig/oxc/options.rbs
65
+ - sig/oxc/parse_result.rbs
66
+ - sig/oxc/result.rbs
67
+ - sig/oxc/transform_result.rbs
68
+ - sig/oxc/transformer.rbs
69
+ - sig/oxc/types.rbs
70
+ - sig/oxc/version.rbs
24
71
  homepage: https://github.com/marcoroth/oxc-ruby
25
72
  licenses:
26
73
  - MIT
74
+ - Apache-2.0
27
75
  metadata:
28
76
  homepage_uri: https://github.com/marcoroth/oxc-ruby
29
77
  source_code_uri: https://github.com/marcoroth/oxc-ruby