Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-router/src/Asset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import type { RouterManagedTag } from '@tanstack/router-core'

Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/src/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
getLocationChangeInfo,
isNotFound,
isRedirect,
isServer,
rootRouteId,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'
Expand Down
3 changes: 2 additions & 1 deletion packages/react-router/src/Matches.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import warning from 'tiny-warning'
import { isServer, rootRouteId } from '@tanstack/router-core'
import { rootRouteId } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/src/ScriptOnce.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/src/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
exactPathTest,
functionalUpdate,
isDangerousProtocol,
isServer,
preloadWarning,
removeTrailingSlash,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'

Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/src/scroll-restoration.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
defaultGetScrollRestorationKey,
escapeHtml,
isServer,
restoreScroll,
storageKey,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { ScriptOnce } from './ScriptOnce'

Expand Down
1 change: 0 additions & 1 deletion packages/router-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export {
export { encode, decode } from './qss'
export { rootRouteId } from './root'
export type { RootRouteId } from './root'
export { isServer } from './isServer'

export { BaseRoute, BaseRouteApi, BaseRootRoute } from './route'
export type {
Expand Down
24 changes: 0 additions & 24 deletions packages/router-core/src/isServer.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/router-core/src/load-matches.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { batch } from '@tanstack/store'
import invariant from 'tiny-invariant'
import { isServer } from '@tanstack/router-core/isServer'
import { createControlledPromise, isPromise } from './utils'
import { isNotFound } from './not-found'
import { rootRouteId } from './root'
import { isRedirect } from './redirect'
import { isServer } from './isServer'
import type { NotFoundError } from './not-found'
import type { ParsedLocation } from './location'
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/router-core/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Store, batch } from '@tanstack/store'
import { createBrowserHistory, parseHref } from '@tanstack/history'
import { isServer } from '@tanstack/router-core/isServer'
import {
createControlledPromise,
decodePath,
Expand All @@ -26,7 +27,6 @@ import {
trimPath,
trimPathRight,
} from './path'
import { isServer } from './isServer'
import { createLRUCache } from './lru-cache'
import { isNotFound } from './not-found'
import { setupScrollRestoration } from './scroll-restoration'
Expand Down
2 changes: 1 addition & 1 deletion packages/router-core/src/scroll-restoration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isServer } from '@tanstack/router-core/isServer'
import { functionalUpdate } from './utils'
import { isServer } from './isServer'
import type { AnyRouter } from './router'
import type { ParsedLocation } from './location'
import type { NonNullableUpdater } from './utils'
Expand Down
5 changes: 5 additions & 0 deletions packages/router-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@tanstack/router-core/isServer": ["./src/isServer/development.ts"]
}
},
"include": ["src", "vite.config.ts", "tests", "vite-minify-plugin.ts"]
}
10 changes: 10 additions & 0 deletions packages/router-core/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path'
import { defineConfig, mergeConfig } from 'vitest/config'
import { tanstackViteConfig } from '@tanstack/config/vite'
import minifyScriptPlugin from './vite-minify-plugin'
Expand All @@ -12,6 +13,14 @@ const config = defineConfig({
watch: false,
environment: 'jsdom',
typecheck: { enabled: true },
alias: {
// For tests only, resolve to development.ts which returns undefined
// so that router.isServer fallback is used
'@tanstack/router-core/isServer': path.resolve(
__dirname,
'src/isServer/development.ts',
),
},
},
})

Expand All @@ -27,5 +36,6 @@ export default mergeConfig(
'./src/isServer/development.ts',
],
srcDir: './src',
externalDeps: ['@tanstack/router-core/isServer'],
}),
)
3 changes: 2 additions & 1 deletion packages/router-ssr-query-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
dehydrate as queryDehydrate,
hydrate as queryHydrate,
} from '@tanstack/query-core'
import { isRedirect, isServer } from '@tanstack/router-core'
import { isRedirect } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import type { AnyRouter } from '@tanstack/router-core'
import type {
QueryClient,
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-router/src/Asset.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link, Meta, Style, Title } from '@solidjs/meta'
import { onCleanup, onMount } from 'solid-js'
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import type { RouterManagedTag } from '@tanstack/router-core'
import type { JSX } from 'solid-js'
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-router/src/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
getLocationChangeInfo,
isNotFound,
isRedirect,
isServer,
rootRouteId,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { Dynamic } from 'solid-js/web'
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
import { useRouterState } from './useRouterState'
Expand Down
3 changes: 2 additions & 1 deletion packages/solid-router/src/Matches.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as Solid from 'solid-js'
import warning from 'tiny-warning'
import { isServer, rootRouteId } from '@tanstack/router-core'
import { rootRouteId } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-router/src/ScriptOnce.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'

export function ScriptOnce({
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-router/src/Transitioner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as Solid from 'solid-js'
import {
getLocationChangeInfo,
handleHashScroll,
isServer,
trimPathRight,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { useRouterState } from './useRouterState'
import { usePrevious } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-router/src/scroll-restoration.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
defaultGetScrollRestorationKey,
escapeHtml,
isServer,
restoreScroll,
storageKey,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { ScriptOnce } from './ScriptOnce'

Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/Asset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Vue from 'vue'
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import type { RouterManagedTag } from '@tanstack/router-core'

Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
getLocationChangeInfo,
isNotFound,
isRedirect,
isServer,
rootRouteId,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
import { ClientOnly } from './ClientOnly'
import { useRouterState } from './useRouterState'
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/Matches.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Vue from 'vue'
import warning from 'tiny-warning'
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { CatchBoundary } from './CatchBoundary'
import { useRouterState } from './useRouterState'
import { useRouter } from './useRouter'
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/ScriptOnce.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Vue from 'vue'
import { isServer } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'

export const ScriptOnce = Vue.defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/Transitioner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as Vue from 'vue'
import {
getLocationChangeInfo,
handleHashScroll,
isServer,
trimPathRight,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { useRouterState } from './useRouterState'
import { usePrevious } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-router/src/scroll-restoration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as Vue from 'vue'
import {
defaultGetScrollRestorationKey,
escapeHtml,
isServer,
restoreScroll,
storageKey,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { ScriptOnce } from './ScriptOnce'

Expand Down
Loading