@zuplo/cli 6.74.8 → 6.74.12

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.
Files changed (92) hide show
  1. package/node_modules/@hono/node-server/README.md +47 -1
  2. package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
  3. package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
  4. package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
  5. package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
  6. package/node_modules/@hono/node-server/dist/index.cjs +4 -1
  7. package/node_modules/@hono/node-server/dist/index.mjs +4 -1
  8. package/node_modules/@hono/node-server/package.json +14 -1
  9. package/node_modules/@zuplo/core/customer.cli.minified.js +245 -245
  10. package/node_modules/@zuplo/core/index.minified.js +234 -234
  11. package/node_modules/@zuplo/core/package.json +1 -1
  12. package/node_modules/@zuplo/graphql/out/esm/index.js +12 -12
  13. package/node_modules/@zuplo/graphql/package.json +1 -1
  14. package/node_modules/@zuplo/openapi-tools/package.json +2 -2
  15. package/node_modules/@zuplo/otel/out/esm/chunk-AHNBOCFU.js +26 -0
  16. package/node_modules/@zuplo/otel/out/esm/chunk-AHNBOCFU.js.map +1 -0
  17. package/node_modules/@zuplo/otel/out/esm/index.js +1 -1
  18. package/node_modules/@zuplo/otel/package.json +1 -1
  19. package/node_modules/@zuplo/runtime/out/esm/chunk-AVDTZRWM.js +26 -0
  20. package/node_modules/@zuplo/runtime/out/esm/chunk-AVDTZRWM.js.map +1 -0
  21. package/node_modules/@zuplo/runtime/out/esm/{chunk-3E6DNHTO.js → chunk-VVVYHDCV.js} +94 -92
  22. package/node_modules/@zuplo/runtime/out/esm/chunk-VVVYHDCV.js.map +1 -0
  23. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  24. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  25. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  26. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  27. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  28. package/node_modules/@zuplo/runtime/out/types/index.d.ts +231 -0
  29. package/node_modules/@zuplo/runtime/package.json +1 -1
  30. package/node_modules/hono/dist/cjs/context.js +28 -13
  31. package/node_modules/hono/dist/cjs/hono-base.js +3 -2
  32. package/node_modules/hono/dist/cjs/jsx/base.js +26 -14
  33. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +2 -2
  34. package/node_modules/hono/dist/cjs/middleware/cache/index.js +103 -8
  35. package/node_modules/hono/dist/cjs/middleware/compress/index.js +5 -0
  36. package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
  37. package/node_modules/hono/dist/cjs/middleware/etag/index.js +1 -1
  38. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +9 -4
  39. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +9 -4
  40. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +90 -0
  41. package/node_modules/hono/dist/cjs/request.js +6 -8
  42. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +55 -56
  43. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +64 -85
  44. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +13 -5
  45. package/node_modules/hono/dist/cjs/router.js +1 -1
  46. package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
  47. package/node_modules/hono/dist/cjs/utils/url.js +7 -7
  48. package/node_modules/hono/dist/context.js +28 -13
  49. package/node_modules/hono/dist/hono-base.js +3 -2
  50. package/node_modules/hono/dist/jsx/base.js +26 -14
  51. package/node_modules/hono/dist/jsx/hooks/index.js +2 -2
  52. package/node_modules/hono/dist/middleware/cache/index.js +103 -8
  53. package/node_modules/hono/dist/middleware/compress/index.js +5 -0
  54. package/node_modules/hono/dist/middleware/cors/index.js +1 -1
  55. package/node_modules/hono/dist/middleware/etag/index.js +1 -1
  56. package/node_modules/hono/dist/middleware/jwk/jwk.js +9 -4
  57. package/node_modules/hono/dist/middleware/jwt/jwt.js +9 -4
  58. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +68 -0
  59. package/node_modules/hono/dist/request.js +7 -9
  60. package/node_modules/hono/dist/router/reg-exp-router/node.js +55 -56
  61. package/node_modules/hono/dist/router/reg-exp-router/router.js +64 -85
  62. package/node_modules/hono/dist/router/reg-exp-router/trie.js +13 -5
  63. package/node_modules/hono/dist/router.js +1 -1
  64. package/node_modules/hono/dist/types/client/types.d.ts +1 -1
  65. package/node_modules/hono/dist/types/hono-base.d.ts +4 -3
  66. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  67. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +5 -5
  68. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +2 -2
  69. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +5 -5
  70. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +8 -6
  71. package/node_modules/hono/dist/types/jsx/index.d.ts +5 -5
  72. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +6 -4
  73. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +1 -1
  74. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +2 -2
  75. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +2 -0
  76. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +2 -0
  77. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +49 -0
  78. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +1 -1
  79. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +2 -1
  80. package/node_modules/hono/dist/types/router.d.ts +1 -1
  81. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -2
  82. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  83. package/node_modules/hono/dist/utils/cookie.js +2 -2
  84. package/node_modules/hono/dist/utils/url.js +5 -6
  85. package/node_modules/hono/package.json +9 -1
  86. package/package.json +6 -6
  87. package/node_modules/@zuplo/otel/out/esm/chunk-6UX7NFNJ.js +0 -26
  88. package/node_modules/@zuplo/otel/out/esm/chunk-6UX7NFNJ.js.map +0 -1
  89. package/node_modules/@zuplo/runtime/out/esm/chunk-3E6DNHTO.js.map +0 -1
  90. package/node_modules/@zuplo/runtime/out/esm/chunk-ZB7PAWBM.js +0 -26
  91. package/node_modules/@zuplo/runtime/out/esm/chunk-ZB7PAWBM.js.map +0 -1
  92. /package/node_modules/@zuplo/runtime/out/esm/{chunk-3E6DNHTO.js.LEGAL.txt → chunk-VVVYHDCV.js.LEGAL.txt} +0 -0
@@ -86,7 +86,7 @@ app.get(
86
86
  }))
87
87
  )
88
88
 
89
- const wss = new WebSocketServer({ noServer: true }) // important to create with `noServer: true`
89
+ const wss = new WebSocketServer({ noServer: true })
90
90
  serve({
91
91
  fetch: app.fetch,
92
92
  websocket: { server: wss },
@@ -332,6 +332,52 @@ type Http2Bindings = {
332
332
  }
333
333
  ```
334
334
 
335
+ ## Early Hints Middleware
336
+
337
+ You can send HTTP 103 Early Hints to instruct browsers to preload or preconnect resources before the final response is prepared. The middleware is supported under Node.js bindings (HTTP/1.1 and HTTP/2).
338
+
339
+ ### Usage
340
+
341
+ Import `earlyHints` from `@hono/node-server/early-hints`:
342
+
343
+ #### Static links
344
+
345
+ ```ts
346
+ import { serve } from '@hono/node-server'
347
+ import { earlyHints } from '@hono/node-server/early-hints'
348
+ import { Hono } from 'hono'
349
+
350
+ const app = new Hono()
351
+
352
+ app.use(
353
+ earlyHints({
354
+ link: '</styles.css>; rel=preload; as=style',
355
+ })
356
+ )
357
+
358
+ app.get('/', (c) => {
359
+ return c.html('<!DOCTYPE html><html><body><h1>Hello Hono!</h1></body></html>')
360
+ })
361
+
362
+ serve(app)
363
+ ```
364
+
365
+ #### Dynamic links
366
+
367
+ ```ts
368
+ app.use(
369
+ earlyHints({
370
+ link: (c) =>
371
+ c.req.query('theme') === 'dark'
372
+ ? '</dark.css>; rel=preload; as=style'
373
+ : '</light.css>; rel=preload; as=style',
374
+ })
375
+ )
376
+ ```
377
+
378
+ > [!NOTE]
379
+ > Early Hints are sent only for requests that look like document navigations. If `Sec-Fetch-Mode` or `Sec-Fetch-Dest` is present with a value other than `navigate` or `document`, for example a `fetch()` or XHR call from a browser, a subresource request, or an iframe navigation, the middleware skips the hints and continues to the handler. Requests without these headers, such as `curl` or `fetch()` from a JavaScript runtime, are treated as navigations and do receive Early Hints.
380
+
335
381
  ## Direct response from Node.js API
336
382
 
337
383
  You can directly respond to the client from the Node.js API.
@@ -0,0 +1,35 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/early-hints.ts
4
+ /**
5
+ * Early Hints middleware for Node.js
6
+ * Automatically sends a 103 Early Hints informational response with the specified Link header(s).
7
+ *
8
+ * @param options EarlyHintsOptions
9
+ * @returns MiddlewareHandler
10
+ */
11
+ const earlyHints = (options) => {
12
+ let warned = false;
13
+ return async (c, next) => {
14
+ const mode = c.req.header("Sec-Fetch-Mode");
15
+ const dest = c.req.header("Sec-Fetch-Dest");
16
+ if (mode && mode !== "navigate" || dest && dest !== "document") return next();
17
+ const env = c.env || {};
18
+ const outgoing = (env.server ? env.server : env)?.outgoing;
19
+ if (typeof outgoing?.writeEarlyHints !== "function") {
20
+ if (!warned) {
21
+ console.warn("Early Hints Middleware is not supported because writeEarlyHints is not defined.");
22
+ warned = true;
23
+ }
24
+ return await next();
25
+ }
26
+ if (!outgoing.headersSent) {
27
+ const link = typeof options.link === "function" ? options.link(c) : options.link;
28
+ if (link !== void 0 && (Array.isArray(link) ? link.length > 0 : Boolean(link))) outgoing.writeEarlyHints({ link });
29
+ }
30
+ await next();
31
+ };
32
+ };
33
+
34
+ //#endregion
35
+ exports.earlyHints = earlyHints;
@@ -0,0 +1,16 @@
1
+ import { Context, Env, MiddlewareHandler } from "hono";
2
+
3
+ //#region src/early-hints.d.ts
4
+ type EarlyHintsOptions<E extends Env = Env> = {
5
+ link: string | string[] | ((c: Context<E>) => string | string[] | undefined);
6
+ };
7
+ /**
8
+ * Early Hints middleware for Node.js
9
+ * Automatically sends a 103 Early Hints informational response with the specified Link header(s).
10
+ *
11
+ * @param options EarlyHintsOptions
12
+ * @returns MiddlewareHandler
13
+ */
14
+ declare const earlyHints: <E extends Env = any>(options: EarlyHintsOptions<E>) => MiddlewareHandler<E>;
15
+ //#endregion
16
+ export { EarlyHintsOptions, earlyHints };
@@ -0,0 +1,16 @@
1
+ import { Context, Env, MiddlewareHandler } from "hono";
2
+
3
+ //#region src/early-hints.d.ts
4
+ type EarlyHintsOptions<E extends Env = Env> = {
5
+ link: string | string[] | ((c: Context<E>) => string | string[] | undefined);
6
+ };
7
+ /**
8
+ * Early Hints middleware for Node.js
9
+ * Automatically sends a 103 Early Hints informational response with the specified Link header(s).
10
+ *
11
+ * @param options EarlyHintsOptions
12
+ * @returns MiddlewareHandler
13
+ */
14
+ declare const earlyHints: <E extends Env = any>(options: EarlyHintsOptions<E>) => MiddlewareHandler<E>;
15
+ //#endregion
16
+ export { EarlyHintsOptions, earlyHints };
@@ -0,0 +1,33 @@
1
+ //#region src/early-hints.ts
2
+ /**
3
+ * Early Hints middleware for Node.js
4
+ * Automatically sends a 103 Early Hints informational response with the specified Link header(s).
5
+ *
6
+ * @param options EarlyHintsOptions
7
+ * @returns MiddlewareHandler
8
+ */
9
+ const earlyHints = (options) => {
10
+ let warned = false;
11
+ return async (c, next) => {
12
+ const mode = c.req.header("Sec-Fetch-Mode");
13
+ const dest = c.req.header("Sec-Fetch-Dest");
14
+ if (mode && mode !== "navigate" || dest && dest !== "document") return next();
15
+ const env = c.env || {};
16
+ const outgoing = (env.server ? env.server : env)?.outgoing;
17
+ if (typeof outgoing?.writeEarlyHints !== "function") {
18
+ if (!warned) {
19
+ console.warn("Early Hints Middleware is not supported because writeEarlyHints is not defined.");
20
+ warned = true;
21
+ }
22
+ return await next();
23
+ }
24
+ if (!outgoing.headersSent) {
25
+ const link = typeof options.link === "function" ? options.link(c) : options.link;
26
+ if (link !== void 0 && (Array.isArray(link) ? link.length > 0 : Boolean(link))) outgoing.writeEarlyHints({ link });
27
+ }
28
+ await next();
29
+ };
30
+ };
31
+
32
+ //#endregion
33
+ export { earlyHints };
@@ -684,7 +684,10 @@ const drainIncoming = (incoming) => {
684
684
  const forceClose = () => {
685
685
  cleanup();
686
686
  const socket = incoming.socket;
687
- if (socket && !socket.destroyed) socket.destroySoon();
687
+ if (socket && !socket.destroyed) {
688
+ if (typeof socket.destroySoon === "function") socket.destroySoon();
689
+ else if (typeof socket.destroy === "function") socket.destroy();
690
+ }
688
691
  };
689
692
  const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
690
693
  timer.unref?.();
@@ -683,7 +683,10 @@ const drainIncoming = (incoming) => {
683
683
  const forceClose = () => {
684
684
  cleanup();
685
685
  const socket = incoming.socket;
686
- if (socket && !socket.destroyed) socket.destroySoon();
686
+ if (socket && !socket.destroyed) {
687
+ if (typeof socket.destroySoon === "function") socket.destroySoon();
688
+ else if (typeof socket.destroy === "function") socket.destroy();
689
+ }
687
690
  };
688
691
  const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
689
692
  timer.unref?.();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "2.0.12",
3
+ "version": "2.1.0",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -48,6 +48,16 @@
48
48
  "types": "./dist/conninfo.d.cts",
49
49
  "default": "./dist/conninfo.cjs"
50
50
  }
51
+ },
52
+ "./early-hints": {
53
+ "import": {
54
+ "types": "./dist/early-hints.d.mts",
55
+ "default": "./dist/early-hints.mjs"
56
+ },
57
+ "require": {
58
+ "types": "./dist/early-hints.d.cts",
59
+ "default": "./dist/early-hints.cjs"
60
+ }
51
61
  }
52
62
  },
53
63
  "typesVersions": {
@@ -63,6 +73,9 @@
63
73
  ],
64
74
  "conninfo": [
65
75
  "./dist/conninfo.d.mts"
76
+ ],
77
+ "early-hints": [
78
+ "./dist/early-hints.d.mts"
66
79
  ]
67
80
  }
68
81
  },