@herb-tools/rewriter 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/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.cjs
CHANGED
|
@@ -290,7 +290,7 @@ class Token {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
293
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
293
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
294
294
|
class HerbError {
|
|
295
295
|
type;
|
|
296
296
|
message;
|
|
@@ -855,7 +855,7 @@ function convertToUTF8(string) {
|
|
|
855
855
|
}
|
|
856
856
|
|
|
857
857
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
858
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
858
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
859
859
|
class Node {
|
|
860
860
|
type;
|
|
861
861
|
location;
|
|
@@ -1929,6 +1929,7 @@ class ERBIfNode extends Node {
|
|
|
1929
1929
|
tag_opening;
|
|
1930
1930
|
content;
|
|
1931
1931
|
tag_closing;
|
|
1932
|
+
then_keyword;
|
|
1932
1933
|
statements;
|
|
1933
1934
|
subsequent;
|
|
1934
1935
|
end_node;
|
|
@@ -1943,6 +1944,7 @@ class ERBIfNode extends Node {
|
|
|
1943
1944
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1944
1945
|
content: data.content ? Token.from(data.content) : null,
|
|
1945
1946
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1947
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1946
1948
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1947
1949
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1948
1950
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1953,6 +1955,7 @@ class ERBIfNode extends Node {
|
|
|
1953
1955
|
this.tag_opening = props.tag_opening;
|
|
1954
1956
|
this.content = props.content;
|
|
1955
1957
|
this.tag_closing = props.tag_closing;
|
|
1958
|
+
this.then_keyword = props.then_keyword;
|
|
1956
1959
|
this.statements = props.statements;
|
|
1957
1960
|
this.subsequent = props.subsequent;
|
|
1958
1961
|
this.end_node = props.end_node;
|
|
@@ -1985,6 +1988,7 @@ class ERBIfNode extends Node {
|
|
|
1985
1988
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1986
1989
|
content: this.content ? this.content.toJSON() : null,
|
|
1987
1990
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1991
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1988
1992
|
statements: this.statements.map(node => node.toJSON()),
|
|
1989
1993
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1990
1994
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -1997,6 +2001,7 @@ class ERBIfNode extends Node {
|
|
|
1997
2001
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
1998
2002
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
1999
2003
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2004
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2000
2005
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2001
2006
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
2002
2007
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2078,6 +2083,7 @@ class ERBWhenNode extends Node {
|
|
|
2078
2083
|
tag_opening;
|
|
2079
2084
|
content;
|
|
2080
2085
|
tag_closing;
|
|
2086
|
+
then_keyword;
|
|
2081
2087
|
statements;
|
|
2082
2088
|
static get type() {
|
|
2083
2089
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -2090,6 +2096,7 @@ class ERBWhenNode extends Node {
|
|
|
2090
2096
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2091
2097
|
content: data.content ? Token.from(data.content) : null,
|
|
2092
2098
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2099
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2093
2100
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2094
2101
|
});
|
|
2095
2102
|
}
|
|
@@ -2098,6 +2105,7 @@ class ERBWhenNode extends Node {
|
|
|
2098
2105
|
this.tag_opening = props.tag_opening;
|
|
2099
2106
|
this.content = props.content;
|
|
2100
2107
|
this.tag_closing = props.tag_closing;
|
|
2108
|
+
this.then_keyword = props.then_keyword;
|
|
2101
2109
|
this.statements = props.statements;
|
|
2102
2110
|
}
|
|
2103
2111
|
accept(visitor) {
|
|
@@ -2124,6 +2132,7 @@ class ERBWhenNode extends Node {
|
|
|
2124
2132
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2125
2133
|
content: this.content ? this.content.toJSON() : null,
|
|
2126
2134
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2135
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2127
2136
|
statements: this.statements.map(node => node.toJSON()),
|
|
2128
2137
|
};
|
|
2129
2138
|
}
|
|
@@ -2134,6 +2143,7 @@ class ERBWhenNode extends Node {
|
|
|
2134
2143
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2135
2144
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2136
2145
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2146
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2137
2147
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2138
2148
|
return output;
|
|
2139
2149
|
}
|
|
@@ -2752,6 +2762,7 @@ class ERBUnlessNode extends Node {
|
|
|
2752
2762
|
tag_opening;
|
|
2753
2763
|
content;
|
|
2754
2764
|
tag_closing;
|
|
2765
|
+
then_keyword;
|
|
2755
2766
|
statements;
|
|
2756
2767
|
else_clause;
|
|
2757
2768
|
end_node;
|
|
@@ -2766,6 +2777,7 @@ class ERBUnlessNode extends Node {
|
|
|
2766
2777
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2767
2778
|
content: data.content ? Token.from(data.content) : null,
|
|
2768
2779
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2780
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2769
2781
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2770
2782
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2771
2783
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2776,6 +2788,7 @@ class ERBUnlessNode extends Node {
|
|
|
2776
2788
|
this.tag_opening = props.tag_opening;
|
|
2777
2789
|
this.content = props.content;
|
|
2778
2790
|
this.tag_closing = props.tag_closing;
|
|
2791
|
+
this.then_keyword = props.then_keyword;
|
|
2779
2792
|
this.statements = props.statements;
|
|
2780
2793
|
this.else_clause = props.else_clause;
|
|
2781
2794
|
this.end_node = props.end_node;
|
|
@@ -2808,6 +2821,7 @@ class ERBUnlessNode extends Node {
|
|
|
2808
2821
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2809
2822
|
content: this.content ? this.content.toJSON() : null,
|
|
2810
2823
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2824
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2811
2825
|
statements: this.statements.map(node => node.toJSON()),
|
|
2812
2826
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2813
2827
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2820,6 +2834,7 @@ class ERBUnlessNode extends Node {
|
|
|
2820
2834
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2821
2835
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2822
2836
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2837
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2823
2838
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2824
2839
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2825
2840
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2886,6 +2901,7 @@ class ERBInNode extends Node {
|
|
|
2886
2901
|
tag_opening;
|
|
2887
2902
|
content;
|
|
2888
2903
|
tag_closing;
|
|
2904
|
+
then_keyword;
|
|
2889
2905
|
statements;
|
|
2890
2906
|
static get type() {
|
|
2891
2907
|
return "AST_ERB_IN_NODE";
|
|
@@ -2898,6 +2914,7 @@ class ERBInNode extends Node {
|
|
|
2898
2914
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2899
2915
|
content: data.content ? Token.from(data.content) : null,
|
|
2900
2916
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2917
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2901
2918
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2902
2919
|
});
|
|
2903
2920
|
}
|
|
@@ -2906,6 +2923,7 @@ class ERBInNode extends Node {
|
|
|
2906
2923
|
this.tag_opening = props.tag_opening;
|
|
2907
2924
|
this.content = props.content;
|
|
2908
2925
|
this.tag_closing = props.tag_closing;
|
|
2926
|
+
this.then_keyword = props.then_keyword;
|
|
2909
2927
|
this.statements = props.statements;
|
|
2910
2928
|
}
|
|
2911
2929
|
accept(visitor) {
|
|
@@ -2932,6 +2950,7 @@ class ERBInNode extends Node {
|
|
|
2932
2950
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2933
2951
|
content: this.content ? this.content.toJSON() : null,
|
|
2934
2952
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2953
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2935
2954
|
statements: this.statements.map(node => node.toJSON()),
|
|
2936
2955
|
};
|
|
2937
2956
|
}
|
|
@@ -2942,6 +2961,7 @@ class ERBInNode extends Node {
|
|
|
2942
2961
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2943
2962
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2944
2963
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2964
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2945
2965
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2946
2966
|
return output;
|
|
2947
2967
|
}
|
|
@@ -3133,7 +3153,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
|
|
|
3133
3153
|
}
|
|
3134
3154
|
|
|
3135
3155
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3136
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3156
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3137
3157
|
class Visitor {
|
|
3138
3158
|
visit(node) {
|
|
3139
3159
|
if (!node)
|