@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/loader.cjs
CHANGED
|
@@ -294,7 +294,7 @@ class Token {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
297
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
297
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
298
298
|
class HerbError {
|
|
299
299
|
type;
|
|
300
300
|
message;
|
|
@@ -859,7 +859,7 @@ function convertToUTF8(string) {
|
|
|
859
859
|
}
|
|
860
860
|
|
|
861
861
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
862
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
862
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
863
863
|
class Node {
|
|
864
864
|
type;
|
|
865
865
|
location;
|
|
@@ -1933,6 +1933,7 @@ class ERBIfNode extends Node {
|
|
|
1933
1933
|
tag_opening;
|
|
1934
1934
|
content;
|
|
1935
1935
|
tag_closing;
|
|
1936
|
+
then_keyword;
|
|
1936
1937
|
statements;
|
|
1937
1938
|
subsequent;
|
|
1938
1939
|
end_node;
|
|
@@ -1947,6 +1948,7 @@ class ERBIfNode extends Node {
|
|
|
1947
1948
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
1948
1949
|
content: data.content ? Token.from(data.content) : null,
|
|
1949
1950
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
1951
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
1950
1952
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
1951
1953
|
subsequent: data.subsequent ? fromSerializedNode((data.subsequent)) : null,
|
|
1952
1954
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -1957,6 +1959,7 @@ class ERBIfNode extends Node {
|
|
|
1957
1959
|
this.tag_opening = props.tag_opening;
|
|
1958
1960
|
this.content = props.content;
|
|
1959
1961
|
this.tag_closing = props.tag_closing;
|
|
1962
|
+
this.then_keyword = props.then_keyword;
|
|
1960
1963
|
this.statements = props.statements;
|
|
1961
1964
|
this.subsequent = props.subsequent;
|
|
1962
1965
|
this.end_node = props.end_node;
|
|
@@ -1989,6 +1992,7 @@ class ERBIfNode extends Node {
|
|
|
1989
1992
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
1990
1993
|
content: this.content ? this.content.toJSON() : null,
|
|
1991
1994
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
1995
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
1992
1996
|
statements: this.statements.map(node => node.toJSON()),
|
|
1993
1997
|
subsequent: this.subsequent ? this.subsequent.toJSON() : null,
|
|
1994
1998
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2001,6 +2005,7 @@ class ERBIfNode extends Node {
|
|
|
2001
2005
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2002
2006
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2003
2007
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2008
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2004
2009
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2005
2010
|
output += `├── subsequent: ${this.inspectNode(this.subsequent, "│ ")}`;
|
|
2006
2011
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2082,6 +2087,7 @@ class ERBWhenNode extends Node {
|
|
|
2082
2087
|
tag_opening;
|
|
2083
2088
|
content;
|
|
2084
2089
|
tag_closing;
|
|
2090
|
+
then_keyword;
|
|
2085
2091
|
statements;
|
|
2086
2092
|
static get type() {
|
|
2087
2093
|
return "AST_ERB_WHEN_NODE";
|
|
@@ -2094,6 +2100,7 @@ class ERBWhenNode extends Node {
|
|
|
2094
2100
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2095
2101
|
content: data.content ? Token.from(data.content) : null,
|
|
2096
2102
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2103
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2097
2104
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2098
2105
|
});
|
|
2099
2106
|
}
|
|
@@ -2102,6 +2109,7 @@ class ERBWhenNode extends Node {
|
|
|
2102
2109
|
this.tag_opening = props.tag_opening;
|
|
2103
2110
|
this.content = props.content;
|
|
2104
2111
|
this.tag_closing = props.tag_closing;
|
|
2112
|
+
this.then_keyword = props.then_keyword;
|
|
2105
2113
|
this.statements = props.statements;
|
|
2106
2114
|
}
|
|
2107
2115
|
accept(visitor) {
|
|
@@ -2128,6 +2136,7 @@ class ERBWhenNode extends Node {
|
|
|
2128
2136
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2129
2137
|
content: this.content ? this.content.toJSON() : null,
|
|
2130
2138
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2139
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2131
2140
|
statements: this.statements.map(node => node.toJSON()),
|
|
2132
2141
|
};
|
|
2133
2142
|
}
|
|
@@ -2138,6 +2147,7 @@ class ERBWhenNode extends Node {
|
|
|
2138
2147
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2139
2148
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2140
2149
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2150
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2141
2151
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2142
2152
|
return output;
|
|
2143
2153
|
}
|
|
@@ -2756,6 +2766,7 @@ class ERBUnlessNode extends Node {
|
|
|
2756
2766
|
tag_opening;
|
|
2757
2767
|
content;
|
|
2758
2768
|
tag_closing;
|
|
2769
|
+
then_keyword;
|
|
2759
2770
|
statements;
|
|
2760
2771
|
else_clause;
|
|
2761
2772
|
end_node;
|
|
@@ -2770,6 +2781,7 @@ class ERBUnlessNode extends Node {
|
|
|
2770
2781
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2771
2782
|
content: data.content ? Token.from(data.content) : null,
|
|
2772
2783
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2784
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2773
2785
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2774
2786
|
else_clause: data.else_clause ? fromSerializedNode((data.else_clause)) : null,
|
|
2775
2787
|
end_node: data.end_node ? fromSerializedNode((data.end_node)) : null,
|
|
@@ -2780,6 +2792,7 @@ class ERBUnlessNode extends Node {
|
|
|
2780
2792
|
this.tag_opening = props.tag_opening;
|
|
2781
2793
|
this.content = props.content;
|
|
2782
2794
|
this.tag_closing = props.tag_closing;
|
|
2795
|
+
this.then_keyword = props.then_keyword;
|
|
2783
2796
|
this.statements = props.statements;
|
|
2784
2797
|
this.else_clause = props.else_clause;
|
|
2785
2798
|
this.end_node = props.end_node;
|
|
@@ -2812,6 +2825,7 @@ class ERBUnlessNode extends Node {
|
|
|
2812
2825
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2813
2826
|
content: this.content ? this.content.toJSON() : null,
|
|
2814
2827
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2828
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2815
2829
|
statements: this.statements.map(node => node.toJSON()),
|
|
2816
2830
|
else_clause: this.else_clause ? this.else_clause.toJSON() : null,
|
|
2817
2831
|
end_node: this.end_node ? this.end_node.toJSON() : null,
|
|
@@ -2824,6 +2838,7 @@ class ERBUnlessNode extends Node {
|
|
|
2824
2838
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2825
2839
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2826
2840
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2841
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2827
2842
|
output += `├── statements: ${this.inspectArray(this.statements, "│ ")}`;
|
|
2828
2843
|
output += `├── else_clause: ${this.inspectNode(this.else_clause, "│ ")}`;
|
|
2829
2844
|
output += `└── end_node: ${this.inspectNode(this.end_node, " ")}`;
|
|
@@ -2890,6 +2905,7 @@ class ERBInNode extends Node {
|
|
|
2890
2905
|
tag_opening;
|
|
2891
2906
|
content;
|
|
2892
2907
|
tag_closing;
|
|
2908
|
+
then_keyword;
|
|
2893
2909
|
statements;
|
|
2894
2910
|
static get type() {
|
|
2895
2911
|
return "AST_ERB_IN_NODE";
|
|
@@ -2902,6 +2918,7 @@ class ERBInNode extends Node {
|
|
|
2902
2918
|
tag_opening: data.tag_opening ? Token.from(data.tag_opening) : null,
|
|
2903
2919
|
content: data.content ? Token.from(data.content) : null,
|
|
2904
2920
|
tag_closing: data.tag_closing ? Token.from(data.tag_closing) : null,
|
|
2921
|
+
then_keyword: data.then_keyword ? Location.from(data.then_keyword) : null,
|
|
2905
2922
|
statements: (data.statements || []).map(node => fromSerializedNode(node)),
|
|
2906
2923
|
});
|
|
2907
2924
|
}
|
|
@@ -2910,6 +2927,7 @@ class ERBInNode extends Node {
|
|
|
2910
2927
|
this.tag_opening = props.tag_opening;
|
|
2911
2928
|
this.content = props.content;
|
|
2912
2929
|
this.tag_closing = props.tag_closing;
|
|
2930
|
+
this.then_keyword = props.then_keyword;
|
|
2913
2931
|
this.statements = props.statements;
|
|
2914
2932
|
}
|
|
2915
2933
|
accept(visitor) {
|
|
@@ -2936,6 +2954,7 @@ class ERBInNode extends Node {
|
|
|
2936
2954
|
tag_opening: this.tag_opening ? this.tag_opening.toJSON() : null,
|
|
2937
2955
|
content: this.content ? this.content.toJSON() : null,
|
|
2938
2956
|
tag_closing: this.tag_closing ? this.tag_closing.toJSON() : null,
|
|
2957
|
+
then_keyword: this.then_keyword ? this.then_keyword.toJSON() : null,
|
|
2939
2958
|
statements: this.statements.map(node => node.toJSON()),
|
|
2940
2959
|
};
|
|
2941
2960
|
}
|
|
@@ -2946,6 +2965,7 @@ class ERBInNode extends Node {
|
|
|
2946
2965
|
output += `├── tag_opening: ${this.tag_opening ? this.tag_opening.treeInspect() : "∅"}\n`;
|
|
2947
2966
|
output += `├── content: ${this.content ? this.content.treeInspect() : "∅"}\n`;
|
|
2948
2967
|
output += `├── tag_closing: ${this.tag_closing ? this.tag_closing.treeInspect() : "∅"}\n`;
|
|
2968
|
+
output += `├── then_keyword: ${this.then_keyword ? "(location: " + this.then_keyword.treeInspect() + ")" : "∅"}\n`;
|
|
2949
2969
|
output += `└── statements: ${this.inspectArray(this.statements, " ")}`;
|
|
2950
2970
|
return output;
|
|
2951
2971
|
}
|
|
@@ -3093,7 +3113,7 @@ class ParseResult extends Result {
|
|
|
3093
3113
|
}
|
|
3094
3114
|
|
|
3095
3115
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3096
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3116
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
3097
3117
|
/**
|
|
3098
3118
|
* Type guard functions for AST nodes.
|
|
3099
3119
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3486,7 +3506,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
|
|
|
3486
3506
|
}
|
|
3487
3507
|
|
|
3488
3508
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3489
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3509
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3490
3510
|
class Visitor {
|
|
3491
3511
|
visit(node) {
|
|
3492
3512
|
if (!node)
|