@tanstack/devtools-vite 0.6.1 β 0.7.0
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/dist/esm/ast-utils.d.ts +11 -0
- package/dist/esm/ast-utils.js +44 -0
- package/dist/esm/ast-utils.js.map +1 -0
- package/dist/esm/devtools-packages.d.ts +2 -0
- package/dist/esm/devtools-packages.js +15 -0
- package/dist/esm/devtools-packages.js.map +1 -0
- package/dist/esm/enhance-logs.d.ts +4 -1
- package/dist/esm/enhance-logs.js +35 -36
- package/dist/esm/enhance-logs.js.map +1 -1
- package/dist/esm/inject-plugin.d.ts +5 -4
- package/dist/esm/inject-plugin.js +114 -103
- package/dist/esm/inject-plugin.js.map +1 -1
- package/dist/esm/inject-source.d.ts +4 -1
- package/dist/esm/inject-source.js +92 -93
- package/dist/esm/inject-source.js.map +1 -1
- package/dist/esm/offset-to-loc.d.ts +14 -0
- package/dist/esm/offset-to-loc.js +29 -0
- package/dist/esm/offset-to-loc.js.map +1 -0
- package/dist/esm/plugin.js +23 -28
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/remove-devtools.d.ts +4 -1
- package/dist/esm/remove-devtools.js +79 -86
- package/dist/esm/remove-devtools.js.map +1 -1
- package/package.json +3 -9
- package/skills/devtools-vite-plugin/SKILL.md +7 -7
- package/skills/devtools-vite-plugin/references/vite-options.md +2 -2
- package/src/ast-utils.ts +54 -0
- package/src/devtools-packages.ts +12 -0
- package/src/enhance-logs.ts +48 -78
- package/src/inject-plugin.test.ts +200 -147
- package/src/inject-plugin.ts +195 -238
- package/src/inject-source.test.ts +165 -115
- package/src/inject-source.ts +183 -231
- package/src/offset-to-loc.ts +39 -0
- package/src/plugin.ts +26 -28
- package/src/remove-devtools.test.ts +76 -57
- package/src/remove-devtools.ts +160 -168
- package/dist/esm/babel.d.ts +0 -18
- package/dist/esm/babel.js +0 -11
- package/dist/esm/babel.js.map +0 -1
- package/src/babel.ts +0 -18
|
@@ -54,9 +54,9 @@ describe('inject source', () => {
|
|
|
54
54
|
)
|
|
55
55
|
expect(output).toBe(
|
|
56
56
|
removeEmptySpace(`
|
|
57
|
-
|
|
58
|
-
component: function() { return <div data-tsd-source="test.jsx:3:38">Hello World</div
|
|
59
|
-
})
|
|
57
|
+
export const Route = createFileRoute("/test")({
|
|
58
|
+
component: function() { return <div data-tsd-source="test.jsx:3:38">Hello World</div> },
|
|
59
|
+
})
|
|
60
60
|
`),
|
|
61
61
|
)
|
|
62
62
|
})
|
|
@@ -102,7 +102,7 @@ describe('inject source', () => {
|
|
|
102
102
|
addSourceToJsx(
|
|
103
103
|
`
|
|
104
104
|
export const Route = createFileRoute("/test")({
|
|
105
|
-
component: function({...rest}) { return <div><div {...rest}>Hello World</div></div> }
|
|
105
|
+
component: function({...rest}) { return <div><div {...rest}>Hello World</div></div> }
|
|
106
106
|
})
|
|
107
107
|
`,
|
|
108
108
|
'test.jsx',
|
|
@@ -110,9 +110,9 @@ describe('inject source', () => {
|
|
|
110
110
|
)
|
|
111
111
|
expect(output).toBe(
|
|
112
112
|
removeEmptySpace(`
|
|
113
|
-
|
|
114
|
-
component: function({...rest}) { return <div data-tsd-source="test.jsx:3:47"><div {...rest}>Hello World</div></div
|
|
115
|
-
})
|
|
113
|
+
export const Route = createFileRoute("/test")({
|
|
114
|
+
component: function({...rest}) { return <div data-tsd-source="test.jsx:3:47"><div {...rest}>Hello World</div></div> }
|
|
115
|
+
})
|
|
116
116
|
`),
|
|
117
117
|
)
|
|
118
118
|
})
|
|
@@ -132,9 +132,9 @@ describe('inject source', () => {
|
|
|
132
132
|
)
|
|
133
133
|
expect(output).toBe(
|
|
134
134
|
removeEmptySpace(`
|
|
135
|
-
|
|
136
|
-
component: () => <div data-tsd-source="test.jsx:3:24">Hello World</div
|
|
137
|
-
})
|
|
135
|
+
export const Route = createFileRoute("/test")({
|
|
136
|
+
component: () => <div data-tsd-source="test.jsx:3:24">Hello World</div>,
|
|
137
|
+
})
|
|
138
138
|
`),
|
|
139
139
|
)
|
|
140
140
|
})
|
|
@@ -167,7 +167,7 @@ describe('inject source', () => {
|
|
|
167
167
|
const output = addSourceToJsx(
|
|
168
168
|
`
|
|
169
169
|
export const Route = createFileRoute("/test")({
|
|
170
|
-
component: ({...rest}) => <div {...rest}>Hello World</div>,
|
|
170
|
+
component: ({...rest}) => <div {...rest}>Hello World</div>,
|
|
171
171
|
})
|
|
172
172
|
`,
|
|
173
173
|
'test.jsx',
|
|
@@ -180,7 +180,7 @@ describe('inject source', () => {
|
|
|
180
180
|
addSourceToJsx(
|
|
181
181
|
`
|
|
182
182
|
export const Route = createFileRoute("/test")({
|
|
183
|
-
component: ({...rest}) => <div><div {...rest}>Hello World</div></div>,
|
|
183
|
+
component: ({...rest}) => <div><div {...rest}>Hello World</div></div>,
|
|
184
184
|
})
|
|
185
185
|
`,
|
|
186
186
|
'test.jsx',
|
|
@@ -188,9 +188,9 @@ describe('inject source', () => {
|
|
|
188
188
|
)
|
|
189
189
|
expect(output).toBe(
|
|
190
190
|
removeEmptySpace(`
|
|
191
|
-
|
|
192
|
-
component: ({...rest}) => <div data-tsd-source="test.jsx:3:33"><div {...rest}>Hello World</div></div
|
|
193
|
-
})
|
|
191
|
+
export const Route = createFileRoute("/test")({
|
|
192
|
+
component: ({...rest}) => <div data-tsd-source="test.jsx:3:33"><div {...rest}>Hello World</div></div>,
|
|
193
|
+
})
|
|
194
194
|
`),
|
|
195
195
|
)
|
|
196
196
|
})
|
|
@@ -212,12 +212,12 @@ describe('inject source', () => {
|
|
|
212
212
|
)
|
|
213
213
|
expect(output).toBe(
|
|
214
214
|
removeEmptySpace(`
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
function Parent({ ...props }) {
|
|
216
|
+
function Child({ ...props }) {
|
|
217
|
+
return <div data-tsd-source="test.jsx:4:18" />
|
|
218
|
+
}
|
|
219
|
+
return <Child {...props} />
|
|
220
|
+
}
|
|
221
221
|
`),
|
|
222
222
|
)
|
|
223
223
|
})
|
|
@@ -225,7 +225,7 @@ describe('inject source', () => {
|
|
|
225
225
|
const output = removeEmptySpace(
|
|
226
226
|
addSourceToJsx(
|
|
227
227
|
`
|
|
228
|
-
|
|
228
|
+
|
|
229
229
|
import Custom from "external";
|
|
230
230
|
|
|
231
231
|
function test({...props }) {
|
|
@@ -237,11 +237,13 @@ function test({...props }) {
|
|
|
237
237
|
)
|
|
238
238
|
expect(output).toBe(
|
|
239
239
|
removeEmptySpace(`
|
|
240
|
-
|
|
240
|
+
|
|
241
|
+
import Custom from "external";
|
|
241
242
|
|
|
242
243
|
function test({...props }) {
|
|
243
|
-
return <Custom children={props.children} data-tsd-source="test.tsx:6:10"
|
|
244
|
-
}
|
|
244
|
+
return <Custom children={props.children} data-tsd-source="test.tsx:6:10" />
|
|
245
|
+
}
|
|
246
|
+
`),
|
|
245
247
|
)
|
|
246
248
|
})
|
|
247
249
|
it(' props not destructured', () => {
|
|
@@ -257,10 +259,10 @@ function test({...props }) {
|
|
|
257
259
|
)
|
|
258
260
|
expect(output).toBe(
|
|
259
261
|
removeEmptySpace(`
|
|
260
|
-
function test(props)
|
|
261
|
-
return <button
|
|
262
|
+
function test(props){
|
|
263
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
262
264
|
}
|
|
263
|
-
`),
|
|
265
|
+
`),
|
|
264
266
|
)
|
|
265
267
|
})
|
|
266
268
|
|
|
@@ -291,12 +293,12 @@ function test(props) {
|
|
|
291
293
|
)
|
|
292
294
|
expect(output).toBe(
|
|
293
295
|
removeEmptySpace(`
|
|
294
|
-
function test(props) {
|
|
295
|
-
return
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
function test(props) {
|
|
297
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
298
|
+
<button {...props} />
|
|
299
|
+
</div>)
|
|
298
300
|
}
|
|
299
|
-
`),
|
|
301
|
+
`),
|
|
300
302
|
)
|
|
301
303
|
})
|
|
302
304
|
|
|
@@ -315,12 +317,12 @@ function test(props) {
|
|
|
315
317
|
)
|
|
316
318
|
expect(output).toBe(
|
|
317
319
|
removeEmptySpace(`
|
|
318
|
-
function test({...props}) {
|
|
319
|
-
return
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
function test({...props}) {
|
|
321
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
322
|
+
<button {...props} />
|
|
323
|
+
</div>)
|
|
322
324
|
}
|
|
323
|
-
`),
|
|
325
|
+
`),
|
|
324
326
|
)
|
|
325
327
|
})
|
|
326
328
|
|
|
@@ -339,12 +341,12 @@ function test({...props}) {
|
|
|
339
341
|
)
|
|
340
342
|
expect(output).toBe(
|
|
341
343
|
removeEmptySpace(`
|
|
342
|
-
function test({...rest}) {
|
|
343
|
-
return
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
function test({...rest}) {
|
|
345
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
346
|
+
<button {...rest} />
|
|
347
|
+
</div>)
|
|
346
348
|
}
|
|
347
|
-
`),
|
|
349
|
+
`),
|
|
348
350
|
)
|
|
349
351
|
})
|
|
350
352
|
|
|
@@ -374,9 +376,9 @@ function test({...rest}) {
|
|
|
374
376
|
expect(output).toBe(
|
|
375
377
|
removeEmptySpace(`
|
|
376
378
|
function test({ ...props }) {
|
|
377
|
-
return <button
|
|
379
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
378
380
|
}
|
|
379
|
-
`),
|
|
381
|
+
`),
|
|
380
382
|
)
|
|
381
383
|
})
|
|
382
384
|
|
|
@@ -406,9 +408,9 @@ function test({...rest}) {
|
|
|
406
408
|
expect(output).toBe(
|
|
407
409
|
removeEmptySpace(`
|
|
408
410
|
function test({ ...props }) {
|
|
409
|
-
return <CustomButton
|
|
411
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
410
412
|
}
|
|
411
|
-
`),
|
|
413
|
+
`),
|
|
412
414
|
)
|
|
413
415
|
})
|
|
414
416
|
|
|
@@ -438,9 +440,9 @@ function test({...rest}) {
|
|
|
438
440
|
expect(output).toBe(
|
|
439
441
|
removeEmptySpace(`
|
|
440
442
|
function test({ ...props }) {
|
|
441
|
-
return <CustomButton
|
|
443
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
442
444
|
}
|
|
443
|
-
`),
|
|
445
|
+
`),
|
|
444
446
|
)
|
|
445
447
|
})
|
|
446
448
|
})
|
|
@@ -458,10 +460,10 @@ function test({...rest}) {
|
|
|
458
460
|
)
|
|
459
461
|
expect(output).toBe(
|
|
460
462
|
removeEmptySpace(`
|
|
461
|
-
|
|
462
|
-
return <button
|
|
463
|
-
}
|
|
464
|
-
`),
|
|
463
|
+
const ButtonWithProps = function test(props){
|
|
464
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
465
|
+
}
|
|
466
|
+
`),
|
|
465
467
|
)
|
|
466
468
|
})
|
|
467
469
|
|
|
@@ -492,12 +494,12 @@ function test({...rest}) {
|
|
|
492
494
|
)
|
|
493
495
|
expect(output).toBe(
|
|
494
496
|
removeEmptySpace(`
|
|
495
|
-
|
|
496
|
-
return
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
`),
|
|
497
|
+
const ButtonWithProps = function test(props) {
|
|
498
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
499
|
+
<button {...props} />
|
|
500
|
+
</div>)
|
|
501
|
+
}
|
|
502
|
+
`),
|
|
501
503
|
)
|
|
502
504
|
})
|
|
503
505
|
|
|
@@ -516,12 +518,12 @@ function test({...rest}) {
|
|
|
516
518
|
)
|
|
517
519
|
expect(output).toBe(
|
|
518
520
|
removeEmptySpace(`
|
|
519
|
-
|
|
520
|
-
return
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
`),
|
|
521
|
+
const ButtonWithProps = function test({...props}) {
|
|
522
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
523
|
+
<button {...props} />
|
|
524
|
+
</div>)
|
|
525
|
+
}
|
|
526
|
+
`),
|
|
525
527
|
)
|
|
526
528
|
})
|
|
527
529
|
|
|
@@ -540,12 +542,12 @@ function test({...rest}) {
|
|
|
540
542
|
)
|
|
541
543
|
expect(output).toBe(
|
|
542
544
|
removeEmptySpace(`
|
|
543
|
-
|
|
544
|
-
return
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
`),
|
|
545
|
+
const ButtonWithProps = function test({...rest}) {
|
|
546
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
547
|
+
<button {...rest} />
|
|
548
|
+
</div>)
|
|
549
|
+
}
|
|
550
|
+
`),
|
|
549
551
|
)
|
|
550
552
|
})
|
|
551
553
|
|
|
@@ -575,9 +577,9 @@ function test({...rest}) {
|
|
|
575
577
|
expect(output).toBe(
|
|
576
578
|
removeEmptySpace(`
|
|
577
579
|
const ButtonWithProps = function test({ ...props }) {
|
|
578
|
-
return <button
|
|
579
|
-
}
|
|
580
|
-
`),
|
|
580
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
581
|
+
}
|
|
582
|
+
`),
|
|
581
583
|
)
|
|
582
584
|
})
|
|
583
585
|
|
|
@@ -607,9 +609,9 @@ function test({...rest}) {
|
|
|
607
609
|
expect(output).toBe(
|
|
608
610
|
removeEmptySpace(`
|
|
609
611
|
const ButtonWithProps = function test({ ...props }) {
|
|
610
|
-
return <CustomButton
|
|
611
|
-
}
|
|
612
|
-
`),
|
|
612
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
613
|
+
}
|
|
614
|
+
`),
|
|
613
615
|
)
|
|
614
616
|
})
|
|
615
617
|
|
|
@@ -639,9 +641,9 @@ function test({...rest}) {
|
|
|
639
641
|
expect(output).toBe(
|
|
640
642
|
removeEmptySpace(`
|
|
641
643
|
export const ButtonWithProps = function test({ ...props }) {
|
|
642
|
-
return <CustomButton
|
|
643
|
-
}
|
|
644
|
-
`),
|
|
644
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
645
|
+
}
|
|
646
|
+
`),
|
|
645
647
|
)
|
|
646
648
|
})
|
|
647
649
|
})
|
|
@@ -659,10 +661,10 @@ function test({...rest}) {
|
|
|
659
661
|
)
|
|
660
662
|
expect(output).toBe(
|
|
661
663
|
removeEmptySpace(`
|
|
662
|
-
|
|
663
|
-
return <button
|
|
664
|
-
}
|
|
665
|
-
`),
|
|
664
|
+
const ButtonWithProps = (props) => {
|
|
665
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
666
|
+
}
|
|
667
|
+
`),
|
|
666
668
|
)
|
|
667
669
|
})
|
|
668
670
|
|
|
@@ -693,12 +695,12 @@ function test({...rest}) {
|
|
|
693
695
|
)
|
|
694
696
|
expect(output).toBe(
|
|
695
697
|
removeEmptySpace(`
|
|
696
|
-
|
|
697
|
-
return
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
`),
|
|
698
|
+
const ButtonWithProps = (props) => {
|
|
699
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
700
|
+
<button {...props} />
|
|
701
|
+
</div>)
|
|
702
|
+
}
|
|
703
|
+
`),
|
|
702
704
|
)
|
|
703
705
|
})
|
|
704
706
|
|
|
@@ -717,12 +719,12 @@ function test({...rest}) {
|
|
|
717
719
|
)
|
|
718
720
|
expect(output).toBe(
|
|
719
721
|
removeEmptySpace(`
|
|
720
|
-
|
|
721
|
-
return
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
`),
|
|
722
|
+
const ButtonWithProps = ({...props}) => {
|
|
723
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
724
|
+
<button {...props} />
|
|
725
|
+
</div>)
|
|
726
|
+
}
|
|
727
|
+
`),
|
|
726
728
|
)
|
|
727
729
|
})
|
|
728
730
|
|
|
@@ -741,12 +743,12 @@ function test({...rest}) {
|
|
|
741
743
|
)
|
|
742
744
|
expect(output).toBe(
|
|
743
745
|
removeEmptySpace(`
|
|
744
|
-
|
|
745
|
-
return
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
`),
|
|
746
|
+
const ButtonWithProps = ({...rest}) => {
|
|
747
|
+
return (<div data-tsd-source="test.jsx:3:17">
|
|
748
|
+
<button {...rest} />
|
|
749
|
+
</div>)
|
|
750
|
+
}
|
|
751
|
+
`),
|
|
750
752
|
)
|
|
751
753
|
})
|
|
752
754
|
|
|
@@ -763,10 +765,10 @@ function test({...rest}) {
|
|
|
763
765
|
)
|
|
764
766
|
expect(output).toBe(
|
|
765
767
|
removeEmptySpace(`
|
|
766
|
-
|
|
767
|
-
return <button
|
|
768
|
-
}
|
|
769
|
-
`),
|
|
768
|
+
const ButtonWithProps = ({ children, ...rest }) => {
|
|
769
|
+
return <button children={children} data-tsd-source="test.jsx:3:16" />
|
|
770
|
+
}
|
|
771
|
+
`),
|
|
770
772
|
)
|
|
771
773
|
})
|
|
772
774
|
|
|
@@ -784,9 +786,9 @@ function test({...rest}) {
|
|
|
784
786
|
expect(output).toBe(
|
|
785
787
|
removeEmptySpace(`
|
|
786
788
|
const ButtonWithProps = ({ ...props }) => {
|
|
787
|
-
return <button
|
|
788
|
-
}
|
|
789
|
-
`),
|
|
789
|
+
return <button children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
790
|
+
}
|
|
791
|
+
`),
|
|
790
792
|
)
|
|
791
793
|
})
|
|
792
794
|
|
|
@@ -816,9 +818,9 @@ function test({...rest}) {
|
|
|
816
818
|
expect(output).toBe(
|
|
817
819
|
removeEmptySpace(`
|
|
818
820
|
const ButtonWithProps = ({ ...props }) => {
|
|
819
|
-
return <CustomButton
|
|
820
|
-
}
|
|
821
|
-
`),
|
|
821
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
822
|
+
}
|
|
823
|
+
`),
|
|
822
824
|
)
|
|
823
825
|
})
|
|
824
826
|
|
|
@@ -848,9 +850,9 @@ function test({...rest}) {
|
|
|
848
850
|
expect(output).toBe(
|
|
849
851
|
removeEmptySpace(`
|
|
850
852
|
export const ButtonWithProps = ({ ...props }) => {
|
|
851
|
-
return <CustomButton
|
|
852
|
-
}
|
|
853
|
-
`),
|
|
853
|
+
return <CustomButton children={props.children} data-tsd-source="test.jsx:3:16" />
|
|
854
|
+
}
|
|
855
|
+
`),
|
|
854
856
|
)
|
|
855
857
|
})
|
|
856
858
|
})
|
|
@@ -886,4 +888,52 @@ function test({...rest}) {
|
|
|
886
888
|
expect(output).toBe(undefined)
|
|
887
889
|
})
|
|
888
890
|
})
|
|
891
|
+
|
|
892
|
+
describe('non-ASCII source positions', () => {
|
|
893
|
+
// oxc-parser napi bindings return UTF-16 code-unit indices (matching JS
|
|
894
|
+
// string indexing and magic-string's expectations). These tests lock that
|
|
895
|
+
// contract in: positions and inserted attributes must remain correct when
|
|
896
|
+
// the source contains multi-byte UTF-8 characters.
|
|
897
|
+
|
|
898
|
+
it('locates JSX correctly after an emoji string literal', () => {
|
|
899
|
+
const source = `
|
|
900
|
+
const label = "π launch"
|
|
901
|
+
function Comp() {
|
|
902
|
+
return <div />
|
|
903
|
+
}
|
|
904
|
+
`
|
|
905
|
+
const output = addSourceToJsx(source, 'emoji.jsx')!.code
|
|
906
|
+
// line numbers are 1-based; the <div /> is on line 4
|
|
907
|
+
expect(output).toMatch(/<div\s+data-tsd-source="emoji\.jsx:4:10"/)
|
|
908
|
+
})
|
|
909
|
+
|
|
910
|
+
it('locates JSX correctly after CJK characters', () => {
|
|
911
|
+
const source = `
|
|
912
|
+
// δΈζ注ι
|
|
913
|
+
function Comp() {
|
|
914
|
+
return <button />
|
|
915
|
+
}
|
|
916
|
+
`
|
|
917
|
+
const output = addSourceToJsx(source, 'cjk.jsx')!.code
|
|
918
|
+
expect(output).toMatch(/<button\s+data-tsd-source="cjk\.jsx:4:10"/)
|
|
919
|
+
})
|
|
920
|
+
})
|
|
921
|
+
|
|
922
|
+
describe('nested function boundaries', () => {
|
|
923
|
+
it('does not annotate inner-function JSX with the outer propsName', () => {
|
|
924
|
+
// The inner arrow forwards its own innerProps via spread. The outer
|
|
925
|
+
// function must NOT inject data-tsd-source onto that inner element,
|
|
926
|
+
// since it has no relation to the outer `props`.
|
|
927
|
+
const output = addSourceToJsx(
|
|
928
|
+
`
|
|
929
|
+
const Outer = (props) => {
|
|
930
|
+
const Inner = (innerProps) => <span {...innerProps} />
|
|
931
|
+
return <Inner {...props} />
|
|
932
|
+
}
|
|
933
|
+
`,
|
|
934
|
+
'nested.jsx',
|
|
935
|
+
)
|
|
936
|
+
expect(output).toBe(undefined)
|
|
937
|
+
})
|
|
938
|
+
})
|
|
889
939
|
})
|