@tsrx/prettier-plugin 0.3.138 → 0.4.1

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": "@tsrx/prettier-plugin",
3
- "version": "0.3.138",
3
+ "version": "0.4.1",
4
4
  "description": "TSRX plugin for Prettier",
5
5
  "type": "module",
6
6
  "module": "src/index.js",
@@ -27,7 +27,7 @@
27
27
  "prettier": "^3.9.6"
28
28
  },
29
29
  "dependencies": {
30
- "@tsrx/core": "0.1.71"
30
+ "@tsrx/core": "0.2.0"
31
31
  },
32
32
  "files": [
33
33
  "src/"
package/src/index.js CHANGED
@@ -2548,15 +2548,11 @@ function printTsrxNode(node, path, options, print, args) {
2548
2548
  break;
2549
2549
 
2550
2550
  case 'ObjectPattern':
2551
- nodeContent = node.lazy
2552
- ? ['&', printObjectPattern(node, path, options, print)]
2553
- : printObjectPattern(node, path, options, print);
2551
+ nodeContent = printObjectPattern(node, path, options, print);
2554
2552
  break;
2555
2553
 
2556
2554
  case 'ArrayPattern':
2557
- nodeContent = node.lazy
2558
- ? ['&', printArrayPattern(node, path, options, print)]
2559
- : printArrayPattern(node, path, options, print);
2555
+ nodeContent = printArrayPattern(node, path, options, print);
2560
2556
  break;
2561
2557
 
2562
2558
  case 'Property':
package/src/index.test.js CHANGED
@@ -137,20 +137,20 @@ const items=[1,2,3];
137
137
  const input = `function SetTest() {
138
138
  return <>@{
139
139
  let items = new ReactiveSet([1, 2, 3]);
140
- let &[hasValue] = track(() => items.has(2));
140
+ const hasValue = track(() => items.has(2));
141
141
  <>
142
142
  <button onClick={() => items.delete(2)}>{'delete'}</button>
143
- <pre>{hasValue}</pre>
143
+ <pre>{hasValue.value}</pre>
144
144
  </>
145
145
  }</>;
146
146
  }`;
147
147
  const expected = `function SetTest() {
148
148
  return <>@{
149
149
  let items = new ReactiveSet([1, 2, 3]);
150
- let &[hasValue] = track(() => items.has(2));
150
+ const hasValue = track(() => items.has(2));
151
151
  <>
152
152
  <button onClick={() => items.delete(2)}>{"delete"}</button>
153
- <pre>{hasValue}</pre>
153
+ <pre>{hasValue.value}</pre>
154
154
  </>
155
155
  }</>;
156
156
  }`;
@@ -3129,18 +3129,18 @@ const sink: import('@example/runtime/server').SSRStreamSink = {
3129
3129
 
3130
3130
  it('should correctly handle call expressions', async () => {
3131
3131
  const input = `export function App() {
3132
- const &[context] = track(globalContext.get().theme);
3132
+ const context = track(globalContext.get().theme);
3133
3133
  <div>
3134
3134
  <TypedComponent />
3135
- {context}
3135
+ {context.value}
3136
3136
  </div>
3137
3137
  }`;
3138
3138
 
3139
3139
  const expected = `export function App() {
3140
- const &[context] = track(globalContext.get().theme);
3140
+ const context = track(globalContext.get().theme);
3141
3141
  <div>
3142
3142
  <TypedComponent />
3143
- {context}
3143
+ {context.value}
3144
3144
  </div>
3145
3145
  }`;
3146
3146
 
@@ -5588,45 +5588,18 @@ function Polygon() {
5588
5588
  expect(result).toBeWithNewline(expected);
5589
5589
  });
5590
5590
 
5591
- it('should handle tracked variable with lazy destructuring', async () => {
5592
- const input = `export default function App() {
5593
- return <div>@{
5594
- let &[count] = track(0);
5595
- count = 2;
5596
- console.log(count);
5597
- console.log(count);
5598
- @if (count > 1) {
5599
- <button onClick={() => count++}>{count}</button>
5600
- }
5601
- }</div>;
5602
- }`;
5603
- const expected = `export default function App() {
5604
- return <div>@{
5605
- let &[count] = track(0);
5606
- count = 2;
5607
- console.log(count);
5608
- console.log(count);
5609
- @if (count > 1) {
5610
- <button onClick={() => count++}>{count}</button>
5611
- }
5612
- }</div>;
5613
- }`;
5614
- const result = await format(input, { singleQuote: true });
5615
- expect(result).toBeWithNewline(expected);
5616
- });
5617
-
5618
5591
  it('should format JSX attributes with tracked values', async () => {
5619
5592
  const input = `function App() {
5620
- const &[count] = track(0);
5593
+ const count = track(0);
5621
5594
 
5622
- <Counter count={count} />
5595
+ <Counter count={count.value} />
5623
5596
  <Counter {count} />
5624
5597
  }`;
5625
5598
 
5626
5599
  const expected = `function App() {
5627
- const &[count] = track(0);
5600
+ const count = track(0);
5628
5601
 
5629
- <Counter count={count} />
5602
+ <Counter count={count.value} />
5630
5603
  <Counter {count} />
5631
5604
  }`;
5632
5605
 
@@ -6066,7 +6039,7 @@ if(n<2){go("now")}</script>`;
6066
6039
 
6067
6040
  it('should preserve comments in destructured typed function parameters', async () => {
6068
6041
  const expected = `function Child({
6069
- tr: &[count, tr],
6042
+ tr: [count, tr],
6070
6043
  // test,
6071
6044
  }: {
6072
6045
  tr: [number, Tracked<number>];