@rip-lang/api 0.8.1 → 1.0.0

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/README.md CHANGED
@@ -2,28 +2,30 @@
2
2
 
3
3
  # Rip API - @rip-lang/api
4
4
 
5
- > **Pure Rip API framework — elegant, fast, zero dependencies**
5
+ > **A fast, elegant API framework with zero dependencies written entirely in Rip**
6
6
 
7
- ## Overview
7
+ Rip API is a complete HTTP framework for building APIs with Bun. It provides
8
+ Sinatra-style routing, Koa-style middleware composition, 37 built-in validators,
9
+ and powerful session management — all in two files with no external dependencies.
10
+ It powers [@rip-lang/db](https://github.com/shreeve/rip-lang/tree/main/packages/db)
11
+ and is designed for APIs that are clear, concise, and correct.
8
12
 
9
- `@rip-lang/api` is a complete API framework written entirely in Rip. It provides Hono-compatible routing, middleware composition, and powerful validation — all with no external dependencies.
13
+ ## Features
10
14
 
11
- - **`api.rip`** (~595 lines) Core framework: routing, validation, `read()`, `session`, server
12
- - **`middleware.rip`** (~390 lines) Optional middleware: cors, logger, compress, sessions, etc.
15
+ - **Zero dependencies**Pure Rip implementation, no external frameworks
16
+ - **Sinatra-style handlers**Return data directly, no ceremony
17
+ - **Magic `@` access** — `@req`, `@json()`, `@session` like Sinatra
18
+ - **37 built-in validators** — Elegant `read()` function for parsing and validation
19
+ - **Lifecycle filters** — `raw` → `before` → handler → `after` hooks
20
+ - **AsyncLocalStorage context** — `read()` and `session` work anywhere, no prop drilling
21
+ - **Hono-compatible API** — Easy migration from existing Hono apps
13
22
 
14
- **Core Philosophy**: API development should be intuitive, safe, and beautiful. Every function eliminates boilerplate, prevents common errors, and makes your intent crystal clear.
23
+ | File | Lines | Role |
24
+ |------|-------|------|
25
+ | `api.rip` | ~590 | Core framework: routing, validation, `read()`, `session`, server |
26
+ | `middleware.rip` | ~465 | Built-in middleware: cors, logger, sessions, compression, security |
15
27
 
16
- ### Key Features
17
-
18
- - **Zero Dependencies** — Pure Rip implementation, no Hono or other frameworks
19
- - **Sinatra-Style Handlers** — Return data directly, no ceremony
20
- - **Magic `@` Access** — Use `@req`, `@json()`, `@session`, `@silent` like Sinatra
21
- - **Powerful Validation** — 37 built-in validators with elegant `read()` function
22
- - **Lifecycle Filters** — `raw` → `before` → handler → `after` hooks
23
- - **AsyncLocalStorage** — Safe, race-condition-free request context
24
- - **Hono-Compatible API** — Easy migration from existing Hono apps
25
-
26
- > **See Also**: For complete Rip language documentation, see the [main rip-lang repository](https://github.com/shreeve/rip-lang) and [docs/GUIDE.md](https://github.com/shreeve/rip-lang/blob/main/docs/GUIDE.md).
28
+ > **See Also**: For Rip language documentation, see the [main rip-lang repository](https://github.com/shreeve/rip-lang) and [docs/GUIDE.md](https://github.com/shreeve/rip-lang/blob/main/docs/GUIDE.md).
27
29
 
28
30
  ## Try it Now
29
31
 
@@ -806,7 +808,7 @@ start port: 3000
806
808
 
807
809
  ## Performance
808
810
 
809
- - **Minimal footprint** — Core is ~595 lines, optional middleware ~390 lines
811
+ - **Minimal footprint** — Core is ~590 lines, middleware ~465 lines
810
812
  - **Zero dependencies** — No external packages to load
811
813
  - **Compiled patterns** — Route regexes compiled once at startup
812
814
  - **Smart response wrapping** — Minimal overhead for return-value handlers
package/middleware.rip CHANGED
@@ -415,7 +415,7 @@ export prettyJson = (c, next) ->
415
415
  return _renderHtmlJson(data, status)
416
416
  originalJson(data, status, headers)
417
417
 
418
- next!()
418
+ next!
419
419
 
420
420
  _shouldRenderHtmlJson = (req) ->
421
421
  ua = req.headers.get('user-agent') or ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/api",
3
- "version": "0.8.1",
3
+ "version": "1.0.0",
4
4
  "description": "Pure Rip API framework — elegant, fast, zero dependencies",
5
5
  "type": "module",
6
6
  "main": "api.rip",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "scripts": {
12
12
  "build": "rip api.rip",
13
- "test": "echo \"Tests coming soon\" && exit 0"
13
+ "test": "rip tests/read.test.rip"
14
14
  },
15
15
  "keywords": [
16
16
  "api",
@@ -32,6 +32,9 @@
32
32
  },
33
33
  "author": "Steve Shreeve <steve.shreeve@gmail.com>",
34
34
  "license": "MIT",
35
+ "dependencies": {
36
+ "rip-lang": "^2.9.0"
37
+ },
35
38
  "files": [
36
39
  "api.rip",
37
40
  "middleware.rip",