@philiprehberger/middleware-ts 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +16 -7
  2. package/package.json +45 -9
package/README.md CHANGED
@@ -1,21 +1,21 @@
1
- # @philiprehberger/middleware-ts
1
+ # @philiprehberger/ts-middleware
2
2
 
3
- [![CI](https://github.com/philiprehberger/middleware-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/philiprehberger/middleware-ts/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/@philiprehberger/middleware-ts.svg)](https://www.npmjs.com/package/@philiprehberger/middleware-ts)
5
- [![License](https://img.shields.io/github/license/philiprehberger/middleware-ts)](LICENSE)
3
+ [![CI](https://github.com/philiprehberger/ts-middleware/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/ts-middleware/actions/workflows/publish.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@philiprehberger/ts-middleware.svg)](https://www.npmjs.com/package/@philiprehberger/ts-middleware)
5
+ [![License](https://img.shields.io/github/license/philiprehberger/ts-middleware)](LICENSE)
6
6
 
7
7
  Framework-agnostic middleware composition engine.
8
8
 
9
9
  ## Installation
10
10
 
11
11
  ```bash
12
- npm install @philiprehberger/middleware-ts
12
+ npm install @philiprehberger/ts-middleware
13
13
  ```
14
14
 
15
15
  ## Usage
16
16
 
17
17
  ```ts
18
- import { compose, createPipeline } from '@philiprehberger/middleware-ts';
18
+ import { compose, createPipeline } from '@philiprehberger/ts-middleware';
19
19
 
20
20
  type Ctx = { req: Request; user?: User };
21
21
 
@@ -31,7 +31,7 @@ await app({ req: new Request('/api') });
31
31
  ### Conditional Branching
32
32
 
33
33
  ```ts
34
- import { branch } from '@philiprehberger/middleware-ts';
34
+ import { branch } from '@philiprehberger/ts-middleware';
35
35
 
36
36
  const authBranch = branch(
37
37
  (ctx) => ctx.req.url.startsWith('/api'),
@@ -49,6 +49,15 @@ const authBranch = branch(
49
49
  | `branch(condition, trueMw, falseMw?)` | Conditional middleware |
50
50
  | `withErrorHandler(mw, handler)` | Wrap with error catching |
51
51
 
52
+
53
+ ## Development
54
+
55
+ ```bash
56
+ npm install
57
+ npm run build
58
+ npm test
59
+ ```
60
+
52
61
  ## License
53
62
 
54
63
  MIT
package/package.json CHANGED
@@ -1,21 +1,57 @@
1
1
  {
2
2
  "name": "@philiprehberger/middleware-ts",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Framework-agnostic middleware composition engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
- "exports": { ".": { "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } } },
10
- "files": ["dist"],
11
- "scripts": { "build": "tsup", "dev": "tsup --watch", "typecheck": "tsc --noEmit", "prepublishOnly": "npm run build" },
12
- "devDependencies": { "tsup": "^8.0.0", "typescript": "^5.0.0" },
13
- "keywords": ["middleware", "compose", "pipeline", "chain", "handler", "context"],
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup",
26
+ "dev": "tsup --watch",
27
+ "typecheck": "tsc --noEmit",
28
+ "prepublishOnly": "npm run build",
29
+ "test": "node --test"
30
+ },
31
+ "devDependencies": {
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.0.0"
34
+ },
35
+ "keywords": [
36
+ "middleware",
37
+ "compose",
38
+ "pipeline",
39
+ "chain",
40
+ "handler",
41
+ "context"
42
+ ],
14
43
  "license": "MIT",
15
- "repository": { "type": "git", "url": "git+https://github.com/philiprehberger/ts-middleware.git" },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/philiprehberger/ts-middleware.git"
47
+ },
16
48
  "homepage": "https://github.com/philiprehberger/ts-middleware#readme",
17
- "bugs": { "url": "https://github.com/philiprehberger/ts-middleware/issues" },
49
+ "bugs": {
50
+ "url": "https://github.com/philiprehberger/ts-middleware/issues"
51
+ },
18
52
  "author": "Philip Rehberger",
19
- "engines": { "node": ">=18.0.0" },
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ },
20
56
  "sideEffects": false
21
57
  }