@sveltejs/adapter-netlify 2.0.3 → 2.0.5
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/files/esm/serverless.js +2 -1
- package/files/esm/shims.js +107 -17
- package/index.js +6 -5
- package/package.json +2 -2
package/files/esm/serverless.js
CHANGED
|
@@ -266,7 +266,8 @@ function split_headers(headers) {
|
|
|
266
266
|
|
|
267
267
|
headers.forEach((value, key) => {
|
|
268
268
|
if (key === 'set-cookie') {
|
|
269
|
-
m[key] =
|
|
269
|
+
if (!m[key]) m[key] = [];
|
|
270
|
+
m[key].push(...splitCookiesString_1(value));
|
|
270
271
|
} else {
|
|
271
272
|
h[key] = value;
|
|
272
273
|
}
|
package/files/esm/shims.js
CHANGED
|
@@ -510,25 +510,42 @@ function parseHeaders (headers, obj = {}) {
|
|
|
510
510
|
for (let i = 0; i < headers.length; i += 2) {
|
|
511
511
|
const key = headers[i].toString().toLowerCase();
|
|
512
512
|
let val = obj[key];
|
|
513
|
+
|
|
514
|
+
const encoding = key.length === 19 && key === 'content-disposition'
|
|
515
|
+
? 'latin1'
|
|
516
|
+
: 'utf8';
|
|
517
|
+
|
|
513
518
|
if (!val) {
|
|
514
519
|
if (Array.isArray(headers[i + 1])) {
|
|
515
520
|
obj[key] = headers[i + 1];
|
|
516
521
|
} else {
|
|
517
|
-
obj[key] = headers[i + 1].toString();
|
|
522
|
+
obj[key] = headers[i + 1].toString(encoding);
|
|
518
523
|
}
|
|
519
524
|
} else {
|
|
520
525
|
if (!Array.isArray(val)) {
|
|
521
526
|
val = [val];
|
|
522
527
|
obj[key] = val;
|
|
523
528
|
}
|
|
524
|
-
val.push(headers[i + 1].toString());
|
|
529
|
+
val.push(headers[i + 1].toString(encoding));
|
|
525
530
|
}
|
|
526
531
|
}
|
|
527
532
|
return obj
|
|
528
533
|
}
|
|
529
534
|
|
|
530
535
|
function parseRawHeaders (headers) {
|
|
531
|
-
|
|
536
|
+
const ret = [];
|
|
537
|
+
for (let n = 0; n < headers.length; n += 2) {
|
|
538
|
+
const key = headers[n + 0].toString();
|
|
539
|
+
|
|
540
|
+
const encoding = key.length === 19 && key.toLowerCase() === 'content-disposition'
|
|
541
|
+
? 'latin1'
|
|
542
|
+
: 'utf8';
|
|
543
|
+
|
|
544
|
+
const val = headers[n + 1].toString(encoding);
|
|
545
|
+
|
|
546
|
+
ret.push(key, val);
|
|
547
|
+
}
|
|
548
|
+
return ret
|
|
532
549
|
}
|
|
533
550
|
|
|
534
551
|
function isBuffer (buffer) {
|
|
@@ -6664,6 +6681,9 @@ function processHeader (request, key, val) {
|
|
|
6664
6681
|
key.length === 4 &&
|
|
6665
6682
|
key.toLowerCase() === 'host'
|
|
6666
6683
|
) {
|
|
6684
|
+
if (headerCharRegex.exec(val) !== null) {
|
|
6685
|
+
throw new InvalidArgumentError$i(`invalid ${key} header`)
|
|
6686
|
+
}
|
|
6667
6687
|
// Consumed by Client
|
|
6668
6688
|
request.host = val;
|
|
6669
6689
|
} else if (
|
|
@@ -11635,7 +11655,11 @@ function buildKey$1 (opts) {
|
|
|
11635
11655
|
}
|
|
11636
11656
|
|
|
11637
11657
|
function generateKeyValues (data) {
|
|
11638
|
-
return Object.entries(data).reduce((keyValuePairs, [key, value]) => [
|
|
11658
|
+
return Object.entries(data).reduce((keyValuePairs, [key, value]) => [
|
|
11659
|
+
...keyValuePairs,
|
|
11660
|
+
Buffer.from(`${key}`),
|
|
11661
|
+
Array.isArray(value) ? value.map(x => Buffer.from(`${x}`)) : Buffer.from(`${value}`)
|
|
11662
|
+
], [])
|
|
11639
11663
|
}
|
|
11640
11664
|
|
|
11641
11665
|
/**
|
|
@@ -12610,6 +12634,7 @@ function requireHeaders () {
|
|
|
12610
12634
|
isValidHeaderValue
|
|
12611
12635
|
} = requireUtil$3();
|
|
12612
12636
|
const { webidl } = requireWebidl();
|
|
12637
|
+
const assert = require$$0$1;
|
|
12613
12638
|
|
|
12614
12639
|
const kHeadersMap = Symbol('headers map');
|
|
12615
12640
|
const kHeadersSortedMap = Symbol('headers map sorted');
|
|
@@ -12622,10 +12647,12 @@ function requireHeaders () {
|
|
|
12622
12647
|
// To normalize a byte sequence potentialValue, remove
|
|
12623
12648
|
// any leading and trailing HTTP whitespace bytes from
|
|
12624
12649
|
// potentialValue.
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12650
|
+
|
|
12651
|
+
// Trimming the end with `.replace()` and a RegExp is typically subject to
|
|
12652
|
+
// ReDoS. This is safer and faster.
|
|
12653
|
+
let i = potentialValue.length;
|
|
12654
|
+
while (/[\r\n\t ]/.test(potentialValue.charAt(--i)));
|
|
12655
|
+
return potentialValue.slice(0, i + 1).replace(/^[\r\n\t ]+/, '')
|
|
12629
12656
|
}
|
|
12630
12657
|
|
|
12631
12658
|
function fill (headers, object) {
|
|
@@ -12714,7 +12741,7 @@ function requireHeaders () {
|
|
|
12714
12741
|
|
|
12715
12742
|
if (lowercaseName === 'set-cookie') {
|
|
12716
12743
|
this.cookies ??= [];
|
|
12717
|
-
this.cookies.push(
|
|
12744
|
+
this.cookies.push(value);
|
|
12718
12745
|
}
|
|
12719
12746
|
}
|
|
12720
12747
|
|
|
@@ -12724,7 +12751,7 @@ function requireHeaders () {
|
|
|
12724
12751
|
const lowercaseName = name.toLowerCase();
|
|
12725
12752
|
|
|
12726
12753
|
if (lowercaseName === 'set-cookie') {
|
|
12727
|
-
this.cookies = [
|
|
12754
|
+
this.cookies = [value];
|
|
12728
12755
|
}
|
|
12729
12756
|
|
|
12730
12757
|
// 1. If list contains name, then set the value of
|
|
@@ -12975,18 +13002,74 @@ function requireHeaders () {
|
|
|
12975
13002
|
return this[kHeadersList].set(name, value)
|
|
12976
13003
|
}
|
|
12977
13004
|
|
|
13005
|
+
// https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
|
|
13006
|
+
getSetCookie () {
|
|
13007
|
+
webidl.brandCheck(this, Headers);
|
|
13008
|
+
|
|
13009
|
+
// 1. If this’s header list does not contain `Set-Cookie`, then return « ».
|
|
13010
|
+
// 2. Return the values of all headers in this’s header list whose name is
|
|
13011
|
+
// a byte-case-insensitive match for `Set-Cookie`, in order.
|
|
13012
|
+
|
|
13013
|
+
const list = this[kHeadersList].cookies;
|
|
13014
|
+
|
|
13015
|
+
if (list) {
|
|
13016
|
+
return [...list]
|
|
13017
|
+
}
|
|
13018
|
+
|
|
13019
|
+
return []
|
|
13020
|
+
}
|
|
13021
|
+
|
|
13022
|
+
// https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
|
|
12978
13023
|
get [kHeadersSortedMap] () {
|
|
12979
|
-
if (
|
|
12980
|
-
this[kHeadersList][kHeadersSortedMap]
|
|
13024
|
+
if (this[kHeadersList][kHeadersSortedMap]) {
|
|
13025
|
+
return this[kHeadersList][kHeadersSortedMap]
|
|
13026
|
+
}
|
|
13027
|
+
|
|
13028
|
+
// 1. Let headers be an empty list of headers with the key being the name
|
|
13029
|
+
// and value the value.
|
|
13030
|
+
const headers = [];
|
|
13031
|
+
|
|
13032
|
+
// 2. Let names be the result of convert header names to a sorted-lowercase
|
|
13033
|
+
// set with all the names of the headers in list.
|
|
13034
|
+
const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1);
|
|
13035
|
+
const cookies = this[kHeadersList].cookies;
|
|
13036
|
+
|
|
13037
|
+
// 3. For each name of names:
|
|
13038
|
+
for (const [name, value] of names) {
|
|
13039
|
+
// 1. If name is `set-cookie`, then:
|
|
13040
|
+
if (name === 'set-cookie') {
|
|
13041
|
+
// 1. Let values be a list of all values of headers in list whose name
|
|
13042
|
+
// is a byte-case-insensitive match for name, in order.
|
|
13043
|
+
|
|
13044
|
+
// 2. For each value of values:
|
|
13045
|
+
// 1. Append (name, value) to headers.
|
|
13046
|
+
for (const value of cookies) {
|
|
13047
|
+
headers.push([name, value]);
|
|
13048
|
+
}
|
|
13049
|
+
} else {
|
|
13050
|
+
// 2. Otherwise:
|
|
13051
|
+
|
|
13052
|
+
// 1. Let value be the result of getting name from list.
|
|
13053
|
+
|
|
13054
|
+
// 2. Assert: value is non-null.
|
|
13055
|
+
assert(value !== null);
|
|
13056
|
+
|
|
13057
|
+
// 3. Append (name, value) to headers.
|
|
13058
|
+
headers.push([name, value]);
|
|
13059
|
+
}
|
|
12981
13060
|
}
|
|
12982
|
-
|
|
13061
|
+
|
|
13062
|
+
this[kHeadersList][kHeadersSortedMap] = headers;
|
|
13063
|
+
|
|
13064
|
+
// 4. Return headers.
|
|
13065
|
+
return headers
|
|
12983
13066
|
}
|
|
12984
13067
|
|
|
12985
13068
|
keys () {
|
|
12986
13069
|
webidl.brandCheck(this, Headers);
|
|
12987
13070
|
|
|
12988
13071
|
return makeIterator(
|
|
12989
|
-
() => [...this[kHeadersSortedMap].
|
|
13072
|
+
() => [...this[kHeadersSortedMap].values()],
|
|
12990
13073
|
'Headers',
|
|
12991
13074
|
'key'
|
|
12992
13075
|
)
|
|
@@ -12996,7 +13079,7 @@ function requireHeaders () {
|
|
|
12996
13079
|
webidl.brandCheck(this, Headers);
|
|
12997
13080
|
|
|
12998
13081
|
return makeIterator(
|
|
12999
|
-
() => [...this[kHeadersSortedMap].
|
|
13082
|
+
() => [...this[kHeadersSortedMap].values()],
|
|
13000
13083
|
'Headers',
|
|
13001
13084
|
'value'
|
|
13002
13085
|
)
|
|
@@ -13006,7 +13089,7 @@ function requireHeaders () {
|
|
|
13006
13089
|
webidl.brandCheck(this, Headers);
|
|
13007
13090
|
|
|
13008
13091
|
return makeIterator(
|
|
13009
|
-
() => [...this[kHeadersSortedMap].
|
|
13092
|
+
() => [...this[kHeadersSortedMap].values()],
|
|
13010
13093
|
'Headers',
|
|
13011
13094
|
'key+value'
|
|
13012
13095
|
)
|
|
@@ -13756,6 +13839,7 @@ function requireRequest () {
|
|
|
13756
13839
|
const { URLSerializer } = requireDataURL();
|
|
13757
13840
|
const { kHeadersList } = symbols$3;
|
|
13758
13841
|
const assert = require$$0$1;
|
|
13842
|
+
const { setMaxListeners, getEventListeners, defaultMaxListeners } = require$$0$4;
|
|
13759
13843
|
|
|
13760
13844
|
let TransformStream = globalThis.TransformStream;
|
|
13761
13845
|
|
|
@@ -14080,6 +14164,11 @@ function requireRequest () {
|
|
|
14080
14164
|
const abort = function () {
|
|
14081
14165
|
acRef.deref()?.abort(this.reason);
|
|
14082
14166
|
};
|
|
14167
|
+
|
|
14168
|
+
if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {
|
|
14169
|
+
setMaxListeners(100, signal);
|
|
14170
|
+
}
|
|
14171
|
+
|
|
14083
14172
|
signal.addEventListener('abort', abort, { once: true });
|
|
14084
14173
|
requestFinalizer.register(this, { signal, abort });
|
|
14085
14174
|
}
|
|
@@ -18563,7 +18652,8 @@ function requireCookies () {
|
|
|
18563
18652
|
return []
|
|
18564
18653
|
}
|
|
18565
18654
|
|
|
18566
|
-
|
|
18655
|
+
// In older versions of undici, cookies is a list of name:value.
|
|
18656
|
+
return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
|
|
18567
18657
|
}
|
|
18568
18658
|
|
|
18569
18659
|
/**
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { dirname, join, resolve, posix } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
1
|
+
import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve, posix } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import esbuild from 'esbuild';
|
|
5
5
|
import toml from '@iarna/toml';
|
|
6
6
|
|
|
@@ -231,8 +231,9 @@ async function generate_lambda_functions({ builder, publish, split }) {
|
|
|
231
231
|
writeFileSync(`.netlify/functions-internal/${name}.mjs`, fn);
|
|
232
232
|
writeFileSync(`.netlify/functions-internal/${name}.json`, fn_config);
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
redirects.push(`${pattern}
|
|
234
|
+
const redirect = `/.netlify/functions/${name} 200`;
|
|
235
|
+
redirects.push(`${pattern} ${redirect}`);
|
|
236
|
+
redirects.push(`${pattern === '/' ? '' : pattern}/__data.json ${redirect}`);
|
|
236
237
|
}
|
|
237
238
|
} else {
|
|
238
239
|
const manifest = builder.generateManifest({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-netlify",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"rollup": "^3.7.0",
|
|
39
39
|
"typescript": "^4.9.4",
|
|
40
40
|
"uvu": "^0.5.6",
|
|
41
|
-
"@sveltejs/kit": "^1.
|
|
41
|
+
"@sveltejs/kit": "^1.7.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@sveltejs/kit": "^1.5.0"
|