@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/loader.esm.js
CHANGED
|
@@ -292,7 +292,7 @@ class Token {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
295
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
295
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/errors.ts.erb
|
|
296
296
|
class HerbError {
|
|
297
297
|
type;
|
|
298
298
|
message;
|
|
@@ -857,7 +857,7 @@ function convertToUTF8(string) {
|
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
860
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
860
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/nodes.ts.erb
|
|
861
861
|
class Node {
|
|
862
862
|
type;
|
|
863
863
|
location;
|
|
@@ -1931,6 +1931,7 @@ class ERBIfNode extends Node {
|
|
|
1931
1931
|
tag_opening;
|
|
1932
1932
|
content;
|
|
1933
1933
|
tag_closing;
|
|
1934
|
+
then_keyword;
|
|
1934
1935
|
statements;
|
|
1935
1936
|
subsequent;
|
|
1936
1937
|
end_node;
|
|
@@ -1945,6 +1946,7 @@ class ERBIfNode extends Node {
|
|
|
1945
1946
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1946
1947
|
content: data.content ? Token.from(data.content) : null,
|
|
1947
1948
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1949
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1948
1950
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1949
1951
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1950
1952
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1955,6 +1957,7 @@ class ERBIfNode extends Node {
|
|
|
1955
1957
|
this.tag_opening = props.tag_opening;
|
|
1956
1958
|
this.content = props.content;
|
|
1957
1959
|
this.tag_closing = props.tag_closing;
|
|
1960
|
+
this.then_keyword = props.then_keyword;
|
|
1958
1961
|
this.statements = props.statements;
|
|
1959
1962
|
this.subsequent = props.subsequent;
|
|
1960
1963
|
this.end_node = props.end_node;
|
|
@@ -1987,6 +1990,7 @@ class ERBIfNode extends Node {
|
|
|
1987
1990
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1988
1991
|
content: this.content ? this.content.toJSON() : null,
|
|
1989
1992
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1993
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1990
1994
|
statements: this.statements.map(node => node.toJSON()),
|
|
1991
1995
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1992
1996
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -1999,6 +2003,7 @@ class ERBIfNode extends Node {
|
|
|
1999
2003
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2000
2004
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2001
2005
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2006
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2002
2007
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2003
2008
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
2004
2009
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2080,6 +2085,7 @@ class ERBWhenNode extends Node {
|
|
|
2080
2085
|
tag_opening;
|
|
2081
2086
|
content;
|
|
2082
2087
|
tag_closing;
|
|
2088
|
+
then_keyword;
|
|
2083
2089
|
statements;
|
|
2084
2090
|
static get type() {
|
|
2085
2091
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -2092,6 +2098,7 @@ class ERBWhenNode extends Node {
|
|
|
2092
2098
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2093
2099
|
content: data.content ? Token.from(data.content) : null,
|
|
2094
2100
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2101
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2095
2102
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2096
2103
|
});
|
|
2097
2104
|
}
|
|
@@ -2100,6 +2107,7 @@ class ERBWhenNode extends Node {
|
|
|
2100
2107
|
this.tag_opening = props.tag_opening;
|
|
2101
2108
|
this.content = props.content;
|
|
2102
2109
|
this.tag_closing = props.tag_closing;
|
|
2110
|
+
this.then_keyword = props.then_keyword;
|
|
2103
2111
|
this.statements = props.statements;
|
|
2104
2112
|
}
|
|
2105
2113
|
accept(visitor) {
|
|
@@ -2126,6 +2134,7 @@ class ERBWhenNode extends Node {
|
|
|
2126
2134
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2127
2135
|
content: this.content ? this.content.toJSON() : null,
|
|
2128
2136
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2137
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2129
2138
|
statements: this.statements.map(node => node.toJSON()),
|
|
2130
2139
|
};
|
|
2131
2140
|
}
|
|
@@ -2136,6 +2145,7 @@ class ERBWhenNode extends Node {
|
|
|
2136
2145
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2137
2146
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2138
2147
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2148
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2139
2149
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2140
2150
|
return output;
|
|
2141
2151
|
}
|
|
@@ -2754,6 +2764,7 @@ class ERBUnlessNode extends Node {
|
|
|
2754
2764
|
tag_opening;
|
|
2755
2765
|
content;
|
|
2756
2766
|
tag_closing;
|
|
2767
|
+
then_keyword;
|
|
2757
2768
|
statements;
|
|
2758
2769
|
else_clause;
|
|
2759
2770
|
end_node;
|
|
@@ -2768,6 +2779,7 @@ class ERBUnlessNode extends Node {
|
|
|
2768
2779
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2769
2780
|
content: data.content ? Token.from(data.content) : null,
|
|
2770
2781
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2782
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2771
2783
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2772
2784
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2773
2785
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2778,6 +2790,7 @@ class ERBUnlessNode extends Node {
|
|
|
2778
2790
|
this.tag_opening = props.tag_opening;
|
|
2779
2791
|
this.content = props.content;
|
|
2780
2792
|
this.tag_closing = props.tag_closing;
|
|
2793
|
+
this.then_keyword = props.then_keyword;
|
|
2781
2794
|
this.statements = props.statements;
|
|
2782
2795
|
this.else_clause = props.else_clause;
|
|
2783
2796
|
this.end_node = props.end_node;
|
|
@@ -2810,6 +2823,7 @@ class ERBUnlessNode extends Node {
|
|
|
2810
2823
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2811
2824
|
content: this.content ? this.content.toJSON() : null,
|
|
2812
2825
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2826
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2813
2827
|
statements: this.statements.map(node => node.toJSON()),
|
|
2814
2828
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2815
2829
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2822,6 +2836,7 @@ class ERBUnlessNode extends Node {
|
|
|
2822
2836
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2823
2837
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2824
2838
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2839
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2825
2840
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2826
2841
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2827
2842
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2888,6 +2903,7 @@ class ERBInNode extends Node {
|
|
|
2888
2903
|
tag_opening;
|
|
2889
2904
|
content;
|
|
2890
2905
|
tag_closing;
|
|
2906
|
+
then_keyword;
|
|
2891
2907
|
statements;
|
|
2892
2908
|
static get type() {
|
|
2893
2909
|
return "AST_ERB_IN_NODE";
|
|
@@ -2900,6 +2916,7 @@ class ERBInNode extends Node {
|
|
|
2900
2916
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2901
2917
|
content: data.content ? Token.from(data.content) : null,
|
|
2902
2918
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2919
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2903
2920
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2904
2921
|
});
|
|
2905
2922
|
}
|
|
@@ -2908,6 +2925,7 @@ class ERBInNode extends Node {
|
|
|
2908
2925
|
this.tag_opening = props.tag_opening;
|
|
2909
2926
|
this.content = props.content;
|
|
2910
2927
|
this.tag_closing = props.tag_closing;
|
|
2928
|
+
this.then_keyword = props.then_keyword;
|
|
2911
2929
|
this.statements = props.statements;
|
|
2912
2930
|
}
|
|
2913
2931
|
accept(visitor) {
|
|
@@ -2934,6 +2952,7 @@ class ERBInNode extends Node {
|
|
|
2934
2952
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2935
2953
|
content: this.content ? this.content.toJSON() : null,
|
|
2936
2954
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2955
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2937
2956
|
statements: this.statements.map(node => node.toJSON()),
|
|
2938
2957
|
};
|
|
2939
2958
|
}
|
|
@@ -2944,6 +2963,7 @@ class ERBInNode extends Node {
|
|
|
2944
2963
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2945
2964
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2946
2965
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2966
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2947
2967
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2948
2968
|
return output;
|
|
2949
2969
|
}
|
|
@@ -3091,7 +3111,7 @@ class ParseResult extends Result {
|
|
|
3091
3111
|
}
|
|
3092
3112
|
|
|
3093
3113
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3094
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3114
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
3095
3115
|
/**
|
|
3096
3116
|
* Type guard functions for AST nodes.
|
|
3097
3117
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3484,7 +3504,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
|
|
|
3484
3504
|
}
|
|
3485
3505
|
|
|
3486
3506
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3487
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3507
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.8/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3488
3508
|
class Visitor {
|
|
3489
3509
|
visit(node) {
|
|
3490
3510
|
if (!node)
|