@wyrly/hono 1.0.4 → 1.0.5

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 ADDED
@@ -0,0 +1,57 @@
1
+ # @wyrly/hono
2
+
3
+ Wyrly DI adapter for Hono — request scope via `di()` middleware and `getDI(c)`.
4
+
5
+ Japanese: [README.ja.md](./README.ja.md)
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @wyrly/hono @wyrly/core hono
11
+ ```
12
+
13
+ Peer dependency: **hono ^4.0.0**.
14
+
15
+ Tested on **Node.js**, **Bun**, and **Cloudflare Workers** (see monorepo `compat/`).
16
+
17
+ ## Requirements
18
+
19
+ - Everything required by [`@wyrly/core`](../core/README.md)
20
+ - **Hono 4.x**
21
+
22
+ ## Quick start
23
+
24
+ ```ts
25
+ import { Hono } from "hono";
26
+ import { di, getDI, type HonoDIVariables } from "@wyrly/hono";
27
+ import { createContainer } from "@wyrly/core";
28
+
29
+ const app = new Hono<{ Variables: HonoDIVariables }>();
30
+ app.use(di(createContainer()));
31
+
32
+ app.get("/users/:id", (c) => {
33
+ const scope = getDI(c);
34
+ return c.json({ disposed: scope.isDisposed() });
35
+ });
36
+ ```
37
+
38
+ ## Documentation
39
+
40
+ - [@wyrly/core](../core/README.md)
41
+ - [API reference](https://github.com/valid-lab/wyrly/blob/main/API.md)
42
+ - [Monorepo README](https://github.com/valid-lab/wyrly/blob/main/README.md)
43
+
44
+ ## Related packages
45
+
46
+ | Package | npm | Description |
47
+ | ---------------- | -------- | --------------- |
48
+ | `@wyrly/core` | yes | Core DI |
49
+ | `@wyrly/hono` | yes | This package |
50
+ | `@wyrly/express` | yes | Express adapter |
51
+ | `@wyrly/graphql` | yes | GraphQL adapter |
52
+ | `@wyrly/next` | yes | Next.js adapter |
53
+ | `@wyrly/fresh` | JSR only | Fresh 2.x |
54
+
55
+ ## License
56
+
57
+ Apache-2.0 — see [LICENSE](https://github.com/valid-lab/wyrly/blob/main/LICENSE).
@@ -1,6 +1,2 @@
1
- import { Deno } from "@deno/shim-deno";
2
- export { Deno } from "@deno/shim-deno";
3
- export declare const dntGlobalThis: Omit<typeof globalThis, "Deno"> & {
4
- Deno: typeof Deno;
5
- };
1
+ export declare const dntGlobalThis: Omit<typeof globalThis, never>;
6
2
  //# sourceMappingURL=_dnt.shims.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
1
+ {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
package/esm/_dnt.shims.js CHANGED
@@ -1,8 +1,4 @@
1
- import { Deno } from "@deno/shim-deno";
2
- export { Deno } from "@deno/shim-deno";
3
- const dntGlobals = {
4
- Deno,
5
- };
1
+ const dntGlobals = {};
6
2
  export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
7
3
  function createMergeProxy(baseObj, extObj) {
8
4
  return new Proxy(baseObj, {
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,MAAa,CAAC;AAE3C,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAC7B,uBAAuB,GACvB,6BAA6B,GAC7B,6BAA6B,GAC7B,qBAAqB,GACrB,iBAAiB,CAAC;AAEtB,gEAAgE;AAChE,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,oBAAoB,GACpB,eAA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ClC,2CAA2C,GAC3C,wBAAwB,CAAC;AAE7B,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD;AAqBD,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CA0BnE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,MAAM,GACb,MAAM,CAsBR;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,MAAM,GACb,MAAM,CA6CR;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED,gEAAgE;AAChE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI5D"}
package/esm/core/i18n.js CHANGED
@@ -11,7 +11,20 @@ export function normalizeLocaleTag(tag) {
11
11
  }
12
12
  function envGet(key) {
13
13
  try {
14
- return dntShim.Deno.env.get(key);
14
+ const proc = dntShim.dntGlobalThis
15
+ .process;
16
+ const fromProcess = proc?.env?.[key];
17
+ if (fromProcess !== undefined)
18
+ return fromProcess;
19
+ }
20
+ catch {
21
+ // ignore
22
+ }
23
+ try {
24
+ const runtime = dntShim.dntGlobalThis;
25
+ const env = runtime["Deno"]
26
+ ?.env;
27
+ return env?.get(key);
15
28
  }
16
29
  catch {
17
30
  return undefined;
package/package.json CHANGED
@@ -1,13 +1,30 @@
1
1
  {
2
2
  "name": "@wyrly/hono",
3
- "version": "1.0.4",
4
- "description": "Wyrly DI adapter for Hono",
3
+ "version": "1.0.5",
4
+ "description": "Wyrly DI adapter for Hono — request scope via di() middleware",
5
+ "keywords": [
6
+ "wyrly",
7
+ "dependency-injection",
8
+ "di",
9
+ "typescript",
10
+ "inversion-of-control",
11
+ "ioc",
12
+ "hono",
13
+ "middleware",
14
+ "bun",
15
+ "cloudflare-workers",
16
+ "edge"
17
+ ],
18
+ "homepage": "https://github.com/valid-lab/wyrly/tree/main/packages/hono",
5
19
  "repository": {
6
20
  "type": "git",
7
21
  "url": "git+https://github.com/valid-lab/wyrly.git",
8
22
  "directory": "packages/hono"
9
23
  },
10
24
  "license": "Apache-2.0",
25
+ "bugs": {
26
+ "url": "https://github.com/valid-lab/wyrly/issues"
27
+ },
11
28
  "module": "./esm/hono/mod.js",
12
29
  "exports": {
13
30
  ".": {
@@ -18,14 +35,10 @@
18
35
  "sideEffects": false,
19
36
  "dependencies": {
20
37
  "hono": "4",
21
- "@deno/shim-deno": "~0.18.0",
22
- "@wyrly/core": "^1.0.4"
38
+ "@wyrly/core": "^1.0.5"
23
39
  },
24
40
  "peerDependencies": {
25
41
  "hono": "^4.0.0"
26
42
  },
27
- "devDependencies": {
28
- "@types/node": "^20.9.0"
29
- },
30
43
  "_generatedBy": "dnt@dev"
31
44
  }