Skip to content
Source
Sign inSign up
TanStack/router

fix: compile createMiddleware using start-compiler-plugin #5245

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/5245/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 35 changed files with 79 additions and 31 deletions (loading 32).

x
0 of 35 viewed, 35 left
34 additions and 14 deletionspackages/start-plugin-core/src/create-server-fn-plugin/compiler.tsModified
View file
@@ -29,10 +29,18 @@
​
type Kind = 'None' | `Root` | `Builder` | LookupKind
​
-type LookupKind = 'ServerFn' | 'Middleware'
+export type LookupKind = 'ServerFn' | 'Middleware'
​
-const validLookupKinds: Array<LookupKind> = ['ServerFn', 'Middleware']
-const candidateCallIdentifier = ['handler', 'server', 'client']
+const LookupSetup: Record<
+ LookupKind,
+ { candidateCallIdentifier: Set<string> }
+> = {
+ ServerFn: { candidateCallIdentifier: new Set(['handler']) },
+ Middleware: {
+ candidateCallIdentifier: new Set(['server', 'client', 'createMiddlewares']),
+ },
+}
+​
export type LookupConfig = {
libName: string
rootExport: string
@@ -48,14 +56,18 @@
export class ServerFnCompiler {
private moduleCache = new Map<string, ModuleInfo>()