fix: generic env handling #5811
Merged
schiller-manuel(GitHub profile, opens in a new tab)merged 2 commits into
main fromrefs/pull/5811/head·merged by schiller-manuel(GitHub profile, opens in a new tab) Summary by CodeRabbit#
New Features
- Added
providerEnvoption to configure a custom server environment for server functions
- Added
Refactor
- Improved plugin architecture to support per-environment configurations for client and server builds
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core
View your CI Pipeline Execution ↗ for commit 1fcdd98f3441282ba1c5d462b3f6d91b0d66e62a
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 5m 38s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 1s View ↗
☁️ Nx Cloud last updated this comment at
2025-11-10 23:34:01UTCMore templates
- tanstack-router-solid-example-basic
- 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-streaming-file-based
- 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-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- 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-example-basic-supabase
- tanstack-solid-start-example-convex-better-auth
- 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-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- 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/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5811@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5811@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5811@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5811@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5811@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5811@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5811@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5811@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5811@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5811@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5811@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5811@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5811@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5811@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5811@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5811@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5811@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5811@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5811@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5811@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5811@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5811@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5811@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5811@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5811@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5811@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5811@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5811@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5811@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5811@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5811@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5811@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5811@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5811@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5811commit:
1fcdd98
Sign in to join this conversation.
Walkthrough#
Refactored the Vite plugin pipeline to support per-environment server function handling. The directive configuration is now dynamic via options. Plugins are generated per-environment rather than using a single multipurpose instance. A new
providerEnvoption allows customizing the server provider environment. Core plugin signatures updated to accept and propagate environment configurations throughout the compilation pipeline.Changes#
packages/start-plugin-core/src/create-server-fn-plugin/handleCreateServerFn.ts'use server'to use the value ofopts.directive, enabling dynamic directive specification.packages/start-plugin-core/src/create-server-fn-plugin/plugin.tspackages/start-plugin-core/src/plugin.tsproviderEnv?: stringoption to serverFn config. Builds environments list dynamically and conditionally appends custom server environment. Refactored plugin invocation signatures to propagate environment array:startCompilerPluginandcreateServerFnPluginnow acceptenvironmentsparameter. Server function runtime environment selection now usesproviderEnvwith fallback to default.packages/start-plugin-core/src/start-compiler-plugin/plugin.tsperEnvCompilerPluginhelper generating separate plugin objects per environment with environment-specific configuration. Transform filter consolidated into constant. Compilation pipeline now passes environment type to compiler and uses per-environment isolated transformation logic.Sequence Diagram(s)#
Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs#
Suggested labels#
package: start-server-core,package: start-client-corePoem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 1b75808f37ebe88b6484ac071ebd0b8131a8dcee and 1fcdd98f3441282ba1c5d462b3f6d91b0d66e62a.
📒 Files selected for processing (4)
packages/start-plugin-core/src/create-server-fn-plugin/handleCreateServerFn.ts(1 hunks)packages/start-plugin-core/src/create-server-fn-plugin/plugin.ts(6 hunks)packages/start-plugin-core/src/plugin.ts(4 hunks)packages/start-plugin-core/src/start-compiler-plugin/plugin.ts(2 hunks)🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/start-plugin-core/src/create-server-fn-plugin/handleCreateServerFn.tspackages/start-plugin-core/src/create-server-fn-plugin/plugin.tspackages/start-plugin-core/src/start-compiler-plugin/plugin.tspackages/start-plugin-core/src/plugin.tspackages/{*-start,start-*}/**
📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/start-plugin-core/src/create-server-fn-plugin/handleCreateServerFn.tspackages/start-plugin-core/src/create-server-fn-plugin/plugin.tspackages/start-plugin-core/src/start-compiler-plugin/plugin.tspackages/start-plugin-core/src/plugin.ts🧬 Code graph analysis (3)
packages/start-plugin-core/src/create-server-fn-plugin/plugin.ts (2)
packages/start-plugin-core/src/start-compiler-plugin/plugin.ts (3)
packages/start-plugin-core/src/plugin.ts (3)
🪛 ast-grep (0.39.9)
packages/start-plugin-core/src/create-server-fn-plugin/plugin.ts
[warning] 158-158: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns. Context: new RegExp(
${SERVER_FN_LOOKUP}$) Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES](regexp-from-variable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (4)
Comment `@coderabbitai help` to get the list of available commands and usage tips.