@@ -294,7 +294,11 @@ const plugin = function (defaults = {}) {
294294
295295 // group routes by config
296296 for ( const route of builder . routes ) {
297- const runtime = route . config ?. runtime ?? defaults ?. runtime ?? get_default_runtime ( ) ;
297+ const runtime = (
298+ route . config ?. runtime ??
299+ defaults ?. runtime ??
300+ get_default_runtime ( )
301+ ) . replace ( 'experimental_' , '' ) ;
298302 const config = { runtime, ...defaults , ...route . config } ;
299303
300304 if ( is_prerendered ( route ) ) {
@@ -305,19 +309,24 @@ const plugin = function (defaults = {}) {
305309 }
306310
307311 const node_runtime = / n o d e j s ( [ 0 - 9 ] + ) \. x / . exec ( runtime ) ;
308- if ( runtime !== 'edge' && ( ! node_runtime || parseInt ( node_runtime [ 1 ] ) < 20 ) ) {
312+ const bun_runtime = / ^ b u n / . exec ( runtime ) ;
313+ if (
314+ runtime !== 'edge' &&
315+ ! bun_runtime &&
316+ ( ! node_runtime || parseInt ( node_runtime [ 1 ] ) < 20 )
317+ ) {
309318 throw new Error (
310- `Invalid runtime '${ runtime } ' for route ${ route . id } . Valid runtimes are 'edge' and 'nodejs20.x' or higher ` +
319+ `Invalid runtime '${ runtime } ' for route ${ route . id } . Valid runtimes are 'edge', 'experimental_bun1.x', 'nodejs20.x' or 'nodejs22.x' ` +
311320 '(see the Node.js Version section in your Vercel project settings for info on the currently supported versions).'
312321 ) ;
313322 }
314323
315324 if ( config . isr ) {
316325 const directory = path . relative ( '.' , builder . config . kit . files . routes + route . id ) ;
317326
318- if ( ! runtime . startsWith ( 'nodejs' ) ) {
327+ if ( ! runtime . startsWith ( 'nodejs' ) && ! bun_runtime ) {
319328 throw new Error (
320- `${ directory } : Routes using \`isr\` must use a Node.js runtime (for example 'nodejs20 .x')`
329+ `${ directory } : Routes using \`isr\` must use a Node.js or Bun runtime (for example 'nodejs22.x' or 'experimental_bun1 .x')`
321330 ) ;
322331 }
323332
@@ -400,7 +409,7 @@ const plugin = function (defaults = {}) {
400409 // we need to create a catch-all route so that 404s are handled
401410 // by SvelteKit rather than Vercel
402411
403- const runtime = defaults . runtime ?? get_default_runtime ( ) ;
412+ const runtime = ( defaults . runtime ?? get_default_runtime ( ) ) . replace ( 'experimental_' , '' ) ;
404413 const generate_function =
405414 runtime === 'edge' ? generate_edge_function : generate_serverless_function ;
406415
0 commit comments