+}
+export {
+ ActualComponent,
+ createBits,
+ DefaultComponent,
+ defaultLoader,
+ loader,
+ MyComponent,
}
-export { ActualComponent, createBits, DefaultComponent, defaultLoader, loader, MyComponent };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring.tsx
index d80f17484f..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring.tsx
@@ -1,11 +1,9 @@
import thing from 'thing'
-
export function test() {
const {
foo: {
bar: { destructured },
},
} = thing
-
return destructured
}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@component.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@component.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@errorComponent.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@errorComponent.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@notFoundComponent.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@notFoundComponent.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue.tsx
index 68f8be0364..5a116073c1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue.tsx
@@ -1,8 +1,8 @@
-'use client';
-
-const $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+'use client'
+const $$splitComponentImporter = () =>
+ import('directive-prologue.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/directive')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@component.tsx
index ce7cd5e5ee..9ee4bd8f4c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@component.tsx
@@ -1,6 +1,5 @@
-'use client';
-
+'use client'
const SplitComponent = () => {
- return
directive preserved
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return
directive preserved
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component.tsx
index 4fdd9d1c68..8109a89624 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component.tsx
@@ -1,6 +1,3 @@
import React from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/')({
- component: undefined,
-})
+export const Route = createFileRoute('/')({ component: undefined })
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@component.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@component.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@notFoundComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@notFoundComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound.tsx
index da4daa9a3f..7154b79acd 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound.tsx
@@ -1,15 +1,23 @@
-console.warn("[tanstack-router] These exports from \"export-default-component-and-normal-notFound.tsx\" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=notFoundComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import React, { useState } from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+console.warn(
+ '[tanstack-router] These exports from "export-default-component-and-normal-notFound.tsx" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitNotFoundComponentImporter = () =>
+ import('export-default-component-and-normal-notFound.tsx?tsr-split=notFoundComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import React, { useState } from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/home')({
component: Home,
- notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')
-});
+ notFoundComponent: lazyRouteComponent(
+ $$splitNotFoundComponentImporter,
+ 'notFoundComponent',
+ ),
+})
export default function Home() {
- const [one, setOne] = useState('this is from a state');
- return
+ const [one, setOne] = useState('this is from a state')
+ return (
+
{one}
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@component.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@component.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@notFoundComponent.tsx
index 62cd0a1036..3da924c04c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@notFoundComponent.tsx
@@ -1,5 +1,5 @@
-import React from 'react';
+import React from 'react'
function NotFoundComponent() {
- return
Not Found
;
+ return
Not Found
}
-export { NotFoundComponent as notFoundComponent };
\ No newline at end of file
+export { NotFoundComponent as notFoundComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component.tsx
index c5198b9e00..de2d748c91 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component.tsx
@@ -1,13 +1,8 @@
import React, { useState } from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/home')({
- component: Home,
-})
-
+export const Route = createFileRoute('/home')({ component: Home })
export default function Home() {
const [one, setOne] = useState('this is from a state')
-
return (
{one}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@component.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@component.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@notFoundComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@notFoundComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter.tsx
index 3ae9710cd5..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter.tsx
@@ -1,29 +1,20 @@
import * as React from 'react'
// @ts-expect-error
import { useMemo } from 'tan-react'
-
const useUsedVar = 'i-am-unused'
-
const ReactUseMemoCall1 = React.useMemo(function performAction() {
return 'true'
}, [])
-
console.info(ReactUseMemoCall1)
-
const ReactUseMemoCall2 = React.useMemo(() => {
return 'true'
}, [])
-
console.info(ReactUseMemoCall2)
-
const UseMemoCall1 = useMemo(function performAction() {
return 'true'
}, [])
-
console.info(UseMemoCall1)
-
const UseMemoCall2 = useMemo(() => {
return 'true'
}, [])
-
console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@component.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@component.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@errorComponent.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@errorComponent.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@notFoundComponent.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@notFoundComponent.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration.tsx
index 5d7e2181f5..e2b672f7b8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration.tsx
@@ -1,9 +1,10 @@
-const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
-import { fetchPosts } from '../posts';
+const $$splitComponentImporter = () =>
+ import('function-declaration.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
+import { fetchPosts } from '../posts'
export const Route = createFileRoute('/posts')({
loader: fetchPosts,
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@component.tsx
index 3476c52d54..a0ebf07dee 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@component.tsx
@@ -1,27 +1,31 @@
-import * as React from 'react';
-import { Link, Outlet } from '@tanstack/react-router';
-import { Route } from "function-declaration.tsx";
+import * as React from 'react'
+import { Link, Outlet } from '@tanstack/react-router'
+import { Route } from 'function-declaration.tsx'
function PostsComponent() {
- const posts = Route.useLoaderData();
- return
}
-export { AboutComponent, AboutComponentImpl, createBits, loader };
\ No newline at end of file
+export { AboutComponent, AboutComponentImpl, createBits, loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function.tsx
index 298c388e65..83b3dd4eb5 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function.tsx
@@ -4,11 +4,9 @@ import {
importedComponent as ImportedComponent,
importedLoader,
} from '../../shared/imported'
-
export function loaderFn() {
return importedLoader()
}
-
function Layout() {
return (
@@ -26,15 +24,12 @@ function Layout() {
)
}
-
export const Route = createFileRoute('/_layout')({
component: Layout,
loader: loaderFn,
})
-
const HEADER_HEIGHT = '63px'
export const SIDEBAR_WIDTH = '150px'
export const SIDEBAR_MINI_WIDTH = '80px'
const ASIDE_WIDTH = '250px'
-
export default Layout
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@component.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@component.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@errorComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@notFoundComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@notFoundComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader.tsx
index 88cd35f704..16357edc27 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader.tsx
@@ -1,16 +1,15 @@
-const $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('retain-exports-loader.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export function loaderFn() {
- return {
- foo: 'bar'
- };
+ return { foo: 'bar' }
}
export const Route = createFileRoute('/_layout')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: loaderFn
-});
-export const SIDEBAR_WIDTH = '150px';
-export const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+ loader: loaderFn,
+})
+export const SIDEBAR_WIDTH = '150px'
+export const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@component.tsx
index 9f54ae0dc5..604be4dc69 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@component.tsx
@@ -1,11 +1,10 @@
-import * as React from 'react';
-import { Outlet } from '@tanstack/react-router';
-import { importedComponent as ImportedComponent } from '../../shared/imported';
+import * as React from 'react'
+import { Outlet } from '@tanstack/react-router'
+import { importedComponent as ImportedComponent } from '../../shared/imported'
function Layout() {
- return
-
+ return (
+
+
- ;
+
+ )
}
-const HEADER_HEIGHT = '63px';
-const ASIDE_WIDTH = '250px';
-export { Layout as component };
\ No newline at end of file
+const HEADER_HEIGHT = '63px'
+const ASIDE_WIDTH = '250px'
+export { Layout as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@errorComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@notFoundComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@notFoundComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class.tsx
index 6e2f0229e4..19509e3bdd 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class.tsx
@@ -1,10 +1,11 @@
-import { store } from "shared-class.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+import { store } from 'shared-class.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-class.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/store')({
loader: async () => {
- store.set('items', await fetch('/api'));
+ store.set('items', await fetch('/api'))
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@component.tsx
index 6a38b10ff8..e0e187fb1d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@component.tsx
@@ -1,3 +1,3 @@
-import { store } from "shared-class.tsx?tsr-shared=1";
-const SplitComponent = () =>
{store.get('items')}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { store } from 'shared-class.tsx?tsr-shared=1'
+const SplitComponent = () =>
{store.get('items')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@shared.tsx
index 18c40bafb6..0abc282ecc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@shared.tsx
@@ -1,11 +1,11 @@
class DataStore {
- data = new Map();
+ data = new Map()
get(k: string) {
- return this.data.get(k);
+ return this.data.get(k)
}
set(k: string, v: unknown) {
- this.data.set(k, v);
+ this.data.set(k, v)
}
}
-const store = new DataStore();
-export { DataStore, store };
\ No newline at end of file
+const store = new DataStore()
+export { DataStore, store }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export.tsx
index 9453dbfbda..dc4d2d383f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export.tsx
@@ -1,9 +1,10 @@
-import { apiUrl } from "shared-destructured-export.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+import { apiUrl } from 'shared-destructured-export.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-destructured-export.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/config')({
loader: async () => fetch(apiUrl),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-export { apiUrl, timeout } from "shared-destructured-export.tsx?tsr-shared=1";
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+export { apiUrl, timeout } from 'shared-destructured-export.tsx?tsr-shared=1'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@component.tsx
index 16b288ac5f..8cd0f14a27 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@component.tsx
@@ -1,3 +1,3 @@
-import { timeout } from "shared-destructured-export.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { timeout } from 'shared-destructured-export.tsx?tsr-shared=1'
+const SplitComponent = () =>
Timeout: {timeout}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@shared.tsx
index f0bfd70add..ae9324acc9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@shared.tsx
@@ -1,11 +1,5 @@
-const {
- apiUrl,
- timeout
-} = getConfig();
+const { apiUrl, timeout } = getConfig()
function getConfig() {
- return {
- apiUrl: '/api',
- timeout: 5000
- };
+ return { apiUrl: '/api', timeout: 5000 }
}
-export { apiUrl, getConfig, timeout };
\ No newline at end of file
+export { apiUrl, getConfig, timeout }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured.tsx
index 3019454516..b1d4f96065 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured.tsx
@@ -1,8 +1,9 @@
-import { apiUrl } from "shared-destructured.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-destructured.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+import { apiUrl } from 'shared-destructured.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-destructured.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/config')({
loader: async () => fetch(apiUrl),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@component.tsx
index 5c0182e61a..3d7933a573 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@component.tsx
@@ -1,3 +1,3 @@
-import { timeout } from "shared-destructured.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { timeout } from 'shared-destructured.tsx?tsr-shared=1'
+const SplitComponent = () =>
;
-export { SplitComponent as component };
\ No newline at end of file
+import { queryOptions } from 'shared-exported.tsx?tsr-shared=1'
+const SplitComponent = () =>
;
-export { SplitComponent as component };
\ No newline at end of file
+import { getCached } from 'shared-function.tsx?tsr-shared=1'
+const SplitComponent = () =>
{JSON.stringify(getCached('data'))}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@shared.tsx
index 27d2cf03f1..243ac23a66 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@shared.tsx
@@ -1,5 +1,5 @@
-const cache = new Map();
+const cache = new Map()
function getCached(key: string) {
- return cache.get(key);
+ return cache.get(key)
}
-export { cache, getCached };
\ No newline at end of file
+export { cache, getCached }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding.tsx
index c3e284c081..da3387c5fd 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding.tsx
@@ -1,8 +1,9 @@
-const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-import { sharedUtil } from '../utils';
+const $$splitComponentImporter = () =>
+ import('shared-imported-binding.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+import { sharedUtil } from '../utils'
export const Route = createFileRoute('/imported')({
loader: async () => sharedUtil('load'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@component.tsx
index 0a835ae063..e3c8a0f5d8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@component.tsx
@@ -1,3 +1,3 @@
-import { sharedUtil } from '../utils';
-const SplitComponent = () =>
{sharedUtil('render')}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { sharedUtil } from '../utils'
+const SplitComponent = () =>
{sharedUtil('render')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref.tsx
index 889dd57cf0..244f566066 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref.tsx
@@ -1,13 +1,12 @@
-import { state, getCount } from "shared-indirect-ref.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+import { state, getCount } from 'shared-indirect-ref.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-indirect-ref.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/shared-indirect')({
loader: () => {
- state.count++;
- return {
- count: getCount()
- };
+ state.count++
+ return { count: getCount() }
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@component.tsx
index 62995e7fd8..64bb6ab567 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@component.tsx
@@ -1,7 +1,9 @@
-import { state, getCount } from "shared-indirect-ref.tsx?tsr-shared=1";
+import { state, getCount } from 'shared-indirect-ref.tsx?tsr-shared=1'
function SharedComponent() {
- return
+ return (
+
{getCount()} - {state.count}
-
;
+
+ )
}
-export { SharedComponent as component };
\ No newline at end of file
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@shared.tsx
index 7e7e811ba8..b4910d2fd1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@shared.tsx
@@ -1,7 +1,5 @@
-const state = {
- count: 0
-};
+const state = { count: 0 }
function getCount() {
- return state.count;
+ return state.count
}
-export { getCount, state };
\ No newline at end of file
+export { getCount, state }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref.tsx
index 728caca361..6b29c09f33 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref.tsx
@@ -1,9 +1,10 @@
-import { shared } from "shared-jsx-component-ref.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
+import { shared } from 'shared-jsx-component-ref.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-jsx-component-ref.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
// @ts-nocheck
-import { createFileRoute } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/jsx')({
loader: () => shared,
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@component.tsx
index 52ecb6d474..845e1db45c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@component.tsx
@@ -1,5 +1,5 @@
-import { shared } from "shared-jsx-component-ref.tsx?tsr-shared=1"; // @ts-nocheck
+import { shared } from 'shared-jsx-component-ref.tsx?tsr-shared=1' // @ts-nocheck
function SharedComponent() {
- return
{shared}
;
+ return
{shared}
}
-export { SharedComponent as component };
\ No newline at end of file
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@shared.tsx
index d5cc2cf990..60ae1006a1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@shared.tsx
@@ -1,4 +1,3 @@
// @ts-nocheck
-
-const shared = 1;
-export { shared };
\ No newline at end of file
+const shared = 1
+export { shared }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none.tsx
index dd352bfc41..6d0ece44ba 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none.tsx
@@ -1,8 +1,9 @@
-const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-const loaderHelper = () => fetch('/api');
+const $$splitComponentImporter = () =>
+ import('shared-none.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+const loaderHelper = () => fetch('/api')
export const Route = createFileRoute('/clean')({
loader: async () => loaderHelper(),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@component.tsx
index 701deeedeb..1bfd4eb63f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@component.tsx
@@ -1,5 +1,7 @@
-const ComponentHelper = () => helper;
-const SplitComponent = () =>
-
-
;
-export { SplitComponent as component };
\ No newline at end of file
+const ComponentHelper = () => helper
+const SplitComponent = () => (
+
+
+
+)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route.tsx
index f82ac5b900..1ac3428ebc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route.tsx
@@ -1,16 +1,15 @@
-import { HEADER } from "shared-referencing-route.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+import { HEADER } from 'shared-referencing-route.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-referencing-route.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
function usePageTitle() {
- return `${HEADER} - ${Route.fullPath}`;
+ return `${HEADER} - ${Route.fullPath}`
}
export const Route = createFileRoute('/about')({
loader: async () => {
- const title = usePageTitle();
- return {
- title
- };
+ const title = usePageTitle()
+ return { title }
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@component.tsx
index 2cb2cdb68c..b2c4630c90 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@component.tsx
@@ -1,10 +1,10 @@
-import { HEADER } from "shared-referencing-route.tsx?tsr-shared=1";
+import { HEADER } from 'shared-referencing-route.tsx?tsr-shared=1'
function usePageTitle() {
- return `${HEADER} - ${Route.fullPath}`;
+ return `${HEADER} - ${Route.fullPath}`
}
-import { Route } from "shared-referencing-route.tsx";
+import { Route } from 'shared-referencing-route.tsx'
const SplitComponent = () => {
- const title = usePageTitle();
- return
{title}
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ const title = usePageTitle()
+ return
{title}
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@shared.tsx
index cc2d01424c..34b9c4ca41 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@shared.tsx
@@ -1,2 +1,2 @@
-const HEADER = 'Page';
-export { HEADER };
\ No newline at end of file
+const HEADER = 'Page'
+export { HEADER }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime.tsx
index c230b4d37f..17d70ca9bd 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime.tsx
@@ -1,23 +1,25 @@
-import { state, createState, createSeed, increment } from "shared-runtime.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-runtime.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('shared-runtime:reference');
+import {
+ state,
+ createState,
+ createSeed,
+ increment,
+} from 'shared-runtime.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-runtime.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('shared-runtime:reference')
export const Route = createFileRoute('/shared-runtime')({
beforeLoad: () => state,
loader: () => {
- increment();
- return state;
+ increment()
+ return state
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@component.tsx
index fbccf6c90b..5245f6d9eb 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@component.tsx
@@ -1,23 +1,24 @@
-import { state, createState, createSeed, Labels } from "shared-runtime.tsx?tsr-shared=1";
-const label = createComponentLabel();
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-function createComponentLabel() {
- console.log('shared-runtime:component');
- return Labels.component;
+import {
+ state,
+ createState,
+ createSeed,
+ Labels,
+} from 'shared-runtime.tsx?tsr-shared=1'
+const label = createComponentLabel()
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
}
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
+function createComponentLabel() {
+ console.log('shared-runtime:component')
+ return Labels.component
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
const SplitComponent = () => {
if (state.count === 3) {
- throw new Error('route source-map contract');
+ throw new Error('route source-map contract')
}
- return `${label}:${state.count}`;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return `${label}:${state.count}`
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@errorComponent.tsx
index d890a562c9..03cacac5b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@errorComponent.tsx
@@ -1,11 +1,7 @@
-import { state, createState, createSeed } from "shared-runtime.tsx?tsr-shared=1";
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+import { state, createState, createSeed } from 'shared-runtime.tsx?tsr-shared=1'
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@notFoundComponent.tsx
index d890a562c9..03cacac5b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@notFoundComponent.tsx
@@ -1,11 +1,7 @@
-import { state, createState, createSeed } from "shared-runtime.tsx?tsr-shared=1";
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+import { state, createState, createSeed } from 'shared-runtime.tsx?tsr-shared=1'
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@shared.tsx
index 54239b6cc5..c53a7e1568 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-runtime@shared.tsx
@@ -1,28 +1,13 @@
-const Count = {
- Initial: 0
-};
-const Labels = {
- component: 'count'
-};
-const seed = createSeed();
-const {
- state,
- increment
-} = createState(seed);
+const Count = { Initial: 0 }
+const Labels = { component: 'count' }
+const seed = createSeed()
+const { state, increment } = createState(seed)
function createSeed() {
- console.log('shared-runtime:seed');
- return {
- count: Count.Initial,
- label: Labels.component
- };
+ console.log('shared-runtime:seed')
+ return { count: Count.Initial, label: Labels.component }
}
-function createState(initialState: {
- count: number;
-}) {
- console.log('shared-runtime:state');
- return {
- state: initialState,
- increment: () => initialState.count++
- };
+function createState(initialState: { count: number }) {
+ console.log('shared-runtime:state')
+ return { state: initialState, increment: () => initialState.count++ }
}
-export { Count, createSeed, createState, increment, Labels, seed, state };
\ No newline at end of file
+export { Count, createSeed, createState, increment, Labels, seed, state }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive.tsx
index ce5a10c47c..3860bd4688 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive.tsx
@@ -1,11 +1,12 @@
-import { config } from "shared-transitive.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-const fetcher = (path: string) => fetch(`${config.url}${path}`);
+import { config } from 'shared-transitive.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-transitive.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+const fetcher = (path: string) => fetch(`${config.url}${path}`)
export const Route = createFileRoute('/api')({
loader: async () => {
- return fetcher('/data');
+ return fetcher('/data')
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@component.tsx
index 7a3a74048e..c237a03583 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@component.tsx
@@ -1,3 +1,3 @@
-import { config } from "shared-transitive.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {config.timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { config } from 'shared-transitive.tsx?tsr-shared=1'
+const SplitComponent = () =>
;
-export { SplitComponent as component };
\ No newline at end of file
+import { collection } from 'shared-variable.tsx?tsr-shared=1'
+const SplitComponent = () =>
{collection.name}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@shared.tsx
index 8a0560d5b9..10421dac09 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@shared.tsx
@@ -1,5 +1,2 @@
-const collection = {
- name: 'todos',
- preload: async () => {}
-};
-export { collection };
\ No newline at end of file
+const collection = { name: 'todos', preload: async () => {} }
+export { collection }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect.tsx
index cba0c7770b..39bbc717d9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect.tsx
@@ -1,11 +1,12 @@
-import { registry } from "shared-with-side-effect.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('registry created');
+import { registry } from 'shared-with-side-effect.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-with-side-effect.tsx?tsr-split=component')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('registry created')
export const Route = createFileRoute('/fx')({
loader: async () => {
- registry.set('loaded', true);
+ registry.set('loaded', true)
},
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@component.tsx
index d953af00fa..3ede22c8be 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@component.tsx
@@ -1,3 +1,3 @@
-import { registry } from "shared-with-side-effect.tsx?tsr-shared=1";
-const SplitComponent = () =>
{registry.size}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { registry } from 'shared-with-side-effect.tsx?tsr-shared=1'
+const SplitComponent = () =>
+}
+export {
+ ActualComponent,
+ createBits,
+ DefaultComponent,
+ defaultLoader,
+ loader,
+ MyComponent,
}
-export { ActualComponent, createBits, DefaultComponent, defaultLoader, loader, MyComponent };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring.tsx
index d80f17484f..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring.tsx
@@ -1,11 +1,9 @@
import thing from 'thing'
-
export function test() {
const {
foo: {
bar: { destructured },
},
} = thing
-
return destructured
}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@loader.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@loader.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue.tsx
index 12d3529331..a5bca5a02c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue.tsx
@@ -1,8 +1,8 @@
-'use client';
-
-const $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+'use client'
+const $$splitComponentImporter = () =>
+ import('directive-prologue.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/directive')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@component---errorComponent---notFoundComponent---pendingComponent.tsx
index ce7cd5e5ee..9ee4bd8f4c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,6 +1,5 @@
-'use client';
-
+'use client'
const SplitComponent = () => {
- return
directive preserved
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return
directive preserved
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component.tsx
index 4fdd9d1c68..8109a89624 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component.tsx
@@ -1,6 +1,3 @@
import React from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/')({
- component: undefined,
-})
+export const Route = createFileRoute('/')({ component: undefined })
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@loader.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@loader.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound.tsx
index 0ca25a7017..fc6cef74a4 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound.tsx
@@ -1,15 +1,23 @@
-console.warn("[tanstack-router] These exports from \"export-default-component-and-normal-notFound.tsx\" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import React, { useState } from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+console.warn(
+ '[tanstack-router] These exports from "export-default-component-and-normal-notFound.tsx" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitNotFoundComponentImporter = () =>
+ import('export-default-component-and-normal-notFound.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import React, { useState } from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/home')({
component: Home,
- notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')
-});
+ notFoundComponent: lazyRouteComponent(
+ $$splitNotFoundComponentImporter,
+ 'notFoundComponent',
+ ),
+})
export default function Home() {
- const [one, setOne] = useState('this is from a state');
- return
+ const [one, setOne] = useState('this is from a state')
+ return (
+
{one}
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 62cd0a1036..3da924c04c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import React from 'react';
+import React from 'react'
function NotFoundComponent() {
- return
Not Found
;
+ return
Not Found
}
-export { NotFoundComponent as notFoundComponent };
\ No newline at end of file
+export { NotFoundComponent as notFoundComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@loader.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@loader.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component.tsx
index c5198b9e00..de2d748c91 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component.tsx
@@ -1,13 +1,8 @@
import React, { useState } from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/home')({
- component: Home,
-})
-
+export const Route = createFileRoute('/home')({ component: Home })
export default function Home() {
const [one, setOne] = useState('this is from a state')
-
return (
{one}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@loader.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@loader.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter.tsx
index 3ae9710cd5..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter.tsx
@@ -1,29 +1,20 @@
import * as React from 'react'
// @ts-expect-error
import { useMemo } from 'tan-react'
-
const useUsedVar = 'i-am-unused'
-
const ReactUseMemoCall1 = React.useMemo(function performAction() {
return 'true'
}, [])
-
console.info(ReactUseMemoCall1)
-
const ReactUseMemoCall2 = React.useMemo(() => {
return 'true'
}, [])
-
console.info(ReactUseMemoCall2)
-
const UseMemoCall1 = useMemo(function performAction() {
return 'true'
}, [])
-
console.info(UseMemoCall1)
-
const UseMemoCall2 = useMemo(() => {
return 'true'
}, [])
-
console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@loader.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@loader.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration.tsx
index c191f9fddd..b12490e0a5 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('function-declaration.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('function-declaration.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 3476c52d54..a0ebf07dee 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,27 +1,31 @@
-import * as React from 'react';
-import { Link, Outlet } from '@tanstack/react-router';
-import { Route } from "function-declaration.tsx";
+import * as React from 'react'
+import { Link, Outlet } from '@tanstack/react-router'
+import { Route } from 'function-declaration.tsx'
function PostsComponent() {
- const posts = Route.useLoaderData();
- return
+ )
}
-export { PostsComponent as component };
\ No newline at end of file
+export { PostsComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@loader.tsx
index cb195afdd8..1c4fc213ed 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@loader.tsx
@@ -1,4 +1,4 @@
-import * as React from 'react';
-import { fetchPosts } from '../posts';
-const SplitLoader = fetchPosts;
-export { SplitLoader as loader };
\ No newline at end of file
+import * as React from 'react'
+import { fetchPosts } from '../posts'
+const SplitLoader = fetchPosts
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute.tsx
index e2aab465f5..b6b9c182dc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute.tsx
@@ -1,6 +1,7 @@
-const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('importAttribute.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@component---errorComponent---notFoundComponent---pendingComponent.tsx
index f34d3c6408..88abef0c00 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { test } from './test' with { type: 'macro' };
-const SplitComponent = () => test;
-export { SplitComponent as component };
\ No newline at end of file
+import { test } from './test' with { type: 'macro' }
+const SplitComponent = () => test
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader.tsx
index 70d5be8c3f..969129bdf2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('imported-default-component-destructured-loader.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('imported-default-component-destructured-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
index d21b198c98..9350cda9e8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import importedComponent from '../../shared/imported';
-const SplitComponent = importedComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import importedComponent from '../../shared/imported'
+const SplitComponent = importedComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@loader.tsx
index 52e811be53..8691aec6ff 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@loader.tsx
@@ -1,3 +1,3 @@
-import { importedLoader } from '../../shared/imported';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import { importedLoader } from '../../shared/imported'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component.tsx
index 601c1f656a..f793a41de9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component.tsx
@@ -1,6 +1,7 @@
-const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('imported-default-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 31ccf07c52..d356227040 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import ImportedDefaultComponent from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import ImportedDefaultComponent from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent.tsx
index 4df12c02de..13e87eb7f1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitErrorComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitErrorComponentImporter = () =>
+ import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')
-});
\ No newline at end of file
+ errorComponent: lazyRouteComponent(
+ $$splitErrorComponentImporter,
+ 'errorComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
index d8a0fcf9ff..b5bded20a6 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-import ImportedDefaultComponent, { importedErrorComponent } from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
-const SplitErrorComponent = importedErrorComponent;
-export { SplitErrorComponent as errorComponent };
\ No newline at end of file
+import ImportedDefaultComponent, {
+ importedErrorComponent,
+} from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
+const SplitErrorComponent = importedErrorComponent
+export { SplitErrorComponent as errorComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent.tsx
index 716ec0ca3a..48b7f7f6bf 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitNotFoundComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitNotFoundComponentImporter = () =>
+ import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')
-});
\ No newline at end of file
+ notFoundComponent: lazyRouteComponent(
+ $$splitNotFoundComponentImporter,
+ 'notFoundComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 1273c7c50d..9f904a1a19 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-import ImportedDefaultComponent, { importedNotFoundComponent } from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
-const SplitNotFoundComponent = importedNotFoundComponent;
-export { SplitNotFoundComponent as notFoundComponent };
\ No newline at end of file
+import ImportedDefaultComponent, {
+ importedNotFoundComponent,
+} from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
+const SplitNotFoundComponent = importedNotFoundComponent
+export { SplitNotFoundComponent as notFoundComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent.tsx
index 5a5aa789f7..c22e117560 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitPendingComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitPendingComponentImporter = () =>
+ import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent')
-});
\ No newline at end of file
+ pendingComponent: lazyRouteComponent(
+ $$splitPendingComponentImporter,
+ 'pendingComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 0368000afa..d24c7b1505 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-import ImportedDefaultComponent, { importedPendingComponent } from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
-const SplitPendingComponent = importedPendingComponent;
-export { SplitPendingComponent as pendingComponent };
\ No newline at end of file
+import ImportedDefaultComponent, {
+ importedPendingComponent,
+} from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
+const SplitPendingComponent = importedPendingComponent
+export { SplitPendingComponent as pendingComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported.tsx
index dd3299b1b1..54a7733167 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported.tsx
@@ -1,9 +1,10 @@
-const $$splitLoaderImporter = () => import('imported.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('imported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () => import('imported.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('imported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 5bc9da8d43..e3c06dbe9e 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { importedComponent } from '../../shared';
-const SplitComponent = importedComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import { importedComponent } from '../../shared'
+const SplitComponent = importedComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@loader.tsx
index 9b91fafd91..d0418cbce3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@loader.tsx
@@ -1,3 +1,3 @@
-import { importedLoader } from '../../shared';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import { importedLoader } from '../../shared'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline.tsx
index 960f639c0a..3c27842428 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline.tsx
@@ -1,9 +1,10 @@
-const $$splitComponentImporter = () => import('inline.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('inline.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-Route.addChildren([]);
-export const test = 'test';
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+Route.addChildren([])
+export const test = 'test'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 58ccfb2903..d28b872634 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,18 +1,18 @@
-import * as React from 'react';
-import * as styles from '../style.css';
-import { TEST_DATA } from '../test.const';
-const Button = (props: {
- children: any;
-}) => {
- return ;
-};
-import { Route } from "inline.tsx";
-import { test } from "inline.tsx";
+import * as React from 'react'
+import * as styles from '../style.css'
+import { TEST_DATA } from '../test.const'
+const Button = (props: { children: any }) => {
+ return
+}
+import { Route } from 'inline.tsx'
+import { test } from 'inline.tsx'
const SplitComponent = () => {
- return
- {test}
-
{TEST_DATA.welcome}
-
-
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return (
+
+ {test}
+
{TEST_DATA.welcome}
+
+
+ )
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx
index 9236af6021..23fab71edc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-import { Route } from "inline.tsx";
\ No newline at end of file
+import * as React from 'react'
+import { Route } from 'inline.tsx'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration.tsx
index 75657cb44a..79ef82a7af 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration.tsx
@@ -1,10 +1,19 @@
-const $$splitErrorComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-const $$splitPendingComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitErrorComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+const $$splitPendingComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent'),
- errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')
-});
\ No newline at end of file
+ pendingComponent: lazyRouteComponent(
+ $$splitPendingComponentImporter,
+ 'pendingComponent',
+ ),
+ errorComponent: lazyRouteComponent(
+ $$splitErrorComponentImporter,
+ 'errorComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 86876d616e..ec003091fb 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/lowercase-function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,12 +1,12 @@
function component() {
- return
lowercase function declaration
;
+ return
lowercase function declaration
}
function pendingComponent() {
- return
lowercase pending function declaration
;
+ return
lowercase pending function declaration
}
function errorComponent() {
- return
lowercase error function declaration
;
+ return
lowercase error function declaration
}
-export { component };
-export { pendingComponent };
-export { errorComponent };
\ No newline at end of file
+export { component }
+export { pendingComponent }
+export { errorComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number.tsx
index a345d17ae7..440e1f4253 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number.tsx
@@ -1,28 +1,41 @@
-const $$splitComponentImporter = () => import('random-number.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('random-number.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { Await, Link, createFileRoute } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-export const textColors = [`text-rose-500`, `text-yellow-500`, `text-teal-500`, `text-blue-500`];
-export const gradients = [`from-rose-500 to-yellow-500`, `from-yellow-500 to-teal-500`, `from-teal-500 to-violet-500`, `from-blue-500 to-pink-500`];
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
+const $$splitComponentImporter = () =>
+ import('random-number.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () => import('random-number.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { Await, Link, createFileRoute } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+export const textColors = [
+ `text-rose-500`,
+ `text-yellow-500`,
+ `text-teal-500`,
+ `text-blue-500`,
+]
+export const gradients = [
+ `from-rose-500 to-yellow-500`,
+ `from-yellow-500 to-teal-500`,
+ `from-teal-500 to-violet-500`,
+ `from-blue-500 to-pink-500`,
+]
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
export const Route = createFileRoute('/')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 9ed6d15184..26a9f9c142 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,61 +1,48 @@
-import { Await, Link } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import discordImage from '~/images/discord-logo-white.svg';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-import { useMutation } from '~/hooks/useMutation';
-import { sample } from '~/utils/utils';
-import { textColors } from "random-number.tsx";
-import { gradients } from "random-number.tsx";
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
-import { Route } from "random-number.tsx";
-async function bytesSignupServerFn({
- email
-}: {
- email: string;
-}) {
- 'use server';
-
+import { Await, Link } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import discordImage from '~/images/discord-logo-white.svg'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+import { useMutation } from '~/hooks/useMutation'
+import { sample } from '~/utils/utils'
+import { textColors } from 'random-number.tsx'
+import { gradients } from 'random-number.tsx'
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
+import { Route } from 'random-number.tsx'
+async function bytesSignupServerFn({ email }: { email: string }) {
+ 'use server'
return fetch(`https://bytes.dev/api/bytes-optin-cors`, {
method: 'POST',
- body: JSON.stringify({
- email,
- influencer: 'tanstack'
- }),
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json'
- }
- });
+ body: JSON.stringify({ email, influencer: 'tanstack' }),
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
+ })
}
function Index() {
- const bytesSignupMutation = useMutation({
- fn: bytesSignupServerFn
- });
- const {
- sponsorsPromise,
- randomNumber,
- testing2
- } = Route.useLoaderData();
- const gradient = sample(gradients, randomNumber);
- const textColor = sample(textColors, randomNumber);
- return <>
+ const bytesSignupMutation = useMutation({ fn: bytesSignupServerFn })
+ const { sponsorsPromise, randomNumber, testing2 } = Route.useLoaderData()
+ const gradient = sample(gradients, randomNumber)
+ const textColor = sample(textColors, randomNumber)
+ return (
+ <>
{discordImage}
{gradient}
{textColor}
- >;
+ >
+ )
}
-export { Index as component };
\ No newline at end of file
+export { Index as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@loader.tsx
index 9f854acfb0..0e7d41451e 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@loader.tsx
@@ -1,26 +1,28 @@
-import { Await, Link, defer } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import { getSponsorsForSponsorPack } from '~/server/sponsors';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
+import { Await, Link, defer } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import { getSponsorsForSponsorPack } from '~/server/sponsors'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
const SplitLoader = () => {
return {
randomNumber: Math.random(),
- sponsorsPromise: defer(getSponsorsForSponsorPack())
- };
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ sponsorsPromise: defer(getSponsorsForSponsorPack()),
+ }
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component.tsx
index eea3e62996..9be4f76d08 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('react-memo-component.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('react-memo-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('react-memo-component.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('react-memo-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index dfef29c9e3..6bdb537fe9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,6 +1,6 @@
-import React from 'react';
+import React from 'react'
function Component() {
- return
Component
;
+ return
Component
}
-const SplitComponent = React.memo(Component);
-export { SplitComponent as component };
\ No newline at end of file
+const SplitComponent = React.memo(Component)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@loader.tsx
index 52e811be53..8691aec6ff 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@loader.tsx
@@ -1,3 +1,3 @@
-import { importedLoader } from '../../shared/imported';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import { importedLoader } from '../../shared/imported'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component.tsx
index e445bcbb72..2637f8de7a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('react-memo-imported-component.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('react-memo-imported-component.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('react-memo-imported-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 540812230e..d162a1aeaf 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
-import { importedComponent } from '../../shared/imported';
-const SplitComponent = React.memo(importedComponent);
-export { SplitComponent as component };
\ No newline at end of file
+import React from 'react'
+import { importedComponent } from '../../shared/imported'
+const SplitComponent = React.memo(importedComponent)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@loader.tsx
index 52e811be53..8691aec6ff 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@loader.tsx
@@ -1,3 +1,3 @@
-import { importedLoader } from '../../shared/imported';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import { importedLoader } from '../../shared/imported'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component.tsx
index f22aa236e1..1b374dd690 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component.tsx
@@ -1,14 +1,16 @@
-console.warn("[tanstack-router] These exports from \"retain-export-component.tsx\" will not be code-split and will increase your bundle size:\n- Layout\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitLoaderImporter = () => import('retain-export-component.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute, Outlet } from '@tanstack/react-router';
-import { importedComponent as ImportedComponent } from '../../shared/imported';
+console.warn(
+ '[tanstack-router] These exports from "retain-export-component.tsx" will not be code-split and will increase your bundle size:\n- Layout\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitLoaderImporter = () =>
+ import('retain-export-component.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute, Outlet } from '@tanstack/react-router'
+import { importedComponent as ImportedComponent } from '../../shared/imported'
export function Layout() {
- return
-
+ return (
+
+
- ;
+
+ )
}
export const Route = createFileRoute('/_layout')({
component: Layout,
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
-const HEADER_HEIGHT = '63px';
-export const SIDEBAR_WIDTH = '150px';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
+const HEADER_HEIGHT = '63px'
+export const SIDEBAR_WIDTH = '150px'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 5bb0ab5451..8fb12f0c6b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import * as React from 'react';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@loader.tsx
index 9787e27ad7..ddeb4d1e6f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@loader.tsx
@@ -1,6 +1,6 @@
-import * as React from 'react';
-import { importedLoader } from '../../shared/imported';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import * as React from 'react'
+import { importedLoader } from '../../shared/imported'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const.tsx
index f256b01a83..d674dbb799 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const.tsx
@@ -4,11 +4,9 @@ import {
importedComponent as ImportedComponent,
importedLoader,
} from '../../shared/imported'
-
export const loaderFn = () => {
return importedLoader()
}
-
const Layout = () => {
return (
@@ -26,15 +24,12 @@ const Layout = () => {
)
}
-
export const Route = createFileRoute('/_layout')({
component: Layout,
loader: loaderFn,
})
-
const HEADER_HEIGHT = '63px'
export const SIDEBAR_WIDTH = '150px'
export const SIDEBAR_MINI_WIDTH = '80px'
const ASIDE_WIDTH = '250px'
-
export default Layout
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@loader.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@loader.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
index 0e3175116f..89c23305a0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
@@ -1,18 +1,12 @@
import { createFileRoute } from '@tanstack/react-router'
-
const createBits = () => ({
component: AboutComponentImpl,
- loader: () => ({
- message: 'hello',
- }),
+ loader: () => ({ message: 'hello' }),
})
-
export const { component: AboutComponent, loader } = createBits()
-
function AboutComponentImpl() {
return
About
}
-
export const Route = createFileRoute('/about')({
component: AboutComponent,
loader,
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
index a6d57afe77..d64b42fdcc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import { AboutComponent } from "retain-exports-destructured.tsx?tsr-shared=1";
-export { AboutComponent as component };
\ No newline at end of file
+import { AboutComponent } from 'retain-exports-destructured.tsx?tsr-shared=1'
+export { AboutComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
index e8d771ea44..0397569b0f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
@@ -1,2 +1,2 @@
-import { loader } from "retain-exports-destructured.tsx?tsr-shared=1";
-export { loader };
\ No newline at end of file
+import { loader } from 'retain-exports-destructured.tsx?tsr-shared=1'
+export { loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@shared.tsx
index b03a4eb83a..6eff1ff083 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@shared.tsx
@@ -1,14 +1,9 @@
const createBits = () => ({
component: AboutComponentImpl,
- loader: () => ({
- message: 'hello'
- })
-});
-const {
- component: AboutComponent,
- loader
-} = createBits();
+ loader: () => ({ message: 'hello' }),
+})
+const { component: AboutComponent, loader } = createBits()
function AboutComponentImpl() {
- return
About
;
+ return
About
}
-export { AboutComponent, AboutComponentImpl, createBits, loader };
\ No newline at end of file
+export { AboutComponent, AboutComponentImpl, createBits, loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function.tsx
index 298c388e65..83b3dd4eb5 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function.tsx
@@ -4,11 +4,9 @@ import {
importedComponent as ImportedComponent,
importedLoader,
} from '../../shared/imported'
-
export function loaderFn() {
return importedLoader()
}
-
function Layout() {
return (
@@ -26,15 +24,12 @@ function Layout() {
)
}
-
export const Route = createFileRoute('/_layout')({
component: Layout,
loader: loaderFn,
})
-
const HEADER_HEIGHT = '63px'
export const SIDEBAR_WIDTH = '150px'
export const SIDEBAR_MINI_WIDTH = '80px'
const ASIDE_WIDTH = '250px'
-
export default Layout
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@loader.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@loader.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader.tsx
index c7d5437729..ef230c47f6 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader.tsx
@@ -1,17 +1,18 @@
-console.warn("[tanstack-router] These exports from \"retain-exports-loader.tsx\" will not be code-split and will increase your bundle size:\n- loaderFn\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+console.warn(
+ '[tanstack-router] These exports from "retain-exports-loader.tsx" will not be code-split and will increase your bundle size:\n- loaderFn\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitComponentImporter = () =>
+ import('retain-exports-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export function loaderFn() {
- return {
- foo: 'bar'
- };
+ return { foo: 'bar' }
}
export const Route = createFileRoute('/_layout')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: loaderFn
-});
-export const SIDEBAR_WIDTH = '150px';
-export const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+ loader: loaderFn,
+})
+export const SIDEBAR_WIDTH = '150px'
+export const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 9f54ae0dc5..604be4dc69 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,11 +1,10 @@
-import * as React from 'react';
-import { Outlet } from '@tanstack/react-router';
-import { importedComponent as ImportedComponent } from '../../shared/imported';
+import * as React from 'react'
+import { Outlet } from '@tanstack/react-router'
+import { importedComponent as ImportedComponent } from '../../shared/imported'
function Layout() {
- return
-
+ return (
+
+
- ;
+
+ )
}
-const HEADER_HEIGHT = '63px';
-const ASIDE_WIDTH = '250px';
-export { Layout as component };
\ No newline at end of file
+const HEADER_HEIGHT = '63px'
+const ASIDE_WIDTH = '250px'
+export { Layout as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@loader.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@loader.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class.tsx
index da068daa17..96d51c8492 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class.tsx
@@ -1,9 +1,10 @@
-const $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-class.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-class.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () => import('shared-class.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/store')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 6a38b10ff8..e0e187fb1d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { store } from "shared-class.tsx?tsr-shared=1";
-const SplitComponent = () =>
{store.get('items')}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { store } from 'shared-class.tsx?tsr-shared=1'
+const SplitComponent = () =>
{store.get('items')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@loader.tsx
index f91799f3c8..96dcaca4a8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@loader.tsx
@@ -1,5 +1,5 @@
-import { store } from "shared-class.tsx?tsr-shared=1";
+import { store } from 'shared-class.tsx?tsr-shared=1'
const SplitLoader = async () => {
- store.set('items', await fetch('/api'));
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ store.set('items', await fetch('/api'))
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@shared.tsx
index 18c40bafb6..0abc282ecc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@shared.tsx
@@ -1,11 +1,11 @@
class DataStore {
- data = new Map();
+ data = new Map()
get(k: string) {
- return this.data.get(k);
+ return this.data.get(k)
}
set(k: string, v: unknown) {
- this.data.set(k, v);
+ this.data.set(k, v)
}
}
-const store = new DataStore();
-export { DataStore, store };
\ No newline at end of file
+const store = new DataStore()
+export { DataStore, store }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export.tsx
index 7d0f0fcae1..080a19ff45 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-destructured-export.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-destructured-export.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/config')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-export { apiUrl, timeout } from "shared-destructured-export.tsx?tsr-shared=1";
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+export { apiUrl, timeout } from 'shared-destructured-export.tsx?tsr-shared=1'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 16b288ac5f..8cd0f14a27 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { timeout } from "shared-destructured-export.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { timeout } from 'shared-destructured-export.tsx?tsr-shared=1'
+const SplitComponent = () =>
Timeout: {timeout}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@loader.tsx
index 33d4b5aa43..d099459c6f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@loader.tsx
@@ -1,3 +1,3 @@
-import { apiUrl } from "shared-destructured-export.tsx?tsr-shared=1";
-const SplitLoader = async () => fetch(apiUrl);
-export { SplitLoader as loader };
\ No newline at end of file
+import { apiUrl } from 'shared-destructured-export.tsx?tsr-shared=1'
+const SplitLoader = async () => fetch(apiUrl)
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@shared.tsx
index f0bfd70add..ae9324acc9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@shared.tsx
@@ -1,11 +1,5 @@
-const {
- apiUrl,
- timeout
-} = getConfig();
+const { apiUrl, timeout } = getConfig()
function getConfig() {
- return {
- apiUrl: '/api',
- timeout: 5000
- };
+ return { apiUrl: '/api', timeout: 5000 }
}
-export { apiUrl, getConfig, timeout };
\ No newline at end of file
+export { apiUrl, getConfig, timeout }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured.tsx
index 8185738e9d..7c46a40bb3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-destructured.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-destructured.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-destructured.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-destructured.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/config')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 5c0182e61a..3d7933a573 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { timeout } from "shared-destructured.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { timeout } from 'shared-destructured.tsx?tsr-shared=1'
+const SplitComponent = () =>
Timeout: {timeout}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@loader.tsx
index 94b0923079..53e56d748d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@loader.tsx
@@ -1,3 +1,3 @@
-import { apiUrl } from "shared-destructured.tsx?tsr-shared=1";
-const SplitLoader = async () => fetch(apiUrl);
-export { SplitLoader as loader };
\ No newline at end of file
+import { apiUrl } from 'shared-destructured.tsx?tsr-shared=1'
+const SplitLoader = async () => fetch(apiUrl)
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@shared.tsx
index f0bfd70add..ae9324acc9 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@shared.tsx
@@ -1,11 +1,5 @@
-const {
- apiUrl,
- timeout
-} = getConfig();
+const { apiUrl, timeout } = getConfig()
function getConfig() {
- return {
- apiUrl: '/api',
- timeout: 5000
- };
+ return { apiUrl: '/api', timeout: 5000 }
}
-export { apiUrl, getConfig, timeout };
\ No newline at end of file
+export { apiUrl, getConfig, timeout }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported.tsx
index ce690311b2..bf6574aaed 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-exported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-exported.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-exported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-exported.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/query')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-export { queryOptions } from "shared-exported.tsx?tsr-shared=1";
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+export { queryOptions } from 'shared-exported.tsx?tsr-shared=1'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@component---errorComponent---notFoundComponent---pendingComponent.tsx
index b020b5cadf..9fe61942dd 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { queryOptions } from "shared-exported.tsx?tsr-shared=1";
-const SplitComponent = () =>
GC: {queryOptions.gcTime}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { queryOptions } from 'shared-exported.tsx?tsr-shared=1'
+const SplitComponent = () =>
GC: {queryOptions.gcTime}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@loader.tsx
index 332fa35079..4d4b8fbc5c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@loader.tsx
@@ -1,7 +1,5 @@
-import { queryOptions } from "shared-exported.tsx?tsr-shared=1";
+import { queryOptions } from 'shared-exported.tsx?tsr-shared=1'
const SplitLoader = async () => {
- return {
- staleTime: queryOptions.staleTime
- };
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ return { staleTime: queryOptions.staleTime }
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@shared.tsx
index a3f91b85bb..3a1ff108bb 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@shared.tsx
@@ -1,5 +1,2 @@
-const queryOptions = {
- staleTime: 5000,
- gcTime: 10000
-};
-export { queryOptions };
\ No newline at end of file
+const queryOptions = { staleTime: 5000, gcTime: 10000 }
+export { queryOptions }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function.tsx
index b5bf41235e..ef2e5e57a3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-function.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-function.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/cached')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 571bd9356a..1c327523af 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { getCached } from "shared-function.tsx?tsr-shared=1";
-const SplitComponent = () =>
{JSON.stringify(getCached('data'))}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { getCached } from 'shared-function.tsx?tsr-shared=1'
+const SplitComponent = () =>
{JSON.stringify(getCached('data'))}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@loader.tsx
index f5f72ab014..d8ae45caed 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@loader.tsx
@@ -1,9 +1,9 @@
-import { getCached, cache } from "shared-function.tsx?tsr-shared=1";
+import { getCached, cache } from 'shared-function.tsx?tsr-shared=1'
function setCached(key: string, val: unknown) {
- cache.set(key, val);
+ cache.set(key, val)
}
const SplitLoader = async () => {
- setCached('data', await fetch('/api').then(r => r.json()));
- return getCached('data');
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ setCached('data', await fetch('/api').then((r) => r.json()))
+ return getCached('data')
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@shared.tsx
index 27d2cf03f1..243ac23a66 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@shared.tsx
@@ -1,5 +1,5 @@
-const cache = new Map();
+const cache = new Map()
function getCached(key: string) {
- return cache.get(key);
+ return cache.get(key)
}
-export { cache, getCached };
\ No newline at end of file
+export { cache, getCached }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding.tsx
index d9ce6828fa..30823e2684 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-imported-binding.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-imported-binding.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-imported-binding.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/imported')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 0a835ae063..e3c8a0f5d8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { sharedUtil } from '../utils';
-const SplitComponent = () =>
{sharedUtil('render')}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { sharedUtil } from '../utils'
+const SplitComponent = () =>
{sharedUtil('render')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@loader.tsx
index 1b27de9093..8b8c645837 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@loader.tsx
@@ -1,3 +1,3 @@
-import { sharedUtil } from '../utils';
-const SplitLoader = async () => sharedUtil('load');
-export { SplitLoader as loader };
\ No newline at end of file
+import { sharedUtil } from '../utils'
+const SplitLoader = async () => sharedUtil('load')
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref.tsx
index f4dfce52ba..17ae801b02 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-indirect-ref.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-indirect-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-indirect-ref.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/shared-indirect')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 62995e7fd8..64bb6ab567 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,7 +1,9 @@
-import { state, getCount } from "shared-indirect-ref.tsx?tsr-shared=1";
+import { state, getCount } from 'shared-indirect-ref.tsx?tsr-shared=1'
function SharedComponent() {
- return
+ return (
+
{getCount()} - {state.count}
-
;
+
+ )
}
-export { SharedComponent as component };
\ No newline at end of file
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@loader.tsx
index 0625ac53f8..6b4c2c895b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@loader.tsx
@@ -1,8 +1,6 @@
-import { state, getCount } from "shared-indirect-ref.tsx?tsr-shared=1";
+import { state, getCount } from 'shared-indirect-ref.tsx?tsr-shared=1'
const SplitLoader = () => {
- state.count++;
- return {
- count: getCount()
- };
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ state.count++
+ return { count: getCount() }
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@shared.tsx
index 7e7e811ba8..b4910d2fd1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@shared.tsx
@@ -1,7 +1,5 @@
-const state = {
- count: 0
-};
+const state = { count: 0 }
function getCount() {
- return state.count;
+ return state.count
}
-export { getCount, state };
\ No newline at end of file
+export { getCount, state }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref.tsx
index 8ac24d49cf..fd6b2c69be 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-jsx-component-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-jsx-component-ref.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
// @ts-nocheck
-import { createFileRoute } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/jsx')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 52ecb6d474..845e1db45c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import { shared } from "shared-jsx-component-ref.tsx?tsr-shared=1"; // @ts-nocheck
+import { shared } from 'shared-jsx-component-ref.tsx?tsr-shared=1' // @ts-nocheck
function SharedComponent() {
- return
{shared}
;
+ return
{shared}
}
-export { SharedComponent as component };
\ No newline at end of file
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@loader.tsx
index f861dda436..348aecd923 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@loader.tsx
@@ -1,3 +1,3 @@
-import { shared } from "shared-jsx-component-ref.tsx?tsr-shared=1"; // @ts-nocheck
-const SplitLoader = () => shared;
-export { SplitLoader as loader };
\ No newline at end of file
+import { shared } from 'shared-jsx-component-ref.tsx?tsr-shared=1' // @ts-nocheck
+const SplitLoader = () => shared
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@shared.tsx
index d5cc2cf990..60ae1006a1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@shared.tsx
@@ -1,4 +1,3 @@
// @ts-nocheck
-
-const shared = 1;
-export { shared };
\ No newline at end of file
+const shared = 1
+export { shared }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none.tsx
index 06e81042d6..5ecfa3b109 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none.tsx
@@ -1,9 +1,10 @@
-const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-none.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-none.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () => import('shared-none.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/clean')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 701deeedeb..1bfd4eb63f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-const ComponentHelper = () => helper;
-const SplitComponent = () =>
-
-
;
-export { SplitComponent as component };
\ No newline at end of file
+const ComponentHelper = () => helper
+const SplitComponent = () => (
+
+
+
+)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@loader.tsx
index d0cfce36ee..0dfbec2515 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@loader.tsx
@@ -1,3 +1,3 @@
-const loaderHelper = () => fetch('/api');
-const SplitLoader = async () => loaderHelper();
-export { SplitLoader as loader };
\ No newline at end of file
+const loaderHelper = () => fetch('/api')
+const SplitLoader = async () => loaderHelper()
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route.tsx
index b62568c1fb..5a3509f434 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-referencing-route.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-referencing-route.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-referencing-route.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/about')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 2cb2cdb68c..b2c4630c90 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,10 +1,10 @@
-import { HEADER } from "shared-referencing-route.tsx?tsr-shared=1";
+import { HEADER } from 'shared-referencing-route.tsx?tsr-shared=1'
function usePageTitle() {
- return `${HEADER} - ${Route.fullPath}`;
+ return `${HEADER} - ${Route.fullPath}`
}
-import { Route } from "shared-referencing-route.tsx";
+import { Route } from 'shared-referencing-route.tsx'
const SplitComponent = () => {
- const title = usePageTitle();
- return
{title}
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ const title = usePageTitle()
+ return
{title}
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@loader.tsx
index baedd53bd7..dbf196f1b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@loader.tsx
@@ -1,12 +1,10 @@
-import { HEADER } from "shared-referencing-route.tsx?tsr-shared=1";
+import { HEADER } from 'shared-referencing-route.tsx?tsr-shared=1'
function usePageTitle() {
- return `${HEADER} - ${Route.fullPath}`;
+ return `${HEADER} - ${Route.fullPath}`
}
-import { Route } from "shared-referencing-route.tsx";
+import { Route } from 'shared-referencing-route.tsx'
const SplitLoader = async () => {
- const title = usePageTitle();
- return {
- title
- };
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ const title = usePageTitle()
+ return { title }
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@shared.tsx
index cc2d01424c..34b9c4ca41 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@shared.tsx
@@ -1,2 +1,2 @@
-const HEADER = 'Page';
-export { HEADER };
\ No newline at end of file
+const HEADER = 'Page'
+export { HEADER }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime.tsx
index bceb12d39a..944c0b8ca8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime.tsx
@@ -1,22 +1,20 @@
-import { state, createState, createSeed } from "shared-runtime.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-runtime.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-runtime.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('shared-runtime:reference');
+import { state, createState, createSeed } from 'shared-runtime.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-runtime.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-runtime.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('shared-runtime:reference')
export const Route = createFileRoute('/shared-runtime')({
beforeLoad: () => state,
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@component---errorComponent---notFoundComponent---pendingComponent.tsx
index fbccf6c90b..5245f6d9eb 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,23 +1,24 @@
-import { state, createState, createSeed, Labels } from "shared-runtime.tsx?tsr-shared=1";
-const label = createComponentLabel();
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-function createComponentLabel() {
- console.log('shared-runtime:component');
- return Labels.component;
+import {
+ state,
+ createState,
+ createSeed,
+ Labels,
+} from 'shared-runtime.tsx?tsr-shared=1'
+const label = createComponentLabel()
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
}
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
+function createComponentLabel() {
+ console.log('shared-runtime:component')
+ return Labels.component
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
const SplitComponent = () => {
if (state.count === 3) {
- throw new Error('route source-map contract');
+ throw new Error('route source-map contract')
}
- return `${label}:${state.count}`;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return `${label}:${state.count}`
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@loader.tsx
index 6c797c0226..6c0c88cab7 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@loader.tsx
@@ -1,16 +1,17 @@
-import { state, createState, createSeed, increment } from "shared-runtime.tsx?tsr-shared=1";
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
+import {
+ state,
+ createState,
+ createSeed,
+ increment,
+} from 'shared-runtime.tsx?tsr-shared=1'
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
const SplitLoader = () => {
- increment();
- return state;
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ increment()
+ return state
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@shared.tsx
index 54239b6cc5..c53a7e1568 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-runtime@shared.tsx
@@ -1,28 +1,13 @@
-const Count = {
- Initial: 0
-};
-const Labels = {
- component: 'count'
-};
-const seed = createSeed();
-const {
- state,
- increment
-} = createState(seed);
+const Count = { Initial: 0 }
+const Labels = { component: 'count' }
+const seed = createSeed()
+const { state, increment } = createState(seed)
function createSeed() {
- console.log('shared-runtime:seed');
- return {
- count: Count.Initial,
- label: Labels.component
- };
+ console.log('shared-runtime:seed')
+ return { count: Count.Initial, label: Labels.component }
}
-function createState(initialState: {
- count: number;
-}) {
- console.log('shared-runtime:state');
- return {
- state: initialState,
- increment: () => initialState.count++
- };
+function createState(initialState: { count: number }) {
+ console.log('shared-runtime:state')
+ return { state: initialState, increment: () => initialState.count++ }
}
-export { Count, createSeed, createState, increment, Labels, seed, state };
\ No newline at end of file
+export { Count, createSeed, createState, increment, Labels, seed, state }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive.tsx
index 869602e15b..aba85fd14b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-transitive.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-transitive.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-transitive.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/api')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 7a3a74048e..c237a03583 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { config } from "shared-transitive.tsx?tsr-shared=1";
-const SplitComponent = () =>
Timeout: {config.timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { config } from 'shared-transitive.tsx?tsr-shared=1'
+const SplitComponent = () =>
Timeout: {config.timeout}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@loader.tsx
index 8472eab295..70faa4c627 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@loader.tsx
@@ -1,6 +1,6 @@
-import { config } from "shared-transitive.tsx?tsr-shared=1";
-const fetcher = (path: string) => fetch(`${config.url}${path}`);
+import { config } from 'shared-transitive.tsx?tsr-shared=1'
+const fetcher = (path: string) => fetch(`${config.url}${path}`)
const SplitLoader = async () => {
- return fetcher('/data');
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ return fetcher('/data')
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@shared.tsx
index 8bec4a1d55..ac44498714 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@shared.tsx
@@ -1,6 +1,3 @@
-const BASE_URL = 'https://api.example.com';
-const config = {
- url: BASE_URL,
- timeout: 5000
-};
-export { BASE_URL, config };
\ No newline at end of file
+const BASE_URL = 'https://api.example.com'
+const config = { url: BASE_URL, timeout: 5000 }
+export { BASE_URL, config }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable.tsx
index 42f68cce48..e06ea2b1d2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-variable.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-variable.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-variable.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-variable.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/todos')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@component---errorComponent---notFoundComponent---pendingComponent.tsx
index d149922fbc..10325aa95e 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { collection } from "shared-variable.tsx?tsr-shared=1";
-const SplitComponent = () =>
{collection.name}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { collection } from 'shared-variable.tsx?tsr-shared=1'
+const SplitComponent = () =>
{collection.name}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@loader.tsx
index 196a8e48a4..b76d00b514 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@loader.tsx
@@ -1,8 +1,6 @@
-import { collection } from "shared-variable.tsx?tsr-shared=1";
+import { collection } from 'shared-variable.tsx?tsr-shared=1'
const SplitLoader = async () => {
- await collection.preload();
- return {
- data: 'loaded'
- };
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ await collection.preload()
+ return { data: 'loaded' }
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@shared.tsx
index 8a0560d5b9..10421dac09 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@shared.tsx
@@ -1,5 +1,2 @@
-const collection = {
- name: 'todos',
- preload: async () => {}
-};
-export { collection };
\ No newline at end of file
+const collection = { name: 'todos', preload: async () => {} }
+export { collection }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect.tsx
index 943cdf189c..5965d04430 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-with-side-effect.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('registry created');
+const $$splitComponentImporter = () =>
+ import('shared-with-side-effect.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-with-side-effect.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('registry created')
export const Route = createFileRoute('/fx')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@component---errorComponent---notFoundComponent---pendingComponent.tsx
index d953af00fa..3ede22c8be 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { registry } from "shared-with-side-effect.tsx?tsr-shared=1";
-const SplitComponent = () =>
{registry.size}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { registry } from 'shared-with-side-effect.tsx?tsr-shared=1'
+const SplitComponent = () =>
{registry.size}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@loader.tsx
index a5f06a0a05..b3b404a8ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@loader.tsx
@@ -1,5 +1,5 @@
-import { registry } from "shared-with-side-effect.tsx?tsr-shared=1";
+import { registry } from 'shared-with-side-effect.tsx?tsr-shared=1'
const SplitLoader = async () => {
- registry.set('loaded', true);
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ registry.set('loaded', true)
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@shared.tsx
index f26c656fdd..a59298f9e0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@shared.tsx
@@ -1,2 +1,2 @@
-const registry = new Map();
-export { registry };
\ No newline at end of file
+const registry = new Map()
+export { registry }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx
index 0c6e4f01aa..88b0bf1ba8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx
@@ -1,5 +1,4 @@
import { createFileRoute } from '@tanstack/react-router'
-
export const Route = createFileRoute('/undefined-test')({
component: undefined,
errorComponent: undefined,
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure.tsx
index d0de09bf8b..b5b3ecade6 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure.tsx
@@ -1,5 +1,4 @@
import * as React from 'react'
-
import { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'
import {
FaBolt,
@@ -21,7 +20,6 @@ import { startProject } from '~/projects/start'
import { createFileRoute } from '@tanstack/react-router'
import { Framework, getBranch } from '~/projects'
import { seo } from '~/utils/seo'
-
const menu = [
{
label: (
@@ -72,31 +70,22 @@ const menu = [
to: `https://cottonbureau.com/people/tanstack`,
},
]
-
export const Route = createFileRoute('/_libraries/start/$version/')({
component: VersionIndex,
meta: () =>
- seo({
- title: startProject.name,
- description: startProject.description,
- }),
+ seo({ title: startProject.name, description: startProject.description }),
})
-
const librariesRouteApi = getRouteApi('/_libraries')
-
export default function VersionIndex() {
const { sponsorsPromise } = librariesRouteApi.useLoaderData()
const { version } = Route.useParams()
const branch = getBranch(startProject, version)
const [framework, setFramework] = React.useState('react')
const [isDark, setIsDark] = React.useState(true)
-
React.useEffect(() => {
setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)
}, [])
-
const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`
-
return (
{item.label}
)
-
return (
{item.to.startsWith('http') ? (
@@ -269,7 +257,6 @@ Check it out at https://tanstack.com/start/`,
*/}
-
{/*
@@ -315,7 +302,6 @@ Check it out at https://tanstack.com/start/`,
})}
*/}
-
{/*
Trusted in Production by
@@ -358,7 +344,6 @@ Check it out at https://tanstack.com/start/`,
*/}
-
Partners
@@ -388,16 +373,13 @@ Check it out at https://tanstack.com/start/`,
-
Sponsors
-
@@ -429,7 +410,6 @@ Check it out at https://tanstack.com/start/`,
rage-quit OSS. Yay money! 😉
-
{/*
@@ -468,7 +448,6 @@ Check it out at https://tanstack.com/start/`,
*/}
-
{/* {[''].includes(framework) ? (
@@ -503,7 +482,6 @@ Check it out at https://tanstack.com/start/`,
>
)} */}
-
{/*
Wow, you've come a long way!
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 97b5481cf5..5cc3099643 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';
-import { VscPreview, VscWand } from 'react-icons/vsc';
\ No newline at end of file
+import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa'
+import { VscPreview, VscWand } from 'react-icons/vsc'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@loader.tsx
index 97b5481cf5..5cc3099643 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@loader.tsx
@@ -1,2 +1,2 @@
-import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';
-import { VscPreview, VscWand } from 'react-icons/vsc';
\ No newline at end of file
+import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa'
+import { VscPreview, VscWand } from 'react-icons/vsc'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using.tsx
index c58f0f663b..811b66a9d3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using.tsx
@@ -1,5 +1,5 @@
-const $$splitLoaderImporter = () => import('using.tsx?tsr-split=loader');
-import { lazyFn } from '@tanstack/react-router';
+const $$splitLoaderImporter = () => import('using.tsx?tsr-split=loader')
+import { lazyFn } from '@tanstack/react-router'
export const Route = createFileRoute({
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@loader.tsx
index 7e4f4fde9b..3b60e73b8d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@loader.tsx
@@ -1,17 +1,9 @@
const DummyPostResource = (postId: string) => ({
- postData: {
- id: postId,
- title: 'dummy',
- body: 'dummy'
- },
- [Symbol.dispose]: () => console.log('disposing!')
-});
-const SplitLoader = ({
- params: {
- postId
- }
-}) => {
- using dummyPost = DummyPostResource(postId);
- return dummyPost.postData;
-};
-export { SplitLoader as loader };
\ No newline at end of file
+ postData: { id: postId, title: 'dummy', body: 'dummy' },
+ [Symbol.dispose]: () => console.log('disposing!'),
+})
+const SplitLoader = ({ params: { postId } }) => {
+ using dummyPost = DummyPostResource(postId)
+ return dummyPost.postData
+}
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function.tsx
index 380087d43c..19dfb7e3ba 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx
index 764043a59c..e2f2a1ccdb 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,30 +1,34 @@
-import * as React from 'react';
-import { Link, Outlet } from '@tanstack/react-router';
-import { fetchPosts } from '../posts';
-import { Route } from "arrow-function.tsx";
+import * as React from 'react'
+import { Link, Outlet } from '@tanstack/react-router'
+import { fetchPosts } from '../posts'
+import { Route } from 'arrow-function.tsx'
const PostsComponent = () => {
- const posts = Route.useLoaderData();
- return
}
-export { loader };
-export { MyComponent as component };
\ No newline at end of file
+export { loader }
+export { MyComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring.tsx
index d80f17484f..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring.tsx
@@ -1,11 +1,9 @@
import thing from 'thing'
-
export function test() {
const {
foo: {
bar: { destructured },
},
} = thing
-
return destructured
}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@component---loader---notFoundComponent---pendingComponent.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@errorComponent.tsx
index 858c5c0e05..112fded569 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@errorComponent.tsx
@@ -1,11 +1,9 @@
-import thing from 'thing';
+import thing from 'thing'
export function test() {
const {
foo: {
- bar: {
- destructured
- }
- }
- } = thing;
- return destructured;
-}
\ No newline at end of file
+ bar: { destructured },
+ },
+ } = thing
+ return destructured
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue.tsx
index 178bec9bf7..b807ba9283 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue.tsx
@@ -1,8 +1,8 @@
-'use client';
-
-const $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+'use client'
+const $$splitComponentImporter = () =>
+ import('directive-prologue.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/directive')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@component---loader---notFoundComponent---pendingComponent.tsx
index ce7cd5e5ee..9ee4bd8f4c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,6 +1,5 @@
-'use client';
-
+'use client'
const SplitComponent = () => {
- return
directive preserved
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return
directive preserved
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component.tsx
index 4fdd9d1c68..8109a89624 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component.tsx
@@ -1,6 +1,3 @@
import React from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/')({
- component: undefined,
-})
+export const Route = createFileRoute('/')({ component: undefined })
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@component---loader---notFoundComponent---pendingComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound.tsx
index a3e020c559..534529220a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound.tsx
@@ -1,15 +1,23 @@
-console.warn("[tanstack-router] These exports from \"export-default-component-and-normal-notFound.tsx\" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import React, { useState } from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+console.warn(
+ '[tanstack-router] These exports from "export-default-component-and-normal-notFound.tsx" will not be code-split and will increase your bundle size:\n- Home\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitNotFoundComponentImporter = () =>
+ import('export-default-component-and-normal-notFound.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import React, { useState } from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/home')({
component: Home,
- notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')
-});
+ notFoundComponent: lazyRouteComponent(
+ $$splitNotFoundComponentImporter,
+ 'notFoundComponent',
+ ),
+})
export default function Home() {
- const [one, setOne] = useState('this is from a state');
- return
+ const [one, setOne] = useState('this is from a state')
+ return (
+
{one}
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@component---loader---notFoundComponent---pendingComponent.tsx
index 62cd0a1036..3da924c04c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import React from 'react';
+import React from 'react'
function NotFoundComponent() {
- return
Not Found
;
+ return
Not Found
}
-export { NotFoundComponent as notFoundComponent };
\ No newline at end of file
+export { NotFoundComponent as notFoundComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component.tsx
index c5198b9e00..de2d748c91 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component.tsx
@@ -1,13 +1,8 @@
import React, { useState } from 'react'
import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/home')({
- component: Home,
-})
-
+export const Route = createFileRoute('/home')({ component: Home })
export default function Home() {
const [one, setOne] = useState('this is from a state')
-
return (
{one}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@component---loader---notFoundComponent---pendingComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@errorComponent.tsx
index b01f5e7863..b45dfaa8f0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@errorComponent.tsx
@@ -1 +1 @@
-import React from 'react';
\ No newline at end of file
+import React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter.tsx
index 3ae9710cd5..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter.tsx
@@ -1,29 +1,20 @@
import * as React from 'react'
// @ts-expect-error
import { useMemo } from 'tan-react'
-
const useUsedVar = 'i-am-unused'
-
const ReactUseMemoCall1 = React.useMemo(function performAction() {
return 'true'
}, [])
-
console.info(ReactUseMemoCall1)
-
const ReactUseMemoCall2 = React.useMemo(() => {
return 'true'
}, [])
-
console.info(ReactUseMemoCall2)
-
const UseMemoCall1 = useMemo(function performAction() {
return 'true'
}, [])
-
console.info(UseMemoCall1)
-
const UseMemoCall2 = useMemo(() => {
return 'true'
}, [])
-
console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@component---loader---notFoundComponent---pendingComponent.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@errorComponent.tsx
index 23e2cd0f03..817b89d69a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@errorComponent.tsx
@@ -1,20 +1,20 @@
-import * as React from 'react';
+import * as React from 'react'
// @ts-expect-error
-import { useMemo } from 'tan-react';
-const useUsedVar = 'i-am-unused';
+import { useMemo } from 'tan-react'
+const useUsedVar = 'i-am-unused'
const ReactUseMemoCall1 = React.useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall1);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall1)
const ReactUseMemoCall2 = React.useMemo(() => {
- return 'true';
-}, []);
-console.info(ReactUseMemoCall2);
+ return 'true'
+}, [])
+console.info(ReactUseMemoCall2)
const UseMemoCall1 = useMemo(function performAction() {
- return 'true';
-}, []);
-console.info(UseMemoCall1);
+ return 'true'
+}, [])
+console.info(UseMemoCall1)
const UseMemoCall2 = useMemo(() => {
- return 'true';
-}, []);
-console.info(UseMemoCall2);
\ No newline at end of file
+ return 'true'
+}, [])
+console.info(UseMemoCall2)
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration.tsx
index 6076420598..bdef68ad2d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
index d453767c20..5289c0c3c4 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,30 +1,34 @@
-import * as React from 'react';
-import { Link, Outlet } from '@tanstack/react-router';
-import { fetchPosts } from '../posts';
-import { Route } from "function-declaration.tsx";
+import * as React from 'react'
+import { Link, Outlet } from '@tanstack/react-router'
+import { fetchPosts } from '../posts'
+import { Route } from 'function-declaration.tsx'
function PostsComponent() {
- const posts = Route.useLoaderData();
- return
+ )
}
-const SplitLoader = fetchPosts;
-export { SplitLoader as loader };
-export { PostsComponent as component };
\ No newline at end of file
+const SplitLoader = fetchPosts
+export { SplitLoader as loader }
+export { PostsComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@errorComponent.tsx
index 5f67a6fff1..371dc65868 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@errorComponent.tsx
@@ -1 +1 @@
-import * as React from 'react';
\ No newline at end of file
+import * as React from 'react'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute.tsx
index cec0324adf..f336e2ff0f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute.tsx
@@ -1,6 +1,7 @@
-const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('importAttribute.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@component---loader---notFoundComponent---pendingComponent.tsx
index f34d3c6408..88abef0c00 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import { test } from './test' with { type: 'macro' };
-const SplitComponent = () => test;
-export { SplitComponent as component };
\ No newline at end of file
+import { test } from './test' with { type: 'macro' }
+const SplitComponent = () => test
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader.tsx
index d79c8e0f32..d7c5699549 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@component---loader---notFoundComponent---pendingComponent.tsx
index d4fc40141e..b7ed94da4a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import importedComponent, { importedLoader } from '../../shared/imported';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
-const SplitComponent = importedComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import importedComponent, { importedLoader } from '../../shared/imported'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
+const SplitComponent = importedComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component.tsx
index c165f65262..81ec753301 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component.tsx
@@ -1,6 +1,7 @@
-const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('imported-default-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@component---loader---notFoundComponent---pendingComponent.tsx
index 31ccf07c52..d356227040 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import ImportedDefaultComponent from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import ImportedDefaultComponent from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent.tsx
index 4152c9af17..e2179478b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitErrorComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=errorComponent');
-const $$splitComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitErrorComponentImporter = () =>
+ import('imported-errorComponent.tsx?tsr-split=errorComponent')
+const $$splitComponentImporter = () =>
+ import('imported-errorComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')
-});
\ No newline at end of file
+ errorComponent: lazyRouteComponent(
+ $$splitErrorComponentImporter,
+ 'errorComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@component---loader---notFoundComponent---pendingComponent.tsx
index 31ccf07c52..d356227040 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,3 @@
-import ImportedDefaultComponent from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import ImportedDefaultComponent from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@errorComponent.tsx
index 7a8654fb94..3f20c3e485 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@errorComponent.tsx
@@ -1,3 +1,3 @@
-import { importedErrorComponent } from '../../shared/imported';
-const SplitErrorComponent = importedErrorComponent;
-export { SplitErrorComponent as errorComponent };
\ No newline at end of file
+import { importedErrorComponent } from '../../shared/imported'
+const SplitErrorComponent = importedErrorComponent
+export { SplitErrorComponent as errorComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent.tsx
index 584c829f37..31812e1e44 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitNotFoundComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitNotFoundComponentImporter = () =>
+ import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')
-});
\ No newline at end of file
+ notFoundComponent: lazyRouteComponent(
+ $$splitNotFoundComponentImporter,
+ 'notFoundComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@component---loader---notFoundComponent---pendingComponent.tsx
index 1273c7c50d..9f904a1a19 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-import ImportedDefaultComponent, { importedNotFoundComponent } from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
-const SplitNotFoundComponent = importedNotFoundComponent;
-export { SplitNotFoundComponent as notFoundComponent };
\ No newline at end of file
+import ImportedDefaultComponent, {
+ importedNotFoundComponent,
+} from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
+const SplitNotFoundComponent = importedNotFoundComponent
+export { SplitNotFoundComponent as notFoundComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent.tsx
index 1be3f8071b..0996abeb6c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent.tsx
@@ -1,8 +1,13 @@
-const $$splitPendingComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitPendingComponentImporter = () =>
+ import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent')
-});
\ No newline at end of file
+ pendingComponent: lazyRouteComponent(
+ $$splitPendingComponentImporter,
+ 'pendingComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@component---loader---notFoundComponent---pendingComponent.tsx
index 0368000afa..d24c7b1505 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,7 @@
-import ImportedDefaultComponent, { importedPendingComponent } from '../../shared/imported';
-const SplitComponent = ImportedDefaultComponent;
-export { SplitComponent as component };
-const SplitPendingComponent = importedPendingComponent;
-export { SplitPendingComponent as pendingComponent };
\ No newline at end of file
+import ImportedDefaultComponent, {
+ importedPendingComponent,
+} from '../../shared/imported'
+const SplitComponent = ImportedDefaultComponent
+export { SplitComponent as component }
+const SplitPendingComponent = importedPendingComponent
+export { SplitPendingComponent as pendingComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported.tsx
index 14356133d6..75c54f18ad 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@component---loader---notFoundComponent---pendingComponent.tsx
index ecc588688b..1c4d3e909b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import { importedComponent, importedLoader } from '../../shared';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
-const SplitComponent = importedComponent;
-export { SplitComponent as component };
\ No newline at end of file
+import { importedComponent, importedLoader } from '../../shared'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
+const SplitComponent = importedComponent
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline.tsx
index 3e2ea1f1c2..fbc7185a17 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline.tsx
@@ -1,9 +1,10 @@
-const $$splitComponentImporter = () => import('inline.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('inline.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-Route.addChildren([]);
-export const test = 'test';
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+Route.addChildren([])
+export const test = 'test'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx
index 58ccfb2903..d28b872634 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,18 +1,18 @@
-import * as React from 'react';
-import * as styles from '../style.css';
-import { TEST_DATA } from '../test.const';
-const Button = (props: {
- children: any;
-}) => {
- return ;
-};
-import { Route } from "inline.tsx";
-import { test } from "inline.tsx";
+import * as React from 'react'
+import * as styles from '../style.css'
+import { TEST_DATA } from '../test.const'
+const Button = (props: { children: any }) => {
+ return
+}
+import { Route } from 'inline.tsx'
+import { test } from 'inline.tsx'
const SplitComponent = () => {
- return
- {test}
-
{TEST_DATA.welcome}
-
-
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return (
+
+ {test}
+
{TEST_DATA.welcome}
+
+
+ )
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx
index 9236af6021..23fab71edc 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-import { Route } from "inline.tsx";
\ No newline at end of file
+import * as React from 'react'
+import { Route } from 'inline.tsx'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration.tsx
index 574c6d4c2b..55c51e878b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration.tsx
@@ -1,10 +1,19 @@
-const $$splitErrorComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=errorComponent');
-const $$splitPendingComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-const $$splitComponentImporter = () => import('lowercase-function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitErrorComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=errorComponent')
+const $$splitPendingComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+const $$splitComponentImporter = () =>
+ import('lowercase-function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent'),
- errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')
-});
\ No newline at end of file
+ pendingComponent: lazyRouteComponent(
+ $$splitPendingComponentImporter,
+ 'pendingComponent',
+ ),
+ errorComponent: lazyRouteComponent(
+ $$splitErrorComponentImporter,
+ 'errorComponent',
+ ),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
index 382621ea9a..3b432397b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,8 +1,8 @@
function component() {
- return
lowercase function declaration
;
+ return
lowercase function declaration
}
function pendingComponent() {
- return
lowercase pending function declaration
;
+ return
lowercase pending function declaration
}
-export { component };
-export { pendingComponent };
\ No newline at end of file
+export { component }
+export { pendingComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@errorComponent.tsx
index acc1c0be8d..9d411c1f0f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/lowercase-function-declaration@errorComponent.tsx
@@ -1,4 +1,4 @@
function errorComponent() {
- return
lowercase error function declaration
;
+ return
lowercase error function declaration
}
-export { errorComponent };
\ No newline at end of file
+export { errorComponent }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number.tsx
index 5b4cfaaa9b..602ff5c117 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number.tsx
@@ -1,28 +1,42 @@
-const $$splitComponentImporter = () => import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { Await, Link, createFileRoute } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-export const textColors = [`text-rose-500`, `text-yellow-500`, `text-teal-500`, `text-blue-500`];
-export const gradients = [`from-rose-500 to-yellow-500`, `from-yellow-500 to-teal-500`, `from-teal-500 to-violet-500`, `from-blue-500 to-pink-500`];
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
+const $$splitComponentImporter = () =>
+ import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { Await, Link, createFileRoute } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+export const textColors = [
+ `text-rose-500`,
+ `text-yellow-500`,
+ `text-teal-500`,
+ `text-blue-500`,
+]
+export const gradients = [
+ `from-rose-500 to-yellow-500`,
+ `from-yellow-500 to-teal-500`,
+ `from-teal-500 to-violet-500`,
+ `from-blue-500 to-pink-500`,
+]
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
export const Route = createFileRoute('/')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@component---loader---notFoundComponent---pendingComponent.tsx
index c133e05d9e..37649d8606 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,69 +1,56 @@
-import { Await, Link, defer } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import { getSponsorsForSponsorPack } from '~/server/sponsors';
-import discordImage from '~/images/discord-logo-white.svg';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-import { useMutation } from '~/hooks/useMutation';
-import { sample } from '~/utils/utils';
-import { textColors } from "random-number.tsx";
-import { gradients } from "random-number.tsx";
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
-import { Route } from "random-number.tsx";
-async function bytesSignupServerFn({
- email
-}: {
- email: string;
-}) {
- 'use server';
-
+import { Await, Link, defer } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import { getSponsorsForSponsorPack } from '~/server/sponsors'
+import discordImage from '~/images/discord-logo-white.svg'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+import { useMutation } from '~/hooks/useMutation'
+import { sample } from '~/utils/utils'
+import { textColors } from 'random-number.tsx'
+import { gradients } from 'random-number.tsx'
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
+import { Route } from 'random-number.tsx'
+async function bytesSignupServerFn({ email }: { email: string }) {
+ 'use server'
return fetch(`https://bytes.dev/api/bytes-optin-cors`, {
method: 'POST',
- body: JSON.stringify({
- email,
- influencer: 'tanstack'
- }),
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json'
- }
- });
+ body: JSON.stringify({ email, influencer: 'tanstack' }),
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
+ })
}
function Index() {
- const bytesSignupMutation = useMutation({
- fn: bytesSignupServerFn
- });
- const {
- sponsorsPromise,
- randomNumber,
- testing2
- } = Route.useLoaderData();
- const gradient = sample(gradients, randomNumber);
- const textColor = sample(textColors, randomNumber);
- return <>
+ const bytesSignupMutation = useMutation({ fn: bytesSignupServerFn })
+ const { sponsorsPromise, randomNumber, testing2 } = Route.useLoaderData()
+ const gradient = sample(gradients, randomNumber)
+ const textColor = sample(textColors, randomNumber)
+ return (
+ <>
{discordImage}
{gradient}
{textColor}
- >;
+ >
+ )
}
const SplitLoader = () => {
return {
randomNumber: Math.random(),
- sponsorsPromise: defer(getSponsorsForSponsorPack())
- };
-};
-export { SplitLoader as loader };
-export { Index as component };
\ No newline at end of file
+ sponsorsPromise: defer(getSponsorsForSponsorPack()),
+ }
+}
+export { SplitLoader as loader }
+export { Index as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@errorComponent.tsx
index cdf4d37891..8e156eca17 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@errorComponent.tsx
@@ -1,18 +1,20 @@
-import { Await, Link } from '@tanstack/react-router';
-import { Carbon } from '~/components/Carbon';
-import { twMerge } from 'tailwind-merge';
-import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';
-import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';
-import { Footer } from '~/components/Footer';
-import SponsorPack from '~/components/SponsorPack';
-import { LogoColor } from '~/components/LogoColor';
-import agGridImage from '~/images/ag-grid.png';
-import nozzleImage from '~/images/nozzle.png';
-import bytesImage from '~/images/bytes.svg';
-import bytesUidotdevImage from '~/images/bytes-uidotdev.png';
-const courses = [{
- name: 'The Official TanStack React Query Course',
- cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
- href: 'https://query.gg/?s=tanstack',
- description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`
-}];
\ No newline at end of file
+import { Await, Link } from '@tanstack/react-router'
+import { Carbon } from '~/components/Carbon'
+import { twMerge } from 'tailwind-merge'
+import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
+import { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'
+import { Footer } from '~/components/Footer'
+import SponsorPack from '~/components/SponsorPack'
+import { LogoColor } from '~/components/LogoColor'
+import agGridImage from '~/images/ag-grid.png'
+import nozzleImage from '~/images/nozzle.png'
+import bytesImage from '~/images/bytes.svg'
+import bytesUidotdevImage from '~/images/bytes-uidotdev.png'
+const courses = [
+ {
+ name: 'The Official TanStack React Query Course',
+ cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,
+ href: 'https://query.gg/?s=tanstack',
+ description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,
+ },
+]
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component.tsx
index 568c8dc323..9f605effce 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@component---loader---notFoundComponent---pendingComponent.tsx
index 70d8b0eb42..7c2c8e17de 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,9 +1,9 @@
-import React from 'react';
-import { importedLoader } from '../../shared/imported';
+import React from 'react'
+import { importedLoader } from '../../shared/imported'
function Component() {
- return
Component
;
+ return
Component
}
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
-const SplitComponent = React.memo(Component);
-export { SplitComponent as component };
\ No newline at end of file
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
+const SplitComponent = React.memo(Component)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component.tsx
index 233eca72a0..7e9467be1b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component.tsx
@@ -1,9 +1,11 @@
-const $$splitLoaderImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-const $$splitComponentImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitLoaderImporter = () =>
+ import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+const $$splitComponentImporter = () =>
+ import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx
index d2671013ef..83e6e4b28c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,6 +1,6 @@
-import React from 'react';
-import { importedLoader, importedComponent } from '../../shared/imported';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
-const SplitComponent = React.memo(importedComponent);
-export { SplitComponent as component };
\ No newline at end of file
+import React from 'react'
+import { importedLoader, importedComponent } from '../../shared/imported'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
+const SplitComponent = React.memo(importedComponent)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component.tsx
index 1b00751ae6..4f14db0832 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component.tsx
@@ -1,14 +1,16 @@
-console.warn("[tanstack-router] These exports from \"retain-export-component.tsx\" will not be code-split and will increase your bundle size:\n- Layout\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitLoaderImporter = () => import('retain-export-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute, Outlet } from '@tanstack/react-router';
-import { importedComponent as ImportedComponent } from '../../shared/imported';
+console.warn(
+ '[tanstack-router] These exports from "retain-export-component.tsx" will not be code-split and will increase your bundle size:\n- Layout\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitLoaderImporter = () =>
+ import('retain-export-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute, Outlet } from '@tanstack/react-router'
+import { importedComponent as ImportedComponent } from '../../shared/imported'
export function Layout() {
- return
-
+ return (
+
+
- ;
+
+ )
}
export const Route = createFileRoute('/_layout')({
component: Layout,
- loader: lazyFn($$splitLoaderImporter, 'loader')
-});
-const HEADER_HEIGHT = '63px';
-export const SIDEBAR_WIDTH = '150px';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+ loader: lazyFn($$splitLoaderImporter, 'loader'),
+})
+const HEADER_HEIGHT = '63px'
+export const SIDEBAR_WIDTH = '150px'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@component---loader---notFoundComponent---pendingComponent.tsx
index 9787e27ad7..ddeb4d1e6f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,6 +1,6 @@
-import * as React from 'react';
-import { importedLoader } from '../../shared/imported';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
-const SplitLoader = importedLoader;
-export { SplitLoader as loader };
\ No newline at end of file
+import * as React from 'react'
+import { importedLoader } from '../../shared/imported'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
+const SplitLoader = importedLoader
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@errorComponent.tsx
index 5bb0ab5451..8fb12f0c6b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@errorComponent.tsx
@@ -1,3 +1,3 @@
-import * as React from 'react';
-const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const.tsx
index f256b01a83..d674dbb799 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const.tsx
@@ -4,11 +4,9 @@ import {
importedComponent as ImportedComponent,
importedLoader,
} from '../../shared/imported'
-
export const loaderFn = () => {
return importedLoader()
}
-
const Layout = () => {
return (
@@ -26,15 +24,12 @@ const Layout = () => {
)
}
-
export const Route = createFileRoute('/_layout')({
component: Layout,
loader: loaderFn,
})
-
const HEADER_HEIGHT = '63px'
export const SIDEBAR_WIDTH = '150px'
export const SIDEBAR_MINI_WIDTH = '80px'
const ASIDE_WIDTH = '250px'
-
export default Layout
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@component---loader---notFoundComponent---pendingComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@errorComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
index 0e3175116f..89c23305a0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
@@ -1,18 +1,12 @@
import { createFileRoute } from '@tanstack/react-router'
-
const createBits = () => ({
component: AboutComponentImpl,
- loader: () => ({
- message: 'hello',
- }),
+ loader: () => ({ message: 'hello' }),
})
-
export const { component: AboutComponent, loader } = createBits()
-
function AboutComponentImpl() {
return
About
}
-
export const Route = createFileRoute('/about')({
component: AboutComponent,
loader,
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
index 43108700f5..c3ddde13a8 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1 +1 @@
-export { SplitLoader as loader };
\ No newline at end of file
+export { SplitLoader as loader }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function.tsx
index 298c388e65..83b3dd4eb5 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function.tsx
@@ -4,11 +4,9 @@ import {
importedComponent as ImportedComponent,
importedLoader,
} from '../../shared/imported'
-
export function loaderFn() {
return importedLoader()
}
-
function Layout() {
return (
@@ -26,15 +24,12 @@ function Layout() {
)
}
-
export const Route = createFileRoute('/_layout')({
component: Layout,
loader: loaderFn,
})
-
const HEADER_HEIGHT = '63px'
export const SIDEBAR_WIDTH = '150px'
export const SIDEBAR_MINI_WIDTH = '80px'
const ASIDE_WIDTH = '250px'
-
export default Layout
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@component---loader---notFoundComponent---pendingComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@errorComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader.tsx
index b36cbc6be2..e805842e0c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader.tsx
@@ -1,17 +1,18 @@
-console.warn("[tanstack-router] These exports from \"retain-exports-loader.tsx\" will not be code-split and will increase your bundle size:\n- loaderFn\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.");
-const $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-import * as React from 'react';
-import { createFileRoute } from '@tanstack/react-router';
+console.warn(
+ '[tanstack-router] These exports from "retain-exports-loader.tsx" will not be code-split and will increase your bundle size:\n- loaderFn\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
+)
+const $$splitComponentImporter = () =>
+ import('retain-exports-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+import * as React from 'react'
+import { createFileRoute } from '@tanstack/react-router'
export function loaderFn() {
- return {
- foo: 'bar'
- };
+ return { foo: 'bar' }
}
export const Route = createFileRoute('/_layout')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
- loader: loaderFn
-});
-export const SIDEBAR_WIDTH = '150px';
-export const SIDEBAR_MINI_WIDTH = '80px';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+ loader: loaderFn,
+})
+export const SIDEBAR_WIDTH = '150px'
+export const SIDEBAR_MINI_WIDTH = '80px'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@component---loader---notFoundComponent---pendingComponent.tsx
index 9f54ae0dc5..604be4dc69 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,11 +1,10 @@
-import * as React from 'react';
-import { Outlet } from '@tanstack/react-router';
-import { importedComponent as ImportedComponent } from '../../shared/imported';
+import * as React from 'react'
+import { Outlet } from '@tanstack/react-router'
+import { importedComponent as ImportedComponent } from '../../shared/imported'
function Layout() {
- return
-
+ return (
+
+
- ;
+
+ )
}
-const HEADER_HEIGHT = '63px';
-const ASIDE_WIDTH = '250px';
-export { Layout as component };
\ No newline at end of file
+const HEADER_HEIGHT = '63px'
+const ASIDE_WIDTH = '250px'
+export { Layout as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@errorComponent.tsx
index 168ba78680..0e0123f1ab 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@errorComponent.tsx
@@ -1,2 +1,2 @@
-import * as React from 'react';
-const ASIDE_WIDTH = '250px';
\ No newline at end of file
+import * as React from 'react'
+const ASIDE_WIDTH = '250px'
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class.tsx
index 48afc3f070..c9bffc92ba 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class.tsx
@@ -1,18 +1,20 @@
-const $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
class DataStore {
- data = new Map();
+ data = new Map()
get(k: string) {
- return this.data.get(k);
+ return this.data.get(k)
}
set(k: string, v: unknown) {
- this.data.set(k, v);
+ this.data.set(k, v)
}
}
export const Route = createFileRoute('/store')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@component---loader---notFoundComponent---pendingComponent.tsx
index 10675b99ed..39593e61e0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,16 +1,16 @@
class DataStore {
- data = new Map();
+ data = new Map()
get(k: string) {
- return this.data.get(k);
+ return this.data.get(k)
}
set(k: string, v: unknown) {
- this.data.set(k, v);
+ this.data.set(k, v)
}
}
-const store = new DataStore();
+const store = new DataStore()
const SplitLoader = async () => {
- store.set('items', await fetch('/api'));
-};
-export { SplitLoader as loader };
-const SplitComponent = () =>
{store.get('items')}
;
-export { SplitComponent as component };
\ No newline at end of file
+ store.set('items', await fetch('/api'))
+}
+export { SplitLoader as loader }
+const SplitComponent = () =>
{store.get('items')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@errorComponent.tsx
index 0a50638c6a..31a1763b5d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@errorComponent.tsx
@@ -1,9 +1,9 @@
class DataStore {
- data = new Map();
+ data = new Map()
get(k: string) {
- return this.data.get(k);
+ return this.data.get(k)
}
set(k: string, v: unknown) {
- this.data.set(k, v);
+ this.data.set(k, v)
}
-}
\ No newline at end of file
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export.tsx
index 73f1b54389..6b770a1cf2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export.tsx
@@ -1,19 +1,15 @@
-const $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-export const {
- apiUrl,
- timeout
-} = getConfig();
+const $$splitComponentImporter = () =>
+ import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+export const { apiUrl, timeout } = getConfig()
export const Route = createFileRoute('/config')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
function getConfig() {
- return {
- apiUrl: '/api',
- timeout: 5000
- };
-}
\ No newline at end of file
+ return { apiUrl: '/api', timeout: 5000 }
+}
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
index d48accf910..68114df748 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import { apiUrl, timeout } from "shared-destructured-export.tsx";
-const SplitLoader = async () => fetch(apiUrl);
-export { SplitLoader as loader };
-const SplitComponent = () =>
Timeout: {timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { apiUrl, timeout } from 'shared-destructured-export.tsx'
+const SplitLoader = async () => fetch(apiUrl)
+export { SplitLoader as loader }
+const SplitComponent = () =>
;
-export { SplitComponent as component };
\ No newline at end of file
+ setCached('data', await fetch('/api').then((r) => r.json()))
+ return getCached('data')
+}
+export { SplitLoader as loader }
+const SplitComponent = () =>
{JSON.stringify(getCached('data'))}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding.tsx
index feb46cd789..71082ac702 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/imported')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@component---loader---notFoundComponent---pendingComponent.tsx
index 409e8d4023..7718cec94c 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,5 +1,5 @@
-import { sharedUtil } from '../utils';
-const SplitLoader = async () => sharedUtil('load');
-export { SplitLoader as loader };
-const SplitComponent = () =>
{sharedUtil('render')}
;
-export { SplitComponent as component };
\ No newline at end of file
+import { sharedUtil } from '../utils'
+const SplitLoader = async () => sharedUtil('load')
+export { SplitLoader as loader }
+const SplitComponent = () =>
{sharedUtil('render')}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref.tsx
index 4275e17e58..913fae8432 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/shared-indirect')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@component---loader---notFoundComponent---pendingComponent.tsx
index 090f3b5c73..90815572f7 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,19 +1,17 @@
-const state = {
- count: 0
-};
+const state = { count: 0 }
function getCount() {
- return state.count;
+ return state.count
}
function SharedComponent() {
- return
+ return (
+
{getCount()} - {state.count}
-
;
+
+ )
}
const SplitLoader = () => {
- state.count++;
- return {
- count: getCount()
- };
-};
-export { SplitLoader as loader };
-export { SharedComponent as component };
\ No newline at end of file
+ state.count++
+ return { count: getCount() }
+}
+export { SplitLoader as loader }
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref.tsx
index 130c7ce120..7d5cff0d5f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
// @ts-nocheck
-import { createFileRoute } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/jsx')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@component---loader---notFoundComponent---pendingComponent.tsx
index c5fd18664e..82b634246f 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,9 +1,8 @@
// @ts-nocheck
-
-const shared = 1;
+const shared = 1
function SharedComponent() {
- return
{shared}
;
+ return
{shared}
}
-const SplitLoader = () => shared;
-export { SplitLoader as loader };
-export { SharedComponent as component };
\ No newline at end of file
+const SplitLoader = () => shared
+export { SplitLoader as loader }
+export { SharedComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none.tsx
index eac0f9ab0a..1dd8f7bb0a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/clean')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@component---loader---notFoundComponent---pendingComponent.tsx
index f9f52ba6be..9f1d1a5ca1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,8 +1,10 @@
-const loaderHelper = () => fetch('/api');
-const ComponentHelper = () => helper;
-const SplitLoader = async () => loaderHelper();
-export { SplitLoader as loader };
-const SplitComponent = () =>
-
-
;
-export { SplitComponent as component };
\ No newline at end of file
+const loaderHelper = () => fetch('/api')
+const ComponentHelper = () => helper
+const SplitLoader = async () => loaderHelper()
+export { SplitLoader as loader }
+const SplitComponent = () => (
+
+
+
+)
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route.tsx
index 9aebb45a95..f51ed0c13a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/about')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@component---loader---notFoundComponent---pendingComponent.tsx
index 9bcd130ea8..da98398ae1 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,17 +1,15 @@
-const HEADER = 'Page';
+const HEADER = 'Page'
function usePageTitle() {
- return `${HEADER} - ${Route.fullPath}`;
+ return `${HEADER} - ${Route.fullPath}`
}
-import { Route } from "shared-referencing-route.tsx";
+import { Route } from 'shared-referencing-route.tsx'
const SplitLoader = async () => {
- const title = usePageTitle();
- return {
- title
- };
-};
-export { SplitLoader as loader };
+ const title = usePageTitle()
+ return { title }
+}
+export { SplitLoader as loader }
const SplitComponent = () => {
- const title = usePageTitle();
- return
{title}
;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ const title = usePageTitle()
+ return
{title}
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime.tsx
index d88eff9d9b..fdc18fa37b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime.tsx
@@ -1,22 +1,20 @@
-import { state, createState, createSeed } from "shared-runtime.tsx?tsr-shared=1";
-const $$splitComponentImporter = () => import('shared-runtime.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-runtime.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('shared-runtime:reference');
+import { state, createState, createSeed } from 'shared-runtime.tsx?tsr-shared=1'
+const $$splitComponentImporter = () =>
+ import('shared-runtime.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-runtime.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('shared-runtime:reference')
export const Route = createFileRoute('/shared-runtime')({
beforeLoad: () => state,
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@component---loader---notFoundComponent---pendingComponent.tsx
index 0af87c21c5..053cf24d5a 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,28 +1,30 @@
-import { state, createState, createSeed, Labels, increment } from "shared-runtime.tsx?tsr-shared=1";
-const label = createComponentLabel();
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-function createComponentLabel() {
- console.log('shared-runtime:component');
- return Labels.component;
+import {
+ state,
+ createState,
+ createSeed,
+ Labels,
+ increment,
+} from 'shared-runtime.tsx?tsr-shared=1'
+const label = createComponentLabel()
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
}
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
+function createComponentLabel() {
+ console.log('shared-runtime:component')
+ return Labels.component
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
const SplitLoader = () => {
- increment();
- return state;
-};
-export { SplitLoader as loader };
+ increment()
+ return state
+}
+export { SplitLoader as loader }
const SplitComponent = () => {
if (state.count === 3) {
- throw new Error('route source-map contract');
+ throw new Error('route source-map contract')
}
- return `${label}:${state.count}`;
-};
-export { SplitComponent as component };
\ No newline at end of file
+ return `${label}:${state.count}`
+}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@errorComponent.tsx
index d890a562c9..03cacac5b3 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@errorComponent.tsx
@@ -1,11 +1,7 @@
-import { state, createState, createSeed } from "shared-runtime.tsx?tsr-shared=1";
-function createState(initialState: {
- count: number;
-}): {
- state: {
- count: number;
- };
- increment: () => number;
-};
-export { state as firstState, state as secondState, state as 'odd-name' };
-export default createSeed;
\ No newline at end of file
+import { state, createState, createSeed } from 'shared-runtime.tsx?tsr-shared=1'
+function createState(initialState: { count: number }): {
+ state: { count: number }
+ increment: () => number
+}
+export { state as firstState, state as secondState, state as 'odd-name' }
+export default createSeed
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@shared.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@shared.tsx
index 54239b6cc5..c53a7e1568 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@shared.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-runtime@shared.tsx
@@ -1,28 +1,13 @@
-const Count = {
- Initial: 0
-};
-const Labels = {
- component: 'count'
-};
-const seed = createSeed();
-const {
- state,
- increment
-} = createState(seed);
+const Count = { Initial: 0 }
+const Labels = { component: 'count' }
+const seed = createSeed()
+const { state, increment } = createState(seed)
function createSeed() {
- console.log('shared-runtime:seed');
- return {
- count: Count.Initial,
- label: Labels.component
- };
+ console.log('shared-runtime:seed')
+ return { count: Count.Initial, label: Labels.component }
}
-function createState(initialState: {
- count: number;
-}) {
- console.log('shared-runtime:state');
- return {
- state: initialState,
- increment: () => initialState.count++
- };
+function createState(initialState: { count: number }) {
+ console.log('shared-runtime:state')
+ return { state: initialState, increment: () => initialState.count++ }
}
-export { Count, createSeed, createState, increment, Labels, seed, state };
\ No newline at end of file
+export { Count, createSeed, createState, increment, Labels, seed, state }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive.tsx
index 67b0631b8e..552cd657e0 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive.tsx
@@ -1,9 +1,11 @@
-const $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
+const $$splitComponentImporter = () =>
+ import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/api')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@component---loader---notFoundComponent---pendingComponent.tsx
index 662d7fd7aa..c67ed3c691 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,12 +1,9 @@
-const BASE_URL = 'https://api.example.com';
-const config = {
- url: BASE_URL,
- timeout: 5000
-};
-const fetcher = (path: string) => fetch(`${config.url}${path}`);
+const BASE_URL = 'https://api.example.com'
+const config = { url: BASE_URL, timeout: 5000 }
+const fetcher = (path: string) => fetch(`${config.url}${path}`)
const SplitLoader = async () => {
- return fetcher('/data');
-};
-export { SplitLoader as loader };
-const SplitComponent = () =>
Timeout: {config.timeout}
;
-export { SplitComponent as component };
\ No newline at end of file
+ return fetcher('/data')
+}
+export { SplitLoader as loader }
+const SplitComponent = () =>
;
-export { SplitComponent as component };
\ No newline at end of file
+ await collection.preload()
+ return { data: 'loaded' }
+}
+export { SplitLoader as loader }
+const SplitComponent = () =>
{collection.name}
+export { SplitComponent as component }
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect.tsx
index c322746737..5f68cb275d 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect.tsx
@@ -1,10 +1,12 @@
-const $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyRouteComponent } from '@tanstack/react-router';
-const $$splitLoaderImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
-import { lazyFn } from '@tanstack/react-router';
-import { createFileRoute } from '@tanstack/react-router';
-console.log('registry created');
+const $$splitComponentImporter = () =>
+ import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyRouteComponent } from '@tanstack/react-router'
+const $$splitLoaderImporter = () =>
+ import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent')
+import { lazyFn } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
+console.log('registry created')
export const Route = createFileRoute('/fx')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
- component: lazyRouteComponent($$splitComponentImporter, 'component')
-});
\ No newline at end of file
+ component: lazyRouteComponent($$splitComponentImporter, 'component'),
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@component---loader---notFoundComponent---pendingComponent.tsx
index 6c77f8b857..542779a26b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,7 +1,7 @@
-const registry = new Map();
+const registry = new Map()
const SplitLoader = async () => {
- registry.set('loaded', true);
-};
-export { SplitLoader as loader };
-const SplitComponent = () =>
{registry.size}
;
-export { SplitComponent as component };
\ No newline at end of file
+ registry.set('loaded', true)
+}
+export { SplitLoader as loader }
+const SplitComponent = () =>
+ },
+})
diff --git a/packages/router-plugin/tests/format-snapshot.ts b/packages/router-plugin/tests/format-snapshot.ts
new file mode 100644
index 0000000000..d152094bea
--- /dev/null
+++ b/packages/router-plugin/tests/format-snapshot.ts
@@ -0,0 +1,69 @@
+import { format } from 'prettier'
+import { parsers } from 'prettier/plugins/typescript'
+import type { ParserOptions } from 'prettier'
+
+/**
+ * Formats compiler output before it is compared with a file snapshot, so that
+ * snapshots record the emitted program instead of the layout choices of the
+ * code generator (object wrapping, blank lines, parentheses around JSX, ...).
+ *
+ * Comments are kept: they are part of the output. Output that does not parse
+ * is returned unchanged.
+ */
+export async function formatSnapshot(code: string, filepath: string) {
+ try {
+ return await format(await removeBlankLines(code, filepath), {
+ filepath,
+ parser: 'typescript',
+ semi: false,
+ singleQuote: true,
+ trailingComma: 'all',
+ // Do not keep an object expanded because the generator printed it
+ // over several lines.
+ objectWrap: 'collapse',
+ })
+ } catch {
+ return code
+ }
+}
+
+/**
+ * Prettier keeps single blank lines from its input. Outside template literals,
+ * line breaks are not significant, so blank lines can be dropped.
+ */
+async function removeBlankLines(code: string, filepath: string) {
+ const parser = parsers.typescript
+ const ast = await parser.parse(code, { filepath } as ParserOptions)
+ const templateRanges: Array<[number, number]> = []
+ const visit = (node: unknown): void => {
+ if (Array.isArray(node)) {
+ node.forEach(visit)
+ return
+ }
+ if (!node || typeof node !== 'object') {
+ return
+ }
+ if ((node as { type?: unknown }).type === 'TemplateElement') {
+ templateRanges.push([parser.locStart(node), parser.locEnd(node)])
+ }
+ for (const [key, value] of Object.entries(node)) {
+ if (key !== 'loc' && key !== 'range') {
+ visit(value)
+ }
+ }
+ }
+ visit(ast)
+
+ const lines: Array = []
+ let lineStart = 0
+ for (const line of code.split('\n')) {
+ const isInTemplate = templateRanges.some(
+ ([start, end]) => start < lineStart && lineStart < end,
+ )
+ if (line.trim() !== '' || isInTemplate) {
+ lines.push(line)
+ }
+ lineStart += line.length + 1
+ }
+ return lines.join('\n')
+}
diff --git a/packages/start-plugin-core/package.json b/packages/start-plugin-core/package.json
index 6ab02f91e5..677fb18013 100644
--- a/packages/start-plugin-core/package.json
+++ b/packages/start-plugin-core/package.json
@@ -113,6 +113,7 @@
"@types/babel__core": "^7.20.5",
"@types/node": ">=20",
"@types/picomatch": "^4.0.2",
+ "prettier": "^3.9.6",
"vite": "*",
"@tanstack/vite-config": "catalog:",
"vitest": "catalog:",
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/clientOnlyJSX.test.ts b/packages/start-plugin-core/tests/clientOnlyJSX/clientOnlyJSX.test.ts
index 4f645d73db..fa48668a38 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/clientOnlyJSX.test.ts
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/clientOnlyJSX.test.ts
@@ -6,6 +6,7 @@ import {
detectKindsInCode,
StartCompiler,
} from '../../src/start-compiler/compiler'
+import { formatSnapshot } from '../format-snapshot'
// Default test options for StartCompiler
function getDefaultTestOptions(env: 'client' | 'server') {
@@ -72,9 +73,9 @@ describe('ClientOnlyJSX compiles correctly', async () => {
})
if (compiledResult) {
- await expect(compiledResult.code).toMatchFileSnapshot(
- `./snapshots/server/${filename}`,
- )
+ await expect(
+ await formatSnapshot(compiledResult.code, filename),
+ ).toMatchFileSnapshot(`./snapshots/server/${filename}`)
} else {
// No transformation - for files where ClientOnly is not from TanStack
await expect('no-transform').toMatchFileSnapshot(
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyBasic.tsx b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyBasic.tsx
index 82195ff739..96de7844f6 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyBasic.tsx
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyBasic.tsx
@@ -1,6 +1,8 @@
-import { ClientOnly } from '@tanstack/react-router';
+import { ClientOnly } from '@tanstack/react-router'
export function MyComponent() {
- return
+ return (
+
Loading...
} />
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyMultiple.tsx b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyMultiple.tsx
index f437f41b05..6b95090d3f 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyMultiple.tsx
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyMultiple.tsx
@@ -1,8 +1,10 @@
-import { ClientOnly } from '@tanstack/react-router';
+import { ClientOnly } from '@tanstack/react-router'
export function MyComponent() {
- return
+ return (
+
Loading video...} />
Some server content
Loading audio...} />
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNested.tsx b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNested.tsx
index 9d48d6577d..f3d5d3b526 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNested.tsx
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNested.tsx
@@ -1,6 +1,8 @@
-import { ClientOnly } from '@tanstack/react-router';
+import { ClientOnly } from '@tanstack/react-router'
export function MyComponent() {
- return
+ return (
+
Outer loading
} />
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNoFallback.tsx b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNoFallback.tsx
index 9224aeb1cf..40551a6dad 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNoFallback.tsx
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyNoFallback.tsx
@@ -1,6 +1,8 @@
-import { ClientOnly } from '@tanstack/react-router';
+import { ClientOnly } from '@tanstack/react-router'
export function MyComponent() {
- return
+ return (
+
-
;
-}
\ No newline at end of file
+
+ )
+}
diff --git a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyRenamed.tsx b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyRenamed.tsx
index de9e376b63..9a537448b0 100644
--- a/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyRenamed.tsx
+++ b/packages/start-plugin-core/tests/clientOnlyJSX/snapshots/server/clientOnlyRenamed.tsx
@@ -1,7 +1,9 @@
// Test: ClientOnly imported with an alias should still be transformed
-import { ClientOnly as CO } from '@tanstack/react-router';
+import { ClientOnly as CO } from '@tanstack/react-router'
export function MyComponent() {
- return