hono-decks 0.1.0

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/dist/node.d.ts ADDED
@@ -0,0 +1,181 @@
1
+ import { F as DeckKind, D as DeckManifest, az as LocalDeckIO, ab as DecksConfig, aA as SlideDeck, aB as Slide, aC as CompileDeckInput, C as CompiledDeck, b as DeckSource, aD as DeckFileChange, aE as DeckCompiler } from './define-decks-U4NxIs66.js';
2
+ export { A as AssetRef, aF as CompileError, c as CompileWarning, a as CompiledSlide, d as ComponentPlaceholder, r as DeckEntry, aG as DeckFileEntry, y as DeckFrontmatter, L as DeckRequestContext, aH as RenderError, aI as SlideBlock, al as SlideFrontmatter, aJ as SlideNode, aK as SlidePropValue } from './define-decks-U4NxIs66.js';
3
+ import { Hono, Env, Context, MiddlewareHandler } from 'hono';
4
+ import './jsx-renderer-BO-N4tMZ.js';
5
+ import 'hono/jsx';
6
+ import 'hono/utils/html';
7
+
8
+ interface ResolvedDeckFile {
9
+ slug: string;
10
+ sourcePath: string;
11
+ kind: DeckKind;
12
+ assetPaths: string[];
13
+ }
14
+ declare function resolveDeckFiles(paths: string[], root?: string): ResolvedDeckFile[];
15
+
16
+ interface LinkCardOgpMetadata {
17
+ title?: string;
18
+ description?: string;
19
+ image?: string;
20
+ siteName?: string;
21
+ }
22
+
23
+ interface DeckComponentExport {
24
+ slug: string;
25
+ sourcePath: string;
26
+ modulePath: string;
27
+ exportName: string;
28
+ }
29
+ interface ResolvedDeckComponentExport extends DeckComponentExport {
30
+ internalName: string;
31
+ }
32
+ interface ApplyDeckComponentRegistryInput {
33
+ manifest: DeckManifest;
34
+ components: DeckComponentExport[];
35
+ }
36
+ interface ApplyDeckComponentRegistryResult {
37
+ manifest: DeckManifest;
38
+ components: ResolvedDeckComponentExport[];
39
+ }
40
+ declare function applyDeckComponentRegistry(input: ApplyDeckComponentRegistryInput): ApplyDeckComponentRegistryResult;
41
+ declare function emitDeckComponentRegistryModule(components: ResolvedDeckComponentExport[]): string;
42
+
43
+ interface BuildDeckManifestFromFileSystemInput {
44
+ cwd: string;
45
+ root: string;
46
+ mountPath?: string;
47
+ }
48
+ interface WriteDeckManifestModuleInput {
49
+ manifest: DeckManifest;
50
+ outFile: string;
51
+ }
52
+ interface WriteDeckComponentRegistryModuleInput {
53
+ components: ResolvedDeckComponentExport[];
54
+ outFile: string;
55
+ }
56
+ interface WriteDecksRouterModuleInput {
57
+ manifestModulePath: string;
58
+ componentRegistryModulePath?: string;
59
+ outFile: string;
60
+ }
61
+ interface CompileDecksInput extends BuildDeckManifestFromFileSystemInput {
62
+ out: string;
63
+ ogpCacheFile?: string;
64
+ refreshOgp?: boolean;
65
+ resolveOgp?(url: string): Promise<LinkCardOgpMetadata | undefined>;
66
+ }
67
+ declare function compileDecks(input: CompileDecksInput): Promise<DeckManifest>;
68
+ declare function buildDeckManifestFromFileSystem(input: BuildDeckManifestFromFileSystemInput): Promise<DeckManifest>;
69
+ declare function writeDeckManifestModule(input: WriteDeckManifestModuleInput): Promise<void>;
70
+ declare function writeDeckComponentRegistryModule(input: WriteDeckComponentRegistryModuleInput): Promise<void>;
71
+ declare function writeDecksRouterModule(input: WriteDecksRouterModuleInput): Promise<void>;
72
+
73
+ interface CreateLocalDeckIOInput {
74
+ cwd: string;
75
+ root: string;
76
+ pathExists?(path: string): boolean;
77
+ watchFileSystem?(path: string, options: {
78
+ recursive: boolean;
79
+ }, listener: (eventType: "rename" | "change", filename: string | null) => void): {
80
+ close(): void;
81
+ };
82
+ }
83
+ declare function createLocalDeckIO(input: CreateLocalDeckIOInput): LocalDeckIO;
84
+
85
+ interface CreateLocalDevSlidesAppInput {
86
+ cwd: string;
87
+ root: string;
88
+ mountPath?: string;
89
+ watchFileSystem?: CreateLocalDeckIOInput["watchFileSystem"];
90
+ }
91
+ interface LocalDevSlidesApp {
92
+ app: Hono;
93
+ localDeckIO: LocalDeckIO;
94
+ stop(): void;
95
+ }
96
+ declare function createLocalDevSlidesApp(input: CreateLocalDevSlidesAppInput): Promise<LocalDevSlidesApp>;
97
+
98
+ declare const DEFAULT_DECKS_CONFIG_FILE = "hono-decks.config.ts";
99
+ interface LoadedDecksConfig<E extends Env = any> {
100
+ path: string;
101
+ config: DecksConfig<E>;
102
+ root: string;
103
+ outDir: string;
104
+ ogpCacheFile?: string;
105
+ }
106
+ declare function loadDecksConfig<E extends Env = any>(input: {
107
+ cwd: string;
108
+ configFile?: string;
109
+ }): Promise<LoadedDecksConfig<E>>;
110
+
111
+ declare module "hono" {
112
+ interface ContextVariableMap {
113
+ slideDeck: SlideDeck;
114
+ slideHtml: string;
115
+ slideMarkdown: string;
116
+ }
117
+ }
118
+ type MaybePromise<T> = T | Promise<T>;
119
+ interface DeckMiddlewareOptions {
120
+ /** Static markdown, or a loader that can read from bindings/storage. */
121
+ markdown?: string | ((c: Context) => MaybePromise<string>);
122
+ /** When false, only parse/render and expose c.var.slideDeck / slideHtml, then call next(). */
123
+ respond?: boolean;
124
+ /** Page title used when respond=true. */
125
+ title?: string;
126
+ /** Extra CSS appended inside the generated deck page. */
127
+ style?: string;
128
+ }
129
+ declare function deckMiddleware(options?: DeckMiddlewareOptions): MiddlewareHandler;
130
+ declare function renderDeckPage(input: {
131
+ title: string;
132
+ slideHtml: string;
133
+ warnings?: string[];
134
+ style?: string;
135
+ }): string;
136
+
137
+ declare function parseDeck(markdown: string): SlideDeck;
138
+
139
+ declare function renderDeck(deck: SlideDeck): string;
140
+ declare function renderSlide(slide: Slide): string;
141
+
142
+ declare function compileMarkdown(input: CompileDeckInput): Promise<CompiledDeck>;
143
+
144
+ type PreviewEventType = "ready" | "deck:updated" | "deck:error";
145
+ interface PreviewEvent {
146
+ type: PreviewEventType;
147
+ slug: string;
148
+ data?: unknown;
149
+ }
150
+ interface PreviewEventHub {
151
+ publish(event: PreviewEvent): void;
152
+ drain(slug: string): PreviewEvent[];
153
+ subscribe?(slug: string, listener: (event: PreviewEvent) => void): () => void;
154
+ }
155
+ declare function createPreviewEventHub(): PreviewEventHub;
156
+
157
+ interface DevDeckRuntimeInput {
158
+ initialDecks: CompiledDeck[];
159
+ localDeckIO: LocalDeckIO;
160
+ compiler: DeckCompiler;
161
+ previewEvents?: PreviewEventHub;
162
+ mountPath?: string;
163
+ }
164
+ interface DevDeckRuntime {
165
+ source: DeckSource;
166
+ handleFileChange(event: DeckFileChange): Promise<void>;
167
+ start(): () => void;
168
+ }
169
+ declare function createDevDeckRuntime(input: DevDeckRuntimeInput): DevDeckRuntime;
170
+
171
+ interface BuildDeckManifestInput {
172
+ root: string;
173
+ paths: string[];
174
+ mountPath?: string;
175
+ readText(path: string): Promise<string>;
176
+ readBinary?(path: string): Promise<Uint8Array>;
177
+ }
178
+ declare function buildDeckManifest(input: BuildDeckManifestInput): Promise<DeckManifest>;
179
+ declare function emitDeckManifestModule(manifest: DeckManifest): string;
180
+
181
+ export { type ApplyDeckComponentRegistryInput, type ApplyDeckComponentRegistryResult, type BuildDeckManifestFromFileSystemInput, type BuildDeckManifestInput, CompileDeckInput, type CompileDecksInput, CompiledDeck, type CreateLocalDeckIOInput, type CreateLocalDevSlidesAppInput, DEFAULT_DECKS_CONFIG_FILE, DeckCompiler, type DeckComponentExport, DeckFileChange, DeckManifest, type DeckMiddlewareOptions, DeckSource, type DevDeckRuntime, type DevDeckRuntimeInput, type LoadedDecksConfig, LocalDeckIO, type LocalDevSlidesApp, type PreviewEvent, type PreviewEventHub, type PreviewEventType, type ResolvedDeckComponentExport, type ResolvedDeckFile, Slide, SlideDeck, type WriteDeckComponentRegistryModuleInput, type WriteDeckManifestModuleInput, type WriteDecksRouterModuleInput, applyDeckComponentRegistry, buildDeckManifest, buildDeckManifestFromFileSystem, compileDecks, compileMarkdown, createDevDeckRuntime, createLocalDeckIO, createLocalDevSlidesApp, createPreviewEventHub, deckMiddleware, emitDeckComponentRegistryModule, emitDeckManifestModule, loadDecksConfig, parseDeck, renderDeck, renderDeckPage, renderSlide, resolveDeckFiles, writeDeckComponentRegistryModule, writeDeckManifestModule, writeDecksRouterModule };