Unverified Commit 7db2ce3b authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Upgrade edge-runtime/cookies (#57021)

parent 40965ebd
......@@ -135,7 +135,7 @@
"@babel/traverse": "7.18.0",
"@babel/types": "7.18.0",
"@capsizecss/metrics": "1.1.0",
"@edge-runtime/cookies": "4.0.1",
"@edge-runtime/cookies": "4.0.2",
"@edge-runtime/ponyfill": "2.4.1",
"@edge-runtime/primitives": "4.0.2",
"@hapi/accept": "5.0.2",
......
......@@ -111,6 +111,57 @@ function parsePriority(string) {
string = string.toLowerCase();
return PRIORITY.includes(string) ? string : void 0;
}
function splitCookiesString(cookiesString) {
if (!cookiesString)
return [];
var cookiesStrings = [];
var pos = 0;
var start;
var ch;
var lastComma;
var nextStart;
var cookiesSeparatorFound;
function skipWhitespace() {
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
pos += 1;
}
return pos < cookiesString.length;
}
function notSpecialChar() {
ch = cookiesString.charAt(pos);
return ch !== "=" && ch !== ";" && ch !== ",";
}
while (pos < cookiesString.length) {
start = pos;
cookiesSeparatorFound = false;
while (skipWhitespace()) {
ch = cookiesString.charAt(pos);
if (ch === ",") {
lastComma = pos;
pos += 1;
skipWhitespace();
nextStart = pos;
while (pos < cookiesString.length && notSpecialChar()) {
pos += 1;
}
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
cookiesSeparatorFound = true;
pos = nextStart;
cookiesStrings.push(cookiesString.substring(start, lastComma));
start = pos;
} else {
pos = lastComma + 1;
}
} else {
pos += 1;
}
}
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
}
}
return cookiesStrings;
}
// src/request-cookies.ts
var RequestCookies = class {
......@@ -196,8 +247,10 @@ var ResponseCookies = class {
constructor(responseHeaders) {
/** @internal */
this._parsed = /* @__PURE__ */ new Map();
var _a, _b, _c;
this._headers = responseHeaders;
const cookieStrings = responseHeaders.getSetCookie();
const setCookie = (_c = (_b = (_a = responseHeaders.getSetCookie) == null ? void 0 : _a.call(responseHeaders)) != null ? _b : responseHeaders.get("set-cookie")) != null ? _c : [];
const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie);
for (const cookieString of cookieStrings) {
const parsed = parseSetCookie(cookieString);
if (parsed)
......
{"name":"@edge-runtime/cookies","version":"4.0.1","main":"./index.js","license":"MPL-2.0"}
{"name":"@edge-runtime/cookies","version":"4.0.2","main":"./index.js","license":"MPL-2.0"}
......@@ -893,8 +893,8 @@ importers:
specifier: 1.1.0
version: 1.1.0
'@edge-runtime/cookies':
specifier: 4.0.1
version: 4.0.1
specifier: 4.0.2
version: 4.0.2
'@edge-runtime/ponyfill':
specifier: 2.4.1
version: 2.4.1
......@@ -5045,8 +5045,8 @@ packages:
resolution: {integrity: sha512-smLocSfrt3s53H/XSVP3/1kP42oqvrkjUPtyaFd1F79ux24oE31BKt+q0c6lsa6hOYrFzsIwyc5GXAI5JmfOew==}
dev: true
/@edge-runtime/cookies@4.0.1:
resolution: {integrity: sha512-QIZ1lz6rAF8rTrFdGkljedUaZpXbGIWmRdbA+kwm15ddFfryyekYwI3luFKB33KDcXRHrBi6WdMuyQN19CS6pg==}
/@edge-runtime/cookies@4.0.2:
resolution: {integrity: sha512-BphVamVz/yt9FN1b60ZXp+iTJVRLUHI0POxKYZG3gn+RsP+M0phqS87Z9JnDn2YOsPx9SRhhrN9AB7yhpexNEw==}
engines: {node: '>=16'}
dev: true
......@@ -6723,8 +6723,8 @@ packages:
resolution: {integrity: sha512-XQr74QaLeMiqhStEhLn1im9EOMnkypp7MZOwQhGzqp2Weu5eQJbpPxWxixxlYRKWPOmJjsk6qYfYH9kq43yc2w==}
dev: true
/@next/react-refresh-utils@13.5.4(react-refresh@0.12.0)(webpack@5.86.0):
resolution: {integrity: sha512-Y2bFd17Gn5Wh1gT/P/xTlApmipdrD0JdTdMwhi8G2wD2qj8p7SZbci1kp7zp+utWVp8PFQD6kHAIBrJS9/iEQQ==}
/@next/react-refresh-utils@13.5.5(react-refresh@0.12.0)(webpack@5.86.0):
resolution: {integrity: sha512-8lvKW22vbWnloufUverqDOsmesoqBPxnX2rUAZuZ+e7240BqvXvhuWd9XWbwFXZ7bgR1FWU/5NYpGK/b2rT5vw==}
peerDependencies:
react-refresh: 0.12.0
webpack: 5.86.0
......@@ -26794,7 +26794,7 @@ packages:
name: '@vercel/turbopack-ecmascript-runtime'
version: 0.0.0
dependencies:
'@next/react-refresh-utils': 13.5.4(react-refresh@0.12.0)(webpack@5.86.0)
'@next/react-refresh-utils': 13.5.5(react-refresh@0.12.0)(webpack@5.86.0)
'@types/node': 20.2.5
transitivePeerDependencies:
- react-refresh
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment