@sveltejs/adapter-netlify 1.0.0-next.56 → 1.0.0-next.59
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/README.md +4 -0
- package/files/cjs/{multipart-parser-431aff0b.js → multipart-parser-55fbd1f3.js} +1 -0
- package/files/cjs/serverless.js +205 -2
- package/files/cjs/shims.js +21 -25
- package/files/esm/{multipart-parser-5faf185a.js → multipart-parser-172e1198.js} +1 -0
- package/files/esm/serverless.js +205 -2
- package/files/esm/shims.js +21 -25
- package/index.js +16 -13
- package/package.json +5 -10
package/README.md
CHANGED
|
@@ -42,6 +42,10 @@ Then, make sure you have a [netlify.toml](https://docs.netlify.com/configure-bui
|
|
|
42
42
|
|
|
43
43
|
If the `netlify.toml` file or the `build.publish` value is missing, a default value of `"build"` will be used. Note that if you have set the publish directory in the Netlify UI to something else then you will need to set it in `netlify.toml` too, or use the default value of `"build"`.
|
|
44
44
|
|
|
45
|
+
### Node version
|
|
46
|
+
|
|
47
|
+
New projects will use Node 16 by default. However, if you're upgrading a project you created a while ago it may be stuck on an older version. See [the Netlify docs](https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript) for details on manually specifying Node 16 or newer.
|
|
48
|
+
|
|
45
49
|
## Netlify Edge Functions (beta)
|
|
46
50
|
|
|
47
51
|
SvelteKit supports the beta release of Netlify Edge Functions. If you pass the option `edge: true` to the `adapter` function, server-side rendering will happen in a Deno-based edge function that's deployed close to the site visitor. If set to `false` (the default), the site will deploy to standard Node-based Netlify Functions.
|
package/files/cjs/serverless.js
CHANGED
|
@@ -11,6 +11,210 @@ require('node:stream');
|
|
|
11
11
|
require('node:util');
|
|
12
12
|
require('node:url');
|
|
13
13
|
require('net');
|
|
14
|
+
require('crypto');
|
|
15
|
+
|
|
16
|
+
var setCookie = {exports: {}};
|
|
17
|
+
|
|
18
|
+
var defaultParseOptions = {
|
|
19
|
+
decodeValues: true,
|
|
20
|
+
map: false,
|
|
21
|
+
silent: false,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function isNonEmptyString(str) {
|
|
25
|
+
return typeof str === "string" && !!str.trim();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function parseString(setCookieValue, options) {
|
|
29
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
30
|
+
var nameValue = parts.shift().split("=");
|
|
31
|
+
var name = nameValue.shift();
|
|
32
|
+
var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
|
|
33
|
+
|
|
34
|
+
options = options
|
|
35
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
36
|
+
: defaultParseOptions;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.error(
|
|
42
|
+
"set-cookie-parser encountered an error while decoding a cookie with value '" +
|
|
43
|
+
value +
|
|
44
|
+
"'. Set options.decodeValues to false to disable this feature.",
|
|
45
|
+
e
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var cookie = {
|
|
50
|
+
name: name, // grab everything before the first =
|
|
51
|
+
value: value,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
parts.forEach(function (part) {
|
|
55
|
+
var sides = part.split("=");
|
|
56
|
+
var key = sides.shift().trimLeft().toLowerCase();
|
|
57
|
+
var value = sides.join("=");
|
|
58
|
+
if (key === "expires") {
|
|
59
|
+
cookie.expires = new Date(value);
|
|
60
|
+
} else if (key === "max-age") {
|
|
61
|
+
cookie.maxAge = parseInt(value, 10);
|
|
62
|
+
} else if (key === "secure") {
|
|
63
|
+
cookie.secure = true;
|
|
64
|
+
} else if (key === "httponly") {
|
|
65
|
+
cookie.httpOnly = true;
|
|
66
|
+
} else if (key === "samesite") {
|
|
67
|
+
cookie.sameSite = value;
|
|
68
|
+
} else {
|
|
69
|
+
cookie[key] = value;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return cookie;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function parse(input, options) {
|
|
77
|
+
options = options
|
|
78
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
79
|
+
: defaultParseOptions;
|
|
80
|
+
|
|
81
|
+
if (!input) {
|
|
82
|
+
if (!options.map) {
|
|
83
|
+
return [];
|
|
84
|
+
} else {
|
|
85
|
+
return {};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (input.headers && input.headers["set-cookie"]) {
|
|
90
|
+
// fast-path for node.js (which automatically normalizes header names to lower-case
|
|
91
|
+
input = input.headers["set-cookie"];
|
|
92
|
+
} else if (input.headers) {
|
|
93
|
+
// slow-path for other environments - see #25
|
|
94
|
+
var sch =
|
|
95
|
+
input.headers[
|
|
96
|
+
Object.keys(input.headers).find(function (key) {
|
|
97
|
+
return key.toLowerCase() === "set-cookie";
|
|
98
|
+
})
|
|
99
|
+
];
|
|
100
|
+
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
|
|
101
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
102
|
+
console.warn(
|
|
103
|
+
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
input = sch;
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(input)) {
|
|
109
|
+
input = [input];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
options = options
|
|
113
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
114
|
+
: defaultParseOptions;
|
|
115
|
+
|
|
116
|
+
if (!options.map) {
|
|
117
|
+
return input.filter(isNonEmptyString).map(function (str) {
|
|
118
|
+
return parseString(str, options);
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
var cookies = {};
|
|
122
|
+
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
|
|
123
|
+
var cookie = parseString(str, options);
|
|
124
|
+
cookies[cookie.name] = cookie;
|
|
125
|
+
return cookies;
|
|
126
|
+
}, cookies);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/*
|
|
131
|
+
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
132
|
+
that are within a single set-cookie field-value, such as in the Expires portion.
|
|
133
|
+
|
|
134
|
+
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
135
|
+
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
136
|
+
React Native's fetch does this for *every* header, including set-cookie.
|
|
137
|
+
|
|
138
|
+
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
139
|
+
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
140
|
+
*/
|
|
141
|
+
function splitCookiesString(cookiesString) {
|
|
142
|
+
if (Array.isArray(cookiesString)) {
|
|
143
|
+
return cookiesString;
|
|
144
|
+
}
|
|
145
|
+
if (typeof cookiesString !== "string") {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var cookiesStrings = [];
|
|
150
|
+
var pos = 0;
|
|
151
|
+
var start;
|
|
152
|
+
var ch;
|
|
153
|
+
var lastComma;
|
|
154
|
+
var nextStart;
|
|
155
|
+
var cookiesSeparatorFound;
|
|
156
|
+
|
|
157
|
+
function skipWhitespace() {
|
|
158
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
159
|
+
pos += 1;
|
|
160
|
+
}
|
|
161
|
+
return pos < cookiesString.length;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function notSpecialChar() {
|
|
165
|
+
ch = cookiesString.charAt(pos);
|
|
166
|
+
|
|
167
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
while (pos < cookiesString.length) {
|
|
171
|
+
start = pos;
|
|
172
|
+
cookiesSeparatorFound = false;
|
|
173
|
+
|
|
174
|
+
while (skipWhitespace()) {
|
|
175
|
+
ch = cookiesString.charAt(pos);
|
|
176
|
+
if (ch === ",") {
|
|
177
|
+
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
|
178
|
+
lastComma = pos;
|
|
179
|
+
pos += 1;
|
|
180
|
+
|
|
181
|
+
skipWhitespace();
|
|
182
|
+
nextStart = pos;
|
|
183
|
+
|
|
184
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
185
|
+
pos += 1;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// currently special character
|
|
189
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
190
|
+
// we found cookies separator
|
|
191
|
+
cookiesSeparatorFound = true;
|
|
192
|
+
// pos is inside the next cookie, so back up and return it.
|
|
193
|
+
pos = nextStart;
|
|
194
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
195
|
+
start = pos;
|
|
196
|
+
} else {
|
|
197
|
+
// in param ',' or param separator ';',
|
|
198
|
+
// we continue from that comma
|
|
199
|
+
pos = lastComma + 1;
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
pos += 1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
207
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return cookiesStrings;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setCookie.exports = parse;
|
|
215
|
+
setCookie.exports.parse = parse;
|
|
216
|
+
setCookie.exports.parseString = parseString;
|
|
217
|
+
var splitCookiesString_1 = setCookie.exports.splitCookiesString = splitCookiesString;
|
|
14
218
|
|
|
15
219
|
/**
|
|
16
220
|
* Splits headers into two categories: single value and multi value
|
|
@@ -29,8 +233,7 @@ function split_headers(headers) {
|
|
|
29
233
|
|
|
30
234
|
headers.forEach((value, key) => {
|
|
31
235
|
if (key === 'set-cookie') {
|
|
32
|
-
|
|
33
|
-
m[key] = headers.raw()[key];
|
|
236
|
+
m[key] = splitCookiesString_1(value);
|
|
34
237
|
} else {
|
|
35
238
|
h[key] = value;
|
|
36
239
|
}
|
package/files/cjs/shims.js
CHANGED
|
@@ -9,6 +9,7 @@ var Stream = require('node:stream');
|
|
|
9
9
|
var node_util = require('node:util');
|
|
10
10
|
var node_url = require('node:url');
|
|
11
11
|
var net = require('net');
|
|
12
|
+
var crypto = require('crypto');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
|
@@ -17,6 +18,8 @@ var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
|
17
18
|
var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
|
|
18
19
|
var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream);
|
|
19
20
|
|
|
21
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
22
|
+
|
|
20
23
|
/**
|
|
21
24
|
* Returns a `Buffer` instance from the given data URI `uri`.
|
|
22
25
|
*
|
|
@@ -69,8 +72,6 @@ function dataUriToBuffer(uri) {
|
|
|
69
72
|
return buffer;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
73
|
-
|
|
74
75
|
var ponyfill_es2018 = {exports: {}};
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -4851,7 +4852,7 @@ class Body {
|
|
|
4851
4852
|
return formData;
|
|
4852
4853
|
}
|
|
4853
4854
|
|
|
4854
|
-
const {toFormData} = await Promise.resolve().then(function () { return require('./multipart-parser-
|
|
4855
|
+
const {toFormData} = await Promise.resolve().then(function () { return require('./multipart-parser-55fbd1f3.js'); });
|
|
4855
4856
|
return toFormData(this.body, ct);
|
|
4856
4857
|
}
|
|
4857
4858
|
|
|
@@ -6500,33 +6501,28 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6500
6501
|
});
|
|
6501
6502
|
}
|
|
6502
6503
|
|
|
6504
|
+
/** @type {Record<string, any>} */
|
|
6505
|
+
const globals = {
|
|
6506
|
+
crypto: crypto.webcrypto,
|
|
6507
|
+
fetch,
|
|
6508
|
+
Response,
|
|
6509
|
+
Request,
|
|
6510
|
+
Headers
|
|
6511
|
+
};
|
|
6512
|
+
|
|
6503
6513
|
// exported for dev/preview and node environments
|
|
6504
|
-
function
|
|
6505
|
-
|
|
6506
|
-
fetch
|
|
6507
|
-
|
|
6508
|
-
configurable: true,
|
|
6509
|
-
value: fetch
|
|
6510
|
-
},
|
|
6511
|
-
Response: {
|
|
6514
|
+
function installPolyfills() {
|
|
6515
|
+
for (const name in globals) {
|
|
6516
|
+
// TODO use built-in fetch once https://github.com/nodejs/undici/issues/1262 is resolved
|
|
6517
|
+
Object.defineProperty(globalThis, name, {
|
|
6512
6518
|
enumerable: true,
|
|
6513
6519
|
configurable: true,
|
|
6514
|
-
value:
|
|
6515
|
-
}
|
|
6516
|
-
|
|
6517
|
-
enumerable: true,
|
|
6518
|
-
configurable: true,
|
|
6519
|
-
value: Request
|
|
6520
|
-
},
|
|
6521
|
-
Headers: {
|
|
6522
|
-
enumerable: true,
|
|
6523
|
-
configurable: true,
|
|
6524
|
-
value: Headers
|
|
6525
|
-
}
|
|
6526
|
-
});
|
|
6520
|
+
value: globals[name]
|
|
6521
|
+
});
|
|
6522
|
+
}
|
|
6527
6523
|
}
|
|
6528
6524
|
|
|
6529
|
-
|
|
6525
|
+
installPolyfills();
|
|
6530
6526
|
|
|
6531
6527
|
exports.File = File;
|
|
6532
6528
|
exports.FormData = FormData;
|
package/files/esm/serverless.js
CHANGED
|
@@ -7,6 +7,210 @@ import 'node:stream';
|
|
|
7
7
|
import 'node:util';
|
|
8
8
|
import 'node:url';
|
|
9
9
|
import 'net';
|
|
10
|
+
import 'crypto';
|
|
11
|
+
|
|
12
|
+
var setCookie = {exports: {}};
|
|
13
|
+
|
|
14
|
+
var defaultParseOptions = {
|
|
15
|
+
decodeValues: true,
|
|
16
|
+
map: false,
|
|
17
|
+
silent: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function isNonEmptyString(str) {
|
|
21
|
+
return typeof str === "string" && !!str.trim();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parseString(setCookieValue, options) {
|
|
25
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
26
|
+
var nameValue = parts.shift().split("=");
|
|
27
|
+
var name = nameValue.shift();
|
|
28
|
+
var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
|
|
29
|
+
|
|
30
|
+
options = options
|
|
31
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
32
|
+
: defaultParseOptions;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(
|
|
38
|
+
"set-cookie-parser encountered an error while decoding a cookie with value '" +
|
|
39
|
+
value +
|
|
40
|
+
"'. Set options.decodeValues to false to disable this feature.",
|
|
41
|
+
e
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var cookie = {
|
|
46
|
+
name: name, // grab everything before the first =
|
|
47
|
+
value: value,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
parts.forEach(function (part) {
|
|
51
|
+
var sides = part.split("=");
|
|
52
|
+
var key = sides.shift().trimLeft().toLowerCase();
|
|
53
|
+
var value = sides.join("=");
|
|
54
|
+
if (key === "expires") {
|
|
55
|
+
cookie.expires = new Date(value);
|
|
56
|
+
} else if (key === "max-age") {
|
|
57
|
+
cookie.maxAge = parseInt(value, 10);
|
|
58
|
+
} else if (key === "secure") {
|
|
59
|
+
cookie.secure = true;
|
|
60
|
+
} else if (key === "httponly") {
|
|
61
|
+
cookie.httpOnly = true;
|
|
62
|
+
} else if (key === "samesite") {
|
|
63
|
+
cookie.sameSite = value;
|
|
64
|
+
} else {
|
|
65
|
+
cookie[key] = value;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return cookie;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function parse(input, options) {
|
|
73
|
+
options = options
|
|
74
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
75
|
+
: defaultParseOptions;
|
|
76
|
+
|
|
77
|
+
if (!input) {
|
|
78
|
+
if (!options.map) {
|
|
79
|
+
return [];
|
|
80
|
+
} else {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (input.headers && input.headers["set-cookie"]) {
|
|
86
|
+
// fast-path for node.js (which automatically normalizes header names to lower-case
|
|
87
|
+
input = input.headers["set-cookie"];
|
|
88
|
+
} else if (input.headers) {
|
|
89
|
+
// slow-path for other environments - see #25
|
|
90
|
+
var sch =
|
|
91
|
+
input.headers[
|
|
92
|
+
Object.keys(input.headers).find(function (key) {
|
|
93
|
+
return key.toLowerCase() === "set-cookie";
|
|
94
|
+
})
|
|
95
|
+
];
|
|
96
|
+
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
|
|
97
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
98
|
+
console.warn(
|
|
99
|
+
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
input = sch;
|
|
103
|
+
}
|
|
104
|
+
if (!Array.isArray(input)) {
|
|
105
|
+
input = [input];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
options = options
|
|
109
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
110
|
+
: defaultParseOptions;
|
|
111
|
+
|
|
112
|
+
if (!options.map) {
|
|
113
|
+
return input.filter(isNonEmptyString).map(function (str) {
|
|
114
|
+
return parseString(str, options);
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
var cookies = {};
|
|
118
|
+
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
|
|
119
|
+
var cookie = parseString(str, options);
|
|
120
|
+
cookies[cookie.name] = cookie;
|
|
121
|
+
return cookies;
|
|
122
|
+
}, cookies);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
128
|
+
that are within a single set-cookie field-value, such as in the Expires portion.
|
|
129
|
+
|
|
130
|
+
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
131
|
+
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
132
|
+
React Native's fetch does this for *every* header, including set-cookie.
|
|
133
|
+
|
|
134
|
+
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
135
|
+
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
136
|
+
*/
|
|
137
|
+
function splitCookiesString(cookiesString) {
|
|
138
|
+
if (Array.isArray(cookiesString)) {
|
|
139
|
+
return cookiesString;
|
|
140
|
+
}
|
|
141
|
+
if (typeof cookiesString !== "string") {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var cookiesStrings = [];
|
|
146
|
+
var pos = 0;
|
|
147
|
+
var start;
|
|
148
|
+
var ch;
|
|
149
|
+
var lastComma;
|
|
150
|
+
var nextStart;
|
|
151
|
+
var cookiesSeparatorFound;
|
|
152
|
+
|
|
153
|
+
function skipWhitespace() {
|
|
154
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
155
|
+
pos += 1;
|
|
156
|
+
}
|
|
157
|
+
return pos < cookiesString.length;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function notSpecialChar() {
|
|
161
|
+
ch = cookiesString.charAt(pos);
|
|
162
|
+
|
|
163
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
while (pos < cookiesString.length) {
|
|
167
|
+
start = pos;
|
|
168
|
+
cookiesSeparatorFound = false;
|
|
169
|
+
|
|
170
|
+
while (skipWhitespace()) {
|
|
171
|
+
ch = cookiesString.charAt(pos);
|
|
172
|
+
if (ch === ",") {
|
|
173
|
+
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
|
174
|
+
lastComma = pos;
|
|
175
|
+
pos += 1;
|
|
176
|
+
|
|
177
|
+
skipWhitespace();
|
|
178
|
+
nextStart = pos;
|
|
179
|
+
|
|
180
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
181
|
+
pos += 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// currently special character
|
|
185
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
186
|
+
// we found cookies separator
|
|
187
|
+
cookiesSeparatorFound = true;
|
|
188
|
+
// pos is inside the next cookie, so back up and return it.
|
|
189
|
+
pos = nextStart;
|
|
190
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
191
|
+
start = pos;
|
|
192
|
+
} else {
|
|
193
|
+
// in param ',' or param separator ';',
|
|
194
|
+
// we continue from that comma
|
|
195
|
+
pos = lastComma + 1;
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
pos += 1;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
203
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return cookiesStrings;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
setCookie.exports = parse;
|
|
211
|
+
setCookie.exports.parse = parse;
|
|
212
|
+
setCookie.exports.parseString = parseString;
|
|
213
|
+
var splitCookiesString_1 = setCookie.exports.splitCookiesString = splitCookiesString;
|
|
10
214
|
|
|
11
215
|
/**
|
|
12
216
|
* Splits headers into two categories: single value and multi value
|
|
@@ -25,8 +229,7 @@ function split_headers(headers) {
|
|
|
25
229
|
|
|
26
230
|
headers.forEach((value, key) => {
|
|
27
231
|
if (key === 'set-cookie') {
|
|
28
|
-
|
|
29
|
-
m[key] = headers.raw()[key];
|
|
232
|
+
m[key] = splitCookiesString_1(value);
|
|
30
233
|
} else {
|
|
31
234
|
h[key] = value;
|
|
32
235
|
}
|
package/files/esm/shims.js
CHANGED
|
@@ -5,6 +5,9 @@ import Stream, { PassThrough, pipeline } from 'node:stream';
|
|
|
5
5
|
import { deprecate, types } from 'node:util';
|
|
6
6
|
import { format } from 'node:url';
|
|
7
7
|
import { isIP } from 'net';
|
|
8
|
+
import { webcrypto } from 'crypto';
|
|
9
|
+
|
|
10
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Returns a `Buffer` instance from the given data URI `uri`.
|
|
@@ -58,8 +61,6 @@ function dataUriToBuffer(uri) {
|
|
|
58
61
|
return buffer;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
62
|
-
|
|
63
64
|
var ponyfill_es2018 = {exports: {}};
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -4840,7 +4841,7 @@ class Body {
|
|
|
4840
4841
|
return formData;
|
|
4841
4842
|
}
|
|
4842
4843
|
|
|
4843
|
-
const {toFormData} = await import('./multipart-parser-
|
|
4844
|
+
const {toFormData} = await import('./multipart-parser-172e1198.js');
|
|
4844
4845
|
return toFormData(this.body, ct);
|
|
4845
4846
|
}
|
|
4846
4847
|
|
|
@@ -6489,32 +6490,27 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6489
6490
|
});
|
|
6490
6491
|
}
|
|
6491
6492
|
|
|
6493
|
+
/** @type {Record<string, any>} */
|
|
6494
|
+
const globals = {
|
|
6495
|
+
crypto: webcrypto,
|
|
6496
|
+
fetch,
|
|
6497
|
+
Response,
|
|
6498
|
+
Request,
|
|
6499
|
+
Headers
|
|
6500
|
+
};
|
|
6501
|
+
|
|
6492
6502
|
// exported for dev/preview and node environments
|
|
6493
|
-
function
|
|
6494
|
-
|
|
6495
|
-
fetch
|
|
6496
|
-
|
|
6497
|
-
configurable: true,
|
|
6498
|
-
value: fetch
|
|
6499
|
-
},
|
|
6500
|
-
Response: {
|
|
6503
|
+
function installPolyfills() {
|
|
6504
|
+
for (const name in globals) {
|
|
6505
|
+
// TODO use built-in fetch once https://github.com/nodejs/undici/issues/1262 is resolved
|
|
6506
|
+
Object.defineProperty(globalThis, name, {
|
|
6501
6507
|
enumerable: true,
|
|
6502
6508
|
configurable: true,
|
|
6503
|
-
value:
|
|
6504
|
-
}
|
|
6505
|
-
|
|
6506
|
-
enumerable: true,
|
|
6507
|
-
configurable: true,
|
|
6508
|
-
value: Request
|
|
6509
|
-
},
|
|
6510
|
-
Headers: {
|
|
6511
|
-
enumerable: true,
|
|
6512
|
-
configurable: true,
|
|
6513
|
-
value: Headers
|
|
6514
|
-
}
|
|
6515
|
-
});
|
|
6509
|
+
value: globals[name]
|
|
6510
|
+
});
|
|
6511
|
+
}
|
|
6516
6512
|
}
|
|
6517
6513
|
|
|
6518
|
-
|
|
6514
|
+
installPolyfills();
|
|
6519
6515
|
|
|
6520
6516
|
export { FormData as F, File as a };
|
package/index.js
CHANGED
|
@@ -54,6 +54,19 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
|
|
|
54
54
|
|
|
55
55
|
builder.log.minor(`Publishing to "${publish}"`);
|
|
56
56
|
|
|
57
|
+
builder.log.minor('Copying assets...');
|
|
58
|
+
builder.writeStatic(publish);
|
|
59
|
+
builder.writeClient(publish);
|
|
60
|
+
builder.writePrerendered(publish);
|
|
61
|
+
|
|
62
|
+
builder.log.minor('Writing custom headers...');
|
|
63
|
+
const headers_file = join(publish, '_headers');
|
|
64
|
+
builder.copy('_headers', headers_file);
|
|
65
|
+
appendFileSync(
|
|
66
|
+
headers_file,
|
|
67
|
+
`\n\n/${builder.config.kit.appDir}/*\n cache-control: public\n cache-control: immutable\n cache-control: max-age=31536000\n`
|
|
68
|
+
);
|
|
69
|
+
|
|
57
70
|
// for esbuild, use ESM
|
|
58
71
|
// for zip-it-and-ship-it, use CJS until https://github.com/netlify/zip-it-and-ship-it/issues/750
|
|
59
72
|
const esm = netlify_config?.functions?.node_bundler === 'esbuild';
|
|
@@ -67,19 +80,6 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
|
|
|
67
80
|
} else {
|
|
68
81
|
await generate_lambda_functions({ builder, esm, split, publish });
|
|
69
82
|
}
|
|
70
|
-
|
|
71
|
-
builder.log.minor('Copying assets...');
|
|
72
|
-
builder.writeStatic(publish);
|
|
73
|
-
builder.writeClient(publish);
|
|
74
|
-
builder.writePrerendered(publish);
|
|
75
|
-
|
|
76
|
-
builder.log.minor('Writing custom headers...');
|
|
77
|
-
const headers_file = join(publish, '_headers');
|
|
78
|
-
builder.copy('_headers', headers_file);
|
|
79
|
-
appendFileSync(
|
|
80
|
-
headers_file,
|
|
81
|
-
`\n\n/${builder.config.kit.appDir}/*\n cache-control: public\n cache-control: immutable\n cache-control: max-age=31536000\n`
|
|
82
|
-
);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}
|
|
@@ -230,6 +230,9 @@ function generate_lambda_functions({ builder, publish, split, esm }) {
|
|
|
230
230
|
redirects.push('* /.netlify/functions/render 200');
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// this should happen at the end, after builder.writeStatic(...),
|
|
234
|
+
// so that generated redirects are appended to custom redirects
|
|
235
|
+
// rather than replaced by them
|
|
233
236
|
builder.log.minor('Writing redirects...');
|
|
234
237
|
const redirect_file = join(publish, '_redirects');
|
|
235
238
|
if (existsSync('_redirects')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-netlify",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.59",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -23,19 +23,14 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@iarna/toml": "^2.2.5",
|
|
26
|
-
"esbuild": "^0.14.
|
|
26
|
+
"esbuild": "^0.14.29",
|
|
27
|
+
"set-cookie-parser": "^2.4.8",
|
|
27
28
|
"tiny-glob": "^0.2.9"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
31
|
+
"@types/set-cookie-parser": "^2.4.2",
|
|
30
32
|
"@netlify/functions": "^1.0.0",
|
|
31
|
-
"@
|
|
32
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
33
|
-
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
34
|
-
"@sveltejs/kit": "1.0.0-next.323",
|
|
35
|
-
"rimraf": "^3.0.2",
|
|
36
|
-
"rollup": "^2.58.0",
|
|
37
|
-
"typescript": "^4.6.2",
|
|
38
|
-
"uvu": "^0.5.2"
|
|
33
|
+
"@sveltejs/kit": "1.0.0-next.341"
|
|
39
34
|
},
|
|
40
35
|
"scripts": {
|
|
41
36
|
"dev": "rimraf files && rollup -cw",
|