@zuplo/cli 7.14.6 → 7.14.8

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 (68) hide show
  1. package/node_modules/@zuplo/core/customer.cli.minified.js +95 -95
  2. package/node_modules/@zuplo/core/index.minified.js +100 -100
  3. package/node_modules/@zuplo/core/package.json +1 -1
  4. package/node_modules/@zuplo/graphql/package.json +1 -1
  5. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  6. package/node_modules/@zuplo/otel/package.json +1 -1
  7. package/node_modules/@zuplo/runtime/out/esm/{chunk-VIH2ISEH.js → chunk-2HVCLUM4.js} +2 -2
  8. package/node_modules/@zuplo/runtime/out/esm/{chunk-VIH2ISEH.js.map → chunk-2HVCLUM4.js.map} +1 -1
  9. package/node_modules/@zuplo/runtime/out/esm/{chunk-G2O2ZIL3.js → chunk-6R2COTV6.js} +2 -2
  10. package/node_modules/@zuplo/runtime/out/esm/{chunk-JORDKCQ5.js → chunk-DB6LKZ36.js} +97 -97
  11. package/node_modules/@zuplo/runtime/out/esm/chunk-DB6LKZ36.js.map +1 -0
  12. package/node_modules/@zuplo/runtime/out/esm/{chunk-AEVCZW3D.js → chunk-PY52EHDX.js} +2 -2
  13. package/node_modules/@zuplo/runtime/out/esm/{chunk-LDA754KZ.js → chunk-SNTU476S.js} +2 -2
  14. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  15. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
  16. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +8 -8
  17. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  18. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  19. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  20. package/node_modules/@zuplo/runtime/out/types/index.d.ts +14 -5
  21. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -5
  22. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +40 -0
  23. package/node_modules/@zuplo/runtime/package.json +1 -1
  24. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
  25. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
  26. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
  27. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
  28. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +1 -1
  29. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +2 -1
  30. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +5 -3
  31. package/node_modules/hono/dist/cjs/jsx/base.js +49 -30
  32. package/node_modules/hono/dist/cjs/jsx/components.js +2 -2
  33. package/node_modules/hono/dist/cjs/jsx/constants.js +2 -0
  34. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +13 -17
  35. package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -1
  36. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +1 -0
  37. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +4 -3
  38. package/node_modules/hono/dist/cjs/utils/cookie.js +2 -2
  39. package/node_modules/hono/dist/cjs/utils/mime.js +1 -1
  40. package/node_modules/hono/dist/cjs/utils/url.js +1 -1
  41. package/node_modules/hono/dist/client/fetch-result-please.js +1 -1
  42. package/node_modules/hono/dist/helper/accepts/accepts.js +2 -1
  43. package/node_modules/hono/dist/helper/ssg/ssg.js +5 -3
  44. package/node_modules/hono/dist/jsx/base.js +49 -32
  45. package/node_modules/hono/dist/jsx/components.js +2 -2
  46. package/node_modules/hono/dist/jsx/constants.js +2 -1
  47. package/node_modules/hono/dist/jsx/jsx-runtime.js +15 -19
  48. package/node_modules/hono/dist/middleware/etag/index.js +3 -1
  49. package/node_modules/hono/dist/middleware/language/language.js +1 -1
  50. package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -0
  51. package/node_modules/hono/dist/middleware/timing/timing.js +4 -3
  52. package/node_modules/hono/dist/types/helper/factory/index.d.ts +1 -1
  53. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +6 -1
  54. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  55. package/node_modules/hono/dist/types/jsx/constants.d.ts +1 -0
  56. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +2 -1
  57. package/node_modules/hono/dist/types/utils/cookie.d.ts +1 -1
  58. package/node_modules/hono/dist/utils/cookie.js +2 -2
  59. package/node_modules/hono/dist/utils/mime.js +1 -1
  60. package/node_modules/hono/dist/utils/url.js +1 -1
  61. package/node_modules/hono/package.json +1 -1
  62. package/package.json +11 -11
  63. package/node_modules/@zuplo/runtime/out/esm/chunk-JORDKCQ5.js.map +0 -1
  64. /package/node_modules/@zuplo/runtime/out/esm/{chunk-VIH2ISEH.js.LEGAL.txt → chunk-2HVCLUM4.js.LEGAL.txt} +0 -0
  65. /package/node_modules/@zuplo/runtime/out/esm/{chunk-G2O2ZIL3.js.map → chunk-6R2COTV6.js.map} +0 -0
  66. /package/node_modules/@zuplo/runtime/out/esm/{chunk-JORDKCQ5.js.LEGAL.txt → chunk-DB6LKZ36.js.LEGAL.txt} +0 -0
  67. /package/node_modules/@zuplo/runtime/out/esm/{chunk-AEVCZW3D.js.map → chunk-PY52EHDX.js.map} +0 -0
  68. /package/node_modules/@zuplo/runtime/out/esm/{chunk-LDA754KZ.js.map → chunk-SNTU476S.js.map} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,M as c,Q as u}from"../chunk-JORDKCQ5.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-AEVCZW3D.js";import"../chunk-A3QGJZO7.js";import"../chunk-G2O2ZIL3.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-VIH2ISEH.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,M as c,Q as u}from"../chunk-DB6LKZ36.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-PY52EHDX.js";import"../chunk-A3QGJZO7.js";import"../chunk-6R2COTV6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-2HVCLUM4.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-G2O2ZIL3.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-VIH2ISEH.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-6R2COTV6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-2HVCLUM4.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -4352,9 +4352,11 @@ declare interface CompatibilityFlags {
4352
4352
  * precompiled Ajv validators from the OpenAPI document, validated per the
4353
4353
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
4354
4354
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
4355
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
4356
- * `format` and pattern rules, and keeps its parameter type coercion
4357
- * (specs/compat-improved-schema-validation.md).
4355
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
4356
+ * fully flattened fails the build instead of staying nested
4357
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
4358
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
4359
+ * type coercion (specs/compat-improved-schema-validation.md).
4358
4360
  *
4359
4361
  * @compatibilityDate 2026-11-06
4360
4362
  */
@@ -4433,10 +4435,11 @@ declare interface CompatibilityFlags {
4433
4435
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
4434
4436
  /**
4435
4437
  * Whether built-in policies treat an empty or whitespace-only value for an
4436
- * optional string option as if the option were left out.
4438
+ * optional string option as if the option were left out, and reject one for
4439
+ * a required string option.
4437
4440
  *
4438
4441
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
4439
- * decides what an empty environment variable does to an optional option.
4442
+ * decides what an empty environment variable does to a policy option.
4440
4443
  *
4441
4444
  * Before this flag: Many policies reject `""`. Some fail every request with
4442
4445
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -4451,6 +4454,12 @@ declare interface CompatibilityFlags {
4451
4454
  * current behavior. `BLANK_IS_NOT_UNSET` in
4452
4455
  * `policies/optional-string-options.spec.ts` lists them with the reason.
4453
4456
  *
4457
+ * A required string option that is empty or whitespace-only fails with a
4458
+ * `ConfigurationError` naming the option when the policy is created, instead
4459
+ * of being sent as a blank credential, host or header. Required options
4460
+ * where an empty value means something (`replace-string-outbound`
4461
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
4462
+ *
4454
4463
  * @compatibilityDate 2026-11-06
4455
4464
  */
4456
4465
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -223,9 +223,11 @@ declare interface CompatibilityFlags {
223
223
  * precompiled Ajv validators from the OpenAPI document, validated per the
224
224
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
225
225
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
226
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
227
- * `format` and pattern rules, and keeps its parameter type coercion
228
- * (specs/compat-improved-schema-validation.md).
226
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
227
+ * fully flattened fails the build instead of staying nested
228
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
229
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
230
+ * type coercion (specs/compat-improved-schema-validation.md).
229
231
  *
230
232
  * @compatibilityDate 2026-11-06
231
233
  */
@@ -304,10 +306,11 @@ declare interface CompatibilityFlags {
304
306
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
305
307
  /**
306
308
  * Whether built-in policies treat an empty or whitespace-only value for an
307
- * optional string option as if the option were left out.
309
+ * optional string option as if the option were left out, and reject one for
310
+ * a required string option.
308
311
  *
309
312
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
310
- * decides what an empty environment variable does to an optional option.
313
+ * decides what an empty environment variable does to a policy option.
311
314
  *
312
315
  * Before this flag: Many policies reject `""`. Some fail every request with
313
316
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -322,6 +325,12 @@ declare interface CompatibilityFlags {
322
325
  * current behavior. `BLANK_IS_NOT_UNSET` in
323
326
  * `policies/optional-string-options.spec.ts` lists them with the reason.
324
327
  *
328
+ * A required string option that is empty or whitespace-only fails with a
329
+ * `ConfigurationError` naming the option when the policy is created, instead
330
+ * of being sent as a blank credential, host or header. Required options
331
+ * where an empty value means something (`replace-string-outbound`
332
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
333
+ *
325
334
  * @compatibilityDate 2026-11-06
326
335
  */
327
336
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -2925,6 +2925,46 @@ export declare function McpProxyHandler(
2925
2925
  context: ZuploContext
2926
2926
  ): Promise<Response>;
2927
2927
 
2928
+ /**
2929
+ * OpenTelemetry options for the MCP Gateway's `McpProxyHandler`, set under
2930
+ * `telemetry` in the route's handler options. The same options as the MCP
2931
+ * Server handler's `telemetry`.
2932
+ */
2933
+ export declare interface McpProxyHandlerTelemetryOptions {
2934
+ /**
2935
+ * Record tool call content on the MCP SERVER and CLIENT spans of a
2936
+ * forwarded `tools/call`: the arguments the client sent as
2937
+ * `gen_ai.tool.call.arguments` and, when the upstream returns a result
2938
+ * without `isError: true`, that result as `gen_ai.tool.call.result`. Both
2939
+ * are JSON strings capped at 8192 UTF-16 code units.
2940
+ *
2941
+ * Off by default. Tool arguments and results often contain personal or
2942
+ * otherwise sensitive data, and enabling this sends them to your telemetry
2943
+ * backend.
2944
+ *
2945
+ * The gateway records content only for a `tools/call` it forwards upstream.
2946
+ * A call a gateway policy answers itself (for example, by asking the client
2947
+ * to connect the upstream) records neither attribute. A result is recorded
2948
+ * when the JSON response, or the SSE event that carries it, is 1 MiB or
2949
+ * less; a larger result is forwarded to the client but not recorded.
2950
+ *
2951
+ * @example
2952
+ * ```json
2953
+ * {
2954
+ * "handler": {
2955
+ * "export": "McpProxyHandler",
2956
+ * "module": "$import(@zuplo/runtime/mcp-gateway)",
2957
+ * "options": {
2958
+ * "rewritePattern": "https://mcp.example.com/mcp",
2959
+ * "telemetry": { "captureToolCallContent": true }
2960
+ * }
2961
+ * }
2962
+ * }
2963
+ * ```
2964
+ */
2965
+ captureToolCallContent?: boolean;
2966
+ }
2967
+
2928
2968
  /**
2929
2969
  * Resolve a gateway-managed upstream MCP credential and apply it to the
2930
2970
  * request before the normal Zuplo route handler forwards the request.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.14.6",
4
+ "version": "7.14.8",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -199,7 +199,7 @@ var EventV2Processor = class extends EventProcessor {
199
199
  const headers = new Headers();
200
200
  this.getCookies(event, headers);
201
201
  if (event.headers) {
202
- for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, v);
202
+ for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, sanitizeHeaderValue(v));
203
203
  }
204
204
  return headers;
205
205
  }
@@ -200,7 +200,7 @@ var EventV2Processor = class extends EventProcessor {
200
200
  const headers = new Headers();
201
201
  this.getCookies(event, headers);
202
202
  if (event.headers) {
203
- for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, v);
203
+ for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, sanitizeHeaderValue(v));
204
204
  }
205
205
  return headers;
206
206
  }
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_middleware_serve_static_index = require("../../middleware/serve-static/index.js");
3
- let node_path = require("node:path");
4
3
  let node_fs_promises = require("node:fs/promises");
4
+ let node_path = require("node:path");
5
5
  //#region src/adapter/bun/serve-static.ts
6
6
  /**
7
7
  * @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_helper_websocket_index = require("../../helper/websocket/index.js");
3
2
  const require_adapter_bun_server = require("./server.js");
3
+ const require_helper_websocket_index = require("../../helper/websocket/index.js");
4
4
  //#region src/adapter/bun/websocket.ts
5
5
  /**
6
6
  * @internal
@@ -58,7 +58,7 @@ const jsonRegex = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;
58
58
  function detectResponseType(response) {
59
59
  const _contentType = response.headers.get("content-type");
60
60
  if (!_contentType) return "text";
61
- const contentType = _contentType.split(";").shift();
61
+ const contentType = _contentType.split(";").shift().trim();
62
62
  if (jsonRegex.test(contentType)) return "json";
63
63
  return "text";
64
64
  }
@@ -20,12 +20,13 @@ const getSpecificity = (type) => {
20
20
  };
21
21
  const defaultMatch = (accepts, config) => {
22
22
  const { supports, default: defaultSupport } = config;
23
+ const exactTypes = new Set(accepts.filter((accept) => getSpecificity(accept.type) === 3).map((accept) => accept.type.toLowerCase()));
23
24
  const sortedAccepts = accepts.filter((accept) => accept.q > 0).sort((a, b) => {
24
25
  if (b.q !== a.q) return b.q - a.q;
25
26
  return getSpecificity(b.type) - getSpecificity(a.type);
26
27
  });
27
28
  for (const accept of sortedAccepts) {
28
- const matched = supports.find((supported) => matchType(accept.type, supported));
29
+ const matched = supports.find((supported) => matchType(accept.type, supported) && (getSpecificity(accept.type) !== 2 || !exactTypes.has(supported.toLowerCase())));
29
30
  if (matched) return matched;
30
31
  }
31
32
  return defaultSupport;
@@ -39,6 +39,8 @@ const defaultExtensionMap = {
39
39
  const determineExtension = (mimeType, userExtensionMap) => {
40
40
  const extensionMap = userExtensionMap || defaultExtensionMap;
41
41
  if (mimeType in extensionMap) return extensionMap[mimeType];
42
+ const lowerCasedMimeType = mimeType.toLowerCase();
43
+ if (lowerCasedMimeType in extensionMap) return extensionMap[lowerCasedMimeType];
42
44
  return require_utils_mime.getExtension(mimeType) || "html";
43
45
  };
44
46
  const combineBeforeRequestHooks = (hooks) => {
@@ -142,8 +144,7 @@ const fetchRoutesContent = function* (app, beforeRequestHook, afterResponseHook,
142
144
  * `saveContentToFile` is an experimental feature.
143
145
  * The API might be changed.
144
146
  */
145
- const createdDirs = /* @__PURE__ */ new Set();
146
- const saveContentToFile = async (data, fsModule, outDir, extensionMap) => {
147
+ const saveContentToFile = async (data, fsModule, outDir, extensionMap, createdDirs = /* @__PURE__ */ new Set()) => {
147
148
  const awaitedData = await data;
148
149
  if (!awaitedData) return;
149
150
  const { routePath, content, mimeType } = awaitedData;
@@ -183,10 +184,11 @@ const toSSG = async (app, fs, options) => {
183
184
  const concurrency = options?.concurrency ?? DEFAULT_CONCURRENCY;
184
185
  const combinedBeforeRequestHook = combineBeforeRequestHooks(beforeRequestHooks.length > 0 ? beforeRequestHooks : [(req) => req]);
185
186
  const combinedAfterResponseHook = combineAfterResponseHooks(afterResponseHooks.length > 0 ? afterResponseHooks : [(req) => req]);
187
+ const createdDirs = /* @__PURE__ */ new Set();
186
188
  const getInfoGen = fetchRoutesContent(app, combinedBeforeRequestHook, combinedAfterResponseHook, concurrency);
187
189
  for (const getInfo of getInfoGen) getInfoPromises.push(getInfo.then((getContentGen) => {
188
190
  if (!getContentGen) return;
189
- for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap).catch((e) => e));
191
+ for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap, createdDirs).catch((e) => e));
190
192
  }));
191
193
  await Promise.all(getInfoPromises);
192
194
  const files = [];
@@ -26,7 +26,7 @@ const emptyTags = [
26
26
  "track",
27
27
  "wbr"
28
28
  ];
29
- const booleanAttributes = [
29
+ const booleanAttributes = /* @__PURE__ */ new Set([
30
30
  "allowfullscreen",
31
31
  "async",
32
32
  "autofocus",
@@ -52,8 +52,11 @@ const booleanAttributes = [
52
52
  "readonly",
53
53
  "required",
54
54
  "reversed",
55
- "selected"
56
- ];
55
+ "selected",
56
+ "shadowrootclonable",
57
+ "shadowrootdelegatesfocus",
58
+ "shadowrootserializable"
59
+ ]);
57
60
  const resolveFunctionComponentResult = (result, suspendedContext) => result.then((resolved) => {
58
61
  if (typeof resolved !== "string" && !Array.isArray(resolved) && !(resolved instanceof JSXNode)) return resolved;
59
62
  const children = Array.isArray(resolved) ? resolved : [resolved];
@@ -64,6 +67,44 @@ const resolveFunctionComponentResult = (result, suspendedContext) => result.then
64
67
  };
65
68
  return suspendedContext ? suspendedContext(render) : require_jsx_context.runWithRenderContext(render);
66
69
  });
70
+ const markRenderedJSX = (value) => {
71
+ value[require_jsx_constants.RENDERED_JSX] = true;
72
+ return value;
73
+ };
74
+ const isEscapedAttribute = (value) => value instanceof String && value.isEscaped && !(require_jsx_constants.RENDERED_JSX in value);
75
+ const objectToAttributeString = (v) => {
76
+ const s = v.toString();
77
+ return s instanceof Promise ? s.then(String) : String(s);
78
+ };
79
+ const attributeToBuffer = (buffer, prefix, key, v, tag) => {
80
+ if (key === "ref" || v === null || v === void 0) return;
81
+ if (typeof v === "boolean" && booleanAttributes.has(key)) {
82
+ if (v) buffer[0] += `${prefix}${key}=""`;
83
+ return;
84
+ }
85
+ if (typeof v === "function") {
86
+ if (!key.startsWith("on")) throw new Error(`Invalid prop '${key}' of type 'function' supplied to ${tag ? `'${tag}'` : "a JSX element"}.`);
87
+ return;
88
+ }
89
+ buffer[0] += `${prefix}${key}="`;
90
+ if (key === "style" && typeof v === "object") {
91
+ let styleStr = "";
92
+ require_jsx_utils.styleObjectForEach(v, (property, value) => {
93
+ if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
94
+ });
95
+ require_utils_html.escapeToBuffer(styleStr, buffer);
96
+ } else if (typeof v === "string") require_utils_html.escapeToBuffer(v, buffer);
97
+ else if (typeof v === "number" || isEscapedAttribute(v)) buffer[0] += `${v}`;
98
+ else {
99
+ const s = v instanceof Promise ? v.then((r) => typeof r === "object" && r !== null && !isEscapedAttribute(r) ? objectToAttributeString(r) : r) : objectToAttributeString(v);
100
+ if (s instanceof Promise) {
101
+ buffer.unshift("\"", s);
102
+ return;
103
+ }
104
+ require_utils_html.escapeToBuffer(s, buffer);
105
+ }
106
+ buffer[0] += "\"";
107
+ };
67
108
  const childrenToStringToBuffer = (children, buffer) => {
68
109
  for (let i = 0, len = children.length; i < len; i++) {
69
110
  const child = children[i];
@@ -115,7 +156,7 @@ var JSXNode = class {
115
156
  const render = () => {
116
157
  const buffer = [""];
117
158
  this.toStringToBuffer(buffer);
118
- return buffer.length === 1 ? "callbacks" in buffer ? require_utils_html.resolveCallbackSync(require_utils_html.raw(buffer[0], buffer.callbacks)).toString() : buffer[0] : require_utils_html.stringBufferToString(buffer, buffer.callbacks);
159
+ return buffer.length === 1 ? "callbacks" in buffer ? require_utils_html.resolveCallbackSync(require_utils_html.raw(buffer[0], buffer.callbacks)).toString() : buffer[0] : require_utils_html.stringBufferToString(buffer, buffer.callbacks).then(markRenderedJSX);
119
160
  };
120
161
  return require_jsx_context.runWithRenderContext(render);
121
162
  }
@@ -128,34 +169,10 @@ var JSXNode = class {
128
169
  for (let [key, v] of Object.entries(props)) {
129
170
  key = normalizeKey(key);
130
171
  if (!require_jsx_utils.isValidAttributeName(key)) continue;
131
- if (key === "children") {} else if (key === "style" && typeof v === "object") {
132
- let styleStr = "";
133
- require_jsx_utils.styleObjectForEach(v, (property, value) => {
134
- if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
135
- });
136
- buffer[0] += " style=\"";
137
- require_utils_html.escapeToBuffer(styleStr, buffer);
138
- buffer[0] += "\"";
139
- } else if (typeof v === "string") {
140
- buffer[0] += ` ${key}="`;
141
- require_utils_html.escapeToBuffer(v, buffer);
142
- buffer[0] += "\"";
143
- } else if (v === null || v === void 0) {} else if (typeof v === "number" || v.isEscaped) buffer[0] += ` ${key}="${v}"`;
144
- else if (typeof v === "boolean" && booleanAttributes.includes(key)) {
145
- if (v) buffer[0] += ` ${key}=""`;
146
- } else if (key === "dangerouslySetInnerHTML") {
172
+ if (key === "children") {} else if (key === "dangerouslySetInnerHTML" && typeof v === "object" && v !== null && "__html" in v) {
147
173
  if (children.length > 0) throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
148
174
  children = [require_utils_html.raw(v.__html)];
149
- } else if (v instanceof Promise) {
150
- buffer[0] += ` ${key}="`;
151
- buffer.unshift("\"", v);
152
- } else if (typeof v === "function") {
153
- if (!key.startsWith("on") && key !== "ref") throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
154
- } else {
155
- buffer[0] += ` ${key}="`;
156
- require_utils_html.escapeToBuffer(v.toString(), buffer);
157
- buffer[0] += "\"";
158
- }
175
+ } else attributeToBuffer(buffer, " ", key, v, tag);
159
176
  }
160
177
  if (emptyTags.includes(tag) && children.length === 0) {
161
178
  buffer[0] += "/>";
@@ -252,6 +269,7 @@ const reactAPICompatVersion = "19.0.0-hono-jsx";
252
269
  exports.Fragment = Fragment;
253
270
  exports.JSXFragmentNode = JSXFragmentNode;
254
271
  exports.JSXNode = JSXNode;
272
+ exports.attributeToBuffer = attributeToBuffer;
255
273
  exports.booleanAttributes = booleanAttributes;
256
274
  exports.cloneElement = cloneElement;
257
275
  exports.getNameSpaceContext = getNameSpaceContext;
@@ -259,6 +277,7 @@ exports.isUntrustedObject = isUntrustedObject;
259
277
  exports.isValidElement = isValidElement;
260
278
  exports.jsx = jsx;
261
279
  exports.jsxFn = jsxFn;
280
+ exports.markRenderedJSX = markRenderedJSX;
262
281
  exports.memo = memo;
263
282
  exports.reactAPICompatVersion = reactAPICompatVersion;
264
283
  exports.renderChildren = renderChildren;
@@ -78,7 +78,7 @@ const ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) =>
78
78
  buffer[0] = buffer[0].replace(replaceRe, () => fallbackResString);
79
79
  return fallbackCallbacks?.length ? require_utils_html.raw("", fallbackCallbacks) : "";
80
80
  }
81
- return require_utils_html.raw(`<template data-hono-target="E:${index}">${fallbackResString}</template><script>
81
+ return require_utils_html.raw(`<template data-hono-target="E:${index}">${fallbackResString}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
82
82
  ((d,c,n) => {
83
83
  c=d.currentScript.previousSibling
84
84
  d=d.getElementById('E:${index}')
@@ -119,7 +119,7 @@ d.parentElement.insertBefore(c.content,d.nextSibling)
119
119
  buffer[0] += content;
120
120
  return require_utils_html.raw("", content.callbacks);
121
121
  }
122
- return require_utils_html.raw(content + (resolvedCount !== callbacks.length ? "" : `<script>
122
+ return require_utils_html.raw(content + (resolvedCount !== callbacks.length ? "" : `<script${nonce ? ` nonce="${nonce}"` : ""}>
123
123
  ((d,c,n) => {
124
124
  d=d.getElementById('E:${index}')
125
125
  if(!d)return
@@ -6,6 +6,7 @@ const DOM_STASH = Symbol("STASH");
6
6
  const DOM_INTERNAL_TAG = Symbol("INTERNAL");
7
7
  const DOM_MEMO = Symbol("MEMO");
8
8
  const PERMALINK = Symbol("PERMALINK");
9
+ const RENDERED_JSX = Symbol("RENDERED_JSX");
9
10
  //#endregion
10
11
  exports.DOM_ERROR_HANDLER = DOM_ERROR_HANDLER;
11
12
  exports.DOM_INTERNAL_TAG = DOM_INTERNAL_TAG;
@@ -13,3 +14,4 @@ exports.DOM_MEMO = DOM_MEMO;
13
14
  exports.DOM_RENDERER = DOM_RENDERER;
14
15
  exports.DOM_STASH = DOM_STASH;
15
16
  exports.PERMALINK = PERMALINK;
17
+ exports.RENDERED_JSX = RENDERED_JSX;
@@ -1,30 +1,26 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_html = require("../utils/html.js");
3
3
  const require_helper_html_index = require("../helper/html/index.js");
4
+ const require_jsx_constants = require("./constants.js");
4
5
  const require_jsx_utils = require("./utils.js");
5
6
  const require_jsx_base = require("./base.js");
6
7
  const require_jsx_jsx_dev_runtime = require("./jsx-dev-runtime.js");
7
8
  //#region src/jsx/jsx-runtime.ts
9
+ const jsxTemplate = (strings, ...values) => {
10
+ const result = require_helper_html_index.html(strings, ...values);
11
+ return result instanceof Promise ? result.then(require_jsx_base.markRenderedJSX) : require_jsx_base.markRenderedJSX(result);
12
+ };
8
13
  const jsxAttr = (key, v) => {
9
14
  if (!require_jsx_utils.isValidAttributeName(key)) return require_utils_html.raw("");
10
- const buffer = [`${key}="`];
11
- if (key === "style" && typeof v === "object") {
12
- let styleStr = "";
13
- require_jsx_utils.styleObjectForEach(v, (property, value) => {
14
- if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
15
- });
16
- require_utils_html.escapeToBuffer(styleStr, buffer);
17
- buffer[0] += "\"";
18
- } else if (typeof v === "string") {
15
+ if (typeof v === "string") {
16
+ const buffer = [`${key}="`];
19
17
  require_utils_html.escapeToBuffer(v, buffer);
20
- buffer[0] += "\"";
21
- } else if (v === null || v === void 0) return require_utils_html.raw("");
22
- else if (typeof v === "number" || v.isEscaped) buffer[0] += `${v}"`;
23
- else if (v instanceof Promise) buffer.unshift("\"", v);
24
- else {
25
- require_utils_html.escapeToBuffer(v.toString(), buffer);
26
- buffer[0] += "\"";
18
+ return require_utils_html.raw(buffer[0] + "\"");
27
19
  }
20
+ let value = v;
21
+ if (typeof value === "function" && (key === "action" || key === "formaction")) value = require_jsx_constants.PERMALINK in value ? value[require_jsx_constants.PERMALINK] : void 0;
22
+ const buffer = [""];
23
+ require_jsx_base.attributeToBuffer(buffer, "", key, value);
28
24
  return buffer.length === 1 ? require_utils_html.raw(buffer[0]) : require_utils_html.stringBufferToString(buffer, void 0);
29
25
  };
30
26
  const jsxEscape = (value) => value;
@@ -33,5 +29,5 @@ exports.Fragment = require_jsx_base.Fragment;
33
29
  exports.jsx = require_jsx_jsx_dev_runtime.jsxDEV;
34
30
  exports.jsxAttr = jsxAttr;
35
31
  exports.jsxEscape = jsxEscape;
36
- exports.jsxTemplate = require_helper_html_index.html;
32
+ exports.jsxTemplate = jsxTemplate;
37
33
  exports.jsxs = require_jsx_jsx_dev_runtime.jsxDEV;
@@ -17,7 +17,8 @@ const RETAINED_304_HEADERS = [
17
17
  ];
18
18
  const stripWeak = (tag) => tag.replace(/^W\//, "");
19
19
  function etagMatches(etag, ifNoneMatch) {
20
- return ifNoneMatch != null && ifNoneMatch.split(",").some((t) => stripWeak(t.trim()) === stripWeak(etag));
20
+ const expected = stripWeak(etag);
21
+ return ifNoneMatch?.match(/"[^"]*"/g)?.some((tag) => tag === expected) ?? false;
21
22
  }
22
23
  function initializeGenerator(generator) {
23
24
  if (!generator) {
@@ -65,6 +66,7 @@ const etag = (options) => {
65
66
  etag = weak ? `W/"${hash}"` : `"${hash}"`;
66
67
  }
67
68
  if (ifNoneMatch === "*" || etagMatches(etag, ifNoneMatch)) {
69
+ await res.body?.cancel();
68
70
  c.res = new Response(null, {
69
71
  status: 304,
70
72
  statusText: "Not Modified",
@@ -32,6 +32,7 @@ const prettyJSON = (options) => {
32
32
  } catch {
33
33
  return;
34
34
  }
35
+ await c.res.body?.cancel();
35
36
  c.res = new Response(JSON.stringify(obj, null, options?.space ?? 2), c.res);
36
37
  c.res.headers.delete("Content-Length");
37
38
  }
@@ -75,6 +75,7 @@ const timing = (config) => {
75
75
  }
76
76
  };
77
77
  };
78
+ const quote = (s) => `"${s.replace(/[\\"]/g, "\\$&")}"`;
78
79
  /**
79
80
  * Set a metric for the timing middleware.
80
81
  *
@@ -97,11 +98,11 @@ const setMetric = (c, name, valueDescription, description, precision) => {
97
98
  return;
98
99
  }
99
100
  if (typeof valueDescription === "number") {
100
- const dur = valueDescription.toFixed(precision || 1);
101
- const metric = description ? `${name};dur=${dur};desc="${description}"` : `${name};dur=${dur}`;
101
+ const dur = valueDescription.toFixed(precision ?? 1);
102
+ const metric = description ? `${name};dur=${dur};desc=${quote(description)}` : `${name};dur=${dur}`;
102
103
  metrics.headers.push(metric);
103
104
  } else {
104
- const metric = valueDescription ? `${name};desc="${valueDescription}"` : `${name}`;
105
+ const metric = valueDescription ? `${name};desc=${quote(valueDescription)}` : `${name}`;
105
106
  metrics.headers.push(metric);
106
107
  }
107
108
  };
@@ -80,8 +80,8 @@ const parseSigned = async (cookie, secret, name) => {
80
80
  const _serialize = (name, value, opt = {}) => {
81
81
  if (!validCookieNameRegEx.test(name)) throw new Error("Invalid cookie name");
82
82
  let cookie = `${name}=${value}`;
83
- if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
84
- if (name.startsWith("__Host-")) {
83
+ if (/^__secure-/i.test(name) && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
84
+ if (/^__host-/i.test(name)) {
85
85
  if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
86
86
  if (opt.path !== "/") throw new Error("__Host- Cookie must have Path attributes with \"/\"");
87
87
  if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
@@ -10,7 +10,7 @@ const getMimeType = (filename, mimes = baseMimes) => {
10
10
  return mimes[match[1].toLowerCase()];
11
11
  };
12
12
  const getExtension = (mimeType) => {
13
- const baseType = mimeType.split(";", 1)[0].trim();
13
+ const baseType = mimeType.split(";", 1)[0].trim().toLowerCase();
14
14
  for (const ext in baseMimes) {
15
15
  const stored = baseMimes[ext];
16
16
  if (stored === mimeType || stored.split(";", 1)[0].trim() === baseType) return ext;
@@ -162,7 +162,7 @@ const _getQueryParam = (url, key, multiple) => {
162
162
  const hashIndex = url.indexOf("#", 8);
163
163
  if (hashIndex !== -1) url = url.slice(0, hashIndex);
164
164
  let encoded;
165
- if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
165
+ if (!multiple && key && !/[%+&=]/.test(key)) {
166
166
  const queryIndex = url.indexOf("?", 8);
167
167
  let keyIndex = queryIndex;
168
168
  if (keyIndex === -1) return;
@@ -57,7 +57,7 @@ const jsonRegex = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;
57
57
  function detectResponseType(response) {
58
58
  const _contentType = response.headers.get("content-type");
59
59
  if (!_contentType) return "text";
60
- const contentType = _contentType.split(";").shift();
60
+ const contentType = _contentType.split(";").shift().trim();
61
61
  if (jsonRegex.test(contentType)) return "json";
62
62
  return "text";
63
63
  }
@@ -19,12 +19,13 @@ const getSpecificity = (type) => {
19
19
  };
20
20
  const defaultMatch = (accepts, config) => {
21
21
  const { supports, default: defaultSupport } = config;
22
+ const exactTypes = new Set(accepts.filter((accept) => getSpecificity(accept.type) === 3).map((accept) => accept.type.toLowerCase()));
22
23
  const sortedAccepts = accepts.filter((accept) => accept.q > 0).sort((a, b) => {
23
24
  if (b.q !== a.q) return b.q - a.q;
24
25
  return getSpecificity(b.type) - getSpecificity(a.type);
25
26
  });
26
27
  for (const accept of sortedAccepts) {
27
- const matched = supports.find((supported) => matchType(accept.type, supported));
28
+ const matched = supports.find((supported) => matchType(accept.type, supported) && (getSpecificity(accept.type) !== 2 || !exactTypes.has(supported.toLowerCase())));
28
29
  if (matched) return matched;
29
30
  }
30
31
  return defaultSupport;
@@ -38,6 +38,8 @@ const defaultExtensionMap = {
38
38
  const determineExtension = (mimeType, userExtensionMap) => {
39
39
  const extensionMap = userExtensionMap || defaultExtensionMap;
40
40
  if (mimeType in extensionMap) return extensionMap[mimeType];
41
+ const lowerCasedMimeType = mimeType.toLowerCase();
42
+ if (lowerCasedMimeType in extensionMap) return extensionMap[lowerCasedMimeType];
41
43
  return getExtension(mimeType) || "html";
42
44
  };
43
45
  const combineBeforeRequestHooks = (hooks) => {
@@ -141,8 +143,7 @@ const fetchRoutesContent = function* (app, beforeRequestHook, afterResponseHook,
141
143
  * `saveContentToFile` is an experimental feature.
142
144
  * The API might be changed.
143
145
  */
144
- const createdDirs = /* @__PURE__ */ new Set();
145
- const saveContentToFile = async (data, fsModule, outDir, extensionMap) => {
146
+ const saveContentToFile = async (data, fsModule, outDir, extensionMap, createdDirs = /* @__PURE__ */ new Set()) => {
146
147
  const awaitedData = await data;
147
148
  if (!awaitedData) return;
148
149
  const { routePath, content, mimeType } = awaitedData;
@@ -182,10 +183,11 @@ const toSSG = async (app, fs, options) => {
182
183
  const concurrency = options?.concurrency ?? DEFAULT_CONCURRENCY;
183
184
  const combinedBeforeRequestHook = combineBeforeRequestHooks(beforeRequestHooks.length > 0 ? beforeRequestHooks : [(req) => req]);
184
185
  const combinedAfterResponseHook = combineAfterResponseHooks(afterResponseHooks.length > 0 ? afterResponseHooks : [(req) => req]);
186
+ const createdDirs = /* @__PURE__ */ new Set();
185
187
  const getInfoGen = fetchRoutesContent(app, combinedBeforeRequestHook, combinedAfterResponseHook, concurrency);
186
188
  for (const getInfo of getInfoGen) getInfoPromises.push(getInfo.then((getContentGen) => {
187
189
  if (!getContentGen) return;
188
- for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap).catch((e) => e));
190
+ for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap, createdDirs).catch((e) => e));
189
191
  }));
190
192
  await Promise.all(getInfoPromises);
191
193
  const files = [];