Skip to content
Source
Sign inSign up
TanStack/router

test: cover compiler output validity and edge cases for code splitting, Hydrate, server functions and the route generator #8629

MergedSheraff(GitHub profile, opens in a new tab)merged 27 commits intomain fromrefs/pull/8629/headmerged by Sheraff(GitHub profile, opens in a new tab)

Showing 29 changed files with 170 additions and 0 deletions (loading 27).

x
0 of 29 viewed, 29 left
51 additions and 0 deletionspackages/react-start-rsc/tests/rscCssTransform.test.tsxModified
View file
@@ -161,4 +161,55 @@
detectKindsInCode(code, 'client', { compilerTransforms }),
).toMatchInlineSnapshot(`Set {}`)
+​
+ test('rewrites render APIs imported from @tanstack/react-start-rsc', async () => {
+ const code = await compileWithRscCssTransform({
+ code: `
+ import { renderServerComponent } from '@tanstack/react-start-rsc'
+​
+ export const renderable = renderServerComponent(<Card />)
+ `,
+ })
+​
+ expect(code).toContain(
+ '__tanstackStartRscCss: import.meta.viteRsc.loadCss()',
+ )
+ })
+​
+ test.each([
+ { wrapped: '(<Card />)', bare: '<Card />' },
+ { wrapped: '<Card /> as any', bare: '<Card />' },
+ { wrapped: '<Card />!', bare: '<Card />' },
+ { wrapped: '(<><Card /></>) satisfies unknown', bare: '<><Card /></>' },
+ ])(
+ 'streams $wrapped like the bare JSX it wraps',