prettier 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/package.json +1 -1
  4. data/src/plugin.js +11 -6
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f48ed0363e8410a6e7fb2c3c8bc95ed8a87f8fac28546429571b71bdd3225e19
4
- data.tar.gz: b7a8dd5700deda01c743c926890eb977660445a06ca057540ab347b27126ff4b
3
+ metadata.gz: cc23f62e5978531aa9efbdf2682381947187e51e04035d56c73d5b9a1f763f6f
4
+ data.tar.gz: 342588a031d583d30159d31c6b6f12496aedfb08356464a7dcdd45f68d06f138
5
5
  SHA512:
6
- metadata.gz: 81880c36ea2a6493552c0af368c61e7cc1f587af9ddfde72e9cdbe484a3cd855c30d1cad7ddfdb629e15f2c54998d822fbab75b35f31ce33fb555b14f9f1255b
7
- data.tar.gz: 21213157b04d8f7e801fd9e0e90ee8351f723223caa8672bd2e00e152a1e2111bb85f6caa35400fb7fa6d3e19b75a36b1c176fb6ebf02f567796ad4ea0472930
6
+ metadata.gz: c054e1d6310ab2c4ce55a676a1d524e1f349d68df4c5947f612e2cb2caaf9a7e28f23af35d864d0d8d46ff6237dd0a83c751aac6dc60454c15dcadd53789c837
7
+ data.tar.gz: b7a3112ad01bb8c214b469b30abfd362fc15895dcf785e5749eb5fcf77df8fb1e809a51e678813b9dfd0952b63130660d426dbcbf45842b11221dc2071ba096b
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [4.0.1] - 2023-07-08
10
+
11
+ ### Changed
12
+
13
+ - [#1363](https://github.com/prettier/plugin-ruby/pull/1363) - mscrivo, kddnewton - Ensure all data is read from socket before attempting to parse to JSON.
14
+
9
15
  ## [4.0.0] - 2023-07-06
10
16
 
11
17
  ### Added
@@ -1279,7 +1285,8 @@ would previously result in `array[]`, but now prints properly.
1279
1285
 
1280
1286
  - Initial release 🎉
1281
1287
 
1282
- [unreleased]: https://github.com/prettier/plugin-ruby/compare/v4.0.0...HEAD
1288
+ [unreleased]: https://github.com/prettier/plugin-ruby/compare/v4.0.1...HEAD
1289
+ [4.0.1]: https://github.com/prettier/plugin-ruby/compare/v4.0.0...v4.0.1
1283
1290
  [4.0.0]: https://github.com/prettier/plugin-ruby/compare/v3.2.2...v4.0.0
1284
1291
  [3.2.2]: https://github.com/prettier/plugin-ruby/compare/v3.2.1...v3.2.2
1285
1292
  [3.2.1]: https://github.com/prettier/plugin-ruby/compare/v3.2.0...v3.2.1
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prettier/plugin-ruby",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "type": "module",
6
6
  "main": "src/plugin.js",
data/src/plugin.js CHANGED
@@ -140,10 +140,7 @@ if (process.env.PRETTIER_RUBY_HOST) {
140
140
  connectionOptions = JSON.parse(process.env.PRETTIER_RUBY_HOST);
141
141
  }
142
142
 
143
- // Formats and sends a request to the parser server. We use netcat (or something
144
- // like it) here since Prettier requires the results of `parse` to be
145
- // synchronous and Node.js does not offer a mechanism for synchronous socket
146
- // requests.
143
+ // Formats and sends an asynchronous request to the parser server.
147
144
  async function parse(parser, source, opts) {
148
145
  if (!connectionOptions) {
149
146
  const spawnedServer = await spawnServer(opts);
@@ -152,10 +149,18 @@ async function parse(parser, source, opts) {
152
149
 
153
150
  return new Promise((resolve, reject) => {
154
151
  const socket = new net.Socket();
152
+ let chunks = "";
153
+
154
+ socket.on("error", (error) => {
155
+ reject(error);
156
+ });
155
157
 
156
- socket.on("error", reject);
157
158
  socket.on("data", (data) => {
158
- const response = JSON.parse(data.toString("utf-8"));
159
+ chunks += data.toString("utf-8");
160
+ });
161
+
162
+ socket.on("end", () => {
163
+ const response = JSON.parse(chunks);
159
164
 
160
165
  if (response.error) {
161
166
  const error = new Error(response.error);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prettier
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-06 00:00:00.000000000 Z
11
+ date: 2023-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: syntax_tree