@stryke/cookie 0.1.14 → 0.1.22
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/CHANGELOG.md +172 -0
- package/README.md +33 -26
- package/dist/index.cjs +1 -49
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +1 -1
- package/dist/is-string-Cdq5ranA.mjs +2 -0
- package/dist/is-string-Cdq5ranA.mjs.map +1 -0
- package/dist/is-string-qyWqKQj-.cjs +1 -0
- package/dist/parse-CB7V9-FM.mjs +2 -0
- package/dist/parse-CB7V9-FM.mjs.map +1 -0
- package/dist/{parse.d.ts → parse-CC7RDu95.d.cts} +9 -3
- package/dist/parse-CC7RDu95.d.cts.map +1 -0
- package/dist/parse-DClQAhyZ.d.mts +23 -0
- package/dist/parse-DClQAhyZ.d.mts.map +1 -0
- package/dist/parse-Lu_9IylD.cjs +1 -0
- package/dist/parse.cjs +1 -90
- package/dist/parse.d.cts +2 -0
- package/dist/parse.d.mts +2 -0
- package/dist/parse.mjs +1 -1
- package/dist/split-BMQx0Ga2.d.mts +5 -0
- package/dist/split-BMQx0Ga2.d.mts.map +1 -0
- package/dist/split-DGuM3LaG.cjs +1 -0
- package/dist/split-DyNIhQJp.mjs +2 -0
- package/dist/split-DyNIhQJp.mjs.map +1 -0
- package/dist/split-Y8qgB1su.d.cts +5 -0
- package/dist/split-Y8qgB1su.d.cts.map +1 -0
- package/dist/split.cjs +1 -31
- package/dist/split.d.cts +2 -0
- package/dist/split.d.mts +2 -0
- package/dist/split.mjs +1 -1
- package/dist/src-Bw3xE0BI.mjs +2 -0
- package/dist/src-Bw3xE0BI.mjs.map +1 -0
- package/dist/src-C0Osv7A0.cjs +1 -0
- package/dist/stringify-BkjTv8_W.mjs +2 -0
- package/dist/stringify-BkjTv8_W.mjs.map +1 -0
- package/dist/stringify-DGdYwk9z.d.mts +16 -0
- package/dist/stringify-DGdYwk9z.d.mts.map +1 -0
- package/dist/stringify-f5GFtoll.cjs +1 -0
- package/dist/stringify-iqRz2xah.d.cts +16 -0
- package/dist/stringify-iqRz2xah.d.cts.map +1 -0
- package/dist/stringify.cjs +1 -78
- package/dist/stringify.d.cts +2 -0
- package/dist/stringify.d.mts +2 -0
- package/dist/stringify.mjs +1 -1
- package/dist/types-DfXe0PRY.d.mts +188 -0
- package/dist/types-DfXe0PRY.d.mts.map +1 -0
- package/dist/types-DmPnClfS.d.cts +188 -0
- package/dist/types-DmPnClfS.d.cts.map +1 -0
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +18 -106
- package/dist/index.d.ts +0 -4
- package/dist/split.d.ts +0 -1
- package/dist/stringify.d.ts +0 -10
- package/dist/types.d.ts +0 -184
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Changelog for Stryke - Cookie
|
|
4
|
+
|
|
5
|
+
## [0.1.21](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.21) (12/07/2025)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **type-checks** to **v0.5.5**
|
|
10
|
+
- Updated **convert** to **v0.6.20**
|
|
11
|
+
|
|
12
|
+
## [0.1.20](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.20) (12/07/2025)
|
|
13
|
+
|
|
14
|
+
### Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- Updated **type-checks** to **v0.5.4**
|
|
17
|
+
- Updated **convert** to **v0.6.19**
|
|
18
|
+
|
|
19
|
+
## [0.1.19](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.19) (12/07/2025)
|
|
20
|
+
|
|
21
|
+
### Miscellaneous
|
|
22
|
+
|
|
23
|
+
- **monorepo:** Format monorepo source files
|
|
24
|
+
([9428936](https://github.com/storm-software/stryke/commit/9428936))
|
|
25
|
+
|
|
26
|
+
### Updated Dependencies
|
|
27
|
+
|
|
28
|
+
- Updated **type-checks** to **v0.5.3**
|
|
29
|
+
- Updated **convert** to **v0.6.18**
|
|
30
|
+
|
|
31
|
+
## [0.1.18](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.18) (12/06/2025)
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
- **tools-nx:** Resolved issue inferring build command-line arguments for local
|
|
36
|
+
packages ([de00278](https://github.com/storm-software/stryke/commit/de00278))
|
|
37
|
+
|
|
38
|
+
### Updated Dependencies
|
|
39
|
+
|
|
40
|
+
- Updated **type-checks** to **v0.5.2**
|
|
41
|
+
- Updated **convert** to **v0.6.17**
|
|
42
|
+
|
|
43
|
+
## [0.1.17](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.17) (12/06/2025)
|
|
44
|
+
|
|
45
|
+
### Updated Dependencies
|
|
46
|
+
|
|
47
|
+
- Updated **type-checks** to **v0.5.1**
|
|
48
|
+
- Updated **convert** to **v0.6.16**
|
|
49
|
+
|
|
50
|
+
## [0.1.16](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.16) (12/05/2025)
|
|
51
|
+
|
|
52
|
+
### Updated Dependencies
|
|
53
|
+
|
|
54
|
+
- Updated **type-checks** to **v0.5.0**
|
|
55
|
+
- Updated **convert** to **v0.6.15**
|
|
56
|
+
|
|
57
|
+
## [0.1.15](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.15) (12/05/2025)
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
- **monorepo:** Update repository to use `tsdown` to build/bundle packages
|
|
62
|
+
([8ceb909](https://github.com/storm-software/stryke/commit/8ceb909))
|
|
63
|
+
|
|
64
|
+
### Updated Dependencies
|
|
65
|
+
|
|
66
|
+
- Updated **type-checks** to **v0.4.5**
|
|
67
|
+
- Updated **convert** to **v0.6.14**
|
|
68
|
+
|
|
69
|
+
## [0.1.14](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.14) (12/01/2025)
|
|
70
|
+
|
|
71
|
+
### Updated Dependencies
|
|
72
|
+
|
|
73
|
+
- Updated **type-checks** to **v0.4.4**
|
|
74
|
+
- Updated **convert** to **v0.6.13**
|
|
75
|
+
|
|
76
|
+
## [0.1.13](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.13) (11/30/2025)
|
|
77
|
+
|
|
78
|
+
### Updated Dependencies
|
|
79
|
+
|
|
80
|
+
- Updated **type-checks** to **v0.4.3**
|
|
81
|
+
- Updated **convert** to **v0.6.12**
|
|
82
|
+
|
|
83
|
+
## [0.1.12](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.12) (11/30/2025)
|
|
84
|
+
|
|
85
|
+
### Updated Dependencies
|
|
86
|
+
|
|
87
|
+
- Updated **type-checks** to **v0.4.2**
|
|
88
|
+
- Updated **convert** to **v0.6.11**
|
|
89
|
+
|
|
90
|
+
## [0.1.11](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.11) (11/30/2025)
|
|
91
|
+
|
|
92
|
+
### Updated Dependencies
|
|
93
|
+
|
|
94
|
+
- Updated **type-checks** to **v0.4.1**
|
|
95
|
+
- Updated **convert** to **v0.6.10**
|
|
96
|
+
|
|
97
|
+
## [0.1.10](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.10) (11/30/2025)
|
|
98
|
+
|
|
99
|
+
### Updated Dependencies
|
|
100
|
+
|
|
101
|
+
- Updated **type-checks** to **v0.4.0**
|
|
102
|
+
- Updated **convert** to **v0.6.9**
|
|
103
|
+
|
|
104
|
+
## [0.1.9](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.9) (11/24/2025)
|
|
105
|
+
|
|
106
|
+
### Updated Dependencies
|
|
107
|
+
|
|
108
|
+
- Updated **type-checks** to **v0.3.18**
|
|
109
|
+
- Updated **convert** to **v0.6.8**
|
|
110
|
+
|
|
111
|
+
## [0.1.8](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.8) (11/21/2025)
|
|
112
|
+
|
|
113
|
+
### Updated Dependencies
|
|
114
|
+
|
|
115
|
+
- Updated **type-checks** to **v0.3.17**
|
|
116
|
+
- Updated **convert** to **v0.6.7**
|
|
117
|
+
|
|
118
|
+
## [0.1.7](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.7) (11/21/2025)
|
|
119
|
+
|
|
120
|
+
### Updated Dependencies
|
|
121
|
+
|
|
122
|
+
- Updated **type-checks** to **v0.3.16**
|
|
123
|
+
- Updated **convert** to **v0.6.6**
|
|
124
|
+
|
|
125
|
+
## [0.1.6](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.6) (11/21/2025)
|
|
126
|
+
|
|
127
|
+
### Updated Dependencies
|
|
128
|
+
|
|
129
|
+
- Updated **type-checks** to **v0.3.15**
|
|
130
|
+
- Updated **convert** to **v0.6.5**
|
|
131
|
+
|
|
132
|
+
## [0.1.5](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.5) (11/21/2025)
|
|
133
|
+
|
|
134
|
+
### Updated Dependencies
|
|
135
|
+
|
|
136
|
+
- Updated **type-checks** to **v0.3.14**
|
|
137
|
+
- Updated **convert** to **v0.6.4**
|
|
138
|
+
|
|
139
|
+
## [0.1.4](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.4) (11/21/2025)
|
|
140
|
+
|
|
141
|
+
### Updated Dependencies
|
|
142
|
+
|
|
143
|
+
- Updated **type-checks** to **v0.3.13**
|
|
144
|
+
- Updated **convert** to **v0.6.3**
|
|
145
|
+
|
|
146
|
+
## [0.1.3](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.3) (11/16/2025)
|
|
147
|
+
|
|
148
|
+
### Updated Dependencies
|
|
149
|
+
|
|
150
|
+
- Updated **type-checks** to **v0.3.12**
|
|
151
|
+
- Updated **convert** to **v0.6.2**
|
|
152
|
+
|
|
153
|
+
## [0.1.2](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.2) (11/08/2025)
|
|
154
|
+
|
|
155
|
+
### Updated Dependencies
|
|
156
|
+
|
|
157
|
+
- Updated **type-checks** to **v0.3.11**
|
|
158
|
+
- Updated **convert** to **v0.6.1**
|
|
159
|
+
|
|
160
|
+
## [0.1.1](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.1) (2025-09-20)
|
|
161
|
+
|
|
162
|
+
### Miscellaneous
|
|
163
|
+
|
|
164
|
+
- **monorepo:** Update workspace package links
|
|
165
|
+
([6a19f93](https://github.com/storm-software/stryke/commit/6a19f93))
|
|
166
|
+
|
|
167
|
+
## [0.1.0](https://github.com/storm-software/stryke/releases/tag/cookie%400.1.0) (2025-09-16)
|
|
168
|
+
|
|
169
|
+
### Features
|
|
170
|
+
|
|
171
|
+
- **cookie:** Added the HTTP Cookie helpers package
|
|
172
|
+
([b8906e9](https://github.com/storm-software/stryke/commit/b8906e9))
|
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div align="center"
|
|
6
|
+
<div align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif">
|
|
9
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-light-optimized.gif">
|
|
10
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif" width="100%" alt="Storm Software" />
|
|
11
|
+
</picture>
|
|
12
|
+
</div>
|
|
7
13
|
<br />
|
|
8
14
|
|
|
9
15
|
<div align="center">
|
|
@@ -16,13 +22,13 @@
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
<br />
|
|
19
|
-
This package is part of Storm Software's
|
|
25
|
+
This package is part of Storm Software's **💥 Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
|
|
20
26
|
|
|
21
27
|
<br />
|
|
22
28
|
|
|
23
29
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
30
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
32
|
|
|
27
33
|
> [!IMPORTANT] Important
|
|
28
34
|
> This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
|
|
@@ -41,29 +47,27 @@ This package is part of Storm Software's **🌩️ Stryke** monorepo. Stryke pac
|
|
|
41
47
|
|
|
42
48
|
# Stryke - HTTP Cookie Helpers
|
|
43
49
|
|
|
44
|
-
A package that includes utility functions used to help with
|
|
45
|
-
|
|
50
|
+
A package that includes utility functions used to help with parsing and
|
|
51
|
+
serializing HTTP cookies.
|
|
46
52
|
|
|
47
53
|
<!-- START doctoc -->
|
|
48
54
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
49
55
|
|
|
50
56
|
## Table of Contents
|
|
51
57
|
|
|
52
|
-
- [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- [Contributing](#contributing)
|
|
66
|
-
- [Contributors](#contributors)
|
|
58
|
+
- [Installing](#installing)
|
|
59
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
60
|
+
- [Development](#development)
|
|
61
|
+
- [Building](#building)
|
|
62
|
+
- [Running unit tests](#running-unit-tests)
|
|
63
|
+
- [Linting](#linting)
|
|
64
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
65
|
+
- [Roadmap](#roadmap)
|
|
66
|
+
- [Support](#support)
|
|
67
|
+
- [License](#license)
|
|
68
|
+
- [Changelog](#changelog)
|
|
69
|
+
- [Contributing](#contributing)
|
|
70
|
+
- [Contributors](#contributors)
|
|
67
71
|
|
|
68
72
|
<!-- END doctoc -->
|
|
69
73
|
|
|
@@ -97,10 +101,10 @@ yarn add -D @stryke/http
|
|
|
97
101
|
|
|
98
102
|
## Reduced Package Size
|
|
99
103
|
|
|
100
|
-
This project uses [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
This project uses [tsdown](https://tsdown.dev) to package the source code due to
|
|
105
|
+
its ability to remove unused code and ship smaller javascript files thanks to
|
|
106
|
+
code splitting. This helps to greatly reduce the size of the package and to make
|
|
107
|
+
it easier to use in other projects.
|
|
104
108
|
|
|
105
109
|
## Development
|
|
106
110
|
|
|
@@ -241,10 +245,13 @@ specification. Contributions of any kind welcome!
|
|
|
241
245
|
<br />
|
|
242
246
|
|
|
243
247
|
<hr />
|
|
244
|
-
<br />
|
|
245
248
|
|
|
246
249
|
<div align="center">
|
|
247
|
-
<
|
|
250
|
+
<picture>
|
|
251
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
|
|
252
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
|
|
253
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
|
|
254
|
+
</picture>
|
|
248
255
|
</div>
|
|
249
256
|
<br />
|
|
250
257
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,49 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _parse = require("./parse.cjs");
|
|
7
|
-
Object.keys(_parse).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _parse[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _parse[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _split = require("./split.cjs");
|
|
18
|
-
Object.keys(_split).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _split[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _split[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _stringify = require("./stringify.cjs");
|
|
29
|
-
Object.keys(_stringify).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _stringify[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _stringify[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _types = require("./types.cjs");
|
|
40
|
-
Object.keys(_types).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _types[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
require(`./src-C0Osv7A0.cjs`);const e=require(`./parse-Lu_9IylD.cjs`),t=require(`./split-DGuM3LaG.cjs`),n=require(`./stringify-f5GFtoll.cjs`);require(`./types.cjs`),exports.parseCookie=e.t,exports.parseSetCookie=e.n,exports.splitSetCookieString=t.t,exports.stringifyCookie=n.t;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { i as SetCookieParseOptions, n as CookieSerializeOptions, r as SetCookie, t as CookieParseOptions } from "./types-DmPnClfS.cjs";
|
|
2
|
+
import { n as parseSetCookie, t as parseCookie } from "./parse-CC7RDu95.cjs";
|
|
3
|
+
import { t as splitSetCookieString } from "./split-Y8qgB1su.cjs";
|
|
4
|
+
import { t as stringifyCookie } from "./stringify-iqRz2xah.cjs";
|
|
5
|
+
export { CookieParseOptions, CookieSerializeOptions, SetCookie, SetCookieParseOptions, parseCookie, parseSetCookie, splitSetCookieString, stringifyCookie };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { i as SetCookieParseOptions, n as CookieSerializeOptions, r as SetCookie, t as CookieParseOptions } from "./types-DfXe0PRY.mjs";
|
|
2
|
+
import { n as parseSetCookie, t as parseCookie } from "./parse-DClQAhyZ.mjs";
|
|
3
|
+
import { t as splitSetCookieString } from "./split-BMQx0Ga2.mjs";
|
|
4
|
+
import { t as stringifyCookie } from "./stringify-DGdYwk9z.mjs";
|
|
5
|
+
export { CookieParseOptions, CookieSerializeOptions, SetCookie, SetCookieParseOptions, parseCookie, parseSetCookie, splitSetCookieString, stringifyCookie };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import"./src-Bw3xE0BI.mjs";import{n as e,t}from"./parse-CB7V9-FM.mjs";import{t as n}from"./split-DyNIhQJp.mjs";import{t as r}from"./stringify-BkjTv8_W.mjs";import"./types.mjs";export{t as parseCookie,e as parseSetCookie,n as splitSetCookieString,r as stringifyCookie};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-string-Cdq5ranA.mjs","names":[],"sources":["../../type-checks/src/is-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{try{return typeof e==`string`}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-string-Cdq5ranA.mjs";function t(t,n){if(!e(t))throw Error(`argument str must be a string`);let r={},i=n??{},a=i.decode??(e=>e.includes(`%`)?decodeURIComponent(e):e),o=0;for(;o<t.length;){let e=t.indexOf(`=`,o);if(e===-1)break;let n=t.indexOf(`;`,o);if(n===-1)n=t.length;else if(n<e){o=t.lastIndexOf(`;`,e-1)+1;continue}let s=t.slice(o,e).trim();if(i?.filter&&!i?.filter(s)){o=n+1;continue}if(r[s]===void 0){let i=t.slice(e+1,n).trim();i.codePointAt(0)===34&&(i=i.slice(1,-1));try{r[s]=a(i)}catch{r[s]=i}}o=n+1}return r}function n(t,n){let r=(t||``).split(`;`).filter(t=>e(t)&&!!t.trim()),i=r.shift()||``,a=``,o=``,s=i.split(`=`);s.length>1?(a=s.shift(),o=s.join(`=`)):o=i;try{o=n?.decode===!1?o:(n?.decode??decodeURIComponent)(o)}catch{}let c={name:a,value:o};for(let e of r){let t=e.split(`=`),n=(t.shift()||``).trimStart().toLowerCase(),r=t.join(`=`);switch(n){case`expires`:c.expires=new Date(r);break;case`max-age`:c.maxAge=Number.parseInt(r,10);break;case`secure`:c.secure=!0;break;case`httponly`:c.httpOnly=!0;break;case`samesite`:c.sameSite=r;break;default:c[n]=r}}return c}export{n,t};
|
|
2
|
+
//# sourceMappingURL=parse-CB7V9-FM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-CB7V9-FM.mjs","names":["cookie: SetCookie"],"sources":["../src/parse.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isString } from \"@stryke/type-checks\";\nimport type {\n CookieParseOptions,\n SetCookie,\n SetCookieParseOptions\n} from \"./types\";\n\n/**\n * Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.\n *\n * @param cookie - the string representing a `Cookie` header value\n * @param options - object containing parsing options\n * @returns an object with the parsed cookies\n */\nexport function parseCookie(\n cookie: string,\n options?: CookieParseOptions\n): Record<string, string> {\n if (!isString(cookie)) {\n throw new Error(\"argument str must be a string\");\n }\n\n const obj = {};\n const opt = options ?? {};\n const dec =\n opt.decode ??\n ((str: string) => (str.includes(\"%\") ? decodeURIComponent(str) : str));\n\n let index = 0;\n while (index < cookie.length) {\n const eqIdx = cookie.indexOf(\"=\", index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = cookie.indexOf(\";\", index);\n\n if (endIdx === -1) {\n endIdx = cookie.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = cookie.lastIndexOf(\";\", eqIdx - 1) + 1;\n\n continue;\n }\n\n const key = cookie.slice(index, eqIdx).trim();\n if (opt?.filter && !opt?.filter(key)) {\n index = endIdx + 1;\n\n continue;\n }\n\n // only assign once\n if (undefined === obj[key as keyof typeof obj]) {\n let val = cookie.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.codePointAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n (obj as any)[key] = dec(val);\n } catch {\n (obj as any)[key] = val;\n }\n }\n\n index = endIdx + 1;\n }\n\n return obj;\n}\n\n/**\n * Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.\n *\n * @param setCookieValue - the string representing a `Set-Cookie` header value\n * @param options - object containing parsing options\n * @returns an object with the parsed cookie\n */\nexport function parseSetCookie(\n setCookieValue: string,\n options?: SetCookieParseOptions\n): SetCookie {\n const parts = (setCookieValue || \"\")\n .split(\";\")\n .filter(str => isString(str) && Boolean(str.trim()));\n\n const nameValuePairStr = parts.shift() || \"\";\n\n let name = \"\";\n let value = \"\";\n const nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift()!;\n // Everything after the first =, joined by a \"=\" if there was more than one part\n value = nameValueArr.join(\"=\");\n } else {\n value = nameValuePairStr;\n }\n\n try {\n value =\n options?.decode === false\n ? value\n : (options?.decode ?? decodeURIComponent)(value);\n } catch {\n // Do nothing\n }\n\n const cookie: SetCookie = {\n name,\n value\n };\n\n for (const part of parts) {\n const sides = part.split(\"=\");\n const partKey = (sides.shift() || \"\").trimStart().toLowerCase();\n const partValue = sides.join(\"=\");\n switch (partKey) {\n case \"expires\": {\n cookie.expires = new Date(partValue);\n break;\n }\n case \"max-age\": {\n cookie.maxAge = Number.parseInt(partValue, 10);\n break;\n }\n case \"secure\": {\n cookie.secure = true;\n break;\n }\n case \"httponly\": {\n cookie.httpOnly = true;\n break;\n }\n case \"samesite\": {\n cookie.sameSite = partValue as SetCookie[\"sameSite\"];\n break;\n }\n default: {\n cookie[partKey] = partValue;\n }\n }\n }\n\n return cookie;\n}\n"],"mappings":"6CAgCA,SAAgB,EACd,EACA,EACwB,CACxB,GAAI,CAAC,EAAS,EAAO,CACnB,MAAU,MAAM,gCAAgC,CAGlD,IAAM,EAAM,EAAE,CACR,EAAM,GAAW,EAAE,CACnB,EACJ,EAAI,SACF,GAAiB,EAAI,SAAS,IAAI,CAAG,mBAAmB,EAAI,CAAG,GAE/D,EAAQ,EACZ,KAAO,EAAQ,EAAO,QAAQ,CAC5B,IAAM,EAAQ,EAAO,QAAQ,IAAK,EAAM,CAGxC,GAAI,IAAU,GACZ,MAGF,IAAI,EAAS,EAAO,QAAQ,IAAK,EAAM,CAEvC,GAAI,IAAW,GACb,EAAS,EAAO,eACP,EAAS,EAAO,CAEzB,EAAQ,EAAO,YAAY,IAAK,EAAQ,EAAE,CAAG,EAE7C,SAGF,IAAM,EAAM,EAAO,MAAM,EAAO,EAAM,CAAC,MAAM,CAC7C,GAAI,GAAK,QAAU,CAAC,GAAK,OAAO,EAAI,CAAE,CACpC,EAAQ,EAAS,EAEjB,SAIF,GAAkB,EAAI,KAAlB,IAAA,GAA4C,CAC9C,IAAI,EAAM,EAAO,MAAM,EAAQ,EAAG,EAAO,CAAC,MAAM,CAG5C,EAAI,YAAY,EAAE,GAAK,KACzB,EAAM,EAAI,MAAM,EAAG,GAAG,EAGxB,GAAI,CACD,EAAY,GAAO,EAAI,EAAI,MACtB,CACL,EAAY,GAAO,GAIxB,EAAQ,EAAS,EAGnB,OAAO,EAUT,SAAgB,EACd,EACA,EACW,CACX,IAAM,GAAS,GAAkB,IAC9B,MAAM,IAAI,CACV,OAAO,GAAO,EAAS,EAAI,EAAI,EAAQ,EAAI,MAAM,CAAE,CAEhD,EAAmB,EAAM,OAAO,EAAI,GAEtC,EAAO,GACP,EAAQ,GACN,EAAe,EAAiB,MAAM,IAAI,CAC5C,EAAa,OAAS,GACxB,EAAO,EAAa,OAAO,CAE3B,EAAQ,EAAa,KAAK,IAAI,EAE9B,EAAQ,EAGV,GAAI,CACF,EACE,GAAS,SAAW,GAChB,GACC,GAAS,QAAU,oBAAoB,EAAM,MAC9C,EAIR,IAAMA,EAAoB,CACxB,OACA,QACD,CAED,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAQ,EAAK,MAAM,IAAI,CACvB,GAAW,EAAM,OAAO,EAAI,IAAI,WAAW,CAAC,aAAa,CACzD,EAAY,EAAM,KAAK,IAAI,CACjC,OAAQ,EAAR,CACE,IAAK,UACH,EAAO,QAAU,IAAI,KAAK,EAAU,CACpC,MAEF,IAAK,UACH,EAAO,OAAS,OAAO,SAAS,EAAW,GAAG,CAC9C,MAEF,IAAK,SACH,EAAO,OAAS,GAChB,MAEF,IAAK,WACH,EAAO,SAAW,GAClB,MAEF,IAAK,WACH,EAAO,SAAW,EAClB,MAEF,QACE,EAAO,GAAW,GAKxB,OAAO"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { i as SetCookieParseOptions, r as SetCookie, t as CookieParseOptions } from "./types-DmPnClfS.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/parse.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.
|
|
4
7
|
*
|
|
@@ -6,7 +9,7 @@ import type { CookieParseOptions, SetCookie, SetCookieParseOptions } from "./typ
|
|
|
6
9
|
* @param options - object containing parsing options
|
|
7
10
|
* @returns an object with the parsed cookies
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
declare function parseCookie(cookie: string, options?: CookieParseOptions): Record<string, string>;
|
|
10
13
|
/**
|
|
11
14
|
* Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.
|
|
12
15
|
*
|
|
@@ -14,4 +17,7 @@ export declare function parseCookie(cookie: string, options?: CookieParseOptions
|
|
|
14
17
|
* @param options - object containing parsing options
|
|
15
18
|
* @returns an object with the parsed cookie
|
|
16
19
|
*/
|
|
17
|
-
|
|
20
|
+
declare function parseSetCookie(setCookieValue: string, options?: SetCookieParseOptions): SetCookie;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { parseSetCookie as n, parseCookie as t };
|
|
23
|
+
//# sourceMappingURL=parse-CC7RDu95.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-CC7RDu95.d.cts","names":[],"sources":["../src/parse.ts"],"sourcesContent":[],"mappings":";;;;;;AAgCA;AAsEA;;;;iBAtEgB,WAAA,2BAEJ,qBACT;;;;;;;;iBAmEa,cAAA,mCAEJ,wBACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { i as SetCookieParseOptions, r as SetCookie, t as CookieParseOptions } from "./types-DfXe0PRY.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/parse.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.
|
|
7
|
+
*
|
|
8
|
+
* @param cookie - the string representing a `Cookie` header value
|
|
9
|
+
* @param options - object containing parsing options
|
|
10
|
+
* @returns an object with the parsed cookies
|
|
11
|
+
*/
|
|
12
|
+
declare function parseCookie(cookie: string, options?: CookieParseOptions): Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.
|
|
15
|
+
*
|
|
16
|
+
* @param setCookieValue - the string representing a `Set-Cookie` header value
|
|
17
|
+
* @param options - object containing parsing options
|
|
18
|
+
* @returns an object with the parsed cookie
|
|
19
|
+
*/
|
|
20
|
+
declare function parseSetCookie(setCookieValue: string, options?: SetCookieParseOptions): SetCookie;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { parseSetCookie as n, parseCookie as t };
|
|
23
|
+
//# sourceMappingURL=parse-DClQAhyZ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-DClQAhyZ.d.mts","names":[],"sources":["../src/parse.ts"],"sourcesContent":[],"mappings":";;;;;;AAgCA;AAsEA;;;;iBAtEgB,WAAA,2BAEJ,qBACT;;;;;;;;iBAmEa,cAAA,mCAEJ,wBACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-string-qyWqKQj-.cjs`);function t(t,n){if(!e.t(t))throw Error(`argument str must be a string`);let r={},i=n??{},a=i.decode??(e=>e.includes(`%`)?decodeURIComponent(e):e),o=0;for(;o<t.length;){let e=t.indexOf(`=`,o);if(e===-1)break;let n=t.indexOf(`;`,o);if(n===-1)n=t.length;else if(n<e){o=t.lastIndexOf(`;`,e-1)+1;continue}let s=t.slice(o,e).trim();if(i?.filter&&!i?.filter(s)){o=n+1;continue}if(r[s]===void 0){let i=t.slice(e+1,n).trim();i.codePointAt(0)===34&&(i=i.slice(1,-1));try{r[s]=a(i)}catch{r[s]=i}}o=n+1}return r}function n(t,n){let r=(t||``).split(`;`).filter(t=>e.t(t)&&!!t.trim()),i=r.shift()||``,a=``,o=``,s=i.split(`=`);s.length>1?(a=s.shift(),o=s.join(`=`)):o=i;try{o=n?.decode===!1?o:(n?.decode??decodeURIComponent)(o)}catch{}let c={name:a,value:o};for(let e of r){let t=e.split(`=`),n=(t.shift()||``).trimStart().toLowerCase(),r=t.join(`=`);switch(n){case`expires`:c.expires=new Date(r);break;case`max-age`:c.maxAge=Number.parseInt(r,10);break;case`secure`:c.secure=!0;break;case`httponly`:c.httpOnly=!0;break;case`samesite`:c.sameSite=r;break;default:c[n]=r}}return c}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
package/dist/parse.cjs
CHANGED
|
@@ -1,90 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parseCookie = parseCookie;
|
|
7
|
-
exports.parseSetCookie = parseSetCookie;
|
|
8
|
-
var _typeChecks = require("@stryke/type-checks");
|
|
9
|
-
function parseCookie(n, c) {
|
|
10
|
-
if (!(0, _typeChecks.isString)(n)) throw new Error("argument str must be a string");
|
|
11
|
-
const r = {},
|
|
12
|
-
a = c ?? {},
|
|
13
|
-
l = a.decode ?? (s => s.includes("%") ? decodeURIComponent(s) : s);
|
|
14
|
-
let e = 0;
|
|
15
|
-
for (; e < n.length;) {
|
|
16
|
-
const s = n.indexOf("=", e);
|
|
17
|
-
if (s === -1) break;
|
|
18
|
-
let t = n.indexOf(";", e);
|
|
19
|
-
if (t === -1) t = n.length;else if (t < s) {
|
|
20
|
-
e = n.lastIndexOf(";", s - 1) + 1;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const i = n.slice(e, s).trim();
|
|
24
|
-
if (a?.filter && !a?.filter(i)) {
|
|
25
|
-
e = t + 1;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (r[i] === void 0) {
|
|
29
|
-
let o = n.slice(s + 1, t).trim();
|
|
30
|
-
o.codePointAt(0) === 34 && (o = o.slice(1, -1));
|
|
31
|
-
try {
|
|
32
|
-
r[i] = l(o);
|
|
33
|
-
} catch {
|
|
34
|
-
r[i] = o;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
e = t + 1;
|
|
38
|
-
}
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
function parseSetCookie(n, c) {
|
|
42
|
-
const r = (n || "").split(";").filter(i => (0, _typeChecks.isString)(i) && !!i.trim()),
|
|
43
|
-
a = r.shift() || "";
|
|
44
|
-
let l = "",
|
|
45
|
-
e = "";
|
|
46
|
-
const s = a.split("=");
|
|
47
|
-
s.length > 1 ? (l = s.shift(), e = s.join("=")) : e = a;
|
|
48
|
-
try {
|
|
49
|
-
e = c?.decode === !1 ? e : (c?.decode ?? decodeURIComponent)(e);
|
|
50
|
-
} catch {}
|
|
51
|
-
const t = {
|
|
52
|
-
name: l,
|
|
53
|
-
value: e
|
|
54
|
-
};
|
|
55
|
-
for (const i of r) {
|
|
56
|
-
const o = i.split("="),
|
|
57
|
-
p = (o.shift() || "").trimStart().toLowerCase(),
|
|
58
|
-
f = o.join("=");
|
|
59
|
-
switch (p) {
|
|
60
|
-
case "expires":
|
|
61
|
-
{
|
|
62
|
-
t.expires = new Date(f);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case "max-age":
|
|
66
|
-
{
|
|
67
|
-
t.maxAge = Number.parseInt(f, 10);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case "secure":
|
|
71
|
-
{
|
|
72
|
-
t.secure = !0;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case "httponly":
|
|
76
|
-
{
|
|
77
|
-
t.httpOnly = !0;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case "samesite":
|
|
81
|
-
{
|
|
82
|
-
t.sameSite = f;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
default:
|
|
86
|
-
t[p] = f;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return t;
|
|
90
|
-
}
|
|
1
|
+
require(`./src-C0Osv7A0.cjs`);const e=require(`./parse-Lu_9IylD.cjs`);exports.parseCookie=e.t,exports.parseSetCookie=e.n;
|
package/dist/parse.d.cts
ADDED
package/dist/parse.d.mts
ADDED
package/dist/parse.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./src-Bw3xE0BI.mjs";import{n as e,t}from"./parse-CB7V9-FM.mjs";export{t as parseCookie,e as parseSetCookie};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-BMQx0Ga2.d.mts","names":[],"sources":["../src/split.ts"],"sourcesContent":[],"mappings":";iBAsCgB,oBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-string-qyWqKQj-.cjs`);function t(n){if(Array.isArray(n))return n.flatMap(e=>t(e));if(!e.t(n))return[];let r=[],i=0,a,o,s,c,l,u=()=>{for(;i<n.length&&/\s/.test(n.charAt(i));)i+=1;return i<n.length},d=()=>(o=n.charAt(i),o!==`=`&&o!==`;`&&o!==`,`);for(;i<n.length;){for(a=i,l=!1;u();)if(o=n.charAt(i),o===`,`){for(s=i,i+=1,u(),c=i;i<n.length&&d();)i+=1;i<n.length&&n.charAt(i)===`=`?(l=!0,i=c,r.push(n.slice(a,s)),a=i):i=s+1}else i+=1;(!l||i>=n.length)&&r.push(n.slice(a))}return r}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-string-Cdq5ranA.mjs";function t(n){if(Array.isArray(n))return n.flatMap(e=>t(e));if(!e(n))return[];let r=[],i=0,a,o,s,c,l,u=()=>{for(;i<n.length&&/\s/.test(n.charAt(i));)i+=1;return i<n.length},d=()=>(o=n.charAt(i),o!==`=`&&o!==`;`&&o!==`,`);for(;i<n.length;){for(a=i,l=!1;u();)if(o=n.charAt(i),o===`,`){for(s=i,i+=1,u(),c=i;i<n.length&&d();)i+=1;i<n.length&&n.charAt(i)===`=`?(l=!0,i=c,r.push(n.slice(a,s)),a=i):i=s+1}else i+=1;(!l||i>=n.length)&&r.push(n.slice(a))}return r}export{t};
|
|
2
|
+
//# sourceMappingURL=split-DyNIhQJp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-DyNIhQJp.mjs","names":["cookiesStrings: string[]","pos: number","start: number","ch: string","lastComma: number","nextStart: number","cookiesSeparatorFound: boolean"],"sources":["../src/split.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isString } from \"@stryke/type-checks/is-string\";\n\n/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport function splitSetCookieString(strCookie: string | string[]): string[] {\n if (Array.isArray(strCookie)) {\n return strCookie.flatMap(c => splitSetCookieString(c));\n }\n\n if (!isString(strCookie)) {\n return [];\n }\n\n const cookiesStrings: string[] = [];\n let pos: number = 0;\n let start: number;\n let ch: string;\n let lastComma: number;\n let nextStart: number;\n let cookiesSeparatorFound: boolean;\n\n const skipWhitespace = () => {\n while (pos < strCookie.length && /\\s/.test(strCookie.charAt(pos))) {\n pos += 1;\n }\n return pos < strCookie.length;\n };\n\n const notSpecialChar = () => {\n ch = strCookie.charAt(pos);\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n };\n\n while (pos < strCookie.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = strCookie.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < strCookie.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < strCookie.length && strCookie.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(strCookie.slice(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= strCookie.length) {\n cookiesStrings.push(strCookie.slice(start));\n }\n }\n\n return cookiesStrings;\n}\n"],"mappings":"6CAsCA,SAAgB,EAAqB,EAAwC,CAC3E,GAAI,MAAM,QAAQ,EAAU,CAC1B,OAAO,EAAU,QAAQ,GAAK,EAAqB,EAAE,CAAC,CAGxD,GAAI,CAAC,EAAS,EAAU,CACtB,MAAO,EAAE,CAGX,IAAMA,EAA2B,EAAE,CAC/BC,EAAc,EACdC,EACAC,EACAC,EACAC,EACAC,EAEE,MAAuB,CAC3B,KAAO,EAAM,EAAU,QAAU,KAAK,KAAK,EAAU,OAAO,EAAI,CAAC,EAC/D,GAAO,EAET,OAAO,EAAM,EAAU,QAGnB,OACJ,EAAK,EAAU,OAAO,EAAI,CACnB,IAAO,KAAO,IAAO,KAAO,IAAO,KAG5C,KAAO,EAAM,EAAU,QAAQ,CAI7B,IAHA,EAAQ,EACR,EAAwB,GAEjB,GAAgB,EAErB,GADA,EAAK,EAAU,OAAO,EAAI,CACtB,IAAO,IAAK,CAQd,IANA,EAAY,EACZ,GAAO,EAEP,GAAgB,CAChB,EAAY,EAEL,EAAM,EAAU,QAAU,GAAgB,EAC/C,GAAO,EAIL,EAAM,EAAU,QAAU,EAAU,OAAO,EAAI,GAAK,KAEtD,EAAwB,GAExB,EAAM,EACN,EAAe,KAAK,EAAU,MAAM,EAAO,EAAU,CAAC,CACtD,EAAQ,GAIR,EAAM,EAAY,OAGpB,GAAO,GAIP,CAAC,GAAyB,GAAO,EAAU,SAC7C,EAAe,KAAK,EAAU,MAAM,EAAM,CAAC,CAI/C,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-Y8qgB1su.d.cts","names":[],"sources":["../src/split.ts"],"sourcesContent":[],"mappings":";iBAsCgB,oBAAA"}
|
package/dist/split.cjs
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.splitSetCookieString = splitSetCookieString;
|
|
7
|
-
var _isString = require("@stryke/type-checks/is-string");
|
|
8
|
-
function splitSetCookieString(n) {
|
|
9
|
-
if (Array.isArray(n)) return n.flatMap(s => splitSetCookieString(s));
|
|
10
|
-
if (!(0, _isString.isString)(n)) return [];
|
|
11
|
-
const r = [];
|
|
12
|
-
let t = 0,
|
|
13
|
-
l,
|
|
14
|
-
e,
|
|
15
|
-
a,
|
|
16
|
-
i,
|
|
17
|
-
h;
|
|
18
|
-
const c = () => {
|
|
19
|
-
for (; t < n.length && /\s/.test(n.charAt(t));) t += 1;
|
|
20
|
-
return t < n.length;
|
|
21
|
-
},
|
|
22
|
-
g = () => (e = n.charAt(t), e !== "=" && e !== ";" && e !== ",");
|
|
23
|
-
for (; t < n.length;) {
|
|
24
|
-
for (l = t, h = !1; c();) if (e = n.charAt(t), e === ",") {
|
|
25
|
-
for (a = t, t += 1, c(), i = t; t < n.length && g();) t += 1;
|
|
26
|
-
t < n.length && n.charAt(t) === "=" ? (h = !0, t = i, r.push(n.slice(l, a)), l = t) : t = a + 1;
|
|
27
|
-
} else t += 1;
|
|
28
|
-
(!h || t >= n.length) && r.push(n.slice(l));
|
|
29
|
-
}
|
|
30
|
-
return r;
|
|
31
|
-
}
|
|
1
|
+
const e=require(`./split-DGuM3LaG.cjs`);exports.splitSetCookieString=e.t;
|
package/dist/split.d.cts
ADDED
package/dist/split.d.mts
ADDED