11import { cp , mkdir , writeFile } from 'node:fs/promises'
22import { join , relative } from 'node:path/posix'
33
4+ import type { InSourceConfig } from '@netlify/zip-it-and-ship-it/dist/runtimes/node/in_source_config/index.js'
45import { glob } from 'fast-glob'
56
67import {
@@ -81,7 +82,13 @@ export async function onBuildComplete(
8182
8283 await copyRuntime ( join ( PAGES_AND_APP_FUNCTION_DIR , RUNTIME_DIR ) )
8384
84- const functionsPaths = Object . keys ( pathnameToEntry )
85+ const functionConfig = {
86+ path : Object . keys ( pathnameToEntry ) ,
87+ nodeBundler : 'none' ,
88+ includedFiles : [ '**' ] ,
89+ generator : GENERATOR ,
90+ name : DISPLAY_NAME_PAGES_AND_APP ,
91+ } as const satisfies InSourceConfig
8592
8693 // generate needed runtime files
8794 const entrypoint = /* javascript */ `
@@ -108,27 +115,14 @@ export async function onBuildComplete(
108115 return runNextHandler(request, context, nextHandler)
109116 }
110117
111- export const config = {
112-
113- path: ${ JSON . stringify ( functionsPaths , null , 2 ) } ,
114- }
118+ export const config = ${ JSON . stringify ( functionConfig , null , 2 ) }
115119 `
116120 await writeFile (
117121 join ( PAGES_AND_APP_FUNCTION_DIR , `${ PAGES_AND_APP_FUNCTION_INTERNAL_NAME } .mjs` ) ,
118122 entrypoint ,
119123 )
120124
121- // configuration
122- netlifyAdapterContext . frameworksAPIConfig ??= { }
123- netlifyAdapterContext . frameworksAPIConfig . functions ??= { '*' : { } }
124- netlifyAdapterContext . frameworksAPIConfig . functions [ PAGES_AND_APP_FUNCTION_INTERNAL_NAME ] = {
125- node_bundler : 'none' ,
126- included_files : [ '**' ] ,
127- // TODO(pieh): below only works due to local patches, need to ship proper support
128- included_files_base_path : PAGES_AND_APP_FUNCTION_DIR ,
129- }
130-
131- netlifyAdapterContext . preparedOutputs . endpoints . push ( ...functionsPaths )
125+ netlifyAdapterContext . preparedOutputs . endpoints . push ( ...functionConfig . path )
132126}
133127
134128const copyRuntime = async ( handlerDirectory : string ) : Promise < void > => {
0 commit comments