diff --git a/CHANGELOG.md b/CHANGELOG.md index c278bc957e9..9130f9a9dbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [0.16.0] - 2023-10-30 + +### Added + +- `InterpolatedMatchLastLineNode#options` and `MatchLastLineNode#options` are added, which are the same methods as are exposed on `InterpolatedRegularExpressionNode` and `RegularExpressionNode`. +- The project can now be compiled with `wasi-sdk` to expose a WebAssembly interface. +- `ArgumentsNode#keyword_splat?` is added to indicate if the arguments node has a keyword splat. +- The C API `pm_prettyprint` has a much improved output which lines up closely with `Node#inspect`. +- Prism now ships with `RBS` and `RBI` type signatures (in the `/sig` and `/rbi` directories, respectively). +- `Prism::parse_comments` and `Prism::parse_file_comments` APIs are added to extract only the comments from the source code. + +### Changed + +- **BREAKING**: `Multi{Target,Write}Node#targets` is split up now into `lefts`, `rest`, and `rights`. This is to avoid having to scan the list in the case that there are splat nodes. +- Some bugs are fixed on `Multi{Target,Write}Node` accidentally creating additional nesting when not necessary. +- **BREAKING**: `RequiredDestructuredParameterNode` has been removed in favor of using `MultiTargetNode` in those places. +- **BREAKING**: `HashPatternNode#assocs` has been renamed to `HashPatternNode#elements`. `HashPatternNode#kwrest` has been renamed to `HashPatternNode#rest`. + ## [0.15.1] - 2023-10-18 ### Changed @@ -201,7 +219,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - 🎉 Initial release! 🎉 -[unreleased]: https://github.com/ruby/prism/compare/v0.15.1...HEAD +[unreleased]: https://github.com/ruby/prism/compare/v0.16.0...HEAD +[0.16.0]: https://github.com/ruby/prism/compare/v0.15.1...v0.16.0 [0.15.1]: https://github.com/ruby/prism/compare/v0.15.0...v0.15.1 [0.15.0]: https://github.com/ruby/prism/compare/v0.14.0...v0.15.0 [0.14.0]: https://github.com/ruby/prism/compare/v0.13.0...v0.14.0 diff --git a/Gemfile.lock b/Gemfile.lock index 7ff67191afa..08db1e4aaed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - prism (0.15.1) + prism (0.16.0) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index ca541600ca0..2d07c7ed9f8 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. We additio * [Heredocs](docs/heredocs.md) * [JavaScript](docs/javascript.md) * [Mapping](docs/mapping.md) +* [Releasing](docs/releasing.md) * [Ripper](docs/ripper.md) * [Ruby API](docs/ruby_api.md) * [Serialization](docs/serialization.md) diff --git a/docs/releasing.md b/docs/releasing.md new file mode 100644 index 00000000000..2887365894f --- /dev/null +++ b/docs/releasing.md @@ -0,0 +1,27 @@ +# Releasing + +To release a new version of Prism, perform the following steps: + +## Preparation + +* Update the CHANGELOG.md file. + * Add a new section for the new version at the top of the file. + * Fill in the relevant changes — it may be easiest to click the link for the `Unreleased` heading to find the commits. + * Update the links at the bottom of the file. +* Update the version in the following files: + * `prism.gemspec` in the `Gem::Specification#version=` method call + * `ext/prism/extension.h` in the `EXPECTED_PRISM_VERSION` macro + * `include/prism/version.h` in the version macros + * `javascript/package.json` in the `version` field + * `rust/prism-sys/tests/utils_tests.rs` in the `version_test` function + * `templates/java/org/prism/Loader.java.erb` in the `load` function + * `templates/javascript/src/deserialize.js.erb` in the version constants + * `templates/lib/prism/serialize.rb.erb` in the version constants +* Run `bundle install` to update the `Gemfile.lock` file. +* Update `rust/prism-sys/Cargo.toml` to match the new version and run `cargo build` +* Update `rust/prism/Cargo.toml` to match the new version and run `cargo build` +* Commit all of the updated files. + +## Publishing + +* Run `bundle exec rake release` to publish the gem to [rubygems.org](rubygems.org). Note that you must have access to the `prism` gem to do this. diff --git a/ext/prism/extension.h b/ext/prism/extension.h index e881d89b8e5..45d446bc409 100644 --- a/ext/prism/extension.h +++ b/ext/prism/extension.h @@ -1,7 +1,7 @@ #ifndef PRISM_EXT_NODE_H #define PRISM_EXT_NODE_H -#define EXPECTED_PRISM_VERSION "0.15.1" +#define EXPECTED_PRISM_VERSION "0.16.0" #include #include diff --git a/include/prism/version.h b/include/prism/version.h index 55ed5da7038..9a72a1dbdfa 100644 --- a/include/prism/version.h +++ b/include/prism/version.h @@ -1,4 +1,4 @@ #define PRISM_VERSION_MAJOR 0 -#define PRISM_VERSION_MINOR 15 -#define PRISM_VERSION_PATCH 1 -#define PRISM_VERSION "0.15.1" +#define PRISM_VERSION_MINOR 16 +#define PRISM_VERSION_PATCH 0 +#define PRISM_VERSION "0.16.0" diff --git a/javascript/package.json b/javascript/package.json index b71c27597e3..b3fda11b4cf 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@ruby/prism", - "version": "0.15.2", + "version": "0.16.0", "description": "Prism Ruby parser", "type": "module", "main": "src/index.js", diff --git a/prism.gemspec b/prism.gemspec index 76f5237783c..f93035aa187 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "prism" - spec.version = "0.15.1" + spec.version = "0.16.0" spec.authors = ["Shopify"] spec.email = ["ruby@shopify.com"] @@ -31,6 +31,7 @@ Gem::Specification.new do |spec| "docs/javascript.md", "docs/mapping.md", "docs/prism.png", + "docs/releasing.md", "docs/ripper.md", "docs/ruby_api.md", "docs/serialization.md", diff --git a/rust/prism-sys/Cargo.lock b/rust/prism-sys/Cargo.lock index c267143c9cc..e1567e36114 100644 --- a/rust/prism-sys/Cargo.lock +++ b/rust/prism-sys/Cargo.lock @@ -167,7 +167,7 @@ dependencies = [ [[package]] name = "prism-sys" -version = "0.15.1" +version = "0.16.0" dependencies = [ "bindgen", "cc", diff --git a/rust/prism-sys/Cargo.toml b/rust/prism-sys/Cargo.toml index 03edcc58744..8d0180d0bc1 100644 --- a/rust/prism-sys/Cargo.toml +++ b/rust/prism-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prism-sys" -version = "0.15.1" +version = "0.16.0" edition = "2021" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" diff --git a/rust/prism-sys/tests/utils_tests.rs b/rust/prism-sys/tests/utils_tests.rs index f402cb00d7f..840da9356fc 100644 --- a/rust/prism-sys/tests/utils_tests.rs +++ b/rust/prism-sys/tests/utils_tests.rs @@ -12,7 +12,7 @@ fn version_test() { CStr::from_ptr(version) }; - assert_eq!(&cstring.to_string_lossy(), "0.15.1"); + assert_eq!(&cstring.to_string_lossy(), "0.16.0"); } #[test] diff --git a/rust/prism/Cargo.lock b/rust/prism/Cargo.lock index 1092753bed5..1a659faa063 100644 --- a/rust/prism/Cargo.lock +++ b/rust/prism/Cargo.lock @@ -195,7 +195,7 @@ dependencies = [ [[package]] name = "prism" -version = "0.15.1" +version = "0.16.0" dependencies = [ "prism-sys", "serde", @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "prism-sys" -version = "0.15.1" +version = "0.16.0" dependencies = [ "bindgen", "cc", diff --git a/rust/prism/Cargo.toml b/rust/prism/Cargo.toml index 8fd7c60f1cd..326ee079923 100644 --- a/rust/prism/Cargo.toml +++ b/rust/prism/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prism" -version = "0.15.1" +version = "0.16.0" edition = "2021" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" diff --git a/templates/java/org/prism/Loader.java.erb b/templates/java/org/prism/Loader.java.erb index 73ea8ae1bff..d15c38b3a1f 100644 --- a/templates/java/org/prism/Loader.java.erb +++ b/templates/java/org/prism/Loader.java.erb @@ -96,8 +96,8 @@ public class Loader { expect((byte) 'M', "incorrect prism header"); expect((byte) 0, "prism version does not match"); - expect((byte) 15, "prism version does not match"); - expect((byte) 1, "prism version does not match"); + expect((byte) 16, "prism version does not match"); + expect((byte) 0, "prism version does not match"); expect((byte) 1, "Loader.java requires no location fields in the serialized output"); diff --git a/templates/javascript/src/deserialize.js.erb b/templates/javascript/src/deserialize.js.erb index 98789412992..610659d8a18 100644 --- a/templates/javascript/src/deserialize.js.erb +++ b/templates/javascript/src/deserialize.js.erb @@ -1,8 +1,8 @@ import * as nodes from "./nodes.js"; const MAJOR_VERSION = 0; -const MINOR_VERSION = 15; -const PATCH_VERSION = 1; +const MINOR_VERSION = 16; +const PATCH_VERSION = 0; class SerializationBuffer { constructor(source, array) { diff --git a/templates/lib/prism/serialize.rb.erb b/templates/lib/prism/serialize.rb.erb index 7f8b61ddfe8..4ee474671a4 100644 --- a/templates/lib/prism/serialize.rb.erb +++ b/templates/lib/prism/serialize.rb.erb @@ -14,8 +14,8 @@ end module Prism module Serialize MAJOR_VERSION = 0 - MINOR_VERSION = 15 - PATCH_VERSION = 1 + MINOR_VERSION = 16 + PATCH_VERSION = 0 def self.load(input, serialized) input = input.dup