@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.esm.js
CHANGED
|
@@ -155,7 +155,7 @@ class Token {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
158
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
158
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
159
159
|
class HerbError {
|
|
160
160
|
type;
|
|
161
161
|
message;
|
|
@@ -727,7 +727,7 @@ function convertToUTF8(string) {
|
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
730
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
730
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
731
731
|
class Node {
|
|
732
732
|
type;
|
|
733
733
|
location;
|
|
@@ -1801,6 +1801,7 @@ class ERBIfNode extends Node {
|
|
|
1801
1801
|
tag_opening;
|
|
1802
1802
|
content;
|
|
1803
1803
|
tag_closing;
|
|
1804
|
+
then_keyword;
|
|
1804
1805
|
statements;
|
|
1805
1806
|
subsequent;
|
|
1806
1807
|
end_node;
|
|
@@ -1815,6 +1816,7 @@ class ERBIfNode extends Node {
|
|
|
1815
1816
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1816
1817
|
content: data.content ? Token.from(data.content) : null,
|
|
1817
1818
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1819
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1818
1820
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1819
1821
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1820
1822
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1825,6 +1827,7 @@ class ERBIfNode extends Node {
|
|
|
1825
1827
|
this.tag_opening = props.tag_opening;
|
|
1826
1828
|
this.content = props.content;
|
|
1827
1829
|
this.tag_closing = props.tag_closing;
|
|
1830
|
+
this.then_keyword = props.then_keyword;
|
|
1828
1831
|
this.statements = props.statements;
|
|
1829
1832
|
this.subsequent = props.subsequent;
|
|
1830
1833
|
this.end_node = props.end_node;
|
|
@@ -1857,6 +1860,7 @@ class ERBIfNode extends Node {
|
|
|
1857
1860
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1858
1861
|
content: this.content ? this.content.toJSON() : null,
|
|
1859
1862
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1863
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1860
1864
|
statements: this.statements.map(node => node.toJSON()),
|
|
1861
1865
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1862
1866
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -1869,6 +1873,7 @@ class ERBIfNode extends Node {
|
|
|
1869
1873
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
1870
1874
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
1871
1875
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
1876
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
1872
1877
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
1873
1878
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
1874
1879
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -1950,6 +1955,7 @@ class ERBWhenNode extends Node {
|
|
|
1950
1955
|
tag_opening;
|
|
1951
1956
|
content;
|
|
1952
1957
|
tag_closing;
|
|
1958
|
+
then_keyword;
|
|
1953
1959
|
statements;
|
|
1954
1960
|
static get type() {
|
|
1955
1961
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -1962,6 +1968,7 @@ class ERBWhenNode extends Node {
|
|
|
1962
1968
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1963
1969
|
content: data.content ? Token.from(data.content) : null,
|
|
1964
1970
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1971
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1965
1972
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1966
1973
|
});
|
|
1967
1974
|
}
|
|
@@ -1970,6 +1977,7 @@ class ERBWhenNode extends Node {
|
|
|
1970
1977
|
this.tag_opening = props.tag_opening;
|
|
1971
1978
|
this.content = props.content;
|
|
1972
1979
|
this.tag_closing = props.tag_closing;
|
|
1980
|
+
this.then_keyword = props.then_keyword;
|
|
1973
1981
|
this.statements = props.statements;
|
|
1974
1982
|
}
|
|
1975
1983
|
accept(visitor) {
|
|
@@ -1996,6 +2004,7 @@ class ERBWhenNode extends Node {
|
|
|
1996
2004
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1997
2005
|
content: this.content ? this.content.toJSON() : null,
|
|
1998
2006
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2007
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1999
2008
|
statements: this.statements.map(node => node.toJSON()),
|
|
2000
2009
|
};
|
|
2001
2010
|
}
|
|
@@ -2006,6 +2015,7 @@ class ERBWhenNode extends Node {
|
|
|
2006
2015
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2007
2016
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2008
2017
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2018
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2009
2019
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2010
2020
|
return output;
|
|
2011
2021
|
}
|
|
@@ -2624,6 +2634,7 @@ class ERBUnlessNode extends Node {
|
|
|
2624
2634
|
tag_opening;
|
|
2625
2635
|
content;
|
|
2626
2636
|
tag_closing;
|
|
2637
|
+
then_keyword;
|
|
2627
2638
|
statements;
|
|
2628
2639
|
else_clause;
|
|
2629
2640
|
end_node;
|
|
@@ -2638,6 +2649,7 @@ class ERBUnlessNode extends Node {
|
|
|
2638
2649
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2639
2650
|
content: data.content ? Token.from(data.content) : null,
|
|
2640
2651
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2652
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2641
2653
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2642
2654
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2643
2655
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2648,6 +2660,7 @@ class ERBUnlessNode extends Node {
|
|
|
2648
2660
|
this.tag_opening = props.tag_opening;
|
|
2649
2661
|
this.content = props.content;
|
|
2650
2662
|
this.tag_closing = props.tag_closing;
|
|
2663
|
+
this.then_keyword = props.then_keyword;
|
|
2651
2664
|
this.statements = props.statements;
|
|
2652
2665
|
this.else_clause = props.else_clause;
|
|
2653
2666
|
this.end_node = props.end_node;
|
|
@@ -2680,6 +2693,7 @@ class ERBUnlessNode extends Node {
|
|
|
2680
2693
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2681
2694
|
content: this.content ? this.content.toJSON() : null,
|
|
2682
2695
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2696
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2683
2697
|
statements: this.statements.map(node => node.toJSON()),
|
|
2684
2698
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2685
2699
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2692,6 +2706,7 @@ class ERBUnlessNode extends Node {
|
|
|
2692
2706
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2693
2707
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2694
2708
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2709
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2695
2710
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2696
2711
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2697
2712
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2758,6 +2773,7 @@ class ERBInNode extends Node {
|
|
|
2758
2773
|
tag_opening;
|
|
2759
2774
|
content;
|
|
2760
2775
|
tag_closing;
|
|
2776
|
+
then_keyword;
|
|
2761
2777
|
statements;
|
|
2762
2778
|
static get type() {
|
|
2763
2779
|
return "AST_ERB_IN_NODE";
|
|
@@ -2770,6 +2786,7 @@ class ERBInNode extends Node {
|
|
|
2770
2786
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2771
2787
|
content: data.content ? Token.from(data.content) : null,
|
|
2772
2788
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2789
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2773
2790
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2774
2791
|
});
|
|
2775
2792
|
}
|
|
@@ -2778,6 +2795,7 @@ class ERBInNode extends Node {
|
|
|
2778
2795
|
this.tag_opening = props.tag_opening;
|
|
2779
2796
|
this.content = props.content;
|
|
2780
2797
|
this.tag_closing = props.tag_closing;
|
|
2798
|
+
this.then_keyword = props.then_keyword;
|
|
2781
2799
|
this.statements = props.statements;
|
|
2782
2800
|
}
|
|
2783
2801
|
accept(visitor) {
|
|
@@ -2804,6 +2822,7 @@ class ERBInNode extends Node {
|
|
|
2804
2822
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2805
2823
|
content: this.content ? this.content.toJSON() : null,
|
|
2806
2824
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2825
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2807
2826
|
statements: this.statements.map(node => node.toJSON()),
|
|
2808
2827
|
};
|
|
2809
2828
|
}
|
|
@@ -2814,6 +2833,7 @@ class ERBInNode extends Node {
|
|
|
2814
2833
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2815
2834
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2816
2835
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2836
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2817
2837
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2818
2838
|
return output;
|
|
2819
2839
|
}
|
|
@@ -2980,7 +3000,7 @@ class ParseResult extends Result {
|
|
|
2980
3000
|
}
|
|
2981
3001
|
|
|
2982
3002
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2983
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3003
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2984
3004
|
/**
|
|
2985
3005
|
* Type guard functions for AST nodes.
|
|
2986
3006
|
* These functions provide type checking by combining both instanceof
|
|
@@ -4060,7 +4080,7 @@ function didyoumeanRanked(input, list, threshold) {
|
|
|
4060
4080
|
}
|
|
4061
4081
|
|
|
4062
4082
|
var name = "@herb-tools/core";
|
|
4063
|
-
var version = "0.8.
|
|
4083
|
+
var version = "0.8.9";
|
|
4064
4084
|
var packageJSON = {
|
|
4065
4085
|
name: name,
|
|
4066
4086
|
version: version};
|
|
@@ -4283,7 +4303,7 @@ class HerbBackend {
|
|
|
4283
4303
|
}
|
|
4284
4304
|
|
|
4285
4305
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
4286
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
4306
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
4287
4307
|
class Visitor {
|
|
4288
4308
|
visit(node) {
|
|
4289
4309
|
if (!node)
|