@herb-tools/rewriter 0.8.7 → 0.8.8
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/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +23 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/loader.cjs +24 -4
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.esm.js +24 -4
- package/dist/loader.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -288,7 +288,7 @@ class Token {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
291
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
291
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/errors.ts.erb
|
|
292
292
|
class HerbError {
|
|
293
293
|
type;
|
|
294
294
|
message;
|
|
@@ -853,7 +853,7 @@ function convertToUTF8(string) {
|
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
856
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
856
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/nodes.ts.erb
|
|
857
857
|
class Node {
|
|
858
858
|
type;
|
|
859
859
|
location;
|
|
@@ -1927,6 +1927,7 @@ class ERBIfNode extends Node {
|
|
|
1927
1927
|
tag_opening;
|
|
1928
1928
|
content;
|
|
1929
1929
|
tag_closing;
|
|
1930
|
+
then_keyword;
|
|
1930
1931
|
statements;
|
|
1931
1932
|
subsequent;
|
|
1932
1933
|
end_node;
|
|
@@ -1941,6 +1942,7 @@ class ERBIfNode extends Node {
|
|
|
1941
1942
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1942
1943
|
content: data.content ? Token.from(data.content) : null,
|
|
1943
1944
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1945
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1944
1946
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1945
1947
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1946
1948
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1951,6 +1953,7 @@ class ERBIfNode extends Node {
|
|
|
1951
1953
|
this.tag_opening = props.tag_opening;
|
|
1952
1954
|
this.content = props.content;
|
|
1953
1955
|
this.tag_closing = props.tag_closing;
|
|
1956
|
+
this.then_keyword = props.then_keyword;
|
|
1954
1957
|
this.statements = props.statements;
|
|
1955
1958
|
this.subsequent = props.subsequent;
|
|
1956
1959
|
this.end_node = props.end_node;
|
|
@@ -1983,6 +1986,7 @@ class ERBIfNode extends Node {
|
|
|
1983
1986
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1984
1987
|
content: this.content ? this.content.toJSON() : null,
|
|
1985
1988
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1989
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1986
1990
|
statements: this.statements.map(node => node.toJSON()),
|
|
1987
1991
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1988
1992
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -1995,6 +1999,7 @@ class ERBIfNode extends Node {
|
|
|
1995
1999
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
1996
2000
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
1997
2001
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2002
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
1998
2003
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
1999
2004
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
2000
2005
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2076,6 +2081,7 @@ class ERBWhenNode extends Node {
|
|
|
2076
2081
|
tag_opening;
|
|
2077
2082
|
content;
|
|
2078
2083
|
tag_closing;
|
|
2084
|
+
then_keyword;
|
|
2079
2085
|
statements;
|
|
2080
2086
|
static get type() {
|
|
2081
2087
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -2088,6 +2094,7 @@ class ERBWhenNode extends Node {
|
|
|
2088
2094
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2089
2095
|
content: data.content ? Token.from(data.content) : null,
|
|
2090
2096
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2097
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2091
2098
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2092
2099
|
});
|
|
2093
2100
|
}
|
|
@@ -2096,6 +2103,7 @@ class ERBWhenNode extends Node {
|
|
|
2096
2103
|
this.tag_opening = props.tag_opening;
|
|
2097
2104
|
this.content = props.content;
|
|
2098
2105
|
this.tag_closing = props.tag_closing;
|
|
2106
|
+
this.then_keyword = props.then_keyword;
|
|
2099
2107
|
this.statements = props.statements;
|
|
2100
2108
|
}
|
|
2101
2109
|
accept(visitor) {
|
|
@@ -2122,6 +2130,7 @@ class ERBWhenNode extends Node {
|
|
|
2122
2130
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2123
2131
|
content: this.content ? this.content.toJSON() : null,
|
|
2124
2132
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2133
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2125
2134
|
statements: this.statements.map(node => node.toJSON()),
|
|
2126
2135
|
};
|
|
2127
2136
|
}
|
|
@@ -2132,6 +2141,7 @@ class ERBWhenNode extends Node {
|
|
|
2132
2141
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2133
2142
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2134
2143
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2144
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2135
2145
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2136
2146
|
return output;
|
|
2137
2147
|
}
|
|
@@ -2750,6 +2760,7 @@ class ERBUnlessNode extends Node {
|
|
|
2750
2760
|
tag_opening;
|
|
2751
2761
|
content;
|
|
2752
2762
|
tag_closing;
|
|
2763
|
+
then_keyword;
|
|
2753
2764
|
statements;
|
|
2754
2765
|
else_clause;
|
|
2755
2766
|
end_node;
|
|
@@ -2764,6 +2775,7 @@ class ERBUnlessNode extends Node {
|
|
|
2764
2775
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2765
2776
|
content: data.content ? Token.from(data.content) : null,
|
|
2766
2777
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2778
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2767
2779
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2768
2780
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2769
2781
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2774,6 +2786,7 @@ class ERBUnlessNode extends Node {
|
|
|
2774
2786
|
this.tag_opening = props.tag_opening;
|
|
2775
2787
|
this.content = props.content;
|
|
2776
2788
|
this.tag_closing = props.tag_closing;
|
|
2789
|
+
this.then_keyword = props.then_keyword;
|
|
2777
2790
|
this.statements = props.statements;
|
|
2778
2791
|
this.else_clause = props.else_clause;
|
|
2779
2792
|
this.end_node = props.end_node;
|
|
@@ -2806,6 +2819,7 @@ class ERBUnlessNode extends Node {
|
|
|
2806
2819
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2807
2820
|
content: this.content ? this.content.toJSON() : null,
|
|
2808
2821
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2822
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2809
2823
|
statements: this.statements.map(node => node.toJSON()),
|
|
2810
2824
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2811
2825
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2818,6 +2832,7 @@ class ERBUnlessNode extends Node {
|
|
|
2818
2832
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2819
2833
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2820
2834
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2835
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2821
2836
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2822
2837
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2823
2838
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2884,6 +2899,7 @@ class ERBInNode extends Node {
|
|
|
2884
2899
|
tag_opening;
|
|
2885
2900
|
content;
|
|
2886
2901
|
tag_closing;
|
|
2902
|
+
then_keyword;
|
|
2887
2903
|
statements;
|
|
2888
2904
|
static get type() {
|
|
2889
2905
|
return "AST_ERB_IN_NODE";
|
|
@@ -2896,6 +2912,7 @@ class ERBInNode extends Node {
|
|
|
2896
2912
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2897
2913
|
content: data.content ? Token.from(data.content) : null,
|
|
2898
2914
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2915
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2899
2916
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2900
2917
|
});
|
|
2901
2918
|
}
|
|
@@ -2904,6 +2921,7 @@ class ERBInNode extends Node {
|
|
|
2904
2921
|
this.tag_opening = props.tag_opening;
|
|
2905
2922
|
this.content = props.content;
|
|
2906
2923
|
this.tag_closing = props.tag_closing;
|
|
2924
|
+
this.then_keyword = props.then_keyword;
|
|
2907
2925
|
this.statements = props.statements;
|
|
2908
2926
|
}
|
|
2909
2927
|
accept(visitor) {
|
|
@@ -2930,6 +2948,7 @@ class ERBInNode extends Node {
|
|
|
2930
2948
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2931
2949
|
content: this.content ? this.content.toJSON() : null,
|
|
2932
2950
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2951
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2933
2952
|
statements: this.statements.map(node => node.toJSON()),
|
|
2934
2953
|
};
|
|
2935
2954
|
}
|
|
@@ -2940,6 +2959,7 @@ class ERBInNode extends Node {
|
|
|
2940
2959
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2941
2960
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2942
2961
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2962
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2943
2963
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2944
2964
|
return output;
|
|
2945
2965
|
}
|
|
@@ -3131,7 +3151,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
|
|
|
3131
3151
|
}
|
|
3132
3152
|
|
|
3133
3153
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3134
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3154
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3135
3155
|
class Visitor {
|
|
3136
3156
|
visit(node) {
|
|
3137
3157
|
if (!node)
|