@@ -22,7 +22,7 @@ const get_default_runtime = () => {
2222// https://vercel.com/docs/functions/edge-functions/edge-runtime#compatible-node.js-modules
2323const compatible_node_modules = [ 'async_hooks' , 'events' , 'buffer' , 'assert' , 'util' ] ;
2424
25- /** @type {import('.').default } **/
25+ /** @type {import('./index.js ').default } **/
2626const plugin = function ( defaults = { } ) {
2727 if ( 'edge' in defaults ) {
2828 throw new Error ( "{ edge: true } has been removed in favour of { runtime: 'edge' }" ) ;
@@ -69,8 +69,8 @@ const plugin = function (defaults = {}) {
6969
7070 /**
7171 * @param {string } name
72- * @param {import('.').ServerlessConfig } config
73- * @param {import('@sveltejs/kit').RouteDefinition<import('.').Config>[] } routes
72+ * @param {import('./index.js ').ServerlessConfig } config
73+ * @param {import('@sveltejs/kit').RouteDefinition<import('./index.js ').Config>[] } routes
7474 */
7575 async function generate_serverless_function ( name , config , routes ) {
7676 const dir = `${ dirs . functions } /${ name } .func` ;
@@ -99,8 +99,8 @@ const plugin = function (defaults = {}) {
9999
100100 /**
101101 * @param {string } name
102- * @param {import('.').EdgeConfig } config
103- * @param {import('@sveltejs/kit').RouteDefinition<import('.').EdgeConfig>[] } routes
102+ * @param {import('./index.js ').EdgeConfig } config
103+ * @param {import('@sveltejs/kit').RouteDefinition<import('./index.js ').EdgeConfig>[] } routes
104104 */
105105 async function generate_edge_function ( name , config , routes ) {
106106 const tmp = builder . getBuildDirectory ( `vercel-tmp/${ name } ` ) ;
@@ -146,7 +146,8 @@ const plugin = function (defaults = {}) {
146146
147147 console . error ( formatted . join ( '\n' ) ) ;
148148 }
149- } catch ( error ) {
149+ } catch ( err ) {
150+ const error = /** @type {import('esbuild').BuildFailure } */ ( err ) ;
150151 for ( const e of error . errors ) {
151152 for ( const node of e . notes ) {
152153 const match =
@@ -192,7 +193,7 @@ const plugin = function (defaults = {}) {
192193 ) ;
193194 }
194195
195- /** @type {Map<string, { i: number, config: import('.').Config, routes: import('@sveltejs/kit').RouteDefinition<import('.').Config>[] }> } */
196+ /** @type {Map<string, { i: number, config: import('./index.js ').Config, routes: import('@sveltejs/kit').RouteDefinition<import('./index.js ').Config>[] }> } */
196197 const groups = new Map ( ) ;
197198
198199 /** @type {Map<string, { hash: string, route_id: string }> } */
@@ -201,7 +202,7 @@ const plugin = function (defaults = {}) {
201202 /** @type {Map<string, string> } */
202203 const functions = new Map ( ) ;
203204
204- /** @type {Map<import('@sveltejs/kit').RouteDefinition<import('.').Config>, { expiration: number | false, bypassToken: string | undefined, allowQuery: string[], group: number, passQuery: true }> } */
205+ /** @type {Map<import('@sveltejs/kit').RouteDefinition<import('./index.js ').Config>, { expiration: number | false, bypassToken: string | undefined, allowQuery: string[], group: number, passQuery: true }> } */
205206 const isr_config = new Map ( ) ;
206207
207208 /** @type {Set<string> } */
@@ -220,7 +221,7 @@ const plugin = function (defaults = {}) {
220221 }
221222
222223 const node_runtime = / n o d e j s ( [ 0 - 9 ] + ) \. x / . exec ( runtime ) ;
223- if ( runtime !== 'edge' && ( ! node_runtime || node_runtime [ 1 ] < 18 ) ) {
224+ if ( runtime !== 'edge' && ( ! node_runtime || parseInt ( node_runtime [ 1 ] ) < 18 ) ) {
224225 throw new Error (
225226 `Invalid runtime '${ runtime } ' for route ${ route . id } . Valid runtimes are 'edge' and 'nodejs18.x' or higher ` +
226227 '(see the Node.js Version section in your Vercel project settings for info on the currently supported versions).'
@@ -395,7 +396,7 @@ const plugin = function (defaults = {}) {
395396 } ;
396397} ;
397398
398- /** @param {import('.').EdgeConfig & import('.').ServerlessConfig } config */
399+ /** @param {import('./index.js ').EdgeConfig & import('./index.js ').ServerlessConfig } config */
399400function hash_config ( config ) {
400401 return [
401402 config . runtime ?? '' ,
@@ -424,7 +425,7 @@ function write(file, data) {
424425// This function is duplicated in adapter-static
425426/**
426427 * @param {import('@sveltejs/kit').Builder } builder
427- * @param {import('.').Config } config
428+ * @param {import('./index.js ').Config } config
428429 * @param {string } dir
429430 */
430431function static_vercel_config ( builder , config , dir ) {
@@ -434,7 +435,7 @@ function static_vercel_config(builder, config, dir) {
434435 /** @type {Record<string, { path: string }> } */
435436 const overrides = { } ;
436437
437- /** @type {import('./index').ImagesConfig } */
438+ /** @type {import('./index.js ').ImagesConfig | undefined } */
438439 const images = config . images ;
439440
440441 for ( const [ src , redirect ] of builder . prerendered . redirects ) {
@@ -531,7 +532,7 @@ function static_vercel_config(builder, config, dir) {
531532 * @param {import('@sveltejs/kit').Builder } builder
532533 * @param {string } entry
533534 * @param {string } dir
534- * @param {import('.').ServerlessConfig } config
535+ * @param {import('./index.js ').ServerlessConfig } config
535536 */
536537async function create_function_bundle ( builder , entry , dir , config ) {
537538 fs . rmSync ( dir , { force : true , recursive : true } ) ;
0 commit comments