@kirejs/h3 0.0.0-stage → 0.2.2

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.
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,39 @@
1
+ import { Kire } from "kire";
2
+ import type { KireH3Options } from "./types";
3
+ export * from "./types";
4
+ /** The Kire h3 integration handle returned by {@link kireH3}. */
5
+ export interface KireH3 {
6
+ /** The Kire engine this integration configured. */
7
+ engine: Kire<boolean>;
8
+ /**
9
+ * Render a (dotted) Kire view path and return it as an HTML `Response`,
10
+ * ready to be returned directly from an h3 handler.
11
+ */
12
+ view(name: string, data?: Record<string, unknown>): Promise<Response>;
13
+ /**
14
+ * An h3 middleware. When the `wire` option is set it serves the Kirewire
15
+ * update endpoint (POST) and client runtime (GET); otherwise it just
16
+ * passes the request through to the next handler.
17
+ */
18
+ middleware: (event: any, next: () => any) => any;
19
+ }
20
+ /**
21
+ * Wire Kire into an [h3](https://h3.dev) app.
22
+ *
23
+ * ```ts
24
+ * import { H3, serve } from "h3";
25
+ * import { kireH3 } from "@kirejs/h3";
26
+ *
27
+ * const kire = kireH3({ views: "resources/views" });
28
+ * const app = new H3();
29
+ *
30
+ * // Optional: serve Kirewire endpoints (POST /_wire, GET /kirewire.js).
31
+ * app.use(kire.middleware);
32
+ *
33
+ * // Return a rendered view straight from a handler — `view()` yields an
34
+ * // `text/html` Response, which h3 sends as-is.
35
+ * app.get("/", () => kire.view("home", { title: "Hi" }));
36
+ * app.get("/about", () => kire.view("pages.about", { who: "Kire" }));
37
+ * ```
38
+ */
39
+ export declare function kireH3(options: KireH3Options): KireH3;
@@ -0,0 +1,32 @@
1
+ import type { Kire, KirePlugin } from "kire";
2
+ /** A Kire plugin, optionally with its options. */
3
+ export type PluginEntry = KirePlugin<any> | [KirePlugin<any>, any];
4
+ /** Optional Kirewire (reactive components) integration. */
5
+ export interface WireIntegration {
6
+ /** A Kirewire instance (from `@kirejs/wire`). */
7
+ instance: any;
8
+ /** Update endpoint path (default `/_wire`). */
9
+ path?: string;
10
+ /** URL the client runtime is served/referenced at (default `/kirewire.js`). */
11
+ scriptUrl?: string;
12
+ /** Local file served at `scriptUrl` (e.g. `@kirejs/wire`'s client bundle). */
13
+ clientScript?: string;
14
+ /** Optional file-upload store. */
15
+ store?: any;
16
+ }
17
+ export interface KireH3Options {
18
+ /** Directory that holds the `.kire` views. */
19
+ views: string;
20
+ /** View file extension (default `kire`). */
21
+ extension?: string;
22
+ /** Production mode (disables source maps, enables caching). */
23
+ production?: boolean;
24
+ /** Use an existing engine instead of creating one from `views`. */
25
+ engine?: Kire<boolean>;
26
+ /** Kire plugins to load (markdown, i18n, auth, …). */
27
+ plugins?: PluginEntry[];
28
+ /** Globals exposed to every view. */
29
+ globals?: Record<string, unknown>;
30
+ /** Enable Kirewire reactive components. */
31
+ wire?: WireIntegration;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@kirejs/h3",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "h3 (unjs) integration for Kire — view rendering, a view() helper and one-line Kirewire setup.",
4
+ "version": "0.2.2",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "typings": "dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ }
15
+ },
16
+ "type": "module",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/drysius/kire.git"
20
+ },
21
+ "keywords": [
22
+ "h3",
23
+ "unjs",
24
+ "kire",
25
+ "view-engine",
26
+ "ssr",
27
+ "typescript"
28
+ ],
29
+ "author": "drysius",
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "kire": "0.2.2"
33
+ },
34
+ "peerDependencies": {
35
+ "@kirejs/wire": "workspace:*",
36
+ "h3": "^2"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@kirejs/wire": {
40
+ "optional": true
41
+ }
42
+ }
6
43
  }