@runtime-type-inspector/transpiler 2.0.4 → 2.0.6
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/index.cjs +20 -7
- package/index.mjs +21 -8
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -562,11 +562,11 @@
|
|
|
562
562
|
key: "toSource",
|
|
563
563
|
value: function toSource(node) {
|
|
564
564
|
var _node$extra;
|
|
565
|
-
var leadingComments = node.leadingComments,
|
|
566
|
-
trailingComments = node.trailingComments;
|
|
567
565
|
if (node === null) {
|
|
568
566
|
return '';
|
|
569
567
|
}
|
|
568
|
+
var leadingComments = node.leadingComments,
|
|
569
|
+
trailingComments = node.trailingComments;
|
|
570
570
|
if (node.type === 'File') {
|
|
571
571
|
this.parents.length = 0;
|
|
572
572
|
}
|
|
@@ -587,7 +587,7 @@
|
|
|
587
587
|
try {
|
|
588
588
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
589
589
|
var trailingComment = _step.value;
|
|
590
|
-
out +=
|
|
590
|
+
out += this.toSource(trailingComment);
|
|
591
591
|
}
|
|
592
592
|
} catch (err) {
|
|
593
593
|
_iterator.e(err);
|
|
@@ -1581,11 +1581,16 @@
|
|
|
1581
1581
|
}, {
|
|
1582
1582
|
key: "CommentBlock",
|
|
1583
1583
|
value: function CommentBlock(node) {
|
|
1584
|
-
var value = node.value
|
|
1584
|
+
var value = node.value,
|
|
1585
|
+
loc = node.loc;
|
|
1585
1586
|
var spaces = this.spaces,
|
|
1586
1587
|
parents = this.parents;
|
|
1587
1588
|
var par = parents[parents.length - 3];
|
|
1588
|
-
var out =
|
|
1589
|
+
var out = '';
|
|
1590
|
+
if (!loc.start.column) {
|
|
1591
|
+
out += '\n' + this.spaces;
|
|
1592
|
+
}
|
|
1593
|
+
out += "".concat(spaces, "/*");
|
|
1589
1594
|
if (value.includes('\n')) {
|
|
1590
1595
|
value = trimEndSpaces(value.replace(/^\s*\*/gm, '*')).split('\n').filter(function (_) {
|
|
1591
1596
|
return _.length;
|
|
@@ -1604,8 +1609,16 @@
|
|
|
1604
1609
|
}, {
|
|
1605
1610
|
key: "CommentLine",
|
|
1606
1611
|
value: function CommentLine(node) {
|
|
1607
|
-
var value = node.value
|
|
1608
|
-
|
|
1612
|
+
var value = node.value,
|
|
1613
|
+
loc = node.loc;
|
|
1614
|
+
var out = '';
|
|
1615
|
+
if (!loc.start.column) {
|
|
1616
|
+
out += '\n' + this.spaces;
|
|
1617
|
+
} else {
|
|
1618
|
+
out += ' ';
|
|
1619
|
+
}
|
|
1620
|
+
out += "//".concat(value, "\n");
|
|
1621
|
+
return out;
|
|
1609
1622
|
}
|
|
1610
1623
|
}, {
|
|
1611
1624
|
key: "Import",
|
package/index.mjs
CHANGED
|
@@ -283,13 +283,13 @@ class Stringifier {
|
|
|
283
283
|
}
|
|
284
284
|
toSource(node) {
|
|
285
285
|
var _node$extra;
|
|
286
|
+
if (node === null) {
|
|
287
|
+
return '';
|
|
288
|
+
}
|
|
286
289
|
const {
|
|
287
290
|
leadingComments,
|
|
288
291
|
trailingComments
|
|
289
292
|
} = node;
|
|
290
|
-
if (node === null) {
|
|
291
|
-
return '';
|
|
292
|
-
}
|
|
293
293
|
if (node.type === 'File') {
|
|
294
294
|
this.parents.length = 0;
|
|
295
295
|
}
|
|
@@ -306,7 +306,7 @@ class Stringifier {
|
|
|
306
306
|
}
|
|
307
307
|
if (trailingComments) {
|
|
308
308
|
for (const trailingComment of trailingComments) {
|
|
309
|
-
out +=
|
|
309
|
+
out += this.toSource(trailingComment);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
this.parents.pop();
|
|
@@ -1280,14 +1280,19 @@ class Stringifier {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
CommentBlock(node) {
|
|
1282
1282
|
let {
|
|
1283
|
-
value
|
|
1283
|
+
value,
|
|
1284
|
+
loc
|
|
1284
1285
|
} = node;
|
|
1285
1286
|
const {
|
|
1286
1287
|
spaces,
|
|
1287
1288
|
parents
|
|
1288
1289
|
} = this;
|
|
1289
1290
|
const par = parents[parents.length - 3];
|
|
1290
|
-
let out =
|
|
1291
|
+
let out = '';
|
|
1292
|
+
if (!loc.start.column) {
|
|
1293
|
+
out += '\n' + this.spaces;
|
|
1294
|
+
}
|
|
1295
|
+
out += `${spaces}/*`;
|
|
1291
1296
|
if (value.includes('\n')) {
|
|
1292
1297
|
value = trimEndSpaces(value.replace(/^\s*\*/gm, '*')).split('\n').filter(_ => _.length).map((line, i) => (i ? spaces + ' ' : '') + line).join('\n');
|
|
1293
1298
|
out += `${value}\n${spaces} */`;
|
|
@@ -1301,9 +1306,17 @@ class Stringifier {
|
|
|
1301
1306
|
}
|
|
1302
1307
|
CommentLine(node) {
|
|
1303
1308
|
const {
|
|
1304
|
-
value
|
|
1309
|
+
value,
|
|
1310
|
+
loc
|
|
1305
1311
|
} = node;
|
|
1306
|
-
|
|
1312
|
+
let out = '';
|
|
1313
|
+
if (!loc.start.column) {
|
|
1314
|
+
out += '\n' + this.spaces;
|
|
1315
|
+
} else {
|
|
1316
|
+
out += ' ';
|
|
1317
|
+
}
|
|
1318
|
+
out += `//${value}\n`;
|
|
1319
|
+
return out;
|
|
1307
1320
|
}
|
|
1308
1321
|
Import(node) {
|
|
1309
1322
|
return 'import';
|
package/package.json
CHANGED