prettier 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +9 -3
- data/package.json +2 -2
- data/src/haml/embed.js +87 -0
- data/src/haml/nodes/comment.js +27 -0
- data/src/haml/nodes/doctype.js +34 -0
- data/src/haml/nodes/filter.js +16 -0
- data/src/haml/nodes/hamlComment.js +21 -0
- data/src/haml/nodes/plain.js +6 -0
- data/src/haml/nodes/root.js +8 -0
- data/src/haml/nodes/script.js +33 -0
- data/src/haml/nodes/silentScript.js +59 -0
- data/src/haml/nodes/tag.js +193 -0
- data/src/haml/parser.js +33 -0
- data/src/haml/parser.rb +141 -0
- data/src/haml/printer.js +28 -0
- data/src/plugin.js +25 -4
- data/src/rbs/parser.js +51 -0
- data/src/rbs/parser.rb +91 -0
- data/src/rbs/printer.js +605 -0
- data/src/ruby/parser.rb +10 -4
- metadata +18 -2
data/src/ruby/parser.rb
CHANGED
@@ -14,7 +14,7 @@ if (RUBY_MAJOR < 2) || ((RUBY_MAJOR == 2) && (RUBY_MINOR < 5))
|
|
14
14
|
end
|
15
15
|
|
16
16
|
require 'delegate'
|
17
|
-
require 'json'
|
17
|
+
require 'json'
|
18
18
|
require 'ripper'
|
19
19
|
|
20
20
|
module Prettier; end
|
@@ -40,6 +40,13 @@ class Prettier::Parser < Ripper
|
|
40
40
|
@source.lines.each { |line| @line_counts << @line_counts.last + line.size }
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.parse(source)
|
44
|
+
builder = new(source)
|
45
|
+
|
46
|
+
response = builder.parse
|
47
|
+
response unless builder.error?
|
48
|
+
end
|
49
|
+
|
43
50
|
private
|
44
51
|
|
45
52
|
# This represents the current place in the source string that we've gotten to
|
@@ -2548,10 +2555,9 @@ end
|
|
2548
2555
|
# stdin and report back the AST over stdout.
|
2549
2556
|
|
2550
2557
|
if $0 == __FILE__
|
2551
|
-
|
2552
|
-
response = builder.parse
|
2558
|
+
response = Prettier::Parser.parse($stdin.read)
|
2553
2559
|
|
2554
|
-
if !response
|
2560
|
+
if !response
|
2555
2561
|
warn(
|
2556
2562
|
'@prettier/plugin-ruby encountered an error when attempting to parse ' \
|
2557
2563
|
'the ruby source. This usually means there was a syntax error in the ' \
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prettier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Deisz
|
@@ -31,8 +31,24 @@ files:
|
|
31
31
|
- node_modules/prettier/third-party.js
|
32
32
|
- package.json
|
33
33
|
- rubocop.yml
|
34
|
+
- src/haml/embed.js
|
35
|
+
- src/haml/nodes/comment.js
|
36
|
+
- src/haml/nodes/doctype.js
|
37
|
+
- src/haml/nodes/filter.js
|
38
|
+
- src/haml/nodes/hamlComment.js
|
39
|
+
- src/haml/nodes/plain.js
|
40
|
+
- src/haml/nodes/root.js
|
41
|
+
- src/haml/nodes/script.js
|
42
|
+
- src/haml/nodes/silentScript.js
|
43
|
+
- src/haml/nodes/tag.js
|
44
|
+
- src/haml/parser.js
|
45
|
+
- src/haml/parser.rb
|
46
|
+
- src/haml/printer.js
|
34
47
|
- src/plugin.js
|
35
48
|
- src/prettier.js
|
49
|
+
- src/rbs/parser.js
|
50
|
+
- src/rbs/parser.rb
|
51
|
+
- src/rbs/printer.js
|
36
52
|
- src/ruby/embed.js
|
37
53
|
- src/ruby/nodes.js
|
38
54
|
- src/ruby/nodes/alias.js
|
@@ -101,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
117
|
- !ruby/object:Gem::Version
|
102
118
|
version: '0'
|
103
119
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.0.3
|
105
121
|
signing_key:
|
106
122
|
specification_version: 4
|
107
123
|
summary: prettier plugin for the Ruby programming language
|