@herb-tools/printer 0.6.0 → 0.6.1

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.
@@ -0,0 +1,229 @@
1
+ import { IdentityPrinter } from "./identity-printer.js";
2
+ import { DEFAULT_PRINT_OPTIONS } from "./printer.js";
3
+ import { isERBOutputNode, filterNodes, ERBContentNode, } from "@herb-tools/core";
4
+ export const DEFAULT_ERB_TO_RUBY_STRING_OPTIONS = {
5
+ ...DEFAULT_PRINT_OPTIONS,
6
+ forceQuotes: false
7
+ };
8
+ /**
9
+ * ERBToRubyStringPrinter - Converts ERB snippets to Ruby strings with interpolation
10
+ *
11
+ * This printer transforms ERB templates into Ruby strings by:
12
+ * - Converting literal text to string content
13
+ * - Converting <%= %> tags to #{} interpolation
14
+ * - Converting simple if/else blocks to ternary operators
15
+ * - Ignoring <% %> tags (they don't produce output)
16
+ *
17
+ * Examples:
18
+ * - `hello world <%= hello %>` => `"hello world #{hello}"`
19
+ * - `hello world <% hello %>` => `"hello world "`
20
+ * - `Welcome <%= user.name %>!` => `"Welcome #{user.name}!"`
21
+ * - `<% if logged_in? %>Welcome<% else %>Login<% end %>` => `"logged_in? ? "Welcome" : "Login"`
22
+ * - `<% if logged_in? %>Welcome<% else %>Login<% end %>!` => `"#{logged_in? ? "Welcome" : "Login"}!"`
23
+ */
24
+ export class ERBToRubyStringPrinter extends IdentityPrinter {
25
+ // TODO: cleanup `.type === "AST_*" checks`
26
+ static print(node, options = DEFAULT_ERB_TO_RUBY_STRING_OPTIONS) {
27
+ const erbNodes = filterNodes([node], ERBContentNode);
28
+ if (erbNodes.length === 1 && isERBOutputNode(erbNodes[0]) && !options.forceQuotes) {
29
+ return (erbNodes[0].content?.value || "").trim();
30
+ }
31
+ if ('children' in node && Array.isArray(node.children)) {
32
+ const childErbNodes = filterNodes(node.children, ERBContentNode);
33
+ const hasOnlyERBContent = node.children.length > 0 && node.children.length === childErbNodes.length;
34
+ if (hasOnlyERBContent && childErbNodes.length === 1 && isERBOutputNode(childErbNodes[0]) && !options.forceQuotes) {
35
+ return (childErbNodes[0].content?.value || "").trim();
36
+ }
37
+ if (node.children.length === 1 && node.children[0].type === "AST_ERB_IF_NODE" && !options.forceQuotes) {
38
+ const ifNode = node.children[0];
39
+ const printer = new ERBToRubyStringPrinter();
40
+ if (printer.canConvertToTernary(ifNode)) {
41
+ printer.convertToTernaryWithoutWrapper(ifNode);
42
+ return printer.context.getOutput();
43
+ }
44
+ }
45
+ if (node.children.length === 1 && node.children[0].type === "AST_ERB_UNLESS_NODE" && !options.forceQuotes) {
46
+ const unlessNode = node.children[0];
47
+ const printer = new ERBToRubyStringPrinter();
48
+ if (printer.canConvertUnlessToTernary(unlessNode)) {
49
+ printer.convertUnlessToTernaryWithoutWrapper(unlessNode);
50
+ return printer.context.getOutput();
51
+ }
52
+ }
53
+ }
54
+ const printer = new ERBToRubyStringPrinter();
55
+ printer.context.write('"');
56
+ printer.visit(node);
57
+ printer.context.write('"');
58
+ return printer.context.getOutput();
59
+ }
60
+ visitHTMLTextNode(node) {
61
+ if (node.content) {
62
+ const escapedContent = node.content.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
63
+ this.context.write(escapedContent);
64
+ }
65
+ }
66
+ visitERBContentNode(node) {
67
+ if (isERBOutputNode(node)) {
68
+ this.context.write("#{");
69
+ if (node.content?.value) {
70
+ this.context.write(node.content.value.trim());
71
+ }
72
+ this.context.write("}");
73
+ }
74
+ }
75
+ visitERBIfNode(node) {
76
+ if (this.canConvertToTernary(node)) {
77
+ this.convertToTernary(node);
78
+ }
79
+ }
80
+ visitERBUnlessNode(node) {
81
+ if (this.canConvertUnlessToTernary(node)) {
82
+ this.convertUnlessToTernary(node);
83
+ }
84
+ }
85
+ visitHTMLAttributeValueNode(node) {
86
+ this.visitChildNodes(node);
87
+ }
88
+ canConvertToTernary(node) {
89
+ if (node.subsequent && node.subsequent.type !== "AST_ERB_ELSE_NODE") {
90
+ return false;
91
+ }
92
+ const ifOnlyText = node.statements ? node.statements.every(statement => statement.type === "AST_HTML_TEXT_NODE") : true;
93
+ if (!ifOnlyText)
94
+ return false;
95
+ if (node.subsequent && node.subsequent.type === "AST_ERB_ELSE_NODE") {
96
+ return node.subsequent.statements
97
+ ? node.subsequent.statements.every(statement => statement.type === "AST_HTML_TEXT_NODE")
98
+ : true;
99
+ }
100
+ return true;
101
+ }
102
+ convertToTernary(node) {
103
+ this.context.write("#{");
104
+ if (node.content?.value) {
105
+ const condition = node.content.value.trim();
106
+ const cleanCondition = condition.replace(/^if\s+/, '');
107
+ const needsParentheses = cleanCondition.includes(' ');
108
+ if (needsParentheses) {
109
+ this.context.write("(");
110
+ }
111
+ this.context.write(cleanCondition);
112
+ if (needsParentheses) {
113
+ this.context.write(")");
114
+ }
115
+ }
116
+ this.context.write(" ? ");
117
+ this.context.write('"');
118
+ if (node.statements) {
119
+ node.statements.forEach(statement => this.visit(statement));
120
+ }
121
+ this.context.write('"');
122
+ this.context.write(" : ");
123
+ this.context.write('"');
124
+ if (node.subsequent && node.subsequent.type === "AST_ERB_ELSE_NODE" && node.subsequent.statements) {
125
+ node.subsequent.statements.forEach(statement => this.visit(statement));
126
+ }
127
+ this.context.write('"');
128
+ this.context.write("}");
129
+ }
130
+ convertToTernaryWithoutWrapper(node) {
131
+ if (node.subsequent && node.subsequent.type !== "AST_ERB_ELSE_NODE") {
132
+ return false;
133
+ }
134
+ if (node.content?.value) {
135
+ const condition = node.content.value.trim();
136
+ const cleanCondition = condition.replace(/^if\s+/, '');
137
+ const needsParentheses = cleanCondition.includes(' ');
138
+ if (needsParentheses) {
139
+ this.context.write("(");
140
+ }
141
+ this.context.write(cleanCondition);
142
+ if (needsParentheses) {
143
+ this.context.write(")");
144
+ }
145
+ }
146
+ this.context.write(" ? ");
147
+ this.context.write('"');
148
+ if (node.statements) {
149
+ node.statements.forEach(statement => this.visit(statement));
150
+ }
151
+ this.context.write('"');
152
+ this.context.write(" : ");
153
+ this.context.write('"');
154
+ if (node.subsequent && node.subsequent.type === "AST_ERB_ELSE_NODE" && node.subsequent.statements) {
155
+ node.subsequent.statements.forEach(statement => this.visit(statement));
156
+ }
157
+ this.context.write('"');
158
+ }
159
+ canConvertUnlessToTernary(node) {
160
+ const unlessOnlyText = node.statements ? node.statements.every(statement => statement.type === "AST_HTML_TEXT_NODE") : true;
161
+ if (!unlessOnlyText)
162
+ return false;
163
+ if (node.else_clause && node.else_clause.type === "AST_ERB_ELSE_NODE") {
164
+ return node.else_clause.statements
165
+ ? node.else_clause.statements.every(statement => statement.type === "AST_HTML_TEXT_NODE")
166
+ : true;
167
+ }
168
+ return true;
169
+ }
170
+ convertUnlessToTernary(node) {
171
+ this.context.write("#{");
172
+ if (node.content?.value) {
173
+ const condition = node.content.value.trim();
174
+ const cleanCondition = condition.replace(/^unless\s+/, '');
175
+ const needsParentheses = cleanCondition.includes(' ');
176
+ this.context.write("!(");
177
+ if (needsParentheses) {
178
+ this.context.write("(");
179
+ }
180
+ this.context.write(cleanCondition);
181
+ if (needsParentheses) {
182
+ this.context.write(")");
183
+ }
184
+ this.context.write(")");
185
+ }
186
+ this.context.write(" ? ");
187
+ this.context.write('"');
188
+ if (node.statements) {
189
+ node.statements.forEach(statement => this.visit(statement));
190
+ }
191
+ this.context.write('"');
192
+ this.context.write(" : ");
193
+ this.context.write('"');
194
+ if (node.else_clause && node.else_clause.type === "AST_ERB_ELSE_NODE") {
195
+ node.else_clause.statements.forEach(statement => this.visit(statement));
196
+ }
197
+ this.context.write('"');
198
+ this.context.write("}");
199
+ }
200
+ convertUnlessToTernaryWithoutWrapper(node) {
201
+ if (node.content?.value) {
202
+ const condition = node.content.value.trim();
203
+ const cleanCondition = condition.replace(/^unless\s+/, '');
204
+ const needsParentheses = cleanCondition.includes(' ');
205
+ this.context.write("!(");
206
+ if (needsParentheses) {
207
+ this.context.write("(");
208
+ }
209
+ this.context.write(cleanCondition);
210
+ if (needsParentheses) {
211
+ this.context.write(")");
212
+ }
213
+ this.context.write(")");
214
+ }
215
+ this.context.write(" ? ");
216
+ this.context.write('"');
217
+ if (node.statements) {
218
+ node.statements.forEach(statement => this.visit(statement));
219
+ }
220
+ this.context.write('"');
221
+ this.context.write(" : ");
222
+ this.context.write('"');
223
+ if (node.else_clause && node.else_clause.type === "AST_ERB_ELSE_NODE") {
224
+ node.else_clause.statements.forEach(statement => this.visit(statement));
225
+ }
226
+ this.context.write('"');
227
+ }
228
+ }
229
+ //# sourceMappingURL=erb-to-ruby-string-printer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erb-to-ruby-string-printer.js","sourceRoot":"","sources":["../src/erb-to-ruby-string-printer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAgB,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,GAAG,MAAM,kBAAkB,CAAA;AAYhF,MAAM,CAAC,MAAM,kCAAkC,GAA2B;IACxE,GAAG,qBAAqB;IACxB,WAAW,EAAE,KAAK;CACnB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IAEzD,2CAA2C;IAC3C,MAAM,CAAC,KAAK,CAAC,IAAU,EAAE,UAA2C,kCAAkC;QACpG,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAA;QAEpD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAClF,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;QAClD,CAAC;QAED,IAAI,UAAU,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAA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