prettier 4.0.0 → 4.0.2

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 +15 -1
  3. data/package.json +4 -3
  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: b615c78701b85a934e803ce85ebcd12b243e8d52a05c6f35eb998281339c35ea
4
+ data.tar.gz: a2e897d33d3b196d3b3191a27b7e5185e45085eec56a4fa118c824f130a22fbf
5
5
  SHA512:
6
- metadata.gz: 81880c36ea2a6493552c0af368c61e7cc1f587af9ddfde72e9cdbe484a3cd855c30d1cad7ddfdb629e15f2c54998d822fbab75b35f31ce33fb555b14f9f1255b
7
- data.tar.gz: 21213157b04d8f7e801fd9e0e90ee8351f723223caa8672bd2e00e152a1e2111bb85f6caa35400fb7fa6d3e19b75a36b1c176fb6ebf02f567796ad4ea0472930
6
+ metadata.gz: f7baf9ed2953155ed2ea056dea87fa2c4fc9322888b59359426d8ee1bf0da24cb979ded1531935af980bfc693dca1bfc9ea0f6e6530eb1634f2d4c7d12584760
7
+ data.tar.gz: 92879359c7a3e26c36bd1400f659f7d6347bf4822effad81603430252f64707dee60a0e2353d5bace32bfce7ad7abe2a9ba83106425b7e70fd04dd1f92f27995
data/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ 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.2] - 2023-07-14
10
+
11
+ ### Changed
12
+
13
+ - [#1367](https://github.com/prettier/plugin-ruby/pull/1367) - kddnewton - Specify `prettier` as a peer dependency and not a runtime dependency.
14
+
15
+ ## [4.0.1] - 2023-07-08
16
+
17
+ ### Changed
18
+
19
+ - [#1363](https://github.com/prettier/plugin-ruby/pull/1363) - mscrivo, kddnewton - Ensure all data is read from socket before attempting to parse to JSON.
20
+
9
21
  ## [4.0.0] - 2023-07-06
10
22
 
11
23
  ### Added
@@ -1279,7 +1291,9 @@ would previously result in `array[]`, but now prints properly.
1279
1291
 
1280
1292
  - Initial release 🎉
1281
1293
 
1282
- [unreleased]: https://github.com/prettier/plugin-ruby/compare/v4.0.0...HEAD
1294
+ [unreleased]: https://github.com/prettier/plugin-ruby/compare/v4.0.2...HEAD
1295
+ [4.0.2]: https://github.com/prettier/plugin-ruby/compare/v4.0.1...v4.0.2
1296
+ [4.0.1]: https://github.com/prettier/plugin-ruby/compare/v4.0.0...v4.0.1
1283
1297
  [4.0.0]: https://github.com/prettier/plugin-ruby/compare/v3.2.2...v4.0.0
1284
1298
  [3.2.2]: https://github.com/prettier/plugin-ruby/compare/v3.2.1...v3.2.2
1285
1299
  [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.2",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "type": "module",
6
6
  "main": "src/plugin.js",
@@ -19,14 +19,15 @@
19
19
  "url": "https://github.com/prettier/plugin-ruby/issues"
20
20
  },
21
21
  "homepage": "https://github.com/prettier/plugin-ruby#readme",
22
- "dependencies": {
23
- "prettier": ">=3.0.0"
22
+ "peerDependencies": {
23
+ "prettier": "^3.0.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "eslint": "^8.35.0",
27
27
  "eslint-config-prettier": "^8.7.0",
28
28
  "husky": "^8.0.1",
29
29
  "jest": "^29.5.0",
30
+ "prettier": "^3.0.0",
30
31
  "pretty-quick": "^3.1.2"
31
32
  },
32
33
  "eslintConfig": {
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.2
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-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: syntax_tree