hono 3.11.8 → 3.11.9
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/dist/adapter/cloudflare-workers/serve-static.js +1 -1
- package/dist/{utils/cloudflare.js → adapter/cloudflare-workers/utils.js} +1 -1
- package/dist/cjs/adapter/cloudflare-workers/serve-static.js +2 -2
- package/dist/cjs/{utils/cloudflare.js → adapter/cloudflare-workers/utils.js} +3 -3
- package/dist/cjs/hono-base.js +8 -8
- package/dist/hono-base.js +8 -8
- package/dist/types/hono-base.d.ts +2 -2
- package/package.json +5 -8
- /package/dist/types/{utils/cloudflare.d.ts → adapter/cloudflare-workers/utils.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/adapter/cloudflare-workers/serve-static.ts
|
|
2
|
-
import { getContentFromKVAsset } from "../../utils/cloudflare.js";
|
|
3
2
|
import { getFilePath } from "../../utils/filepath.js";
|
|
4
3
|
import { getMimeType } from "../../utils/mime.js";
|
|
4
|
+
import { getContentFromKVAsset } from "./utils.js";
|
|
5
5
|
var DEFAULT_DOCUMENT = "index.html";
|
|
6
6
|
var serveStatic = (options = { root: "" }) => {
|
|
7
7
|
return async (c, next) => {
|
|
@@ -21,9 +21,9 @@ __export(serve_static_exports, {
|
|
|
21
21
|
serveStatic: () => serveStatic
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(serve_static_exports);
|
|
24
|
-
var import_cloudflare = require("../../utils/cloudflare");
|
|
25
24
|
var import_filepath = require("../../utils/filepath");
|
|
26
25
|
var import_mime = require("../../utils/mime");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
27
|
const DEFAULT_DOCUMENT = "index.html";
|
|
28
28
|
const serveStatic = (options = { root: "" }) => {
|
|
29
29
|
return async (c, next) => {
|
|
@@ -40,7 +40,7 @@ const serveStatic = (options = { root: "" }) => {
|
|
|
40
40
|
});
|
|
41
41
|
if (!path)
|
|
42
42
|
return await next();
|
|
43
|
-
const content = await (0,
|
|
43
|
+
const content = await (0, import_utils.getContentFromKVAsset)(path, {
|
|
44
44
|
manifest: options.manifest,
|
|
45
45
|
namespace: options.namespace ? options.namespace : c.env ? c.env.__STATIC_CONTENT : void 0
|
|
46
46
|
});
|
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
21
|
getContentFromKVAsset: () => getContentFromKVAsset
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
24
|
const getContentFromKVAsset = async (path, options) => {
|
|
25
25
|
let ASSET_MANIFEST = {};
|
|
26
26
|
if (options && options.manifest) {
|
package/dist/cjs/hono-base.js
CHANGED
|
@@ -69,6 +69,14 @@ const _Hono = class extends defineDynamicClass() {
|
|
|
69
69
|
this.routes = [];
|
|
70
70
|
this.notFoundHandler = notFoundHandler;
|
|
71
71
|
this.errorHandler = errorHandler;
|
|
72
|
+
this.onError = (handler) => {
|
|
73
|
+
this.errorHandler = handler;
|
|
74
|
+
return this;
|
|
75
|
+
};
|
|
76
|
+
this.notFound = (handler) => {
|
|
77
|
+
this.notFoundHandler = handler;
|
|
78
|
+
return this;
|
|
79
|
+
};
|
|
72
80
|
this.head = () => {
|
|
73
81
|
console.warn("`app.head()` is no longer used. `app.get()` implicitly handles the HEAD method.");
|
|
74
82
|
return this;
|
|
@@ -163,14 +171,6 @@ const _Hono = class extends defineDynamicClass() {
|
|
|
163
171
|
subApp._basePath = (0, import_url.mergePath)(this._basePath, path);
|
|
164
172
|
return subApp;
|
|
165
173
|
}
|
|
166
|
-
onError(handler) {
|
|
167
|
-
this.errorHandler = handler;
|
|
168
|
-
return this;
|
|
169
|
-
}
|
|
170
|
-
notFound(handler) {
|
|
171
|
-
this.notFoundHandler = handler;
|
|
172
|
-
return this;
|
|
173
|
-
}
|
|
174
174
|
showRoutes() {
|
|
175
175
|
const length = 8;
|
|
176
176
|
this.routes.map((route) => {
|
package/dist/hono-base.js
CHANGED
|
@@ -48,6 +48,14 @@ var _Hono = class extends defineDynamicClass() {
|
|
|
48
48
|
this.routes = [];
|
|
49
49
|
this.notFoundHandler = notFoundHandler;
|
|
50
50
|
this.errorHandler = errorHandler;
|
|
51
|
+
this.onError = (handler) => {
|
|
52
|
+
this.errorHandler = handler;
|
|
53
|
+
return this;
|
|
54
|
+
};
|
|
55
|
+
this.notFound = (handler) => {
|
|
56
|
+
this.notFoundHandler = handler;
|
|
57
|
+
return this;
|
|
58
|
+
};
|
|
51
59
|
this.head = () => {
|
|
52
60
|
console.warn("`app.head()` is no longer used. `app.get()` implicitly handles the HEAD method.");
|
|
53
61
|
return this;
|
|
@@ -142,14 +150,6 @@ var _Hono = class extends defineDynamicClass() {
|
|
|
142
150
|
subApp._basePath = mergePath(this._basePath, path);
|
|
143
151
|
return subApp;
|
|
144
152
|
}
|
|
145
|
-
onError(handler) {
|
|
146
|
-
this.errorHandler = handler;
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
notFound(handler) {
|
|
150
|
-
this.notFoundHandler = handler;
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
153
|
showRoutes() {
|
|
154
154
|
const length = 8;
|
|
155
155
|
this.routes.map((route) => {
|
|
@@ -35,8 +35,8 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
|
|
|
35
35
|
private errorHandler;
|
|
36
36
|
route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app?: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>;
|
|
37
37
|
basePath<SubPath extends string>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>>;
|
|
38
|
-
onError(handler: ErrorHandler<E>)
|
|
39
|
-
notFound(handler: NotFoundHandler<E>)
|
|
38
|
+
onError: (handler: ErrorHandler<E>) => this;
|
|
39
|
+
notFound: (handler: NotFoundHandler<E>) => this;
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated
|
|
42
42
|
* Use `showRoutes()` utility methods provided by 'hono/dev' instead of `app.showRoutes()`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.9",
|
|
4
4
|
"description": "Ultrafast web framework for the Edges",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"test": "tsc --noEmit && vitest --run",
|
|
14
14
|
"test:deno": "env NAME=Deno deno test --allow-read --allow-env runtime_tests/deno && deno test --no-lock -c runtime_tests/deno-jsx/deno.precompile.json runtime_tests/deno-jsx && deno test --no-lock -c runtime_tests/deno-jsx/deno.react-jsx.json runtime_tests/deno-jsx",
|
|
15
15
|
"test:bun": "env NAME=Bun bun test --jsx-import-source ../../src/jsx runtime_tests/bun/index.test.tsx",
|
|
16
|
-
"test:fastly": "
|
|
16
|
+
"test:fastly": "vitest --run --config ./runtime_tests/fastly/vitest.config.ts",
|
|
17
17
|
"test:lagon": "start-server-and-test \"lagon dev runtime_tests/lagon/index.ts -e runtime_tests/lagon/.env.lagon\" http://127.0.0.1:1234 \"yarn vitest --run runtime_tests/lagon/index.test.ts --config runtime_tests/lagon/vitest.config.ts\"",
|
|
18
18
|
"test:node": "env NAME=Node vitest --run --config ./runtime_tests/node/vitest.config.ts",
|
|
19
19
|
"test:wrangler": "vitest --run --config ./runtime_tests/wrangler/vitest.config.ts",
|
|
@@ -446,20 +446,17 @@
|
|
|
446
446
|
"@hono/node-server": "^1.3.3",
|
|
447
447
|
"@types/crypto-js": "^4.1.1",
|
|
448
448
|
"@types/glob": "^8.0.0",
|
|
449
|
-
"@types/jest": "^29.4.0",
|
|
450
449
|
"@types/jsdom": "^21.1.4",
|
|
451
450
|
"@types/node": "^20.8.2",
|
|
452
451
|
"@types/node-fetch": "^2.6.2",
|
|
453
452
|
"@types/supertest": "^2.0.12",
|
|
454
|
-
"@vitest/coverage-v8": "^0.
|
|
453
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
455
454
|
"arg": "^5.0.2",
|
|
456
455
|
"crypto-js": "^4.1.1",
|
|
457
456
|
"denoify": "^1.6.6",
|
|
458
457
|
"esbuild": "^0.15.12",
|
|
459
458
|
"eslint": "^8.55.0",
|
|
460
459
|
"form-data": "^4.0.0",
|
|
461
|
-
"jest": "^29.6.4",
|
|
462
|
-
"jest-preset-fastly-js-compute": "^1.3.0",
|
|
463
460
|
"jsdom": "^22.1.0",
|
|
464
461
|
"msw": "^1.0.0",
|
|
465
462
|
"node-fetch": "2",
|
|
@@ -469,10 +466,10 @@
|
|
|
469
466
|
"rimraf": "^3.0.2",
|
|
470
467
|
"start-server-and-test": "^1.15.2",
|
|
471
468
|
"supertest": "^6.3.3",
|
|
472
|
-
"ts-jest": "^29.1.1",
|
|
473
469
|
"tsx": "^3.11.0",
|
|
474
470
|
"typescript": "^5.3.3",
|
|
475
|
-
"
|
|
471
|
+
"vite-plugin-fastly-js-compute": "^0.4.2",
|
|
472
|
+
"vitest": "^1.0.4",
|
|
476
473
|
"wrangler": "3.17.1",
|
|
477
474
|
"zod": "^3.20.2"
|
|
478
475
|
},
|
|
File without changes
|