File tree Expand file tree Collapse file tree 7 files changed +326
-25
lines changed 
test/integration/test/server/utils Expand file tree Collapse file tree 7 files changed +326
-25
lines changed Original file line number Diff line number Diff line change 7070  "devDependencies" : {
7171    "@remix-run/node" : " ^1.4.3" 
7272    "@remix-run/react" : " ^1.4.3" 
73-     "@types/express" : " ^4.17.14" 
73+     "@types/express" : " ^4.17.14" 
74+     "fastify" : " ^4.26.2" 
75+     "typescript" : " ^5.4.4" 
7476  },
7577  "peerDependencies" : {
7678    "@remix-run/node" : " 1.x || 2.x" 
Original file line number Diff line number Diff line change 1+ import  {  type  ExpressCreateHandlerWrapper  }  from  '../vendor/types' ; 
12import  {  SupportedFramework ,  prepareWrapCreateRequestHandler  }  from  './shared' ; 
23
34/** 
45 * Instruments `createRequestHandler` from `@remix-run/express` 
56 */ 
6- export  const  wrapExpressCreateRequestHandler  =  prepareWrapCreateRequestHandler ( SupportedFramework . Express ) ; 
7+ export  const  wrapExpressCreateRequestHandler  =  prepareWrapCreateRequestHandler ( SupportedFramework . Express )   as   ExpressCreateHandlerWrapper ; 
Original file line number Diff line number Diff line change 1+ import  {  type  FastifyCreateHandlerWrapper  }  from  '../vendor/types' ; 
12import  {  SupportedFramework ,  prepareWrapCreateRequestHandler  }  from  './shared' ; 
23
34/** 
45 * Instruments `createRequestHandler` from `@mcansh/remix-fastify` 
56 */ 
6- export  const  wrapFastifyCreateRequestHandler  =  prepareWrapCreateRequestHandler ( SupportedFramework . Fastify ) ; 
7+ export  const  wrapFastifyCreateRequestHandler  =  prepareWrapCreateRequestHandler ( SupportedFramework . Fastify )   as   FastifyCreateHandlerWrapper ; 
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import type { PolymorphicRequest } from '@sentry/types';
1515import  type  *  as  Express  from  'express' ; 
1616import  type  {  ComponentType  }  from  'react' ; 
1717
18+ import  type  *  as  Fastify  from  'fastify' 
19+ 
1820type  Dev  =  { 
1921  command ?: string ; 
2022  scheme ?: string ; 
@@ -238,8 +240,9 @@ export interface AssetsManifest {
238240} 
239241
240242export  type  GenericRequestHandler  =  ( req : any ,  res : any ,  next : any )  =>  Promise < void > ; 
241- 
242243export  type  CreateGenericRequestHandler  =  ( this : unknown ,  options : any )  =>  GenericRequestHandler ; 
244+ export  type  ExpressCreateHandlerWrapper  =  ( createHandler : CreateGenericRequestHandler )  =>  ( opts : CreateRequestHandlerOptions )  =>  Express . RequestHandler 
245+ export  type  FastifyCreateHandlerWrapper  =  ( createHandler : CreateGenericRequestHandler )  =>  ( opts : CreateRequestHandlerOptions )  =>  Fastify . RouteHandlerMethod ; 
243246
244247export  interface  CreateRequestHandlerOptions  { 
245248  build : ServerBuild  |  ( ( )  =>  ServerBuild )  |  ( ( )  =>  Promise < ServerBuild > ) ; 
Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ const runExpressApp = (adapter: Adapter.Builtin | Adapter.Express): Promise<http
3131  } 
3232) 
3333
34- const  runFastifyApp  =  ( ) : Promise < http . Server >  =>  new  Promise ( res  =>  { 
34+ const  runFastifyApp  =  ( ) : Promise < http . Server >  =>  new  Promise ( async   res  =>  { 
3535  const  app  =  fastify ( ) ; 
36-   app . register ( formBody ) ; 
37-   //  @ts -ignore 
38-   app . all ( '*' ,  adapters [ Adapter . Fastify ] ( {   build :  require ( '../../../build' )   } ) ) ; 
36+   await   app . register ( formBody ) ; 
37+   const   handler   =   adapters [ Adapter . Fastify ] ( {   build :  require ( '../../../build' )   } ) ; 
38+   app . all ( '*' ,  handler ) ; 
3939  app . listen ( { port : 0 } ,  ( _err ,  _addr )  =>  { 
4040    res ( app . server ) 
4141  } ) ; 
Original file line number Diff line number Diff line change 55
66  "compilerOptions" : {
77    "jsx" : " react" 
8-     "module" : " es2020" 
8+     "module" : " es2020" 
9+     "ignoreDeprecations" : " 5.0" 
910  }
1011}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments