@wnodex/cookie-parser 0.2.1 → 0.2.2

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.
@@ -1,7 +1,7 @@
1
1
 
2
- > @wnodex/cookie-parser@0.2.1 build /home/runner/work/wnodex/wnodex/packages/cookie-parser
2
+ > @wnodex/cookie-parser@0.2.2 build /home/runner/work/wnodex/wnodex/packages/cookie-parser
3
3
  > rolldown -c && tsc
4
4
 
5
5
  [log] <DIR>/index.js chunk │ size: 1.11 kB
6
6
  [log]
7
- [success] rolldown v1.0.0-rc.1 Finished in 44.25 ms
7
+ [success] rolldown v1.0.0-rc.1 Finished in 30.68 ms
package/README.md CHANGED
@@ -1,14 +1,75 @@
1
1
  # @wnodex/cookie-parser
2
2
 
3
- wnodex cookie-parser middleware
3
+ > wnodex cookie-parser middleware
4
4
 
5
- ---
5
+ Part of the [wnodex](https://github.com/wnodex/wnodex) ecosystem, this package provides cookie-parser middleware for `wnodex`.
6
6
 
7
- ## Table of Content
7
+ ## About
8
8
 
9
- - [License](#license)
9
+ `@wnodex/cookie-parser` integrates the `cookie-parser` middleware into your `wnodex` application. It provides a simple way to parse `Cookie` header and populate `req.cookies` with an object keyed by the cookie names.
10
10
 
11
- ---
11
+ ## Features
12
+
13
+ - Seamless integration with the `wnodex` server.
14
+ - Parses cookies and supports signed cookies.
15
+ - Configurable via the main `wnodex` configuration object.
16
+ - Built on the standard `cookie-parser` library.
17
+
18
+ ## Why use it?
19
+
20
+ This package is the standard way to handle cookies within a `wnodex` application. It centralizes cookie parsing configuration, making it easy to manage alongside other server settings, especially when dealing with signed cookies for security.
21
+
22
+ ## Installation
23
+
24
+ You can install the package using your favorite package manager:
25
+
26
+ **pnpm**
27
+
28
+ ```bash
29
+ pnpm add @wnodex/cookie-parser
30
+ ```
31
+
32
+ **npm**
33
+
34
+ ```bash
35
+ npm install @wnodex/cookie-parser
36
+ ```
37
+
38
+ **yarn**
39
+
40
+ ```bash
41
+ yarn add @wnodex/cookie-parser
42
+ ```
43
+
44
+ **bun**
45
+
46
+ ```bash
47
+ bun add @wnodex/cookie-parser
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ `@wnodex/cookie-parser` is disabled by default. To enable it, provide a configuration object to the `cookieParser` property in the `Wnodex` constructor, or set it to `true`.
53
+
54
+ ```typescript
55
+ import { Wnodex } from 'wnodex';
56
+
57
+ // Example: Enable with a secret for signed cookies
58
+ const server = new Wnodex({
59
+ cookieParser: {
60
+ secret: 'your-secret-key',
61
+ },
62
+ });
63
+
64
+ // Example: Enable without a secret
65
+ const serverSimple = new Wnodex({
66
+ cookieParser: true,
67
+ });
68
+
69
+ server.start();
70
+ ```
71
+
72
+ The `secret` can be a string or an array of strings. You can also provide `options` that are passed directly to `cookie-parser`.
12
73
 
13
74
  ## License
14
75
 
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@wnodex/cookie-parser",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
- "description": "wnodex cookie-parser middleware",
5
+ "description": "A wnodex middleware that integrates cookie-parser to parse request cookies.",
6
6
  "keywords": [
7
7
  "wnodex",
8
- "cookie-parser"
8
+ "middleware",
9
+ "cookie-parser",
10
+ "express",
11
+ "cookie",
12
+ "parser"
9
13
  ],
10
14
  "homepage": "https://github.com/wnodex/wnodex#readme",
11
15
  "bugs": {
@@ -40,7 +44,7 @@
40
44
  "@types/node": "^25.0.10",
41
45
  "rolldown": "1.0.0-rc.1",
42
46
  "typescript": "5.9.2",
43
- "@wnodex/typescript-config": "0.2.1"
47
+ "@wnodex/typescript-config": "0.2.2"
44
48
  },
45
49
  "publishConfig": {
46
50
  "access": "public"