@kirejs/fivem 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,43 @@
1
+ import { FiveMBroadcaster, type NuiCallback } from "@kirejs/wire";
2
+ import { Kire } from "kire";
3
+ import type { KireFivemOptions } from "./types";
4
+ export { createFiveMHandler, FiveMBroadcaster } from "@kirejs/wire";
5
+ export * from "./types";
6
+ export interface KireFivem {
7
+ /** The configured Kire engine. */
8
+ engine: Kire<boolean>;
9
+ /** Render a NUI view to HTML. */
10
+ render(view: string, data?: Record<string, unknown>): string | Promise<string>;
11
+ /**
12
+ * The `RegisterNuiCallback` handler for the Kirewire update endpoint:
13
+ * `RegisterNuiCallback(fivem.path, fivem.handler)`.
14
+ */
15
+ handler: NuiCallback;
16
+ /** NUI callback name (default `_wire`). */
17
+ path: string;
18
+ /**
19
+ * Build a server→NUI broadcaster from the host's `SendNuiMessage`. Pass it to
20
+ * `new Kirewire({ broadcaster })` for `@broadcast`/push effects.
21
+ */
22
+ broadcaster(sendNuiMessage: (json: string) => void): FiveMBroadcaster;
23
+ }
24
+ /**
25
+ * Wire Kire + Kirewire into a FiveM resource. FiveM has no HTTP server — the NUI
26
+ * (browser UI) talks to the resource via `RegisterNuiCallback`, so this returns a
27
+ * `handler` to register plus a `render()` for NUI pages:
28
+ *
29
+ * ```ts
30
+ * import { Kirewire } from "@kirejs/wire";
31
+ * import { kireFivem } from "@kirejs/fivem";
32
+ *
33
+ * const wire = new Kirewire({ secret: "…" });
34
+ * wire.component(Counter);
35
+ *
36
+ * const fivem = kireFivem({ views: "views", wire: { instance: wire } });
37
+ * RegisterNuiCallback(fivem.path, fivem.handler);
38
+ *
39
+ * // push the initial page to the NUI browser
40
+ * SendNuiMessage(JSON.stringify({ type: "page", html: await fivem.render("counter") }));
41
+ * ```
42
+ */
43
+ export declare function kireFivem(options: KireFivemOptions): KireFivem;
@@ -0,0 +1,24 @@
1
+ import type { Kire, KirePlugin } from "kire";
2
+ export type PluginEntry = KirePlugin<any> | [KirePlugin<any>, any];
3
+ export interface KireFivemOptions {
4
+ /** Directory that holds the `.kire` NUI views. */
5
+ views: string;
6
+ /** View file extension (default `kire`). */
7
+ extension?: string;
8
+ /** Production mode. */
9
+ production?: boolean;
10
+ /** Use an existing engine instead of creating one from `views`. */
11
+ engine?: Kire<boolean>;
12
+ /** Kire plugins to load. */
13
+ plugins?: PluginEntry[];
14
+ /** Globals exposed to every view. */
15
+ globals?: Record<string, unknown>;
16
+ /** The Kirewire instance that holds component state. */
17
+ wire: {
18
+ instance: any;
19
+ /** NUI callback name the client posts updates to (default `_wire`). */
20
+ path?: string;
21
+ /** URL the NUI page references the client runtime at (default `/kirewire.js`). */
22
+ scriptUrl?: string;
23
+ };
24
+ }
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@kirejs/fivem",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "FiveM (NUI) integration for Kire + Kirewire — render NUI pages and handle updates via RegisterNuiCallback.",
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
+ "fivem",
23
+ "nui",
24
+ "kire",
25
+ "kirewire",
26
+ "typescript"
27
+ ],
28
+ "author": "drysius",
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "@kirejs/wire": "0.2.2",
32
+ "kire": "0.2.2"
33
+ }
6
34
  }