@wyrly/express 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,56 @@
1
+ # @wyrly/express
2
+
3
+ Wyrly DI adapter for Express — one request scope per HTTP request via `diMiddleware`.
4
+
5
+ Japanese: [README.ja.md](./README.ja.md)
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @wyrly/express @wyrly/core express
11
+ ```
12
+
13
+ Peer dependency: **express ^5.0.0**.
14
+
15
+ ## Requirements
16
+
17
+ - Everything required by [`@wyrly/core`](../core/README.md)
18
+ - **Express 5.x**
19
+
20
+ ## Quick start
21
+
22
+ ```ts
23
+ import express from "express";
24
+ import { asExpressRequestWithDI, diMiddleware } from "@wyrly/express";
25
+ import { createContainer } from "@wyrly/core";
26
+
27
+ const app = express();
28
+ const container = createContainer();
29
+ app.use(diMiddleware(container));
30
+
31
+ app.get("/users/:id", (req, res) => {
32
+ const di = asExpressRequestWithDI(req).di;
33
+ res.json({ ok: true });
34
+ });
35
+ ```
36
+
37
+ ## Documentation
38
+
39
+ - [@wyrly/core](../core/README.md)
40
+ - [API reference](https://github.com/valid-lab/wyrly/blob/main/API.md)
41
+ - [Monorepo README](https://github.com/valid-lab/wyrly/blob/main/README.md)
42
+
43
+ ## Related packages
44
+
45
+ | Package | npm | Description |
46
+ | ---------------- | -------- | --------------- |
47
+ | `@wyrly/core` | yes | Core DI |
48
+ | `@wyrly/express` | yes | This package |
49
+ | `@wyrly/hono` | yes | Hono adapter |
50
+ | `@wyrly/graphql` | yes | GraphQL adapter |
51
+ | `@wyrly/next` | yes | Next.js adapter |
52
+ | `@wyrly/fresh` | JSR only | Fresh 2.x |
53
+
54
+ ## License
55
+
56
+ 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,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,kCAAkC,GAClC,kCAAkC,GAClC,2CAA2C,GAC3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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,29 @@
1
1
  {
2
2
  "name": "@wyrly/express",
3
- "version": "1.0.4",
4
- "description": "Wyrly DI adapter for Express",
3
+ "version": "1.0.5",
4
+ "description": "Wyrly DI adapter for Express — request scope via diMiddleware",
5
+ "keywords": [
6
+ "wyrly",
7
+ "dependency-injection",
8
+ "di",
9
+ "typescript",
10
+ "inversion-of-control",
11
+ "ioc",
12
+ "express",
13
+ "middleware",
14
+ "node",
15
+ "http"
16
+ ],
17
+ "homepage": "https://github.com/valid-lab/wyrly/tree/main/packages/express",
5
18
  "repository": {
6
19
  "type": "git",
7
20
  "url": "git+https://github.com/valid-lab/wyrly.git",
8
21
  "directory": "packages/express"
9
22
  },
10
23
  "license": "Apache-2.0",
24
+ "bugs": {
25
+ "url": "https://github.com/valid-lab/wyrly/issues"
26
+ },
11
27
  "module": "./esm/express/mod.js",
12
28
  "exports": {
13
29
  ".": {
@@ -18,14 +34,10 @@
18
34
  "sideEffects": false,
19
35
  "dependencies": {
20
36
  "express": "5",
21
- "@deno/shim-deno": "~0.18.0",
22
- "@wyrly/core": "^1.0.4"
37
+ "@wyrly/core": "^1.0.5"
23
38
  },
24
39
  "peerDependencies": {
25
40
  "express": "^5.0.0"
26
41
  },
27
- "devDependencies": {
28
- "@types/node": "^20.9.0"
29
- },
30
42
  "_generatedBy": "dnt@dev"
31
43
  }