@tsrx/prettier-plugin 0.3.42 → 0.3.44
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 +4 -4
- package/src/index.js +29 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsrx/prettier-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.44",
|
|
4
4
|
"description": "Ripple plugin for Prettier",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^24.3.0",
|
|
28
28
|
"prettier": "^3.8.3",
|
|
29
|
-
"ripple": "0.3.
|
|
29
|
+
"ripple": "0.3.44"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tsrx/core": "0.0.
|
|
33
|
-
"@tsrx/ripple": "0.0.
|
|
32
|
+
"@tsrx/core": "0.0.24",
|
|
33
|
+
"@tsrx/ripple": "0.0.26"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"src/"
|
package/src/index.js
CHANGED
|
@@ -1427,8 +1427,8 @@ function printRippleNode(node, path, options, print, args) {
|
|
|
1427
1427
|
break;
|
|
1428
1428
|
}
|
|
1429
1429
|
|
|
1430
|
-
case '
|
|
1431
|
-
nodeContent = '
|
|
1430
|
+
case 'Style': {
|
|
1431
|
+
nodeContent = ['style ', path.call(print, 'value')];
|
|
1432
1432
|
break;
|
|
1433
1433
|
}
|
|
1434
1434
|
|
|
@@ -1444,11 +1444,6 @@ function printRippleNode(node, path, options, print, args) {
|
|
|
1444
1444
|
break;
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
|
-
case 'ServerIdentifier': {
|
|
1448
|
-
nodeContent = '#server';
|
|
1449
|
-
break;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
1447
|
case 'UnaryExpression':
|
|
1453
1448
|
nodeContent = printUnaryExpression(node, path, options, print);
|
|
1454
1449
|
break;
|
|
@@ -1695,15 +1690,17 @@ function printRippleNode(node, path, options, print, args) {
|
|
|
1695
1690
|
nodeContent = printFunctionExpression(node, path, options, print);
|
|
1696
1691
|
break;
|
|
1697
1692
|
|
|
1693
|
+
case 'TSModuleBlock':
|
|
1698
1694
|
case 'BlockStatement': {
|
|
1699
1695
|
// Apply the same block formatting pattern as component bodies
|
|
1700
1696
|
if (!node.body || node.body.length === 0) {
|
|
1701
1697
|
// Handle innerComments for empty blocks
|
|
1702
1698
|
if (innerCommentParts.length > 0) {
|
|
1699
|
+
const blockNode = /** @type {AST.BlockStatement} */ (node);
|
|
1703
1700
|
// Check if we need to preserve blank lines between comments
|
|
1704
|
-
if (
|
|
1701
|
+
if (blockNode.innerComments && blockNode.innerComments.length > 0) {
|
|
1705
1702
|
const commentDocs = [];
|
|
1706
|
-
const comments =
|
|
1703
|
+
const comments = blockNode.innerComments;
|
|
1707
1704
|
|
|
1708
1705
|
for (let i = 0; i < comments.length; i++) {
|
|
1709
1706
|
const comment = comments[i];
|
|
@@ -1804,9 +1801,14 @@ function printRippleNode(node, path, options, print, args) {
|
|
|
1804
1801
|
break;
|
|
1805
1802
|
}
|
|
1806
1803
|
|
|
1807
|
-
case '
|
|
1808
|
-
|
|
1809
|
-
|
|
1804
|
+
case 'TSModuleDeclaration': {
|
|
1805
|
+
nodeContent = [
|
|
1806
|
+
node.metadata?.module_keyword ?? 'module',
|
|
1807
|
+
' ',
|
|
1808
|
+
path.call(print, 'id'),
|
|
1809
|
+
' ',
|
|
1810
|
+
path.call(print, 'body'),
|
|
1811
|
+
];
|
|
1810
1812
|
break;
|
|
1811
1813
|
}
|
|
1812
1814
|
|
|
@@ -2387,11 +2389,13 @@ function printImportDeclaration(node, path, options, _print) {
|
|
|
2387
2389
|
parts.push(' from');
|
|
2388
2390
|
}
|
|
2389
2391
|
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2392
|
+
const source = /** @type {AST.Literal | AST.Identifier} */ (/** @type {unknown} */ (node.source));
|
|
2393
|
+
const sourceDoc =
|
|
2394
|
+
source.type === 'Identifier'
|
|
2395
|
+
? source.name
|
|
2396
|
+
: formatStringLiteral(/** @type {string} */ (source.value), options);
|
|
2397
|
+
|
|
2398
|
+
parts.push(' ', sourceDoc, semi(options));
|
|
2395
2399
|
|
|
2396
2400
|
return parts;
|
|
2397
2401
|
}
|
|
@@ -2430,8 +2434,15 @@ function printExportNamedDeclaration(node, path, options, print) {
|
|
|
2430
2434
|
parts.push(' }');
|
|
2431
2435
|
|
|
2432
2436
|
if (node.source) {
|
|
2437
|
+
const source = /** @type {AST.Literal | AST.Identifier} */ (
|
|
2438
|
+
/** @type {unknown} */ (node.source)
|
|
2439
|
+
);
|
|
2433
2440
|
parts.push(' from ');
|
|
2434
|
-
parts.push(
|
|
2441
|
+
parts.push(
|
|
2442
|
+
source.type === 'Identifier'
|
|
2443
|
+
? source.name
|
|
2444
|
+
: formatStringLiteral(/** @type {string} */ (source.value), options),
|
|
2445
|
+
);
|
|
2435
2446
|
}
|
|
2436
2447
|
parts.push(semi(options));
|
|
2437
2448
|
|