fix: properly track re-exports of server function factories #6164
Merged
schiller-manuel(GitHub profile, opens in a new tab)merged 1 commit into
main fromrefs/pull/6164/head·merged by schiller-manuel(GitHub profile, opens in a new tab) fixes #6029
Summary by CodeRabbit#
New Features
- Added re-exported server function examples (named and wildcard) that surface middleware-applied context when invoked.
Compiler
- Enhanced compiler resolution to support re-exported server functions (named and export * patterns).
Tests
- Added end-to-end tests confirming middleware executes and context is propagated for re-exported server functions.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core
View your CI Pipeline Execution ↗ for commit 0348283630e38f9ae9d0d3e2c799c17fa552f167
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 9m 35s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 22s View ↗
☁️ Nx Cloud last updated this comment at
2025-12-20 23:14:33UTCMore templates
- tanstack-router-vue-example-basic-jsx
- tanstack-router-vue-example-basic-file-based-jsx
- tanstack-router-vue-example-basic-file-based-sfc
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-router-react-example-basic-authjs
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-rsc
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
- tanstack-router-solid-example-authenticated-routes
- tanstack-router-solid-example-authenticated-routes-firebase
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-default-search-params
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-basic-virtual-file-based
- tanstack-router-solid-example-basic-virtual-inside-file-based
- tanstack-router-solid-example-deferred-data
- tanstack-router-solid-i18n-paraglide
- tanstack-router-solid-example-kitchen-sink
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-large-file-based
- tanstack-router-solid-example-location-masking
- tanstack-router-solid-example-navigation-blocking
- tanstack-router-solid-example-quickstart
- tanstack-router-solid-example-quickstart-esbuild-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-router-solid-example-quickstart-rspack-file-based
- tanstack-router-solid-example-quickstart-webpack-file-based
- @tanstack/router-solid-mono-simple
- router-solid-mono-simple-lazy
- router-solid-monorepo-solid-query
- tanstack-router-solid-example-scroll-restoration
- tanstack-solid-router-search-validator-adapters
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-authjs
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-bun-hosting
- tanstack-solid-start-example-convex-better-auth
- tanstack-solid-start-example-counter
- tanstack-solid-start-i18n-paraglide
- tanstack-solid-start-example-large
- tanstack-solid-start-streaming-data-from-server-functions
- tanstack-solid-start-example-supabase-basic
- tanstack-solid-start-tailwind-v4
- tanstack-router-solid-example-view-transitions
- tanstack-router-solid-example-with-framer-motion
- tanstack-router-solid-example-with-trpc
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6164@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@6164@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6164@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6164@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6164@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6164@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6164@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6164@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6164@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6164@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6164@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6164@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6164@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6164@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6164@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6164@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6164@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6164@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6164@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6164@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@6164@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6164@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6164@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6164@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6164@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6164@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6164@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6164@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6164@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6164@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6164@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6164@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6164@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6164@tanstack/vue-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6164@tanstack/vue-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6164@tanstack/vue-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6164@tanstack/vue-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6164@tanstack/vue-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6164@tanstack/vue-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6164@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6164commit:
3844f82
Sign in to join this conversation.
Caution
Review failed#
The pull request is closed.
Walkthrough#
Adds test fixtures and e2e tests for re-exported server-function factories and extends the server-fn compiler to track and resolve
export */ re-exported named exports so middleware attached to factories runs correctly when factories are re-exported.Changes#
e2e/react-start/server-functions/src/routes/factory/-functions/reexportWrapper.ts,e2e/react-start/server-functions/src/routes/factory/-functions/starReexportWrapper.tse2e/react-start/server-functions/src/routes/factory/-functions/reexportIndex.ts,e2e/react-start/server-functions/src/routes/factory/-functions/starReexportIndex.tsexport { ... } from) and star (export * from) syntax to exercise re-export behavior.e2e/react-start/server-functions/src/routes/factory/-functions/functions.tsreexportedFactoryFnandstarReexportedFactoryFnthat call the re-exported wrapper factories and return name + context for assertions.e2e/react-start/server-functions/src/routes/factory/index.tsxe2e/react-start/server-functions/tests/server-functions.spec.tspackages/start-plugin-core/src/create-server-fn-plugin/compiler.tsModuleInfogainsreExportAllSources: string[]; ingestion collectsexport *sources andexport { ... } frombindings; resolution now falls back to scanning re-export sources and resolving bindings recursively so re-exported factories retain middleware.Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~45 minutes
packages/start-plugin-core/src/create-server-fn-plugin/compiler.ts(reExportAllSources propagation, caching, recursion, circular re-export edge cases).Possibly related PRs#
Suggested reviewers#
Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (5 passed)
📜 Recent review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 3844f821684ea9299fa15c7e29f6c7bd239a3649 and 0348283630e38f9ae9d0d3e2c799c17fa552f167.
📒 Files selected for processing (8)
e2e/react-start/server-functions/src/routes/factory/-functions/functions.ts(2 hunks)e2e/react-start/server-functions/src/routes/factory/-functions/reexportIndex.ts(1 hunks)e2e/react-start/server-functions/src/routes/factory/-functions/reexportWrapper.ts(1 hunks)e2e/react-start/server-functions/src/routes/factory/-functions/starReexportIndex.ts(1 hunks)e2e/react-start/server-functions/src/routes/factory/-functions/starReexportWrapper.ts(1 hunks)e2e/react-start/server-functions/src/routes/factory/index.tsx(2 hunks)e2e/react-start/server-functions/tests/server-functions.spec.ts(1 hunks)packages/start-plugin-core/src/create-server-fn-plugin/compiler.ts(6 hunks)Comment `@coderabbitai help` to get the list of available commands and usage tips.