From feeebf6f2dd6e2238ae65ce08d7a73665e62a8a7 Mon Sep 17 00:00:00 2001 From: Salih Hasicic Date: Fri, 3 Apr 2026 14:58:24 +0200 Subject: [PATCH] Refine product detail layout and add delivery information section --- node_modules/.package-lock.json | 51 + node_modules/cookie/LICENSE | 24 + node_modules/cookie/README.md | 295 + node_modules/cookie/dist/index.d.ts | 148 + node_modules/cookie/dist/index.js | 350 + node_modules/cookie/dist/index.js.map | 1 + node_modules/cookie/package.json | 47 + node_modules/react-router/CHANGELOG.md | 2555 ++++ node_modules/react-router/LICENSE.md | 23 + node_modules/react-router/README.md | 7 + .../dist/development/browser-C9Ar1yxG.d.ts | 318 + .../dist/development/browser-vtIR1Kpe.d.mts | 318 + .../dist/development/chunk-2UH5WJXA.mjs | 2565 ++++ .../dist/development/chunk-IK6APEEG.js | 9963 ++++++++++++++ .../dist/development/chunk-NXTEWSJO.js | 1352 ++ .../dist/development/chunk-QFMPRPBF.mjs | 11252 ++++++++++++++++ .../dist/development/chunk-WAVMRYR2.js | 188 + .../dist/development/context-phCt_zmH.d.mts | 1713 +++ .../dist/development/dom-export.d.mts | 172 + .../dist/development/dom-export.d.ts | 173 + .../dist/development/dom-export.js | 1021 ++ .../dist/development/dom-export.mjs | 1013 ++ .../index-react-server-client-BwWaHAr3.d.mts | 2590 ++++ .../index-react-server-client-luDbagNU.d.ts | 3645 +++++ .../index-react-server-client.d.mts | 4 + .../index-react-server-client.d.ts | 4 + .../development/index-react-server-client.js | 61 + .../development/index-react-server-client.mjs | 59 + .../dist/development/index-react-server.d.mts | 2620 ++++ .../dist/development/index-react-server.d.ts | 2620 ++++ .../dist/development/index-react-server.js | 3862 ++++++ .../dist/development/index-react-server.mjs | 3750 +++++ .../react-router/dist/development/index.d.mts | 1390 ++ .../react-router/dist/development/index.d.ts | 1390 ++ .../react-router/dist/development/index.js | 2608 ++++ .../react-router/dist/development/index.mjs | 275 + .../development/instrumentation-BYr6ff5D.d.ts | 657 + .../dist/development/lib/types/internal.d.mts | 184 + .../dist/development/lib/types/internal.d.ts | 184 + .../dist/development/lib/types/internal.js | 10 + .../dist/development/lib/types/internal.mjs | 10 + .../dist/development/register-CTxsJBKQ.d.mts | 30 + .../dist/development/register-CkcGwv27.d.ts | 30 + .../development/routeModules-BRrCYrSL.d.mts | 1693 +++ .../development/routeModules-CA7kSxJJ.d.ts | 1693 +++ .../dist/production/browser-C9Ar1yxG.d.ts | 318 + .../dist/production/browser-vtIR1Kpe.d.mts | 318 + .../dist/production/chunk-355DUZMC.js | 188 + .../dist/production/chunk-4TJ7T2OQ.js | 9963 ++++++++++++++ .../dist/production/chunk-FPT5DLVJ.js | 1352 ++ .../dist/production/chunk-HZQGQD2X.mjs | 11252 ++++++++++++++++ .../dist/production/chunk-X5LK27NZ.mjs | 2565 ++++ .../dist/production/context-phCt_zmH.d.mts | 1713 +++ .../dist/production/dom-export.d.mts | 172 + .../dist/production/dom-export.d.ts | 173 + .../dist/production/dom-export.js | 1021 ++ .../dist/production/dom-export.mjs | 1013 ++ .../index-react-server-client-BwWaHAr3.d.mts | 2590 ++++ .../index-react-server-client-luDbagNU.d.ts | 3645 +++++ .../index-react-server-client.d.mts | 4 + .../production/index-react-server-client.d.ts | 4 + .../production/index-react-server-client.js | 61 + .../production/index-react-server-client.mjs | 59 + .../dist/production/index-react-server.d.mts | 2620 ++++ .../dist/production/index-react-server.d.ts | 2620 ++++ .../dist/production/index-react-server.js | 3862 ++++++ .../dist/production/index-react-server.mjs | 3750 +++++ .../react-router/dist/production/index.d.mts | 1390 ++ .../react-router/dist/production/index.d.ts | 1390 ++ .../react-router/dist/production/index.js | 2608 ++++ .../react-router/dist/production/index.mjs | 275 + .../production/instrumentation-BYr6ff5D.d.ts | 657 + .../dist/production/lib/types/internal.d.mts | 184 + .../dist/production/lib/types/internal.d.ts | 184 + .../dist/production/lib/types/internal.js | 10 + .../dist/production/lib/types/internal.mjs | 10 + .../dist/production/register-CTxsJBKQ.d.mts | 30 + .../dist/production/register-CkcGwv27.d.ts | 30 + .../production/routeModules-BRrCYrSL.d.mts | 1693 +++ .../production/routeModules-CA7kSxJJ.d.ts | 1693 +++ node_modules/react-router/package.json | 163 + node_modules/react/LICENSE | 21 + node_modules/react/README.md | 37 + .../cjs/react-compiler-runtime.development.js | 24 + .../cjs/react-compiler-runtime.production.js | 16 + .../cjs/react-compiler-runtime.profiling.js | 16 + .../cjs/react-jsx-dev-runtime.development.js | 338 + .../cjs/react-jsx-dev-runtime.production.js | 14 + .../cjs/react-jsx-dev-runtime.profiling.js | 14 + ...sx-dev-runtime.react-server.development.js | 370 + ...jsx-dev-runtime.react-server.production.js | 40 + .../cjs/react-jsx-runtime.development.js | 352 + .../react/cjs/react-jsx-runtime.production.js | 34 + .../react/cjs/react-jsx-runtime.profiling.js | 34 + ...ct-jsx-runtime.react-server.development.js | 370 + ...act-jsx-runtime.react-server.production.js | 40 + node_modules/react/cjs/react.development.js | 1284 ++ node_modules/react/cjs/react.production.js | 542 + .../cjs/react.react-server.development.js | 848 ++ .../cjs/react.react-server.production.js | 423 + node_modules/react/compiler-runtime.js | 14 + node_modules/react/index.js | 7 + node_modules/react/jsx-dev-runtime.js | 7 + .../react/jsx-dev-runtime.react-server.js | 7 + node_modules/react/jsx-runtime.js | 7 + .../react/jsx-runtime.react-server.js | 7 + node_modules/react/package.json | 51 + node_modules/react/react.react-server.js | 7 + node_modules/set-cookie-parser/LICENSE | 21 + node_modules/set-cookie-parser/README.md | 202 + .../set-cookie-parser/lib/set-cookie.js | 242 + node_modules/set-cookie-parser/package.json | 45 + package-lock.json | 54 +- package.json | 3 +- .../src/components/ProductDetailPage.css | 68 +- .../src/components/ProductDetailPage.jsx | 25 + 116 files changed, 128079 insertions(+), 3 deletions(-) create mode 100644 node_modules/cookie/LICENSE create mode 100644 node_modules/cookie/README.md create mode 100644 node_modules/cookie/dist/index.d.ts create mode 100644 node_modules/cookie/dist/index.js create mode 100644 node_modules/cookie/dist/index.js.map create mode 100644 node_modules/cookie/package.json create mode 100644 node_modules/react-router/CHANGELOG.md create mode 100644 node_modules/react-router/LICENSE.md create mode 100644 node_modules/react-router/README.md create mode 100644 node_modules/react-router/dist/development/browser-C9Ar1yxG.d.ts create mode 100644 node_modules/react-router/dist/development/browser-vtIR1Kpe.d.mts create mode 100644 node_modules/react-router/dist/development/chunk-2UH5WJXA.mjs create mode 100644 node_modules/react-router/dist/development/chunk-IK6APEEG.js create mode 100644 node_modules/react-router/dist/development/chunk-NXTEWSJO.js create mode 100644 node_modules/react-router/dist/development/chunk-QFMPRPBF.mjs create mode 100644 node_modules/react-router/dist/development/chunk-WAVMRYR2.js create mode 100644 node_modules/react-router/dist/development/context-phCt_zmH.d.mts create mode 100644 node_modules/react-router/dist/development/dom-export.d.mts create mode 100644 node_modules/react-router/dist/development/dom-export.d.ts create mode 100644 node_modules/react-router/dist/development/dom-export.js create mode 100644 node_modules/react-router/dist/development/dom-export.mjs create mode 100644 node_modules/react-router/dist/development/index-react-server-client-BwWaHAr3.d.mts create mode 100644 node_modules/react-router/dist/development/index-react-server-client-luDbagNU.d.ts create mode 100644 node_modules/react-router/dist/development/index-react-server-client.d.mts create mode 100644 node_modules/react-router/dist/development/index-react-server-client.d.ts create mode 100644 node_modules/react-router/dist/development/index-react-server-client.js create mode 100644 node_modules/react-router/dist/development/index-react-server-client.mjs create mode 100644 node_modules/react-router/dist/development/index-react-server.d.mts create mode 100644 node_modules/react-router/dist/development/index-react-server.d.ts create mode 100644 node_modules/react-router/dist/development/index-react-server.js create mode 100644 node_modules/react-router/dist/development/index-react-server.mjs create mode 100644 node_modules/react-router/dist/development/index.d.mts create mode 100644 node_modules/react-router/dist/development/index.d.ts create mode 100644 node_modules/react-router/dist/development/index.js create mode 100644 node_modules/react-router/dist/development/index.mjs create mode 100644 node_modules/react-router/dist/development/instrumentation-BYr6ff5D.d.ts create mode 100644 node_modules/react-router/dist/development/lib/types/internal.d.mts create mode 100644 node_modules/react-router/dist/development/lib/types/internal.d.ts create mode 100644 node_modules/react-router/dist/development/lib/types/internal.js create mode 100644 node_modules/react-router/dist/development/lib/types/internal.mjs create mode 100644 node_modules/react-router/dist/development/register-CTxsJBKQ.d.mts create mode 100644 node_modules/react-router/dist/development/register-CkcGwv27.d.ts create mode 100644 node_modules/react-router/dist/development/routeModules-BRrCYrSL.d.mts create mode 100644 node_modules/react-router/dist/development/routeModules-CA7kSxJJ.d.ts create mode 100644 node_modules/react-router/dist/production/browser-C9Ar1yxG.d.ts create mode 100644 node_modules/react-router/dist/production/browser-vtIR1Kpe.d.mts create mode 100644 node_modules/react-router/dist/production/chunk-355DUZMC.js create mode 100644 node_modules/react-router/dist/production/chunk-4TJ7T2OQ.js create mode 100644 node_modules/react-router/dist/production/chunk-FPT5DLVJ.js create mode 100644 node_modules/react-router/dist/production/chunk-HZQGQD2X.mjs create mode 100644 node_modules/react-router/dist/production/chunk-X5LK27NZ.mjs create mode 100644 node_modules/react-router/dist/production/context-phCt_zmH.d.mts create mode 100644 node_modules/react-router/dist/production/dom-export.d.mts create mode 100644 node_modules/react-router/dist/production/dom-export.d.ts create mode 100644 node_modules/react-router/dist/production/dom-export.js create mode 100644 node_modules/react-router/dist/production/dom-export.mjs create mode 100644 node_modules/react-router/dist/production/index-react-server-client-BwWaHAr3.d.mts create mode 100644 node_modules/react-router/dist/production/index-react-server-client-luDbagNU.d.ts create mode 100644 node_modules/react-router/dist/production/index-react-server-client.d.mts create mode 100644 node_modules/react-router/dist/production/index-react-server-client.d.ts create mode 100644 node_modules/react-router/dist/production/index-react-server-client.js create mode 100644 node_modules/react-router/dist/production/index-react-server-client.mjs create mode 100644 node_modules/react-router/dist/production/index-react-server.d.mts create mode 100644 node_modules/react-router/dist/production/index-react-server.d.ts create mode 100644 node_modules/react-router/dist/production/index-react-server.js create mode 100644 node_modules/react-router/dist/production/index-react-server.mjs create mode 100644 node_modules/react-router/dist/production/index.d.mts create mode 100644 node_modules/react-router/dist/production/index.d.ts create mode 100644 node_modules/react-router/dist/production/index.js create mode 100644 node_modules/react-router/dist/production/index.mjs create mode 100644 node_modules/react-router/dist/production/instrumentation-BYr6ff5D.d.ts create mode 100644 node_modules/react-router/dist/production/lib/types/internal.d.mts create mode 100644 node_modules/react-router/dist/production/lib/types/internal.d.ts create mode 100644 node_modules/react-router/dist/production/lib/types/internal.js create mode 100644 node_modules/react-router/dist/production/lib/types/internal.mjs create mode 100644 node_modules/react-router/dist/production/register-CTxsJBKQ.d.mts create mode 100644 node_modules/react-router/dist/production/register-CkcGwv27.d.ts create mode 100644 node_modules/react-router/dist/production/routeModules-BRrCYrSL.d.mts create mode 100644 node_modules/react-router/dist/production/routeModules-CA7kSxJJ.d.ts create mode 100644 node_modules/react-router/package.json create mode 100644 node_modules/react/LICENSE create mode 100644 node_modules/react/README.md create mode 100644 node_modules/react/cjs/react-compiler-runtime.development.js create mode 100644 node_modules/react/cjs/react-compiler-runtime.production.js create mode 100644 node_modules/react/cjs/react-compiler-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.development.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.production.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.development.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.production.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.react-server.development.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.react-server.production.js create mode 100644 node_modules/react/cjs/react.development.js create mode 100644 node_modules/react/cjs/react.production.js create mode 100644 node_modules/react/cjs/react.react-server.development.js create mode 100644 node_modules/react/cjs/react.react-server.production.js create mode 100644 node_modules/react/compiler-runtime.js create mode 100644 node_modules/react/index.js create mode 100644 node_modules/react/jsx-dev-runtime.js create mode 100644 node_modules/react/jsx-dev-runtime.react-server.js create mode 100644 node_modules/react/jsx-runtime.js create mode 100644 node_modules/react/jsx-runtime.react-server.js create mode 100644 node_modules/react/package.json create mode 100644 node_modules/react/react.react-server.js create mode 100644 node_modules/set-cookie-parser/LICENSE create mode 100644 node_modules/set-cookie-parser/README.md create mode 100644 node_modules/set-cookie-parser/lib/set-cookie.js create mode 100644 node_modules/set-cookie-parser/package.json diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 73720ef..911c2d6 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -3,11 +3,62 @@ "lockfileVersion": 3, "requires": true, "packages": { + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/gsap": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/gsap/-/gsap-3.14.2.tgz", "integrity": "sha512-P8/mMxVLU7o4+55+1TCnQrPmgjPKnwkzkXOK1asnR9Jg2lna4tEY5qBJjMmAaOBDDZWtlRjBXjLa0w53G/uBLA==", "license": "Standard 'no charge' license: https://gsap.com/standard-license." + }, + "node_modules/react": { + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.14.0.tgz", + "integrity": "sha512-m/xR9N4LQLmAS0ZhkY2nkPA1N7gQ5TUVa5n8TgANuDTARbn1gt+zLPXEm7W0XDTbrQ2AJSJKhoa6yx1D8BcpxQ==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" } } } diff --git a/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE new file mode 100644 index 0000000..058b6b4 --- /dev/null +++ b/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/cookie/README.md b/node_modules/cookie/README.md new file mode 100644 index 0000000..24ec013 --- /dev/null +++ b/node_modules/cookie/README.md @@ -0,0 +1,295 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coverage-image]][coverage-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +```sh +$ npm install cookie +``` + +## API + +```js +const cookie = require("cookie"); +// import * as cookie from 'cookie'; +``` + +### cookie.parseCookie(str, options) + +Parse an HTTP `Cookie` header string and return an [object](#cookie-object) of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +const cookieObject = cookie.parseCookie("foo=bar; equation=E%3Dmc%5E2"); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +- `decode` Specifies the function to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`decodeURIComponent`](#encode-and-decode). + +### cookie.stringifyCookie(cookieObj, options) + +Stringifies a [cookie object](#cookie-object) into an HTTP `Cookie` header. + +```js +const cookieHeader = cookie.stringify({ a: "foo", b: "bar" }); +// a=foo; b=bar +``` + +#### Options + +- `encode` Specifies the function to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`encodeURIComponent`](#encode-and-decode). + +### cookie.parseSetCookie(str, options) + +Parse an HTTP `Set-Cookie` header string and return an [object](#set-cookie-object) of the options. + +```js +const setCookieObject = cookie.parseSetCookie("foo=bar; httpOnly"); +// { name: "foo", value: "bar", httpOnly: true } +``` + +**Note:** Cookie follows the specification and ignores invalid attributes, but does not attempt to normalize or modify any attributes as a browser might. For example: + +```js +cookie.parseSetCookie( + "session=abc; max-age=1.5; expires=invalid; custom=value; domain=example.com", +); +// { name: "session", value: "abc", domain: "example.com" } +``` + +#### Options + +- `decode` Specifies the function to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`decodeURIComponent`](#encode-and-decode). + +### cookie.stringifySetCookie(setCookieObj, options) + +Stringifies a [`Set-Cookie` object](#set-cookie-object) into a `Set-Cookie` header string. + +```js +const setCookieHeader = cookie.stringifySetCookie({ + name: "foo", + value: "bar", +}); +// foo=bar +``` + +#### Options + +- `encode` Specifies the function to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`encodeURIComponent`](#encode-and-decode). + +## Cookie object + +The cookie object represents all cookie name-value pairs in a `Cookie` header, where `{ name: "value" }` is used for `name=value`. + +## `Set-Cookie` object + +The `Set-Cookie` object represents all the options in a `Set-Cookie` header. + +### name + +The name of the cookie. + +### value + +The value of a cookie after it has been [decoded](#encode-and-decode). + +### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). + +The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1). +When no expiration is set, clients consider this a "non-persistent cookie" and delete it when the current session is over. + +The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3). +When no domain is set, clients consider the cookie to apply to the current domain only. + +### path + +Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). +When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4). + +### httpOnly + +Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6). +When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`. + +### secure + +Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). +When enabled, clients will only send the cookie back if the browser has an HTTPS connection. + +### partitioned + +Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/). +When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches. + +This is an attribute that has not yet been fully standardized, and may change in the future. +This also means clients may ignore this attribute until they understand it. More information +about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +### priority + +Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + +- `'low'` will set the `Priority` attribute to `Low`. +- `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. +- `'high'` will set the `Priority` attribute to `High`. + +More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + +### sameSite + +Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + +- `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. +- `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. +- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. +- `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + +## Encode and decode + +Cookie accepts `encode` or `decode` options for processing a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). +Since the value of a cookie has a limited character set (and must be a simple string), these functions are used to transform values into strings suitable for a cookies value. + +The default `encode` function is the global `encodeURIComponent`. + +The default `decode` function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error +is thrown it will return the cookie's original value. If you provide your own encode/decode +scheme you must ensure errors are appropriately handled. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require("cookie"); +var escapeHtml = require("escape-html"); +var http = require("http"); +var url = require("url"); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader( + "Set-Cookie", + cookie.stringifySetCookie({ + name: "name", + value: String(query.name), + httpOnly: true, + maxAge: 60 * 60 * 24 * 7, // 1 week + }), + ); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader("Location", req.headers.referer || "/"); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parseCookie(req.headers.cookie || ""); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader("Content-Type", "text/html; charset=UTF-8"); + + if (name) { + res.write("

Welcome back, " + escapeHtml(name) + "!

"); + } else { + res.write("

Hello, new visitor!

"); + } + + res.write('
'); + res.write( + ' ', + ); + res.end("
"); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +npm test +``` + +## Benchmark + +```sh +npm run bench +``` + +``` + name hz min max mean p75 p99 p995 p999 rme samples + · simple 8,566,313.09 0.0000 0.3694 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.64% 4283157 fastest + · decode 3,834,348.85 0.0001 0.2465 0.0003 0.0003 0.0003 0.0004 0.0006 ±0.38% 1917175 + · unquote 8,315,355.96 0.0000 0.3824 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.72% 4157880 + · duplicates 1,944,765.97 0.0004 0.2959 0.0005 0.0005 0.0006 0.0006 0.0008 ±0.24% 972384 + · 10 cookies 675,345.67 0.0012 0.4328 0.0015 0.0015 0.0019 0.0020 0.0058 ±0.75% 337673 + · 100 cookies 61,040.71 0.0152 0.4092 0.0164 0.0160 0.0196 0.0228 0.2260 ±0.71% 30521 slowest + ✓ parse top-sites (15) 22945ms + name hz min max mean p75 p99 p995 p999 rme samples + · parse accounts.google.com 7,164,349.17 0.0000 0.0929 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.09% 3582184 + · parse apple.com 7,817,686.84 0.0000 0.6048 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.05% 3908844 + · parse cloudflare.com 7,189,841.70 0.0000 0.0390 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3594921 + · parse docs.google.com 7,051,765.61 0.0000 0.0296 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3525883 + · parse drive.google.com 7,349,104.77 0.0000 0.0368 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.05% 3674553 + · parse en.wikipedia.org 1,929,909.49 0.0004 0.3598 0.0005 0.0005 0.0007 0.0007 0.0012 ±0.16% 964955 + · parse linkedin.com 2,225,658.01 0.0003 0.0595 0.0004 0.0005 0.0005 0.0005 0.0006 ±0.06% 1112830 + · parse maps.google.com 4,423,511.68 0.0001 0.0942 0.0002 0.0003 0.0003 0.0003 0.0005 ±0.08% 2211756 + · parse microsoft.com 3,387,601.88 0.0002 0.0725 0.0003 0.0003 0.0004 0.0004 0.0005 ±0.09% 1693801 + · parse play.google.com 7,375,980.86 0.0000 0.1994 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.12% 3687991 + · parse support.google.com 4,912,267.94 0.0001 2.8958 0.0002 0.0002 0.0003 0.0003 0.0005 ±1.28% 2456134 + · parse www.google.com 3,443,035.87 0.0002 0.2783 0.0003 0.0003 0.0004 0.0004 0.0007 ±0.51% 1721518 + · parse youtu.be 1,910,492.87 0.0004 0.3490 0.0005 0.0005 0.0007 0.0007 0.0011 ±0.46% 955247 + · parse youtube.com 1,895,082.62 0.0004 0.7454 0.0005 0.0005 0.0006 0.0007 0.0013 ±0.64% 947542 slowest + · parse example.com 21,582,835.27 0.0000 0.1095 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.13% 10791418 +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265) +- [Same-site Cookies](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7) + +## License + +[MIT](LICENSE) + +[ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/cookie/ci.yml +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml?query=branch%3Amaster +[coverage-image]: https://img.shields.io/codecov/c/github/jshttp/cookie/master +[coverage-url]: https://app.codecov.io/gh/jshttp/cookie +[npm-downloads-image]: https://img.shields.io/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://img.shields.io/npm/v/cookie diff --git a/node_modules/cookie/dist/index.d.ts b/node_modules/cookie/dist/index.d.ts new file mode 100644 index 0000000..1ae405a --- /dev/null +++ b/node_modules/cookie/dist/index.d.ts @@ -0,0 +1,148 @@ +/** + * Parse options. + */ +export interface ParseOptions { + /** + * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). + * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode + * a previously-encoded cookie value into a JavaScript string. + * + * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error + * is thrown it will return the cookie's original value. If you provide your own encode/decode + * scheme you must ensure errors are appropriately handled. + * + * @default decode + */ + decode?: (str: string) => string | undefined; +} +/** + * Cookies object. + */ +export type Cookies = Record; +/** + * Parse a `Cookie` header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + */ +export declare function parseCookie(str: string, options?: ParseOptions): Cookies; +export interface StringifyOptions { + /** + * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). + * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode + * a value into a string suited for a cookie's value, and should mirror `decode` when parsing. + * + * @default encodeURIComponent + */ + encode?: (str: string) => string; +} +/** + * Stringifies an object into an HTTP `Cookie` header. + */ +export declare function stringifyCookie(cookie: Cookies, options?: StringifyOptions): string; +/** + * Set-Cookie object. + */ +export interface SetCookie { + /** + * Specifies the name of the cookie. + */ + name: string; + /** + * Specifies the string to be the value for the cookie. + */ + value: string | undefined; + /** + * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). + * + * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and + * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, + * so if both are set, they should point to the same date and time. + */ + maxAge?: number; + /** + * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1). + * When no expiration is set, clients consider this a "non-persistent cookie" and delete it when the current session is over. + * + * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and + * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, + * so if both are set, they should point to the same date and time. + */ + expires?: Date; + /** + * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3). + * When no domain is set, clients consider the cookie to apply to the current domain only. + */ + domain?: string; + /** + * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). + * When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4). + */ + path?: string; + /** + * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6). + * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`. + */ + httpOnly?: boolean; + /** + * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). + * When enabled, clients will only send the cookie back if the browser has an HTTPS connection. + */ + secure?: boolean; + /** + * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/). + * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches. + * + * This is an attribute that has not yet been fully standardized, and may change in the future. + * This also means clients may ignore this attribute until they understand it. More information + * about can be found in [the proposal](https://github.com/privacycg/CHIPS). + */ + partitioned?: boolean; + /** + * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + * + * - `'low'` will set the `Priority` attribute to `Low`. + * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + * - `'high'` will set the `Priority` attribute to `High`. + * + * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + */ + priority?: "low" | "medium" | "high"; + /** + * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + * + * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + * + * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + */ + sameSite?: boolean | "lax" | "strict" | "none"; +} +/** + * Backward compatibility serialize options. + */ +export type SerializeOptions = StringifyOptions & Omit; +/** + * Serialize data into a cookie header. + * + * Serialize a name value pair into a cookie string suitable for + * http headers. An optional options object specifies cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + */ +export declare function stringifySetCookie(cookie: SetCookie, options?: StringifyOptions): string; +export declare function stringifySetCookie(name: string, val: string, options?: SerializeOptions): string; +/** + * Deserialize a `Set-Cookie` header into an object. + * + * deserialize('foo=bar; httpOnly') + * => { name: 'foo', value: 'bar', httpOnly: true } + */ +export declare function parseSetCookie(str: string, options?: ParseOptions): SetCookie; +/** + * Backward compatibility exports. + */ +export { stringifySetCookie as serialize, parseCookie as parse }; diff --git a/node_modules/cookie/dist/index.js b/node_modules/cookie/dist/index.js new file mode 100644 index 0000000..d83d190 --- /dev/null +++ b/node_modules/cookie/dist/index.js @@ -0,0 +1,350 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCookie = parseCookie; +exports.parse = parseCookie; +exports.stringifyCookie = stringifyCookie; +exports.stringifySetCookie = stringifySetCookie; +exports.serialize = stringifySetCookie; +exports.parseSetCookie = parseSetCookie; +exports.stringifySetCookie = stringifySetCookie; +exports.serialize = stringifySetCookie; +/** + * RegExp to match cookie-name in RFC 6265 sec 4.1.1 + * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2 + * which has been replaced by the token definition in RFC 7230 appendix B. + * + * cookie-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / + * "*" / "+" / "-" / "." / "^" / "_" / + * "`" / "|" / "~" / DIGIT / ALPHA + * + * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191 + * Allow same range as cookie value, except `=`, which delimits end of name. + */ +const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/; +/** + * RegExp to match cookie-value in RFC 6265 sec 4.1.1 + * + * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) + * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + * ; US-ASCII characters excluding CTLs, + * ; whitespace DQUOTE, comma, semicolon, + * ; and backslash + * + * Allowing more characters: https://github.com/jshttp/cookie/issues/191 + * Comma, backslash, and DQUOTE are not part of the parsing algorithm. + */ +const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/; +/** + * RegExp to match domain-value in RFC 6265 sec 4.1.1 + * + * domain-value = + * ; defined in [RFC1034], Section 3.5, as + * ; enhanced by [RFC1123], Section 2.1 + * =