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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
"@radix-ui/react-tooltip": "^1.2.8",
"@react-three/drei": "^10.7.7",
"@react-three/fiber": "^9.5.0",
"@sentry/node": "^10.33.0",
"@sentry/tanstackstart-react": "^10.32.1",
"@sentry/vite-plugin": "^4.6.1",
"@sentry/node": "^10.42.0",
"@sentry/tanstackstart-react": "^10.42.0",
"@stackblitz/sdk": "^1.11.0",
"@tailwindcss/typography": "^0.5.13",
"@tailwindcss/vite": "^4.1.11",
Expand Down
897 changes: 424 additions & 473 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ export interface FileRoutesByFullPath {
'/admin/': typeof AdminIndexRoute
'/blog/': typeof BlogIndexRoute
'/builder/': typeof BuilderIndexRoute
'/feed/': typeof FeedIndexRoute
'/showcase/': typeof ShowcaseIndexRoute
'/stats/': typeof StatsIndexRoute
'/feed': typeof FeedIndexRoute
'/showcase': typeof ShowcaseIndexRoute
'/stats': typeof StatsIndexRoute
'/$libraryId/$version/docs': typeof LibraryIdVersionDocsRouteWithChildren
'/admin/banners/$id': typeof AdminBannersIdRoute
'/admin/feed/$id': typeof AdminFeedIdRoute
Expand Down Expand Up @@ -763,14 +763,14 @@ export interface FileRoutesByFullPath {
'/showcase/edit/$id': typeof ShowcaseEditIdRoute
'/stats/npm/$packages': typeof StatsNpmPackagesRoute
'/$libraryId/$version/': typeof LibraryIdVersionIndexRoute
'/admin/banners/': typeof AdminBannersIndexRoute
'/admin/feed/': typeof AdminFeedIndexRoute
'/admin/feedback/': typeof AdminFeedbackIndexRoute
'/admin/notes/': typeof AdminNotesIndexRoute
'/admin/roles/': typeof AdminRolesIndexRoute
'/admin/showcases/': typeof AdminShowcasesIndexRoute
'/api/mcp/': typeof ApiMcpIndexRoute
'/stats/npm/': typeof StatsNpmIndexRoute
'/admin/banners': typeof AdminBannersIndexRoute
'/admin/feed': typeof AdminFeedIndexRoute
'/admin/feedback': typeof AdminFeedbackIndexRoute
'/admin/notes': typeof AdminNotesIndexRoute
'/admin/roles': typeof AdminRolesIndexRoute
'/admin/showcases': typeof AdminShowcasesIndexRoute
'/api/mcp': typeof ApiMcpIndexRoute
'/stats/npm': typeof StatsNpmIndexRoute
'/$libraryId/$version/docs/$': typeof LibraryIdVersionDocsSplatRoute
'/$libraryId/$version/docs/community-resources': typeof LibraryIdVersionDocsCommunityResourcesRoute
'/$libraryId/$version/docs/contributors': typeof LibraryIdVersionDocsContributorsRoute
Expand All @@ -780,10 +780,10 @@ export interface FileRoutesByFullPath {
'/api/builder/deploy/check-name': typeof ApiBuilderDeployCheckNameRoute
'/api/builder/deploy/github': typeof ApiBuilderDeployGithubRoute
'/$libraryId/$version/docs/': typeof LibraryIdVersionDocsIndexRoute
'/$libraryId/$version/docs/framework/': typeof LibraryIdVersionDocsFrameworkIndexRoute
'/$libraryId/$version/docs/framework': typeof LibraryIdVersionDocsFrameworkIndexRoute
'/$libraryId/$version/docs/framework/$framework/$': typeof LibraryIdVersionDocsFrameworkFrameworkSplatRoute
'/$libraryId/$version/docs/framework/$framework/{$}.md': typeof LibraryIdVersionDocsFrameworkFrameworkChar123Char125DotmdRoute
'/$libraryId/$version/docs/framework/$framework/': typeof LibraryIdVersionDocsFrameworkFrameworkIndexRoute
'/$libraryId/$version/docs/framework/$framework': typeof LibraryIdVersionDocsFrameworkFrameworkIndexRoute
'/$libraryId/$version/docs/framework/$framework/examples/$': typeof LibraryIdVersionDocsFrameworkFrameworkExamplesSplatRoute
}
export interface FileRoutesByTo {
Expand Down Expand Up @@ -1058,9 +1058,9 @@ export interface FileRouteTypes {
| '/admin/'
| '/blog/'
| '/builder/'
| '/feed/'
| '/showcase/'
| '/stats/'
| '/feed'
| '/showcase'
| '/stats'
| '/$libraryId/$version/docs'
| '/admin/banners/$id'
| '/admin/feed/$id'
Expand Down Expand Up @@ -1089,14 +1089,14 @@ export interface FileRouteTypes {
| '/showcase/edit/$id'
| '/stats/npm/$packages'
| '/$libraryId/$version/'
| '/admin/banners/'
| '/admin/feed/'
| '/admin/feedback/'
| '/admin/notes/'
| '/admin/roles/'
| '/admin/showcases/'
| '/api/mcp/'
| '/stats/npm/'
| '/admin/banners'
| '/admin/feed'
| '/admin/feedback'
| '/admin/notes'
| '/admin/roles'
| '/admin/showcases'
| '/api/mcp'
| '/stats/npm'
| '/$libraryId/$version/docs/$'
| '/$libraryId/$version/docs/community-resources'
| '/$libraryId/$version/docs/contributors'
Expand All @@ -1106,10 +1106,10 @@ export interface FileRouteTypes {
| '/api/builder/deploy/check-name'
| '/api/builder/deploy/github'
| '/$libraryId/$version/docs/'
| '/$libraryId/$version/docs/framework/'
| '/$libraryId/$version/docs/framework'
| '/$libraryId/$version/docs/framework/$framework/$'
| '/$libraryId/$version/docs/framework/$framework/{$}.md'
| '/$libraryId/$version/docs/framework/$framework/'
| '/$libraryId/$version/docs/framework/$framework'
| '/$libraryId/$version/docs/framework/$framework/examples/$'
fileRoutesByTo: FileRoutesByTo
to:
Expand Down Expand Up @@ -1596,21 +1596,21 @@ declare module '@tanstack/react-router' {
'/stats/': {
id: '/stats/'
path: '/stats'
fullPath: '/stats/'
fullPath: '/stats'
preLoaderRoute: typeof StatsIndexRouteImport
parentRoute: typeof rootRouteImport
}
'/showcase/': {
id: '/showcase/'
path: '/showcase'
fullPath: '/showcase/'
fullPath: '/showcase'
preLoaderRoute: typeof ShowcaseIndexRouteImport
parentRoute: typeof rootRouteImport
}
'/feed/': {
id: '/feed/'
path: '/feed'
fullPath: '/feed/'
fullPath: '/feed'
preLoaderRoute: typeof FeedIndexRouteImport
parentRoute: typeof rootRouteImport
}
Expand Down Expand Up @@ -1806,56 +1806,56 @@ declare module '@tanstack/react-router' {
'/stats/npm/': {
id: '/stats/npm/'
path: '/stats/npm'
fullPath: '/stats/npm/'
fullPath: '/stats/npm'
preLoaderRoute: typeof StatsNpmIndexRouteImport
parentRoute: typeof rootRouteImport
}
'/api/mcp/': {
id: '/api/mcp/'
path: '/api/mcp'
fullPath: '/api/mcp/'
fullPath: '/api/mcp'
preLoaderRoute: typeof ApiMcpIndexRouteImport
parentRoute: typeof rootRouteImport
}
'/admin/showcases/': {
id: '/admin/showcases/'
path: '/showcases'
fullPath: '/admin/showcases/'
fullPath: '/admin/showcases'
preLoaderRoute: typeof AdminShowcasesIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
'/admin/roles/': {
id: '/admin/roles/'
path: '/roles'
fullPath: '/admin/roles/'
fullPath: '/admin/roles'
preLoaderRoute: typeof AdminRolesIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
'/admin/notes/': {
id: '/admin/notes/'
path: '/notes'
fullPath: '/admin/notes/'
fullPath: '/admin/notes'
preLoaderRoute: typeof AdminNotesIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
'/admin/feedback/': {
id: '/admin/feedback/'
path: '/feedback'
fullPath: '/admin/feedback/'
fullPath: '/admin/feedback'
preLoaderRoute: typeof AdminFeedbackIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
'/admin/feed/': {
id: '/admin/feed/'
path: '/feed'
fullPath: '/admin/feed/'
fullPath: '/admin/feed'
preLoaderRoute: typeof AdminFeedIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
'/admin/banners/': {
id: '/admin/banners/'
path: '/banners'
fullPath: '/admin/banners/'
fullPath: '/admin/banners'
preLoaderRoute: typeof AdminBannersIndexRouteImport
parentRoute: typeof AdminRouteRoute
}
Expand Down Expand Up @@ -2121,14 +2121,14 @@ declare module '@tanstack/react-router' {
'/$libraryId/$version/docs/framework/': {
id: '/$libraryId/$version/docs/framework/'
path: '/framework'
fullPath: '/$libraryId/$version/docs/framework/'
fullPath: '/$libraryId/$version/docs/framework'
preLoaderRoute: typeof LibraryIdVersionDocsFrameworkIndexRouteImport
parentRoute: typeof LibraryIdVersionDocsRoute
}
'/$libraryId/$version/docs/framework/$framework/': {
id: '/$libraryId/$version/docs/framework/$framework/'
path: '/framework/$framework'
fullPath: '/$libraryId/$version/docs/framework/$framework/'
fullPath: '/$libraryId/$version/docs/framework/$framework'
preLoaderRoute: typeof LibraryIdVersionDocsFrameworkFrameworkIndexRouteImport
parentRoute: typeof LibraryIdVersionDocsRoute
}
Expand Down
95 changes: 49 additions & 46 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './instrument.server.mjs'

import { wrapFetchWithSentry } from '@sentry/tanstackstart-react'
import handler, { createServerEntry } from '@tanstack/react-start/server-entry'
import {
installProductionFetchProbe,
Expand All @@ -13,54 +14,56 @@ import {
installProductionFetchProbe()
installProductionProcessProbe()

export default createServerEntry({
async fetch(request) {
return runWithRequestDiagnostics(request, async (context) => {
const url = new URL(request.url)
logRequestStart(context)
export default createServerEntry(
wrapFetchWithSentry({
async fetch(request) {
return runWithRequestDiagnostics(request, async (context) => {
const url = new URL(request.url)
logRequestStart(context)

try {
const acceptHeader = request.headers.get('Accept') || ''
if (
acceptHeader.includes('text/markdown') &&
url.pathname.includes('/docs/') &&
!url.pathname.endsWith('.md')
) {
logRequestEnd(context, 303, { redirectToMarkdown: true })
return new Response(null, {
status: 303,
headers: {
Location: `${url.pathname}.md`,
},
})
}
try {
const acceptHeader = request.headers.get('Accept') || ''
if (
acceptHeader.includes('text/markdown') &&
url.pathname.includes('/docs/') &&
!url.pathname.endsWith('.md')
) {
logRequestEnd(context, 303, { redirectToMarkdown: true })
return new Response(null, {
status: 303,
headers: {
Location: `${url.pathname}.md`,
},
})
}

const response = await handler.fetch(request)
const response = await handler.fetch(request)

if (
url.pathname === '/builder' ||
url.pathname.startsWith('/builder/')
) {
const newHeaders = new Headers(response.headers)
newHeaders.set('Cross-Origin-Opener-Policy', 'same-origin')
newHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp')
if (
url.pathname === '/builder' ||
url.pathname.startsWith('/builder/')
) {
const newHeaders = new Headers(response.headers)
newHeaders.set('Cross-Origin-Opener-Policy', 'same-origin')
newHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp')

logRequestEnd(context, response.status, {
builderIsolatedHeaders: true,
})
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
})
}
logRequestEnd(context, response.status, {
builderIsolatedHeaders: true,
})
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
})
}

logRequestEnd(context, response.status)
return response
} catch (error) {
logRequestError(context, error)
throw error
}
})
},
})
logRequestEnd(context, response.status)
return response
} catch (error) {
logRequestError(context, error)
throw error
}
})
},
}),
)
12 changes: 12 additions & 0 deletions src/start.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
sentryGlobalFunctionMiddleware,
sentryGlobalRequestMiddleware,
} from '@sentry/tanstackstart-react'
import { createStart } from '@tanstack/react-start'

export const startInstance = createStart(() => {
return {
requestMiddleware: [sentryGlobalRequestMiddleware],
functionMiddleware: [sentryGlobalFunctionMiddleware],
}
})
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite'
import { defineConfig } from 'vite'
import contentCollections from '@content-collections/vite'
import tsConfigPaths from 'vite-tsconfig-paths'
Expand Down Expand Up @@ -116,7 +116,7 @@ export default defineConfig({
: []),
viteReact(),

sentryVitePlugin({
sentryTanstackStart({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'tanstack',
project: 'tanstack-com',
Expand Down
Loading