esrap 1.4.2 → 1.4.4
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/package.json +1 -1
- package/src/handlers.js +18 -0
package/package.json
CHANGED
package/src/handlers.js
CHANGED
|
@@ -129,6 +129,8 @@ function quote(string, char) {
|
|
|
129
129
|
out += '\\' + c;
|
|
130
130
|
} else if (c === '\n') {
|
|
131
131
|
out += '\\n';
|
|
132
|
+
} else if (c === '\r') {
|
|
133
|
+
out += '\\r';
|
|
132
134
|
} else {
|
|
133
135
|
out += c;
|
|
134
136
|
}
|
|
@@ -1504,6 +1506,22 @@ const handlers = {
|
|
|
1504
1506
|
state.commands.push(dedent, newline, '}', newline);
|
|
1505
1507
|
},
|
|
1506
1508
|
|
|
1509
|
+
TSModuleBlock(node, state) {
|
|
1510
|
+
state.commands.push(' {', indent, newline);
|
|
1511
|
+
sequence(node.body, state, false, handle);
|
|
1512
|
+
state.commands.push(dedent, newline, '}');
|
|
1513
|
+
},
|
|
1514
|
+
|
|
1515
|
+
TSModuleDeclaration(node, state) {
|
|
1516
|
+
if (node.declare) state.commands.push('declare ');
|
|
1517
|
+
else state.commands.push('namespace ');
|
|
1518
|
+
|
|
1519
|
+
handle(node.id, state);
|
|
1520
|
+
|
|
1521
|
+
if (!node.body) return;
|
|
1522
|
+
handle(node.body, state);
|
|
1523
|
+
},
|
|
1524
|
+
|
|
1507
1525
|
TSNonNullExpression(node, state) {
|
|
1508
1526
|
handle(node.expression, state);
|
|
1509
1527
|
state.commands.push('!');
|