@ripple-ts/prettier-plugin 0.2.210 → 0.2.212

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/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # @ripple-ts/prettier-plugin
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/%40ripple-ts%2Fprettier-plugin?logo=npm)](https://www.npmjs.com/package/@ripple-ts/prettier-plugin)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40ripple-ts%2Fprettier-plugin?logo=npm&label=downloads)](https://www.npmjs.com/package/@ripple-ts/prettier-plugin)
5
+
3
6
  A Prettier plugin for formatting [Ripple](https://github.com/Ripple-TS/ripple)
4
7
  `.ripple` files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ripple-ts/prettier-plugin",
3
- "version": "0.2.210",
3
+ "version": "0.2.212",
4
4
  "description": "Ripple plugin for Prettier",
5
5
  "type": "module",
6
6
  "module": "src/index.js",
@@ -27,7 +27,7 @@
27
27
  "@types/estree": "^1.0.8",
28
28
  "@types/estree-jsx": "^1.0.5",
29
29
  "prettier": "^3.6.2",
30
- "ripple": "0.2.210"
30
+ "ripple": "0.2.212"
31
31
  },
32
32
  "dependencies": {},
33
33
  "files": [
package/src/index.js CHANGED
@@ -1596,6 +1596,18 @@ function printRippleNode(node, path, options, print, args) {
1596
1596
  break;
1597
1597
  }
1598
1598
 
1599
+ case 'StyleSheet': {
1600
+ // StyleSheet nodes inside <style> elements. When CSS is empty/whitespace-only,
1601
+ // return empty string so the element collapses to <style></style>.
1602
+ // Non-empty stylesheets are normally handled by embed() using textToDoc with the CSS parser.
1603
+ if (!node.source || !node.source.trim()) {
1604
+ nodeContent = '';
1605
+ } else {
1606
+ nodeContent = node.source.trim();
1607
+ }
1608
+ break;
1609
+ }
1610
+
1599
1611
  case 'ServerIdentifier': {
1600
1612
  nodeContent = '#server';
1601
1613
  break;
package/src/index.test.js CHANGED
@@ -1236,6 +1236,21 @@ const [obj1, obj2] = arrayOfObjects;`;
1236
1236
  expect(result).toBeWithNewline(expected);
1237
1237
  });
1238
1238
 
1239
+ it('should not mangle empty stylesheet tags <style></style>', async () => {
1240
+ const input = `component App() {
1241
+ <style>
1242
+
1243
+ </style>
1244
+ }`;
1245
+
1246
+ const expected = `component App() {
1247
+ <style></style>
1248
+ }`;
1249
+
1250
+ const result = await format(input, { singleQuote: true, printWidth: 100 });
1251
+ expect(result).toBeWithNewline(expected);
1252
+ });
1253
+
1239
1254
  it('should keep TrackedMap short syntax intact', async () => {
1240
1255
  const expected = `const map = new #Map([['key1', 'value1'], ['key2', 'value2']]);
1241
1256
  const set = new #Set([1, 2, 3]);`;