diff --git a/Gemfile.lock b/Gemfile.lock index 85d6a84..97d03a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - oxc (0.151.0) + oxc (0.152.0) GEM remote: https://rubygems.org/ @@ -170,7 +170,7 @@ CHECKSUMS logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 maxitest (7.1.1) sha256=f504c01714f83d8e4483be8cb1a6b02faa7e08a135202c0516c1e55fd11cd78d minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1 - oxc (0.151.0) + oxc (0.152.0) parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356 parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828 pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570 diff --git a/lib/oxc/version.rb b/lib/oxc/version.rb index d534182..09f6956 100644 --- a/lib/oxc/version.rb +++ b/lib/oxc/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Oxc - VERSION = "0.151.0" + VERSION = "0.152.0" end diff --git a/rust/Cargo.lock b/rust/Cargo.lock index ea02ea0..bf2fb8b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -472,9 +472,9 @@ checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" [[package]] name = "oxc" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c1a35009a2f553b1f482c6f9f32aac8af4773abb0cbcb3378af689b90e23ae" +checksum = "68d39d0db78a448fbb36d4fd4e3482bf42473107ba3e029c8cbed6c58623e723" dependencies = [ "oxc_allocator", "oxc_ast", @@ -515,16 +515,16 @@ version = "0.0.0" dependencies = [ "cbindgen", "oxc", - "oxc_sourcemap", + "oxc_sourcemap 8.1.2", "serde", "serde_json", ] [[package]] name = "oxc_allocator" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c0b817e08c45c28fbc74511ff2cdf1c9e86b457dd1b6da2c49931493fbb438d" +checksum = "f24a6005a6ff29f17c8782d1088772db6329b50cf8ad264f66df542215df7c2f" dependencies = [ "allocator-api2", "hashbrown", @@ -536,9 +536,9 @@ dependencies = [ [[package]] name = "oxc_ast" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202ffaaa2337e1826b5855b2f2667ef3cfcee44c012148c8640e44dba3bec750" +checksum = "6d07280aa0e456352d72a1a98d2a91a127358177d8b246feee615b99b778ea1f" dependencies = [ "bitflags", "oxc_allocator", @@ -554,9 +554,9 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94bf90674e95f29b2579546cd16334ccd588bb0ef60d490a15878f0c020e093" +checksum = "1ce1a0ca39332490e992eca47e20501f3774740718713b7ff53644ec590e2016" dependencies = [ "phf", "proc-macro2", @@ -566,9 +566,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8c97a8aaeffe6d1dd8236caf5143833381968941557200451ba57dd0cb0da3" +checksum = "d5dab648a994ca3b3675ccbea348b11006aca6c22d28a2bcc4fd22c891be47ed" dependencies = [ "oxc_allocator", "oxc_ast", @@ -578,9 +578,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072f4ca9a6dc7f3db07975345c5eeddf75f5cbcd2baed4127a7bfe8c32aabf45" +checksum = "4871f00a6863d3fe7730b1d6afb2be1fe89a4ed3aa62fabc87297498a2537953" dependencies = [ "bitflags", "cow-utils", @@ -590,7 +590,7 @@ dependencies = [ "oxc_ecmascript", "oxc_index", "oxc_semantic", - "oxc_sourcemap", + "oxc_sourcemap 9.0.0", "oxc_span", "oxc_str", "oxc_syntax", @@ -600,9 +600,9 @@ dependencies = [ [[package]] name = "oxc_compat" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d77aedfd33ee8c1b60d4b1f196557a9015d6ae14f7a50855dd1d48ede6113" +checksum = "4c0415d2e950dc009db4e6c84cc7add8263f26b1600c81639c24cd14521a87ea" dependencies = [ "cow-utils", "oxc-browserslist", @@ -613,18 +613,18 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d93d5de8ad9fa036f970179eb08d19a3eaad0dd3c794dcd5321d2c25db71f5e" +checksum = "ac3f0180ce8b10906ae03adcd76cbc3f67cc162459372197edbc978baf5ae7f9" dependencies = [ "ropey", ] [[package]] name = "oxc_diagnostics" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eb98dbf92b8597e43d689bed6afb6e508c5ae358d6d8105a1fb25daef7918d5" +checksum = "14144d3bdedc81c60fd465ae46ea16018f4a2ca11df8f4cfe85d6bcb320af9b9" dependencies = [ "bytecount", "cow-utils", @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899933206d84edb4bb5ccc8027633fa33d30687ba2ca539361cdd5d3ff2c1246" +checksum = "143f70d2c47792bcdd3e8c3e3fbdc24506043499c50d092c752afba1c6103620" dependencies = [ "cow-utils", "dragonbox_ecma", @@ -661,9 +661,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08888715b49149d49324a99d53a9fa4f9375eb2b96d1694ce098097b410e1a1" +checksum = "cc212d653c5ee92487e637b9b44a51b8430cd48040d5f4abdce933a2f9a5edd3" dependencies = [ "dragonbox_ecma", "itoa", @@ -682,9 +682,9 @@ dependencies = [ [[package]] name = "oxc_isolated_declarations" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3adbfced895229e56d8eb4596411c6e9bd824ec299974580894cec6fb6b943c" +checksum = "ca2179ba21fb1f3d77123efc76bb0c63e484be3ae6a74b6930aec9bb4262cd5a" dependencies = [ "bitflags", "oxc_allocator", @@ -700,9 +700,9 @@ dependencies = [ [[package]] name = "oxc_mangler" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8723e6c50c791e030db56c17e531469bfeddb09391ed22c3915ffb57468b72" +checksum = "97b93307093cd69d925eb866ab8434c9eeca1e74f7a0c3c7f93e0da8086f2d1c" dependencies = [ "itertools", "oxc_allocator", @@ -719,9 +719,9 @@ dependencies = [ [[package]] name = "oxc_minifier" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d988e703552a17cb7fa4146be5f505e8b833d29aff95b82eae1b960dd52bece" +checksum = "e2aae776f027ac6dc88e4c1a70c8868910df294d658f9d415e458a1bfd1c12c0" dependencies = [ "cow-utils", "itoa", @@ -745,9 +745,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b461f66fd02878fd12819428ca6d887e967b512f7a0f7c0a9fb6c17b5a9ae694" +checksum = "2193499addde2689649d31816af73dc10c32f1855dba40d61cee17d341b05d9e" dependencies = [ "bitflags", "cow-utils", @@ -769,9 +769,9 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b7b7bd14ea6d12858942fc1ac9f3c1b3c448030ef564bafcc33faca480e293" +checksum = "b8330be1634468fdb3c9b850d831e1d82ded5c413d1154a46c0fc62eba2389bc" dependencies = [ "bitflags", "oxc_allocator", @@ -786,9 +786,9 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d105de95afcf7c3fa84c5daa9a2c483f28e8469111e08bd7aaaf8552245abf78" +checksum = "475e0f21fee076e57d9551415aeac08b843c29f7b65ced0ce09975845cea1bd6" dependencies = [ "itertools", "memchr", @@ -820,11 +820,24 @@ dependencies = [ "serde_json", ] +[[package]] +name = "oxc_sourcemap" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1133371a5fadc14b9f66a8fec14be3564a77647c7ab21b1ef0ec973bd82613ce" +dependencies = [ + "base64-simd", + "json-escape-simd", + "rustc-hash", + "serde", + "serde_json", +] + [[package]] name = "oxc_span" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20a71eea4ea7c4a23cf5a658d8e136541802365121ce6586b59b80cdbab96309" +checksum = "f32dae5b09cc262867e383533cdc822c40bccb09d84bbdc889716c99265197a1" dependencies = [ "compact_str", "oxc_allocator", @@ -836,9 +849,9 @@ dependencies = [ [[package]] name = "oxc_str" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91cc4c578ebb315cd4110b90b194ac46d89488cdf7368f50ad8f69d35d216f" +checksum = "49552c2eeb7cbfa118d55485fb38c6689be5ce1b313af7e0116e5d8da0dc22e0" dependencies = [ "compact_str", "hashbrown", @@ -849,9 +862,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719d4ae2bee14590ed2b39e1b7f6b8a9a0e914371f9117b8ebdc0afe7a12905e" +checksum = "87b3087c9e6f2039a4a46af8b0a9f9a5108ee3390a1fc8d98b24a5461e47888d" dependencies = [ "bitflags", "cow-utils", @@ -870,9 +883,9 @@ dependencies = [ [[package]] name = "oxc_transformer" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1d3f2c022e6d9f103556688e04991525403cb0d189e60e95c776d38dd98a29" +checksum = "df937a25f6221b88c69f94f7763913e286a63360a653124a5642f8e1af274e72" dependencies = [ "base64", "compact_str", @@ -900,9 +913,9 @@ dependencies = [ [[package]] name = "oxc_transformer_plugins" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b2ebe9fc82891d4aeab8ad113927398e35a099f0e06ebf7c6be2a3aebc4fe" +checksum = "cfa948ce8014f3479b01f453cb4a625828042d36216f52313bc89a8a530e447d" dependencies = [ "cow-utils", "itoa", @@ -923,9 +936,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.151.0" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2c242e72cf62c2f7632f702a991d01512763cdb264d6a6b2e2905ff6359a23" +checksum = "c7404a745b6fe5e902da850211105bedb8da9fe648e63d1581afe3e585df1abc" dependencies = [ "itoa", "oxc_allocator", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index d674c23..3cd42f6 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" crate-type = ["cdylib", "staticlib", "rlib"] [dependencies] -oxc = { version = "=0.151.0", features = ["full", "serialize"] } +oxc = { version = "=0.152.0", features = ["full", "serialize"] } oxc_sourcemap = "8" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["raw_value"] } diff --git a/rust/src/parse.rs b/rust/src/parse.rs index cb20b4b..b5778f6 100644 --- a/rust/src/parse.rs +++ b/rust/src/parse.rs @@ -68,6 +68,7 @@ fn collect_comments(source: &str, program: &oxc::ast::ast::Program<'_>, include_ kind: match comment.kind { CommentKind::Line => "Line", CommentKind::SingleLineBlock | CommentKind::MultiLineBlock => "Block", + CommentKind::HtmlOpen | CommentKind::HtmlClose => "Line", }, value: comment.content_span().source_text(source).to_string(), start: comment.span.start, diff --git a/rust/tests/parse_test.rs b/rust/tests/parse_test.rs index f95b185..2ed8f13 100644 --- a/rust/tests/parse_test.rs +++ b/rust/tests/parse_test.rs @@ -46,6 +46,34 @@ fn parse_leaves_the_ast_out_when_it_was_only_asked_to_read() { ); } +#[test] +fn parse_treats_html_comments_as_line_comments() { + let (code, answer) = parse("\nfoo()", r#"{"ast":false,"source_type":"script"}"#); + + assert_eq!(code, OxcErrorCode::None); + + let payload: serde_json::Value = serde_json::from_str(&answer).unwrap(); + let comments = payload["comments"].as_array().unwrap(); + + assert_eq!(comments.len(), 1); + assert_eq!(comments[0]["type"], "Line"); + assert_eq!(comments[0]["value"], ""); +} + #[test] fn parse_answers_what_it_could_not_read_inside_the_result() { let (code, answer) = parse("const x = ;", r#"{"ast":false}"#); diff --git a/test/oxc_test.rb b/test/oxc_test.rb index e8f86e4..8da8989 100644 --- a/test/oxc_test.rb +++ b/test/oxc_test.rb @@ -4,7 +4,7 @@ class OxcTest < Minitest::Spec test "has a version number" do - assert_equal "0.151.0", Oxc::VERSION + assert_equal "0.152.0", Oxc::VERSION end test "the native library was built from the version the gem was" do @@ -12,7 +12,7 @@ class OxcTest < Minitest::Spec end test "reports the version of oxc it was compiled against" do - assert_equal "0.151.0", Oxc.oxc_version + assert_equal "0.152.0", Oxc.oxc_version end test "the version it reports is the one Cargo.lock pins" do