syntax_tree-json 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4eb0907bcd118a21b8b293ee2f9b9da43bafd4779d1b3153b107b79cba7d839c
4
- data.tar.gz: 50b87fe6e6184c083c5bc458e0e88d4b5530e28c766f610930c908fe86f12a4a
3
+ metadata.gz: e254feef0c7698c445f1f926957850da544b82e3d708a4dced11fad5df81de94
4
+ data.tar.gz: 868de6d426b3a22e66f8ddf8e09df6756ca020cf808bd30d909f8994acfd0bef
5
5
  SHA512:
6
- metadata.gz: 416bf44911bf0c239f9f85f7c00c18c16a2ec5473ae3597c627b91ee25b3866cc6719fcd475eccc32b9b005187e150dbb1392da0825d55ade6680f711ec85df2
7
- data.tar.gz: 4ba346c41486bcbc9f748ebe88c09bc2da26633031aeb16f6b3fc1705bf6ce3d9d862c6bd59c8c7b5596b11f4f3d724667fc2994a1a4835b1f1e84ddc138d272
6
+ metadata.gz: fc062e3bba849e2948de7219e075b4c06c05b49465b2acfbe0237227989a3847f58031424631fb8954ea31e91e100856d66ede53984fb51033438af13f63e95f
7
+ data.tar.gz: 5fa6ffe9d9bc18f560e160556369e7717cacd5cf8a0eb172b9f6e33d0d812b51a78e24466ae2ef80bb03c2952cca71a864dab9033d74112ba68adbc87f6e1480
data/CHANGELOG.md CHANGED
@@ -6,11 +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
+ ## [0.2.0] - 2022-05-13
10
+
11
+ ### Changed
12
+
13
+ - Use `prettier_print` for formatting.
14
+
9
15
  ## [0.1.0] - 2022-03-31
10
16
 
11
17
  ### Added
12
18
 
13
19
  - 🎉 Initial release! 🎉
14
20
 
15
- [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-json/compare/v0.1.0...HEAD
16
- [0.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-json/compare/c52ff8...v0.1.0
21
+ [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-json/compare/v0.2.0...HEAD
22
+ [0.2.0]: https://github.com/ruby-syntax-tree/syntax_tree-json/compare/v0.1.0...v0.2.0
23
+ [0.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-json/compare/291383...v0.1.0
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree-json (0.1.0)
4
+ syntax_tree-json (0.2.0)
5
5
  json
6
+ prettier_print
6
7
  syntax_tree (>= 2.0.1)
7
8
 
8
9
  GEM
@@ -11,6 +12,7 @@ GEM
11
12
  docile (1.4.0)
12
13
  json (2.6.1)
13
14
  minitest (5.15.0)
15
+ prettier_print (0.1.0)
14
16
  rake (13.0.6)
15
17
  simplecov (0.21.2)
16
18
  docile (~> 1.1)
@@ -18,10 +20,12 @@ GEM
18
20
  simplecov_json_formatter (~> 0.1)
19
21
  simplecov-html (0.12.3)
20
22
  simplecov_json_formatter (0.1.4)
21
- syntax_tree (2.0.1)
23
+ syntax_tree (2.5.0)
24
+ prettier_print
22
25
 
23
26
  PLATFORMS
24
27
  x86_64-darwin-21
28
+ x86_64-linux
25
29
 
26
30
  DEPENDENCIES
27
31
  bundler
data/README.md CHANGED
@@ -36,14 +36,14 @@ From the CLI:
36
36
 
37
37
  ```sh
38
38
  $ stree ast --plugins=json file.json
39
- (root children=[(tag name="span" value="Hello, world!")])
39
+ (root object=(object values={"Hello"=>(literal value="world!")}))
40
40
  ```
41
41
 
42
42
  or
43
43
 
44
44
  ```sh
45
45
  $ stree format --plugins=json file.json
46
- %span Hello, world!
46
+ { "Hello": "world!" }
47
47
  ```
48
48
 
49
49
  or
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SyntaxTree
4
4
  module JSON
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "json"
4
+ require "prettier_print"
4
5
  require "syntax_tree"
5
6
 
6
7
  require_relative "json/version"
@@ -97,8 +98,8 @@ module SyntaxTree
97
98
  end
98
99
 
99
100
  class << self
100
- def format(source)
101
- formatter = PP.new([])
101
+ def format(source, maxwidth = 80)
102
+ formatter = PrettierPrint.new([], maxwidth)
102
103
  parse(source).format(formatter)
103
104
 
104
105
  formatter.flush
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = %w[lib]
25
25
 
26
26
  spec.add_dependency "json"
27
+ spec.add_dependency "prettier_print"
27
28
  spec.add_dependency "syntax_tree", ">= 2.0.1"
28
29
 
29
30
  spec.add_development_dependency "bundler"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prettier_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: syntax_tree
29
43
  requirement: !ruby/object:Gem::Requirement