Skip to content

Commit f06b4f8

Browse files
committed
Build static docs site
1 parent dca0502 commit f06b4f8

112 files changed

Lines changed: 12936 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/data/Cookie.html

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta content="Use cookie when you need a small dependency-free parser and serializer for request cookies and response Set-Cookie values." name="description">
6+
<meta content="width=device-width, initial-scale=1" name="viewport">
7+
<meta content="cookie | @stackpress/lib" property="og:title">
8+
<meta content="Use cookie when you need a small dependency-free parser and serializer for request cookies and response Set-Cookie values." property="og:description">
9+
<meta content="website" property="og:type">
10+
<meta content="summary" name="twitter:card">
11+
<title>cookie | @stackpress/lib</title>
12+
<link href="../../assets/styles/site.css" rel="stylesheet">
13+
</head>
14+
<body>
15+
<div class="site-shell">
16+
<aside aria-label="Site navigation" class="sidebar">
17+
<a class="brand" href="../../index.html" title="@stackpress/lib">
18+
<span class="brand-mark" aria-hidden="true"></span>
19+
<span><strong>@stackpress/lib</strong><span>API reference hub</span></span>
20+
</a>
21+
<section class="sidebar-section">
22+
<h2>Pages</h2>
23+
<ul class="nav-list">
24+
<li><a class="" href="../../index.html" title="Reference Hub">Reference Hub</a></li>
25+
<li><a class="" href="../../events.html" title="Events">Events</a></li><li><a class="" href="../../system.html" title="System">System</a></li><li><a class="" href="../../data.html" title="Data">Data</a></li><li><a class="" href="../../routing.html" title="Routing">Routing</a></li><li><a class="" href="../../queue.html" title="Queue">Queue</a></li><li><a class="" href="../../runtime.html" title="Runtime">Runtime</a></li><li><a class="" href="../../types.html" title="Types">Types</a></li>
26+
</ul>
27+
</section>
28+
29+
</aside>
30+
<main class="content">
31+
<header class="topbar">
32+
<a class="topbar-brand" href="../../index.html" title="@stackpress/lib">
33+
<span class="brand-mark" aria-hidden="true"></span>
34+
<span><strong>@stackpress/lib</strong><span>Docs</span></span>
35+
</a>
36+
<nav aria-label="Top actions" class="top-actions">
37+
<button aria-pressed="false" class="theme-toggle" type="button">Dark</button>
38+
<a class="button" href="https://github.com/stackpress/lib" title="GitHub">GitHub</a>
39+
<a class="button" href="https://www.npmjs.com/package/@stackpress/lib" title="npm">npm</a>
40+
</nav>
41+
<button aria-controls="mobile-nav" aria-expanded="false" aria-label="Menu" class="mobile-menu" type="button">
42+
<span aria-hidden="true"></span>
43+
<span aria-hidden="true"></span>
44+
<span aria-hidden="true"></span>
45+
</button>
46+
</header>
47+
<nav aria-label="Mobile pages" class="mobile-nav" id="mobile-nav">
48+
<a class="button" href="../../index.html" title="Hub">Hub</a>
49+
<a class="button" href="../../events.html" title="Events">Events</a>
50+
<a class="button" href="../../system.html" title="System">System</a>
51+
<a class="button" href="../../data.html" title="Data">Data</a>
52+
<a class="button" href="../../routing.html" title="Routing">Routing</a>
53+
<a class="button" href="../../queue.html" title="Queue">Queue</a>
54+
<a class="button" href="../../runtime.html" title="Runtime">Runtime</a>
55+
<a class="button" href="../../types.html" title="Types">Types</a>
56+
57+
</nav>
58+
<div class="article-layout"><article class="page article-main">
59+
<div class="page-inner">
60+
<p class="eyebrow">API reference</p>
61+
<h1>cookie</h1>
62+
<p class="lede">Use cookie when you need a small dependency-free parser and serializer for request cookies and response Set-Cookie values.</p>
63+
<div class="article-card markdown-body">
64+
<h1 id="cookie">cookie</h1>
65+
66+
<p>Cookie parse and serialize helpers with the same API shape as the default export and named functions.</p>
67+
68+
<h2 id="import">Import</h2>
69+
70+
<pre class="code-block"><code class="language-ts">import { cookie } from '@stackpress/lib';
71+
72+
const { parse, serialize } = cookie;</code></pre>
73+
74+
<p>If you prefer named access inside your own wrapper, read the methods from the default export. The package does not expose <code>parse</code>
75+
and <code>serialize</code>
76+
as separate root-level named exports.</p>
77+
78+
<h2 id="when-to-use-it">When To Use It</h2>
79+
80+
<p>Use <code>cookie</code>
81+
when you need a small dependency-free parser and serializer for request cookies and response <code>Set-Cookie</code>
82+
values.</p>
83+
84+
<h2 id="api">API</h2>
85+
86+
<h3 id="parse-serial-options"><code>parse(serial, options?)</code>
87+
</h3>
88+
89+
<p>Parses a request cookie header into <code>Record&lt;string, string | undefined&gt;</code>
90+
.</p>
91+
92+
<pre class="code-block"><code class="language-ts">const session = cookie.parse('sessionId=abc123; user=ada');</code></pre>
93+
94+
<p>The optional <code>decode</code>
95+
function in <code>CookieParseOptions</code>
96+
overrides value decoding.</p>
97+
98+
<h3 id="serialize-name-value-options"><code>serialize(name, value, options?)</code>
99+
</h3>
100+
101+
<p>Builds one <code>Set-Cookie</code>
102+
value.</p>
103+
104+
<pre class="code-block"><code class="language-ts">const header = cookie.serialize('sessionId', 'abc123', {
105+
httpOnly: true,
106+
sameSite: 'strict',
107+
path: '/'
108+
});</code></pre>
109+
110+
<p>Supported options come from <code>CookieSerializeOptions</code>
111+
and include:</p>
112+
113+
<ul>
114+
<li><code>domain</code>
115+
</li><li><code>encode</code>
116+
</li><li><code>expires</code>
117+
</li><li><code>httpOnly</code>
118+
</li><li><code>maxAge</code>
119+
</li><li><code>partitioned</code>
120+
</li><li><code>path</code>
121+
</li><li><code>priority</code>
122+
</li><li><code>sameSite</code>
123+
</li><li><code>secure</code>
124+
</li>
125+
</ul>
126+
127+
<h2 id="example">Example</h2>
128+
129+
<pre class="code-block"><code class="language-ts">import { cookie } from '@stackpress/lib';
130+
131+
const cookies = cookie.parse('theme=dark; sessionId=abc123');
132+
133+
const setCookie = cookie.serialize('theme', 'light', {
134+
path: '/',
135+
maxAge: 3600
136+
});</code></pre>
137+
138+
<h2 id="related">Related</h2>
139+
140+
<ul>
141+
<li><a href="../router/Session.html" title="Session">Session</a>
142+
</li><li><a href="../types/index.html" title="Types">Types</a>
143+
</li>
144+
</ul>
145+
146+
</div>
147+
<nav aria-label="Pagination" class="pager">
148+
<a href="../system/NodeFS.html" title="NodeFS">Previous: NodeFS</a>
149+
<a href="./Map.html" title="Map">Next: Map</a>
150+
</nav>
151+
</div>
152+
</article>
153+
<aside class="article-toc">
154+
<strong>On this page</strong>
155+
<a href="#import" title="Import">Import</a><a href="#when-to-use-it" title="When To Use It">When To Use It</a><a href="#api" title="API">API</a><a href="#parse-serial-options" title="parse(serial, options?)">parse(serial, options?)</a><a href="#serialize-name-value-options" title="serialize(name, value, options?)">serialize(name, value, options?)</a><a href="#example" title="Example">Example</a><a href="#related" title="Related">Related</a>
156+
</aside>
157+
</div>
158+
</main>
159+
</div>
160+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
161+
<script src="../../assets/scripts/site.js"></script>
162+
</body>
163+
</html>

0 commit comments

Comments
 (0)