hoa 0.1.0 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
- v0.1.0 / 2025-09-25
1
+ ## v0.1.2 / 2025-10-09
2
2
 
3
- - init
3
+ - fix: change default status code from 200 to 404
4
+ - fix: add missing `silent` property to TypeScript declarations
5
+
6
+ ## v0.1.1 / 2025-10-08
7
+
8
+ - fix: console is removed due to tsup configuration errors
9
+ - chore(deps): update deps
10
+
11
+ ## v0.1.0 / 2025-09-25
12
+
13
+ - init
package/README.md CHANGED
@@ -1,4 +1,15 @@
1
- ## Hoa
1
+ <div align="center">
2
+ <a href="https://hoa-js.com">
3
+ <img src="https://raw.githubusercontent.com/hoa-js/hoa/master/logo.png" width="400" height="400" alt="Hoa"/>
4
+ </a>
5
+ </div>
6
+
7
+ [![NPM version](https://img.shields.io/npm/v/hoa)](https://npmjs.org/package/hoa)
8
+ [![Build status](https://img.shields.io/github/actions/workflow/status/hoa-js/hoa/ci.yml?branch=master)](https://github.com/hoa-js/hoa/actions)
9
+ [![Codecov](https://img.shields.io/codecov/c/github/hoa-js/hoa/master)](https://app.codecov.io/gh/hoa-js/hoa/tree/master)
10
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/hoa)](https://bundlephobia.com/result?p=hoa)
11
+ [![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/hoa-js/hoa/blob/master/package.json)
12
+ [![License](https://img.shields.io/github/license/hoa-js/hoa)](https://github.com/hoa-js/hoa/blob/master/LICENSE)
2
13
 
3
14
  Hoa is a minimal Web framework inspired by [Koa](https://github.com/koajs/koa) and [Hono](https://github.com/honojs/hono), built entirely on Web Standards. It runs seamlessly on any modern JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
4
15
 
@@ -152,6 +152,9 @@ class Application {
152
152
  if (err.status === 404 || err.expose) return;
153
153
  if (this.silent) return;
154
154
  const msg = err.stack || err.toString();
155
+ console.error(`
156
+ ${msg.replace(/^/gm, " ")}
157
+ `);
155
158
  }
156
159
  /**
157
160
  * ESM/CJS interop helper for default exports.
@@ -204,9 +207,6 @@ function respond(ctx) {
204
207
  res.delete("Transfer-Encoding");
205
208
  res.set("Content-Length", "0");
206
209
  }
207
- if (!res._explicitStatus) {
208
- res.status = 404;
209
- }
210
210
  return new Response(null, {
211
211
  status: res.status,
212
212
  statusText: res.statusText,
@@ -147,13 +147,13 @@ class HoaResponse {
147
147
  }
148
148
  /**
149
149
  * Get the response status code.
150
- * Defaults to 200 if not explicitly set.
150
+ * Defaults to 404 if not explicitly set.
151
151
  *
152
152
  * @returns {number} The HTTP status code
153
153
  * @public
154
154
  */
155
155
  get status() {
156
- return this._status || 200;
156
+ return this._status || 404;
157
157
  }
158
158
  /**
159
159
  * Set the response status code.
@@ -114,6 +114,9 @@ class Application {
114
114
  if (err.status === 404 || err.expose) return;
115
115
  if (this.silent) return;
116
116
  const msg = err.stack || err.toString();
117
+ console.error(`
118
+ ${msg.replace(/^/gm, " ")}
119
+ `);
117
120
  }
118
121
  /**
119
122
  * ESM/CJS interop helper for default exports.
@@ -166,9 +169,6 @@ function respond(ctx) {
166
169
  res.delete("Transfer-Encoding");
167
170
  res.set("Content-Length", "0");
168
171
  }
169
- if (!res._explicitStatus) {
170
- res.status = 404;
171
- }
172
172
  return new Response(null, {
173
173
  status: res.status,
174
174
  statusText: res.statusText,
@@ -125,13 +125,13 @@ class HoaResponse {
125
125
  }
126
126
  /**
127
127
  * Get the response status code.
128
- * Defaults to 200 if not explicitly set.
128
+ * Defaults to 404 if not explicitly set.
129
129
  *
130
130
  * @returns {number} The HTTP status code
131
131
  * @public
132
132
  */
133
133
  get status() {
134
- return this._status || 200;
134
+ return this._status || 404;
135
135
  }
136
136
  /**
137
137
  * Set the response status code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoa",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A minimal web framework built on Web Standards",
5
5
  "main": "./dist/cjs/application.js",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "CHANGELOG.md"
21
21
  ],
22
22
  "scripts": {
23
- "lint": "eslint",
23
+ "lint": "eslint .",
24
24
  "docs:dev": "vitepress dev",
25
25
  "docs:build": "vitepress build",
26
26
  "docs:preview": "vitepress preview",
@@ -51,10 +51,12 @@
51
51
  "lambda"
52
52
  ],
53
53
  "devDependencies": {
54
- "eslint": "9.36.0",
54
+ "@commitlint/cli": "20.1.0",
55
+ "@commitlint/config-conventional": "20.0.0",
56
+ "eslint": "9.37.0",
55
57
  "globals": "16.4.0",
56
58
  "husky": "9.1.7",
57
- "jest": "30.1.3",
59
+ "jest": "30.2.0",
58
60
  "neostandard": "0.12.2",
59
61
  "tsup": "8.5.0",
60
62
  "vitepress": "1.6.4"
package/types/index.d.ts CHANGED
@@ -194,6 +194,7 @@ export declare class Application {
194
194
  constructor(options?: ApplicationOptions);
195
195
 
196
196
  name: string;
197
+ silent?: boolean;
197
198
  readonly HoaContext: typeof HoaContext;
198
199
  readonly HoaRequest: typeof HoaRequest;
199
200
  readonly HoaResponse: typeof HoaResponse;