@sveltejs/adapter-vercel 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +6 -6
- package/index.js +14 -13
- package/package.json +12 -4
package/index.d.ts
CHANGED
|
@@ -29,11 +29,6 @@ export interface ServerlessConfig {
|
|
|
29
29
|
*/
|
|
30
30
|
split?: boolean;
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* https://vercel.com/docs/build-output-api/v3/configuration#images
|
|
34
|
-
*/
|
|
35
|
-
images?: ImagesConfig;
|
|
36
|
-
|
|
37
32
|
/**
|
|
38
33
|
* [Incremental Static Regeneration](https://vercel.com/docs/concepts/incremental-static-regeneration/overview) configuration.
|
|
39
34
|
* Serverless only.
|
|
@@ -100,7 +95,12 @@ export interface EdgeConfig {
|
|
|
100
95
|
split?: boolean;
|
|
101
96
|
}
|
|
102
97
|
|
|
103
|
-
export type Config = EdgeConfig | ServerlessConfig
|
|
98
|
+
export type Config = (EdgeConfig | ServerlessConfig) & {
|
|
99
|
+
/**
|
|
100
|
+
* https://vercel.com/docs/build-output-api/v3/configuration#images
|
|
101
|
+
*/
|
|
102
|
+
images?: ImagesConfig;
|
|
103
|
+
};
|
|
104
104
|
|
|
105
105
|
// we copy the RequestContext interface from `@vercel/edge` because that package can't co-exist with `@types/node`.
|
|
106
106
|
// see https://github.com/sveltejs/kit/pull/9280#issuecomment-1452110035
|
package/index.js
CHANGED
|
@@ -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 (
|
|
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 = /nodejs([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 });
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "A SvelteKit adapter that creates a Vercel app",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"adapter",
|
|
7
|
+
"deploy",
|
|
8
|
+
"hosting",
|
|
9
|
+
"svelte",
|
|
10
|
+
"sveltekit",
|
|
11
|
+
"vercel"
|
|
12
|
+
],
|
|
5
13
|
"repository": {
|
|
6
14
|
"type": "git",
|
|
7
15
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -25,15 +33,15 @@
|
|
|
25
33
|
"index.d.ts"
|
|
26
34
|
],
|
|
27
35
|
"dependencies": {
|
|
28
|
-
"@vercel/nft": "^0.
|
|
36
|
+
"@vercel/nft": "^0.27.1",
|
|
29
37
|
"esbuild": "^0.20.2"
|
|
30
38
|
},
|
|
31
39
|
"devDependencies": {
|
|
32
40
|
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
|
33
41
|
"@types/node": "^18.19.3",
|
|
34
42
|
"typescript": "^5.3.3",
|
|
35
|
-
"vitest": "^1.
|
|
36
|
-
"@sveltejs/kit": "^2.5.
|
|
43
|
+
"vitest": "^1.6.0",
|
|
44
|
+
"@sveltejs/kit": "^2.5.11"
|
|
37
45
|
},
|
|
38
46
|
"peerDependencies": {
|
|
39
47
|
"@sveltejs/kit": "^2.4.0"
|