@herb-tools/core 0.8.7 → 0.8.9
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.
- package/dist/herb-core.browser.js +25 -5
- package/dist/herb-core.browser.js.map +1 -1
- package/dist/herb-core.cjs +25 -5
- package/dist/herb-core.cjs.map +1 -1
- package/dist/herb-core.esm.js +25 -5
- package/dist/herb-core.esm.js.map +1 -1
- package/dist/herb-core.umd.js +25 -5
- package/dist/herb-core.umd.js.map +1 -1
- package/dist/types/nodes.d.ts +12 -0
- package/package.json +1 -1
- package/src/errors.ts +1 -1
- package/src/node-type-guards.ts +1 -1
- package/src/nodes.ts +29 -1
- package/src/visitor.ts +1 -1
package/dist/herb-core.cjs
CHANGED
|
@@ -157,7 +157,7 @@ class Token {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
160
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
160
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
161
161
|
class HerbError {
|
|
162
162
|
type;
|
|
163
163
|
message;
|
|
@@ -729,7 +729,7 @@ function convertToUTF8(string) {
|
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
732
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
732
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
733
733
|
class Node {
|
|
734
734
|
type;
|
|
735
735
|
location;
|
|
@@ -1803,6 +1803,7 @@ class ERBIfNode extends Node {
|
|
|
1803
1803
|
tag_opening;
|
|
1804
1804
|
content;
|
|
1805
1805
|
tag_closing;
|
|
1806
|
+
then_keyword;
|
|
1806
1807
|
statements;
|
|
1807
1808
|
subsequent;
|
|
1808
1809
|
end_node;
|
|
@@ -1817,6 +1818,7 @@ class ERBIfNode extends Node {
|
|
|
1817
1818
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1818
1819
|
content: data.content ? Token.from(data.content) : null,
|
|
1819
1820
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1821
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1820
1822
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1821
1823
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1822
1824
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1827,6 +1829,7 @@ class ERBIfNode extends Node {
|
|
|
1827
1829
|
this.tag_opening = props.tag_opening;
|
|
1828
1830
|
this.content = props.content;
|
|
1829
1831
|
this.tag_closing = props.tag_closing;
|
|
1832
|
+
this.then_keyword = props.then_keyword;
|
|
1830
1833
|
this.statements = props.statements;
|
|
1831
1834
|
this.subsequent = props.subsequent;
|
|
1832
1835
|
this.end_node = props.end_node;
|
|
@@ -1859,6 +1862,7 @@ class ERBIfNode extends Node {
|
|
|
1859
1862
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1860
1863
|
content: this.content ? this.content.toJSON() : null,
|
|
1861
1864
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1865
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1862
1866
|
statements: this.statements.map(node => node.toJSON()),
|
|
1863
1867
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1864
1868
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -1871,6 +1875,7 @@ class ERBIfNode extends Node {
|
|
|
1871
1875
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
1872
1876
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
1873
1877
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
1878
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
1874
1879
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
1875
1880
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
1876
1881
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -1952,6 +1957,7 @@ class ERBWhenNode extends Node {
|
|
|
1952
1957
|
tag_opening;
|
|
1953
1958
|
content;
|
|
1954
1959
|
tag_closing;
|
|
1960
|
+
then_keyword;
|
|
1955
1961
|
statements;
|
|
1956
1962
|
static get type() {
|
|
1957
1963
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -1964,6 +1970,7 @@ class ERBWhenNode extends Node {
|
|
|
1964
1970
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1965
1971
|
content: data.content ? Token.from(data.content) : null,
|
|
1966
1972
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1973
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1967
1974
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1968
1975
|
});
|
|
1969
1976
|
}
|
|
@@ -1972,6 +1979,7 @@ class ERBWhenNode extends Node {
|
|
|
1972
1979
|
this.tag_opening = props.tag_opening;
|
|
1973
1980
|
this.content = props.content;
|
|
1974
1981
|
this.tag_closing = props.tag_closing;
|
|
1982
|
+
this.then_keyword = props.then_keyword;
|
|
1975
1983
|
this.statements = props.statements;
|
|
1976
1984
|
}
|
|
1977
1985
|
accept(visitor) {
|
|
@@ -1998,6 +2006,7 @@ class ERBWhenNode extends Node {
|
|
|
1998
2006
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1999
2007
|
content: this.content ? this.content.toJSON() : null,
|
|
2000
2008
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2009
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2001
2010
|
statements: this.statements.map(node => node.toJSON()),
|
|
2002
2011
|
};
|
|
2003
2012
|
}
|
|
@@ -2008,6 +2017,7 @@ class ERBWhenNode extends Node {
|
|
|
2008
2017
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2009
2018
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2010
2019
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2020
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2011
2021
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2012
2022
|
return output;
|
|
2013
2023
|
}
|
|
@@ -2626,6 +2636,7 @@ class ERBUnlessNode extends Node {
|
|
|
2626
2636
|
tag_opening;
|
|
2627
2637
|
content;
|
|
2628
2638
|
tag_closing;
|
|
2639
|
+
then_keyword;
|
|
2629
2640
|
statements;
|
|
2630
2641
|
else_clause;
|
|
2631
2642
|
end_node;
|
|
@@ -2640,6 +2651,7 @@ class ERBUnlessNode extends Node {
|
|
|
2640
2651
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2641
2652
|
content: data.content ? Token.from(data.content) : null,
|
|
2642
2653
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2654
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2643
2655
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2644
2656
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2645
2657
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2650,6 +2662,7 @@ class ERBUnlessNode extends Node {
|
|
|
2650
2662
|
this.tag_opening = props.tag_opening;
|
|
2651
2663
|
this.content = props.content;
|
|
2652
2664
|
this.tag_closing = props.tag_closing;
|
|
2665
|
+
this.then_keyword = props.then_keyword;
|
|
2653
2666
|
this.statements = props.statements;
|
|
2654
2667
|
this.else_clause = props.else_clause;
|
|
2655
2668
|
this.end_node = props.end_node;
|
|
@@ -2682,6 +2695,7 @@ class ERBUnlessNode extends Node {
|
|
|
2682
2695
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2683
2696
|
content: this.content ? this.content.toJSON() : null,
|
|
2684
2697
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2698
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2685
2699
|
statements: this.statements.map(node => node.toJSON()),
|
|
2686
2700
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2687
2701
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2694,6 +2708,7 @@ class ERBUnlessNode extends Node {
|
|
|
2694
2708
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2695
2709
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2696
2710
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2711
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2697
2712
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2698
2713
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2699
2714
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2760,6 +2775,7 @@ class ERBInNode extends Node {
|
|
|
2760
2775
|
tag_opening;
|
|
2761
2776
|
content;
|
|
2762
2777
|
tag_closing;
|
|
2778
|
+
then_keyword;
|
|
2763
2779
|
statements;
|
|
2764
2780
|
static get type() {
|
|
2765
2781
|
return "AST_ERB_IN_NODE";
|
|
@@ -2772,6 +2788,7 @@ class ERBInNode extends Node {
|
|
|
2772
2788
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2773
2789
|
content: data.content ? Token.from(data.content) : null,
|
|
2774
2790
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2791
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2775
2792
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2776
2793
|
});
|
|
2777
2794
|
}
|
|
@@ -2780,6 +2797,7 @@ class ERBInNode extends Node {
|
|
|
2780
2797
|
this.tag_opening = props.tag_opening;
|
|
2781
2798
|
this.content = props.content;
|
|
2782
2799
|
this.tag_closing = props.tag_closing;
|
|
2800
|
+
this.then_keyword = props.then_keyword;
|
|
2783
2801
|
this.statements = props.statements;
|
|
2784
2802
|
}
|
|
2785
2803
|
accept(visitor) {
|
|
@@ -2806,6 +2824,7 @@ class ERBInNode extends Node {
|
|
|
2806
2824
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2807
2825
|
content: this.content ? this.content.toJSON() : null,
|
|
2808
2826
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2827
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2809
2828
|
statements: this.statements.map(node => node.toJSON()),
|
|
2810
2829
|
};
|
|
2811
2830
|
}
|
|
@@ -2816,6 +2835,7 @@ class ERBInNode extends Node {
|
|
|
2816
2835
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2817
2836
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2818
2837
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2838
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2819
2839
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2820
2840
|
return output;
|
|
2821
2841
|
}
|
|
@@ -2982,7 +3002,7 @@ class ParseResult extends Result {
|
|
|
2982
3002
|
}
|
|
2983
3003
|
|
|
2984
3004
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2985
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3005
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2986
3006
|
/**
|
|
2987
3007
|
* Type guard functions for AST nodes.
|
|
2988
3008
|
* These functions provide type checking by combining both instanceof
|
|
@@ -4062,7 +4082,7 @@ function didyoumeanRanked(input, list, threshold) {
|
|
|
4062
4082
|
}
|
|
4063
4083
|
|
|
4064
4084
|
var name = "@herb-tools/core";
|
|
4065
|
-
var version = "0.8.
|
|
4085
|
+
var version = "0.8.9";
|
|
4066
4086
|
var packageJSON = {
|
|
4067
4087
|
name: name,
|
|
4068
4088
|
version: version};
|
|
@@ -4285,7 +4305,7 @@ class HerbBackend {
|
|
|
4285
4305
|
}
|
|
4286
4306
|
|
|
4287
4307
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
4288
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
4308
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
4289
4309
|
class Visitor {
|
|
4290
4310
|
visit(node) {
|
|
4291
4311
|
if (!node)
|