@wyrly/next 1.0.4 → 1.0.6

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/next
2
+
3
+ Wyrly DI adapter for Next.js 15+ App Router — route handlers (`withDI`) and Server Components
4
+ (`createServerDI`).
5
+
6
+ Japanese: [README.ja.md](./README.ja.md)
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install @wyrly/next @wyrly/core next react
12
+ ```
13
+
14
+ Peer dependencies: **next ^15.0.0**, **react ^19.0.0**.
15
+
16
+ ## Requirements
17
+
18
+ - Everything required by [`@wyrly/core`](../core/README.md)
19
+ - **Next.js 15+** (App Router)
20
+
21
+ ## Quick start (Route Handler)
22
+
23
+ ```ts
24
+ import { withDI } from "@wyrly/next";
25
+ import { createContainer } from "@wyrly/core";
26
+
27
+ const container = createContainer();
28
+
29
+ export const GET = withDI(container, async (_req, { di }) => {
30
+ const usecase = di.resolve(MyUseCase);
31
+ return Response.json(await usecase.run());
32
+ });
33
+ ```
34
+
35
+ For Server Components, use `createServerDI` — see
36
+ [API.md](https://github.com/valid-lab/wyrly/blob/main/API.md).
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/next` | yes | This package |
50
+ | `@wyrly/express` | yes | Express adapter |
51
+ | `@wyrly/hono` | yes | Hono adapter |
52
+ | `@wyrly/graphql` | yes | GraphQL 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,eAAe,GACf,mB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C,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/esm/next/mod.d.ts CHANGED
@@ -20,6 +20,7 @@ export type { ClassProvider, ClassToken, Container, DependencyEdge, DependencyGr
20
20
  export { withDI } from "./with_di.js";
21
21
  export { withActionDI } from "./with_action_di.js";
22
22
  export { createServerDI } from "./server_di.js";
23
+ export type { NextRequest } from "./public_types.js";
23
24
  export { NextRequestToken } from "./tokens.js";
24
25
  export type { AfterScheduler, CreateServerDIOptions, RouteHandlerContext, WithDIOptions, } from "./types.js";
25
26
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/next/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,KAAK,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/next/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,KAAK,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { NextRequest as NextRequestBase } from "next/server.js";
2
+ /** Next.js App Router request (re-exported for package-public doc types). */
3
+ export interface NextRequest extends NextRequestBase {
4
+ }
5
+ //# sourceMappingURL=public_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_types.d.ts","sourceRoot":"","sources":["../../src/next/public_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAErE,6EAA6E;AAC7E,MAAM,WAAW,WAAY,SAAQ,eAAe;CAAG"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import type { NextRequest } from "next/server.js";
2
1
  import { type Token } from "../core/mod.js";
2
+ import type { NextRequest } from "./public_types.js";
3
3
  /** Current Next.js `NextRequest` (resolvable only in request scope) */
4
4
  export declare const NextRequestToken: Token<NextRequest>;
5
5
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/next/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,gBAAgB,CAAC;AAEnD,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAqC,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/next/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAqC,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,30 @@
1
1
  {
2
2
  "name": "@wyrly/next",
3
- "version": "1.0.4",
4
- "description": "Wyrly DI adapter for Next.js App Router",
3
+ "version": "1.0.6",
4
+ "description": "Wyrly DI adapter for Next.js App Router — withDI and createServerDI",
5
+ "keywords": [
6
+ "wyrly",
7
+ "dependency-injection",
8
+ "di",
9
+ "typescript",
10
+ "inversion-of-control",
11
+ "ioc",
12
+ "nextjs",
13
+ "next.js",
14
+ "app-router",
15
+ "react",
16
+ "server-components"
17
+ ],
18
+ "homepage": "https://github.com/valid-lab/wyrly/tree/main/packages/next",
5
19
  "repository": {
6
20
  "type": "git",
7
21
  "url": "git+https://github.com/valid-lab/wyrly.git",
8
22
  "directory": "packages/next"
9
23
  },
10
24
  "license": "Apache-2.0",
25
+ "bugs": {
26
+ "url": "https://github.com/valid-lab/wyrly/issues"
27
+ },
11
28
  "module": "./esm/next/mod.js",
12
29
  "exports": {
13
30
  ".": {
@@ -19,15 +36,11 @@
19
36
  "dependencies": {
20
37
  "next": "15",
21
38
  "react": "19",
22
- "@deno/shim-deno": "~0.18.0",
23
- "@wyrly/core": "^1.0.4"
39
+ "@wyrly/core": "^1.0.6"
24
40
  },
25
41
  "peerDependencies": {
26
42
  "next": "^15.0.0",
27
43
  "react": "^19.0.0"
28
44
  },
29
- "devDependencies": {
30
- "@types/node": "^20.9.0"
31
- },
32
45
  "_generatedBy": "dnt@dev"
33
46
  }