@@ -22,7 +22,7 @@ const get_default_runtime = () => {
22
22
// https://vercel.com/docs/functions/edge-functions/edge-runtime#compatible-node.js-modules
23
23
const compatible_node_modules = [ 'async_hooks' , 'events' , 'buffer' , 'assert' , 'util' ] ;
24
24
25
- /** @type {import('.').default } **/
25
+ /** @type {import('./index.js ').default } **/
26
26
const plugin = function ( defaults = { } ) {
27
27
if ( 'edge' in defaults ) {
28
28
throw new Error ( "{ edge: true } has been removed in favour of { runtime: 'edge' }" ) ;
@@ -69,8 +69,8 @@ const plugin = function (defaults = {}) {
69
69
70
70
/**
71
71
* @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
74
74
*/
75
75
async function generate_serverless_function ( name , config , routes ) {
76
76
const dir = `${ dirs . functions } /${ name } .func` ;
@@ -99,8 +99,8 @@ const plugin = function (defaults = {}) {
99
99
100
100
/**
101
101
* @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
104
104
*/
105
105
async function generate_edge_function ( name , config , routes ) {
106
106
const tmp = builder . getBuildDirectory ( `vercel-tmp/${ name } ` ) ;
@@ -146,7 +146,8 @@ const plugin = function (defaults = {}) {
146
146
147
147
console . error ( formatted . join ( '\n' ) ) ;
148
148
}
149
- } catch ( error ) {
149
+ } catch ( err ) {
150
+ const error = /** @type {import('esbuild').BuildFailure } */ ( err ) ;
150
151
for ( const e of error . errors ) {
151
152
for ( const node of e . notes ) {
152
153
const match =
@@ -192,7 +193,7 @@ const plugin = function (defaults = {}) {
192
193
) ;
193
194
}
194
195
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>[] }> } */
196
197
const groups = new Map ( ) ;
197
198
198
199
/** @type {Map<string, { hash: string, route_id: string }> } */
@@ -201,7 +202,7 @@ const plugin = function (defaults = {}) {
201
202
/** @type {Map<string, string> } */
202
203
const functions = new Map ( ) ;
203
204
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 }> } */
205
206
const isr_config = new Map ( ) ;
206
207
207
208
/** @type {Set<string> } */
@@ -220,7 +221,7 @@ const plugin = function (defaults = {}) {
220
221
}
221
222
222
223
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 ) ) {
224
225
throw new Error (
225
226
`Invalid runtime '${ runtime } ' for route ${ route . id } . Valid runtimes are 'edge' and 'nodejs18.x' or higher ` +
226
227
'(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 = {}) {
395
396
} ;
396
397
} ;
397
398
398
- /** @param {import('.').EdgeConfig & import('.').ServerlessConfig } config */
399
+ /** @param {import('./index.js ').EdgeConfig & import('./index.js ').ServerlessConfig } config */
399
400
function hash_config ( config ) {
400
401
return [
401
402
config . runtime ?? '' ,
@@ -424,7 +425,7 @@ function write(file, data) {
424
425
// This function is duplicated in adapter-static
425
426
/**
426
427
* @param {import('@sveltejs/kit').Builder } builder
427
- * @param {import('.').Config } config
428
+ * @param {import('./index.js ').Config } config
428
429
* @param {string } dir
429
430
*/
430
431
function static_vercel_config ( builder , config , dir ) {
@@ -434,7 +435,7 @@ function static_vercel_config(builder, config, dir) {
434
435
/** @type {Record<string, { path: string }> } */
435
436
const overrides = { } ;
436
437
437
- /** @type {import('./index').ImagesConfig } */
438
+ /** @type {import('./index.js ').ImagesConfig | undefined } */
438
439
const images = config . images ;
439
440
440
441
for ( const [ src , redirect ] of builder . prerendered . redirects ) {
@@ -531,7 +532,7 @@ function static_vercel_config(builder, config, dir) {
531
532
* @param {import('@sveltejs/kit').Builder } builder
532
533
* @param {string } entry
533
534
* @param {string } dir
534
- * @param {import('.').ServerlessConfig } config
535
+ * @param {import('./index.js ').ServerlessConfig } config
535
536
*/
536
537
async function create_function_bundle ( builder , entry , dir , config ) {
537
538
fs . rmSync ( dir , { force : true , recursive : true } ) ;
0 commit comments