@pyreon/zero 0.12.1 → 0.12.3

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 (140) hide show
  1. package/lib/actions.js +97 -0
  2. package/lib/actions.js.map +1 -0
  3. package/lib/ai.js +503 -0
  4. package/lib/ai.js.map +1 -0
  5. package/lib/api-routes.js +137 -0
  6. package/lib/api-routes.js.map +1 -0
  7. package/lib/compression.js +80 -0
  8. package/lib/compression.js.map +1 -0
  9. package/lib/cors.js +57 -0
  10. package/lib/cors.js.map +1 -0
  11. package/lib/csp.js +119 -0
  12. package/lib/csp.js.map +1 -0
  13. package/lib/env.js +217 -0
  14. package/lib/env.js.map +1 -0
  15. package/lib/favicon.js +424 -0
  16. package/lib/favicon.js.map +1 -0
  17. package/lib/i18n-routing.js +167 -0
  18. package/lib/i18n-routing.js.map +1 -0
  19. package/lib/index.js +1631 -179
  20. package/lib/index.js.map +1 -1
  21. package/lib/link.js +5 -0
  22. package/lib/link.js.map +1 -1
  23. package/lib/logger.js +78 -0
  24. package/lib/logger.js.map +1 -0
  25. package/lib/meta.js +336 -0
  26. package/lib/meta.js.map +1 -0
  27. package/lib/middleware.js +53 -0
  28. package/lib/middleware.js.map +1 -0
  29. package/lib/og-image.js +233 -0
  30. package/lib/og-image.js.map +1 -0
  31. package/lib/rate-limit.js +76 -0
  32. package/lib/rate-limit.js.map +1 -0
  33. package/lib/testing.js +179 -0
  34. package/lib/testing.js.map +1 -0
  35. package/lib/theme.js +11 -2
  36. package/lib/theme.js.map +1 -1
  37. package/lib/types/actions.d.ts +27 -24
  38. package/lib/types/actions.d.ts.map +1 -1
  39. package/lib/types/ai.d.ts +163 -0
  40. package/lib/types/ai.d.ts.map +1 -0
  41. package/lib/types/api-routes.d.ts +37 -33
  42. package/lib/types/api-routes.d.ts.map +1 -1
  43. package/lib/types/cache.d.ts +26 -22
  44. package/lib/types/cache.d.ts.map +1 -1
  45. package/lib/types/client.d.ts +13 -9
  46. package/lib/types/client.d.ts.map +1 -1
  47. package/lib/types/compression.d.ts +14 -10
  48. package/lib/types/compression.d.ts.map +1 -1
  49. package/lib/types/config.d.ts +39 -4
  50. package/lib/types/config.d.ts.map +1 -1
  51. package/lib/types/cors.d.ts +20 -16
  52. package/lib/types/cors.d.ts.map +1 -1
  53. package/lib/types/csp.d.ts +88 -0
  54. package/lib/types/csp.d.ts.map +1 -0
  55. package/lib/types/env.d.ts +118 -0
  56. package/lib/types/env.d.ts.map +1 -0
  57. package/lib/types/favicon.d.ts +70 -24
  58. package/lib/types/favicon.d.ts.map +1 -1
  59. package/lib/types/font.d.ts +68 -65
  60. package/lib/types/font.d.ts.map +1 -1
  61. package/lib/types/i18n-routing.d.ts +43 -37
  62. package/lib/types/i18n-routing.d.ts.map +1 -1
  63. package/lib/types/image-plugin.d.ts +49 -45
  64. package/lib/types/image-plugin.d.ts.map +1 -1
  65. package/lib/types/image.d.ts +47 -36
  66. package/lib/types/image.d.ts.map +1 -1
  67. package/lib/types/index.d.ts +1961 -46
  68. package/lib/types/index.d.ts.map +1 -1
  69. package/lib/types/link.d.ts +61 -56
  70. package/lib/types/link.d.ts.map +1 -1
  71. package/lib/types/logger.d.ts +57 -0
  72. package/lib/types/logger.d.ts.map +1 -0
  73. package/lib/types/meta.d.ts +180 -69
  74. package/lib/types/meta.d.ts.map +1 -1
  75. package/lib/types/middleware.d.ts +8 -4
  76. package/lib/types/middleware.d.ts.map +1 -1
  77. package/lib/types/og-image.d.ts +111 -0
  78. package/lib/types/og-image.d.ts.map +1 -0
  79. package/lib/types/rate-limit.d.ts +20 -16
  80. package/lib/types/rate-limit.d.ts.map +1 -1
  81. package/lib/types/script.d.ts +23 -19
  82. package/lib/types/script.d.ts.map +1 -1
  83. package/lib/types/seo.d.ts +47 -43
  84. package/lib/types/seo.d.ts.map +1 -1
  85. package/lib/types/testing.d.ts +64 -27
  86. package/lib/types/testing.d.ts.map +1 -1
  87. package/lib/types/theme.d.ts +22 -12
  88. package/lib/types/theme.d.ts.map +1 -1
  89. package/package.json +37 -12
  90. package/src/actions.ts +1 -3
  91. package/src/adapters/bun.ts +2 -0
  92. package/src/adapters/cloudflare.ts +84 -0
  93. package/src/adapters/index.ts +13 -1
  94. package/src/adapters/netlify.ts +86 -0
  95. package/src/adapters/node.ts +2 -0
  96. package/src/adapters/validate.ts +16 -0
  97. package/src/adapters/vercel.ts +86 -0
  98. package/src/ai.ts +623 -0
  99. package/src/compression.ts +19 -3
  100. package/src/csp.ts +207 -0
  101. package/src/entry-server.ts +28 -5
  102. package/src/env.ts +344 -0
  103. package/src/favicon.ts +221 -80
  104. package/src/index.ts +42 -2
  105. package/src/link.tsx +6 -0
  106. package/src/logger.ts +144 -0
  107. package/src/meta.tsx +124 -14
  108. package/src/og-image.ts +378 -0
  109. package/src/rate-limit.ts +11 -9
  110. package/src/theme.tsx +12 -1
  111. package/src/types.ts +1 -1
  112. package/src/vite-plugin.ts +5 -1
  113. package/lib/types/adapters/bun.d.ts +0 -6
  114. package/lib/types/adapters/bun.d.ts.map +0 -1
  115. package/lib/types/adapters/index.d.ts +0 -10
  116. package/lib/types/adapters/index.d.ts.map +0 -1
  117. package/lib/types/adapters/node.d.ts +0 -6
  118. package/lib/types/adapters/node.d.ts.map +0 -1
  119. package/lib/types/adapters/static.d.ts +0 -7
  120. package/lib/types/adapters/static.d.ts.map +0 -1
  121. package/lib/types/app.d.ts +0 -24
  122. package/lib/types/app.d.ts.map +0 -1
  123. package/lib/types/entry-server.d.ts +0 -37
  124. package/lib/types/entry-server.d.ts.map +0 -1
  125. package/lib/types/error-overlay.d.ts +0 -6
  126. package/lib/types/error-overlay.d.ts.map +0 -1
  127. package/lib/types/fs-router.d.ts +0 -47
  128. package/lib/types/fs-router.d.ts.map +0 -1
  129. package/lib/types/isr.d.ts +0 -9
  130. package/lib/types/isr.d.ts.map +0 -1
  131. package/lib/types/not-found.d.ts +0 -7
  132. package/lib/types/not-found.d.ts.map +0 -1
  133. package/lib/types/types.d.ts +0 -111
  134. package/lib/types/types.d.ts.map +0 -1
  135. package/lib/types/utils/use-intersection-observer.d.ts +0 -10
  136. package/lib/types/utils/use-intersection-observer.d.ts.map +0 -1
  137. package/lib/types/utils/with-headers.d.ts +0 -6
  138. package/lib/types/utils/with-headers.d.ts.map +0 -1
  139. package/lib/types/vite-plugin.d.ts +0 -17
  140. package/lib/types/vite-plugin.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"api-routes.d.ts","sourceRoot":"","sources":["../../src/api-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,gBAAgB,CAAA;AAInE,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEzF,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,kBAAkB;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,uBAAuB;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qCAAqC;AACrC,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE1E,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,UAAU,CAAA;IAChB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,GAAG,CAAC,EAAE,UAAU,CAAA;IAChB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AAED,oCAAoC;AACpC,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAA;IACf,6CAA6C;IAC7C,MAAM,EAAE,cAAc,CAAA;CACvB;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA8B1F;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CA8BvE;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkC7D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsBjF"}
1
+ {"version":3,"file":"api-routes2.d.ts","names":[],"sources":["../../../src/api-routes.ts"],"mappings":";;;;KAKY,UAAA;AAAZ;AAAA,UAGiB,UAAA;;EAEf,OAAA,EAAS,OAAA;EALW;EAOpB,GAAA,EAAK,GAAA;EAJoB;EAMzB,IAAA;EAJS;EAMT,MAAA,EAAQ,MAAA;EAAA;EAER,OAAA,EAAS,OAAA;AAAA;;KAIC,UAAA,IAAc,GAAA,EAAK,UAAA,KAAe,QAAA,GAAW,OAAA,CAAQ,QAAA;;UAGhD,cAAA;EACf,GAAA,GAAM,UAAA;EACN,IAAA,GAAO,UAAA;EACP,GAAA,GAAM,UAAA;EACN,KAAA,GAAQ,UAAA;EACR,MAAA,GAAS,UAAA;EACT,IAAA,GAAO,UAAA;EACP,OAAA,GAAU,UAAA;AAAA;AAVZ;AAAA,UAciB,aAAA;;EAEf,OAAA;EAhB4C;EAkB5C,MAAA,EAAQ,cAAA;AAAA;;;;;iBASM,aAAA,CAAc,OAAA,UAAiB,IAAA,WAAe,MAAA;;;;;iBAwC9C,mBAAA,CAAoB,MAAA,EAAQ,aAAA,KAAkB,UAAA;;;;;iBAsC9C,UAAA,CAAW,QAAA;;;;;;;;;;iBAmBX,oBAAA,CAAqB,QAAA;;;;;iBAwCrB,sBAAA,CAAuB,KAAA,YAAiB,SAAA"}
@@ -1,24 +1,26 @@
1
- import type { Middleware } from '@pyreon/server';
2
- export interface CacheConfig {
3
- /** Cache duration for immutable hashed assets (seconds). Default: 31536000 (1 year) */
4
- immutable?: number;
5
- /** Cache duration for static assets like images/fonts (seconds). Default: 86400 (1 day) */
6
- static?: number;
7
- /** Cache duration for pages (seconds). Default: 0 (no cache) */
8
- pages?: number;
9
- /** Stale-while-revalidate window for pages (seconds). Default: 60 */
10
- staleWhileRevalidate?: number;
11
- /** Custom rules by URL pattern. */
12
- rules?: CacheRule[];
1
+ import { Middleware } from "@pyreon/server";
2
+
3
+ //#region src/cache.d.ts
4
+ interface CacheConfig {
5
+ /** Cache duration for immutable hashed assets (seconds). Default: 31536000 (1 year) */
6
+ immutable?: number;
7
+ /** Cache duration for static assets like images/fonts (seconds). Default: 86400 (1 day) */
8
+ static?: number;
9
+ /** Cache duration for pages (seconds). Default: 0 (no cache) */
10
+ pages?: number;
11
+ /** Stale-while-revalidate window for pages (seconds). Default: 60 */
12
+ staleWhileRevalidate?: number;
13
+ /** Custom rules by URL pattern. */
14
+ rules?: CacheRule[];
13
15
  }
14
- export interface CacheRule {
15
- /** URL pattern to match (glob-style). e.g. "/api/*" */
16
- match: string;
17
- /** Cache-Control header value. */
18
- control: string;
16
+ interface CacheRule {
17
+ /** URL pattern to match (glob-style). e.g. "/api/*" */
18
+ match: string;
19
+ /** Cache-Control header value. */
20
+ control: string;
19
21
  }
20
22
  /** @internal Exported for testing */
21
- export declare function matchGlob(pattern: string, path: string): boolean;
23
+ declare function matchGlob(pattern: string, path: string): boolean;
22
24
  /**
23
25
  * Cache control middleware for Zero.
24
26
  * Sets Cache-Control headers on the response based on asset type.
@@ -39,16 +41,18 @@ export declare function matchGlob(pattern: string, path: string): boolean;
39
41
  * ],
40
42
  * })
41
43
  */
42
- export declare function cacheMiddleware(config?: CacheConfig): Middleware;
44
+ declare function cacheMiddleware(config?: CacheConfig): Middleware;
43
45
  /**
44
46
  * Security headers middleware.
45
47
  * Adds common security headers to all responses.
46
48
  */
47
- export declare function securityHeaders(): Middleware;
49
+ declare function securityHeaders(): Middleware;
48
50
  /**
49
51
  * Compression detection middleware.
50
52
  * Sets Vary: Accept-Encoding header so caches can serve compressed variants.
51
53
  * Actual compression is handled by the runtime (Bun/Node) or reverse proxy.
52
54
  */
53
- export declare function varyEncoding(): Middleware;
54
- //# sourceMappingURL=cache.d.ts.map
55
+ declare function varyEncoding(): Middleware;
56
+ //#endregion
57
+ export { CacheConfig, CacheRule, cacheMiddleware, matchGlob, securityHeaders, varyEncoding };
58
+ //# sourceMappingURL=cache2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,gBAAgB,CAAA;AAanE,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qEAAqE;IACrE,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAA;CAChB;AAMD,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAKhE;AAwBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,WAAgB,GAAG,UAAU,CAoBpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,UAAU,CAQ5C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,UAAU,CAOzC"}
1
+ {"version":3,"file":"cache2.d.ts","names":[],"sources":["../../../src/cache.ts"],"mappings":";;;UAaiB,WAAA;;EAEf,SAAA;EAF0B;EAI1B,MAAA;EAMiB;EAJjB,KAAA;EAFA;EAIA,oBAAA;EAAA;EAEA,KAAA,GAAQ,SAAA;AAAA;AAAA,UAGO,SAAA;EAHE;EAKjB,KAAA;EAFwB;EAIxB,OAAA;AAAA;;iBAQc,SAAA,CAAU,OAAA,UAAiB,IAAA;;;;;AAiD3C;;;;;;;;;AA0BA;;;;;AAeA;;iBAzCgB,eAAA,CAAgB,MAAA,GAAQ,WAAA,GAAmB,UAAA;;;;;iBA0B3C,eAAA,CAAA,GAAmB,UAAA;;;;;;iBAenB,YAAA,CAAA,GAAgB,UAAA"}
@@ -1,10 +1,12 @@
1
- import type { ComponentFn } from '@pyreon/core';
2
- import type { RouteRecord } from '@pyreon/router';
3
- export interface StartClientOptions {
4
- /** Route definitions. */
5
- routes: RouteRecord[];
6
- /** Root layout component. */
7
- layout?: ComponentFn;
1
+ import { ComponentFn } from "@pyreon/core";
2
+ import { RouteRecord } from "@pyreon/router";
3
+
4
+ //#region src/client.d.ts
5
+ interface StartClientOptions {
6
+ /** Route definitions. */
7
+ routes: RouteRecord[];
8
+ /** Root layout component. */
9
+ layout?: ComponentFn;
8
10
  }
9
11
  /**
10
12
  * Start the client-side app — hydrates SSR content or mounts fresh for SPA.
@@ -15,5 +17,7 @@ export interface StartClientOptions {
15
17
  *
16
18
  * startClient({ routes })
17
19
  */
18
- export declare function startClient(options: StartClientOptions): () => void;
19
- //# sourceMappingURL=client.d.ts.map
20
+ declare function startClient(options: StartClientOptions): () => void;
21
+ //#endregion
22
+ export { StartClientOptions, startClient };
23
+ //# sourceMappingURL=client2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,cAkBtD"}
1
+ {"version":3,"file":"client2.d.ts","names":[],"sources":["../../../src/client.ts"],"mappings":";;;;UAQiB,kBAAA;;EAEf,MAAA,EAAQ,WAAA;EAFyB;EAIjC,MAAA,GAAS,WAAA;AAAA;;;;;;;AAYX;;;iBAAgB,WAAA,CAAY,OAAA,EAAS,kBAAA"}
@@ -1,9 +1,11 @@
1
- import type { Middleware } from '@pyreon/server';
2
- export interface CompressionConfig {
3
- /** Minimum response size in bytes to compress. Default: `1024` (1KB) */
4
- threshold?: number;
5
- /** Encoding preference order. Default: `["gzip", "deflate"]` */
6
- encodings?: ('gzip' | 'deflate')[];
1
+ import { Middleware } from "@pyreon/server";
2
+
3
+ //#region src/compression.d.ts
4
+ interface CompressionConfig {
5
+ /** Minimum response size in bytes to compress. Default: `1024` (1KB) */
6
+ threshold?: number;
7
+ /** Encoding preference order. Default: `["gzip", "deflate"]` */
8
+ encodings?: ('gzip' | 'deflate')[];
7
9
  }
8
10
  /**
9
11
  * Compression middleware — compresses responses using gzip or deflate
@@ -18,7 +20,7 @@ export interface CompressionConfig {
18
20
  * compressionMiddleware() // gzip with 1KB threshold
19
21
  * compressionMiddleware({ threshold: 512, encodings: ["gzip"] })
20
22
  */
21
- export declare function compressionMiddleware(config?: CompressionConfig): Middleware;
23
+ declare function compressionMiddleware(config?: CompressionConfig): Middleware;
22
24
  /**
23
25
  * Compress a Response body if it meets the criteria.
24
26
  * Use this to post-process responses after the handler runs.
@@ -27,7 +29,9 @@ export declare function compressionMiddleware(config?: CompressionConfig): Middl
27
29
  * const response = await handler(request)
28
30
  * const compressed = await compressResponse(response, 'gzip', 1024)
29
31
  */
30
- export declare function compressResponse(response: Response, encoding: 'gzip' | 'deflate', threshold: number): Promise<Response>;
32
+ declare function compressResponse(response: Response, encoding: 'gzip' | 'deflate', threshold: number): Promise<Response>;
31
33
  /** Check if a content type is compressible. Exported for testing. */
32
- export declare function isCompressible(contentType: string): boolean;
33
- //# sourceMappingURL=compression.d.ts.map
34
+ declare function isCompressible(contentType: string): boolean;
35
+ //#endregion
36
+ export { CompressionConfig, compressResponse, compressionMiddleware, isCompressible };
37
+ //# sourceMappingURL=compression2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../src/compression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,gBAAgB,CAAA;AAInE,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,iBAAsB,GAAG,UAAU,CAehF;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CA0BnB;AAWD,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE3D"}
1
+ {"version":3,"file":"compression2.d.ts","names":[],"sources":["../../../src/compression.ts"],"mappings":";;;UAIiB,iBAAA;;EAEf,SAAA;EAFgC;EAIhC,SAAA;AAAA;;AAgBF;;;;;;;;;AAyBA;;;iBAzBgB,qBAAA,CAAsB,MAAA,GAAQ,iBAAA,GAAyB,UAAA;;;;;;;;;iBAyBjD,gBAAA,CACpB,QAAA,EAAU,QAAA,EACV,QAAA,sBACA,SAAA,WACC,OAAA,CAAQ,QAAA;;iBAsCK,cAAA,CAAe,WAAA"}
@@ -1,4 +1,37 @@
1
- import type { ZeroConfig } from './types';
1
+ import { Middleware } from "@pyreon/server";
2
+
3
+ //#region src/types.d.ts
4
+ type RenderMode = 'ssr' | 'ssg' | 'spa' | 'isr';
5
+ interface ISRConfig {
6
+ /** Revalidation interval in seconds. */
7
+ revalidate: number;
8
+ }
9
+ interface ZeroConfig {
10
+ /** Default rendering mode. Default: "ssr" */
11
+ mode?: RenderMode;
12
+ /** Vite config overrides. */
13
+ vite?: Record<string, unknown>;
14
+ /** SSR options. */
15
+ ssr?: {
16
+ /** Streaming mode. Default: "string" */mode?: 'string' | 'stream';
17
+ };
18
+ /** SSG options — only used when mode is "ssg". */
19
+ ssg?: {
20
+ /** Paths to prerender (or function returning paths). */paths?: string[] | (() => string[] | Promise<string[]>);
21
+ };
22
+ /** ISR config — only used when mode is "isr". */
23
+ isr?: ISRConfig;
24
+ /** Deploy adapter. Default: "node" */
25
+ adapter?: 'node' | 'bun' | 'static' | 'vercel' | 'cloudflare' | 'netlify';
26
+ /** Base URL path. Default: "/" */
27
+ base?: string;
28
+ /** App-level middleware applied to all routes. */
29
+ middleware?: Middleware[];
30
+ /** Server port for dev/preview. Default: 3000 */
31
+ port?: number;
32
+ }
33
+ //#endregion
34
+ //#region src/config.d.ts
2
35
  /**
3
36
  * Define a Zero configuration.
4
37
  * Used in `zero.config.ts` at the project root.
@@ -12,7 +45,9 @@ import type { ZeroConfig } from './types';
12
45
  * port: 3000,
13
46
  * })
14
47
  */
15
- export declare function defineConfig(config: ZeroConfig): ZeroConfig;
48
+ declare function defineConfig(config: ZeroConfig): ZeroConfig;
16
49
  /** Merge user config with defaults. */
17
- export declare function resolveConfig(userConfig?: ZeroConfig): Required<Pick<ZeroConfig, 'mode' | 'base' | 'port' | 'adapter'>> & ZeroConfig;
18
- //# sourceMappingURL=config.d.ts.map
50
+ declare function resolveConfig(userConfig?: ZeroConfig): Required<Pick<ZeroConfig, 'mode' | 'base' | 'port' | 'adapter'>> & ZeroConfig;
51
+ //#endregion
52
+ export { defineConfig, resolveConfig };
53
+ //# sourceMappingURL=config2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAE3D;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,GAC1B,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,UAAU,CAY/E"}
1
+ {"version":3,"file":"config2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/config.ts"],"mappings":";;;KA6CY,UAAA;AAAA,UAEK,SAAA;EAoCF;EAlCb,UAAA;AAAA;AAAA,UAKe,UAAA;;EAEf,IAAA,GAAO,UAAA;;EAGP,IAAA,GAAO,MAAA;EC5CmB;ED+C1B,GAAA;IC/C0D,wCDiDxD,IAAA;EAAA;ECjD8C;EDqDhD,GAAA;ICrD0D,wDDuDxD,KAAA,gCAAqC,OAAA;EAAA;;EAIvC,GAAA,GAAM,SAAA;ECpDS;EDuDf,OAAA;ECvDC;ED0DD,IAAA;EC1D8E;ED6D9E,UAAA,GAAa,UAAA;EC9DD;EDiEZ,IAAA;AAAA;;;;;;;AAzCF;;;;;AAEA;;;;iBChCgB,YAAA,CAAa,MAAA,EAAQ,UAAA,GAAa,UAAA;ADuClD;AAAA,iBClCgB,aAAA,CACd,UAAA,GAAY,UAAA,GACX,QAAA,CAAS,IAAA,CAAK,UAAA,2CAAqD,UAAA"}
@@ -1,17 +1,19 @@
1
- import type { Middleware } from '@pyreon/server';
2
- export interface CorsConfig {
3
- /** Allowed origins. Use `"*"` for any origin. Default: `"*"` */
4
- origin?: string | string[] | ((origin: string) => boolean);
5
- /** Allowed HTTP methods. Default: `["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]` */
6
- methods?: string[];
7
- /** Allowed request headers. Default: `["Content-Type", "Authorization"]` */
8
- allowedHeaders?: string[];
9
- /** Headers exposed to the client. Default: `[]` */
10
- exposedHeaders?: string[];
11
- /** Allow credentials (cookies, auth headers). Default: `false` */
12
- credentials?: boolean;
13
- /** Preflight cache duration in seconds. Default: `86400` (24 hours) */
14
- maxAge?: number;
1
+ import { Middleware } from "@pyreon/server";
2
+
3
+ //#region src/cors.d.ts
4
+ interface CorsConfig {
5
+ /** Allowed origins. Use `"*"` for any origin. Default: `"*"` */
6
+ origin?: string | string[] | ((origin: string) => boolean);
7
+ /** Allowed HTTP methods. Default: `["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]` */
8
+ methods?: string[];
9
+ /** Allowed request headers. Default: `["Content-Type", "Authorization"]` */
10
+ allowedHeaders?: string[];
11
+ /** Headers exposed to the client. Default: `[]` */
12
+ exposedHeaders?: string[];
13
+ /** Allow credentials (cookies, auth headers). Default: `false` */
14
+ credentials?: boolean;
15
+ /** Preflight cache duration in seconds. Default: `86400` (24 hours) */
16
+ maxAge?: number;
15
17
  }
16
18
  /**
17
19
  * CORS middleware — handles preflight requests and sets appropriate
@@ -28,5 +30,7 @@ export interface CorsConfig {
28
30
  * // Multiple origins
29
31
  * corsMiddleware({ origin: ["https://app.com", "https://admin.com"] })
30
32
  */
31
- export declare function corsMiddleware(config?: CorsConfig): Middleware;
32
- //# sourceMappingURL=cors.d.ts.map
33
+ declare function corsMiddleware(config?: CorsConfig): Middleware;
34
+ //#endregion
35
+ export { CorsConfig, corsMiddleware };
36
+ //# sourceMappingURL=cors2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../src/cors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,gBAAgB,CAAA;AAInE,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAA;IAC1D,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,UAAe,GAAG,UAAU,CA0ClE"}
1
+ {"version":3,"file":"cors2.d.ts","names":[],"sources":["../../../src/cors.ts"],"mappings":";;;UAIiB,UAAA;;EAEf,MAAA,yBAA+B,MAAA;EAFN;EAIzB,OAAA;EAJyB;EAMzB,cAAA;EAJ+B;EAM/B,cAAA;EAFA;EAIA,WAAA;EAAA;EAEA,MAAA;AAAA;;AAqBF;;;;;;;;;;;;;;iBAAgB,cAAA,CAAe,MAAA,GAAQ,UAAA,GAAkB,UAAA"}
@@ -0,0 +1,88 @@
1
+ import { Middleware } from "@pyreon/server";
2
+
3
+ //#region src/csp.d.ts
4
+ /**
5
+ * Read the current CSP nonce in a component.
6
+ *
7
+ * SSR: reads from per-request `ctx.locals.cspNonce` via Pyreon's context
8
+ * system — fully isolated between concurrent requests via AsyncLocalStorage.
9
+ * Client/dev: falls back to module-level variable set by middleware.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { useNonce } from "@pyreon/zero/csp"
14
+ *
15
+ * function InlineScript() {
16
+ * const nonce = useNonce()
17
+ * return <script nonce={nonce}>console.log("safe")</script>
18
+ * }
19
+ * ```
20
+ */
21
+ declare function useNonce(): string;
22
+ interface CspDirectives {
23
+ defaultSrc?: string[];
24
+ scriptSrc?: string[];
25
+ styleSrc?: string[];
26
+ imgSrc?: string[];
27
+ fontSrc?: string[];
28
+ connectSrc?: string[];
29
+ mediaSrc?: string[];
30
+ objectSrc?: string[];
31
+ frameSrc?: string[];
32
+ childSrc?: string[];
33
+ workerSrc?: string[];
34
+ frameAncestors?: string[];
35
+ formAction?: string[];
36
+ baseUri?: string[];
37
+ manifestSrc?: string[];
38
+ /** Reporting endpoint URL. */
39
+ reportUri?: string;
40
+ /** Reporting endpoint name (CSP Level 3). */
41
+ reportTo?: string;
42
+ /** Upgrade insecure requests. */
43
+ upgradeInsecureRequests?: boolean;
44
+ /** Block all mixed content. */
45
+ blockAllMixedContent?: boolean;
46
+ }
47
+ interface CspConfig {
48
+ /** CSP directives. */
49
+ directives: CspDirectives;
50
+ /**
51
+ * Report-only mode — logs violations without blocking.
52
+ * Uses Content-Security-Policy-Report-Only header instead.
53
+ * Default: false
54
+ */
55
+ reportOnly?: boolean;
56
+ }
57
+ /**
58
+ * Build a CSP header string from directives.
59
+ * Exported for testing.
60
+ */
61
+ declare function buildCspHeader(directives: CspDirectives, nonce?: string): string;
62
+ /**
63
+ * CSP middleware — sets Content-Security-Policy header.
64
+ *
65
+ * When directives contain `"'nonce'"`, a fresh nonce is generated per-request
66
+ * and attached to `ctx.locals.cspNonce` for use in inline script tags.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * // Apply to all routes
71
+ * export default defineConfig({
72
+ * middleware: [
73
+ * cspMiddleware({
74
+ * directives: {
75
+ * defaultSrc: ["'self'"],
76
+ * scriptSrc: ["'self'", "'nonce'"],
77
+ * styleSrc: ["'self'", "'unsafe-inline'"],
78
+ * imgSrc: ["'self'", "data:", "https:"],
79
+ * },
80
+ * }),
81
+ * ],
82
+ * })
83
+ * ```
84
+ */
85
+ declare function cspMiddleware(config: CspConfig): Middleware;
86
+ //#endregion
87
+ export { CspConfig, CspDirectives, buildCspHeader, cspMiddleware, useNonce };
88
+ //# sourceMappingURL=csp2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp2.d.ts","names":[],"sources":["../../../src/csp.ts"],"mappings":";;;;;;;;;;;;AA8EA;;;;;;;;iBAhCgB,QAAA,CAAA;AAAA,UAMC,aAAA;EACf,UAAA;EACA,SAAA;EACA,QAAA;EACA,MAAA;EACA,OAAA;EACA,UAAA;EACA,QAAA;EACA,SAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EACA,cAAA;EACA,UAAA;EACA,OAAA;EACA,WAAA;EAmH0D;EAjH1D,SAAA;;EAEA,QAAA;;EAEA,uBAAA;;EAEA,oBAAA;AAAA;AAAA,UAGe,SAAA;;EAEf,UAAA,EAAY,aAAA;;;;;;EAMZ,UAAA;AAAA;;;;;iBA2Bc,cAAA,CAAe,UAAA,EAAY,aAAA,EAAe,KAAA;;;;;;;;;;;;;;;;;;;;;;;;iBAqE1C,aAAA,CAAc,MAAA,EAAQ,SAAA,GAAY,UAAA"}
@@ -0,0 +1,118 @@
1
+ //#region src/env.d.ts
2
+ /**
3
+ * Environment variable validation.
4
+ *
5
+ * Infers types from default values — no verbose validator imports needed.
6
+ * Explicit validators (`url()`, `oneOf()`) available for special cases.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { validateEnv, url, oneOf } from "@pyreon/zero/env"
11
+ *
12
+ * const env = validateEnv({
13
+ * PORT: 3000, // number, default 3000
14
+ * DEBUG: false, // boolean, default false
15
+ * HOST: "localhost", // string, default "localhost"
16
+ * DATABASE_URL: url(), // validated URL, required
17
+ * NODE_ENV: oneOf(["development", "production", "test"]),
18
+ * API_KEY: String, // required string, no default
19
+ * MAX_RETRIES: Number, // required number, no default
20
+ * })
21
+ * ```
22
+ */
23
+ interface EnvValidatorOptions<T = string> {
24
+ /** Whether this variable is required. Default: true */
25
+ required?: boolean;
26
+ /** Default value when not set. Makes the variable optional. */
27
+ default?: T;
28
+ /** Human-readable description for error messages. */
29
+ description?: string;
30
+ }
31
+ interface EnvValidator<T> {
32
+ __type: 'env-validator';
33
+ parse: (raw: string | undefined, key: string) => T;
34
+ required: boolean;
35
+ defaultValue?: T | undefined;
36
+ }
37
+ /**
38
+ * String validator — accepts any non-empty string.
39
+ */
40
+ declare function str(options?: EnvValidatorOptions<string>): EnvValidator<string>;
41
+ /**
42
+ * Number validator — parses to a number, rejects NaN.
43
+ */
44
+ declare function num(options?: EnvValidatorOptions<number>): EnvValidator<number>;
45
+ /**
46
+ * Boolean validator — accepts "true"/"1" as true, "false"/"0" as false.
47
+ */
48
+ declare function bool(options?: EnvValidatorOptions<boolean>): EnvValidator<boolean>;
49
+ /**
50
+ * URL validator — validates that the value is a valid URL.
51
+ */
52
+ declare function url(options?: EnvValidatorOptions<string>): EnvValidator<string>;
53
+ /**
54
+ * Enum validator — value must be one of the allowed values.
55
+ */
56
+ declare function oneOf<T extends string>(values: readonly T[], options?: EnvValidatorOptions<T>): EnvValidator<T>;
57
+ /** Schema entry: plain value, constructor, or explicit validator. */
58
+ type SchemaEntry = string | number | boolean | StringConstructor | NumberConstructor | BooleanConstructor | EnvValidator<any>;
59
+ /** Infer the output type from a schema entry. */
60
+ type InferEntry<T> = T extends EnvValidator<infer V> ? V : T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends string ? string : T extends number ? number : T extends boolean ? boolean : never;
61
+ type InferEnvSchema<T> = { [K in keyof T]: InferEntry<T[K]> };
62
+ /**
63
+ * Validate environment variables.
64
+ *
65
+ * Schema values can be:
66
+ * - **Default values**: `3000`, `false`, `"localhost"` → type inferred, used as default
67
+ * - **Constructors**: `String`, `Number`, `Boolean` → required, no default
68
+ * - **Validators**: `url()`, `oneOf([...])`, `str()`, `num()`, `bool()` → explicit validation
69
+ * - **Custom**: `schema(raw => z.coerce.number().parse(raw))` — bridge to any schema library
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { validateEnv, url, oneOf } from "@pyreon/zero/env"
74
+ *
75
+ * const env = validateEnv({
76
+ * PORT: 3000, // optional, default 3000
77
+ * DATABASE_URL: url(), // required, validated URL
78
+ * NODE_ENV: oneOf(["dev", "prod", "test"]), // required, must be one of
79
+ * API_KEY: String, // required string
80
+ * DEBUG: false, // optional, default false
81
+ * })
82
+ * ```
83
+ */
84
+ declare function validateEnv<T extends Record<string, SchemaEntry>>(schema: T, source?: Record<string, string | undefined>): InferEnvSchema<T>;
85
+ /**
86
+ * Extract public environment variables (prefixed with `ZERO_PUBLIC_`).
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const pub = publicEnv()
91
+ * // → { API_URL: "https://...", APP_NAME: "MyApp" }
92
+ *
93
+ * const pub = publicEnv({ API_URL: url(), APP_NAME: "Default" })
94
+ * // → validated against ZERO_PUBLIC_API_URL, ZERO_PUBLIC_APP_NAME
95
+ * ```
96
+ */
97
+ declare function publicEnv(): Record<string, string>;
98
+ declare function publicEnv<T extends Record<string, SchemaEntry>>(schema: T): InferEnvSchema<T>;
99
+ /**
100
+ * Create an env validator from a custom parse function.
101
+ * Use this to integrate any schema library (Zod, Valibot, ArkType, etc.).
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * import { z } from "zod"
106
+ * import { validateEnv, schema } from "@pyreon/zero/env"
107
+ *
108
+ * const env = validateEnv({
109
+ * PORT: schema(raw => z.coerce.number().parse(raw)),
110
+ * DATABASE_URL: schema(raw => z.string().url().parse(raw)),
111
+ * HOST: "localhost", // plain defaults still work alongside
112
+ * })
113
+ * ```
114
+ */
115
+ declare function schema<T>(parse: (raw: string) => T): EnvValidator<T>;
116
+ //#endregion
117
+ export { EnvValidator, EnvValidatorOptions, bool, num, oneOf, publicEnv, schema, str, url, validateEnv };
118
+ //# sourceMappingURL=env2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env2.d.ts","names":[],"sources":["../../../src/env.ts"],"mappings":";;AAsBA;;;;;;;;;;;AASA;;;;;;;;;UATiB,mBAAA;EAYf;EAVA,QAAA;EAWe;EATf,OAAA,GAAU,CAAA;EASM;EAPhB,WAAA;AAAA;AAAA,UAGe,YAAA;EACf,MAAA;EACA,KAAA,GAAQ,GAAA,sBAAyB,GAAA,aAAgB,CAAA;EACjD,QAAA;EACA,YAAA,GAAe,CAAA;AAAA;;AA2BjB;;iBAnBgB,GAAA,CAAI,OAAA,GAAU,mBAAA,WAA8B,YAAA;;;;iBAmB5C,GAAA,CAAI,OAAA,GAAU,mBAAA,WAA8B,YAAA;;;AAuB5D;iBAAgB,IAAA,CAAK,OAAA,GAAU,mBAAA,YAA+B,YAAA;;;;iBAsB9C,GAAA,CAAI,OAAA,GAAU,mBAAA,WAA8B,YAAA;;;;iBAwB5C,KAAA,kBAAA,CACd,MAAA,WAAiB,CAAA,IACjB,OAAA,GAAU,mBAAA,CAAoB,CAAA,IAC7B,YAAA,CAAa,CAAA;;KAmEX,WAAA,+BAED,iBAAA,GAAoB,iBAAA,GAAoB,kBAAA,GACxC,YAAA;;KAGC,UAAA,MACH,CAAA,SAAU,YAAA,YAAwB,CAAA,GAClC,CAAA,SAAU,iBAAA,YACV,CAAA,SAAU,iBAAA,YACV,CAAA,SAAU,kBAAA,aACV,CAAA,2BACA,CAAA,2BACA,CAAA;AAAA,KAGG,cAAA,oBACS,CAAA,GAAI,UAAA,CAAW,CAAA,CAAE,CAAA;;AAvF/B;;;;;;;;;;;;;;;;;;;;AAwBC;iBA0Fe,WAAA,WAAsB,MAAA,SAAe,WAAA,EAAA,CACnD,MAAA,EAAQ,CAAA,EACR,MAAA,GAAS,MAAA,+BACR,cAAA,CAAe,CAAA;;;;;;;;;;;;;iBAqCF,SAAA,CAAA,GAAa,MAAA;AAAA,iBACb,SAAA,WAAoB,MAAA,SAAe,WAAA,EAAA,CAAc,MAAA,EAAQ,CAAA,GAAI,cAAA,CAAe,CAAA;;;;;;;;;;;;;;;;;iBAwC5E,MAAA,GAAA,CAAU,KAAA,GAAQ,GAAA,aAAgB,CAAA,GAAI,YAAA,CAAa,CAAA"}
@@ -1,21 +1,49 @@
1
- import type { Plugin } from 'vite';
2
- export interface FaviconPluginConfig {
3
- /** Path to the source icon (SVG or PNG, at least 512x512 for PNG). */
4
- source: string;
5
- /** Theme color for web manifest. Default: "#ffffff" */
6
- themeColor?: string;
7
- /** Background color for web manifest. Default: "#ffffff" */
8
- backgroundColor?: string;
9
- /** App name for web manifest. Uses package.json name if not set. */
10
- name?: string;
11
- /** Generate web manifest. Default: true */
12
- manifest?: boolean;
13
- /**
14
- * Dark mode favicon (SVG only).
15
- * When provided, the SVG favicon uses prefers-color-scheme media query
16
- * to switch between light and dark variants.
17
- */
18
- darkSource?: string;
1
+ import { Plugin } from "vite";
2
+
3
+ //#region src/favicon.d.ts
4
+ interface FaviconLocaleConfig {
5
+ /** Locale-specific source icon (SVG or PNG). */
6
+ source: string;
7
+ /** Optional dark mode variant for this locale. */
8
+ darkSource?: string;
9
+ }
10
+ interface FaviconPluginConfig {
11
+ /** Path to the source icon (SVG or PNG, at least 512x512 for PNG). */
12
+ source: string;
13
+ /** Theme color for web manifest. Default: "#ffffff" */
14
+ themeColor?: string;
15
+ /** Background color for web manifest. Default: "#ffffff" */
16
+ backgroundColor?: string;
17
+ /** App name for web manifest. Uses package.json name if not set. */
18
+ name?: string;
19
+ /** Generate web manifest. Default: true */
20
+ manifest?: boolean;
21
+ /**
22
+ * Dark mode favicon (SVG only).
23
+ * When provided, the SVG favicon uses prefers-color-scheme media query
24
+ * to switch between light and dark variants.
25
+ */
26
+ darkSource?: string;
27
+ /**
28
+ * Locale-specific icon overrides. Each key is a locale code,
29
+ * value is a source icon (and optional dark variant).
30
+ * Locales not in this map use the base `source`.
31
+ *
32
+ * Generated files are placed under `/{locale}/` prefix:
33
+ * /de/favicon.svg, /de/favicon-32x32.png, etc.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * faviconPlugin({
38
+ * source: "./icon.svg",
39
+ * locales: {
40
+ * de: { source: "./icon-de.svg" },
41
+ * cs: { source: "./icon-cs.svg" },
42
+ * },
43
+ * })
44
+ * ```
45
+ */
46
+ locales?: Record<string, FaviconLocaleConfig>;
19
47
  }
20
48
  /**
21
49
  * Favicon generation Vite plugin.
@@ -33,11 +61,29 @@ export interface FaviconPluginConfig {
33
61
  * }
34
62
  * ```
35
63
  */
36
- export declare function faviconPlugin(config: FaviconPluginConfig): Plugin;
37
- export interface IcoEntry {
38
- buffer: Buffer;
39
- size: number;
64
+ declare function faviconPlugin(config: FaviconPluginConfig): Plugin;
65
+ /**
66
+ * Get favicon link tags for a specific locale.
67
+ * Returns link objects suitable for `useHead()` or direct HTML injection.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const links = faviconLinks("de", { source: "./icon.svg", locales: { de: { source: "./icon-de.svg" } } })
72
+ * // → [{ rel: "icon", type: "image/svg+xml", href: "/de/favicon.svg" }, ...]
73
+ * ```
74
+ */
75
+ declare function faviconLinks(locale: string | undefined, config: FaviconPluginConfig): Array<{
76
+ rel: string;
77
+ type?: string;
78
+ sizes?: string;
79
+ href: string;
80
+ }>;
81
+ interface IcoEntry {
82
+ buffer: Buffer;
83
+ size: number;
40
84
  }
41
85
  /** @internal Exported for testing */
42
- export declare function createIcoFromPngs(entries: IcoEntry[]): Uint8Array;
43
- //# sourceMappingURL=favicon.d.ts.map
86
+ declare function createIcoFromPngs(entries: IcoEntry[]): Uint8Array;
87
+ //#endregion
88
+ export { FaviconLocaleConfig, FaviconPluginConfig, IcoEntry, createIcoFromPngs, faviconLinks, faviconPlugin };
89
+ //# sourceMappingURL=favicon2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"favicon.d.ts","sourceRoot":"","sources":["../../src/favicon.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA0BlC,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAeD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAgNjE;AAuDD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,qCAAqC;AACrC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,CAiCjE"}
1
+ {"version":3,"file":"favicon2.d.ts","names":[],"sources":["../../../src/favicon.ts"],"mappings":";;;UA6BiB,mBAAA;;EAEf,MAAA;EAFkC;EAIlC,UAAA;AAAA;AAAA,UAGe,mBAAA;EAAA;EAEf,MAAA;;EAEA,UAAA;EAFA;EAIA,eAAA;EAAA;EAEA,IAAA;EAEA;EAAA,QAAA;EA0BA;;;;;EApBA,UAAA;EAoD2B;;;;;;;;AAmU7B;;;;;;;;;;;EAnWE,OAAA,GAAU,MAAA,SAAe,mBAAA;AAAA;;AAyZ3B;;;;;;;;;AAMA;;;;;;iBA/XgB,aAAA,CAAc,MAAA,EAAQ,mBAAA,GAAsB,MAAA;;;;;;;;;;;iBAmU5C,YAAA,CACd,MAAA,sBACA,MAAA,EAAQ,mBAAA,GACP,KAAA;EAAQ,GAAA;EAAa,IAAA;EAAe,KAAA;EAAgB,IAAA;AAAA;AAAA,UAmDtC,QAAA;EACf,MAAA,EAAQ,MAAA;EACR,IAAA;AAAA;;iBAIc,iBAAA,CAAkB,OAAA,EAAS,QAAA,KAAa,UAAA"}