@sveltejs/adapter-netlify 2.0.6 → 2.0.8

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.
@@ -14,21 +14,17 @@ import 'stream/web';
14
14
  import 'worker_threads';
15
15
  import 'perf_hooks';
16
16
  import 'util/types';
17
- import 'url';
18
17
  import 'events';
19
18
  import 'tls';
20
19
  import 'async_hooks';
21
20
  import 'console';
21
+ import 'url';
22
22
  import 'zlib';
23
23
  import 'string_decoder';
24
24
  import 'crypto';
25
25
  import 'diagnostics_channel';
26
26
 
27
- var setCookieExports = {};
28
- var setCookie = {
29
- get exports(){ return setCookieExports; },
30
- set exports(v){ setCookieExports = v; },
31
- };
27
+ var setCookie = {exports: {}};
32
28
 
33
29
  var defaultParseOptions = {
34
30
  decodeValues: true,
@@ -119,24 +115,30 @@ function parse(input, options) {
119
115
  }
120
116
  }
121
117
 
122
- if (input.headers && input.headers["set-cookie"]) {
123
- // fast-path for node.js (which automatically normalizes header names to lower-case
124
- input = input.headers["set-cookie"];
125
- } else if (input.headers) {
126
- // slow-path for other environments - see #25
127
- var sch =
128
- input.headers[
129
- Object.keys(input.headers).find(function (key) {
130
- return key.toLowerCase() === "set-cookie";
131
- })
132
- ];
133
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
134
- if (!sch && input.headers.cookie && !options.silent) {
135
- console.warn(
136
- "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."
137
- );
118
+ if (input.headers) {
119
+ if (typeof input.headers.getSetCookie === "function") {
120
+ // for fetch responses - they combine headers of the same type in the headers array,
121
+ // but getSetCookie returns an uncombined array
122
+ input = input.headers.getSetCookie();
123
+ } else if (input.headers["set-cookie"]) {
124
+ // fast-path for node.js (which automatically normalizes header names to lower-case
125
+ input = input.headers["set-cookie"];
126
+ } else {
127
+ // slow-path for other environments - see #25
128
+ var sch =
129
+ input.headers[
130
+ Object.keys(input.headers).find(function (key) {
131
+ return key.toLowerCase() === "set-cookie";
132
+ })
133
+ ];
134
+ // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
135
+ if (!sch && input.headers.cookie && !options.silent) {
136
+ console.warn(
137
+ "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."
138
+ );
139
+ }
140
+ input = sch;
138
141
  }
139
- input = sch;
140
142
  }
141
143
  if (!Array.isArray(input)) {
142
144
  input = [input];
@@ -245,9 +247,9 @@ function splitCookiesString(cookiesString) {
245
247
  }
246
248
 
247
249
  setCookie.exports = parse;
248
- setCookieExports.parse = parse;
249
- setCookieExports.parseString = parseString;
250
- var splitCookiesString_1 = setCookieExports.splitCookiesString = splitCookiesString;
250
+ setCookie.exports.parse = parse;
251
+ setCookie.exports.parseString = parseString;
252
+ var splitCookiesString_1 = setCookie.exports.splitCookiesString = splitCookiesString;
251
253
 
252
254
  /**
253
255
  * Splits headers into two categories: single value and multi value