@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.
- package/lib/actions.js +97 -0
- package/lib/actions.js.map +1 -0
- package/lib/ai.js +503 -0
- package/lib/ai.js.map +1 -0
- package/lib/api-routes.js +137 -0
- package/lib/api-routes.js.map +1 -0
- package/lib/compression.js +80 -0
- package/lib/compression.js.map +1 -0
- package/lib/cors.js +57 -0
- package/lib/cors.js.map +1 -0
- package/lib/csp.js +119 -0
- package/lib/csp.js.map +1 -0
- package/lib/env.js +217 -0
- package/lib/env.js.map +1 -0
- package/lib/favicon.js +424 -0
- package/lib/favicon.js.map +1 -0
- package/lib/i18n-routing.js +167 -0
- package/lib/i18n-routing.js.map +1 -0
- package/lib/index.js +1631 -179
- package/lib/index.js.map +1 -1
- package/lib/link.js +5 -0
- package/lib/link.js.map +1 -1
- package/lib/logger.js +78 -0
- package/lib/logger.js.map +1 -0
- package/lib/meta.js +336 -0
- package/lib/meta.js.map +1 -0
- package/lib/middleware.js +53 -0
- package/lib/middleware.js.map +1 -0
- package/lib/og-image.js +233 -0
- package/lib/og-image.js.map +1 -0
- package/lib/rate-limit.js +76 -0
- package/lib/rate-limit.js.map +1 -0
- package/lib/testing.js +179 -0
- package/lib/testing.js.map +1 -0
- package/lib/theme.js +11 -2
- package/lib/theme.js.map +1 -1
- package/lib/types/actions.d.ts +27 -24
- package/lib/types/actions.d.ts.map +1 -1
- package/lib/types/ai.d.ts +163 -0
- package/lib/types/ai.d.ts.map +1 -0
- package/lib/types/api-routes.d.ts +37 -33
- package/lib/types/api-routes.d.ts.map +1 -1
- package/lib/types/cache.d.ts +26 -22
- package/lib/types/cache.d.ts.map +1 -1
- package/lib/types/client.d.ts +13 -9
- package/lib/types/client.d.ts.map +1 -1
- package/lib/types/compression.d.ts +14 -10
- package/lib/types/compression.d.ts.map +1 -1
- package/lib/types/config.d.ts +39 -4
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/cors.d.ts +20 -16
- package/lib/types/cors.d.ts.map +1 -1
- package/lib/types/csp.d.ts +88 -0
- package/lib/types/csp.d.ts.map +1 -0
- package/lib/types/env.d.ts +118 -0
- package/lib/types/env.d.ts.map +1 -0
- package/lib/types/favicon.d.ts +70 -24
- package/lib/types/favicon.d.ts.map +1 -1
- package/lib/types/font.d.ts +68 -65
- package/lib/types/font.d.ts.map +1 -1
- package/lib/types/i18n-routing.d.ts +43 -37
- package/lib/types/i18n-routing.d.ts.map +1 -1
- package/lib/types/image-plugin.d.ts +49 -45
- package/lib/types/image-plugin.d.ts.map +1 -1
- package/lib/types/image.d.ts +47 -36
- package/lib/types/image.d.ts.map +1 -1
- package/lib/types/index.d.ts +1961 -46
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/link.d.ts +61 -56
- package/lib/types/link.d.ts.map +1 -1
- package/lib/types/logger.d.ts +57 -0
- package/lib/types/logger.d.ts.map +1 -0
- package/lib/types/meta.d.ts +180 -69
- package/lib/types/meta.d.ts.map +1 -1
- package/lib/types/middleware.d.ts +8 -4
- package/lib/types/middleware.d.ts.map +1 -1
- package/lib/types/og-image.d.ts +111 -0
- package/lib/types/og-image.d.ts.map +1 -0
- package/lib/types/rate-limit.d.ts +20 -16
- package/lib/types/rate-limit.d.ts.map +1 -1
- package/lib/types/script.d.ts +23 -19
- package/lib/types/script.d.ts.map +1 -1
- package/lib/types/seo.d.ts +47 -43
- package/lib/types/seo.d.ts.map +1 -1
- package/lib/types/testing.d.ts +64 -27
- package/lib/types/testing.d.ts.map +1 -1
- package/lib/types/theme.d.ts +22 -12
- package/lib/types/theme.d.ts.map +1 -1
- package/package.json +37 -12
- package/src/actions.ts +1 -3
- package/src/adapters/bun.ts +2 -0
- package/src/adapters/cloudflare.ts +84 -0
- package/src/adapters/index.ts +13 -1
- package/src/adapters/netlify.ts +86 -0
- package/src/adapters/node.ts +2 -0
- package/src/adapters/validate.ts +16 -0
- package/src/adapters/vercel.ts +86 -0
- package/src/ai.ts +623 -0
- package/src/compression.ts +19 -3
- package/src/csp.ts +207 -0
- package/src/entry-server.ts +28 -5
- package/src/env.ts +344 -0
- package/src/favicon.ts +221 -80
- package/src/index.ts +42 -2
- package/src/link.tsx +6 -0
- package/src/logger.ts +144 -0
- package/src/meta.tsx +124 -14
- package/src/og-image.ts +378 -0
- package/src/rate-limit.ts +11 -9
- package/src/theme.tsx +12 -1
- package/src/types.ts +1 -1
- package/src/vite-plugin.ts +5 -1
- package/lib/types/adapters/bun.d.ts +0 -6
- package/lib/types/adapters/bun.d.ts.map +0 -1
- package/lib/types/adapters/index.d.ts +0 -10
- package/lib/types/adapters/index.d.ts.map +0 -1
- package/lib/types/adapters/node.d.ts +0 -6
- package/lib/types/adapters/node.d.ts.map +0 -1
- package/lib/types/adapters/static.d.ts +0 -7
- package/lib/types/adapters/static.d.ts.map +0 -1
- package/lib/types/app.d.ts +0 -24
- package/lib/types/app.d.ts.map +0 -1
- package/lib/types/entry-server.d.ts +0 -37
- package/lib/types/entry-server.d.ts.map +0 -1
- package/lib/types/error-overlay.d.ts +0 -6
- package/lib/types/error-overlay.d.ts.map +0 -1
- package/lib/types/fs-router.d.ts +0 -47
- package/lib/types/fs-router.d.ts.map +0 -1
- package/lib/types/isr.d.ts +0 -9
- package/lib/types/isr.d.ts.map +0 -1
- package/lib/types/not-found.d.ts +0 -7
- package/lib/types/not-found.d.ts.map +0 -1
- package/lib/types/types.d.ts +0 -111
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/utils/use-intersection-observer.d.ts +0 -10
- package/lib/types/utils/use-intersection-observer.d.ts.map +0 -1
- package/lib/types/utils/with-headers.d.ts +0 -6
- package/lib/types/utils/with-headers.d.ts.map +0 -1
- package/lib/types/vite-plugin.d.ts +0 -17
- package/lib/types/vite-plugin.d.ts.map +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/og-image.d.ts
|
|
4
|
+
interface OgImageLayer {
|
|
5
|
+
/**
|
|
6
|
+
* Text content. Can be:
|
|
7
|
+
* - A string (same for all locales)
|
|
8
|
+
* - A record mapping locale → text
|
|
9
|
+
* - A function receiving locale and returning text
|
|
10
|
+
*/
|
|
11
|
+
text: string | Record<string, string> | ((locale: string) => string);
|
|
12
|
+
/** X position — number (px) or string with % (e.g. "50%"). Default: "50%" */
|
|
13
|
+
x?: number | string;
|
|
14
|
+
/** Y position — number (px) or string with % (e.g. "40%"). Default: "50%" */
|
|
15
|
+
y?: number | string;
|
|
16
|
+
/** Font size in px. Default: 64 */
|
|
17
|
+
fontSize?: number;
|
|
18
|
+
/** Font family. Default: "sans-serif" */
|
|
19
|
+
fontFamily?: string;
|
|
20
|
+
/** Font weight. Default: "bold" */
|
|
21
|
+
fontWeight?: string;
|
|
22
|
+
/** Text color. Default: "#ffffff" */
|
|
23
|
+
color?: string;
|
|
24
|
+
/** Text anchor (alignment). Default: "middle" */
|
|
25
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
26
|
+
/** Max width in px before wrapping. Default: 80% of image width. */
|
|
27
|
+
maxWidth?: number;
|
|
28
|
+
}
|
|
29
|
+
interface OgImageTemplate {
|
|
30
|
+
/** Template name — used for output file naming. */
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Background: path to an image file, or a solid color config.
|
|
34
|
+
*
|
|
35
|
+
* @example "./src/assets/og-bg.jpg"
|
|
36
|
+
* @example { color: "#0066ff", width: 1200, height: 630 }
|
|
37
|
+
*/
|
|
38
|
+
background: string | {
|
|
39
|
+
color: string;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
};
|
|
43
|
+
/** Output width. Default: 1200 */
|
|
44
|
+
width?: number;
|
|
45
|
+
/** Output height. Default: 630 */
|
|
46
|
+
height?: number;
|
|
47
|
+
/** Output format. Default: "png" */
|
|
48
|
+
format?: 'png' | 'jpeg';
|
|
49
|
+
/** JPEG quality (1-100). Default: 90 */
|
|
50
|
+
quality?: number;
|
|
51
|
+
/** Text layers to overlay on the background. */
|
|
52
|
+
layers?: OgImageLayer[];
|
|
53
|
+
}
|
|
54
|
+
interface OgImagePluginConfig {
|
|
55
|
+
/** Templates to generate. */
|
|
56
|
+
templates: OgImageTemplate[];
|
|
57
|
+
/** Locales to generate for. When omitted, generates a single image per template. */
|
|
58
|
+
locales?: string[];
|
|
59
|
+
/** Output directory prefix. Default: "og" */
|
|
60
|
+
outDir?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build an SVG overlay with text layers.
|
|
64
|
+
* @internal Exported for testing.
|
|
65
|
+
*/
|
|
66
|
+
declare function buildTextOverlaySvg(layers: OgImageLayer[], width: number, height: number, locale: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Render an OG image from a template for a specific locale.
|
|
69
|
+
* @internal Exported for testing.
|
|
70
|
+
*/
|
|
71
|
+
declare function renderOgImage(template: OgImageTemplate, locale: string, rootDir: string): Promise<Uint8Array | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Compute the OG image path for a template and locale.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* ogImagePath("default", "de") // → "/og/default-de.png"
|
|
78
|
+
* ogImagePath("default") // → "/og/default.png"
|
|
79
|
+
* ogImagePath("hero", "en", "images") // → "/images/hero-en.png"
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function ogImagePath(templateName: string, locale?: string, outDir?: string, format?: 'png' | 'jpeg'): string;
|
|
83
|
+
/**
|
|
84
|
+
* OG image generation Vite plugin.
|
|
85
|
+
*
|
|
86
|
+
* Generates Open Graph images at build time. In dev, generates on-demand.
|
|
87
|
+
* Requires `sharp` as an optional dependency.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* // vite.config.ts
|
|
92
|
+
* import { ogImagePlugin } from "@pyreon/zero/og-image"
|
|
93
|
+
*
|
|
94
|
+
* export default {
|
|
95
|
+
* plugins: [
|
|
96
|
+
* ogImagePlugin({
|
|
97
|
+
* locales: ["en", "de"],
|
|
98
|
+
* templates: [{
|
|
99
|
+
* name: "default",
|
|
100
|
+
* background: { color: "#0066ff" },
|
|
101
|
+
* layers: [{ text: { en: "Hello", de: "Hallo" }, fontSize: 72 }],
|
|
102
|
+
* }],
|
|
103
|
+
* }),
|
|
104
|
+
* ],
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function ogImagePlugin(config: OgImagePluginConfig): Plugin;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { OgImageLayer, OgImagePluginConfig, OgImageTemplate, buildTextOverlaySvg, ogImagePath, ogImagePlugin, renderOgImage };
|
|
111
|
+
//# sourceMappingURL=og-image2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"og-image2.d.ts","names":[],"sources":["../../../src/og-image.ts"],"mappings":";;;UA8CiB,YAAA;;AAAjB;;;;;EAOE,IAAA,WAAe,MAAA,qBAA2B,MAAA;EAAA;EAE1C,CAAA;EAEA;EAAA,CAAA;EAIA;EAFA,QAAA;EAMA;EAJA,UAAA;EAQA;EANA,UAAA;EAMQ;EAJR,KAAA;EAO8B;EAL9B,UAAA;EAwBqB;EAtBrB,QAAA;AAAA;AAAA,UAGe,eAAA;EASuB;EAPtC,IAAA;EASA;;;;;;EAFA,UAAA;IAAuB,KAAA;IAAe,KAAA;IAAgB,MAAA;EAAA;EAe5B;EAb1B,KAAA;EAaW;EAXX,MAAA;EAeA;EAbA,MAAA;EAaM;EAXN,OAAA;EA0CiC;EAxCjC,MAAA,GAAS,YAAA;AAAA;AAAA,UAGM,mBAAA;EAsCf;EApCA,SAAA,EAAW,eAAA;EAsCX;EApCA,OAAA;EAqCc;EAnCd,MAAA;AAAA;;;;;iBA+Bc,mBAAA,CACd,MAAA,EAAQ,YAAA,IACR,KAAA,UACA,MAAA,UACA,MAAA;;;;;iBAiEoB,aAAA,CACpB,QAAA,EAAU,eAAA,EACV,MAAA,UACA,OAAA,WACC,OAAA,CAAQ,UAAA;;;;;;AAqDX;;;;;iBAAgB,WAAA,CACd,YAAA,UACA,MAAA,WACA,MAAA,WACA,MAAA;;;;;AAkCF;;;;;;;;;;;;;;;;;;;;;iBAAgB,aAAA,CAAc,MAAA,EAAQ,mBAAA,GAAsB,MAAA"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Middleware, MiddlewareContext } from "@pyreon/server";
|
|
2
|
+
|
|
3
|
+
//#region src/rate-limit.d.ts
|
|
4
|
+
interface RateLimitConfig {
|
|
5
|
+
/** Maximum requests per window. Default: `100` */
|
|
6
|
+
max?: number;
|
|
7
|
+
/** Time window in seconds. Default: `60` */
|
|
8
|
+
window?: number;
|
|
9
|
+
/** Function to extract the client identifier. Default: IP from headers. */
|
|
10
|
+
keyFn?: (ctx: MiddlewareContext) => string;
|
|
11
|
+
/** Custom response when rate limited. */
|
|
12
|
+
onLimit?: (ctx: MiddlewareContext) => Response;
|
|
13
|
+
/** URL patterns to rate limit (glob-style). Default: all paths. */
|
|
14
|
+
include?: string[];
|
|
15
|
+
/** URL patterns to exclude from rate limiting. */
|
|
16
|
+
exclude?: string[];
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Rate limiting middleware — limits requests per client within a time window.
|
|
@@ -30,5 +32,7 @@ export interface RateLimitConfig {
|
|
|
30
32
|
* include: ["/api/*"],
|
|
31
33
|
* })
|
|
32
34
|
*/
|
|
33
|
-
|
|
34
|
-
//#
|
|
35
|
+
declare function rateLimitMiddleware(config?: RateLimitConfig): Middleware;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { RateLimitConfig, rateLimitMiddleware };
|
|
38
|
+
//# sourceMappingURL=rate-limit2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-
|
|
1
|
+
{"version":3,"file":"rate-limit2.d.ts","names":[],"sources":["../../../src/rate-limit.ts"],"mappings":";;;UAIiB,eAAA;;EAEf,GAAA;EAF8B;EAI9B,MAAA;EAEc;EAAd,KAAA,IAAS,GAAA,EAAK,iBAAA;EAEwB;EAAtC,OAAA,IAAW,GAAA,EAAK,iBAAA,KAAsB,QAAA;EAAQ;EAE9C,OAAA;EANA;EAQA,OAAA;AAAA;;;;;;;;;;AAyBF;;;;;;;;iBAAgB,mBAAA,CAAoB,MAAA,GAAQ,eAAA,GAAuB,UAAA"}
|
package/lib/types/script.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { VNodeChild } from "@pyreon/core";
|
|
2
|
+
|
|
3
|
+
//#region src/script.d.ts
|
|
4
|
+
interface ScriptProps {
|
|
5
|
+
/** Script source URL. */
|
|
6
|
+
src: string;
|
|
7
|
+
/** Loading strategy. Default: "afterHydration" */
|
|
8
|
+
strategy?: ScriptStrategy;
|
|
9
|
+
/** Inline script content (alternative to src). */
|
|
10
|
+
children?: string;
|
|
11
|
+
/** Script id for deduplication. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Async attribute. Default: true */
|
|
14
|
+
async?: boolean;
|
|
15
|
+
/** onLoad callback. */
|
|
16
|
+
onLoad?: () => void;
|
|
17
|
+
/** onError callback. */
|
|
18
|
+
onError?: (error: Error) => void;
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
type ScriptStrategy = 'beforeHydration' | 'afterHydration' | 'onIdle' | 'onInteraction' | 'onViewport';
|
|
19
21
|
/**
|
|
20
22
|
* Optimized script loading component.
|
|
21
23
|
*
|
|
@@ -31,5 +33,7 @@ export type ScriptStrategy = 'beforeHydration' | 'afterHydration' | 'onIdle' | '
|
|
|
31
33
|
* {`console.log("App hydrated!")`}
|
|
32
34
|
* </Script>
|
|
33
35
|
*/
|
|
34
|
-
|
|
35
|
-
//#
|
|
36
|
+
declare function Script(props: ScriptProps): VNodeChild;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Script, ScriptProps, ScriptStrategy };
|
|
39
|
+
//# sourceMappingURL=script2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"script2.d.ts","names":[],"sources":["../../../src/script.tsx"],"mappings":";;;UAaiB,WAAA;;EAEf,GAAA;EAF0B;EAI1B,QAAA,GAAW,cAAA;EAUY;EARvB,QAAA;EAFA;EAIA,EAAA;EAFA;EAIA,KAAA;EAAA;EAEA,MAAA;EAEA;EAAA,OAAA,IAAW,KAAA,EAAO,KAAA;AAAA;AAAA,KAGR,cAAA;;AAAZ;;;;;AAsBA;;;;;;;;;iBAAgB,MAAA,CAAO,KAAA,EAAO,WAAA,GAAc,UAAA"}
|
package/lib/types/seo.d.ts
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Middleware } from "@pyreon/server";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/seo.d.ts
|
|
5
|
+
interface SitemapConfig {
|
|
6
|
+
/** Base URL of the site (required). e.g. "https://example.com" */
|
|
7
|
+
origin: string;
|
|
8
|
+
/** Paths to exclude from the sitemap. */
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
/** Default change frequency. Default: "weekly" */
|
|
11
|
+
changefreq?: ChangeFreq;
|
|
12
|
+
/** Default priority. Default: 0.7 */
|
|
13
|
+
priority?: number;
|
|
14
|
+
/** Additional URLs to include (for dynamic routes). */
|
|
15
|
+
additionalPaths?: SitemapEntry[];
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
interface SitemapEntry {
|
|
18
|
+
path: string;
|
|
19
|
+
changefreq?: ChangeFreq;
|
|
20
|
+
priority?: number;
|
|
21
|
+
lastmod?: string;
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
type ChangeFreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
|
|
22
24
|
/**
|
|
23
25
|
* Generate a sitemap.xml string from route file paths.
|
|
24
26
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
declare function generateSitemap(routeFiles: string[], config: SitemapConfig): string;
|
|
28
|
+
interface RobotsConfig {
|
|
29
|
+
/** Rules per user-agent. */
|
|
30
|
+
rules?: RobotsRule[];
|
|
31
|
+
/** Sitemap URL. */
|
|
32
|
+
sitemap?: string;
|
|
33
|
+
/** Host directive. */
|
|
34
|
+
host?: string;
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
interface RobotsRule {
|
|
37
|
+
userAgent: string;
|
|
38
|
+
allow?: string[];
|
|
39
|
+
disallow?: string[];
|
|
40
|
+
crawlDelay?: number;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Generate a robots.txt string.
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
declare function generateRobots(config?: RobotsConfig): string;
|
|
46
|
+
type JsonLdType = 'WebSite' | 'WebPage' | 'Article' | 'BlogPosting' | 'Product' | 'Organization' | 'Person' | 'BreadcrumbList' | 'FAQPage' | (string & {});
|
|
45
47
|
/**
|
|
46
48
|
* Generate a JSON-LD script tag string for structured data.
|
|
47
49
|
*
|
|
@@ -54,12 +56,12 @@ export type JsonLdType = 'WebSite' | 'WebPage' | 'Article' | 'BlogPosting' | 'Pr
|
|
|
54
56
|
* })],
|
|
55
57
|
* })
|
|
56
58
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
declare function jsonLd(data: Record<string, unknown>): string;
|
|
60
|
+
interface SeoPluginConfig {
|
|
61
|
+
/** Sitemap configuration. */
|
|
62
|
+
sitemap?: SitemapConfig;
|
|
63
|
+
/** Robots.txt configuration. */
|
|
64
|
+
robots?: RobotsConfig;
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* Zero SEO Vite plugin.
|
|
@@ -79,10 +81,12 @@ export interface SeoPluginConfig {
|
|
|
79
81
|
* ],
|
|
80
82
|
* }
|
|
81
83
|
*/
|
|
82
|
-
|
|
84
|
+
declare function seoPlugin(config?: SeoPluginConfig): Plugin;
|
|
83
85
|
/**
|
|
84
86
|
* SEO middleware for dev server.
|
|
85
87
|
* Serves sitemap.xml and robots.txt dynamically during development.
|
|
86
88
|
*/
|
|
87
|
-
|
|
88
|
-
//#
|
|
89
|
+
declare function seoMiddleware(config?: SeoPluginConfig): Middleware;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { ChangeFreq, JsonLdType, RobotsConfig, RobotsRule, SeoPluginConfig, SitemapConfig, SitemapEntry, generateRobots, generateSitemap, jsonLd, seoMiddleware, seoPlugin };
|
|
92
|
+
//# sourceMappingURL=seo2.d.ts.map
|
package/lib/types/seo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"seo2.d.ts","names":[],"sources":["../../../src/seo.ts"],"mappings":";;;;UAWiB,aAAA;;EAEf,MAAA;EAF4B;EAI5B,OAAA;EAM8B;EAJ9B,UAAA,GAAa,UAAA;EAFb;EAIA,QAAA;EAFa;EAIb,eAAA,GAAkB,YAAA;AAAA;AAAA,UAGH,YAAA;EACf,IAAA;EACA,UAAA,GAAa,UAAA;EACb,QAAA;EACA,OAAA;AAAA;AAAA,KAGU,UAAA;;;;iBAKI,eAAA,CAAgB,UAAA,YAAsB,MAAA,EAAQ,aAAA;AAAA,UAgE7C,YAAA;EAxER;EA0EP,KAAA,GAAQ,UAAA;EAvEE;EAyEV,OAAA;;EAEA,IAAA;AAAA;AAAA,UAGe,UAAA;EACf,SAAA;EACA,KAAA;EACA,QAAA;EACA,UAAA;AAAA;;;;iBAMc,cAAA,CAAe,MAAA,GAAQ,YAAA;AAAA,KAwB3B,UAAA;;;;;;;;;AAlCZ;;;;iBA0DgB,MAAA,CAAO,IAAA,EAAM,MAAA;AAAA,UAUZ,eAAA;EAjEf;EAmEA,OAAA,GAAU,aAAA;EAlEA;EAoEV,MAAA,GAAS,YAAA;AAAA;;;;;AAtCX;;;;;AAwBA;;;;;AAUA;;;;iBAyBgB,SAAA,CAAU,MAAA,GAAQ,eAAA,GAAuB,MAAA;;;;;iBA6CzC,aAAA,CAAc,MAAA,GAAQ,eAAA,GAAuB,UAAA"}
|
package/lib/types/testing.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Middleware, MiddlewareContext } from "@pyreon/server";
|
|
2
|
+
|
|
3
|
+
//#region src/api-routes.d.ts
|
|
4
|
+
/** Context passed to API route handlers. */
|
|
5
|
+
interface ApiContext {
|
|
6
|
+
/** The incoming request. */
|
|
7
|
+
request: Request;
|
|
8
|
+
/** Parsed URL. */
|
|
9
|
+
url: URL;
|
|
10
|
+
/** URL path. */
|
|
11
|
+
path: string;
|
|
12
|
+
/** Dynamic route parameters (e.g., { id: "123" }). */
|
|
13
|
+
params: Record<string, string>;
|
|
14
|
+
/** Request headers. */
|
|
15
|
+
headers: Headers;
|
|
16
|
+
}
|
|
17
|
+
/** An API route handler function. */
|
|
18
|
+
type ApiHandler = (ctx: ApiContext) => Response | Promise<Response>;
|
|
19
|
+
/** An API route module — exports named HTTP method handlers. */
|
|
20
|
+
interface ApiRouteModule {
|
|
21
|
+
GET?: ApiHandler;
|
|
22
|
+
POST?: ApiHandler;
|
|
23
|
+
PUT?: ApiHandler;
|
|
24
|
+
PATCH?: ApiHandler;
|
|
25
|
+
DELETE?: ApiHandler;
|
|
26
|
+
HEAD?: ApiHandler;
|
|
27
|
+
OPTIONS?: ApiHandler;
|
|
28
|
+
}
|
|
29
|
+
/** A registered API route entry. */
|
|
30
|
+
interface ApiRouteEntry {
|
|
31
|
+
/** URL pattern (e.g., "/api/posts/:id"). */
|
|
32
|
+
pattern: string;
|
|
33
|
+
/** The route module with method handlers. */
|
|
34
|
+
module: ApiRouteModule;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/testing.d.ts
|
|
3
38
|
/**
|
|
4
39
|
* Create a mock MiddlewareContext for testing middleware.
|
|
5
40
|
*
|
|
@@ -9,10 +44,10 @@ import type { ApiHandler, ApiRouteEntry } from './api-routes';
|
|
|
9
44
|
* const ctx = createTestContext("/api/posts", { method: "POST", body: { title: "Hello" } })
|
|
10
45
|
* const result = await myMiddleware(ctx)
|
|
11
46
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
47
|
+
declare function createTestContext(path: string, options?: {
|
|
48
|
+
method?: string;
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
body?: unknown;
|
|
16
51
|
}): MiddlewareContext;
|
|
17
52
|
/**
|
|
18
53
|
* Test a middleware by running it with a mock context and returning
|
|
@@ -27,13 +62,13 @@ export declare function createTestContext(path: string, options?: {
|
|
|
27
62
|
* )
|
|
28
63
|
* expect(headers.get("Access-Control-Allow-Origin")).toBe("*")
|
|
29
64
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
65
|
+
declare function testMiddleware(middleware: Middleware, path: string, options?: {
|
|
66
|
+
method?: string;
|
|
67
|
+
headers?: Record<string, string>;
|
|
68
|
+
body?: unknown;
|
|
34
69
|
}): Promise<{
|
|
35
|
-
|
|
36
|
-
|
|
70
|
+
response: Response | undefined;
|
|
71
|
+
headers: Headers;
|
|
37
72
|
}>;
|
|
38
73
|
/**
|
|
39
74
|
* Create a test server for API routes. Returns a function that
|
|
@@ -53,12 +88,12 @@ export declare function testMiddleware(middleware: Middleware, path: string, opt
|
|
|
53
88
|
* const data = await server.request("/api/posts", { method: "POST", body: { title: "Hi" } })
|
|
54
89
|
* expect(data.status).toBe(201)
|
|
55
90
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
declare function createTestApiServer(routes: ApiRouteEntry[]): {
|
|
92
|
+
request(path: string, options?: {
|
|
93
|
+
method?: string;
|
|
94
|
+
headers?: Record<string, string>;
|
|
95
|
+
body?: unknown;
|
|
96
|
+
}): Promise<Response>;
|
|
62
97
|
};
|
|
63
98
|
/**
|
|
64
99
|
* Create a mock API handler for testing.
|
|
@@ -72,14 +107,16 @@ export declare function createTestApiServer(routes: ApiRouteEntry[]): {
|
|
|
72
107
|
* expect(handler.calls).toHaveLength(1)
|
|
73
108
|
* expect(handler.calls[0].params).toEqual({ id: "123" })
|
|
74
109
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
110
|
+
declare function createMockHandler(responseConfig?: {
|
|
111
|
+
status?: number;
|
|
112
|
+
body?: unknown;
|
|
113
|
+
headers?: Record<string, string>;
|
|
79
114
|
}): ApiHandler & {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
115
|
+
calls: Array<{
|
|
116
|
+
path: string;
|
|
117
|
+
params: Record<string, string>;
|
|
118
|
+
}>;
|
|
84
119
|
};
|
|
85
|
-
//#
|
|
120
|
+
//#endregion
|
|
121
|
+
export { createMockHandler, createTestApiServer, createTestContext, testMiddleware };
|
|
122
|
+
//# sourceMappingURL=testing2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"testing2.d.ts","names":[],"sources":["../../../src/api-routes.ts","../../../src/testing.ts"],"mappings":";;;AAQA;AAAA,UAAiB,UAAA;;EAEf,OAAA,EAAS,OAAA;EAEJ;EAAL,GAAA,EAAK,GAAA;EAMI;EAJT,IAAA;EAIgB;EAFhB,MAAA,EAAQ,MAAA;EANC;EAQT,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;;UAIK,aAAA;EAd+C;EAgB9D,OAAA;EAhB6B;EAkB7B,MAAA,EAAQ,cAAA;AAAA;;;;AAhCV;;;;;;;;iBCOgB,iBAAA,CACd,IAAA,UACA,OAAA;EACE,MAAA;EACA,OAAA,GAAU,MAAA;EACV,IAAA;AAAA,IAED,iBAAA;;;;;;;;ADAH;;;;;;iBCwCsB,cAAA,CACpB,UAAA,EAAY,UAAA,EACZ,IAAA,UACA,OAAA;EACE,MAAA;EACA,OAAA,GAAU,MAAA;EACV,IAAA;AAAA,IAED,OAAA;EAAU,QAAA,EAAU,QAAA;EAAsB,OAAA,EAAS,OAAA;AAAA;;;AD7CtD;;;;;;;;;;;;;;;;iBCqEgB,mBAAA,CAAoB,MAAA,EAAQ,aAAA;wBAK1B,OAAA;IAEV,MAAA;IACA,OAAA,GAAU,MAAA;IACV,IAAA;EAAA,IAED,OAAA,CAAQ,QAAA;AAAA;;;;;;ADrEf;;;;;;;iBC4FgB,iBAAA,CACd,cAAA;EAAkB,MAAA;EAAiB,IAAA;EAAgB,OAAA,GAAU,MAAA;AAAA,IAC5D,UAAA;EACD,KAAA,EAAO,KAAA;IAAQ,IAAA;IAAc,MAAA,EAAQ,MAAA;EAAA;AAAA"}
|
package/lib/types/theme.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _pyreon_reactivity0 from "@pyreon/reactivity";
|
|
2
|
+
import { VNodeChild } from "@pyreon/core";
|
|
3
|
+
|
|
4
|
+
//#region src/theme.d.ts
|
|
5
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
3
6
|
/** Reactive theme signal. */
|
|
4
|
-
|
|
7
|
+
declare const theme: _pyreon_reactivity0.Signal<Theme>;
|
|
8
|
+
/**
|
|
9
|
+
* Set the default theme for SSR (when `matchMedia` is unavailable).
|
|
10
|
+
* Call once at server startup before rendering.
|
|
11
|
+
*/
|
|
12
|
+
declare function setSSRThemeDefault(value: 'light' | 'dark'): void;
|
|
5
13
|
/** Computed resolved theme (what's actually applied). */
|
|
6
|
-
|
|
14
|
+
declare function resolvedTheme(): 'light' | 'dark';
|
|
7
15
|
/** Toggle between light and dark. */
|
|
8
|
-
|
|
16
|
+
declare function toggleTheme(): void;
|
|
9
17
|
/** Set theme explicitly. */
|
|
10
|
-
|
|
18
|
+
declare function setTheme(t: Theme): void;
|
|
11
19
|
/**
|
|
12
20
|
* Initialize the theme system. Call once in your app entry or layout.
|
|
13
21
|
* Reads from localStorage, listens for system preference changes.
|
|
14
22
|
*/
|
|
15
|
-
|
|
23
|
+
declare function initTheme(): void;
|
|
16
24
|
/**
|
|
17
25
|
* Theme toggle button component.
|
|
18
26
|
*
|
|
@@ -20,9 +28,9 @@ export declare function initTheme(): void;
|
|
|
20
28
|
* import { ThemeToggle } from "@pyreon/zero/theme"
|
|
21
29
|
* <ThemeToggle />
|
|
22
30
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
declare function ThemeToggle(props: {
|
|
32
|
+
class?: string;
|
|
33
|
+
style?: string;
|
|
26
34
|
}): VNodeChild;
|
|
27
35
|
/**
|
|
28
36
|
* Inline script to prevent flash of wrong theme.
|
|
@@ -35,5 +43,7 @@ export declare function ThemeToggle(props: {
|
|
|
35
43
|
* ...
|
|
36
44
|
* </head>
|
|
37
45
|
*/
|
|
38
|
-
|
|
39
|
-
//#
|
|
46
|
+
declare const themeScript = "(function(){try{var t=localStorage.getItem(\"zero-theme\");var r=t===\"light\"?\"light\":t===\"dark\"?\"dark\":window.matchMedia(\"(prefers-color-scheme:dark)\").matches?\"dark\":\"light\";document.documentElement.dataset.theme=r}catch(e){}})()";
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Theme, ThemeToggle, initTheme, resolvedTheme, setSSRThemeDefault, setTheme, theme, themeScript, toggleTheme };
|
|
49
|
+
//# sourceMappingURL=theme2.d.ts.map
|
package/lib/types/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"theme2.d.ts","names":[],"sources":["../../../src/theme.tsx"],"mappings":";;;;KAYY,KAAA;;cAKC,KAAA,EAAK,mBAAA,CAAA,MAAA,CAAA,KAAA;AALlB;;;;AAAA,iBAcgB,kBAAA,CAAmB,KAAA;AATnC;AAAA,iBAcgB,aAAA,CAAA;;iBAUA,WAAA,CAAA;;iBAMA,QAAA,CAAS,CAAA,EAAG,KAAA;;;;;iBAgBZ,SAAA,CAAA;;;;;AAtBhB;;;iBAgEgB,WAAA,CAAY,KAAA;EAAS,KAAA;EAAgB,KAAA;AAAA,IAAmB,UAAA;;;;AA1CxE;;;;;AA0CA;;;cAkEa,WAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/zero",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Pyreon Zero — zero-config full-stack framework powered by Pyreon and Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vit Bokisch",
|
|
@@ -117,36 +117,61 @@
|
|
|
117
117
|
"import": "./lib/favicon.js",
|
|
118
118
|
"types": "./lib/types/favicon.d.ts"
|
|
119
119
|
},
|
|
120
|
-
"./
|
|
120
|
+
"./og-image": {
|
|
121
|
+
"bun": "./src/og-image.ts",
|
|
122
|
+
"import": "./lib/og-image.js",
|
|
123
|
+
"types": "./lib/types/og-image.d.ts"
|
|
124
|
+
},
|
|
125
|
+
"./i18n-routing": {
|
|
121
126
|
"bun": "./src/i18n-routing.ts",
|
|
122
127
|
"import": "./lib/i18n-routing.js",
|
|
123
128
|
"types": "./lib/types/i18n-routing.d.ts"
|
|
124
129
|
},
|
|
130
|
+
"./ai": {
|
|
131
|
+
"bun": "./src/ai.ts",
|
|
132
|
+
"import": "./lib/ai.js",
|
|
133
|
+
"types": "./lib/types/ai.d.ts"
|
|
134
|
+
},
|
|
125
135
|
"./middleware": {
|
|
126
136
|
"bun": "./src/middleware.ts",
|
|
127
137
|
"import": "./lib/middleware.js",
|
|
128
138
|
"types": "./lib/types/middleware.d.ts"
|
|
139
|
+
},
|
|
140
|
+
"./csp": {
|
|
141
|
+
"bun": "./src/csp.ts",
|
|
142
|
+
"import": "./lib/csp.js",
|
|
143
|
+
"types": "./lib/types/csp.d.ts"
|
|
144
|
+
},
|
|
145
|
+
"./env": {
|
|
146
|
+
"bun": "./src/env.ts",
|
|
147
|
+
"import": "./lib/env.js",
|
|
148
|
+
"types": "./lib/types/env.d.ts"
|
|
149
|
+
},
|
|
150
|
+
"./logger": {
|
|
151
|
+
"bun": "./src/logger.ts",
|
|
152
|
+
"import": "./lib/logger.js",
|
|
153
|
+
"types": "./lib/types/logger.d.ts"
|
|
129
154
|
}
|
|
130
155
|
},
|
|
131
156
|
"scripts": {
|
|
132
|
-
"build": "vl_rolldown_build
|
|
157
|
+
"build": "vl_rolldown_build",
|
|
133
158
|
"dev": "vl_rolldown_build-watch",
|
|
134
159
|
"test": "vitest run",
|
|
135
160
|
"typecheck": "tsc --noEmit",
|
|
136
161
|
"lint": "oxlint ."
|
|
137
162
|
},
|
|
138
163
|
"dependencies": {
|
|
139
|
-
"@pyreon/core": "^0.12.
|
|
140
|
-
"@pyreon/head": "^0.12.
|
|
141
|
-
"@pyreon/meta": "^0.12.
|
|
142
|
-
"@pyreon/router": "^0.12.
|
|
143
|
-
"@pyreon/runtime-dom": "^0.12.
|
|
144
|
-
"@pyreon/runtime-server": "^0.12.
|
|
145
|
-
"@pyreon/server": "^0.12.
|
|
146
|
-
"@pyreon/vite-plugin": "^0.12.
|
|
164
|
+
"@pyreon/core": "^0.12.3",
|
|
165
|
+
"@pyreon/head": "^0.12.3",
|
|
166
|
+
"@pyreon/meta": "^0.12.3",
|
|
167
|
+
"@pyreon/router": "^0.12.3",
|
|
168
|
+
"@pyreon/runtime-dom": "^0.12.3",
|
|
169
|
+
"@pyreon/runtime-server": "^0.12.3",
|
|
170
|
+
"@pyreon/server": "^0.12.3",
|
|
171
|
+
"@pyreon/vite-plugin": "^0.12.3",
|
|
147
172
|
"vite": "^8.0.0"
|
|
148
173
|
},
|
|
149
174
|
"peerDependencies": {
|
|
150
|
-
"@pyreon/reactivity": "^0.12.
|
|
175
|
+
"@pyreon/reactivity": "^0.12.3"
|
|
151
176
|
}
|
|
152
177
|
}
|