@wyrly/hono 1.0.0 → 1.0.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.
- package/esm/hono/middleware.d.ts.map +1 -1
- package/esm/hono/middleware.js +2 -1
- package/esm/hono/mod.d.ts +1 -1
- package/esm/hono/mod.d.ts.map +1 -1
- package/esm/hono/mod.js +1 -1
- package/esm/hono/types.d.ts +9 -6
- package/esm/hono/types.d.ts.map +1 -1
- package/esm/hono/types.js +6 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/hono/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/hono/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD;;;;;;GAMG;AACH,wBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CAY1D"}
|
package/esm/hono/middleware.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HonoContextToken, RequestToken } from "./tokens.js";
|
|
2
|
+
import { diVariableKey } from "./types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a DI scope per request and attaches it via `c.set("di", scope)`.
|
|
4
5
|
* Disposes the scope after `await next()` (including on handler error, via `finally`).
|
|
@@ -11,7 +12,7 @@ export function di(container) {
|
|
|
11
12
|
const scope = container.createScope();
|
|
12
13
|
scope.set(HonoContextToken, c);
|
|
13
14
|
scope.set(RequestToken, c.req.raw);
|
|
14
|
-
c.set(
|
|
15
|
+
c.set(diVariableKey, scope);
|
|
15
16
|
try {
|
|
16
17
|
await next();
|
|
17
18
|
}
|
package/esm/hono/mod.d.ts
CHANGED
package/esm/hono/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/hono/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/hono/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/esm/hono/mod.js
CHANGED
package/esm/hono/types.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
1
2
|
import type { Scope } from "../core/mod.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
/** Context variable key used by `di()` middleware. */
|
|
4
|
+
export declare const diVariableKey: "di";
|
|
5
|
+
/** Pass to `new Hono<{ Variables: HonoDIVariables }>()` for typed `getDI(c)`. */
|
|
6
|
+
export type HonoDIVariables = {
|
|
7
|
+
[diVariableKey]: Scope;
|
|
8
|
+
};
|
|
9
|
+
/** Read the request DI scope set by `di()` (use when `Variables` is not generic). */
|
|
10
|
+
export declare function getDI(c: Context): Scope;
|
|
8
11
|
//# sourceMappingURL=types.d.ts.map
|
package/esm/hono/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hono/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hono/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,sDAAsD;AACtD,eAAO,MAAM,aAAa,EAAG,IAAa,CAAC;AAE3C,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAEvC"}
|
package/esm/hono/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyrly/hono",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Wyrly DI adapter for Hono",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
8
|
-
"directory": "
|
|
7
|
+
"url": "git+https://github.com/valid-lab/wyrly.git",
|
|
8
|
+
"directory": "packages/hono"
|
|
9
9
|
},
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"module": "./esm/hono/mod.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"hono": "4",
|
|
21
21
|
"@deno/shim-deno": "~0.18.0",
|
|
22
|
-
"@wyrly/core": "^1.0.
|
|
22
|
+
"@wyrly/core": "^1.0.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"hono": "^4.0.0"
|