diff --git a/.changeset/hide-router-internals.md b/.changeset/hide-router-internals.md new file mode 100644 index 00000000000..6ba87d11e71 --- /dev/null +++ b/.changeset/hide-router-internals.md @@ -0,0 +1,29 @@ +--- +'@tanstack/router-core': patch +'@tanstack/history': patch +'@tanstack/react-router': patch +'@tanstack/solid-router': patch +'@tanstack/vue-router': patch +--- + +Remove undocumented internals from the published type declarations. Runtime behaviour is unchanged: every value is still exported from the same entry points and every property still exists at runtime. Only the types no longer name them. Code that used one of these names gets a type error and needs a cast. They are internal and can change in any release. + +Router (`RouterCore` and the framework `Router` classes): `_tx`, `_cache`, `_serverResult`, `_rendered`, `_scroll`, `_refreshRoute`, `_replaceRouteChunk`, `_lifecycleEnd`, `_flights`, `_preloads`, `_preflight`, `_handoff`, `_pending`, `_committed`, `_pendingLocation`, `_commitPromise`, `stores`, `batch`, `emit`, `subscribers`, `isServer`, `ssr`, `origin`, `basepath`, `rewrite`, `protocolAllowlist`, `startTransition`, `startViewTransition`, `shouldViewTransition`, `tempLocationKey`, `getStoreConfig`, `latestLocation`, `processedTree`, `resolvePathCache`, `lightweightCache`, `staticLocations`, `pathParamsDecoder`, `updateLatestLocation`, `buildRouteTree`, `setRoutes`, `parseLocation`, `matchRoutesInternal`, `getMatchedRoutes`, `matchRoutesLightweight`, `buildAndCommitLocation`, `resolveRedirect`, `serverSsrLifecycle`, `commitLocation` and `routesByPath`. + +Matches (`RouteMatch`): `index`, `loaderDeps`, `preload`, `invalid`, `headers`, `_strictParams`, `_strictSearch` and `_notFound`, and the `meta`, `links`, `scripts`, `styles` and `headScripts` fields that the framework packages add. + +Routes (`Route` and `BaseRoute`): `options`, `children`, `rank`, `init`, `isRoot`, `originalIndex` and `updateLoader`. `FileRoute`: `silent`. + +History (`RouterHistory`): `location`, `length`, `subscribe`, `subscribers`, `canGoBack`, `block`, `notify`, `flush`, `createHref`, `_getBlockers`, `_ignoreSubscribers` and `_ignoreNextBeforeUnload`. `history.go` and `history.forward` stay and are now documented. `HistoryState.__hashScrollIntoViewOptions` in the framework packages is hidden as well. + +Options: `_fromLocation`, `_isNavigate`, `_includeValidateSearch`, `_signal`, `_skipLocationUpdate`, `unsafeRelative`, the deprecated `startTransition` navigation option, and the router options `additionalContext`, `isServer`, `isShell` and `isPrerendering`. + +Exports of `@tanstack/router-core`: `TSR_DEFERRED_PROMISE`, `invariant`, `preloadWarning`, `DEV_STYLES_ATTR`, `appendUniqueUserTags`, `createInlineCssStyleAsset`, `getAssetCrossOrigin`, `getManifestScriptFormat`, `getScriptPreloadAttrs`, `getStylesheetHref`, `resolveManifestAssetLink`, `resolveManifestCssLink`, `_getAssetMatches`, `_getRenderedMatches`, `_isRouteDeparting`, `composeSsrBodyScripts`, `getSsrBodyScriptParts`, `joinPaths`, `cleanPath`, `trimPathLeft`, `trimPathRight`, `trimPath`, `removeTrailingSlash`, `exactPathTest`, `resolvePath`, `interpolatePath`, `getRouteSegments`, `hasMissingPathParams`, `encode`, `decode`, `createNonReactiveMutableStore`, `createNonReactiveReadonlyStore`, `defaultSerializeError`, `getLocationChangeInfo`, `getInitialRouterState`, `trailingSlashOptions`, `createRouterConfig`, `functionalUpdate`, `hasKeys`, `replaceEqualDeep`, `deepEqual`, `createControlledPromise`, `isPromise`, `isModuleNotFoundError`, `escapeHtml`, `getUrlScheme`, `isDangerousProtocol`, `buildDevStylesUrl`, `isResolvedRedirect`, `parseRedirect`, `defaultGetScrollRestorationKey`, `getElementScrollRestorationEntry`, `storageKey`, `setupScrollRestoration`, `makeSerovalPlugin` and `executeRewriteInput`. + +Exports of `@tanstack/router-core/ssr/server`: `waitForRequest`, `bindSsrResponseToRequest`, `createSsrStreamResponse`, `disposeSsrResponse`, `getSsrStatus`, `isSsrResponse`, `normalizeSsrResponse`, `replaceSsrResponse`, `stripSsrResponseBody`, `transformHtmlStringWithRouter`, `renderSsrHtmlResponse`, `getNormalizedURL`, `getOrigin`, `defaultSerovalDeserializerPlugins`, `createRawStreamRPCPlugin` and `makeSsrSerovalPlugin`. Of `@tanstack/router-core/ssr/client`: `createDefaultSerovalPlugins`, `defaultSerovalPlugins`, `makeSerovalPlugin` and `createRawStreamDeserializePlugin`. Of `@tanstack/router-core/isServer`: `isServer` and `loadServerRoute`. Of `@tanstack/router-core/scroll-restoration-script`: `getScrollRestorationScriptForRouter`. + +Exports of `@tanstack/history`: `createHistory`, `parseHref`, `normalizeProtocolRelative` and the `NavigationBlocker` type. + +Exports of the framework packages: `joinPaths`, `cleanPath`, `trimPath`, `trimPathLeft`, `trimPathRight`, `resolvePath`, `interpolatePath`, `functionalUpdate`, `replaceEqualDeep`, `deepEqual`, `createControlledPromise`, `createHistory`, `createRouterConfig`, `Matches`, `Match`, `Asset`, `useTags`, `RouterContextProvider` and `FileRouteLoader`, and in `@tanstack/react-router` also `useLayoutEffect` and `reactUse`. + +Types that no public declaration uses any more, from `@tanstack/router-core` and the framework packages that re-export them: `AnyRouteWithContext`, `AnyRouterWithContext`, `AnySearchValidator`, `AnyStandardSchemaValidateInput`, `AnyValidatorFn`, `CommitLocationFn`, `CommitLocationOptions`, `ControllablePromise`, `ControlledPromise`, `CreateLazyFileRoute`, `DefaultSearchValidator`, `EmitFn`, `ErrorRouteProps`, `GetMatchRoutesFn`, `IsAny`, `IsUnion`, `LoadRouteChunkFn`, `MatchLocation`, `MergeAll`, `MergeAllObjects`, `MetaDescriptor`, `ParseLocationFn`, `PickRequired`, `PreloadableObj`, `ResolvedRedirect`, `ResolveSearchSchema`, `ResolveSearchSchemaFn`, `ResolveSearchSchemaFnInput`, `ResolveSearchSchemaInput`, `RouteContextFn`, `RouteLinkEntry`, `RoutePathOptionsIntersection`, `RouterConfig`, `RouterConfigOptions`, `RouterConfigTypes`, `AnyRouterConfig`, `RouterListener`, `RouterManagedInlineCssTag`, `RouterStores`, `SearchValidator`, `StartTransitionFn`, `StringLiteral`, `Timeout`, `ValidateId`, `ValidateNavigateOptionsArray`, `ValidateParams`, `ValidateRedirectOptionsArray`, `ValidateSearch`, `ValidateToPath`, `ValidateUseParamsResult`, `ValidateUseSearchResult` and `WithoutEmpty`; in the framework packages also `ValidateUseSearchOptions` and `ValidateUseParamsOptions`, `InferStructuralSharing` in `@tanstack/react-router` and `VueNode` in `@tanstack/vue-router`. diff --git a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx index d8948fdb7e3..c044b3922cd 100644 --- a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx @@ -1,5 +1,4 @@ import { - Asset, Await, Block, CatchBoundary, @@ -9,12 +8,9 @@ import { ErrorComponent, HeadContent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -41,7 +37,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/react-router' export const Route = createRootRoute({ @@ -68,7 +63,6 @@ function RootComponent() { const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() useBlocker({ shouldBlockFn: () => false, @@ -101,7 +95,6 @@ function RootComponent() { useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -109,16 +102,12 @@ function RootComponent() { DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, ] @@ -143,17 +132,12 @@ function RootComponent() { void canGoBack void navigate void scrollEntry - void tags void routeMatchResult return ( <> {'window.__tsr_bundle_size = true'} - home @@ -171,9 +155,6 @@ function RootComponent() { }> - - - diff --git a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx index 07fd3a40be2..a81645fa264 100644 --- a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx @@ -1,5 +1,4 @@ import { - Asset, Await, Block, CatchBoundary, @@ -9,12 +8,9 @@ import { ErrorComponent, HeadContent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -41,7 +37,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/react-router' import { createMiddleware, @@ -91,7 +86,6 @@ function RootComponent() { const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() const invokeServerFn = useServerFn(helloServerFn) useBlocker({ @@ -126,7 +120,6 @@ function RootComponent() { useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -134,16 +127,12 @@ function RootComponent() { DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, ] @@ -169,7 +158,6 @@ function RootComponent() { void canGoBack void navigate void scrollEntry - void tags void routeMatchResult void invokeServerFn @@ -180,10 +168,6 @@ function RootComponent() { {'window.__tsr_bundle_size = true'} - home @@ -201,9 +185,6 @@ function RootComponent() { }> - - - diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx index f4c29060160..6e769e756d7 100644 --- a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx @@ -1,5 +1,4 @@ import { - Asset, Await, Block, CatchBoundary, @@ -9,12 +8,9 @@ import { ErrorComponent, HeadContent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -41,7 +37,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/solid-router' export const Route = createRootRoute({ @@ -68,7 +63,6 @@ function RootComponent() { const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() useBlocker({ shouldBlockFn: () => false, @@ -101,7 +95,6 @@ function RootComponent() { useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -109,16 +102,12 @@ function RootComponent() { DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, ] @@ -143,17 +132,12 @@ function RootComponent() { void canGoBack() void navigate void scrollEntry - void tags() void routeMatchResult() return ( <> {'window.__tsr_bundle_size = true'} - home @@ -171,9 +155,6 @@ function RootComponent() { }> - - {() => } - diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx index 3daa0019c0b..172c1953fc1 100644 --- a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx @@ -1,5 +1,4 @@ import { - Asset, Await, Block, CatchBoundary, @@ -9,12 +8,9 @@ import { ErrorComponent, HeadContent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -41,7 +37,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/solid-router' import { createMiddleware, @@ -100,7 +95,6 @@ function RootComponent() { const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() const invokeServerFn = useServerFn(helloServerFn) useBlocker({ @@ -135,7 +129,6 @@ function RootComponent() { useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -143,16 +136,12 @@ function RootComponent() { DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, ] @@ -178,7 +167,6 @@ function RootComponent() { void canGoBack() void navigate void scrollEntry - void tags() void routeMatchResult() void invokeServerFn @@ -189,10 +177,6 @@ function RootComponent() { {'window.__tsr_bundle_size = true'} - home @@ -210,9 +194,6 @@ function RootComponent() { }> - - {() => } - diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx index 0ff40aebfc5..aa7524f8903 100644 --- a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx @@ -1,6 +1,5 @@ import { defineComponent } from 'vue' import { - Asset, Await, Block, Body, @@ -12,12 +11,9 @@ import { HeadContent, Html, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -43,7 +39,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/vue-router' const RootComponent = defineComponent({ @@ -68,7 +63,6 @@ const RootComponent = defineComponent({ const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() useBlocker({ shouldBlockFn: () => false, @@ -100,7 +94,6 @@ const RootComponent = defineComponent({ useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -108,16 +101,12 @@ const RootComponent = defineComponent({ DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, Body, @@ -145,17 +134,12 @@ const RootComponent = defineComponent({ void canGoBack.value void navigate void scrollEntry - void tags() void routeMatchResult.value return ( <> {'window.__tsr_bundle_size = true'} - home @@ -176,9 +160,6 @@ const RootComponent = defineComponent({ }> - - - diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx index 8e8870a2ce7..3e6d21f48df 100644 --- a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx +++ b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx @@ -1,6 +1,5 @@ import { defineComponent } from 'vue' import { - Asset, Await, Block, Body, @@ -12,12 +11,9 @@ import { HeadContent, Html, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScriptOnce, Scripts, ScrollRestoration, @@ -43,7 +39,6 @@ import { useRouter, useRouterState, useSearch, - useTags, } from '@tanstack/vue-router' import { createMiddleware, @@ -91,7 +86,6 @@ const RootComponent = defineComponent({ const canGoBack = useCanGoBack() const navigate = useNavigate() const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() const invokeServerFn = useServerFn(helloServerFn) useBlocker({ @@ -125,7 +119,6 @@ const RootComponent = defineComponent({ useLocation, useCanGoBack, useElementScrollRestoration, - useTags, Await, CatchBoundary, CatchNotFound, @@ -133,16 +126,12 @@ const RootComponent = defineComponent({ DefaultGlobalNotFound, ErrorComponent, Link, - Match, MatchRoute, - Matches, Navigate, Outlet, - RouterContextProvider, ScrollRestoration, Block, ScriptOnce, - Asset, HeadContent, Scripts, Body, @@ -171,7 +160,6 @@ const RootComponent = defineComponent({ void canGoBack.value void navigate void scrollEntry - void tags() void routeMatchResult.value void invokeServerFn @@ -182,10 +170,6 @@ const RootComponent = defineComponent({ {'window.__tsr_bundle_size = true'} - home @@ -206,9 +190,6 @@ const RootComponent = defineComponent({ }> - - - diff --git a/benchmarks/client-nav/link-performance/project.json b/benchmarks/client-nav/link-performance/project.json index fd1751c0818..1ed140497e9 100644 --- a/benchmarks/client-nav/link-performance/project.json +++ b/benchmarks/client-nav/link-performance/project.json @@ -86,12 +86,17 @@ "{workspaceRoot}/benchmarks/client-nav/scenarios/links/shared.ts", "{workspaceRoot}/benchmarks/client-nav/setup-helpers.ts", "{workspaceRoot}/benchmarks/client-nav/tsconfig.json", - "{workspaceRoot}/benchmarks/client-nav/vitest.setup.ts" + "{workspaceRoot}/benchmarks/client-nav/vitest.setup.ts", + "{workspaceRoot}/packages/tsconfig.paths.json" ], "dependsOn": [ { "projects": ["@tanstack/react-router"], "target": "build" + }, + { + "projects": ["@tanstack/react-router"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/link-performance/tsconfig.json b/benchmarks/client-nav/link-performance/tsconfig.json index fbf230c9770..13e6252504f 100644 --- a/benchmarks/client-nav/link-performance/tsconfig.json +++ b/benchmarks/client-nav/link-performance/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": ["../tsconfig.json", "../../../packages/tsconfig.paths.json"], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react", diff --git a/benchmarks/client-nav/scenarios/history/react/project.json b/benchmarks/client-nav/scenarios/history/react/project.json index a2fe0001be9..76b666c8e80 100644 --- a/benchmarks/client-nav/scenarios/history/react/project.json +++ b/benchmarks/client-nav/scenarios/history/react/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/history/react/tsconfig.json b/benchmarks/client-nav/scenarios/history/react/tsconfig.json index 1d59cbb4503..b7ca273c36d 100644 --- a/benchmarks/client-nav/scenarios/history/react/tsconfig.json +++ b/benchmarks/client-nav/scenarios/history/react/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react", diff --git a/benchmarks/client-nav/scenarios/history/solid/project.json b/benchmarks/client-nav/scenarios/history/solid/project.json index 6f4bba1ca50..2661d03ca66 100644 --- a/benchmarks/client-nav/scenarios/history/solid/project.json +++ b/benchmarks/client-nav/scenarios/history/solid/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json b/benchmarks/client-nav/scenarios/history/solid/tsconfig.json index 98d76ad6b80..1ee968fbce1 100644 --- a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json +++ b/benchmarks/client-nav/scenarios/history/solid/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "preserve", "jsxImportSource": "solid-js", diff --git a/benchmarks/client-nav/scenarios/history/vue/project.json b/benchmarks/client-nav/scenarios/history/vue/project.json index 17fca887caf..182d20d556b 100644 --- a/benchmarks/client-nav/scenarios/history/vue/project.json +++ b/benchmarks/client-nav/scenarios/history/vue/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/history/vue/tsconfig.json b/benchmarks/client-nav/scenarios/history/vue/tsconfig.json index 7786fc3da9a..a29b91fc508 100644 --- a/benchmarks/client-nav/scenarios/history/vue/tsconfig.json +++ b/benchmarks/client-nav/scenarios/history/vue/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "preserve", "jsxImportSource": "vue", diff --git a/benchmarks/client-nav/scenarios/hydration/react/project.json b/benchmarks/client-nav/scenarios/hydration/react/project.json index ca23838c0f3..1451d57c6af 100644 --- a/benchmarks/client-nav/scenarios/hydration/react/project.json +++ b/benchmarks/client-nav/scenarios/hydration/react/project.json @@ -6,7 +6,10 @@ "executor": "nx:run-commands", "cache": false, "dependsOn": [ - { "projects": ["@tanstack/react-router"], "target": "build" } + { + "projects": ["@tanstack/react-router"], + "target": "build" + } ], "options": { "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" @@ -32,9 +35,18 @@ "test:types:client": { "executor": "nx:run-commands", "dependsOn": [ - { "projects": ["@tanstack/react-router"], "target": "build" } + { + "projects": ["@tanstack/react-router"], + "target": "build" + }, + { + "projects": ["@tanstack/react-router"], + "target": "compile" + } ], - "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" } + "options": { + "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" + } } } } diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx index 42c5a5104ed..18401e46a07 100644 --- a/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx +++ b/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx @@ -5,6 +5,7 @@ import { hydrate } from '@tanstack/react-router/ssr/client' import { isServer } from '@tanstack/router-core/isServer' import { createDiagnostics, hashLinkCount } from '../fixture' import { createFixtureRouter } from './app' +import type { AnyRouteMatch } from '@tanstack/react-router' export const serverEnvironment = isServer let router: ReturnType | undefined @@ -64,11 +65,11 @@ export function ready() { } export function snapshot() { - const matches = router?.stores.matches.get() + const matches: Array | undefined = router?.state.matches return { diagnostics: { ...diagnostics }, errors: [...errors], - location: router?.stores.location.get().href, + location: router?.state.location.href, matches: matches?.map((match) => ({ status: match.status, context: match.context, diff --git a/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json index 23dd08de8b2..c9e9ee30cfa 100644 --- a/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json +++ b/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react", diff --git a/benchmarks/client-nav/scenarios/hydration/solid/project.json b/benchmarks/client-nav/scenarios/hydration/solid/project.json index 1fa162771b6..9bb3d2963f5 100644 --- a/benchmarks/client-nav/scenarios/hydration/solid/project.json +++ b/benchmarks/client-nav/scenarios/hydration/solid/project.json @@ -6,7 +6,10 @@ "executor": "nx:run-commands", "cache": false, "dependsOn": [ - { "projects": ["@tanstack/solid-router"], "target": "build" } + { + "projects": ["@tanstack/solid-router"], + "target": "build" + } ], "options": { "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" @@ -32,9 +35,18 @@ "test:types:client": { "executor": "nx:run-commands", "dependsOn": [ - { "projects": ["@tanstack/solid-router"], "target": "build" } + { + "projects": ["@tanstack/solid-router"], + "target": "build" + }, + { + "projects": ["@tanstack/solid-router"], + "target": "compile" + } ], - "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" } + "options": { + "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" + } } } } diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx index ef0f5268d68..3c84c0753a5 100644 --- a/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx +++ b/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx @@ -5,6 +5,7 @@ import { hydrate } from '@tanstack/router-core/ssr/client' import { isServer } from '@tanstack/router-core/isServer' import { createDiagnostics, hashLinkCount } from '../fixture' import { createFixtureRouter } from './app' +import type { AnyRouteMatch } from '@tanstack/solid-router' export const serverEnvironment = isServer export const solidServerEnvironment = solidIsServer @@ -45,7 +46,7 @@ export function ready() { !diagnostics.mounted || !diagnostics.rendered || sharedConfig.context || - router?.stores.status.get() === 'pending' + router?.state.status === 'pending' ) { return false } @@ -64,6 +65,7 @@ export function ready() { } export function snapshot() { + const matches: Array | undefined = router?.state.matches return { diagnostics: { ...diagnostics, @@ -71,9 +73,9 @@ export function snapshot() { hashStates: [...diagnostics.hashStates], }, hydrating: !!sharedConfig.context, - location: router?.stores.location.get().href, - resolvedLocation: router?.stores.resolvedLocation.get()?.href, - matches: router?.stores.matches.get().map((match) => ({ + location: router?.state.location.href, + resolvedLocation: router?.state.resolvedLocation?.href, + matches: matches?.map((match) => ({ status: match.status, context: match.context, loaderData: match.loaderData, diff --git a/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json index daf27ddf12d..c56f42a226c 100644 --- a/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json +++ b/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "preserve", "jsxImportSource": "solid-js", diff --git a/benchmarks/client-nav/scenarios/rewrites/react/project.json b/benchmarks/client-nav/scenarios/rewrites/react/project.json index d98c6e14128..4a00bb12a61 100644 --- a/benchmarks/client-nav/scenarios/rewrites/react/project.json +++ b/benchmarks/client-nav/scenarios/rewrites/react/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json index 1d59cbb4503..b7ca273c36d 100644 --- a/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json +++ b/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react", diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/project.json b/benchmarks/client-nav/scenarios/rewrites/solid/project.json index 4b2f763032b..5fd7aa98d35 100644 --- a/benchmarks/client-nav/scenarios/rewrites/solid/project.json +++ b/benchmarks/client-nav/scenarios/rewrites/solid/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json index 98d76ad6b80..1ee968fbce1 100644 --- a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json +++ b/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "preserve", "jsxImportSource": "solid-js", diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/project.json b/benchmarks/client-nav/scenarios/rewrites/vue/project.json index 9b7cb5d1989..88da9ac8c88 100644 --- a/benchmarks/client-nav/scenarios/rewrites/vue/project.json +++ b/benchmarks/client-nav/scenarios/rewrites/vue/project.json @@ -21,6 +21,10 @@ { "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], "target": "build" + }, + { + "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], + "target": "compile" } ], "options": { diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json index 7786fc3da9a..a29b91fc508 100644 --- a/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json +++ b/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "../../../../../tsconfig.json", + "extends": [ + "../../../../../tsconfig.json", + "../../../../../packages/tsconfig.paths.json" + ], "compilerOptions": { "jsx": "preserve", "jsxImportSource": "vue", diff --git a/docs/router/api/router/RouteMatchType.md b/docs/router/api/router/RouteMatchType.md index b5009ebe685..2dc7658ee79 100644 --- a/docs/router/api/router/RouteMatchType.md +++ b/docs/router/api/router/RouteMatchType.md @@ -9,6 +9,7 @@ The `RouteMatch` type represents a route match in TanStack Router. interface RouteMatch { id: string routeId: string + fullPath: Route['fullPath'] pathname: string params: Route['allParams'] status: 'pending' | 'success' | 'error' | 'notFound' @@ -26,6 +27,8 @@ interface RouteMatch { } ``` +`fullPath` is the full path of the matched route, such as `/posts/$postId`. You can pass it as the `from` of a `Link` or `navigate` call to resolve a relative path from that match. + `status` describes the match's render state. `isFetching` independently exposes active `beforeLoad` or loader work. In particular, a successful match can report `isFetching: 'loader'` while stale data remains visible during a background diff --git a/docs/router/api/router/RouterType.md b/docs/router/api/router/RouterType.md index 3fde90e32e5..847b6407bd1 100644 --- a/docs/router/api/router/RouterType.md +++ b/docs/router/api/router/RouterType.md @@ -75,49 +75,6 @@ Builds a new parsed location object that can be used later to navigate to a new - Optional - If `true`, the route mask will be removed when the page is reloaded. This can be overridden on a per-navigation basis by setting `mask.unmaskOnReload` in [`NavigateOptions`](./NavigateOptionsType.md). -### `.commitLocation` method - -Commits a new location object to the browser history. - -- Type - ```tsx - type commitLocation = ( - location: ParsedLocation & { - replace?: boolean - resetScroll?: boolean - hashScrollIntoView?: boolean | ScrollIntoViewOptions - ignoreBlocker?: boolean - }, - ) => Promise - ``` -- Properties - - `location` - - Type: [`ParsedLocation`](./ParsedLocationType.md) - - Required - - The location to commit to the browser history. - - `replace` - - Type: `boolean` - - Optional - - Defaults to `false`. - - If `true`, the location will be committed to the browser history using `history.replace` instead of `history.push`. - - `resetScroll` - - Type: `boolean` - - Optional - - Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history. - - If `false`, the scroll position will not be reset to 0,0 after the location is committed to history. - - `hashScrollIntoView` - - Type: `boolean | ScrollIntoViewOptions` - - Optional - - Defaults to `true` so the element with an id matching the hash will be scrolled into view after the location is committed to history. - - If `false`, the element with an id matching the hash will not be scrolled into view after the location is committed to history. - - If an object is provided, it will be passed to the `scrollIntoView` method as options. - - See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`. - - `ignoreBlocker` - - Type: `boolean` - - Optional - - Defaults to `false`. - - If `true`, navigation will ignore any blockers that might prevent it. - ### `.navigate` method Navigates to a new location. diff --git a/docs/router/guide/history-types.md b/docs/router/guide/history-types.md index 0c6a914fb61..66e256c4f69 100644 --- a/docs/router/guide/history-types.md +++ b/docs/router/guide/history-types.md @@ -105,4 +105,23 @@ const router = createRouter({ routeTree, history: memoryHistory }) +## Moving Through the History + +The router's history instance is available as `router.history`. Like the browser's history, it can move to entries the user has already visited: + +- `back()` goes to the previous entry. +- `forward()` goes to the next entry. +- `go(delta)` moves `delta` entries. A negative number goes back and a positive number goes forward, so `go(-1)` moves to the same entry as `back()`. + +Each of them takes an optional `{ ignoreBlocker: true }` object to skip any [navigation blockers](./navigation-blocking.md). + +```ts +const router = useRouter() + +router.history.back() +router.history.forward() +router.history.go(-2) // two entries back +router.history.go(1, { ignoreBlocker: true }) +``` + Refer to the [SSR Guide](./ssr.md#automatic-server-history) for usage on the server for server-side rendering. diff --git a/docs/router/guide/preloading.md b/docs/router/guide/preloading.md index 7f48412ce68..02eff812ed8 100644 --- a/docs/router/guide/preloading.md +++ b/docs/router/guide/preloading.md @@ -278,24 +278,26 @@ function Component() { -If you need to preload only the JS chunk of a route, you can use the router's `loadRouteChunk` method. It accepts a route object and returns a promise that resolves when the route chunk is loaded. +If you need to preload only the JS chunk of a route, you can use the router's `loadRouteChunk` method. It accepts a route object, such as the `Route` a route file exports, and returns a promise that resolves when the route chunk is loaded. # React ```tsx +import { Route as IndexRoute } from './routes/index' +import { Route as PostsRoute } from './routes/posts' + function Component() { const router = useRouter() useEffect(() => { async function preloadRouteChunks() { try { - const postsRoute = router.routesByPath['/posts'] await Promise.all([ - router.loadRouteChunk(router.routesByPath['/']), - router.loadRouteChunk(postsRoute), - router.loadRouteChunk(postsRoute.parentRoute), + router.loadRouteChunk(IndexRoute), + router.loadRouteChunk(PostsRoute), + router.loadRouteChunk(PostsRoute.parentRoute), ]) } catch (err) { // Failed to preload route chunk @@ -312,17 +314,19 @@ function Component() { # Solid ```tsx +import { Route as IndexRoute } from './routes/index' +import { Route as PostsRoute } from './routes/posts' + function Component() { const router = useRouter() createEffect(() => { async function preloadRouteChunks() { try { - const postsRoute = router.routesByPath['/posts'] await Promise.all([ - router.loadRouteChunk(router.routesByPath['/']), - router.loadRouteChunk(postsRoute), - router.loadRouteChunk(postsRoute.parentRoute), + router.loadRouteChunk(IndexRoute), + router.loadRouteChunk(PostsRoute), + router.loadRouteChunk(PostsRoute.parentRoute), ]) } catch (err) { // Failed to preload route chunk diff --git a/docs/router/guide/ssr.md b/docs/router/guide/ssr.md index 46a0941e7c6..24ab251fa1f 100644 --- a/docs/router/guide/ssr.md +++ b/docs/router/guide/ssr.md @@ -62,7 +62,7 @@ To implement non-streaming SSR with TanStack Router, you will need the following On the client, Router defaults to using an instance of `createBrowserHistory`. On the server, the Router SSR request handler and TanStack Start automatically create a lightweight history containing only the request URL. This history does not keep a navigation stack or respond to `push`, `replace`, `go`, `back`, or `forward` calls. -Server-side calls to `router.navigate()` and `router.commitLocation()` are also no-ops: their promises resolve without changing the request location or running another load. To redirect a request, use the dedicated [redirect API](../api/router/redirectFunction.md), such as `throw redirect({ to: '/login' })` in `beforeLoad` or a loader. +Server-side calls to `router.navigate()` are also no-ops: the promise resolves without changing the request location or running another load. To redirect a request, use the dedicated [redirect API](../api/router/redirectFunction.md), such as `throw redirect({ to: '/login' })` in `beforeLoad` or a loader. ### Automatic Loader Dehydration/Hydration diff --git a/docs/router/how-to/debug-router-issues.md b/docs/router/how-to/debug-router-issues.md index 27dadd361f3..56ea4d8aa19 100644 --- a/docs/router/how-to/debug-router-issues.md +++ b/docs/router/how-to/debug-router-issues.md @@ -109,7 +109,6 @@ const route = createRoute({ ```tsx // Debug route tree in console console.log('Route tree:', router.routeTree) -console.log('All routes:', router.routesById) ``` 3. **Check Parent Route Configuration** @@ -667,9 +666,6 @@ router.getRoute('/users/$userId') // Check if route exists router.buildLocation({ to: '/some-path' }) - -// View all registered routes -Object.keys(router.routesById) ``` ### Network Tab diff --git a/e2e/react-start/dev-ssr-styles/package.json b/e2e/react-start/dev-ssr-styles/package.json index a5300e836eb..b47b64998b4 100644 --- a/e2e/react-start/dev-ssr-styles/package.json +++ b/e2e/react-start/dev-ssr-styles/package.json @@ -11,7 +11,7 @@ "dev:e2e:nitro": "VITE_USE_NITRO=true vite dev --port $PORT", "dev:e2e:disabled:nitro": "SSR_STYLES=disabled VITE_USE_NITRO=true vite dev --port $PORT", "dev:e2e:custom-basepath:nitro": "SSR_STYLES=custom-basepath VITE_USE_NITRO=true vite dev --port $PORT", - "build": "vite build && tsc --noEmit", + "build": "vite build && tsc --noEmit && tsc --noEmit -p tests", "start": "pnpx srvx --prod -s ../client dist/server/server.js", "test:e2e:dev": "MODE=dev playwright test --project=chromium", "test:e2e:dev:disabled": "MODE=dev SSR_STYLES=disabled playwright test --project=chromium", @@ -46,5 +46,15 @@ "typescript": "npm:@typescript/typescript6@^6.0.2", "vite": "^8.0.14", "zod": "^4.4.3" + }, + "nx": { + "targets": { + "build": { + "dependsOn": [ + "^build", + "^compile" + ] + } + } } } diff --git a/e2e/react-start/dev-ssr-styles/tests/tsconfig.json b/e2e/react-start/dev-ssr-styles/tests/tsconfig.json new file mode 100644 index 00000000000..f294c8e39a4 --- /dev/null +++ b/e2e/react-start/dev-ssr-styles/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + // These tests import `DEV_STYLES_ATTR`, which is not in the published + // declarations of @tanstack/router-core. The map selects the internal + // declarations of the workspace packages; it has no effect at runtime. + "extends": ["../tsconfig.json", "../../../../packages/tsconfig.paths.json"], + "compilerOptions": { + "types": ["node"] + }, + "include": ["."], + "exclude": [] +} diff --git a/e2e/react-start/dev-ssr-styles/tsconfig.json b/e2e/react-start/dev-ssr-styles/tsconfig.json index cef9369516a..f90e7decc27 100644 --- a/e2e/react-start/dev-ssr-styles/tsconfig.json +++ b/e2e/react-start/dev-ssr-styles/tsconfig.json @@ -1,5 +1,6 @@ { "include": ["**/*.ts", "**/*.tsx"], + "exclude": ["tests"], "compilerOptions": { "strict": true, "esModuleInterop": true, diff --git a/e2e/react-start/server-functions/src/routes/factory/index.tsx b/e2e/react-start/server-functions/src/routes/factory/index.tsx index f8ef467e681..658d8d2a6e1 100644 --- a/e2e/react-start/server-functions/src/routes/factory/index.tsx +++ b/e2e/react-start/server-functions/src/routes/factory/index.tsx @@ -1,4 +1,5 @@ -import { createFileRoute, deepEqual } from '@tanstack/react-router' +import { createFileRoute } from '@tanstack/react-router' +import { isEqualData } from '~/utils/isEqualData' import React from 'react' import { createServerFn } from '@tanstack/react-start' @@ -189,7 +190,7 @@ function Test({ fn, type, expected }: TestCase) { const [result, setResult] = React.useState(null) function comparison() { if (result) { - const isEqual = deepEqual(result, expected) + const isEqual = isEqualData(result, expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/react-start/server-functions/src/routes/function-method/index.tsx b/e2e/react-start/server-functions/src/routes/function-method/index.tsx index 29a34d97d40..98c1109b615 100644 --- a/e2e/react-start/server-functions/src/routes/function-method/index.tsx +++ b/e2e/react-start/server-functions/src/routes/function-method/index.tsx @@ -1,4 +1,5 @@ -import { Link, createFileRoute, deepEqual } from '@tanstack/react-router' +import { Link, createFileRoute } from '@tanstack/react-router' +import { isEqualData } from '~/utils/isEqualData' import { useState } from 'react' import { getServerFnCallingPost, @@ -56,7 +57,7 @@ function Test({ fn, expected }: TestCase) { const [result, setResult] = useState(null) function comparison() { if (result) { - const isEqual = deepEqual(result, expected) + const isEqual = isEqualData(result, expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/react-start/server-functions/src/utils/isEqualData.ts b/e2e/react-start/server-functions/src/utils/isEqualData.ts new file mode 100644 index 00000000000..d36c825aab0 --- /dev/null +++ b/e2e/react-start/server-functions/src/utils/isEqualData.ts @@ -0,0 +1,27 @@ +/** + * Compares plain data structurally. Key order and keys whose value is + * `undefined` do not matter. + */ +export function isEqualData(a: unknown, b: unknown): boolean { + if (a === b) { + return true + } + if ( + typeof a !== 'object' || + typeof b !== 'object' || + a === null || + b === null || + Array.isArray(a) !== Array.isArray(b) + ) { + return false + } + const left = a as Record + const right = b as Record + const keys = (value: Record) => + Object.keys(value).filter((key) => value[key] !== undefined) + const leftKeys = keys(left) + return ( + leftKeys.length === keys(right).length && + leftKeys.every((key) => isEqualData(left[key], right[key])) + ) +} diff --git a/e2e/react-start/vitest-app/tests/route-files.client.test.ts b/e2e/react-start/vitest-app/tests/route-files.client.test.ts index 5fa2dc48209..c9404715c66 100644 --- a/e2e/react-start/vitest-app/tests/route-files.client.test.ts +++ b/e2e/react-start/vitest-app/tests/route-files.client.test.ts @@ -1,10 +1,14 @@ import { expect, test } from 'vitest' import { Route as HealthRoute } from '../src/routes/api/health' import { Route as PostRoute } from '../src/routes/posts.$postId' +import { routeOptions } from './routeOptions' test('the options that only the server uses are not in client code', () => { - expect(Object.keys(PostRoute.options).sort()).toEqual(['component', 'loader']) - expect(Object.keys(HealthRoute.options)).toEqual([]) + expect(Object.keys(routeOptions(PostRoute)).sort()).toEqual([ + 'component', + 'loader', + ]) + expect(Object.keys(routeOptions(HealthRoute))).toEqual([]) }) test('the module that only server code uses is never loaded', () => { diff --git a/e2e/react-start/vitest-app/tests/route-files.server.test.ts b/e2e/react-start/vitest-app/tests/route-files.server.test.ts index c3b4d601134..d433492f820 100644 --- a/e2e/react-start/vitest-app/tests/route-files.server.test.ts +++ b/e2e/react-start/vitest-app/tests/route-files.server.test.ts @@ -1,9 +1,10 @@ import { expect, test } from 'vitest' import { Route as HealthRoute } from '../src/routes/api/health' import { Route as PostRoute } from '../src/routes/posts.$postId' +import { routeOptions } from './routeOptions' test('the options that only the server uses are in server code', () => { - expect(Object.keys(PostRoute.options).sort()).toEqual([ + expect(Object.keys(routeOptions(PostRoute)).sort()).toEqual([ 'component', 'headers', 'loader', @@ -13,7 +14,7 @@ test('the options that only the server uses are in server code', () => { }) test('a server route handler can be called', async () => { - const { handlers } = (HealthRoute.options as any).server + const { handlers } = routeOptions(HealthRoute).server const response: Response = await handlers.GET({ request: new Request('http://localhost/api/health'), }) diff --git a/e2e/react-start/vitest-app/tests/route-modules.client.test.ts b/e2e/react-start/vitest-app/tests/route-modules.client.test.ts index 22db660d3b6..30480a4de47 100644 --- a/e2e/react-start/vitest-app/tests/route-modules.client.test.ts +++ b/e2e/react-start/vitest-app/tests/route-modules.client.test.ts @@ -1,8 +1,9 @@ import { expect, test } from 'vitest' import { Route } from '../src/embedded/root' +import { routeOptions } from './routeOptions' test('a route module outside the routes directory has no server-only options in client code', () => { - expect(Object.keys(Route.options)).toEqual(['component']) + expect(Object.keys(routeOptions(Route))).toEqual(['component']) }) test('the module that only server code uses is never loaded', () => { diff --git a/e2e/react-start/vitest-app/tests/route-modules.server.test.ts b/e2e/react-start/vitest-app/tests/route-modules.server.test.ts index 231372b0fb8..b17980e9898 100644 --- a/e2e/react-start/vitest-app/tests/route-modules.server.test.ts +++ b/e2e/react-start/vitest-app/tests/route-modules.server.test.ts @@ -1,8 +1,9 @@ import { expect, test } from 'vitest' import { Route } from '../src/embedded/root' +import { routeOptions } from './routeOptions' test('a route module outside the routes directory keeps its server-only options in server code', () => { - expect(Object.keys(Route.options).sort()).toEqual([ + expect(Object.keys(routeOptions(Route)).sort()).toEqual([ 'component', 'headers', 'server', diff --git a/e2e/react-start/vitest-app/tests/routeOptions.ts b/e2e/react-start/vitest-app/tests/routeOptions.ts new file mode 100644 index 00000000000..0ddeb3b2f4c --- /dev/null +++ b/e2e/react-start/vitest-app/tests/routeOptions.ts @@ -0,0 +1,8 @@ +/** + * Reads the options a route object was created with. `options` is not part of + * a route's public type; these tests read it to see which options the Start + * compiler kept in each build. + */ +export function routeOptions(route: object): Record { + return (route as { options: Record }).options +} diff --git a/e2e/solid-start/dev-ssr-styles/package.json b/e2e/solid-start/dev-ssr-styles/package.json index 6ca79c15c6d..bffc18749fb 100644 --- a/e2e/solid-start/dev-ssr-styles/package.json +++ b/e2e/solid-start/dev-ssr-styles/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite dev --port 3000", "dev:e2e": "vite dev --port 0", - "build": "vite build && tsc --noEmit", + "build": "vite build && tsc --noEmit && tsc --noEmit -p tests", "start": "pnpx srvx --prod -s ../client dist/server/server.js", "test:e2e:dev": "MODE=dev playwright test --project=chromium", "test:e2e": "pnpm run test:e2e:dev && pnpm run test:e2e:dev:bundled-dev", @@ -27,5 +27,15 @@ "vite": "^8.0.14", "vite-plugin-solid": "^2.11.11", "@typescript/native": "npm:typescript@^7.0.2" + }, + "nx": { + "targets": { + "build": { + "dependsOn": [ + "^build", + "^compile" + ] + } + } } } diff --git a/e2e/solid-start/dev-ssr-styles/tests/tsconfig.json b/e2e/solid-start/dev-ssr-styles/tests/tsconfig.json new file mode 100644 index 00000000000..f294c8e39a4 --- /dev/null +++ b/e2e/solid-start/dev-ssr-styles/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + // These tests import `DEV_STYLES_ATTR`, which is not in the published + // declarations of @tanstack/router-core. The map selects the internal + // declarations of the workspace packages; it has no effect at runtime. + "extends": ["../tsconfig.json", "../../../../packages/tsconfig.paths.json"], + "compilerOptions": { + "types": ["node"] + }, + "include": ["."], + "exclude": [] +} diff --git a/e2e/solid-start/dev-ssr-styles/tsconfig.json b/e2e/solid-start/dev-ssr-styles/tsconfig.json index c34f9d7c361..165346b7457 100644 --- a/e2e/solid-start/dev-ssr-styles/tsconfig.json +++ b/e2e/solid-start/dev-ssr-styles/tsconfig.json @@ -1,5 +1,6 @@ { "include": ["**/*.ts", "**/*.tsx"], + "exclude": ["tests"], "compilerOptions": { "strict": true, "esModuleInterop": true, diff --git a/e2e/solid-start/server-functions/src/routes/factory/index.tsx b/e2e/solid-start/server-functions/src/routes/factory/index.tsx index b637f4f91b8..b8dde063d45 100644 --- a/e2e/solid-start/server-functions/src/routes/factory/index.tsx +++ b/e2e/solid-start/server-functions/src/routes/factory/index.tsx @@ -1,4 +1,5 @@ -import { createFileRoute, deepEqual } from '@tanstack/solid-router' +import { createFileRoute } from '@tanstack/solid-router' +import { isEqualData } from '~/utils/isEqualData' import { createSignal, For } from 'solid-js' import { createServerFn } from '@tanstack/solid-start' @@ -153,7 +154,7 @@ function Test(props: TestCase) { const [result, setResult] = createSignal(null) function comparison() { if (result()) { - const isEqual = deepEqual(result(), props.expected) + const isEqual = isEqualData(result(), props.expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/solid-start/server-functions/src/routes/function-method/index.tsx b/e2e/solid-start/server-functions/src/routes/function-method/index.tsx index 801e6e3083e..2d5c6fe6e67 100644 --- a/e2e/solid-start/server-functions/src/routes/function-method/index.tsx +++ b/e2e/solid-start/server-functions/src/routes/function-method/index.tsx @@ -1,5 +1,6 @@ import { For, createSignal } from 'solid-js' -import { Link, createFileRoute, deepEqual } from '@tanstack/solid-router' +import { Link, createFileRoute } from '@tanstack/solid-router' +import { isEqualData } from '~/utils/isEqualData' import { getServerFnCallingPost, postServerFnCallingGet, @@ -56,7 +57,7 @@ function Test({ fn, expected }: TestCase) { const [result, setResult] = createSignal(null) function comparison() { if (result()) { - const isEqual = deepEqual(result(), expected) + const isEqual = isEqualData(result(), expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/solid-start/server-functions/src/utils/isEqualData.ts b/e2e/solid-start/server-functions/src/utils/isEqualData.ts new file mode 100644 index 00000000000..d36c825aab0 --- /dev/null +++ b/e2e/solid-start/server-functions/src/utils/isEqualData.ts @@ -0,0 +1,27 @@ +/** + * Compares plain data structurally. Key order and keys whose value is + * `undefined` do not matter. + */ +export function isEqualData(a: unknown, b: unknown): boolean { + if (a === b) { + return true + } + if ( + typeof a !== 'object' || + typeof b !== 'object' || + a === null || + b === null || + Array.isArray(a) !== Array.isArray(b) + ) { + return false + } + const left = a as Record + const right = b as Record + const keys = (value: Record) => + Object.keys(value).filter((key) => value[key] !== undefined) + const leftKeys = keys(left) + return ( + leftKeys.length === keys(right).length && + leftKeys.every((key) => isEqualData(left[key], right[key])) + ) +} diff --git a/e2e/vue-start/dev-ssr-styles/package.json b/e2e/vue-start/dev-ssr-styles/package.json index 0033a0a5cc7..36a168cf72c 100644 --- a/e2e/vue-start/dev-ssr-styles/package.json +++ b/e2e/vue-start/dev-ssr-styles/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite dev --port 3000", "dev:e2e": "vite dev --port 0", - "build": "vite build && tsc --noEmit", + "build": "vite build && tsc --noEmit && tsc --noEmit -p tests", "start": "pnpx srvx --prod -s ../client dist/server/server.js", "test:e2e:dev": "MODE=dev playwright test --project=chromium", "test:e2e": "pnpm run test:e2e:dev && pnpm run test:e2e:dev:bundled-dev", @@ -28,5 +28,15 @@ "typescript": "npm:@typescript/typescript6@^6.0.2", "vite": "^8.0.14", "@typescript/native": "npm:typescript@^7.0.2" + }, + "nx": { + "targets": { + "build": { + "dependsOn": [ + "^build", + "^compile" + ] + } + } } } diff --git a/e2e/vue-start/dev-ssr-styles/tests/tsconfig.json b/e2e/vue-start/dev-ssr-styles/tests/tsconfig.json new file mode 100644 index 00000000000..f294c8e39a4 --- /dev/null +++ b/e2e/vue-start/dev-ssr-styles/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + // These tests import `DEV_STYLES_ATTR`, which is not in the published + // declarations of @tanstack/router-core. The map selects the internal + // declarations of the workspace packages; it has no effect at runtime. + "extends": ["../tsconfig.json", "../../../../packages/tsconfig.paths.json"], + "compilerOptions": { + "types": ["node"] + }, + "include": ["."], + "exclude": [] +} diff --git a/e2e/vue-start/dev-ssr-styles/tsconfig.json b/e2e/vue-start/dev-ssr-styles/tsconfig.json index 898ea214b19..a9d7f003153 100644 --- a/e2e/vue-start/dev-ssr-styles/tsconfig.json +++ b/e2e/vue-start/dev-ssr-styles/tsconfig.json @@ -1,5 +1,6 @@ { "include": ["**/*.ts", "**/*.tsx", "**/*.vue"], + "exclude": ["tests"], "compilerOptions": { "strict": true, "esModuleInterop": true, diff --git a/e2e/vue-start/server-functions/src/routes/factory/index.tsx b/e2e/vue-start/server-functions/src/routes/factory/index.tsx index c02bb1338ef..54caf9859b2 100644 --- a/e2e/vue-start/server-functions/src/routes/factory/index.tsx +++ b/e2e/vue-start/server-functions/src/routes/factory/index.tsx @@ -1,4 +1,5 @@ -import { createFileRoute, deepEqual } from '@tanstack/vue-router' +import { createFileRoute } from '@tanstack/vue-router' +import { isEqualData } from '~/utils/isEqualData' import { createServerFn } from '@tanstack/vue-start' import { fooFnInsideFactoryFile } from './-functions/createFooServerFn' @@ -164,7 +165,7 @@ const Test = defineComponent({ const result = ref(null) const comparison = computed(() => { if (result.value) { - const isEqual = deepEqual(result.value, props.expected) + const isEqual = isEqualData(result.value, props.expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/vue-start/server-functions/src/routes/function-method/index.tsx b/e2e/vue-start/server-functions/src/routes/function-method/index.tsx index a4cb3951d53..efeff2da779 100644 --- a/e2e/vue-start/server-functions/src/routes/function-method/index.tsx +++ b/e2e/vue-start/server-functions/src/routes/function-method/index.tsx @@ -1,4 +1,5 @@ -import { Link, createFileRoute, deepEqual } from '@tanstack/vue-router' +import { Link, createFileRoute } from '@tanstack/vue-router' +import { isEqualData } from '~/utils/isEqualData' import { computed, defineComponent, ref } from 'vue' import { getServerFnCallingPost, @@ -48,7 +49,7 @@ const Test = defineComponent({ const result = ref(null) const comparison = computed(() => { if (result.value) { - const isEqual = deepEqual(result.value, props.expected) + const isEqual = isEqualData(result.value, props.expected) return isEqual ? 'equal' : 'not equal' } return 'Loading...' diff --git a/e2e/vue-start/server-functions/src/utils/isEqualData.ts b/e2e/vue-start/server-functions/src/utils/isEqualData.ts new file mode 100644 index 00000000000..d36c825aab0 --- /dev/null +++ b/e2e/vue-start/server-functions/src/utils/isEqualData.ts @@ -0,0 +1,27 @@ +/** + * Compares plain data structurally. Key order and keys whose value is + * `undefined` do not matter. + */ +export function isEqualData(a: unknown, b: unknown): boolean { + if (a === b) { + return true + } + if ( + typeof a !== 'object' || + typeof b !== 'object' || + a === null || + b === null || + Array.isArray(a) !== Array.isArray(b) + ) { + return false + } + const left = a as Record + const right = b as Record + const keys = (value: Record) => + Object.keys(value).filter((key) => value[key] !== undefined) + const leftKeys = keys(left) + return ( + leftKeys.length === keys(right).length && + leftKeys.every((key) => isEqualData(left[key], right[key])) + ) +} diff --git a/packages/history/api/index.api.md b/packages/history/api/index.api.md index 5d1ac0226c0..9c811decb36 100644 --- a/packages/history/api/index.api.md +++ b/packages/history/api/index.api.md @@ -34,24 +34,6 @@ export function createHashHistory(opts?: { window?: any; }): RouterHistory; -// @public (undocumented) -export function createHistory(opts: { - getLocation: () => HistoryLocation; - getLength: () => number; - pushState: (path: string, state: any) => void; - replaceState: (path: string, state: any) => void; - go: (n: number, ignoreBlocker: boolean) => void; - back: (ignoreBlocker: boolean) => void; - forward: (ignoreBlocker: boolean) => void; - createHref: (path: string) => string; - flush?: () => void; - destroy?: () => void; - onBlocked?: () => void; - getBlockers?: () => Array; - setBlockers?: (blockers: Array) => void; - notifyOnIndexChange?: boolean; -}): RouterHistory; - // @public export function createMemoryHistory(opts?: { initialEntries: Array; @@ -80,15 +62,6 @@ export interface NavigateOptions { ignoreBlocker?: boolean; } -// @public (undocumented) -export type NavigationBlocker = { - blockerFn: BlockerFn; - enableBeforeUnload?: (() => boolean) | boolean; -}; - -// @public (undocumented) -export function normalizeProtocolRelative(url: string): string; - // @public (undocumented) export type ParsedHistoryState = HistoryState & { key?: string; @@ -108,51 +81,20 @@ export interface ParsedPath { search: string; } -// @public (undocumented) -export function parseHref(href: string, state: ParsedHistoryState | undefined): HistoryLocation; - // @public (undocumented) export interface RouterHistory { // (undocumented) back: (navigateOpts?: NavigateOptions) => void; // (undocumented) - block: (blocker: NavigationBlocker) => () => void; - // (undocumented) - canGoBack: () => boolean; - // (undocumented) - createHref: (href: string) => string; - // (undocumented) destroy: () => void; // (undocumented) - flush: () => void; - // (undocumented) forward: (navigateOpts?: NavigateOptions) => void; // (undocumented) - _getBlockers: () => Array; - // (undocumented) go: (index: number, navigateOpts?: NavigateOptions) => void; // (undocumented) - _ignoreNextBeforeUnload?: (href: string) => void; - // (undocumented) - _ignoreSubscribers?: boolean; - // (undocumented) - length: number; - // (undocumented) - location: HistoryLocation; - // Warning: (ae-forgotten-export) The symbol "SubscriberHistoryAction" needs to be exported by the entry point index.d.ts - // - // (undocumented) - notify: (action: SubscriberHistoryAction) => void; - // (undocumented) push: (path: string, state?: any, navigateOpts?: NavigateOptions) => void; // (undocumented) replace: (path: string, state?: any, navigateOpts?: NavigateOptions) => void; - // (undocumented) - subscribe: (cb: (opts: SubscriberArgs) => void) => () => void; - // Warning: (ae-forgotten-export) The symbol "SubscriberArgs" needs to be exported by the entry point index.d.ts - // - // (undocumented) - subscribers: Set<(opts: SubscriberArgs) => void>; } // (No @packageDocumentation comment for this package) diff --git a/packages/history/src/index.ts b/packages/history/src/index.ts index d2f80581b9a..562329e1f28 100644 --- a/packages/history/src/index.ts +++ b/packages/history/src/index.ts @@ -21,23 +21,35 @@ type SubscriberArgs = { } export interface RouterHistory { + /** @internal */ location: HistoryLocation + /** @internal */ length: number + /** @internal */ subscribers: Set<(opts: SubscriberArgs) => void> + /** @internal */ subscribe: (cb: (opts: SubscriberArgs) => void) => () => void push: (path: string, state?: any, navigateOpts?: NavigateOptions) => void replace: (path: string, state?: any, navigateOpts?: NavigateOptions) => void go: (index: number, navigateOpts?: NavigateOptions) => void back: (navigateOpts?: NavigateOptions) => void forward: (navigateOpts?: NavigateOptions) => void + /** @internal */ canGoBack: () => boolean + /** @internal */ createHref: (href: string) => string + /** @internal */ block: (blocker: NavigationBlocker) => () => void + /** @internal */ flush: () => void destroy: () => void + /** @internal */ notify: (action: SubscriberHistoryAction) => void + /** @internal */ _getBlockers: () => Array + /** @internal */ _ignoreSubscribers?: boolean + /** @internal */ _ignoreNextBeforeUnload?: (href: string) => void } @@ -74,6 +86,7 @@ export type BlockerFn = ( args: BlockerFnArgs, ) => Promise | ShouldAllowNavigation +/** @internal */ export type NavigationBlocker = { blockerFn: BlockerFn enableBeforeUnload?: (() => boolean) | boolean @@ -110,6 +123,7 @@ const beforeUnloadEvent = 'beforeunload' // eslint-disable-next-line no-control-regex const protocolRelativePrefix = /^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/ +// @internal export function normalizeProtocolRelative(url: string): string { const match = protocolRelativePrefix.exec(url) return match ? '/' + url.slice(match[0].length) : url @@ -126,6 +140,7 @@ function normalizeHref(href: string): string { return normalizeProtocolRelative(href) } +// @internal export function createHistory(opts: { getLocation: () => HistoryLocation getLength: () => number @@ -736,6 +751,7 @@ export function createServerHistory(href: string): RouterHistory { return new ServerHistory(parseHref(href, undefined)) } +// @internal export function parseHref( href: string, state: ParsedHistoryState | undefined, diff --git a/packages/react-router/api/index.api.md b/packages/react-router/api/index.api.md index 4c4726b77c5..99c4517eaf5 100644 --- a/packages/react-router/api/index.api.md +++ b/packages/react-router/api/index.api.md @@ -18,13 +18,10 @@ import { AnyRedirect } from '@tanstack/router-core'; import { AnyRoute } from '@tanstack/router-core'; import { AnyRouteMatch } from '@tanstack/router-core'; import { AnyRouter } from '@tanstack/router-core'; -import { AnyRouterWithContext } from '@tanstack/router-core'; -import { AnyRouteWithContext } from '@tanstack/router-core'; import { AnySchema } from '@tanstack/router-core'; import { AnySerializationAdapter } from '@tanstack/router-core'; import { AnyValidator } from '@tanstack/router-core'; import { AnyValidatorAdapter } from '@tanstack/router-core'; -import { AnyValidatorFn } from '@tanstack/router-core'; import { AnyValidatorObj } from '@tanstack/router-core'; import { AssetCrossOriginConfig } from '@tanstack/router-core'; import { Assign } from '@tanstack/router-core'; @@ -37,27 +34,18 @@ import { BeforeLoadContextParameter } from '@tanstack/router-core'; import { BlockerFn } from '@tanstack/history'; import { BuildLocationFn } from '@tanstack/router-core'; import { BuildNextOptions } from '@tanstack/router-core'; -import { cleanPath } from '@tanstack/router-core'; -import { CommitLocationOptions } from '@tanstack/router-core'; import { composeRewrites } from '@tanstack/router-core'; import { Constrain } from '@tanstack/router-core'; import { ConstrainLiteral } from '@tanstack/router-core'; import { ContextAsyncReturnType } from '@tanstack/router-core'; import { ContextOptions } from '@tanstack/router-core'; import { ContextReturnType } from '@tanstack/router-core'; -import { ControllablePromise } from '@tanstack/router-core'; -import { ControlledPromise } from '@tanstack/router-core'; import { createBrowserHistory } from '@tanstack/history'; -import { createControlledPromise } from '@tanstack/router-core'; import { CreateFileRoute } from '@tanstack/router-core'; import { createHashHistory } from '@tanstack/history'; -import { createHistory } from '@tanstack/history'; -import { CreateLazyFileRoute } from '@tanstack/router-core'; import { createMemoryHistory } from '@tanstack/history'; -import { createRouterConfig } from '@tanstack/router-core'; import { CreateRouterFn } from '@tanstack/router-core'; import { createSerializationAdapter } from '@tanstack/router-core'; -import { deepEqual } from '@tanstack/router-core'; import { DeepPartial } from '@tanstack/router-core'; import { default as default_2 } from 'react'; import { DEFAULT_PROTOCOL_ALLOWLIST } from '@tanstack/router-core'; @@ -69,14 +57,12 @@ import { DeferredPromise } from '@tanstack/router-core'; import { DeferredPromiseState } from '@tanstack/router-core'; import { ErrorComponentProps } from '@tanstack/router-core'; import { ErrorInfo } from 'react'; -import { ErrorRouteProps } from '@tanstack/router-core'; import { Expand } from '@tanstack/router-core'; import { FileBaseRouteOptions } from '@tanstack/router-core'; import { FileRoutesByPath } from '@tanstack/router-core'; import { FileRouteTypes } from '@tanstack/router-core'; import { FromPathOption } from '@tanstack/router-core'; import { FullSearchSchemaOption } from '@tanstack/router-core'; -import { functionalUpdate } from '@tanstack/router-core'; import { HistoryAction } from '@tanstack/history'; import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; @@ -92,12 +78,10 @@ import { InferSelected } from '@tanstack/router-core'; import { InferShouldThrow } from '@tanstack/router-core'; import { InferStrict } from '@tanstack/router-core'; import { InferTo } from '@tanstack/router-core'; -import { interpolatePath } from '@tanstack/router-core'; import { IntersectAssign } from '@tanstack/router-core'; import { isMatch } from '@tanstack/router-core'; import { isNotFound } from '@tanstack/router-core'; import { isRedirect } from '@tanstack/router-core'; -import { joinPaths } from '@tanstack/router-core'; import { JSX } from 'react/jsx-runtime'; import { lazyFn } from '@tanstack/router-core'; import { LazyRouteOptions } from '@tanstack/router-core'; @@ -115,10 +99,7 @@ import { MakeRouteMatch } from '@tanstack/router-core'; import { MakeRouteMatchUnion } from '@tanstack/router-core'; import { Manifest } from '@tanstack/router-core'; import { MaskOptions } from '@tanstack/router-core'; -import { MatchLocation } from '@tanstack/router-core'; import { MatchRouteOptions } from '@tanstack/router-core'; -import { MergeAll } from '@tanstack/router-core'; -import { MetaDescriptor } from '@tanstack/router-core'; import { NavigateFn } from '@tanstack/router-core'; import { NavigateOptions } from '@tanstack/router-core'; import { notFound } from '@tanstack/router-core'; @@ -132,7 +113,6 @@ import { ParseParamsFn } from '@tanstack/router-core'; import { ParseRoute } from '@tanstack/router-core'; import { parseSearchWith } from '@tanstack/router-core'; import { PathParamOptions } from '@tanstack/router-core'; -import { PreloadableObj } from '@tanstack/router-core'; import * as React_2 from 'react'; import { ReactNode } from 'react'; import { Redirect } from '@tanstack/router-core'; @@ -148,10 +128,8 @@ import { RelativeToPathAutoComplete } from '@tanstack/router-core'; import { RemountDepsOptions } from '@tanstack/router-core'; import { RemoveLeadingSlashes } from '@tanstack/router-core'; import { RemoveTrailingSlashes } from '@tanstack/router-core'; -import { replaceEqualDeep } from '@tanstack/router-core'; import { ResolveAllContext } from '@tanstack/router-core'; import { ResolveAllParamsFromParent } from '@tanstack/router-core'; -import { ResolvedRedirect } from '@tanstack/router-core'; import { ResolveFullPath } from '@tanstack/router-core'; import { ResolveFullSearchSchema } from '@tanstack/router-core'; import { ResolveFullSearchSchemaInput } from '@tanstack/router-core'; @@ -159,7 +137,6 @@ import { ResolveId } from '@tanstack/router-core'; import { ResolveLoaderData } from '@tanstack/router-core'; import { ResolveOptionalParams } from '@tanstack/router-core'; import { ResolveParams } from '@tanstack/router-core'; -import { resolvePath } from '@tanstack/router-core'; import { ResolveRelativePath } from '@tanstack/router-core'; import { ResolveRequiredParams } from '@tanstack/router-core'; import { ResolveRoute } from '@tanstack/router-core'; @@ -183,18 +160,14 @@ import { Route as Route_2 } from '@tanstack/router-core'; import { RouteById } from '@tanstack/router-core'; import { RouteConstraints } from '@tanstack/router-core'; import { RouteContext } from '@tanstack/router-core'; -import { RouteContextFn } from '@tanstack/router-core'; import { RouteContextOptions } from '@tanstack/router-core'; import { RouteContextParameter } from '@tanstack/router-core'; import { RouteIds } from '@tanstack/router-core'; -import { RouteLinkEntry } from '@tanstack/router-core'; -import { RouteLoaderEntry } from '@tanstack/router-core'; import { RouteLoaderFn } from '@tanstack/router-core'; import { RouteMask } from '@tanstack/router-core'; import { RouteMatch } from '@tanstack/router-core'; import { RouteOptions } from '@tanstack/router-core'; import { RoutePathOptions } from '@tanstack/router-core'; -import { RoutePathOptionsIntersection } from '@tanstack/router-core'; import { RoutePaths } from '@tanstack/router-core'; import { RouterConstructorOptions } from '@tanstack/router-core'; import { RouterContextOptions } from '@tanstack/router-core'; @@ -202,7 +175,6 @@ import { RouterCore } from '@tanstack/router-core'; import { RouterEvent } from '@tanstack/router-core'; import { RouterEvents } from '@tanstack/router-core'; import { RouterHistory } from '@tanstack/history'; -import { RouterListener } from '@tanstack/router-core'; import { RouterManagedTag } from '@tanstack/router-core'; import { RouterOptions } from '@tanstack/router-core'; import { RouterState } from '@tanstack/router-core'; @@ -234,11 +206,8 @@ import { ToSubOptions } from '@tanstack/router-core'; import { ToSubOptionsProps } from '@tanstack/router-core'; import { TrailingSlashOption } from '@tanstack/router-core'; import { TrimPath } from '@tanstack/router-core'; -import { trimPath } from '@tanstack/router-core'; import { TrimPathLeft } from '@tanstack/router-core'; -import { trimPathLeft } from '@tanstack/router-core'; import { TrimPathRight } from '@tanstack/router-core'; -import { trimPathRight } from '@tanstack/router-core'; import { UpdatableRouteOptions } from '@tanstack/router-core'; import { UpdatableStaticRouteOption } from '@tanstack/router-core'; import { UseLoaderDataResult } from '@tanstack/router-core'; @@ -250,17 +219,9 @@ import { UseRouteContextOptions } from '@tanstack/router-core'; import { UseRouteContextResult } from '@tanstack/router-core'; import { UseSearchResult } from '@tanstack/router-core'; import { ValidateFromPath } from '@tanstack/router-core'; -import { ValidateId } from '@tanstack/router-core'; import { ValidateJSON } from '@tanstack/router-core'; import { ValidateNavigateOptions } from '@tanstack/router-core'; -import { ValidateNavigateOptionsArray } from '@tanstack/router-core'; -import { ValidateParams } from '@tanstack/router-core'; import { ValidateRedirectOptions } from '@tanstack/router-core'; -import { ValidateRedirectOptionsArray } from '@tanstack/router-core'; -import { ValidateSearch } from '@tanstack/router-core'; -import { ValidateToPath } from '@tanstack/router-core'; -import { ValidateUseParamsResult } from '@tanstack/router-core'; -import { ValidateUseSearchResult } from '@tanstack/router-core'; import { Validator } from '@tanstack/router-core'; import { ValidatorAdapter } from '@tanstack/router-core'; import { ValidatorFn } from '@tanstack/router-core'; @@ -290,10 +251,6 @@ export { AnyRouteMatch } export { AnyRouter } -export { AnyRouterWithContext } - -export { AnyRouteWithContext } - export { AnySchema } export { AnySerializationAdapter } @@ -302,16 +259,8 @@ export { AnyValidator } export { AnyValidatorAdapter } -export { AnyValidatorFn } - export { AnyValidatorObj } -// @public (undocumented) -export function Asset(asset: RouterManagedTag & { - nonce?: string; - preventScriptHoist?: boolean; -}): React_2.ReactElement | null; - export { Assign } // @public (undocumented) @@ -396,15 +345,11 @@ export function CatchNotFound(props: { children: React_2.ReactNode; }): JSX.Element; -export { cleanPath } - // Warning: (ae-forgotten-export) The symbol "ClientOnlyProps" needs to be exported by the entry point index.d.ts // // @public export function ClientOnly(input: ClientOnlyProps): JSX.Element; -export { CommitLocationOptions } - export { composeRewrites } export { Constrain } @@ -415,14 +360,8 @@ export { ContextOptions } export { ContextReturnType } -export { ControllablePromise } - -export { ControlledPromise } - export { createBrowserHistory } -export { createControlledPromise } - export { CreateFileRoute } // @public @@ -430,10 +369,6 @@ export function createFileRoute(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute; @@ -465,12 +400,8 @@ export function createRouteMask; -export { ErrorRouteProps } - export { Expand } export { FileBaseRouteOptions } @@ -519,21 +448,14 @@ export class FileRoute, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, const TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions & UpdatableRouteOptions) => Route_2; // (undocumented) path?: TFilePath | undefined; - // (undocumented) - silent?: boolean; } -// @public @deprecated (undocumented) -export function FileRouteLoader(_path: TFilePath): (loaderFn: Constrain>) => TLoaderFn; - export { FileRoutesByPath } export { FileRouteTypes } export { FullSearchSchemaOption } -export { functionalUpdate } - // @public export function getRouteApi(id: ConstrainLiteral>): RouteApi; @@ -568,15 +490,8 @@ export { InferShouldThrow } export { InferStrict } -// @public (undocumented) -export type InferStructuralSharing = TOptions extends { - structuralSharing: infer TStructuralSharing; -} ? TStructuralSharing : unknown; - export { InferTo } -export { interpolatePath } - export { IntersectAssign } export { isMatch } @@ -585,8 +500,6 @@ export { isNotFound } export { isRedirect } -export { joinPaths } - export { lazyFn } // @public (undocumented) @@ -681,25 +594,11 @@ export { MakeRouteMatchUnion } export { Manifest } -// @public (undocumented) -export const Match: React_2.MemoExoticComponent<(input: { - routeId: string; -}) => JSX.Element>; - -// @public -export function Matches(): JSX.Element; - -export { MatchLocation } - // @public export function MatchRoute(props: MakeMatchRouteOptions): any; export { MatchRouteOptions } -export { MergeAll } - -export { MetaDescriptor } - // @public export function Navigate(props: NavigateOptions): null; @@ -736,11 +635,6 @@ export { parseSearchWith } export { PathParamOptions } -export { PreloadableObj } - -// @public -export const reactUse: ((usable: Promise | React_2.Context) => T) | undefined; - export { Redirect } export { redirect } @@ -767,14 +661,10 @@ export { RemoveLeadingSlashes } export { RemoveTrailingSlashes } -export { replaceEqualDeep } - export { ResolveAllContext } export { ResolveAllParamsFromParent } -export { ResolvedRedirect } - export { ResolveFullPath } export { ResolveFullSearchSchema } @@ -789,8 +679,6 @@ export { ResolveOptionalParams } export { ResolveParams } -export { resolvePath } - export { ResolveRelativePath } export { ResolveRequiredParams } @@ -903,16 +791,12 @@ export { RouteConstraints } export { RouteContext } -export { RouteContextFn } - export { RouteContextOptions } export { RouteContextParameter } export { RouteIds } -export { RouteLinkEntry } - export { RouteLoaderFn } export { RouteMask } @@ -923,8 +807,6 @@ export { RouteOptions } export { RoutePathOptions } -export { RoutePathOptionsIntersection } - // @public (undocumented) export class Router = Record> extends RouterCore { constructor(options: RouterConstructorOptions); @@ -934,19 +816,12 @@ export { RouterConstructorOptions } export { RouterContextOptions } -// @public -export function RouterContextProvider = Record>(input: RouterProps & { - children: React_2.ReactNode; -}): JSX.Element; - export { RouterEvent } export { RouterEvents } export { RouterHistory } -export { RouterListener } - export { RouterManagedTag } export { RouterOptions } @@ -1025,16 +900,10 @@ export { TrailingSlashOption } export { TrimPath } -export { trimPath } - export { TrimPathLeft } -export { trimPathLeft } - export { TrimPathRight } -export { trimPathRight } - export { UpdatableRouteOptions } export { UpdatableStaticRouteOption } @@ -1089,9 +958,6 @@ export function useElementScrollRestoration(options: ({ // @public export function useHydrated(): boolean; -// @public (undocumented) -export const useLayoutEffect: typeof React_2.useEffect; - // @public export function useLinkProps(options: UseLinkPropsOptions, forwardedRef?: React_2.ForwardedRef): React_2.ComponentPropsWithRef<'a'>; @@ -1165,13 +1031,8 @@ export function useRouterState(opts: UseSearchOptions, TSelected, TStructuralSharing>): ThrowOrOptional, TThrow>; -// @public -export const useTags: (assetCrossOrigin?: AssetCrossOriginConfig) => RouterManagedTag[]; - export { ValidateFromPath } -export { ValidateId } - // @public (undocumented) export type ValidateLinkOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; @@ -1182,28 +1043,8 @@ export type ValidateLinkOptionsArray = Constrain, InferStrict, InferShouldThrow, InferSelected, InferSelected>>; - -export { ValidateUseParamsResult } - -// @public (undocumented) -export type ValidateUseSearchOptions = Constrain, InferStrict, InferShouldThrow, InferSelected, InferStructuralSharing>>; - -export { ValidateUseSearchResult } - export { Validator } export { ValidatorAdapter } @@ -1227,18 +1068,12 @@ declare module "@tanstack/history" { interface HistoryState { __tempLocation?: HistoryLocation; __tempKey?: string; - __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions; } } // Matches.d.ts declare module "@tanstack/router-core" { interface RouteMatchExtensions { - meta?: Array; - links?: Array; - scripts?: Array; - styles?: Array; - headScripts?: Array; } } diff --git a/packages/react-router/api/index.rsc.api.md b/packages/react-router/api/index.rsc.api.md index f2d0f4945c2..cb63465d971 100644 --- a/packages/react-router/api/index.rsc.api.md +++ b/packages/react-router/api/index.rsc.api.md @@ -18,13 +18,10 @@ import { AnyRedirect } from '@tanstack/router-core'; import { AnyRoute } from '@tanstack/router-core'; import { AnyRouteMatch } from '@tanstack/router-core'; import { AnyRouter } from '@tanstack/router-core'; -import { AnyRouterWithContext } from '@tanstack/router-core'; -import { AnyRouteWithContext } from '@tanstack/router-core'; import { AnySchema } from '@tanstack/router-core'; import { AnySerializationAdapter } from '@tanstack/router-core'; import { AnyValidator } from '@tanstack/router-core'; import { AnyValidatorAdapter } from '@tanstack/router-core'; -import { AnyValidatorFn } from '@tanstack/router-core'; import { AnyValidatorObj } from '@tanstack/router-core'; import { AssetCrossOriginConfig } from '@tanstack/router-core'; import { Assign } from '@tanstack/router-core'; @@ -37,27 +34,18 @@ import { BeforeLoadContextParameter } from '@tanstack/router-core'; import { BlockerFn } from '@tanstack/history'; import { BuildLocationFn } from '@tanstack/router-core'; import { BuildNextOptions } from '@tanstack/router-core'; -import { cleanPath } from '@tanstack/router-core'; -import { CommitLocationOptions } from '@tanstack/router-core'; import { composeRewrites } from '@tanstack/router-core'; import { Constrain } from '@tanstack/router-core'; import { ConstrainLiteral } from '@tanstack/router-core'; import { ContextAsyncReturnType } from '@tanstack/router-core'; import { ContextOptions } from '@tanstack/router-core'; import { ContextReturnType } from '@tanstack/router-core'; -import { ControllablePromise } from '@tanstack/router-core'; -import { ControlledPromise } from '@tanstack/router-core'; import { createBrowserHistory } from '@tanstack/history'; -import { createControlledPromise } from '@tanstack/router-core'; import { CreateFileRoute } from '@tanstack/router-core'; import { createHashHistory } from '@tanstack/history'; -import { createHistory } from '@tanstack/history'; -import { CreateLazyFileRoute } from '@tanstack/router-core'; import { createMemoryHistory } from '@tanstack/history'; -import { createRouterConfig } from '@tanstack/router-core'; import { CreateRouterFn } from '@tanstack/router-core'; import { createSerializationAdapter } from '@tanstack/router-core'; -import { deepEqual } from '@tanstack/router-core'; import { DeepPartial } from '@tanstack/router-core'; import { default as default_2 } from 'react'; import { DEFAULT_PROTOCOL_ALLOWLIST } from '@tanstack/router-core'; @@ -69,14 +57,12 @@ import { DeferredPromise } from '@tanstack/router-core'; import { DeferredPromiseState } from '@tanstack/router-core'; import { ErrorComponentProps } from '@tanstack/router-core'; import { ErrorInfo } from 'react'; -import { ErrorRouteProps } from '@tanstack/router-core'; import { Expand } from '@tanstack/router-core'; import { FileBaseRouteOptions } from '@tanstack/router-core'; import { FileRoutesByPath } from '@tanstack/router-core'; import { FileRouteTypes } from '@tanstack/router-core'; import { FromPathOption } from '@tanstack/router-core'; import { FullSearchSchemaOption } from '@tanstack/router-core'; -import { functionalUpdate } from '@tanstack/router-core'; import { HistoryAction } from '@tanstack/history'; import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; @@ -92,12 +78,10 @@ import { InferSelected } from '@tanstack/router-core'; import { InferShouldThrow } from '@tanstack/router-core'; import { InferStrict } from '@tanstack/router-core'; import { InferTo } from '@tanstack/router-core'; -import { interpolatePath } from '@tanstack/router-core'; import { IntersectAssign } from '@tanstack/router-core'; import { isMatch } from '@tanstack/router-core'; import { isNotFound } from '@tanstack/router-core'; import { isRedirect } from '@tanstack/router-core'; -import { joinPaths } from '@tanstack/router-core'; import { JSX } from 'react/jsx-runtime'; import { lazyFn } from '@tanstack/router-core'; import { LazyRouteOptions } from '@tanstack/router-core'; @@ -115,10 +99,7 @@ import { MakeRouteMatch } from '@tanstack/router-core'; import { MakeRouteMatchUnion } from '@tanstack/router-core'; import { Manifest } from '@tanstack/router-core'; import { MaskOptions } from '@tanstack/router-core'; -import { MatchLocation } from '@tanstack/router-core'; import { MatchRouteOptions } from '@tanstack/router-core'; -import { MergeAll } from '@tanstack/router-core'; -import { MetaDescriptor } from '@tanstack/router-core'; import { NavigateFn } from '@tanstack/router-core'; import { NavigateOptions } from '@tanstack/router-core'; import { notFound } from '@tanstack/router-core'; @@ -132,7 +113,6 @@ import { ParseParamsFn } from '@tanstack/router-core'; import { ParseRoute } from '@tanstack/router-core'; import { parseSearchWith } from '@tanstack/router-core'; import { PathParamOptions } from '@tanstack/router-core'; -import { PreloadableObj } from '@tanstack/router-core'; import * as React_2 from 'react'; import { ReactNode } from 'react'; import { Redirect } from '@tanstack/router-core'; @@ -148,10 +128,8 @@ import { RelativeToPathAutoComplete } from '@tanstack/router-core'; import { RemountDepsOptions } from '@tanstack/router-core'; import { RemoveLeadingSlashes } from '@tanstack/router-core'; import { RemoveTrailingSlashes } from '@tanstack/router-core'; -import { replaceEqualDeep } from '@tanstack/router-core'; import { ResolveAllContext } from '@tanstack/router-core'; import { ResolveAllParamsFromParent } from '@tanstack/router-core'; -import { ResolvedRedirect } from '@tanstack/router-core'; import { ResolveFullPath } from '@tanstack/router-core'; import { ResolveFullSearchSchema } from '@tanstack/router-core'; import { ResolveFullSearchSchemaInput } from '@tanstack/router-core'; @@ -159,7 +137,6 @@ import { ResolveId } from '@tanstack/router-core'; import { ResolveLoaderData } from '@tanstack/router-core'; import { ResolveOptionalParams } from '@tanstack/router-core'; import { ResolveParams } from '@tanstack/router-core'; -import { resolvePath } from '@tanstack/router-core'; import { ResolveRelativePath } from '@tanstack/router-core'; import { ResolveRequiredParams } from '@tanstack/router-core'; import { ResolveRoute } from '@tanstack/router-core'; @@ -183,18 +160,14 @@ import { Route as Route_2 } from '@tanstack/router-core'; import { RouteById } from '@tanstack/router-core'; import { RouteConstraints } from '@tanstack/router-core'; import { RouteContext } from '@tanstack/router-core'; -import { RouteContextFn } from '@tanstack/router-core'; import { RouteContextOptions } from '@tanstack/router-core'; import { RouteContextParameter } from '@tanstack/router-core'; import { RouteIds } from '@tanstack/router-core'; -import { RouteLinkEntry } from '@tanstack/router-core'; -import { RouteLoaderEntry } from '@tanstack/router-core'; import { RouteLoaderFn } from '@tanstack/router-core'; import { RouteMask } from '@tanstack/router-core'; import { RouteMatch } from '@tanstack/router-core'; import { RouteOptions } from '@tanstack/router-core'; import { RoutePathOptions } from '@tanstack/router-core'; -import { RoutePathOptionsIntersection } from '@tanstack/router-core'; import { RoutePaths } from '@tanstack/router-core'; import { RouterConstructorOptions } from '@tanstack/router-core'; import { RouterContextOptions } from '@tanstack/router-core'; @@ -202,7 +175,6 @@ import { RouterCore } from '@tanstack/router-core'; import { RouterEvent } from '@tanstack/router-core'; import { RouterEvents } from '@tanstack/router-core'; import { RouterHistory } from '@tanstack/history'; -import { RouterListener } from '@tanstack/router-core'; import { RouterManagedTag } from '@tanstack/router-core'; import { RouterOptions } from '@tanstack/router-core'; import { RouterState } from '@tanstack/router-core'; @@ -234,11 +206,8 @@ import { ToSubOptions } from '@tanstack/router-core'; import { ToSubOptionsProps } from '@tanstack/router-core'; import { TrailingSlashOption } from '@tanstack/router-core'; import { TrimPath } from '@tanstack/router-core'; -import { trimPath } from '@tanstack/router-core'; import { TrimPathLeft } from '@tanstack/router-core'; -import { trimPathLeft } from '@tanstack/router-core'; import { TrimPathRight } from '@tanstack/router-core'; -import { trimPathRight } from '@tanstack/router-core'; import { UpdatableRouteOptions } from '@tanstack/router-core'; import { UpdatableStaticRouteOption } from '@tanstack/router-core'; import { UseLoaderDataResult } from '@tanstack/router-core'; @@ -250,17 +219,9 @@ import { UseRouteContextOptions } from '@tanstack/router-core'; import { UseRouteContextResult } from '@tanstack/router-core'; import { UseSearchResult } from '@tanstack/router-core'; import { ValidateFromPath } from '@tanstack/router-core'; -import { ValidateId } from '@tanstack/router-core'; import { ValidateJSON } from '@tanstack/router-core'; import { ValidateNavigateOptions } from '@tanstack/router-core'; -import { ValidateNavigateOptionsArray } from '@tanstack/router-core'; -import { ValidateParams } from '@tanstack/router-core'; import { ValidateRedirectOptions } from '@tanstack/router-core'; -import { ValidateRedirectOptionsArray } from '@tanstack/router-core'; -import { ValidateSearch } from '@tanstack/router-core'; -import { ValidateToPath } from '@tanstack/router-core'; -import { ValidateUseParamsResult } from '@tanstack/router-core'; -import { ValidateUseSearchResult } from '@tanstack/router-core'; import { Validator } from '@tanstack/router-core'; import { ValidatorAdapter } from '@tanstack/router-core'; import { ValidatorFn } from '@tanstack/router-core'; @@ -290,10 +251,6 @@ export { AnyRouteMatch } export { AnyRouter } -export { AnyRouterWithContext } - -export { AnyRouteWithContext } - export { AnySchema } export { AnySerializationAdapter } @@ -302,16 +259,8 @@ export { AnyValidator } export { AnyValidatorAdapter } -export { AnyValidatorFn } - export { AnyValidatorObj } -// @public (undocumented) -export function Asset(asset: RouterManagedTag & { - nonce?: string; - preventScriptHoist?: boolean; -}): React_2.ReactElement | null; - export { Assign } // @public (undocumented) @@ -396,15 +345,11 @@ export function CatchNotFound(props: { children: React_2.ReactNode; }): JSX.Element; -export { cleanPath } - // Warning: (ae-forgotten-export) The symbol "ClientOnlyProps" needs to be exported by the entry point index.rsc.d.ts // // @public export function ClientOnly(input: ClientOnlyProps): JSX.Element; -export { CommitLocationOptions } - export { composeRewrites } export { Constrain } @@ -415,14 +360,8 @@ export { ContextOptions } export { ContextReturnType } -export { ControllablePromise } - -export { ControlledPromise } - export { createBrowserHistory } -export { createControlledPromise } - export { CreateFileRoute } // @public @@ -430,10 +369,6 @@ export function createFileRoute(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute; @@ -465,12 +400,8 @@ export function createRouteMask; -export { ErrorRouteProps } - export { Expand } export { FileBaseRouteOptions } @@ -519,21 +448,14 @@ export class FileRoute, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, const TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions & UpdatableRouteOptions) => Route_2; // (undocumented) path?: TFilePath | undefined; - // (undocumented) - silent?: boolean; } -// @public @deprecated (undocumented) -export function FileRouteLoader(_path: TFilePath): (loaderFn: Constrain>) => TLoaderFn; - export { FileRoutesByPath } export { FileRouteTypes } export { FullSearchSchemaOption } -export { functionalUpdate } - // @public export function getRouteApi(id: ConstrainLiteral>): RouteApi; @@ -568,15 +490,8 @@ export { InferShouldThrow } export { InferStrict } -// @public (undocumented) -export type InferStructuralSharing = TOptions extends { - structuralSharing: infer TStructuralSharing; -} ? TStructuralSharing : unknown; - export { InferTo } -export { interpolatePath } - export { IntersectAssign } export { isMatch } @@ -585,8 +500,6 @@ export { isNotFound } export { isRedirect } -export { joinPaths } - export { lazyFn } // @public (undocumented) @@ -681,25 +594,11 @@ export { MakeRouteMatchUnion } export { Manifest } -// @public (undocumented) -export const Match: React_2.MemoExoticComponent<(input: { - routeId: string; -}) => JSX.Element>; - -// @public -export function Matches(): JSX.Element; - -export { MatchLocation } - // @public export function MatchRoute(props: MakeMatchRouteOptions): any; export { MatchRouteOptions } -export { MergeAll } - -export { MetaDescriptor } - // @public export function Navigate(props: NavigateOptions): null; @@ -736,11 +635,6 @@ export { parseSearchWith } export { PathParamOptions } -export { PreloadableObj } - -// @public -export const reactUse: ((usable: Promise | React_2.Context) => T) | undefined; - export { Redirect } export { redirect } @@ -767,14 +661,10 @@ export { RemoveLeadingSlashes } export { RemoveTrailingSlashes } -export { replaceEqualDeep } - export { ResolveAllContext } export { ResolveAllParamsFromParent } -export { ResolvedRedirect } - export { ResolveFullPath } export { ResolveFullSearchSchema } @@ -789,8 +679,6 @@ export { ResolveOptionalParams } export { ResolveParams } -export { resolvePath } - export { ResolveRelativePath } export { ResolveRequiredParams } @@ -903,16 +791,12 @@ export { RouteConstraints } export { RouteContext } -export { RouteContextFn } - export { RouteContextOptions } export { RouteContextParameter } export { RouteIds } -export { RouteLinkEntry } - export { RouteLoaderFn } export { RouteMask } @@ -923,8 +807,6 @@ export { RouteOptions } export { RoutePathOptions } -export { RoutePathOptionsIntersection } - // @public (undocumented) export class Router = Record> extends RouterCore { constructor(options: RouterConstructorOptions); @@ -934,19 +816,12 @@ export { RouterConstructorOptions } export { RouterContextOptions } -// @public -export function RouterContextProvider = Record>(input: RouterProps & { - children: React_2.ReactNode; -}): JSX.Element; - export { RouterEvent } export { RouterEvents } export { RouterHistory } -export { RouterListener } - export { RouterManagedTag } export { RouterOptions } @@ -1025,16 +900,10 @@ export { TrailingSlashOption } export { TrimPath } -export { trimPath } - export { TrimPathLeft } -export { trimPathLeft } - export { TrimPathRight } -export { trimPathRight } - export { UpdatableRouteOptions } export { UpdatableStaticRouteOption } @@ -1089,9 +958,6 @@ export function useElementScrollRestoration(options: ({ // @public export function useHydrated(): boolean; -// @public (undocumented) -export const useLayoutEffect: typeof React_2.useEffect; - // @public export function useLinkProps(options: UseLinkPropsOptions, forwardedRef?: React_2.ForwardedRef): React_2.ComponentPropsWithRef<'a'>; @@ -1165,13 +1031,8 @@ export function useRouterState(opts: UseSearchOptions, TSelected, TStructuralSharing>): ThrowOrOptional, TThrow>; -// @public -export const useTags: (assetCrossOrigin?: AssetCrossOriginConfig) => RouterManagedTag[]; - export { ValidateFromPath } -export { ValidateId } - // @public (undocumented) export type ValidateLinkOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; @@ -1182,28 +1043,8 @@ export type ValidateLinkOptionsArray = Constrain, InferStrict, InferShouldThrow, InferSelected, InferSelected>>; - -export { ValidateUseParamsResult } - -// @public (undocumented) -export type ValidateUseSearchOptions = Constrain, InferStrict, InferShouldThrow, InferSelected, InferStructuralSharing>>; - -export { ValidateUseSearchResult } - export { Validator } export { ValidatorAdapter } @@ -1227,18 +1068,12 @@ declare module "@tanstack/history" { interface HistoryState { __tempLocation?: HistoryLocation; __tempKey?: string; - __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions; } } // Matches.d.ts declare module "@tanstack/router-core" { interface RouteMatchExtensions { - meta?: Array; - links?: Array; - scripts?: Array; - styles?: Array; - headScripts?: Array; } } diff --git a/packages/react-router/src/Matches.tsx b/packages/react-router/src/Matches.tsx index a20c862b238..7e4d02863d3 100644 --- a/packages/react-router/src/Matches.tsx +++ b/packages/react-router/src/Matches.tsx @@ -32,10 +32,15 @@ import type { declare module '@tanstack/router-core' { export interface RouteMatchExtensions { + /** @internal */ meta?: Array + /** @internal */ links?: Array + /** @internal */ scripts?: Array + /** @internal */ styles?: Array + /** @internal */ headScripts?: Array } } diff --git a/packages/react-router/src/Transitioner.tsx b/packages/react-router/src/Transitioner.tsx index ddf8afea2e1..fe45709a6de 100644 --- a/packages/react-router/src/Transitioner.tsx +++ b/packages/react-router/src/Transitioner.tsx @@ -6,6 +6,7 @@ import { useLayoutEffect } from './utils' import { useRouter } from './useRouter' import type { AnyRouter } from '@tanstack/router-core' +// @internal export function settleOwner( owner: NonNullable, rendered: boolean, diff --git a/packages/react-router/src/fileRoute.ts b/packages/react-router/src/fileRoute.ts index f4d8c9b9676..c829c5df32e 100644 --- a/packages/react-router/src/fileRoute.ts +++ b/packages/react-router/src/fileRoute.ts @@ -76,6 +76,7 @@ export class FileRoute< TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'], > { + /** @internal */ silent?: boolean constructor( diff --git a/packages/react-router/src/history.ts b/packages/react-router/src/history.ts index 2271af692cd..190b60e4ed0 100644 --- a/packages/react-router/src/history.ts +++ b/packages/react-router/src/history.ts @@ -4,6 +4,7 @@ declare module '@tanstack/history' { interface HistoryState { __tempLocation?: HistoryLocation __tempKey?: string + /** @internal */ __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions } } diff --git a/packages/react-router/src/index.tsx b/packages/react-router/src/index.tsx index 23ebf57938f..b5d0236c972 100644 --- a/packages/react-router/src/index.tsx +++ b/packages/react-router/src/index.tsx @@ -3,6 +3,17 @@ export { defer, isMatch, + rootRouteId, + defaultParseSearch, + defaultStringifySearch, + parseSearchWith, + stringifySearchWith, + retainSearchParams, + stripSearchParams, + createSerializationAdapter, +} from '@tanstack/router-core' +/** @internal */ +export { joinPaths, cleanPath, trimPathLeft, @@ -10,18 +21,10 @@ export { trimPath, resolvePath, interpolatePath, - rootRouteId, - defaultParseSearch, - defaultStringifySearch, - parseSearchWith, - stringifySearchWith, functionalUpdate, replaceEqualDeep, deepEqual, createControlledPromise, - retainSearchParams, - stripSearchParams, - createSerializationAdapter, } from '@tanstack/router-core' export type { @@ -41,19 +44,14 @@ export type { SearchSchemaInput, AnyContext, RouteContext, - PreloadableObj, RoutePathOptions, StaticDataRouteOption, - RoutePathOptionsIntersection, UpdatableStaticRouteOption, - MetaDescriptor, - RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, - ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, @@ -75,13 +73,10 @@ export type { TrailingSlashOption, Manifest, RouterManagedTag, - ControlledPromise, Constrain, Expand, - MergeAll, Assign, IntersectAssign, - ResolveValidatorInput, ResolveValidatorOutput, Register, AnyValidator, @@ -89,9 +84,7 @@ export type { ValidatorFn, AnySchema, AnyValidatorAdapter, - AnyValidatorFn, AnyValidatorObj, - ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, @@ -101,18 +94,32 @@ export type { FileRoutesByPath, RouteById, RootRouteOptions, - CreateFileRoute, SerializationAdapter, AnySerializationAdapter, SerializableExtensions, + CreateFileRoute, + ResolveValidatorInput, + ResolveValidatorInputFn, +} from '@tanstack/router-core' +/** @internal */ +export type { + PreloadableObj, + RoutePathOptionsIntersection, + MetaDescriptor, + RouteLinkEntry, + ErrorRouteProps, + ControlledPromise, + MergeAll, + AnyValidatorFn, } from '@tanstack/router-core' export { - createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history' +/** @internal */ +export { createHistory } from '@tanstack/history' export type { BlockerFn, @@ -127,16 +134,18 @@ export type { AwaitOptions } from './awaited' export { CatchBoundary, ErrorComponent } from './CatchBoundary' export { ClientOnly, useHydrated } from './ClientOnly' +/** @internal */ export { reactUse, useLayoutEffect } from './utils' export { FileRoute, createFileRoute, - FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute' +/** @internal */ +export { FileRouteLoader } from './fileRoute' export * from './history' @@ -174,20 +183,14 @@ export type { MakeRemountDepsOptionsUnion, RemountDepsOptions, ResolveFullPath, - AnyRouteWithContext, - AnyRouterWithContext, - CommitLocationOptions, - MatchLocation, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, - ResolvedRedirect, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, - RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, @@ -201,7 +204,6 @@ export type { AnyRouter, RegisteredRouter, RouterContextOptions, - ControllablePromise, RouterOptions, RouterState, ListenerFn, @@ -209,10 +211,20 @@ export type { RouterConstructorOptions, RouterEvents, RouterEvent, - RouterListener, RouteConstraints, RouteMask, MatchRouteOptions, +} from '@tanstack/router-core' +/** @internal */ +export type { + AnyRouteWithContext, + AnyRouterWithContext, + CommitLocationOptions, + MatchLocation, + ResolvedRedirect, + RouteContextFn, + ControllablePromise, + RouterListener, CreateLazyFileRoute, } from '@tanstack/router-core' export type { @@ -225,17 +237,20 @@ export type { } from './link' export { - Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches' +/** @internal */ +export { Matches } from './Matches' export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches' -export { Match, Outlet } from './Match' +export { Outlet } from './Match' +/** @internal */ +export { Match } from './Match' export { useMatch } from './useMatch' export { useLoaderDeps } from './useLoaderDeps' @@ -244,9 +259,10 @@ export { useLoaderData } from './useLoaderData' export { redirect, isRedirect, - createRouterConfig, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/router-core' +/** @internal */ +export { createRouterConfig } from '@tanstack/router-core' export { RouteApi, @@ -274,7 +290,9 @@ export { createRouter, Router } from './router' export { lazyFn, SearchParamError } from '@tanstack/router-core' -export { RouterProvider, RouterContextProvider } from './RouterProvider' +export { RouterProvider } from './RouterProvider' +/** @internal */ +export { RouterContextProvider } from './RouterProvider' export type { RouterProps } from './RouterProvider' export { @@ -302,39 +320,47 @@ export type { NotFoundError } from '@tanstack/router-core' export type { ValidateLinkOptions, + ValidateLinkOptionsArray, +} from './typePrimitives' +/** @internal */ +export type { InferStructuralSharing, ValidateUseSearchOptions, ValidateUseParamsOptions, - ValidateLinkOptionsArray, } from './typePrimitives' export type { ValidateFromPath, - ValidateToPath, - ValidateSearch, - ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, - ValidateNavigateOptionsArray, ValidateRedirectOptions, + SerializerExtensions, + RegisteredSerializableInput, + Serializable, + InferSelected, + InferShouldThrow, + InferStrict, +} from '@tanstack/router-core' +/** @internal */ +export type { + ValidateToPath, + ValidateSearch, + ValidateParams, + ValidateNavigateOptionsArray, ValidateRedirectOptionsArray, ValidateId, - InferStrict, - InferShouldThrow, - InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, - SerializerExtensions, - RegisteredSerializableInput, - Serializable, } from '@tanstack/router-core' export { ScriptOnce } from './ScriptOnce' +/** @internal */ export { Asset } from './Asset' export { HeadContent } from './HeadContent' +/** @internal */ export { useTags } from './headContentUtils' export { Scripts } from './Scripts' export type * from './ssr/serializer' diff --git a/packages/react-router/src/matchContext.tsx b/packages/react-router/src/matchContext.tsx index 12db4dbadaf..63c4788cb14 100644 --- a/packages/react-router/src/matchContext.tsx +++ b/packages/react-router/src/matchContext.tsx @@ -12,6 +12,7 @@ declare module '@tanstack/router-core' { * The link scope of each route id that rendered links, keyed `undefined` * for links outside every match (route ids start with `/` or are the * root id). A scope without links holds no location. + * @internal */ _linkScopes?: Record } diff --git a/packages/router-core/api/index.api.md b/packages/router-core/api/index.api.md index 024ac8dd674..c50d2d3a949 100644 --- a/packages/router-core/api/index.api.md +++ b/packages/router-core/api/index.api.md @@ -11,13 +11,9 @@ ```ts import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; import { ParsedHistoryState } from '@tanstack/history'; -import { Plugin as Plugin_2 } from 'seroval'; -import { PluginInfo } from 'seroval'; import { RouterHistory } from '@tanstack/history'; -import { SerovalNode } from 'seroval'; // Warning: (ae-forgotten-export) The symbol "CurrentPath" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ParentPath" needs to be exported by the entry point index.d.ts @@ -72,25 +68,9 @@ export type AnyRouteMatch = RouteMatch; // @public (undocumented) export type AnyRouter = RouterCore; -// @public (undocumented) -export type AnyRouterConfig = RouterConfig; - -// @public (undocumented) -export type AnyRouterWithContext = RouterCore, any, any, any, any>; - -// @public (undocumented) -export type AnyRouteWithContext = AnyRoute & { - types: { - allContext: TContext; - }; -}; - // @public (undocumented) export type AnySchema = {}; -// @public (undocumented) -export type AnySearchValidator = SearchValidator; - // @public (undocumented) export type AnySerializationAdapter = SerializationAdapter; @@ -103,12 +83,6 @@ export interface AnyStandardSchemaValidateFailure { readonly issues: ReadonlyArray; } -// @public (undocumented) -export interface AnyStandardSchemaValidateInput { - // (undocumented) - readonly value: any; -} - // @public (undocumented) export interface AnyStandardSchemaValidateIssue { // (undocumented) @@ -132,15 +106,9 @@ export type AnyValidator = Validator; // @public (undocumented) export type AnyValidatorAdapter = ValidatorAdapter; -// @public (undocumented) -export type AnyValidatorFn = ValidatorFn; - // @public (undocumented) export type AnyValidatorObj = ValidatorObj; -// @public (undocumented) -export function appendUniqueUserTags(target: Array, tags: Array): void; - // @public (undocumented) export type AssetCrossOrigin = 'anonymous' | 'use-credentials'; @@ -176,29 +144,17 @@ export class BaseRoute; // (undocumented) - children?: TChildren; - // (undocumented) get fullPath(): TFullPath; // (undocumented) get id(): TId; // (undocumented) - init: (originalIndex: number) => void; - // (undocumented) - isRoot: TParentRoute extends AnyRoute ? true : false; - // (undocumented) lazy: RouteLazyFn>; // (undocumented) lazyFn?: () => Promise>>; // (undocumented) - options: RouteOptions; - // (undocumented) - originalIndex?: number; - // (undocumented) parentRoute: TParentRoute; // (undocumented) get path(): TPath; - // (undocumented) - rank: number; redirect: RedirectFnRoute; // (undocumented) get to(): TrimPathRight; @@ -206,10 +162,6 @@ export class BaseRoute; // (undocumented) update: (options: UpdatableRouteOptions) => this; - // (undocumented) - updateLoader: (options: { - loader: Constrain>; - }) => BaseRoute; } // @public (undocumented) @@ -238,14 +190,9 @@ export interface BeforeLoadContextOptions = Assign, ContextReturnType>; -// @public -export function buildDevStylesUrl(basepath: string, routeIds: Array): string; - // @public (undocumented) export type BuildLocationFn = | string = string, TMaskFrom extends RoutePaths | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions & { leaveParams?: boolean; - _includeValidateSearch?: boolean; - _isNavigate?: boolean; }) => ParsedLocation; // @public (undocumented) @@ -253,14 +200,10 @@ export interface BuildNextOptions { // (undocumented) from?: string; // (undocumented) - _fromLocation?: ParsedLocation; - // (undocumented) hash?: true | Updater; // (undocumented) href?: string; // (undocumented) - _isNavigate?: boolean; - // (undocumented) mask?: { to?: string | number | null; params?: true | Updater; @@ -277,13 +220,8 @@ export interface BuildNextOptions { state?: true | NonNullableUpdater; // (undocumented) to?: string | number | null; - // (undocumented) - unsafeRelative?: 'path'; } -// @public -export function cleanPath(path: string): string; - // @public (undocumented) export type ClearCacheFn = (opts?: { filter?: (d: MakeRouteMatchUnion) => boolean; @@ -295,25 +233,6 @@ export type ClearCacheFn = (opts?: { // @public (undocumented) export type CodeRouteToPath = ParseRouteWithoutBranches extends infer TRoute extends AnyRoute ? TRoute extends any ? RouteToByRouter : never : never; -// @public (undocumented) -export type CommitLocationFn = (input: ParsedLocation & CommitLocationOptions) => Promise; - -// @public (undocumented) -export interface CommitLocationOptions { - // (undocumented) - hashScrollIntoView?: boolean | ScrollIntoViewOptions; - // (undocumented) - ignoreBlocker?: boolean; - // (undocumented) - replace?: boolean; - // (undocumented) - resetScroll?: boolean; - // @deprecated (undocumented) - startTransition?: boolean; - // (undocumented) - viewTransition?: boolean | ViewTransitionOptions; -} - // @public export function composeRewrites(rewrites: Array): { input: (input: { @@ -324,12 +243,6 @@ export function composeRewrites(rewrites: Array): { }) => URL; }; -// Warning: (ae-forgotten-export) The symbol "SsrBodyScriptParts" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "InitialHydrationScriptTags" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export function composeSsrBodyScripts(input: SsrBodyScriptParts, initialHydrationScripts?: InitialHydrationScriptTags): Array; - // @public (undocumented) export type Constrain = (T extends TConstraint ? T : never) | TDefault; @@ -364,49 +277,17 @@ export interface ContextOptions = unknown extends TContextFn ? TContextFn : LooseReturnType extends never ? AnyContext : LooseReturnType; -// @public (undocumented) -export type ControllablePromise = Promise & { - resolve: (value: T) => void; - reject: (value?: any) => void; -}; - -// @public (undocumented) -export type ControlledPromise = Promise & { - resolve: (value: T) => void; - reject: (value: any) => void; - status: 'pending' | 'resolved' | 'rejected'; - value?: T; -}; - -// @public -export function createControlledPromise(onResolve?: (value: T) => void): ControlledPromise; - // Warning: (ae-forgotten-export) The symbol "FileRouteOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) export type CreateFileRoute = , TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined>(options?: FileRouteOptions) => Route; -// @public (undocumented) -export function createInlineCssStyleAsset(css: string): ManifestInlineCss; - -// @public (undocumented) -export type CreateLazyFileRoute = (opts: LazyRouteOptions) => LazyRoute; - // @public (undocumented) export type CreateMatchAndValue = TValue extends any ? { match: TMatch; value: TValue; } : never; -// @public -export function createNonReactiveMutableStore(initialValue: TValue): RouterWritableStore; - -// @public -export function createNonReactiveReadonlyStore(read: () => TValue): RouterReadableStore; - -// @public (undocumented) -export const createRouterConfig: = [], TDefaultSsr extends SSROption = SSROption>(options: RouterConfigOptions) => RouterConfig; - // @public (undocumented) export type CreateRouterFn = = Record>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions) => RouterCore; @@ -415,12 +296,6 @@ export type CreateRouterFn = | never = never>(opts: CreateSerializationAdapterOptions): SerializationAdapter; -// @public -export function decode(str: any): any; - -// @public -export function deepEqual(a: any, b: any, partial?: boolean, explicitUndefined?: boolean): boolean; - // @public (undocumented) export type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; @@ -435,18 +310,12 @@ export interface DefaultErrorBoundaryTypes { error: unknown; } -// @public -export const defaultGetScrollRestorationKey: (location: ParsedLocation) => string; - // @public export const defaultParseSearch: (searchStr: string) => AnySchema; // @public (undocumented) export type DefaultRemountDepsFn = (opts: MakeRemountDepsOptionsUnion) => any; -// @public (undocumented) -export type DefaultSearchValidator = SearchValidator, AnySchema>; - // @public (undocumented) export interface DefaultSerializable { // (undocumented) @@ -473,14 +342,6 @@ export interface DefaultSerializable { void: void; } -// @public -export function defaultSerializeError(err: unknown): { - name: string; - message: string; -} | { - data: unknown; -}; - // @public export const defaultStringifySearch: (search: Record) => string; @@ -511,15 +372,6 @@ export type DeferredPromiseState = { error: unknown; }; -// @public (undocumented) -export const DEV_STYLES_ATTR = "data-tanstack-router-dev-styles"; - -// @public (undocumented) -export type EmitFn = (routerEvent: RouterEvent) => void; - -// @public -export function encode(obj: Record, stringify?: (value: any) => string): string; - // @public export interface ErrorBoundaryTypes extends DefaultErrorBoundaryTypes { } @@ -533,24 +385,6 @@ export type ErrorComponentProps = { reset: () => void; }; -// @public @deprecated (undocumented) -export type ErrorRouteProps = { - error: unknown; - info?: { - componentStack: string; - }; - reset: () => void; -}; - -// @public -export function escapeHtml(str: string): string; - -// @public -export function exactPathTest(pathName1: string, pathName2: string, basepath: string): boolean; - -// @public -export function executeRewriteInput(rewrite: LocationRewrite | undefined, url: URL): URL; - // @public (undocumented) export type Expand = T extends object ? T extends infer O ? O extends Function ? O : { [K in keyof O]: O[K]; @@ -633,72 +467,6 @@ export interface FullSearchSchemaOption>; } -// @public -export function functionalUpdate(updater: Updater | NonNullableUpdater, previous: TPrevious): TResult; - -// @public (undocumented) -export function getAssetCrossOrigin(assetCrossOrigin: AssetCrossOriginConfig | undefined, kind: 'script' | 'stylesheet'): AssetCrossOrigin | undefined; - -// @public -export function _getAssetMatches(matches: Array): Array; - -// @public (undocumented) -export function getElementScrollRestorationEntry(router: AnyRouter, options: ({ - id: string; - getElement?: () => Window | Element | undefined | null; -} | { - id?: string; - getElement: () => Window | Element | undefined | null; -}) & { - getKey?: (location: ParsedLocation) => string; -}): ScrollRestorationEntry | undefined; - -// @public -export function getInitialRouterState(location: ParsedLocation): RouterState; - -// @public -export function getLocationChangeInfo(location: ParsedLocation, resolvedLocation?: ParsedLocation): { - fromLocation: ParsedLocation<{}> | undefined; - toLocation: ParsedLocation<{}>; - pathChanged: boolean; - hrefChanged: boolean; - hashChanged: boolean; -}; - -// @public (undocumented) -export function getManifestScriptFormat(manifest: { - scriptFormat?: ScriptFormat; -} | undefined): ScriptFormat; - -// @public (undocumented) -export type GetMatchRoutesFn = (pathname: string) => [ -matchedRoutes: ReadonlyArray, -rawParams: Record, -foundRoute: AnyRoute | undefined -]; - -// @public -export function _getRenderedMatches(matches: Array): Array; - -// Warning: (ae-forgotten-export) The symbol "RouteInterpolation" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export function getRouteSegments(route: AnyRoute): RouteInterpolation | undefined; - -// @public (undocumented) -export function getScriptPreloadAttrs(manifest: { - scriptFormat?: ScriptFormat; -} | undefined, link: ManifestAssetLink, assetCrossOrigin?: AssetCrossOriginConfig): { - rel: 'modulepreload' | 'preload'; - as?: 'script'; - href: string; - fetchPriority: 'low'; - crossOrigin?: AssetCrossOrigin; -}; - -// @public (undocumented) -export function getSsrBodyScriptParts(matches: Array, manifest: Manifest | undefined, nonce: string | undefined, routeScriptAttrs?: Record): SsrBodyScriptParts; - // Warning: (ae-forgotten-export) The symbol "StoreConfig" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -706,18 +474,6 @@ export type GetStoreConfig = (opts: { isServer?: boolean; }) => StoreConfig; -// @public (undocumented) -export function getStylesheetHref(asset: ManifestCssLink): string; - -// @public -export function getUrlScheme(url: string): string | undefined; - -// @public (undocumented) -export function hasKeys(obj: Record): boolean; - -// @public -export function hasMissingPathParams(segments: RouteInterpolation, params: Record): boolean; - // @public (undocumented) export type InferAllContext = unknown extends TRoute ? TRoute : TRoute extends { types: { @@ -797,9 +553,6 @@ export type InlineCssTemplate = { urls: Array; }; -// @public -export function interpolatePath(path: string, segments: RouteInterpolation, params: Record, decoder?: (encoded: string) => string, usedParams?: Record): string; - // @public (undocumented) export type IntersectAssign = TLeft extends any ? TRight extends any ? IsNonEmptyObject extends false ? TRight : IsNonEmptyObject extends false ? TLeft : TRight & TLeft : never : never; @@ -810,15 +563,6 @@ export type InvalidateFn = (opts?: { forcePending?: boolean; }) => Promise; -// @public (undocumented) -export function invariant(): never; - -// @public (undocumented) -export type IsAny = 1 extends 0 & TValue ? TYesResult : TNoResult; - -// @public -export function isDangerousProtocol(url: string, allowlist: Set): boolean; - // @public (undocumented) export type IsMatch = IsMatchParse = TMatchAndValue extends any ? TKey extends keyof TMatchAndValue['value'] ? TMatchAndValue['match'] : never : never; -// @public -export function isModuleNotFoundError(error: any): boolean; - // @public (undocumented) export type IsNonEmptyObject = T extends object ? keyof T extends never ? false : true : false; // @public export function isNotFound(obj: any): obj is NotFoundError; -// @public (undocumented) -export function isPromise(value: Promise> | T): value is Promise>; - // @public export function isRedirect(obj: any): obj is AnyRedirect; // @public (undocumented) export type IsRequiredParams = Record extends TParams ? never : true; -// @public -export function isResolvedRedirect(obj: any): obj is AnyRedirect & { - options: { - href: string; - }; -}; - -// @public -export function _isRouteDeparting(router: AnyRouter, routeId: string | undefined, location: ParsedLocation): unknown; - -// @public (undocumented) -export type IsUnion = (T extends any ? (U extends T ? false : true) : never) extends false ? false : true; - -// @public -export function joinPaths(paths: Array): string; - // @public export function lazyFn) => any>, TKey extends keyof T = 'default'>(fn: () => Promise, key?: TKey): (...args: Parameters) => Promise>>; @@ -939,13 +661,8 @@ export type LoadFn = (opts?: { action?: { type: HistoryAction; }; - _signal?: AbortSignal; - _skipLocationUpdate?: boolean; }) => Promise; -// @public (undocumented) -export type LoadRouteChunkFn = (route: AnyRoute) => Promise>; - // @public (undocumented) export type LocationRewrite = { input?: LocationRewriteFunction; @@ -994,11 +711,6 @@ export type MakeRouteMatchFromRoute = RouteMatch> = TRoute extends any ? RouteMatch : never; -// Warning: (ae-forgotten-export) The symbol "AdapterNode" needs to be exported by the entry point index.d.ts -// -// @public -export function makeSerovalPlugin(serializationAdapter: AnySerializationAdapter): Plugin_2; - // @public (undocumented) export type Manifest = { scriptFormat?: ScriptFormat; @@ -1041,24 +753,10 @@ export type ManifestScript = Omit; // @public (undocumented) export interface MaskOptions { - // (undocumented) - _fromLocation?: ParsedLocation; // (undocumented) mask?: ToMaskOptions; } -// @public (undocumented) -export interface MatchLocation { - // (undocumented) - caseSensitive?: boolean; - // (undocumented) - from?: string; - // (undocumented) - fuzzy?: boolean; - // (undocumented) - to?: string | number | null; -} - // @public (undocumented) export type MatchRouteFn = = '/', TTo extends string | undefined = undefined, TResolved = ResolveRelativePath>>(location: ToOptions, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById['types']['allParams']; @@ -1087,38 +785,9 @@ export interface MatchRoutesOpts { throwOnError?: boolean; } -// @public (undocumented) -export type MergeAll = MergeAllObjects | ExtractPrimitives; - -// @public -export type MergeAllObjects>> = [keyof TIntersected] extends [never] ? never : { - [TKey in keyof TIntersected]: TUnion extends any ? TUnion[TKey & keyof TUnion] : never; -}; - // @public (undocumented) export type MergeAllPrimitive = ReadonlyArray | number | string | bigint | boolean | symbol | undefined | null; -// @public (undocumented) -export type MetaDescriptor = { - charSet: 'utf-8'; -} | { - title: string; -} | { - name: string; - content: string; -} | { - property: string; - content: string; -} | { - httpEquiv: string; - content: string; -} | { - 'script:ld+json': LdJsonObject; -} | { - tagName: 'meta' | 'link'; - [name: string]: string; -} | Record; - // @public (undocumented) export type NavigateFn = | string = string, TMaskFrom extends RoutePaths | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions) => Promise; @@ -1191,15 +860,9 @@ export interface ParsedLocation { unmaskOnReload?: boolean; } -// @public (undocumented) -export type ParseLocationFn = (locationToParse: HistoryLocation, previousLocation?: ParsedLocation>) => ParsedLocation>; - // @public (undocumented) export type ParseParamsFn = (rawParams: Expand>) => TParams | false; -// @public -export function parseRedirect(obj: any): Redirect | undefined; - // @public (undocumented) export type ParseRoute = TRouteTree extends { types: { @@ -1236,22 +899,9 @@ export type PickOptional = { [K in keyof T as undefined extends T[K] ? K : never]: T[K]; }; -// @public (undocumented) -export type PickRequired = { - [K in keyof T as undefined extends T[K] ? never : K]: T[K]; -}; - -// @public (undocumented) -export type PreloadableObj = { - preload?: () => Promise | undefined; -}; - // @public (undocumented) export type PreloadRouteFn = Record> = | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise | undefined>; -// @public (undocumented) -export const preloadWarning = "Error preloading route! \u261D\uFE0F"; - // @public export class RawStream { constructor(stream: ReadableStream, options?: RawStreamOptions); @@ -1338,15 +988,9 @@ export interface RemountDepsOptions = T & `/${string}` extends never ? T : T extends `/${infer R}` ? R : T; -// @public -export function removeTrailingSlash(value: string, basepath: string): string; - // @public (undocumented) export type RemoveTrailingSlashes = T & `${string}/` extends never ? T : T extends `${infer R}/` ? R : T; -// @public -export function replaceEqualDeep(prev: any, next: T, _nullProto?: boolean, _depth?: number): T; - // @public (undocumented) export interface RequiredToOptions { to: ToPathOption & {}; @@ -1363,9 +1007,6 @@ export type ResolveAllParamsFromParent = // @public (undocumented) export type ResolveCurrentPath = TTo extends '.' ? TFrom : TTo extends './' ? AddTrailingSlash : TTo & `./${string}` extends never ? never : TTo extends `./${infer TRest}` ? AddLeadingSlash> : never; -// @public (undocumented) -export type ResolvedRedirect = Redirect; - // @public (undocumented) export type ResolveFullPath> = TPrefixed extends RootRouteId ? '/' : TPrefixed; @@ -1385,19 +1026,6 @@ export type ResolveId = unknown extends TLoaderFn ? TLoaderFn : LooseAsyncReturnType> extends never ? undefined : LooseAsyncReturnType>; -// @public (undocumented) -export function resolveManifestAssetLink(link: ManifestAssetLink): { - href: string; - crossOrigin?: AssetCrossOrigin; -}; - -// @public (undocumented) -export function resolveManifestCssLink(link: ManifestCssLink): { - href: string; - crossOrigin?: AssetCrossOrigin; - "data-tanstack-router-dev-styles"?: true; -}; - // Warning: (ae-forgotten-export) The symbol "ParsePathParams" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -1413,11 +1041,6 @@ export type ResolveParams = ResolveRequiredPar // @public (undocumented) export type ResolveParentPath = TTo extends '../' | '..' ? TFrom extends '' | '/' ? never : AddLeadingSlash> : TTo & `../${string}` extends never ? AddLeadingSlash> : TFrom extends '' | '/' ? never : TTo extends `../${infer ToRest}` ? ResolveParentPath, ToRest> : AddLeadingSlash>; -// Warning: (ae-forgotten-export) The symbol "SieveCache" needs to be exported by the entry point index.d.ts -// -// @public -export function resolvePath(base: string, to: string, trailingSlash?: 'always' | 'never' | 'preserve', cache?: SieveCache): string; - // @public (undocumented) export type ResolveRelativePath = string extends TFrom ? TTo : string extends TTo ? TFrom : undefined extends TTo ? TFrom : TTo extends string ? TFrom extends string ? TTo extends `/${string}` ? TTo : TTo extends `..${string}` ? ResolveParentPath : TTo extends `.${string}` ? ResolveCurrentPath : AddLeadingSlash> : never : never; @@ -1434,18 +1057,6 @@ export type ResolveRoute = Assign, ContextAsyncReturnType>; -// @public (undocumented) -export type ResolveSearchSchema = unknown extends TSearchValidator ? TSearchValidator : TSearchValidator extends AnyStandardSchemaValidator ? NonNullable['output'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['output'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFn : ResolveSearchSchemaFn; - -// @public (undocumented) -export type ResolveSearchSchemaFn = TSearchValidator extends (...args: any) => infer TSearchSchema ? TSearchSchema : AnySchema; - -// @public (undocumented) -export type ResolveSearchSchemaFnInput = TSearchValidator extends (input: infer TSearchSchemaInput) => any ? TSearchSchemaInput extends SearchSchemaInput ? Omit : ResolveSearchSchemaFn : AnySchema; - -// @public (undocumented) -export type ResolveSearchSchemaInput = TSearchValidator extends AnyStandardSchemaValidator ? NonNullable['input'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['input'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFnInput : ResolveSearchSchemaFnInput; - // @public (undocumented) export type ResolveSearchValidatorInput = TValidator extends AnyStandardSchemaValidator ? NonNullable['input'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['input'] : TValidator extends AnyValidatorObj ? ResolveSearchValidatorInputFn : ResolveSearchValidatorInputFn; @@ -1522,23 +1133,13 @@ export interface Route; // (undocumented) - children?: TChildren; - // (undocumented) - init: (originalIndex: number) => void; - // (undocumented) - isRoot: TParentRoute extends AnyRoute ? true : false; - // (undocumented) lazy: RouteLazyFn>; // (undocumented) lazyFn?: () => Promise>>; // (undocumented) - options: RouteOptions; - // (undocumented) parentRoute: TParentRoute; // (undocumented) path: TPath; - // (undocumented) - rank: number; redirect: RedirectFnRoute; // (undocumented) to: TrimPathRight; @@ -1586,9 +1187,6 @@ export type RouteConstraints = { export interface RouteContext { } -// @public (undocumented) -export type RouteContextFn = (ctx: RouteContextOptions) => any; - // @public (undocumented) export interface RouteContextOptions extends ContextOptions { // (undocumented) @@ -1616,9 +1214,6 @@ export type RouteIds = InferFileRouteTypes = (lazyFn: () => Promise>) => TRoute; -// @public (undocumented) -export type RouteLinkEntry = {}; - // @public (undocumented) export type RouteLoaderEntry = RouteLoaderFn | RouteLoaderObject; @@ -1650,30 +1245,18 @@ export interface RouteMatch; - // (undocumented) id: string; // (undocumented) - index: number; - // (undocumented) - invalid: boolean; - // (undocumented) isFetching: false | 'beforeLoad' | 'loader'; // (undocumented) loaderData?: TLoaderData; // (undocumented) - loaderDeps: TLoaderDeps; - // (undocumented) - _notFound?: boolean; - // (undocumented) params: TAllParams; // (undocumented) paramsError: unknown; // (undocumented) pathname: string; // (undocumented) - preload: boolean; - // (undocumented) routeId: TRouteId; // (undocumented) search: TFullSearchSchema; @@ -1685,10 +1268,6 @@ export interface RouteMatch = { id: TCustomId; }; -// @public (undocumented) -export type RoutePathOptionsIntersection = { - path: TPath; - id: TCustomId; -}; - // Warning: (ae-forgotten-export) The symbol "CodeRoutePaths" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -1725,32 +1298,6 @@ export type RoutePrefix = string e // @public (undocumented) export type RouterBatchFn = (fn: () => void) => void; -// @public (undocumented) -export interface RouterConfig { - // (undocumented) - '~types': RouterConfigTypes; - // (undocumented) - defaultSsr: TDefaultSsr | undefined; - // (undocumented) - serializationAdapters: TSerializationAdapters; -} - -// @public (undocumented) -export interface RouterConfigOptions { - // (undocumented) - defaultSsr?: TDefaultSsr; - // (undocumented) - serializationAdapters?: TSerializationAdapters; -} - -// @public (undocumented) -export interface RouterConfigTypes { - // (undocumented) - defaultSsr: TDefaultSsr; - // (undocumented) - serializationAdapters: TSerializationAdapters; -} - // @public (undocumented) export type RouterConstructorOptions> = Omit, 'context' | 'serializationAdapters' | 'defaultSsr'> & RouterContextOptions; @@ -1765,66 +1312,21 @@ export type RouterContextOptions = AnyContext exten // @public (undocumented) export interface RouterCore = Record> { - // Warning: (ae-forgotten-export) The symbol "LoaderFlight" needs to be exported by the entry point index.d.ts - _flights?: Map; - // Warning: (ae-forgotten-export) The symbol "HydrationHandoff" needs to be exported by the entry point index.d.ts - _handoff?: HydrationHandoff; - _lifecycleEnd?: number; - // Warning: (ae-forgotten-export) The symbol "PendingSession" needs to be exported by the entry point index.d.ts - _pending?: PendingSession; - _preflight?: AbortController; - _preloads?: Map>; - _refreshRoute: (() => Promise) | undefined; - _rendered?: [ - offered?: Array, - settle?: (rendered: boolean) => void - ]; - _replaceRouteChunk: ((route: AnyRoute, lazyFn: AnyRoute['lazyFn']) => void) | undefined; - // Warning: (ae-forgotten-export) The symbol "ServerLoadResult" needs to be exported by the entry point index.d.ts - _serverResult?: ServerLoadResult; - // (undocumented) - shouldViewTransition?: boolean | ViewTransitionOptions; - // Warning: (ae-forgotten-export) The symbol "LoadTransaction" needs to be exported by the entry point index.d.ts - _tx?: LoadTransaction; } // @public export class RouterCore = Record> { // @deprecated constructor(options: RouterConstructorOptions, getStoreConfig: GetStoreConfig); - // (undocumented) - basepath: string; - // (undocumented) - batch: (fn: () => void) => void; - buildAndCommitLocation: (input?: BuildNextOptions & CommitLocationOptions) => Promise; buildLocation: BuildLocationFn; - // Warning: (ae-forgotten-export) The symbol "RouteTreeCaches" needs to be exported by the entry point index.d.ts - // - // (undocumented) - buildRouteTree: () => RouteTreeCaches; - _cache: Map; // (undocumented) clearCache: ClearCacheFn; - commitLocation: CommitLocationFn; - // (undocumented) - _commitPromise: (Promise & { - resolve: () => void; - }) | undefined; - _committed: Array; - // (undocumented) - emit: EmitFn; - // (undocumented) - getMatchedRoutes: GetMatchRoutesFn; // (undocumented) history: TRouterHistory; invalidate: InvalidateFn>; // (undocumented) - isServer: boolean; - // (undocumented) isShell(): boolean; // (undocumented) - latestLocation: ParsedLocation>; - // (undocumented) load: LoadFn; // (undocumented) loadRouteChunk: (route: AnyRoute, componentType?: 'errorComponent' | 'notFoundComponent' | false) => Promise | undefined; @@ -1836,71 +1338,20 @@ export class RouterCore, 'stringifySearch' | 'parseSearch' | 'context'>; // (undocumented) - origin: string; - parseLocation: ParseLocationFn; - // (undocumented) - readonly pathParamsDecoder?: (encoded: string) => string; - // (undocumented) - _pendingLocation?: ParsedLocation>; - // (undocumented) preloadRoute: PreloadRouteFn; - // Warning: (ae-forgotten-export) The symbol "ProcessedTree" needs to be exported by the entry point index.d.ts - // - // (undocumented) - processedTree: ProcessedTree; - // (undocumented) - protocolAllowlist: Set; - // (undocumented) - resolvePathCache: SieveCache; - // (undocumented) - resolveRedirect: (redirect: AnyRedirect) => AnyRedirect; - // (undocumented) - rewrite?: LocationRewrite; // (undocumented) routesById: RoutesById; // (undocumented) - routesByPath: RoutesByPath; - // (undocumented) routeTree: TRouteTree; - // (undocumented) - _scroll: { - n: boolean; - h?: boolean; - e?: boolean; - s?: boolean; - r?: boolean; - }; // Warning: (ae-forgotten-export) The symbol "ServerSsr" needs to be exported by the entry point index.d.ts // // (undocumented) serverSsr?: ServerSsr; - // Warning: (ae-forgotten-export) The symbol "RouterSsrLifecycle" needs to be exported by the entry point index.d.ts - // - // (undocumented) - serverSsrLifecycle?: RouterSsrLifecycle; - // (undocumented) - setRoutes(caches: RouteTreeCaches): void; - // (undocumented) - ssr?: { - manifest: Manifest | undefined; - }; - // (undocumented) - startTransition: StartTransitionFn; - // (undocumented) - startViewTransition: (fn: () => Promise) => any; // (undocumented) get state(): RouterState; - // (undocumented) - stores: RouterStores; subscribe: SubscribeFn; // (undocumented) - subscribers: Set>; - // (undocumented) - tempLocationKey: string | undefined; - // (undocumented) update: UpdateFn; - // (undocumented) - updateLatestLocation: () => void; } // @public (undocumented) @@ -1936,17 +1387,6 @@ export interface RouterEvents { } & NavigationEventInfo; } -// @public (undocumented) -export type RouterListener = { - eventType: TRouterEvent['type']; - fn: ListenerFn; -}; - -// @public (undocumented) -export type RouterManagedInlineCssTag = RouterManagedStyleTag & { - inlineCss: true; -}; - // @public (undocumented) export type RouterManagedLinkTag = { tag: 'link'; @@ -1988,8 +1428,6 @@ export type RouterManagedTitleTag = { // @public (undocumented) export interface RouterOptions extends RouterOptionsExtensions { - // (undocumented) - additionalContext?: any; basepath?: string; caseSensitive?: boolean; context?: InferRouterContext; @@ -2013,9 +1451,6 @@ export interface RouterOptions string; history?: TRouterHistory; hydrate?: (dehydrated: TDehydrated) => Awaitable; - isPrerendering?: boolean; - isServer?: boolean; - isShell?: boolean; notFoundMode?: 'root' | 'fuzzy'; // @deprecated notFoundRoute?: AnyRoute; @@ -2072,31 +1507,6 @@ export interface RouterState { - // (undocumented) - __store: RouterReadableStore>; - // Warning: (ae-forgotten-export) The symbol "MatchStore" needs to be exported by the entry point index.d.ts - // - // (undocumented) - byRoute: Map; - getMatchStore: (routeId: string) => RouterReadableStore; - // (undocumented) - ids: RouterWritableStore>; - // (undocumented) - location: RouterWritableStore>>; - // Warning: (ae-forgotten-export) The symbol "ReadableStore" needs to be exported by the entry point index.d.ts - // - // (undocumented) - matches: ReadableStore>; - // (undocumented) - resolvedLocation: RouterWritableStore> | undefined>; - // (undocumented) - setMatches: (nextMatches: Array) => void; - // (undocumented) - status: RouterWritableStore['status']>; -} - // @public (undocumented) export interface RouterWritableStore extends RouterReadableStore { // (undocumented) @@ -2225,9 +1635,6 @@ export type SearchSchemaInput = { // @public (undocumented) export type SearchSerializer = (searchObj: Record) => string; -// @public (undocumented) -export type SearchValidator = ValidatorObj | ValidatorFn | ValidatorAdapter | StandardSchemaValidator | undefined; - // @public (undocumented) export type Serializable = SerializableExtensions[keyof SerializableExtensions]; @@ -2281,9 +1688,6 @@ export type ServerManifestInlineCss = { // @public (undocumented) export type ServerManifestRoute = ManifestRoute; -// @public (undocumented) -export function setupScrollRestoration(router: AnyRouter, force?: boolean): void; - // @public (undocumented) export interface SsrContextOptions { // (undocumented) @@ -2335,16 +1739,10 @@ export interface StandardSchemaValidatorTypes { readonly output: TOutput; } -// @public (undocumented) -export type StartTransitionFn = (fn: () => void, expected: Array) => Promise; - // @public (undocumented) export interface StaticDataRouteOption { } -// @public (undocumented) -export const storageKey = "tsr-scroll-restoration-v1_3"; - // @public (undocumented) export type StrictOrFrom = TStrict extends false ? { from?: never; @@ -2360,9 +1758,6 @@ export type StringifyParamsFn = (pa // @public export function stringifySearchWith(stringify: (search: any) => string, parser?: (str: string) => any): (search: Record) => string; -// @public (undocumented) -export type StringLiteral = T extends string ? string extends T ? string : T : never; - // @public export function stripSearchParams>, const TValues = Partial> | Array, const TInput = IsRequiredParams extends never ? TValues | true : TValues>(input: NoInfer_2): SearchMiddleware; @@ -2375,9 +1770,6 @@ export type ThrowConstraint = T // @public (undocumented) export type ThrowOrOptional = TThrow extends true ? T : T | undefined; -// @public (undocumented) -export type Timeout = ReturnType; - // @public (undocumented) export type ToMaskOptions = ToSubOptions & { unmaskOnReload?: boolean; @@ -2399,43 +1791,25 @@ export type ToSubOptionsProps; state?: true | NonNullableUpdater; from?: FromPathOption & {}; - unsafeRelative?: 'path'; }; +// Warning: (ae-forgotten-export) The symbol "trailingSlashOptions" needs to be exported by the entry point index.d.ts +// // @public (undocumented) export type TrailingSlashOption = (typeof trailingSlashOptions)[keyof typeof trailingSlashOptions]; // @public (undocumented) export type TrailingSlashOptionByRouter = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable; -// @public -export const trailingSlashOptions: { - readonly always: "always"; - readonly never: "never"; - readonly preserve: "preserve"; -}; - // @public (undocumented) export type TrimPath = '' extends T ? '' : TrimPathRight>; -// @public -export function trimPath(path: string): string; - // @public (undocumented) export type TrimPathLeft = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft : T extends `/${infer U}` ? TrimPathLeft : T; -// @public -export function trimPathLeft(path: string): string; - // @public (undocumented) export type TrimPathRight = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight : T; -// @public -export function trimPathRight(path: string): string; - -// @public -export const TSR_DEFERRED_PROMISE: unique symbol; - // Warning: (ae-forgotten-export) The symbol "TSR_SERIALIZABLE_2" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -2552,9 +1926,6 @@ export type UseSearchResult = FromPathOption; -// @public (undocumented) -export type ValidateId = ConstrainLiteral>; - // @public (undocumented) export type ValidateJSON = ((...args: Array) => any) extends T ? unknown extends T ? never : 'Function is not serializable' : { [K in keyof T]: ValidateJSON; @@ -2563,25 +1934,9 @@ export type ValidateJSON = ((...args: Array) => any) extends T ? unknown // @public (undocumented) export type ValidateNavigateOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; -// @public (undocumented) -export type ValidateNavigateOptionsArray = ReadonlyArray, TDefaultFrom extends string = string> = { - [K in keyof TOptions]: ValidateNavigateOptions; -}; - -// @public (undocumented) -export type ValidateParams = PathParamOptions; - // @public (undocumented) export type ValidateRedirectOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; -// @public (undocumented) -export type ValidateRedirectOptionsArray = ReadonlyArray, TDefaultFrom extends string = string> = { - [K in keyof TOptions]: ValidateRedirectOptions; -}; - -// @public (undocumented) -export type ValidateSearch = SearchParamOptions; - // Warning: (ae-forgotten-export) The symbol "RegisteredReadableStream" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ValidateSerializableArray" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ValidateSerializablePromise" needs to be exported by the entry point index.d.ts @@ -2597,15 +1952,6 @@ export type ValidateSerializable = T extends TSerializable ? T // @public (undocumented) export type ValidateSerializableInput = ValidateSerializable>; -// @public (undocumented) -export type ValidateToPath = ToPathOption; - -// @public (undocumented) -export type ValidateUseParamsResult = Constrain, InferStrict, InferSelected>>; - -// @public (undocumented) -export type ValidateUseSearchResult = UseSearchResult, InferStrict, InferSelected>; - // @public (undocumented) export type Validator = ValidatorObj | ValidatorFn | ValidatorAdapter | StandardSchemaValidator | undefined; @@ -2641,14 +1987,12 @@ export interface ViewTransitionOptions { }) => Array | false); } -// @public (undocumented) -export type WithoutEmpty = T extends any ? ({} extends T ? never : T) : never; - // Warnings were encountered during analysis: // +// dist/esm/defer.d.ts:36:5 - (ae-forgotten-export) The symbol "defaultSerializeError" needs to be exported by the entry point index.d.ts +// dist/esm/manifest.d.ts:84:5 - (ae-forgotten-export) The symbol "DEV_STYLES_ATTR" needs to be exported by the entry point index.d.ts // dist/esm/route.d.ts:45:5 - (ae-forgotten-export) The symbol "SearchMiddlewareMeta" needs to be exported by the entry point index.d.ts // dist/esm/route.d.ts:89:9 - (ae-forgotten-export) The symbol "ValidateParsedParams" needs to be exported by the entry point index.d.ts -// dist/esm/route.d.ts:129:5 - (ae-forgotten-export) The symbol "LdJsonObject" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) @@ -2667,14 +2011,6 @@ declare global { } } -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - // router.d.ts declare global { var __TSR_CACHE__: { diff --git a/packages/router-core/api/isServer/client.api.md b/packages/router-core/api/isServer/client.api.md index 5cd8cae5bb9..80fbf4bd1c6 100644 --- a/packages/router-core/api/isServer/client.api.md +++ b/packages/router-core/api/isServer/client.api.md @@ -11,12 +11,6 @@ ```ts -// @public (undocumented) -export const isServer = false; - -// @public (undocumented) -export const loadServerRoute: never; - // (No @packageDocumentation comment for this package) ``` diff --git a/packages/router-core/api/isServer/development.api.md b/packages/router-core/api/isServer/development.api.md index 5555559760d..76374d5f8c3 100644 --- a/packages/router-core/api/isServer/development.api.md +++ b/packages/router-core/api/isServer/development.api.md @@ -10,46 +10,6 @@ ```ts -import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; -import { HistoryState } from '@tanstack/history'; -import { ParsedHistoryState } from '@tanstack/history'; -import { RouterHistory } from '@tanstack/history'; - -// @public (undocumented) -export const isServer: boolean | undefined; - -// Warning: (ae-forgotten-export) The symbol "AnyRouter" needs to be exported by the entry point development.d.ts -// Warning: (ae-forgotten-export) The symbol "ServerLoadOptions" needs to be exported by the entry point development.d.ts -// -// @public (undocumented) -export function loadServerRoute(router: AnyRouter, opts?: ServerLoadOptions): Promise; - // (No @packageDocumentation comment for this package) ``` - -## Augmentations - -> The `declare module` and `declare global` blocks in the declaration files that this entry reaches in `dist/esm`, which API Extractor leaves out of the report above. Paths are relative to `dist/esm`. - -```ts - -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - -// router.d.ts -declare global { - var __TSR_CACHE__: { - routeTree: AnyRoute; - caseSensitive: boolean | undefined; - processRouteTreeResult: RouteTreeCaches; - } | undefined; -} - -``` diff --git a/packages/router-core/api/isServer/server.api.md b/packages/router-core/api/isServer/server.api.md index e5fab88e9ab..2ac3bd044d4 100644 --- a/packages/router-core/api/isServer/server.api.md +++ b/packages/router-core/api/isServer/server.api.md @@ -14,46 +14,6 @@ ```ts -import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; -import { HistoryState } from '@tanstack/history'; -import { ParsedHistoryState } from '@tanstack/history'; -import { RouterHistory } from '@tanstack/history'; - -// @public (undocumented) -export const isServer: boolean | undefined; - -// Warning: (ae-forgotten-export) The symbol "AnyRouter" needs to be exported by the entry point server.d.ts -// Warning: (ae-forgotten-export) The symbol "ServerLoadOptions" needs to be exported by the entry point server.d.ts -// -// @public (undocumented) -export function loadServerRoute(router: AnyRouter, opts?: ServerLoadOptions): Promise; - // (No @packageDocumentation comment for this package) ``` - -## Augmentations - -> The `declare module` and `declare global` blocks in the declaration files that this entry reaches in `dist/esm`, which API Extractor leaves out of the report above. Paths are relative to `dist/esm`. - -```ts - -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - -// router.d.ts -declare global { - var __TSR_CACHE__: { - routeTree: AnyRoute; - caseSensitive: boolean | undefined; - processRouteTreeResult: RouteTreeCaches; - } | undefined; -} - -``` diff --git a/packages/router-core/api/scroll-restoration-script/client.api.md b/packages/router-core/api/scroll-restoration-script/client.api.md index 2786d379233..50910caae68 100644 --- a/packages/router-core/api/scroll-restoration-script/client.api.md +++ b/packages/router-core/api/scroll-restoration-script/client.api.md @@ -10,42 +10,6 @@ ```ts -import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; -import { HistoryState } from '@tanstack/history'; -import { ParsedHistoryState } from '@tanstack/history'; -import { RouterHistory } from '@tanstack/history'; - -// Warning: (ae-forgotten-export) The symbol "AnyRouter" needs to be exported by the entry point client.d.ts -// -// @public (undocumented) -export function getScrollRestorationScriptForRouter(_router: AnyRouter): null; - // (No @packageDocumentation comment for this package) ``` - -## Augmentations - -> The `declare module` and `declare global` blocks in the declaration files that this entry reaches in `dist/esm`, which API Extractor leaves out of the report above. Paths are relative to `dist/esm`. - -```ts - -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - -// router.d.ts -declare global { - var __TSR_CACHE__: { - routeTree: AnyRoute; - caseSensitive: boolean | undefined; - processRouteTreeResult: RouteTreeCaches; - } | undefined; -} - -``` diff --git a/packages/router-core/api/scroll-restoration-script/server.api.md b/packages/router-core/api/scroll-restoration-script/server.api.md index 86b663bc1eb..1b3664aea6d 100644 --- a/packages/router-core/api/scroll-restoration-script/server.api.md +++ b/packages/router-core/api/scroll-restoration-script/server.api.md @@ -10,42 +10,6 @@ ```ts -import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; -import { HistoryState } from '@tanstack/history'; -import { ParsedHistoryState } from '@tanstack/history'; -import { RouterHistory } from '@tanstack/history'; - -// Warning: (ae-forgotten-export) The symbol "AnyRouter" needs to be exported by the entry point server.d.ts -// -// @public (undocumented) -export function getScrollRestorationScriptForRouter(router: AnyRouter): string | null; - // (No @packageDocumentation comment for this package) ``` - -## Augmentations - -> The `declare module` and `declare global` blocks in the declaration files that this entry reaches in `dist/esm`, which API Extractor leaves out of the report above. Paths are relative to `dist/esm`. - -```ts - -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - -// router.d.ts -declare global { - var __TSR_CACHE__: { - routeTree: AnyRoute; - caseSensitive: boolean | undefined; - processRouteTreeResult: RouteTreeCaches; - } | undefined; -} - -``` diff --git a/packages/router-core/api/ssr/client.api.md b/packages/router-core/api/ssr/client.api.md index 4aab3883605..578577d3079 100644 --- a/packages/router-core/api/ssr/client.api.md +++ b/packages/router-core/api/ssr/client.api.md @@ -11,34 +11,20 @@ ```ts import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; import { OutgoingHttpHeaders } from 'node:http2'; import { ParsedHistoryState } from '@tanstack/history'; import { Plugin as Plugin_2 } from 'seroval'; -import { PluginInfo } from 'seroval'; import { RouterHistory } from '@tanstack/history'; -import { SerovalNode } from 'seroval'; // Warning: (ae-forgotten-export) The symbol "SerializationAdapter" needs to be exported by the entry point client.d.ts // // @public (undocumented) export type AnySerializationAdapter = SerializationAdapter; -// @public -export function createDefaultSerovalPlugins(signal?: AbortSignal): Array>; - -// Warning: (ae-forgotten-export) The symbol "RawStreamRPCNode" needs to be exported by the entry point client.d.ts -// -// @public -export function createRawStreamDeserializePlugin(getStream: (id: number) => ReadableStream): Plugin_2>, RawStreamRPCNode>; - // @public export const defaultSerovalDeserializerPlugins: Array>; -// @public (undocumented) -export const defaultSerovalPlugins: Plugin_2[]; - // @public (undocumented) export interface DehydratedMatch { // (undocumented) @@ -85,11 +71,6 @@ export interface JsonResponse extends Response { json: () => Promise; } -// Warning: (ae-forgotten-export) The symbol "AdapterNode" needs to be exported by the entry point client.d.ts -// -// @public -export function makeSerovalPlugin(serializationAdapter: AnySerializationAdapter): Plugin_2; - // Warning: (ae-forgotten-export) The symbol "AnyHeaders" needs to be exported by the entry point client.d.ts // // @public (undocumented) diff --git a/packages/router-core/api/ssr/server.api.md b/packages/router-core/api/ssr/server.api.md index 41036812a39..6861783032d 100644 --- a/packages/router-core/api/ssr/server.api.md +++ b/packages/router-core/api/ssr/server.api.md @@ -11,15 +11,11 @@ ```ts import { HistoryAction } from '@tanstack/history'; -import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; import { ParsedHistoryState } from '@tanstack/history'; -import { Plugin as Plugin_2 } from 'seroval'; -import { PluginInfo } from 'seroval'; import { Readable } from 'node:stream'; import { ReadableStream as ReadableStream_2 } from 'node:stream/web'; import { RouterHistory } from '@tanstack/history'; -import { SerovalNode } from 'seroval'; // @public (undocumented) export function attachRouterServerSsrUtils(input: { @@ -28,16 +24,6 @@ export function attachRouterServerSsrUtils(input: { getRequestAssets?: () => ManifestRouteAssets | undefined; }): void; -// @public (undocumented) -export function bindSsrResponseToRequest(router: AnyRouter | undefined, result: HandlerCallbackResult, signal: AbortSignal): SsrResponse; - -// Warning: (ae-forgotten-export) The symbol "OnRawStreamCallback" needs to be exported by the entry point server.d.ts -// Warning: (ae-forgotten-export) The symbol "RawStream" needs to be exported by the entry point server.d.ts -// Warning: (ae-forgotten-export) The symbol "RawStreamRPCNode" needs to be exported by the entry point server.d.ts -// -// @public -export function createRawStreamRPCPlugin(onRawStream: OnRawStreamCallback): Plugin_2; - // @public (undocumented) export function createRequestHandler(input: { createRouter: () => TRouter; @@ -45,32 +31,9 @@ export function createRequestHandler(input: { getRouterManifest?: () => ServerManifest | Promise; }): RequestHandler; -// @public (undocumented) -export function createSsrStreamResponse(router: AnyRouter, response: Response): Extract; - -// @public -export const defaultSerovalDeserializerPlugins: Array>; - // @public (undocumented) export function defineHandlerCallback(handler: HandlerCallback): HandlerCallback; -// @public (undocumented) -export function disposeSsrResponse(result: HandlerCallbackResult, reason?: unknown): undefined; - -// @public (undocumented) -export function getNormalizedURL(url: string | URL, base?: string | URL): { - url: URL; - handledProtocolRelativeURL: boolean; -}; - -// @public -export function getOrigin(request: Request): string; - -// @public -export function getSsrStatus(router: AnyRouter): 500 | 200 | 404; - // @public (undocumented) export interface HandlerCallback { // (undocumented) @@ -84,32 +47,6 @@ export interface HandlerCallback { // @public (undocumented) export type HandlerCallbackResult = Response | SsrResponse; -// @public (undocumented) -export function isSsrResponse(value: unknown): value is SsrResponse; - -// Warning: (ae-forgotten-export) The symbol "AnySerializationAdapter" needs to be exported by the entry point server.d.ts -// Warning: (ae-forgotten-export) The symbol "AdapterNode" needs to be exported by the entry point server.d.ts -// -// @public -export function makeSsrSerovalPlugin(serializationAdapter: AnySerializationAdapter, tracker?: { - didRun: boolean; -}): Plugin_2; - -// @public (undocumented) -export function normalizeSsrResponse(result: HandlerCallbackResult): SsrResponse; - -// @public (undocumented) -export function renderSsrHtmlResponse(input: { - router: AnyRouter; - responseHeaders: Headers; - render: () => string | Promise; -}): Promise; - -// @public (undocumented) -export function replaceSsrResponse(result: HandlerCallbackResult, response: Response, reason?: unknown): Extract; - // @public (undocumented) export type RequestHandler = (cb: HandlerCallback) => Promise; @@ -123,14 +60,6 @@ export type SsrResponse = { dispose: (reason?: unknown) => undefined; }; -// @public (undocumented) -export function stripSsrResponseBody(result: HandlerCallbackResult, reason?: unknown): Extract; - -// @public (undocumented) -export function transformHtmlStringWithRouter(router: AnyRouter, html: string, opts?: TransformStreamWithRouterOptions): Promise; - // @public (undocumented) export function transformPipeableStreamWithRouter(router: AnyRouter, routerStream: Readable, opts?: TransformStreamWithRouterOptions): Readable; @@ -148,9 +77,6 @@ export type TransformStreamWithRouterOptions = { onAbort?: (reason?: unknown) => void; }; -// @public -export function waitForRequest(value: T | PromiseLike, signal: AbortSignal, onLate?: (value: T) => unknown, onLateError?: (reason: unknown) => unknown): Promise; - // Warnings were encountered during analysis: // // dist/esm/ssr/ssr-server.d.ts:7:5 - (ae-forgotten-export) The symbol "AnyRouter" needs to be exported by the entry point server.d.ts @@ -167,14 +93,6 @@ export function waitForRequest(value: T | PromiseLike, signal: AbortSignal ```ts -// load-client.d.ts -declare global { - interface Window { - [GLOBAL_TSR]?: TsrSsrGlobal; - [GLOBAL_SEROVAL]?: any; - } -} - // router.d.ts declare global { var __TSR_CACHE__: { diff --git a/packages/router-core/src/Matches.ts b/packages/router-core/src/Matches.ts index 41fd4018b51..f7a88ed0b03 100644 --- a/packages/router-core/src/Matches.ts +++ b/packages/router-core/src/Matches.ts @@ -127,9 +127,11 @@ export interface RouteMatch< id: string routeId: TRouteId fullPath: TFullPath + /** @internal */ index: number pathname: string params: TAllParams + /** @internal */ _strictParams: TAllParams status: 'pending' | 'success' | 'error' | 'notFound' isFetching: false | 'beforeLoad' | 'loader' @@ -146,13 +148,19 @@ export interface RouteMatch< __beforeLoadContext?: Record context: TAllContext search: TFullSearchSchema + /** @internal */ _strictSearch: TFullSearchSchema abortController: AbortController cause: 'preload' | 'enter' | 'stay' + /** @internal */ loaderDeps: TLoaderDeps + /** @internal */ preload: boolean + /** @internal */ invalid: boolean + /** @internal */ headers?: Record + /** @internal */ _notFound?: boolean staticData: StaticDataRouteOption /** This attribute is not reactive */ diff --git a/packages/router-core/src/RouterProvider.ts b/packages/router-core/src/RouterProvider.ts index 52aeaffabb3..4c96bafa119 100644 --- a/packages/router-core/src/RouterProvider.ts +++ b/packages/router-core/src/RouterProvider.ts @@ -17,6 +17,7 @@ export interface CommitLocationOptions { viewTransition?: boolean | ViewTransitionOptions /** * @deprecated All navigations use transitions under the hood now + * @internal **/ startTransition?: boolean ignoreBlocker?: boolean @@ -41,7 +42,9 @@ export type BuildLocationFn = < >( opts: ToOptions & { leaveParams?: boolean + /** @internal */ _includeValidateSearch?: boolean + /** @internal */ _isNavigate?: boolean }, ) => ParsedLocation diff --git a/packages/router-core/src/config.ts b/packages/router-core/src/config.ts index d6c41fb40f6..910a36d95a7 100644 --- a/packages/router-core/src/config.ts +++ b/packages/router-core/src/config.ts @@ -1,6 +1,7 @@ import type { SSROption } from './router' import type { AnySerializationAdapter } from './ssr/serializer/transformer' +/** @internal */ export interface RouterConfigOptions< in out TSerializationAdapters, in out TDefaultSsr, @@ -9,6 +10,7 @@ export interface RouterConfigOptions< defaultSsr?: TDefaultSsr } +/** @internal */ export interface RouterConfig< in out TSerializationAdapters, in out TDefaultSsr, @@ -18,6 +20,7 @@ export interface RouterConfig< defaultSsr: TDefaultSsr | undefined } +/** @internal */ export interface RouterConfigTypes< in out TSerializationAdapters, in out TDefaultSsr, @@ -26,6 +29,7 @@ export interface RouterConfigTypes< defaultSsr: TDefaultSsr } +// @internal export const createRouterConfig = < const TSerializationAdapters extends ReadonlyArray = [], @@ -39,4 +43,5 @@ export const createRouterConfig = < } as RouterConfig } +/** @internal */ export type AnyRouterConfig = RouterConfig diff --git a/packages/router-core/src/index.ts b/packages/router-core/src/index.ts index 9206ef60dd8..99f025822cb 100644 --- a/packages/router-core/src/index.ts +++ b/packages/router-core/src/index.ts @@ -1,8 +1,12 @@ export * from './global' -export { TSR_DEFERRED_PROMISE, defer } from './defer' +export { defer } from './defer' +/** @internal */ +export { TSR_DEFERRED_PROMISE } from './defer' export type { DeferredPromiseState, DeferredPromise } from './defer' +/** @internal */ export { invariant } from './invariant' +/** @internal */ export { preloadWarning } from './link' export type { IsRequiredParams, @@ -61,11 +65,12 @@ export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, - CreateFileRoute, LazyRoute, LazyRouteOptions, - CreateLazyFileRoute, + CreateFileRoute, } from './fileRoute' +/** @internal */ +export type { CreateLazyFileRoute } from './fileRoute' export type { ParsedLocation } from './location' export type { @@ -82,7 +87,6 @@ export type { RouterManagedTag, RouterManagedTitleTag, RouterManagedMetaTag, - RouterManagedInlineCssTag, RouterManagedScriptTag, RouterManagedLinkTag, RouterManagedStyleTag, @@ -91,6 +95,9 @@ export type { ManifestAssetLink, ScriptFormat, } from './manifest' +/** @internal */ +export type { RouterManagedInlineCssTag } from './manifest' +/** @internal */ export { DEV_STYLES_ATTR, appendUniqueUserTags, @@ -103,11 +110,13 @@ export { resolveManifestCssLink, } from './manifest' export { isMatch } from './Matches' +/** @internal */ export { _getAssetMatches, _getRenderedMatches, _isRouteDeparting, } from './load-client' +/** @internal */ export { composeSsrBodyScripts, getSsrBodyScriptParts } from './ssr/bodyScripts' export type { AnyMatchAndValue, @@ -128,6 +137,7 @@ export type { MakeRouteMatchFromRoute, MatchRouteOptions, } from './Matches' +/** @internal */ export { joinPaths, cleanPath, @@ -141,6 +151,7 @@ export { getRouteSegments, hasMissingPathParams, } from './path' +/** @internal */ export { encode, decode } from './qss' export { rootRouteId } from './root' export type { RootRouteId } from './root' @@ -151,10 +162,8 @@ export type { SearchSchemaInput, AnyContext, RouteContext, - PreloadableObj, RoutePathOptions, StaticDataRouteOption, - RoutePathOptionsIntersection, SearchFilter, SearchMiddlewareContext, SearchMiddleware, @@ -163,12 +172,6 @@ export type { InferFullSearchSchemaInput, InferAllParams, InferAllContext, - MetaDescriptor, - RouteLinkEntry, - SearchValidator, - AnySearchValidator, - DefaultSearchValidator, - ErrorRouteProps, ErrorComponentProps, DefaultErrorBoundaryTypes, ErrorBoundaryTypes, @@ -186,10 +189,6 @@ export type { TrimPath, TrimPathLeft, TrimPathRight, - ResolveSearchSchemaFnInput, - ResolveSearchSchemaInput, - ResolveSearchSchemaFn, - ResolveSearchSchema, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllContext, @@ -203,16 +202,13 @@ export type { RemountDepsOptions, MakeRemountDepsOptionsUnion, ResolveFullPath, - AnyRouteWithContext, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, LoaderStaleReloadMode, RouteLoaderFn, - RouteLoaderEntry, LoaderFnContext, - RouteContextFn, ContextOptions, RouteContextOptions, SsrContextOptions, @@ -232,7 +228,26 @@ export type { ResolveRequiredParams, RootRoute, FilebaseRouteOptionsInterface, + RouteLoaderEntry, } from './route' +/** @internal */ +export type { + PreloadableObj, + RoutePathOptionsIntersection, + MetaDescriptor, + RouteLinkEntry, + SearchValidator, + AnySearchValidator, + DefaultSearchValidator, + ErrorRouteProps, + ResolveSearchSchemaFnInput, + ResolveSearchSchemaInput, + ResolveSearchSchemaFn, + ResolveSearchSchema, + AnyRouteWithContext, + RouteContextFn, +} from './route' +/** @internal */ export { createNonReactiveMutableStore, createNonReactiveReadonlyStore, @@ -241,16 +256,15 @@ export type { RouterBatchFn, RouterReadableStore, GetStoreConfig, - RouterStores, RouterWritableStore, } from './stores' +/** @internal */ +export type { RouterStores } from './stores' +export { RouterCore, lazyFn, SearchParamError, PathParamError } from './router' +/** @internal */ export { defaultSerializeError, getLocationChangeInfo, - RouterCore, - lazyFn, - SearchParamError, - PathParamError, getInitialRouterState, trailingSlashOptions, } from './router' @@ -260,11 +274,9 @@ export type { TrailingSlashOption, Register, AnyRouter, - AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, - RouterListener, RouterEvent, ListenerFn, RouterEvents, @@ -277,30 +289,32 @@ export type { RouterOptions, RouterConstructorOptions, UpdateFn, - ParseLocationFn, InvalidateFn, - ControllablePromise, - EmitFn, LoadFn, SubscribeFn, - CommitLocationFn, - GetMatchRoutesFn, MatchRoutesFn, - StartTransitionFn, - LoadRouteChunkFn, ClearCacheFn, CreateRouterFn, SSROption, } from './router' +/** @internal */ +export type { + AnyRouterWithContext, + RouterListener, + ParseLocationFn, + ControllablePromise, + EmitFn, + CommitLocationFn, + GetMatchRoutesFn, + StartTransitionFn, + LoadRouteChunkFn, +} from './router' export * from './config' -export type { - MatchLocation, - CommitLocationOptions, - NavigateFn, - BuildLocationFn, -} from './RouterProvider' +export type { NavigateFn, BuildLocationFn } from './RouterProvider' +/** @internal */ +export type { MatchLocation, CommitLocationOptions } from './RouterProvider' export { retainSearchParams, stripSearchParams } from './searchMiddleware' @@ -314,6 +328,8 @@ export type { SearchSerializer, SearchParser } from './searchParams' export type { OptionalStructuralSharing } from './structuralSharing' +export { DEFAULT_PROTOCOL_ALLOWLIST } from './utils' +/** @internal */ export { functionalUpdate, hasKeys, @@ -322,7 +338,6 @@ export { createControlledPromise, isPromise, isModuleNotFoundError, - DEFAULT_PROTOCOL_ALLOWLIST, escapeHtml, getUrlScheme, isDangerousProtocol, @@ -330,25 +345,18 @@ export { } from './utils' export type { NoInfer, - IsAny, PickAsRequired, - PickRequired, PickOptional, - WithoutEmpty, Expand, DeepPartial, MakeDifferenceOptional, - IsUnion, IsNonEmptyObject, Assign, IntersectAssign, - Timeout, Updater, NonNullableUpdater, - StringLiteral, ThrowOrOptional, ThrowConstraint, - ControlledPromise, ExtractObjects, PartialMergeAllObject, MergeAllPrimitive, @@ -356,14 +364,24 @@ export type { PartialMergeAll, Constrain, ConstrainLiteral, - UnionToIntersection, - MergeAllObjects, - MergeAll, ValidateJSON, StrictOrFrom, LooseReturnType, LooseAsyncReturnType, Awaitable, + UnionToIntersection, +} from './utils' +/** @internal */ +export type { + IsAny, + PickRequired, + WithoutEmpty, + IsUnion, + Timeout, + StringLiteral, + ControlledPromise, + MergeAllObjects, + MergeAll, } from './utils' export type { @@ -374,13 +392,11 @@ export type { AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, - AnyStandardSchemaValidateInput, AnyStandardSchemaValidate, ValidatorObj, AnyValidatorObj, ValidatorAdapter, AnyValidatorAdapter, - AnyValidatorFn, ValidatorFn, Validator, AnyValidator, @@ -388,10 +404,15 @@ export type { DefaultValidator, ResolveSearchValidatorInputFn, ResolveSearchValidatorInput, - ResolveValidatorInputFn, - ResolveValidatorInput, ResolveValidatorOutputFn, ResolveValidatorOutput, + ResolveValidatorInput, + ResolveValidatorInputFn, +} from './validators' +/** @internal */ +export type { + AnyStandardSchemaValidateInput, + AnyValidatorFn, } from './validators' export type { @@ -415,20 +436,19 @@ export type { RedirectOptions, RedirectOptionsRoute, RedirectFnRoute, - ResolvedRedirect, AnyRedirect, } from './redirect' +/** @internal */ +export type { ResolvedRedirect } from './redirect' -export { - redirect, - isRedirect, - isResolvedRedirect, - parseRedirect, -} from './redirect' +export { redirect, isRedirect } from './redirect' +/** @internal */ +export { isResolvedRedirect, parseRedirect } from './redirect' export type { NotFoundError } from './not-found' export { isNotFound, notFound } from './not-found' +/** @internal */ export { defaultGetScrollRestorationKey, getElementScrollRestorationEntry, @@ -443,21 +463,24 @@ export type { export type { ValidateFromPath, - ValidateToPath, - ValidateSearch, - ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, - ValidateNavigateOptionsArray, ValidateRedirectOptions, + InferSelected, + InferShouldThrow, + InferStrict, +} from './typePrimitives' +/** @internal */ +export type { + ValidateToPath, + ValidateSearch, + ValidateParams, + ValidateNavigateOptionsArray, ValidateRedirectOptionsArray, ValidateId, - InferStrict, - InferShouldThrow, - InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from './typePrimitives' @@ -478,6 +501,7 @@ export type { } from './ssr/serializer/transformer' export { createSerializationAdapter } from './ssr/serializer/transformer' +/** @internal */ export { makeSerovalPlugin } from './ssr/serializer/makeSerovalPlugin' export { RawStream } from './ssr/serializer/RawStream' @@ -487,5 +511,7 @@ export type { RawStreamOptions, } from './ssr/serializer/RawStream' -export { composeRewrites, executeRewriteInput } from './rewrite' +export { composeRewrites } from './rewrite' +/** @internal */ +export { executeRewriteInput } from './rewrite' export type { LocationRewrite, LocationRewriteFunction } from './router' diff --git a/packages/router-core/src/isServer/client.ts b/packages/router-core/src/isServer/client.ts index e12407f409c..5cf1a6f7684 100644 --- a/packages/router-core/src/isServer/client.ts +++ b/packages/router-core/src/isServer/client.ts @@ -1,2 +1,4 @@ +// @internal export const isServer = false +// @internal export const loadServerRoute: never = undefined as never diff --git a/packages/router-core/src/isServer/development.ts b/packages/router-core/src/isServer/development.ts index e4f13879ad6..6bdd52525c7 100644 --- a/packages/router-core/src/isServer/development.ts +++ b/packages/router-core/src/isServer/development.ts @@ -1,3 +1,5 @@ // Development/test mode - returns undefined so fallback to router.isServer is used +// @internal export const isServer: boolean | undefined = undefined +/** @internal */ export { loadServerRoute } from '../load-server' diff --git a/packages/router-core/src/isServer/server.ts b/packages/router-core/src/isServer/server.ts index d13401a9e91..432ce5aae06 100644 --- a/packages/router-core/src/isServer/server.ts +++ b/packages/router-core/src/isServer/server.ts @@ -1,2 +1,4 @@ +// @internal export const isServer = process.env.NODE_ENV === 'test' ? undefined : true +/** @internal */ export { loadServerRoute } from '../load-server' diff --git a/packages/router-core/src/link.ts b/packages/router-core/src/link.ts index 275eee8ddf1..c0f2bc9f4c8 100644 --- a/packages/router-core/src/link.ts +++ b/packages/router-core/src/link.ts @@ -321,7 +321,10 @@ export interface NavigateOptionProps { * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#resetscroll) */ resetScroll?: boolean - /** @deprecated All navigations now use startTransition under the hood */ + /** + * @deprecated All navigations now use startTransition under the hood + * @internal + */ startTransition?: boolean /** * If set to `true`, the router will wrap the resulting navigation in a `document.startViewTransition()` call. @@ -370,6 +373,7 @@ export interface MaskOptions< in out TMaskFrom extends string, in out TMaskTo extends string, > { + /** @internal */ _fromLocation?: ParsedLocation mask?: ToMaskOptions } @@ -438,6 +442,7 @@ export type ToSubOptionsProps< hash?: true | Updater state?: true | NonNullableUpdater from?: FromPathOption & {} + /** @internal */ unsafeRelative?: 'path' } diff --git a/packages/router-core/src/load-client.ts b/packages/router-core/src/load-client.ts index e84bb8fba59..1f250b19429 100644 --- a/packages/router-core/src/load-client.ts +++ b/packages/router-core/src/load-client.ts @@ -235,6 +235,7 @@ declare const matchPhase: unique symbol */ type SettledMatch = WorkMatch & { readonly [matchPhase]: 'settled' } +/** @internal */ export type LoadTransaction = [ controller: AbortController, redirects: number, @@ -250,6 +251,7 @@ export type LoadTransaction = [ refresh?: [handoff: NonNullable | undefined], ] +/** @internal */ export type PendingSession = [ generation: LoadTransaction, boundaryId: string, @@ -1621,6 +1623,7 @@ function publishMatches( router.stores.setMatches(matches) } +// @internal export function commitMatches( router: CoordinatorRouter, tx: LoadTransaction, diff --git a/packages/router-core/src/route.ts b/packages/router-core/src/route.ts index 089369b454d..204839d6d6d 100644 --- a/packages/router-core/src/route.ts +++ b/packages/router-core/src/route.ts @@ -661,6 +661,7 @@ export interface Route< > extends RouteExtensions { path: TPath parentRoute: TParentRoute + /** @internal */ children?: TChildren types: RouteTypes< TRegister, @@ -682,6 +683,7 @@ export interface Route< TServerMiddlewares, THandlers > + /** @internal */ options: RouteOptions< TRegister, TParentRoute, @@ -700,6 +702,7 @@ export interface Route< TServerMiddlewares, THandlers > + /** @internal */ isRoot: TParentRoute extends AnyRoute ? true : false lazyFn?: () => Promise< LazyRoute< @@ -731,8 +734,10 @@ export interface Route< _branch?: ReadonlyArray /** @internal */ _interpolation?: RouteInterpolation + /** @internal */ rank: number to: TrimPathRight + /** @internal */ init: (originalIndex: number) => void update: ( options: UpdatableRouteOptions< @@ -1645,7 +1650,9 @@ export class BaseRoute< in out TServerMiddlewares = unknown, in out THandlers = undefined, > { + /** @internal */ isRoot: TParentRoute extends AnyRoute ? true : false + /** @internal */ options: RouteOptions< TRegister, TParentRoute, @@ -1689,8 +1696,11 @@ export class BaseRoute< } // Optional + /** @internal */ children?: TChildren + /** @internal */ originalIndex?: number + /** @internal */ rank!: number lazyFn?: () => Promise< LazyRoute< @@ -1771,6 +1781,7 @@ export class BaseRoute< THandlers > + /** @internal */ init = (originalIndex: number): void => { this.originalIndex = originalIndex // Rebuilding a tree can change the ancestors of an existing route. @@ -1922,6 +1933,7 @@ export class BaseRoute< return this as any } + /** @internal */ updateLoader = (options: { loader: Constrain< TNewLoaderFn, diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index 54df04c5cff..308195f7eac 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -355,6 +355,7 @@ export interface RouterOptions< */ context?: InferRouterContext + /** @internal */ additionalContext?: any /** @@ -419,16 +420,19 @@ export interface RouterOptions< * * @default typeof document !== 'undefined' * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property) + * @internal */ isServer?: boolean /** * @default false + * @internal */ isShell?: boolean /** * @default false + * @internal */ isPrerendering?: boolean @@ -591,8 +595,11 @@ export interface BuildNextOptions { } from?: string href?: string + /** @internal */ _fromLocation?: ParsedLocation + /** @internal */ unsafeRelative?: 'path' + /** @internal */ _isNavigate?: boolean } @@ -779,8 +786,9 @@ export type EmitFn = (routerEvent: RouterEvent) => void export type LoadFn = (opts?: { sync?: boolean action?: { type: HistoryAction } + /** @internal */ _signal?: AbortSignal - /** @private Reuse the location already prepared for this SSR request. */ + /** @internal Reuse the location already prepared for this SSR request. */ _skipLocationUpdate?: boolean }) => Promise @@ -979,6 +987,7 @@ export function lifecycleEnd(matches: Array) { } /** Run route lifecycle callbacks in leave/enter/stay phases. */ +// @internal export function runRouteLifecycle( router: AnyRouter, previous: Array, @@ -1079,34 +1088,36 @@ export interface RouterCore< in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record = Record, > { + /** @internal */ shouldViewTransition?: boolean | ViewTransitionOptions /** * Foreground lifecycle boundary survives invalidation/background statuses. * Zero or undefined means the whole branch participates. + * @internal */ _lifecycleEnd?: number - /** Current client load transaction and owner of navigation writes. */ + /** @internal Current client load transaction and owner of navigation writes. */ _tx?: LoadTransaction - /** Joinable in-flight loader generations keyed by match ID. */ + /** @internal Joinable in-flight loader generations keyed by match ID. */ _flights?: Map - /** Active speculative lanes retained for cancellation, invalidation, and cache clearing. */ + /** @internal Active speculative lanes retained for cancellation, invalidation, and cache clearing. */ _preloads?: Map> - /** Owns cancellable work before a client transaction publishes. */ + /** @internal Owns cancellable work before a client transaction publishes. */ _preflight?: AbortController - /** Transfers one reconstructed SSR prefix into its initial client load. */ + /** @internal Transfers one reconstructed SSR prefix into its initial client load. */ _handoff?: HydrationHandoff - /** Pending-boundary reveal and minimum-visible timing state. */ + /** @internal Pending-boundary reveal and minimum-visible timing state. */ _pending?: PendingSession - /** Result of the latest server load, used to render or redirect. */ + /** @internal Result of the latest server load, used to render or redirect. */ _serverResult?: ServerLoadResult - /** Framework publication waiting for an exact render acknowledgement. */ + /** @internal Framework publication waiting for an exact render acknowledgement. */ _rendered?: [ offered?: Array, settle?: (rendered: boolean) => void, ] - /** Development-only HMR reload for a route and its descendants. */ + /** @internal Development-only HMR reload for a route and its descendants. */ _refreshRoute: (() => Promise) | undefined - /** Development-only replacement for a route's lazy chunk owner. */ + /** @internal Development-only replacement for a route's lazy chunk owner. */ _replaceRouteChunk: | ((route: AnyRoute, lazyFn: AnyRoute['lazyFn']) => void) | undefined @@ -1134,9 +1145,11 @@ export class RouterCore< in out TDehydrated extends Record = Record, > { // Option-independent properties + /** @internal */ tempLocationKey: string | undefined = `${Math.round( Math.random() * 10000000, )}` + /** @internal */ _scroll: { n: boolean // Reset scroll on the next render. // True until the current PUSH/REPLACE renders, so its hash owns window scroll. @@ -1145,15 +1158,19 @@ export class RouterCore< s?: boolean // Snapshot/lifecycle listeners installed. r?: boolean // Render listener installed. } = { n: true } + /** @internal */ subscribers = new Set>() - /** Accepted off-screen loader generations keyed by match ID. */ + /** @internal Accepted off-screen loader generations keyed by match ID. */ _cache = new Map() - /** Accepted semantic lane, excluding temporary pending presentation. */ + /** @internal Accepted semantic lane, excluding temporary pending presentation. */ _committed: Array = [] // Must build in constructor + /** @internal */ stores!: RouterStores + /** @internal */ private getStoreConfig!: GetStoreConfig + /** @internal */ batch!: (fn: () => void) => void options!: PickAsRequired< @@ -1167,16 +1184,25 @@ export class RouterCore< 'stringifySearch' | 'parseSearch' | 'context' > history!: TRouterHistory + /** @internal */ rewrite?: LocationRewrite + /** @internal */ origin!: string + /** @internal */ latestLocation!: ParsedLocation> + /** @internal */ _pendingLocation?: ParsedLocation> + /** @internal */ basepath!: string routeTree!: TRouteTree routesById!: RoutesById + /** @internal */ routesByPath!: RoutesByPath + /** @internal */ processedTree!: ProcessedTree + /** @internal */ resolvePathCache!: SieveCache + /** @internal */ private lightweightCache!: WeakMap< ParsedLocation, LightweightRouteMatchCacheEntry @@ -1185,9 +1211,13 @@ export class RouterCore< // options object a Link owns. Links pass a new object when their values change. // Client only: server renders never repeat an options object, so server // bundles fold `isServer` and drop the cache entirely. + /** @internal */ private staticLocations: WeakMap | undefined + /** @internal */ isServer!: boolean + /** @internal */ readonly pathParamsDecoder?: (encoded: string) => string + /** @internal */ protocolAllowlist!: Set /** @@ -1229,6 +1259,7 @@ export class RouterCore< } } + /** @internal */ startTransition: StartTransitionFn = async (fn) => { fn() return false @@ -1374,6 +1405,7 @@ export class RouterCore< return this.stores.__store.get() } + /** @internal */ updateLatestLocation = () => { this.latestLocation = this.parseLocation( this.history.location, @@ -1381,6 +1413,7 @@ export class RouterCore< ) } + /** @internal */ buildRouteTree = (): RouteTreeCaches => { const result = processRouteTree(this.routeTree, this.options.caseSensitive) if (this.options.routeMasks) { @@ -1393,6 +1426,7 @@ export class RouterCore< } } + // @internal setRoutes(caches: RouteTreeCaches) { Object.assign(this, caches) this.lightweightCache = new WeakMap() @@ -1431,6 +1465,7 @@ export class RouterCore< } } + /** @internal */ emit: EmitFn = (routerEvent) => { for (const listener of this.subscribers) { if (listener.eventType === routerEvent.type) { @@ -1446,6 +1481,7 @@ export class RouterCore< /** * Parse a HistoryLocation into a strongly-typed ParsedLocation using the * current router options, rewrite rules and search parser/stringifier. + * @internal */ parseLocation: ParseLocationFn = ( locationToParse, @@ -1542,6 +1578,7 @@ export class RouterCore< return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts) } + // @internal private matchRoutesInternal( next: ParsedLocation, opts?: MatchRoutesOpts, @@ -1776,6 +1813,7 @@ export class RouterCore< return matches } + /** @internal */ getMatchedRoutes: GetMatchRoutesFn = (pathname) => { const rawParams: Record = Object.create(null) const match = findRouteMatch( @@ -1798,6 +1836,7 @@ export class RouterCore< * Only computes fullPath, accumulated search, and params - skipping expensive * operations like AbortController, loaderDeps, and full match objects. */ + // @internal private matchRoutesLightweight( location: ParsedLocation, ): LightweightRouteMatchResult { @@ -2209,11 +2248,13 @@ export class RouterCore< return next } + /** @internal */ _commitPromise: (Promise & { resolve: () => void }) | undefined /** * Commit a previously built location to history (push/replace), optionally * using view transitions and scroll restoration options. + * @internal */ commitLocation: CommitLocationFn = async ({ viewTransition, @@ -2320,7 +2361,7 @@ export class RouterCore< return this._commitPromise } - /** Convenience helper: build a location from options, then commit it. */ + /** @internal Convenience helper: build a location from options, then commit it. */ buildAndCommitLocation = ({ replace, resetScroll, @@ -2423,6 +2464,7 @@ export class RouterCore< await loadClientRoute(this, opts) } + /** @internal */ startViewTransition = (fn: () => Promise) => { // Determine if we should start a view transition from the navigation // or from the router default @@ -2562,6 +2604,7 @@ export class RouterCore< return this.load({ sync: opts?.sync }) } + /** @internal */ resolveRedirect = (redirect: AnyRedirect): AnyRedirect => { const options = redirect.options let href = redirect.headers.get('Location') || options.href @@ -2724,12 +2767,14 @@ export class RouterCore< return match.rawParams } + /** @internal */ ssr?: { manifest: Manifest | undefined } serverSsr?: ServerSsr + /** @internal */ serverSsrLifecycle?: RouterSsrLifecycle } diff --git a/packages/router-core/src/scroll-restoration-script/client.ts b/packages/router-core/src/scroll-restoration-script/client.ts index 7552ebcce30..1437e2772c3 100644 --- a/packages/router-core/src/scroll-restoration-script/client.ts +++ b/packages/router-core/src/scroll-restoration-script/client.ts @@ -1,5 +1,6 @@ import type { AnyRouter } from '../router' +// @internal export function getScrollRestorationScriptForRouter(_router: AnyRouter) { return null } diff --git a/packages/router-core/src/scroll-restoration-script/server.ts b/packages/router-core/src/scroll-restoration-script/server.ts index 5c5ce5e7348..4cb750c1595 100644 --- a/packages/router-core/src/scroll-restoration-script/server.ts +++ b/packages/router-core/src/scroll-restoration-script/server.ts @@ -18,6 +18,7 @@ function getScrollRestorationScript(key?: string) { return `(${minifiedScrollRestorationScript})(${escapeHtml(JSON.stringify(storageKey))},${escapeHtml(JSON.stringify(key))})` } +// @internal export function getScrollRestorationScriptForRouter(router: AnyRouter) { if ( typeof router.options.scrollRestoration === 'function' && diff --git a/packages/router-core/src/ssr/client.ts b/packages/router-core/src/ssr/client.ts index dc769e7495a..2a392357cbf 100644 --- a/packages/router-core/src/ssr/client.ts +++ b/packages/router-core/src/ssr/client.ts @@ -4,11 +4,14 @@ export type { JsonResponse } from './json' export { hydrate } from './ssr-client' export * from './ssr-client' export type { TsrSsrGlobal, DehydratedMatch, DehydratedRouter } from './types' +export { defaultSerovalDeserializerPlugins } from './serializer/seroval-plugins' +/** @internal */ export { createDefaultSerovalPlugins, defaultSerovalPlugins, - defaultSerovalDeserializerPlugins, } from './serializer/seroval-plugins' +/** @internal */ export { makeSerovalPlugin } from './serializer/makeSerovalPlugin' export type { AnySerializationAdapter } from './serializer/transformer' +/** @internal */ export { createRawStreamDeserializePlugin } from './serializer/RawStreamRPCPlugin' diff --git a/packages/router-core/src/ssr/server.ts b/packages/router-core/src/ssr/server.ts index 84c34976c98..519b3347511 100644 --- a/packages/router-core/src/ssr/server.ts +++ b/packages/router-core/src/ssr/server.ts @@ -1,9 +1,12 @@ -export { createRequestHandler, waitForRequest } from './createRequestHandler' +export { createRequestHandler } from './createRequestHandler' +/** @internal */ +export { waitForRequest } from './createRequestHandler' export type { RequestHandler } from './createRequestHandler' +export { defineHandlerCallback } from './handlerCallback' +/** @internal */ export { bindSsrResponseToRequest, createSsrStreamResponse, - defineHandlerCallback, disposeSsrResponse, getSsrStatus, isSsrResponse, @@ -18,16 +21,19 @@ export type { } from './handlerCallback' export { transformPipeableStreamWithRouter, - transformHtmlStringWithRouter, transformReadableStreamWithRouter, } from './transformStreamWithRouter' +/** @internal */ +export { transformHtmlStringWithRouter } from './transformStreamWithRouter' export type { TransformStreamWithRouterOptions } from './transformStreamWithRouter' +/** @internal */ export { renderSsrHtmlResponse } from './renderSsrHtmlResponse' -export { - attachRouterServerSsrUtils, - getNormalizedURL, - getOrigin, -} from './ssr-server' +export { attachRouterServerSsrUtils } from './ssr-server' +/** @internal */ +export { getNormalizedURL, getOrigin } from './ssr-server' +/** @internal */ export { defaultSerovalDeserializerPlugins } from './serializer/seroval-plugins' +/** @internal */ export { createRawStreamRPCPlugin } from './serializer/RawStreamRPCPlugin' +/** @internal */ export { makeSsrSerovalPlugin } from './serializer/makeSsrSerovalPlugin' diff --git a/packages/solid-router/api/index.api.md b/packages/solid-router/api/index.api.md index b52691cd2f6..cfc689b6c19 100644 --- a/packages/solid-router/api/index.api.md +++ b/packages/solid-router/api/index.api.md @@ -22,13 +22,10 @@ import { AnyRedirect } from '@tanstack/router-core'; import { AnyRoute } from '@tanstack/router-core'; import { AnyRouteMatch } from '@tanstack/router-core'; import { AnyRouter } from '@tanstack/router-core'; -import { AnyRouterWithContext } from '@tanstack/router-core'; -import { AnyRouteWithContext } from '@tanstack/router-core'; import { AnySchema } from '@tanstack/router-core'; import { AnySerializationAdapter } from '@tanstack/router-core'; import { AnyValidator } from '@tanstack/router-core'; import { AnyValidatorAdapter } from '@tanstack/router-core'; -import { AnyValidatorFn } from '@tanstack/router-core'; import { AnyValidatorObj } from '@tanstack/router-core'; import { AssetCrossOriginConfig } from '@tanstack/router-core'; import { Assign } from '@tanstack/router-core'; @@ -41,26 +38,18 @@ import { BeforeLoadContextParameter } from '@tanstack/router-core'; import { BlockerFn } from '@tanstack/history'; import { BuildLocationFn } from '@tanstack/router-core'; import { BuildNextOptions } from '@tanstack/router-core'; -import { cleanPath } from '@tanstack/router-core'; -import { CommitLocationOptions } from '@tanstack/router-core'; import { composeRewrites } from '@tanstack/router-core'; import { Constrain } from '@tanstack/router-core'; import { ConstrainLiteral } from '@tanstack/router-core'; import { ContextAsyncReturnType } from '@tanstack/router-core'; import { ContextOptions } from '@tanstack/router-core'; import { ContextReturnType } from '@tanstack/router-core'; -import { ControllablePromise } from '@tanstack/router-core'; -import { ControlledPromise } from '@tanstack/router-core'; import { createBrowserHistory } from '@tanstack/history'; -import { createControlledPromise } from '@tanstack/router-core'; import { CreateFileRoute } from '@tanstack/router-core'; import { createHashHistory } from '@tanstack/history'; -import { createHistory } from '@tanstack/history'; -import { CreateLazyFileRoute } from '@tanstack/router-core'; import { createMemoryHistory } from '@tanstack/history'; import { CreateRouterFn } from '@tanstack/router-core'; import { createSerializationAdapter } from '@tanstack/router-core'; -import { deepEqual } from '@tanstack/router-core'; import { DeepPartial } from '@tanstack/router-core'; import { DEFAULT_PROTOCOL_ALLOWLIST } from '@tanstack/router-core'; import { defaultParseSearch } from '@tanstack/router-core'; @@ -70,7 +59,6 @@ import { defer } from '@tanstack/router-core'; import { DeferredPromise } from '@tanstack/router-core'; import { DeferredPromiseState } from '@tanstack/router-core'; import { ErrorComponentProps } from '@tanstack/router-core'; -import { ErrorRouteProps } from '@tanstack/router-core'; import { Expand } from '@tanstack/router-core'; import { FileBaseRouteOptions } from '@tanstack/router-core'; import { FileRoutesByPath } from '@tanstack/router-core'; @@ -79,7 +67,6 @@ import { FromPathOption } from '@tanstack/router-core'; import { FullSearchSchema } from '@tanstack/router-core'; import { FullSearchSchemaInput } from '@tanstack/router-core'; import { FullSearchSchemaOption } from '@tanstack/router-core'; -import { functionalUpdate } from '@tanstack/router-core'; import { HistoryAction } from '@tanstack/history'; import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; @@ -95,12 +82,10 @@ import { InferSelected } from '@tanstack/router-core'; import { InferShouldThrow } from '@tanstack/router-core'; import { InferStrict } from '@tanstack/router-core'; import { InferTo } from '@tanstack/router-core'; -import { interpolatePath } from '@tanstack/router-core'; import { IntersectAssign } from '@tanstack/router-core'; import { isMatch } from '@tanstack/router-core'; import { isNotFound } from '@tanstack/router-core'; import { isRedirect } from '@tanstack/router-core'; -import { joinPaths } from '@tanstack/router-core'; import { JSX } from 'solid-js'; import { lazyFn } from '@tanstack/router-core'; import { LazyRouteOptions } from '@tanstack/router-core'; @@ -118,10 +103,7 @@ import { MakeRouteMatch } from '@tanstack/router-core'; import { MakeRouteMatchUnion } from '@tanstack/router-core'; import { Manifest } from '@tanstack/router-core'; import { MaskOptions } from '@tanstack/router-core'; -import { MatchLocation } from '@tanstack/router-core'; import { MatchRouteOptions } from '@tanstack/router-core'; -import { MergeAll } from '@tanstack/router-core'; -import { MetaDescriptor } from '@tanstack/router-core'; import { NavigateFn } from '@tanstack/router-core'; import { NavigateOptions } from '@tanstack/router-core'; import { notFound } from '@tanstack/router-core'; @@ -134,7 +116,6 @@ import { ParseParamsFn } from '@tanstack/router-core'; import { ParseRoute } from '@tanstack/router-core'; import { parseSearchWith } from '@tanstack/router-core'; import { PathParamOptions } from '@tanstack/router-core'; -import { PreloadableObj } from '@tanstack/router-core'; import { Redirect } from '@tanstack/router-core'; import { redirect } from '@tanstack/router-core'; import { RedirectOptions } from '@tanstack/router-core'; @@ -147,10 +128,8 @@ import { RelativeToPathAutoComplete } from '@tanstack/router-core'; import { RemountDepsOptions } from '@tanstack/router-core'; import { RemoveLeadingSlashes } from '@tanstack/router-core'; import { RemoveTrailingSlashes } from '@tanstack/router-core'; -import { replaceEqualDeep } from '@tanstack/router-core'; import { ResolveAllContext } from '@tanstack/router-core'; import { ResolveAllParamsFromParent } from '@tanstack/router-core'; -import { ResolvedRedirect } from '@tanstack/router-core'; import { ResolveFullPath } from '@tanstack/router-core'; import { ResolveFullSearchSchema } from '@tanstack/router-core'; import { ResolveFullSearchSchemaInput } from '@tanstack/router-core'; @@ -158,7 +137,6 @@ import { ResolveId } from '@tanstack/router-core'; import { ResolveLoaderData } from '@tanstack/router-core'; import { ResolveOptionalParams } from '@tanstack/router-core'; import { ResolveParams } from '@tanstack/router-core'; -import { resolvePath } from '@tanstack/router-core'; import { ResolveRelativePath } from '@tanstack/router-core'; import { ResolveRequiredParams } from '@tanstack/router-core'; import { ResolveRoute } from '@tanstack/router-core'; @@ -183,18 +161,14 @@ import { RouteById } from '@tanstack/router-core'; import { RouteByPath } from '@tanstack/router-core'; import { RouteConstraints } from '@tanstack/router-core'; import { RouteContext } from '@tanstack/router-core'; -import { RouteContextFn } from '@tanstack/router-core'; import { RouteContextOptions } from '@tanstack/router-core'; import { RouteContextParameter } from '@tanstack/router-core'; import { RouteIds } from '@tanstack/router-core'; -import { RouteLinkEntry } from '@tanstack/router-core'; -import { RouteLoaderEntry } from '@tanstack/router-core'; import { RouteLoaderFn } from '@tanstack/router-core'; import { RouteMask } from '@tanstack/router-core'; import { RouteMatch } from '@tanstack/router-core'; import { RouteOptions } from '@tanstack/router-core'; import { RoutePathOptions } from '@tanstack/router-core'; -import { RoutePathOptionsIntersection } from '@tanstack/router-core'; import { RoutePaths } from '@tanstack/router-core'; import { RouterConstructorOptions } from '@tanstack/router-core'; import { RouterContextOptions } from '@tanstack/router-core'; @@ -202,7 +176,6 @@ import { RouterCore } from '@tanstack/router-core'; import { RouterEvent } from '@tanstack/router-core'; import { RouterEvents } from '@tanstack/router-core'; import { RouterHistory } from '@tanstack/history'; -import { RouterListener } from '@tanstack/router-core'; import { RouterManagedTag } from '@tanstack/router-core'; import { RouterOptions } from '@tanstack/router-core'; import { RouterState } from '@tanstack/router-core'; @@ -234,11 +207,8 @@ import { ToSubOptions } from '@tanstack/router-core'; import { ToSubOptionsProps } from '@tanstack/router-core'; import { TrailingSlashOption } from '@tanstack/router-core'; import { TrimPath } from '@tanstack/router-core'; -import { trimPath } from '@tanstack/router-core'; import { TrimPathLeft } from '@tanstack/router-core'; -import { trimPathLeft } from '@tanstack/router-core'; import { TrimPathRight } from '@tanstack/router-core'; -import { trimPathRight } from '@tanstack/router-core'; import { UpdatableRouteOptions } from '@tanstack/router-core'; import { UpdatableStaticRouteOption } from '@tanstack/router-core'; import { UseLoaderDataResult } from '@tanstack/router-core'; @@ -250,16 +220,8 @@ import { UseRouteContextOptions } from '@tanstack/router-core'; import { UseRouteContextResult } from '@tanstack/router-core'; import { UseSearchResult } from '@tanstack/router-core'; import { ValidateFromPath } from '@tanstack/router-core'; -import { ValidateId } from '@tanstack/router-core'; import { ValidateNavigateOptions } from '@tanstack/router-core'; -import { ValidateNavigateOptionsArray } from '@tanstack/router-core'; -import { ValidateParams } from '@tanstack/router-core'; import { ValidateRedirectOptions } from '@tanstack/router-core'; -import { ValidateRedirectOptionsArray } from '@tanstack/router-core'; -import { ValidateSearch } from '@tanstack/router-core'; -import { ValidateToPath } from '@tanstack/router-core'; -import { ValidateUseParamsResult } from '@tanstack/router-core'; -import { ValidateUseSearchResult } from '@tanstack/router-core'; import { Validator } from '@tanstack/router-core'; import { ValidatorAdapter } from '@tanstack/router-core'; import { ValidatorFn } from '@tanstack/router-core'; @@ -295,10 +257,6 @@ export { AnyRouteMatch } export { AnyRouter } -export { AnyRouterWithContext } - -export { AnyRouteWithContext } - export { AnySchema } export { AnySerializationAdapter } @@ -307,13 +265,8 @@ export { AnyValidator } export { AnyValidatorAdapter } -export { AnyValidatorFn } - export { AnyValidatorObj } -// @public (undocumented) -export function Asset(asset: RouterManagedTag): JSX.Element | null; - export { Assign } // Warning: (ae-forgotten-export) The symbol "RouteTypes" needs to be exported by the entry point index.d.ts @@ -366,15 +319,11 @@ export function CatchNotFound(props: { children: Solid.JSX.Element; }): Solid.JSX.Element; -export { cleanPath } - // Warning: (ae-forgotten-export) The symbol "ClientOnlyProps" needs to be exported by the entry point index.d.ts // // @public export function ClientOnly(props: ClientOnlyProps): Solid.JSX.Element; -export { CommitLocationOptions } - export { composeRewrites } export { Constrain } @@ -385,14 +334,8 @@ export { ContextOptions } export { ContextReturnType } -export { ControllablePromise } - -export { ControlledPromise } - export { createBrowserHistory } -export { createControlledPromise } - export { CreateFileRoute } // @public (undocumented) @@ -400,10 +343,6 @@ export function createFileRoute(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute; @@ -437,8 +376,6 @@ export const createRouter: CreateRouterFn; export { createSerializationAdapter } -export { deepEqual } - export { DEFAULT_PROTOCOL_ALLOWLIST } // @public (undocumented) @@ -466,8 +403,6 @@ export { ErrorComponentProps } // @public (undocumented) export type ErrorRouteComponent = AsyncRouteComponent; -export { ErrorRouteProps } - export { Expand } export { FileBaseRouteOptions } @@ -481,13 +416,8 @@ export class FileRoute, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, const TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions & UpdatableRouteOptions) => Route_2; // (undocumented) path?: TFilePath | undefined; - // (undocumented) - silent?: boolean; } -// @public @deprecated (undocumented) -export function FileRouteLoader(_path: TFilePath): (loaderFn: Constrain>) => TLoaderFn; - export { FileRoutesByPath } export { FileRouteTypes } @@ -498,8 +428,6 @@ export { FullSearchSchemaInput } export { FullSearchSchemaOption } -export { functionalUpdate } - // @public (undocumented) export function getRouteApi(id: ConstrainLiteral>): RouteApi; @@ -536,8 +464,6 @@ export { InferStrict } export { InferTo } -export { interpolatePath } - export { IntersectAssign } export { isMatch } @@ -546,8 +472,6 @@ export { isNotFound } export { isRedirect } -export { joinPaths } - export { lazyFn } // @public (undocumented) @@ -642,25 +566,11 @@ export { MakeRouteMatchUnion } export { Manifest } -// @public (undocumented) -export const Match: (props: { - routeId: string; -}) => Solid.JSX.Element; - -// @public (undocumented) -export function Matches(): Solid.JSX.Element; - -export { MatchLocation } - // @public (undocumented) export function MatchRoute(props: MakeMatchRouteOptions): any; export { MatchRouteOptions } -export { MergeAll } - -export { MetaDescriptor } - // @public (undocumented) export function Navigate(props: NavigateOptions): null; @@ -699,8 +609,6 @@ export { parseSearchWith } export { PathParamOptions } -export { PreloadableObj } - export { Redirect } export { redirect } @@ -725,14 +633,10 @@ export { RemoveLeadingSlashes } export { RemoveTrailingSlashes } -export { replaceEqualDeep } - export { ResolveAllContext } export { ResolveAllParamsFromParent } -export { ResolvedRedirect } - export { ResolveFullPath } export { ResolveFullSearchSchema } @@ -747,8 +651,6 @@ export { ResolveOptionalParams } export { ResolveParams } -export { resolvePath } - export { ResolveRelativePath } export { ResolveRequiredParams } @@ -863,16 +765,12 @@ export { RouteConstraints } export { RouteContext } -export { RouteContextFn } - export { RouteContextOptions } export { RouteContextParameter } export { RouteIds } -export { RouteLinkEntry } - export { RouteLoaderFn } export { RouteMask } @@ -883,8 +781,6 @@ export { RouteOptions } export { RoutePathOptions } -export { RoutePathOptionsIntersection } - export { RoutePaths } // @public (undocumented) @@ -896,19 +792,12 @@ export { RouterConstructorOptions } export { RouterContextOptions } -// @public (undocumented) -export function RouterContextProvider = Record>(input: RouterProps & { - children: () => Solid.JSX.Element; -}): Solid.JSX.Element; - export { RouterEvent } export { RouterEvents } export { RouterHistory } -export { RouterListener } - export { RouterManagedTag } export { RouterOptions } @@ -986,16 +875,10 @@ export { TrailingSlashOption } export { TrimPath } -export { trimPath } - export { TrimPathLeft } -export { trimPathLeft } - export { TrimPathRight } -export { trimPathRight } - export { UpdatableRouteOptions } export { UpdatableStaticRouteOption } @@ -1122,13 +1005,8 @@ export function useRouterState(opts: UseSearchOptions, TSelected>): Accessor, TThrow>>; -// @public -export const useTags: (assetCrossOrigin?: AssetCrossOriginConfig) => Solid.Accessor; - export { ValidateFromPath } -export { ValidateId } - // @public (undocumented) export type ValidateLinkOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; @@ -1139,28 +1017,8 @@ export type ValidateLinkOptionsArray = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseParamsResult } - -// @public (undocumented) -export type ValidateUseSearchOptions = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseSearchResult } - export { Validator } export { ValidatorAdapter } @@ -1184,18 +1042,12 @@ declare module "@tanstack/history" { interface HistoryState { __tempLocation?: HistoryLocation; __tempKey?: string; - __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions; } } // Matches.d.ts declare module "@tanstack/router-core" { interface RouteMatchExtensions { - meta?: Array; - links?: Array; - scripts?: Array; - styles?: Array; - headScripts?: Array; } } diff --git a/packages/solid-router/api/source/index.api.md b/packages/solid-router/api/source/index.api.md index 2db0a6a5364..bc9b3ac01a7 100644 --- a/packages/solid-router/api/source/index.api.md +++ b/packages/solid-router/api/source/index.api.md @@ -22,13 +22,10 @@ import { AnyRedirect } from '@tanstack/router-core'; import { AnyRoute } from '@tanstack/router-core'; import { AnyRouteMatch } from '@tanstack/router-core'; import { AnyRouter } from '@tanstack/router-core'; -import { AnyRouterWithContext } from '@tanstack/router-core'; -import { AnyRouteWithContext } from '@tanstack/router-core'; import { AnySchema } from '@tanstack/router-core'; import { AnySerializationAdapter } from '@tanstack/router-core'; import { AnyValidator } from '@tanstack/router-core'; import { AnyValidatorAdapter } from '@tanstack/router-core'; -import { AnyValidatorFn } from '@tanstack/router-core'; import { AnyValidatorObj } from '@tanstack/router-core'; import type { AssetCrossOriginConfig } from '@tanstack/router-core'; import { Assign } from '@tanstack/router-core'; @@ -41,26 +38,18 @@ import { BeforeLoadContextParameter } from '@tanstack/router-core'; import { BlockerFn } from '@tanstack/history'; import { BuildLocationFn } from '@tanstack/router-core'; import { BuildNextOptions } from '@tanstack/router-core'; -import { cleanPath } from '@tanstack/router-core'; -import { CommitLocationOptions } from '@tanstack/router-core'; import { composeRewrites } from '@tanstack/router-core'; import { Constrain } from '@tanstack/router-core'; import type { ConstrainLiteral } from '@tanstack/router-core'; import { ContextAsyncReturnType } from '@tanstack/router-core'; import { ContextOptions } from '@tanstack/router-core'; import { ContextReturnType } from '@tanstack/router-core'; -import { ControllablePromise } from '@tanstack/router-core'; -import { ControlledPromise } from '@tanstack/router-core'; import { createBrowserHistory } from '@tanstack/history'; -import { createControlledPromise } from '@tanstack/router-core'; import { CreateFileRoute } from '@tanstack/router-core'; import { createHashHistory } from '@tanstack/history'; -import { createHistory } from '@tanstack/history'; -import { CreateLazyFileRoute } from '@tanstack/router-core'; import { createMemoryHistory } from '@tanstack/history'; import type { CreateRouterFn } from '@tanstack/router-core'; import { createSerializationAdapter } from '@tanstack/router-core'; -import { deepEqual } from '@tanstack/router-core'; import type { DeepPartial } from '@tanstack/router-core'; import { DEFAULT_PROTOCOL_ALLOWLIST } from '@tanstack/router-core'; import { defaultParseSearch } from '@tanstack/router-core'; @@ -70,7 +59,6 @@ import { defer } from '@tanstack/router-core'; import { DeferredPromise } from '@tanstack/router-core'; import { DeferredPromiseState } from '@tanstack/router-core'; import { ErrorComponentProps } from '@tanstack/router-core'; -import { ErrorRouteProps } from '@tanstack/router-core'; import { Expand } from '@tanstack/router-core'; import { FileBaseRouteOptions } from '@tanstack/router-core'; import { FileRoutesByPath } from '@tanstack/router-core'; @@ -79,7 +67,6 @@ import type { FromPathOption } from '@tanstack/router-core'; import { FullSearchSchema } from '@tanstack/router-core'; import { FullSearchSchemaInput } from '@tanstack/router-core'; import { FullSearchSchemaOption } from '@tanstack/router-core'; -import { functionalUpdate } from '@tanstack/router-core'; import type { HistoryAction } from '@tanstack/history'; import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; @@ -95,12 +82,10 @@ import { InferSelected } from '@tanstack/router-core'; import { InferShouldThrow } from '@tanstack/router-core'; import { InferStrict } from '@tanstack/router-core'; import { InferTo } from '@tanstack/router-core'; -import { interpolatePath } from '@tanstack/router-core'; import { IntersectAssign } from '@tanstack/router-core'; import { isMatch } from '@tanstack/router-core'; import { isNotFound } from '@tanstack/router-core'; import { isRedirect } from '@tanstack/router-core'; -import { joinPaths } from '@tanstack/router-core'; import { JSX } from 'solid-js'; import { lazyFn } from '@tanstack/router-core'; import { LazyRouteOptions } from '@tanstack/router-core'; @@ -118,10 +103,7 @@ import { MakeRouteMatch } from '@tanstack/router-core'; import { MakeRouteMatchUnion } from '@tanstack/router-core'; import { Manifest } from '@tanstack/router-core'; import type { MaskOptions } from '@tanstack/router-core'; -import { MatchLocation } from '@tanstack/router-core'; import { MatchRouteOptions } from '@tanstack/router-core'; -import { MergeAll } from '@tanstack/router-core'; -import { MetaDescriptor } from '@tanstack/router-core'; import { NavigateFn } from '@tanstack/router-core'; import { NavigateOptions } from '@tanstack/router-core'; import { notFound } from '@tanstack/router-core'; @@ -134,7 +116,6 @@ import { ParseParamsFn } from '@tanstack/router-core'; import { ParseRoute } from '@tanstack/router-core'; import { parseSearchWith } from '@tanstack/router-core'; import { PathParamOptions } from '@tanstack/router-core'; -import { PreloadableObj } from '@tanstack/router-core'; import { Redirect } from '@tanstack/router-core'; import { redirect } from '@tanstack/router-core'; import { RedirectOptions } from '@tanstack/router-core'; @@ -147,10 +128,8 @@ import { RelativeToPathAutoComplete } from '@tanstack/router-core'; import { RemountDepsOptions } from '@tanstack/router-core'; import { RemoveLeadingSlashes } from '@tanstack/router-core'; import { RemoveTrailingSlashes } from '@tanstack/router-core'; -import { replaceEqualDeep } from '@tanstack/router-core'; import { ResolveAllContext } from '@tanstack/router-core'; import { ResolveAllParamsFromParent } from '@tanstack/router-core'; -import { ResolvedRedirect } from '@tanstack/router-core'; import { ResolveFullPath } from '@tanstack/router-core'; import { ResolveFullSearchSchema } from '@tanstack/router-core'; import { ResolveFullSearchSchemaInput } from '@tanstack/router-core'; @@ -158,7 +137,6 @@ import { ResolveId } from '@tanstack/router-core'; import { ResolveLoaderData } from '@tanstack/router-core'; import { ResolveOptionalParams } from '@tanstack/router-core'; import { ResolveParams } from '@tanstack/router-core'; -import { resolvePath } from '@tanstack/router-core'; import { ResolveRelativePath } from '@tanstack/router-core'; import { ResolveRequiredParams } from '@tanstack/router-core'; import { ResolveRoute } from '@tanstack/router-core'; @@ -183,18 +161,14 @@ import { RouteById } from '@tanstack/router-core'; import { RouteByPath } from '@tanstack/router-core'; import { RouteConstraints } from '@tanstack/router-core'; import { RouteContext } from '@tanstack/router-core'; -import { RouteContextFn } from '@tanstack/router-core'; import { RouteContextOptions } from '@tanstack/router-core'; import { RouteContextParameter } from '@tanstack/router-core'; import { RouteIds } from '@tanstack/router-core'; -import { RouteLinkEntry } from '@tanstack/router-core'; -import type { RouteLoaderEntry } from '@tanstack/router-core'; import { RouteLoaderFn } from '@tanstack/router-core'; import { RouteMask } from '@tanstack/router-core'; import { RouteMatch } from '@tanstack/router-core'; import { RouteOptions } from '@tanstack/router-core'; import { RoutePathOptions } from '@tanstack/router-core'; -import { RoutePathOptionsIntersection } from '@tanstack/router-core'; import { RoutePaths } from '@tanstack/router-core'; import { RouterConstructorOptions } from '@tanstack/router-core'; import { RouterContextOptions } from '@tanstack/router-core'; @@ -202,7 +176,6 @@ import { RouterCore } from '@tanstack/router-core'; import { RouterEvent } from '@tanstack/router-core'; import { RouterEvents } from '@tanstack/router-core'; import { RouterHistory } from '@tanstack/history'; -import { RouterListener } from '@tanstack/router-core'; import { RouterManagedTag } from '@tanstack/router-core'; import { RouterOptions } from '@tanstack/router-core'; import { RouterState } from '@tanstack/router-core'; @@ -234,11 +207,8 @@ import { ToSubOptions } from '@tanstack/router-core'; import type { ToSubOptionsProps } from '@tanstack/router-core'; import { TrailingSlashOption } from '@tanstack/router-core'; import { TrimPath } from '@tanstack/router-core'; -import { trimPath } from '@tanstack/router-core'; import { TrimPathLeft } from '@tanstack/router-core'; -import { trimPathLeft } from '@tanstack/router-core'; import { TrimPathRight } from '@tanstack/router-core'; -import { trimPathRight } from '@tanstack/router-core'; import { UpdatableRouteOptions } from '@tanstack/router-core'; import { UpdatableStaticRouteOption } from '@tanstack/router-core'; import type { UseLoaderDataResult } from '@tanstack/router-core'; @@ -250,16 +220,8 @@ import type { UseRouteContextOptions } from '@tanstack/router-core'; import type { UseRouteContextResult } from '@tanstack/router-core'; import type { UseSearchResult } from '@tanstack/router-core'; import { ValidateFromPath } from '@tanstack/router-core'; -import { ValidateId } from '@tanstack/router-core'; import { ValidateNavigateOptions } from '@tanstack/router-core'; -import { ValidateNavigateOptionsArray } from '@tanstack/router-core'; -import { ValidateParams } from '@tanstack/router-core'; import { ValidateRedirectOptions } from '@tanstack/router-core'; -import { ValidateRedirectOptionsArray } from '@tanstack/router-core'; -import { ValidateSearch } from '@tanstack/router-core'; -import { ValidateToPath } from '@tanstack/router-core'; -import { ValidateUseParamsResult } from '@tanstack/router-core'; -import { ValidateUseSearchResult } from '@tanstack/router-core'; import { Validator } from '@tanstack/router-core'; import { ValidatorAdapter } from '@tanstack/router-core'; import { ValidatorFn } from '@tanstack/router-core'; @@ -295,10 +257,6 @@ export { AnyRouteMatch } export { AnyRouter } -export { AnyRouterWithContext } - -export { AnyRouteWithContext } - export { AnySchema } export { AnySerializationAdapter } @@ -307,13 +265,8 @@ export { AnyValidator } export { AnyValidatorAdapter } -export { AnyValidatorFn } - export { AnyValidatorObj } -// @public (undocumented) -export function Asset(asset: RouterManagedTag): JSX.Element | null; - export { Assign } // Warning: (ae-forgotten-export) The symbol "RouteTypes" needs to be exported by the entry point index.d.ts @@ -366,15 +319,11 @@ export function CatchNotFound(props: { children: Solid.JSX.Element; }): Solid.JSX.Element; -export { cleanPath } - // Warning: (ae-forgotten-export) The symbol "ClientOnlyProps" needs to be exported by the entry point index.d.ts // // @public export function ClientOnly(props: ClientOnlyProps): Solid.JSX.Element; -export { CommitLocationOptions } - export { composeRewrites } export { Constrain } @@ -385,14 +334,8 @@ export { ContextOptions } export { ContextReturnType } -export { ControllablePromise } - -export { ControlledPromise } - export { createBrowserHistory } -export { createControlledPromise } - export { CreateFileRoute } // @public (undocumented) @@ -400,10 +343,6 @@ export function createFileRoute(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute; @@ -437,8 +376,6 @@ export const createRouter: CreateRouterFn; export { createSerializationAdapter } -export { deepEqual } - export { DEFAULT_PROTOCOL_ALLOWLIST } // @public (undocumented) @@ -466,8 +403,6 @@ export { ErrorComponentProps } // @public (undocumented) export type ErrorRouteComponent = AsyncRouteComponent; -export { ErrorRouteProps } - export { Expand } export { FileBaseRouteOptions } @@ -481,13 +416,8 @@ export class FileRoute, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, const TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions & UpdatableRouteOptions) => Route_2; // (undocumented) path?: TFilePath | undefined; - // (undocumented) - silent?: boolean; } -// @public @deprecated (undocumented) -export function FileRouteLoader(_path: TFilePath): (loaderFn: Constrain>) => TLoaderFn; - export { FileRoutesByPath } export { FileRouteTypes } @@ -498,8 +428,6 @@ export { FullSearchSchemaInput } export { FullSearchSchemaOption } -export { functionalUpdate } - // @public (undocumented) export function getRouteApi(id: ConstrainLiteral>): RouteApi; @@ -536,8 +464,6 @@ export { InferStrict } export { InferTo } -export { interpolatePath } - export { IntersectAssign } export { isMatch } @@ -546,8 +472,6 @@ export { isNotFound } export { isRedirect } -export { joinPaths } - export { lazyFn } // @public (undocumented) @@ -642,25 +566,11 @@ export { MakeRouteMatchUnion } export { Manifest } -// @public (undocumented) -export const Match: (props: { - routeId: string; -}) => Solid.JSX.Element; - -// @public (undocumented) -export function Matches(): Solid.JSX.Element; - -export { MatchLocation } - // @public (undocumented) export function MatchRoute(props: MakeMatchRouteOptions): any; export { MatchRouteOptions } -export { MergeAll } - -export { MetaDescriptor } - // @public (undocumented) export function Navigate(props: NavigateOptions): null; @@ -699,8 +609,6 @@ export { parseSearchWith } export { PathParamOptions } -export { PreloadableObj } - export { Redirect } export { redirect } @@ -725,14 +633,10 @@ export { RemoveLeadingSlashes } export { RemoveTrailingSlashes } -export { replaceEqualDeep } - export { ResolveAllContext } export { ResolveAllParamsFromParent } -export { ResolvedRedirect } - export { ResolveFullPath } export { ResolveFullSearchSchema } @@ -747,8 +651,6 @@ export { ResolveOptionalParams } export { ResolveParams } -export { resolvePath } - export { ResolveRelativePath } export { ResolveRequiredParams } @@ -863,16 +765,12 @@ export { RouteConstraints } export { RouteContext } -export { RouteContextFn } - export { RouteContextOptions } export { RouteContextParameter } export { RouteIds } -export { RouteLinkEntry } - export { RouteLoaderFn } export { RouteMask } @@ -883,8 +781,6 @@ export { RouteOptions } export { RoutePathOptions } -export { RoutePathOptionsIntersection } - export { RoutePaths } // @public (undocumented) @@ -896,19 +792,12 @@ export { RouterConstructorOptions } export { RouterContextOptions } -// @public (undocumented) -export function RouterContextProvider = Record>(input: RouterProps & { - children: () => Solid.JSX.Element; -}): Solid.JSX.Element; - export { RouterEvent } export { RouterEvents } export { RouterHistory } -export { RouterListener } - export { RouterManagedTag } export { RouterOptions } @@ -986,16 +875,10 @@ export { TrailingSlashOption } export { TrimPath } -export { trimPath } - export { TrimPathLeft } -export { trimPathLeft } - export { TrimPathRight } -export { trimPathRight } - export { UpdatableRouteOptions } export { UpdatableStaticRouteOption } @@ -1122,13 +1005,8 @@ export function useRouterState(opts: UseSearchOptions, TSelected>): Accessor, TThrow>>; -// @public -export const useTags: (assetCrossOrigin?: AssetCrossOriginConfig) => Solid.Accessor; - export { ValidateFromPath } -export { ValidateId } - // @public (undocumented) export type ValidateLinkOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; @@ -1139,28 +1017,8 @@ export type ValidateLinkOptionsArray = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseParamsResult } - -// @public (undocumented) -export type ValidateUseSearchOptions = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseSearchResult } - export { Validator } export { ValidatorAdapter } @@ -1184,18 +1042,12 @@ declare module "@tanstack/history" { interface HistoryState { __tempLocation?: HistoryLocation; __tempKey?: string; - __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions; } } // Matches.d.ts declare module "@tanstack/router-core" { interface RouteMatchExtensions { - meta?: Array; - links?: Array; - scripts?: Array; - styles?: Array; - headScripts?: Array; } } diff --git a/packages/solid-router/src/Matches.tsx b/packages/solid-router/src/Matches.tsx index d2dd1a681ad..32533813e89 100644 --- a/packages/solid-router/src/Matches.tsx +++ b/packages/solid-router/src/Matches.tsx @@ -25,10 +25,15 @@ import type { declare module '@tanstack/router-core' { export interface RouteMatchExtensions { + /** @internal */ meta?: Array + /** @internal */ links?: Array + /** @internal */ scripts?: Array + /** @internal */ styles?: Array + /** @internal */ headScripts?: Array } } diff --git a/packages/solid-router/src/fileRoute.ts b/packages/solid-router/src/fileRoute.ts index a1fcae713fc..46760333110 100644 --- a/packages/solid-router/src/fileRoute.ts +++ b/packages/solid-router/src/fileRoute.ts @@ -65,6 +65,7 @@ export class FileRoute< TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'], > { + /** @internal */ silent?: boolean constructor( diff --git a/packages/solid-router/src/history.ts b/packages/solid-router/src/history.ts index 2271af692cd..190b60e4ed0 100644 --- a/packages/solid-router/src/history.ts +++ b/packages/solid-router/src/history.ts @@ -4,6 +4,7 @@ declare module '@tanstack/history' { interface HistoryState { __tempLocation?: HistoryLocation __tempKey?: string + /** @internal */ __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions } } diff --git a/packages/solid-router/src/index.tsx b/packages/solid-router/src/index.tsx index 9b1026a6b8b..be5631c1bd1 100644 --- a/packages/solid-router/src/index.tsx +++ b/packages/solid-router/src/index.tsx @@ -1,6 +1,17 @@ export { defer, isMatch, + rootRouteId, + defaultParseSearch, + defaultStringifySearch, + parseSearchWith, + stringifySearchWith, + retainSearchParams, + stripSearchParams, + createSerializationAdapter, +} from '@tanstack/router-core' +/** @internal */ +export { joinPaths, cleanPath, trimPathLeft, @@ -8,18 +19,10 @@ export { trimPath, resolvePath, interpolatePath, - rootRouteId, - defaultParseSearch, - defaultStringifySearch, - parseSearchWith, - stringifySearchWith, functionalUpdate, replaceEqualDeep, deepEqual, createControlledPromise, - retainSearchParams, - stripSearchParams, - createSerializationAdapter, } from '@tanstack/router-core' export type { @@ -38,19 +41,14 @@ export type { SearchSchemaInput, AnyContext, RouteContext, - PreloadableObj, RoutePathOptions, StaticDataRouteOption, - RoutePathOptionsIntersection, UpdatableStaticRouteOption, - MetaDescriptor, - RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, - ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, @@ -71,22 +69,17 @@ export type { TrailingSlashOption, Manifest, RouterManagedTag, - ControlledPromise, Constrain, Expand, - MergeAll, Assign, IntersectAssign, - ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, - AnyValidatorFn, AnyValidatorObj, - ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, @@ -112,7 +105,6 @@ export type { ToPathOption, LinkOptions, MakeOptionalPathParams, - AnyRouterWithContext, ParseRoute, RoutesById, RouteById, @@ -125,8 +117,6 @@ export type { AllLoaderData, FullSearchSchemaInput, AllContext, - CommitLocationOptions, - MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, @@ -142,7 +132,6 @@ export type { AnyRedirect, Redirect, RedirectOptions, - ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, @@ -153,12 +142,10 @@ export type { MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, - RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, - AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, @@ -170,26 +157,46 @@ export type { RegisteredRouter, RouterEvents, RouterEvent, - RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, - ControllablePromise, - CreateFileRoute, - CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, + CreateFileRoute, + ResolveValidatorInput, + ResolveValidatorInputFn, +} from '@tanstack/router-core' +/** @internal */ +export type { + PreloadableObj, + RoutePathOptionsIntersection, + MetaDescriptor, + RouteLinkEntry, + ErrorRouteProps, + ControlledPromise, + MergeAll, + AnyValidatorFn, + AnyRouterWithContext, + CommitLocationOptions, + MatchLocation, + ResolvedRedirect, + RouteContextFn, + AnyRouteWithContext, + RouterListener, + ControllablePromise, + CreateLazyFileRoute, } from '@tanstack/router-core' export { - createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history' +/** @internal */ +export { createHistory } from '@tanstack/history' export type { BlockerFn, @@ -208,11 +215,12 @@ export { ClientOnly, useHydrated } from './ClientOnly' export { FileRoute, createFileRoute, - FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute' +/** @internal */ +export { FileRouteLoader } from './fileRoute' export * from './history' @@ -229,17 +237,20 @@ export type { } from './link' export { - Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches' +/** @internal */ +export { Matches } from './Matches' export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches' -export { Match, Outlet } from './Match' +export { Outlet } from './Match' +/** @internal */ +export { Match } from './Match' export { useMatch } from './useMatch' export { useLoaderDeps } from './useLoaderDeps' @@ -276,7 +287,9 @@ export { createRouter, Router } from './router' export { lazyFn, SearchParamError } from '@tanstack/router-core' -export { RouterProvider, RouterContextProvider } from './RouterProvider' +export { RouterProvider } from './RouterProvider' +/** @internal */ +export { RouterContextProvider } from './RouterProvider' export type { RouterProps } from './RouterProvider' export { @@ -304,36 +317,44 @@ export type { NotFoundError } from '@tanstack/router-core' export type { ValidateLinkOptions, + ValidateLinkOptionsArray, +} from './typePrimitives' +/** @internal */ +export type { ValidateUseSearchOptions, ValidateUseParamsOptions, - ValidateLinkOptionsArray, } from './typePrimitives' export type { ValidateFromPath, - ValidateToPath, - ValidateSearch, - ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, - ValidateNavigateOptionsArray, ValidateRedirectOptions, + InferSelected, + InferShouldThrow, + InferStrict, +} from '@tanstack/router-core' +/** @internal */ +export type { + ValidateToPath, + ValidateSearch, + ValidateParams, + ValidateNavigateOptionsArray, ValidateRedirectOptionsArray, ValidateId, - InferStrict, - InferShouldThrow, - InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from '@tanstack/router-core' export { ScriptOnce } from './ScriptOnce' +/** @internal */ export { Asset } from './Asset' export { HeadContent } from './HeadContent' +/** @internal */ export { useTags } from './headContentUtils' export { Scripts } from './Scripts' export { composeRewrites } from '@tanstack/router-core' diff --git a/packages/vue-router/api/index.api.md b/packages/vue-router/api/index.api.md index 53fa6f7185a..430a83f238e 100644 --- a/packages/vue-router/api/index.api.md +++ b/packages/vue-router/api/index.api.md @@ -19,13 +19,10 @@ import { AnyRedirect } from '@tanstack/router-core'; import { AnyRoute } from '@tanstack/router-core'; import { AnyRouteMatch } from '@tanstack/router-core'; import { AnyRouter } from '@tanstack/router-core'; -import { AnyRouterWithContext } from '@tanstack/router-core'; -import { AnyRouteWithContext } from '@tanstack/router-core'; import { AnySchema } from '@tanstack/router-core'; import { AnySerializationAdapter } from '@tanstack/router-core'; import { AnyValidator } from '@tanstack/router-core'; import { AnyValidatorAdapter } from '@tanstack/router-core'; -import { AnyValidatorFn } from '@tanstack/router-core'; import { AnyValidatorObj } from '@tanstack/router-core'; import { AssetCrossOriginConfig } from '@tanstack/router-core'; import { Assign } from '@tanstack/router-core'; @@ -38,27 +35,18 @@ import { BeforeLoadContextParameter } from '@tanstack/router-core'; import { BlockerFn } from '@tanstack/history'; import { BuildLocationFn } from '@tanstack/router-core'; import { BuildNextOptions } from '@tanstack/router-core'; -import { cleanPath } from '@tanstack/router-core'; -import { CommitLocationOptions } from '@tanstack/router-core'; import { composeRewrites } from '@tanstack/router-core'; import { Constrain } from '@tanstack/router-core'; import { ConstrainLiteral } from '@tanstack/router-core'; import { ContextAsyncReturnType } from '@tanstack/router-core'; import { ContextOptions } from '@tanstack/router-core'; import { ContextReturnType } from '@tanstack/router-core'; -import { ControllablePromise } from '@tanstack/router-core'; -import { ControlledPromise } from '@tanstack/router-core'; import { createBrowserHistory } from '@tanstack/history'; -import { createControlledPromise } from '@tanstack/router-core'; import { CreateFileRoute } from '@tanstack/router-core'; import { createHashHistory } from '@tanstack/history'; -import { createHistory } from '@tanstack/history'; -import { CreateLazyFileRoute } from '@tanstack/router-core'; import { createMemoryHistory } from '@tanstack/history'; -import { createRouterConfig } from '@tanstack/router-core'; import { CreateRouterFn } from '@tanstack/router-core'; import { createSerializationAdapter } from '@tanstack/router-core'; -import { deepEqual } from '@tanstack/router-core'; import { DeepPartial } from '@tanstack/router-core'; import { DEFAULT_PROTOCOL_ALLOWLIST } from '@tanstack/router-core'; import { defaultParseSearch } from '@tanstack/router-core'; @@ -68,14 +56,12 @@ import { defer } from '@tanstack/router-core'; import { DeferredPromise } from '@tanstack/router-core'; import { DeferredPromiseState } from '@tanstack/router-core'; import { ErrorComponentProps } from '@tanstack/router-core'; -import { ErrorRouteProps } from '@tanstack/router-core'; import { Expand } from '@tanstack/router-core'; import { FileBaseRouteOptions } from '@tanstack/router-core'; import { FileRoutesByPath } from '@tanstack/router-core'; import { FileRouteTypes } from '@tanstack/router-core'; import { FromPathOption } from '@tanstack/router-core'; import { FullSearchSchemaOption } from '@tanstack/router-core'; -import { functionalUpdate } from '@tanstack/router-core'; import { HistoryAction } from '@tanstack/history'; import { HistoryLocation } from '@tanstack/history'; import { HistoryState } from '@tanstack/history'; @@ -91,12 +77,10 @@ import { InferSelected } from '@tanstack/router-core'; import { InferShouldThrow } from '@tanstack/router-core'; import { InferStrict } from '@tanstack/router-core'; import { InferTo } from '@tanstack/router-core'; -import { interpolatePath } from '@tanstack/router-core'; import { IntersectAssign } from '@tanstack/router-core'; import { isMatch } from '@tanstack/router-core'; import { isNotFound } from '@tanstack/router-core'; import { isRedirect } from '@tanstack/router-core'; -import { joinPaths } from '@tanstack/router-core'; import { JSX } from 'vue/jsx-runtime'; import { lazyFn } from '@tanstack/router-core'; import { LazyRouteOptions } from '@tanstack/router-core'; @@ -114,10 +98,7 @@ import { MakeRouteMatch } from '@tanstack/router-core'; import { MakeRouteMatchUnion } from '@tanstack/router-core'; import { Manifest } from '@tanstack/router-core'; import { MaskOptions } from '@tanstack/router-core'; -import { MatchLocation } from '@tanstack/router-core'; import { MatchRouteOptions } from '@tanstack/router-core'; -import { MergeAll } from '@tanstack/router-core'; -import { MetaDescriptor } from '@tanstack/router-core'; import { NavigateFn } from '@tanstack/router-core'; import { NavigateOptions } from '@tanstack/router-core'; import { notFound } from '@tanstack/router-core'; @@ -130,7 +111,6 @@ import { ParseParamsFn } from '@tanstack/router-core'; import { ParseRoute } from '@tanstack/router-core'; import { parseSearchWith } from '@tanstack/router-core'; import { PathParamOptions } from '@tanstack/router-core'; -import { PreloadableObj } from '@tanstack/router-core'; import { Redirect } from '@tanstack/router-core'; import { redirect } from '@tanstack/router-core'; import { RedirectOptions } from '@tanstack/router-core'; @@ -144,11 +124,9 @@ import { RelativeToPathAutoComplete } from '@tanstack/router-core'; import { RemountDepsOptions } from '@tanstack/router-core'; import { RemoveLeadingSlashes } from '@tanstack/router-core'; import { RemoveTrailingSlashes } from '@tanstack/router-core'; -import { replaceEqualDeep } from '@tanstack/router-core'; import { ReservedProps } from '@vue/runtime-dom'; import { ResolveAllContext } from '@tanstack/router-core'; import { ResolveAllParamsFromParent } from '@tanstack/router-core'; -import { ResolvedRedirect } from '@tanstack/router-core'; import { ResolveFullPath } from '@tanstack/router-core'; import { ResolveFullSearchSchema } from '@tanstack/router-core'; import { ResolveFullSearchSchemaInput } from '@tanstack/router-core'; @@ -156,7 +134,6 @@ import { ResolveId } from '@tanstack/router-core'; import { ResolveLoaderData } from '@tanstack/router-core'; import { ResolveOptionalParams } from '@tanstack/router-core'; import { ResolveParams } from '@tanstack/router-core'; -import { resolvePath } from '@tanstack/router-core'; import { ResolveRelativePath } from '@tanstack/router-core'; import { ResolveRequiredParams } from '@tanstack/router-core'; import { ResolveRoute } from '@tanstack/router-core'; @@ -180,18 +157,14 @@ import { Route as Route_2 } from '@tanstack/router-core'; import { RouteById } from '@tanstack/router-core'; import { RouteConstraints } from '@tanstack/router-core'; import { RouteContext } from '@tanstack/router-core'; -import { RouteContextFn } from '@tanstack/router-core'; import { RouteContextOptions } from '@tanstack/router-core'; import { RouteContextParameter } from '@tanstack/router-core'; import { RouteIds } from '@tanstack/router-core'; -import { RouteLinkEntry } from '@tanstack/router-core'; -import { RouteLoaderEntry } from '@tanstack/router-core'; import { RouteLoaderFn } from '@tanstack/router-core'; import { RouteMask } from '@tanstack/router-core'; import { RouteMatch } from '@tanstack/router-core'; import { RouteOptions } from '@tanstack/router-core'; import { RoutePathOptions } from '@tanstack/router-core'; -import { RoutePathOptionsIntersection } from '@tanstack/router-core'; import { RoutePaths } from '@tanstack/router-core'; import { RouterConstructorOptions } from '@tanstack/router-core'; import { RouterContextOptions } from '@tanstack/router-core'; @@ -199,7 +172,6 @@ import { RouterCore } from '@tanstack/router-core'; import { RouterEvent } from '@tanstack/router-core'; import { RouterEvents } from '@tanstack/router-core'; import { RouterHistory } from '@tanstack/history'; -import { RouterListener } from '@tanstack/router-core'; import { RouterManagedTag } from '@tanstack/router-core'; import { RouterOptions } from '@tanstack/router-core'; import { RouterState } from '@tanstack/router-core'; @@ -228,11 +200,8 @@ import { ToSubOptions } from '@tanstack/router-core'; import { ToSubOptionsProps } from '@tanstack/router-core'; import { TrailingSlashOption } from '@tanstack/router-core'; import { TrimPath } from '@tanstack/router-core'; -import { trimPath } from '@tanstack/router-core'; import { TrimPathLeft } from '@tanstack/router-core'; -import { trimPathLeft } from '@tanstack/router-core'; import { TrimPathRight } from '@tanstack/router-core'; -import { trimPathRight } from '@tanstack/router-core'; import { UpdatableRouteOptions } from '@tanstack/router-core'; import { UpdatableStaticRouteOption } from '@tanstack/router-core'; import { UseLoaderDataResult } from '@tanstack/router-core'; @@ -244,16 +213,8 @@ import { UseRouteContextOptions } from '@tanstack/router-core'; import { UseRouteContextResult } from '@tanstack/router-core'; import { UseSearchResult } from '@tanstack/router-core'; import { ValidateFromPath } from '@tanstack/router-core'; -import { ValidateId } from '@tanstack/router-core'; import { ValidateNavigateOptions } from '@tanstack/router-core'; -import { ValidateNavigateOptionsArray } from '@tanstack/router-core'; -import { ValidateParams } from '@tanstack/router-core'; import { ValidateRedirectOptions } from '@tanstack/router-core'; -import { ValidateRedirectOptionsArray } from '@tanstack/router-core'; -import { ValidateSearch } from '@tanstack/router-core'; -import { ValidateToPath } from '@tanstack/router-core'; -import { ValidateUseParamsResult } from '@tanstack/router-core'; -import { ValidateUseSearchResult } from '@tanstack/router-core'; import { Validator } from '@tanstack/router-core'; import { ValidatorAdapter } from '@tanstack/router-core'; import { ValidatorFn } from '@tanstack/router-core'; @@ -285,10 +246,6 @@ export { AnyRouteMatch } export { AnyRouter } -export { AnyRouterWithContext } - -export { AnyRouteWithContext } - export { AnySchema } export { AnySerializationAdapter } @@ -297,13 +254,8 @@ export { AnyValidator } export { AnyValidatorAdapter } -export { AnyValidatorFn } - export { AnyValidatorObj } -// @public (undocumented) -export function Asset(asset: RouterManagedTag): any; - export { Assign } // @public (undocumented) @@ -401,8 +353,6 @@ export const CatchNotFound: Vue.DefineComponent> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>; -export { cleanPath } - // @public export const ClientOnly: Vue.DefineComponent; }, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>; -export { CommitLocationOptions } - export { composeRewrites } export { Constrain } @@ -436,14 +384,8 @@ export { ContextOptions } export { ContextReturnType } -export { ControllablePromise } - -export { ControlledPromise } - export { createBrowserHistory } -export { createControlledPromise } - export { CreateFileRoute } // @public (undocumented) @@ -451,10 +393,6 @@ export function createFileRoute(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute; @@ -486,12 +424,8 @@ export function createRouteMask; -export { ErrorRouteProps } - export { Expand } export { FileBaseRouteOptions } @@ -542,21 +474,14 @@ export class FileRoute, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions & UpdatableRouteOptions) => Route_2; // (undocumented) path?: TFilePath | undefined; - // (undocumented) - silent?: boolean; } -// @public @deprecated (undocumented) -export function FileRouteLoader(_path: TFilePath): (loaderFn: Constrain>) => TLoaderFn; - export { FileRoutesByPath } export { FileRouteTypes } export { FullSearchSchemaOption } -export { functionalUpdate } - // @public (undocumented) export function getRouteApi(id: ConstrainLiteral>): RouteApi; @@ -610,8 +535,6 @@ export { InferStrict } export { InferTo } -export { interpolatePath } - export { IntersectAssign } export { isMatch } @@ -620,8 +543,6 @@ export { isNotFound } export { isRedirect } -export { joinPaths } - export { lazyFn } // @public (undocumented) @@ -724,26 +645,6 @@ export { MakeRouteMatchUnion } export { Manifest } -// @public (undocumented) -export const Match: Vue.DefineComponent, () => VNode, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>; - -// @public (undocumented) -export const Matches: Vue.DefineComponent<{}, () => Vue.VNode, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>; - -export { MatchLocation } - // Warning: (ae-forgotten-export) The symbol "MatchRouteComponentType" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -751,10 +652,6 @@ export const MatchRoute: MatchRouteComponentType; export { MatchRouteOptions } -export { MergeAll } - -export { MetaDescriptor } - // @public (undocumented) export function Navigate(props: NavigateOptions): null; @@ -791,8 +688,6 @@ export { parseSearchWith } export { PathParamOptions } -export { PreloadableObj } - export { Redirect } export { redirect } @@ -817,14 +712,10 @@ export { RemoveLeadingSlashes } export { RemoveTrailingSlashes } -export { replaceEqualDeep } - export { ResolveAllContext } export { ResolveAllParamsFromParent } -export { ResolvedRedirect } - export { ResolveFullPath } export { ResolveFullSearchSchema } @@ -839,8 +730,6 @@ export { ResolveOptionalParams } export { ResolveParams } -export { resolvePath } - export { ResolveRelativePath } export { ResolveRequiredParams } @@ -951,16 +840,12 @@ export { RouteConstraints } export { RouteContext } -export { RouteContextFn } - export { RouteContextOptions } export { RouteContextParameter } export { RouteIds } -export { RouteLinkEntry } - export { RouteLoaderFn } export { RouteMask } @@ -971,8 +856,6 @@ export { RouteOptions } export { RoutePathOptions } -export { RoutePathOptionsIntersection } - // @public (undocumented) export class Router = Record> extends RouterCore { constructor(options: RouterConstructorOptions); @@ -982,31 +865,12 @@ export { RouterConstructorOptions } export { RouterContextOptions } -// @public (undocumented) -export const RouterContextProvider: Vue.DefineComponent, () => Vue.VNode | Vue.VNode[] | undefined, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>; - export { RouterEvent } export { RouterEvents } export { RouterHistory } -export { RouterListener } - export { RouterManagedTag } export { RouterOptions } @@ -1094,16 +958,10 @@ export { TrailingSlashOption } export { TrimPath } -export { trimPath } - export { TrimPathLeft } -export { trimPathLeft } - export { TrimPathRight } -export { trimPathRight } - export { UpdatableRouteOptions } export { UpdatableStaticRouteOption } @@ -1227,13 +1085,8 @@ export function useRouterState(opts: UseSearchOptions, TSelected>): Vue.Ref, TThrow>>; -// @public (undocumented) -export const useTags: (assetCrossOrigin?: AssetCrossOriginConfig) => () => RouterManagedTag[]; - export { ValidateFromPath } -export { ValidateId } - // @public (undocumented) export type ValidateLinkOptions = Constrain, InferTo, InferMaskFrom, InferMaskTo>>; @@ -1244,28 +1097,8 @@ export type ValidateLinkOptionsArray = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseParamsResult } - -// @public (undocumented) -export type ValidateUseSearchOptions = Constrain, InferStrict, InferShouldThrow, InferSelected>>; - -export { ValidateUseSearchResult } - export { Validator } export { ValidatorAdapter } @@ -1274,9 +1107,6 @@ export { ValidatorFn } export { ValidatorObj } -// @public (undocumented) -export type VueNode = Vue.VNode; - // (No @packageDocumentation comment for this package) ``` @@ -1292,17 +1122,12 @@ declare module "@tanstack/history" { interface HistoryState { __tempLocation?: HistoryLocation; __tempKey?: string; - __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions; } } // Matches.d.ts declare module "@tanstack/router-core" { interface RouteMatchExtensions { - meta?: Array; - links?: Array; - scripts?: Array; - headScripts?: Array; } } diff --git a/packages/vue-router/src/Matches.tsx b/packages/vue-router/src/Matches.tsx index a22ec82e821..bb68912f1f9 100644 --- a/packages/vue-router/src/Matches.tsx +++ b/packages/vue-router/src/Matches.tsx @@ -26,9 +26,13 @@ type ErrorRouteComponentType = (props: ErrorComponentProps) => Vue.VNode declare module '@tanstack/router-core' { export interface RouteMatchExtensions { + /** @internal */ meta?: Array + /** @internal */ links?: Array + /** @internal */ scripts?: Array + /** @internal */ headScripts?: Array } } diff --git a/packages/vue-router/src/fileRoute.ts b/packages/vue-router/src/fileRoute.ts index 69334b79ee9..6c6a6a34fff 100644 --- a/packages/vue-router/src/fileRoute.ts +++ b/packages/vue-router/src/fileRoute.ts @@ -65,6 +65,7 @@ export class FileRoute< TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'], > { + /** @internal */ silent?: boolean constructor( diff --git a/packages/vue-router/src/history.ts b/packages/vue-router/src/history.ts index 2271af692cd..190b60e4ed0 100644 --- a/packages/vue-router/src/history.ts +++ b/packages/vue-router/src/history.ts @@ -4,6 +4,7 @@ declare module '@tanstack/history' { interface HistoryState { __tempLocation?: HistoryLocation __tempKey?: string + /** @internal */ __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions } } diff --git a/packages/vue-router/src/index.tsx b/packages/vue-router/src/index.tsx index f63a763e25a..4e66dce8b53 100644 --- a/packages/vue-router/src/index.tsx +++ b/packages/vue-router/src/index.tsx @@ -1,6 +1,17 @@ export { defer, isMatch, + rootRouteId, + defaultParseSearch, + defaultStringifySearch, + parseSearchWith, + stringifySearchWith, + retainSearchParams, + stripSearchParams, + createSerializationAdapter, +} from '@tanstack/router-core' +/** @internal */ +export { joinPaths, cleanPath, trimPathLeft, @@ -8,18 +19,10 @@ export { trimPath, resolvePath, interpolatePath, - rootRouteId, - defaultParseSearch, - defaultStringifySearch, - parseSearchWith, - stringifySearchWith, functionalUpdate, replaceEqualDeep, deepEqual, createControlledPromise, - retainSearchParams, - stripSearchParams, - createSerializationAdapter, } from '@tanstack/router-core' export type { @@ -39,19 +42,14 @@ export type { SearchSchemaInput, AnyContext, RouteContext, - PreloadableObj, RoutePathOptions, StaticDataRouteOption, - RoutePathOptionsIntersection, UpdatableStaticRouteOption, - MetaDescriptor, - RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, - ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, @@ -72,13 +70,10 @@ export type { TrailingSlashOption, Manifest, RouterManagedTag, - ControlledPromise, Constrain, Expand, - MergeAll, Assign, IntersectAssign, - ResolveValidatorInput, ResolveValidatorOutput, Register, AnyValidator, @@ -86,9 +81,7 @@ export type { ValidatorFn, AnySchema, AnyValidatorAdapter, - AnyValidatorFn, AnyValidatorObj, - ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, @@ -98,18 +91,32 @@ export type { FileRoutesByPath, RouteById, RootRouteOptions, - CreateFileRoute, SerializationAdapter, AnySerializationAdapter, SerializableExtensions, + CreateFileRoute, + ResolveValidatorInput, + ResolveValidatorInputFn, +} from '@tanstack/router-core' +/** @internal */ +export type { + PreloadableObj, + RoutePathOptionsIntersection, + MetaDescriptor, + RouteLinkEntry, + ErrorRouteProps, + ControlledPromise, + MergeAll, + AnyValidatorFn, } from '@tanstack/router-core' export { - createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history' +/** @internal */ +export { createHistory } from '@tanstack/history' export type { BlockerFn, @@ -127,11 +134,12 @@ export { CatchBoundary, ErrorComponent } from './CatchBoundary' export { FileRoute, createFileRoute, - FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute' +/** @internal */ +export { FileRouteLoader } from './fileRoute' export * from './history' @@ -169,20 +177,14 @@ export type { MakeRemountDepsOptionsUnion, RemountDepsOptions, ResolveFullPath, - AnyRouteWithContext, - AnyRouterWithContext, - CommitLocationOptions, - MatchLocation, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, - ResolvedRedirect, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, - RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, @@ -196,7 +198,6 @@ export type { AnyRouter, RegisteredRouter, RouterContextOptions, - ControllablePromise, RouterOptions, RouterState, ListenerFn, @@ -204,10 +205,20 @@ export type { RouterConstructorOptions, RouterEvents, RouterEvent, - RouterListener, RouteConstraints, RouteMask, MatchRouteOptions, +} from '@tanstack/router-core' +/** @internal */ +export type { + AnyRouteWithContext, + AnyRouterWithContext, + CommitLocationOptions, + MatchLocation, + ResolvedRedirect, + RouteContextFn, + ControllablePromise, + RouterListener, CreateLazyFileRoute, } from '@tanstack/router-core' export type { @@ -221,17 +232,20 @@ export type { } from './link' export { - Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches' +/** @internal */ +export { Matches } from './Matches' export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches' -export { Match, Outlet } from './Match' +export { Outlet } from './Match' +/** @internal */ +export { Match } from './Match' export { useMatch } from './useMatch' export { useLoaderDeps } from './useLoaderDeps' @@ -240,9 +254,10 @@ export { useLoaderData } from './useLoaderData' export { redirect, isRedirect, - createRouterConfig, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/router-core' +/** @internal */ +export { createRouterConfig } from '@tanstack/router-core' export { RouteApi, @@ -258,19 +273,22 @@ export { } from './route' export type { AnyRootRoute, - VueNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route' +/** @internal */ +export type { VueNode } from './route' export { createRouter, Router } from './router' export { lazyFn, SearchParamError } from '@tanstack/router-core' -export { RouterProvider, RouterContextProvider } from './RouterProvider' +export { RouterProvider } from './RouterProvider' +/** @internal */ +export { RouterContextProvider } from './RouterProvider' export type { RouterProps } from './RouterProvider' export { @@ -298,35 +316,43 @@ export type { NotFoundError } from '@tanstack/router-core' export type { ValidateLinkOptions, + ValidateLinkOptionsArray, +} from './typePrimitives' +/** @internal */ +export type { ValidateUseSearchOptions, ValidateUseParamsOptions, - ValidateLinkOptionsArray, } from './typePrimitives' export type { ValidateFromPath, - ValidateToPath, - ValidateSearch, - ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, - ValidateNavigateOptionsArray, ValidateRedirectOptions, + InferSelected, + InferShouldThrow, + InferStrict, +} from '@tanstack/router-core' +/** @internal */ +export type { + ValidateToPath, + ValidateSearch, + ValidateParams, + ValidateNavigateOptionsArray, ValidateRedirectOptionsArray, ValidateId, - InferStrict, - InferShouldThrow, - InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from '@tanstack/router-core' export { ScriptOnce } from './ScriptOnce' +/** @internal */ export { Asset } from './Asset' export { HeadContent } from './HeadContent' +/** @internal */ export { useTags } from './headContentUtils' export { Scripts } from './Scripts' export { Body } from './Body'