@ripple-ts/prettier-plugin 0.3.2 → 0.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ripple-ts/prettier-plugin",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Ripple plugin for Prettier",
5
5
  "type": "module",
6
6
  "module": "src/index.js",
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@types/node": "^24.3.0",
28
28
  "prettier": "^3.8.1",
29
- "ripple": "0.3.2"
29
+ "ripple": "0.3.4"
30
30
  },
31
31
  "dependencies": {},
32
32
  "files": [
package/src/index.js CHANGED
@@ -638,33 +638,6 @@ function shouldPrintComma(options, level = 'all') {
638
638
  }
639
639
  }
640
640
 
641
- /**
642
- * Check whether a tracked array/object node used long #ripple.<kind>(...) syntax.
643
- * @param {AST.RippleArrayExpression | AST.RippleObjectExpression} node - The tracked node
644
- * @param {RippleFormatOptions} options - Prettier options
645
- * @param {'array' | 'object'} kind - Tracked structure kind
646
- * @returns {boolean}
647
- */
648
- function uses_long_tracked_syntax(node, options, kind) {
649
- if (!options || typeof options.originalText !== 'string') {
650
- return false;
651
- }
652
-
653
- if (
654
- typeof node.start !== 'number' ||
655
- typeof node.end !== 'number' ||
656
- node.start < 0 ||
657
- node.end <= node.start
658
- ) {
659
- return false;
660
- }
661
-
662
- const node_text = options.originalText.slice(node.start, node.end);
663
- return kind === 'array'
664
- ? /^#ripple\.array\s*\(/.test(node_text)
665
- : /^#ripple\.object\s*\(/.test(node_text);
666
- }
667
-
668
641
  /**
669
642
  * Check if a leading comment can be attached to the previous element
670
643
  * @param {AST.Comment} comment - The comment node
@@ -953,13 +926,9 @@ function printRippleNode(node, path, options, print, args) {
953
926
  nodeContent = printTryStatement(node, path, options, print);
954
927
  break;
955
928
 
956
- case 'ArrayExpression':
957
- case 'RippleArrayExpression': {
958
- const is_ripple_array = node.type === 'RippleArrayExpression';
959
- const prefix = is_ripple_array ? '#ripple' : '';
960
-
929
+ case 'ArrayExpression': {
961
930
  if (!node.elements || node.elements.length === 0) {
962
- nodeContent = prefix + '[]';
931
+ nodeContent = '[]';
963
932
  break;
964
933
  }
965
934
 
@@ -1083,7 +1052,7 @@ function printRippleNode(node, path, options, print, args) {
1083
1052
  const separator = [',', line];
1084
1053
  const trailing = shouldUseTrailingComma ? ifBreak(',', '') : '';
1085
1054
  nodeContent = group([
1086
- prefix + '[',
1055
+ '[',
1087
1056
  indent([softline, join(separator, elements), trailing]),
1088
1057
  softline,
1089
1058
  ']',
@@ -1183,7 +1152,7 @@ function printRippleNode(node, path, options, print, args) {
1183
1152
  const separator = [',', hardline];
1184
1153
  const trailingDoc = shouldUseTrailingComma ? ',' : '';
1185
1154
  nodeContent = group([
1186
- prefix + '[',
1155
+ '[',
1187
1156
  indent([hardline, join(separator, elements), trailingDoc]),
1188
1157
  hardline,
1189
1158
  ']',
@@ -1243,12 +1212,7 @@ function printRippleNode(node, path, options, print, args) {
1243
1212
  }
1244
1213
 
1245
1214
  const trailingDoc = shouldUseTrailingComma ? ifBreak(',', '') : '';
1246
- nodeContent = group([
1247
- prefix + '[',
1248
- indent([softline, fill(fillParts), trailingDoc]),
1249
- softline,
1250
- ']',
1251
- ]);
1215
+ nodeContent = group(['[', indent([softline, fill(fillParts), trailingDoc]), softline, ']']);
1252
1216
  break;
1253
1217
  }
1254
1218
 
@@ -1263,7 +1227,7 @@ function printRippleNode(node, path, options, print, args) {
1263
1227
  }
1264
1228
  const trailingDoc = shouldUseTrailingComma ? ifBreak(',', '') : '';
1265
1229
  nodeContent = group([
1266
- prefix + '[',
1230
+ '[',
1267
1231
  indent([softline, join(separator, parts), trailingDoc]),
1268
1232
  softline,
1269
1233
  ']',
@@ -1287,7 +1251,7 @@ function printRippleNode(node, path, options, print, args) {
1287
1251
  const separator = [',', hardline];
1288
1252
  const trailingDoc = shouldUseTrailingComma ? ifBreak(',', '') : '';
1289
1253
  nodeContent = group([
1290
- prefix + '[',
1254
+ '[',
1291
1255
  indent([hardline, join(separator, inlineElements), trailingDoc]),
1292
1256
  hardline,
1293
1257
  ']',
@@ -1362,12 +1326,11 @@ function printRippleNode(node, path, options, print, args) {
1362
1326
 
1363
1327
  // Array with blank lines - format as multi-line
1364
1328
  // Use simple group that will break to fit within printWidth
1365
- nodeContent = group([prefix + '[', indent([line, contentParts]), line, ']']);
1329
+ nodeContent = group(['[', indent([line, contentParts]), line, ']']);
1366
1330
  break;
1367
1331
  }
1368
1332
 
1369
1333
  case 'ObjectExpression':
1370
- case 'RippleObjectExpression':
1371
1334
  nodeContent = printObjectExpression(node, path, options, print, args);
1372
1335
  break;
1373
1336
 
@@ -1495,7 +1458,7 @@ function printRippleNode(node, path, options, print, args) {
1495
1458
  }
1496
1459
 
1497
1460
  case 'StyleIdentifier': {
1498
- nodeContent = '#ripple.style';
1461
+ nodeContent = '#style';
1499
1462
  break;
1500
1463
  }
1501
1464
 
@@ -1512,7 +1475,7 @@ function printRippleNode(node, path, options, print, args) {
1512
1475
  }
1513
1476
 
1514
1477
  case 'ServerIdentifier': {
1515
- nodeContent = '#ripple.server';
1478
+ nodeContent = '#server';
1516
1479
  break;
1517
1480
  }
1518
1481
 
@@ -1692,9 +1655,7 @@ function printRippleNode(node, path, options, print, args) {
1692
1655
 
1693
1656
  case 'ExpressionStatement': {
1694
1657
  // Object literals at statement position need parentheses to avoid ambiguity with blocks
1695
- const needsParens =
1696
- node.expression.type === 'ObjectExpression' ||
1697
- node.expression.type === 'RippleObjectExpression';
1658
+ const needsParens = node.expression.type === 'ObjectExpression';
1698
1659
  if (needsParens) {
1699
1660
  nodeContent = ['(', path.call(print, 'expression'), ')', semi(options)];
1700
1661
  } else {
@@ -1715,23 +1676,18 @@ function printRippleNode(node, path, options, print, args) {
1715
1676
 
1716
1677
  case 'Identifier': {
1717
1678
  // Simple case - just return the name directly like Prettier core
1718
- const source_name = node.metadata?.source_name;
1719
- const identifier_name =
1720
- typeof source_name === 'string' && source_name.startsWith('#ripple.')
1721
- ? source_name
1722
- : node.name;
1723
1679
  const trackedPrefix = node.tracked ? '@' : '';
1724
1680
  let identifierContent;
1725
1681
  if (node.typeAnnotation) {
1726
1682
  const optionalMarker = node.optional ? '?' : '';
1727
1683
  identifierContent = [
1728
- trackedPrefix + identifier_name,
1684
+ trackedPrefix + node.name,
1729
1685
  optionalMarker,
1730
1686
  ': ',
1731
1687
  path.call(print, 'typeAnnotation'),
1732
1688
  ];
1733
1689
  } else {
1734
- identifierContent = trackedPrefix + identifier_name;
1690
+ identifierContent = trackedPrefix + node.name;
1735
1691
  }
1736
1692
  // Preserve parentheses for type-cast identifiers, but only if:
1737
1693
  // 1. The identifier itself is marked as parenthesized
@@ -1880,7 +1836,7 @@ function printRippleNode(node, path, options, print, args) {
1880
1836
 
1881
1837
  case 'ServerBlock': {
1882
1838
  const blockContent = path.call(print, 'body');
1883
- nodeContent = ['#ripple.server ', blockContent];
1839
+ nodeContent = ['#server ', blockContent];
1884
1840
  break;
1885
1841
  }
1886
1842
 
@@ -2080,11 +2036,15 @@ function printRippleNode(node, path, options, print, args) {
2080
2036
  break;
2081
2037
 
2082
2038
  case 'ObjectPattern':
2083
- nodeContent = printObjectPattern(node, path, options, print);
2039
+ nodeContent = node.lazy
2040
+ ? ['&', printObjectPattern(node, path, options, print)]
2041
+ : printObjectPattern(node, path, options, print);
2084
2042
  break;
2085
2043
 
2086
2044
  case 'ArrayPattern':
2087
- nodeContent = printArrayPattern(node, path, options, print);
2045
+ nodeContent = node.lazy
2046
+ ? ['&', printArrayPattern(node, path, options, print)]
2047
+ : printArrayPattern(node, path, options, print);
2088
2048
  break;
2089
2049
 
2090
2050
  case 'Property':
@@ -3005,10 +2965,7 @@ function printCallArguments(path, options, print) {
3005
2965
  const finalArg = args[args.length - 1];
3006
2966
  const couldExpandLastArg =
3007
2967
  finalArg &&
3008
- (finalArg.type === 'ObjectExpression' ||
3009
- finalArg.type === 'RippleObjectExpression' ||
3010
- finalArg.type === 'ArrayExpression' ||
3011
- finalArg.type === 'RippleArrayExpression') &&
2968
+ (finalArg.type === 'ObjectExpression' || finalArg.type === 'ArrayExpression') &&
3012
2969
  !hasComment(finalArg);
3013
2970
 
3014
2971
  /** @type {Doc[]} */
@@ -3047,10 +3004,7 @@ function printCallArguments(path, options, print) {
3047
3004
  const trailingComma = shouldPrintComma(options, 'all') ? ',' : '';
3048
3005
 
3049
3006
  // Special case: single array argument should keep opening bracket inline
3050
- const isSingleArrayArgument =
3051
- args.length === 1 &&
3052
- args[0] &&
3053
- (args[0].type === 'ArrayExpression' || args[0].type === 'RippleArrayExpression');
3007
+ const isSingleArrayArgument = args.length === 1 && args[0] && args[0].type === 'ArrayExpression';
3054
3008
 
3055
3009
  if (isSingleArrayArgument) {
3056
3010
  // Don't use group() - just concat to allow array to control its own breaking
@@ -3105,11 +3059,7 @@ function printCallArguments(path, options, print) {
3105
3059
  const previousArgsBreak =
3106
3060
  lastIndex > 0 ? argumentBreakFlags.slice(0, lastIndex).some(Boolean) : false;
3107
3061
  const isExpandableLastArgType =
3108
- lastArg &&
3109
- (lastArg.type === 'ObjectExpression' ||
3110
- lastArg.type === 'RippleObjectExpression' ||
3111
- lastArg.type === 'ArrayExpression' ||
3112
- lastArg.type === 'RippleArrayExpression');
3062
+ lastArg && (lastArg.type === 'ObjectExpression' || lastArg.type === 'ArrayExpression');
3113
3063
 
3114
3064
  // Check if we should expand the last argument (like Prettier's shouldExpandLastArg)
3115
3065
  const shouldExpandLast =
@@ -3573,20 +3523,18 @@ function printDoWhileStatement(node, path, options, print) {
3573
3523
  }
3574
3524
 
3575
3525
  /**
3576
- * Print an object expression (or RippleObjectExpression)
3577
- * @param {AST.ObjectExpression | AST.RippleObjectExpression} node - The object expression node
3578
- * @param {AstPath<AST.ObjectExpression | AST.RippleObjectExpression>} path - The AST path
3526
+ * Print an object expression
3527
+ * @param {AST.ObjectExpression} node - The object expression node
3528
+ * @param {AstPath<AST.ObjectExpression>} path - The AST path
3579
3529
  * @param {RippleFormatOptions} options - Prettier options
3580
3530
  * @param {PrintFn} print - Print callback
3581
3531
  * @param {PrintArgs} [args] - Additional context arguments
3582
3532
  * @returns {Doc}
3583
3533
  */
3584
3534
  function printObjectExpression(node, path, options, print, args) {
3585
- // const use_long_tracked_syntax =
3586
- // node.type === 'RippleObjectExpression' && uses_long_tracked_syntax(node, options, 'object');
3587
- const open_brace = node.type === 'RippleObjectExpression' ? '#ripple{' : '{';
3535
+ const open_brace = '{';
3588
3536
  const close_brace = '}';
3589
- const skip_offset = node.type === 'RippleObjectExpression' ? '#ripple{'.length : 1;
3537
+ const skip_offset = 1;
3590
3538
  const closing_offset = 1;
3591
3539
 
3592
3540
  if (!node.properties || node.properties.length === 0) {
@@ -4133,15 +4081,6 @@ function printYieldExpression(node, path, options, print) {
4133
4081
  * @returns {Doc[]}
4134
4082
  */
4135
4083
  function printNewExpression(node, path, options, print) {
4136
- // #ripple.* constructors don't need 'new' - compiler handles that automatically
4137
- // If someone writes 'new #ripple.map()', just output '#ripple.map()'
4138
- if (
4139
- node.callee &&
4140
- (node.callee.type === 'RippleArrayExpression' || node.callee.type === 'RippleObjectExpression')
4141
- ) {
4142
- return [path.call(print, 'callee')];
4143
- }
4144
-
4145
4084
  /** @type {Doc[]} */
4146
4085
  const parts = [];
4147
4086
  parts.push('new ');
@@ -5042,16 +4981,13 @@ function printVariableDeclarator(node, path, options, print) {
5042
4981
 
5043
4982
  // For arrays/objects with blank lines, use conditionalGroup to try both layouts
5044
4983
  // Prettier will break the declaration if keeping it inline doesn't fit
5045
- const isArray =
5046
- node.init.type === 'ArrayExpression' || node.init.type === 'RippleArrayExpression';
5047
- const isObject =
5048
- node.init.type === 'ObjectExpression' || node.init.type === 'RippleObjectExpression';
4984
+ const isArray = node.init.type === 'ArrayExpression';
4985
+ const isObject = node.init.type === 'ObjectExpression';
5049
4986
 
5050
4987
  if (isArray || isObject) {
5051
4988
  const items = isArray
5052
- ? /** @type {AST.ArrayExpression | AST.RippleArrayExpression} */ (node.init).elements || []
5053
- : /** @type {AST.ObjectExpression | AST.RippleObjectExpression} */ (node.init).properties ||
5054
- [];
4989
+ ? /** @type {AST.ArrayExpression} */ (node.init).elements || []
4990
+ : /** @type {AST.ObjectExpression} */ (node.init).properties || [];
5055
4991
  let hasBlankLines = false;
5056
4992
 
5057
4993
  if (isArray) {
package/src/index.test.js CHANGED
@@ -655,7 +655,7 @@ import { Something, type Props, track } from 'ripple';`;
655
655
  it('should handle @ prefix', async () => {
656
656
  const input = `export default component App() {
657
657
  <div>
658
- let count = #ripple.track(0);
658
+ let count = track(0);
659
659
  @count = 2;
660
660
  console.log(@count);
661
661
  console.log(count);
@@ -666,7 +666,7 @@ import { Something, type Props, track } from 'ripple';`;
666
666
  }`;
667
667
  const expected = `export default component App() {
668
668
  <div>
669
- let count = #ripple.track(0);
669
+ let count = track(0);
670
670
  @count = 2;
671
671
  console.log(@count);
672
672
  console.log(count);
@@ -708,14 +708,14 @@ import { Something, type Props, track } from 'ripple';`;
708
708
 
709
709
  it('should preserve @ symbol in JSX attributes and shorthand syntax', async () => {
710
710
  const input = `component App() {
711
- const count = #ripple.track(0);
711
+ const count = track(0);
712
712
 
713
713
  <Counter count={@count} />
714
714
  <Counter {@count} />
715
715
  }`;
716
716
 
717
717
  const expected = `component App() {
718
- const count = #ripple.track(0);
718
+ const count = track(0);
719
719
 
720
720
  <Counter {@count} />
721
721
  <Counter {@count} />
@@ -935,7 +935,7 @@ export component Test({ a, b }: Props) {}`;
935
935
 
936
936
  it('should not strip @ from dynamic @tag', async () => {
937
937
  const expected = `export component Four() {
938
- let tag = #ripple.track('div');
938
+ let tag = track('div');
939
939
 
940
940
  <@tag {href} {...props}>
941
941
  <@children />
@@ -973,7 +973,7 @@ export component Test({ a, b }: Props) {}`;
973
973
  it('should keep @ on dynamic object member array expressions', async () => {
974
974
  const expected = `component App() {
975
975
  const obj = {
976
- [0]: #ripple.track(0),
976
+ [0]: track(0),
977
977
  };
978
978
 
979
979
  <div>{obj.@[0]}</div>
@@ -1264,8 +1264,8 @@ const [obj1, obj2] = arrayOfObjects;`;
1264
1264
  });
1265
1265
 
1266
1266
  it('should keep RippleMap short syntax intact', async () => {
1267
- const expected = `const map = #ripple.map([['key1', 'value1'], ['key2', 'value2']]);
1268
- const set = #ripple.set([1, 2, 3]);`;
1267
+ const expected = `const map = new RippleMap([['key1', 'value1'], ['key2', 'value2']]);
1268
+ const set = new RippleSet([1, 2, 3]);`;
1269
1269
 
1270
1270
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1271
1271
  expect(result).toBeWithNewline(expected);
@@ -1273,7 +1273,7 @@ const set = #ripple.set([1, 2, 3]);`;
1273
1273
 
1274
1274
  it('should keep RippleSet parents with short syntax and no args intact', async () => {
1275
1275
  const expected = `component SetTest() {
1276
- let items = #ripple.set();
1276
+ let items = new RippleSet();
1277
1277
 
1278
1278
  <button onClick={() => items.add(1)}>{'add'}</button>
1279
1279
  <pre>{items.size}</pre>
@@ -1285,7 +1285,7 @@ const set = #ripple.set([1, 2, 3]);`;
1285
1285
 
1286
1286
  it('should keep RippleMap parents with short syntax and no args intact', async () => {
1287
1287
  const expected = `component MapTest() {
1288
- let items = #ripple.map();
1288
+ let items = new RippleMap();
1289
1289
 
1290
1290
  <button onClick={() => items.set('key', 1)}>{'add'}</button>
1291
1291
  <pre>{items.size}</pre>
@@ -1294,47 +1294,6 @@ const set = #ripple.set([1, 2, 3]);`;
1294
1294
  expect(result).toBeWithNewline(expected);
1295
1295
  });
1296
1296
 
1297
- it('should preserve #ripple.array and #ripple.object long syntax if authored', async () => {
1298
- const input = `component App() {
1299
- let arr = #ripple.array(1, 2, 3);
1300
- let obj = #ripple.object({ a: 1 });
1301
-
1302
- <div>{arr.length + obj.a}</div>
1303
- }`;
1304
-
1305
- const expected = `component App() {
1306
- let arr = #ripple.array(1, 2, 3);
1307
- let obj = #ripple.object({ a: 1 });
1308
-
1309
- <div>{arr.length + obj.a}</div>
1310
- }`;
1311
-
1312
- const result = await format(input, { singleQuote: true, printWidth: 100 });
1313
- expect(result).toBeWithNewline(expected);
1314
- });
1315
-
1316
- it('should preserve static member access from #ripple collection roots', async () => {
1317
- const input = `const from = #ripple.array.from([1, 2, 3]);
1318
- const from_async = #ripple.array.fromAsync([1, 2, 3]);
1319
- const of = #ripple.array
1320
- .of(1, 2, 3);`;
1321
-
1322
- const expected = `const from = #ripple.array.from([1, 2, 3]);
1323
- const from_async = #ripple.array.fromAsync([1, 2, 3]);
1324
- const of = #ripple.array.of(1, 2, 3);`;
1325
-
1326
- const result = await format(input, { singleQuote: true, printWidth: 100 });
1327
- expect(result).toBeWithNewline(expected);
1328
- });
1329
-
1330
- it('should preserve computed member access from #ripple roots', async () => {
1331
- const expected = `const from = #ripple.array['from']([1, 2, 3]);
1332
- const of = #ripple.array['of'](1, 2, 3);`;
1333
-
1334
- const result = await format(expected, { singleQuote: true, printWidth: 100 });
1335
- expect(result).toBeWithNewline(expected);
1336
- });
1337
-
1338
1297
  it('should not remove blank lines between components and types if provided', async () => {
1339
1298
  const expected = `export component App() {
1340
1299
  console.log('test');
@@ -1476,7 +1435,7 @@ function bind_element_rect(maybe_tracked, type) {
1476
1435
  /** @param {any} entry */ (entry) => set(tracked, entry[type]),
1477
1436
  );
1478
1437
 
1479
- #ripple.effect(() => unsubscribe);
1438
+ effect(() => unsubscribe);
1480
1439
  };
1481
1440
  }`;
1482
1441
 
@@ -1730,8 +1689,8 @@ const program =
1730
1689
  it('should keep blank lines between commented out block and markup', async () => {
1731
1690
  const expected = `function CounterWrapper(props) {
1732
1691
  const more = {
1733
- double: #ripple.track(() => props.count * 2),
1734
- another: #ripple.track(0),
1692
+ double: track(() => props.count * 2),
1693
+ another: track(0),
1735
1694
  onemore: 100,
1736
1695
  };
1737
1696
 
@@ -1749,24 +1708,24 @@ const program =
1749
1708
  });
1750
1709
 
1751
1710
  it('should keep parens around negating key in object expression', async () => {
1752
- const input = `#ripple.effect(() => {
1711
+ const input = `effect(() => {
1753
1712
  props.count;
1754
1713
  if (props.count > 1 && 'another' in more) {
1755
- #ripple.untrack(() => delete more.another);
1714
+ untrack(() => delete more.another);
1756
1715
  } else if (props.count > 2 && !('another' in more)) {
1757
- #ripple.untrack(() => more.another = 0);
1716
+ untrack(() => more.another = 0);
1758
1717
  }
1759
- #ripple.untrack(() => console.log(more));
1718
+ untrack(() => console.log(more));
1760
1719
  });`;
1761
1720
 
1762
- const expected = `#ripple.effect(() => {
1721
+ const expected = `effect(() => {
1763
1722
  props.count;
1764
1723
  if (props.count > 1 && 'another' in more) {
1765
- #ripple.untrack(() => delete more.another);
1724
+ untrack(() => delete more.another);
1766
1725
  } else if (props.count > 2 && !('another' in more)) {
1767
- #ripple.untrack(() => (more.another = 0));
1726
+ untrack(() => (more.another = 0));
1768
1727
  }
1769
- #ripple.untrack(() => console.log(more));
1728
+ untrack(() => console.log(more));
1770
1729
  });`;
1771
1730
 
1772
1731
  const result = await format(input, { singleQuote: true, printWidth: 100 });
@@ -1774,7 +1733,7 @@ const program =
1774
1733
  });
1775
1734
 
1776
1735
  it('should keep parents in math subtraction and multiplication', async () => {
1777
- const expected = `let offset = #ripple.track(() => (@page - 1) * @limit);`;
1736
+ const expected = `let offset = track(() => (@page - 1) * @limit);`;
1778
1737
 
1779
1738
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1780
1739
  expect(result).toBeWithNewline(expected);
@@ -1857,7 +1816,7 @@ files = [...(files ?? []), ...dt.files];`;
1857
1816
  }
1858
1817
 
1859
1818
  try {
1860
- items = await #ripple.array.fromAsync(throwingIterable());
1819
+ items = await RippleArray.fromAsync(throwingIterable());
1861
1820
  for (const item of items) {
1862
1821
  <li>{item}</li>
1863
1822
  }
@@ -2333,7 +2292,7 @@ component Child({ something }) {
2333
2292
 
2334
2293
  it('should correctly handle call expressions', async () => {
2335
2294
  const input = `export component App() {
2336
- const context = #ripple.track(globalContext.get().theme);
2295
+ const context = track(globalContext.get().theme);
2337
2296
  <div>
2338
2297
  <TypedComponent />
2339
2298
  {@context}
@@ -2341,7 +2300,7 @@ component Child({ something }) {
2341
2300
  }`;
2342
2301
 
2343
2302
  const expected = `export component App() {
2344
- const context = #ripple.track(globalContext.get().theme);
2303
+ const context = track(globalContext.get().theme);
2345
2304
  <div>
2346
2305
  <TypedComponent />
2347
2306
  {@context}
@@ -2616,20 +2575,11 @@ function test() {
2616
2575
  expect(result).toBeWithNewline(expected);
2617
2576
  });
2618
2577
 
2619
- it('should preserve comments in object and tracked object expressions', async () => {
2578
+ it('should preserve comments in object expressions', async () => {
2620
2579
  const expected = `const obj = {
2621
2580
  /* comment 1 */
2622
2581
  a: 1,
2623
2582
 
2624
- // comment 2
2625
- b: 2,
2626
- // comment 3
2627
- };
2628
-
2629
- const obj2 = #ripple{
2630
- /* comment 1 */
2631
- a: 1,
2632
-
2633
2583
  // comment 2
2634
2584
  b: 2,
2635
2585
  // comment 3
@@ -2771,46 +2721,6 @@ const obj2 = #ripple{
2771
2721
  expect(result).toBeWithNewline(expected);
2772
2722
  });
2773
2723
 
2774
- it('should preserve comments in arrays width printWidth 3', async () => {
2775
- const input = `const arr = #ripple[
2776
- 1,
2777
- /* comment 1 */
2778
- 2,
2779
- 3,
2780
- // comment 2
2781
- ];`;
2782
-
2783
- const expected = `const arr =
2784
- #ripple[
2785
- 1,
2786
- /* comment 1 */
2787
- 2,
2788
- 3,
2789
- // comment 2
2790
- ];`;
2791
-
2792
- const result = await format(input, { singleQuote: true, printWidth: 3 });
2793
- expect(result).toBeWithNewline(expected);
2794
- });
2795
-
2796
- it('should preserve comments in arrays width printWidth 13', async () => {
2797
- const input = `const arr =
2798
- #ripple[
2799
- 1 /* comment 1 */,
2800
- 2, 3,
2801
- // comment 2
2802
- ];`;
2803
-
2804
- const expected = `const arr = #ripple[
2805
- 1 /* comment 1 */,
2806
- 2, 3,
2807
- // comment 2
2808
- ];`;
2809
-
2810
- const result = await format(input, { singleQuote: true, printWidth: 13 });
2811
- expect(result).toBeWithNewline(expected);
2812
- });
2813
-
2814
2724
  it('should preserve comments inside js/ts blocks inside markup', async () => {
2815
2725
  const expected = `component App() {
2816
2726
  <button
@@ -3201,14 +3111,14 @@ const items = [] as unknown[];`;
3201
3111
 
3202
3112
  it('should format TypeScript generics in variable declarations', async () => {
3203
3113
  const input = `component GenericTest() {
3204
- let open: Tracked<boolean> = #ripple.track(false);
3114
+ let open: Tracked<boolean> = track(false);
3205
3115
  let items: Array<string> = [];
3206
3116
  let map: Map<string, number> = new Map();
3207
3117
  <div>{"test"}</div>
3208
3118
  }`;
3209
3119
 
3210
3120
  const expected = `component GenericTest() {
3211
- let open: Tracked<boolean> = #ripple.track(false);
3121
+ let open: Tracked<boolean> = track(false);
3212
3122
  let items: Array<string> = [];
3213
3123
  let map: Map<string, number> = new Map();
3214
3124
  <div>{'test'}</div>
@@ -3649,7 +3559,7 @@ try {
3649
3559
  it('properly formats components markup and new lines and leaves one new line between components and <style> if one or more exits', async () => {
3650
3560
  const input = `export component App() {
3651
3561
  <div>
3652
- <RowList rows={#ripple[{id: 'a'}, {id: 'b'}, {id: 'c'}]}>
3562
+ <RowList rows={[{id: 'a'}, {id: 'b'}, {id: 'c'}]}>
3653
3563
  component Row({id, index, isHighlighted = (index) => (index % 2) === 0}) {
3654
3564
  <div class={{highlighted: isHighlighted(index)}}>{index}{' - '}{id}</div>
3655
3565
 
@@ -3672,7 +3582,7 @@ component RowList({ rows, Row }) {
3672
3582
 
3673
3583
  const expected = `export component App() {
3674
3584
  <div>
3675
- <RowList rows={#ripple[{ id: 'a' }, { id: 'b' }, { id: 'c' }]}>
3585
+ <RowList rows={[{ id: 'a' }, { id: 'b' }, { id: 'c' }]}>
3676
3586
  component Row({ id, index, isHighlighted = (index) => index % 2 === 0 }) {
3677
3587
  <div class={{ highlighted: isHighlighted(index) }}>
3678
3588
  {index}
@@ -3704,88 +3614,6 @@ component RowList({ rows, Row }) {
3704
3614
  expect(result).toBeWithNewline(expected);
3705
3615
  });
3706
3616
 
3707
- it('leaves the shorthand reactive declaration intact and formats the same way as plain objects', async () => {
3708
- const input = `export component App() {
3709
- const obj = #ripple{ a: 1, b: 2, c: 3 };
3710
- let singleUser = #ripple{name:"Test Me", email: "abc@example.com"}
3711
- }`;
3712
-
3713
- const expected = `export component App() {
3714
- const obj = #ripple{ a: 1, b: 2, c: 3 };
3715
- let singleUser = #ripple{ name: 'Test Me', email: 'abc@example.com' };
3716
- }`;
3717
- const result = await format(input, {
3718
- singleQuote: true,
3719
- arrowParens: 'always',
3720
- printWidth: 100,
3721
- });
3722
- expect(result).toBeWithNewline(expected);
3723
- });
3724
-
3725
- it('formats single line reactive object into multiline when printWidth is exceeded', async () => {
3726
- const input = `export component App() {
3727
- const obj = #ripple{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, o: 15};
3728
- let singleUser = #ripple{name:"Test Me", email: "abc@example.com"}
3729
- }`;
3730
-
3731
- const expected = `export component App() {
3732
- const obj = #ripple{
3733
- a: 1,
3734
- b: 2,
3735
- c: 3,
3736
- d: 4,
3737
- e: 5,
3738
- f: 6,
3739
- g: 7,
3740
- h: 8,
3741
- i: 9,
3742
- j: 10,
3743
- k: 11,
3744
- l: 12,
3745
- m: 13,
3746
- n: 14,
3747
- o: 15,
3748
- };
3749
- let singleUser = #ripple{ name: 'Test Me', email: 'abc@example.com' };
3750
- }`;
3751
- const result = await format(input, {
3752
- singleQuote: true,
3753
- arrowParens: 'always',
3754
- printWidth: 100,
3755
- });
3756
- expect(result).toBeWithNewline(expected);
3757
- });
3758
-
3759
- it('leaves the shorthand reactive array declaration intact and formats the same way as regular array', async () => {
3760
- const input = `export component App() {
3761
- const arr = #ripple[ {a: 1}, { b:2}, {c:3 } ];
3762
- let multi = #ripple[{a: 1}, {b: 2}, {c: 3}, {d: 4}, {e:5}, {f:6}, {g: 7}, {h: 8}, {i:9}, {j: 10}, {k: 11}];
3763
- }`;
3764
-
3765
- const expected = `export component App() {
3766
- const arr = #ripple[{ a: 1 }, { b: 2 }, { c: 3 }];
3767
- let multi = #ripple[
3768
- { a: 1 },
3769
- { b: 2 },
3770
- { c: 3 },
3771
- { d: 4 },
3772
- { e: 5 },
3773
- { f: 6 },
3774
- { g: 7 },
3775
- { h: 8 },
3776
- { i: 9 },
3777
- { j: 10 },
3778
- { k: 11 },
3779
- ];
3780
- }`;
3781
- const result = await format(input, {
3782
- singleQuote: true,
3783
- arrowParens: 'always',
3784
- printWidth: 100,
3785
- });
3786
- expect(result).toBeWithNewline(expected);
3787
- });
3788
-
3789
3617
  it('preserves typescript parameter types with a default value', async () => {
3790
3618
  const expected = `function getString(e: string = 'test') {
3791
3619
  return e;
@@ -4513,7 +4341,7 @@ export component App() {
4513
4341
  it('should keep blank line between components with a trailing comment at the end of the first', async () => {
4514
4342
  const expected = `component SVG({ children }) {
4515
4343
  <svg width={20} height={20} fill="blue" viewBox="0 0 30 10" preserveAspectRatio="none">
4516
- let test = #ripple.track(8);
4344
+ let test = track(8);
4517
4345
  {test}
4518
4346
  <polygon points="0,0 30,0 15,10" />
4519
4347
  </svg>
@@ -4994,7 +4822,7 @@ component Polygon() {
4994
4822
 
4995
4823
  it('should preserve @ symbol in JSX attributes inside <tsx:react>', async () => {
4996
4824
  const input = `component App() {
4997
- const count = #ripple.track(0);
4825
+ const count = track(0);
4998
4826
 
4999
4827
  <div>
5000
4828
  <h1>{'Hello, from Ripple!'}</h1>
@@ -5005,7 +4833,7 @@ component Polygon() {
5005
4833
  }`;
5006
4834
 
5007
4835
  const expected = `component App() {
5008
- const count = #ripple.track(0);
4836
+ const count = track(0);
5009
4837
 
5010
4838
  <div>
5011
4839
  <h1>{'Hello, from Ripple!'}</h1>
@@ -5079,10 +4907,10 @@ component App() {
5079
4907
  expect(result).toBeWithNewline(expected);
5080
4908
  });
5081
4909
  it('should format JSXExpressionContainer with complex expressions', async () => {
5082
- const input = `component App(){let count=#ripple.track(0);<tsx:react><div>{count*2+10}</div>{getMessage("test")}</tsx:react>}`;
4910
+ const input = `component App(){let count=track(0);<tsx:react><div>{count*2+10}</div>{getMessage("test")}</tsx:react>}`;
5083
4911
 
5084
4912
  const expected = `component App() {
5085
- let count = #ripple.track(0);
4913
+ let count = track(0);
5086
4914
  <tsx:react>
5087
4915
  <div>
5088
4916
  {count * 2 + 10}