Skip to content

Commit d1324a4

Browse files
authored
docs(readme): add docs for API removal features (#63)
1 parent 2bf49f2 commit d1324a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ hono serve \
244244

245245
Generate an optimized Hono class and export bundled file.
246246

247+
This command automatically applies the following optimizations to reduce bundle size:
248+
249+
- **Request body API removal**: Removes request body APIs (`c.req.json()`, `c.req.formData()`, etc.) when your application only uses GET, HEAD, or OPTIONS methods
250+
- **Context response API removal**: Removes unused response utility APIs (`c.body()`, `c.json()`, `c.text()`, `c.html()`, `c.redirect()`) from Context object
251+
- **Hono API removal**: Removes unused Hono methods (`route`, `mount`, `fire`) that are only used during application initialization
252+
247253
```bash
248254
hono optimize [entry] [options]
249255
```
@@ -257,6 +263,9 @@ hono optimize [entry] [options]
257263
- `-o, --outfile <outfile>` - Output file
258264
- `-m, --minify` - minify output file
259265
- `-t, --target [target]` - environment target
266+
- `--no-request-body-api-removal` - Disable request body API removal optimization
267+
- `--no-context-response-api-removal` - Disable response utility API removal from Context object
268+
- `--no-hono-api-removal` - Disable Hono API removal optimization
260269

261270
**Examples:**
262271

@@ -272,6 +281,11 @@ hono optimize -m
272281

273282
# Specify environment target
274283
hono optimize -t es2024
284+
285+
# Disable specific optimizations
286+
hono optimize -m --no-request-body-api-removal
287+
hono optimize -m --no-context-response-api-removal
288+
hono optimize -m --no-hono-api-removal
275289
```
276290

277291
## Tips

0 commit comments

Comments
 (0)