@moku-labs/web 0.1.0-alpha.1

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,349 @@
1
+ import { p as OGImageConfig } from "./primitives-kuZFxqV7.mjs";
2
+ import { n as ComponentDef } from "./factory-BBVQO5ZG.mjs";
3
+ import { Processor } from "unified";
4
+
5
+ //#region src/plugins/log/types.d.ts
6
+ /** @file log plugin types — LogEntry, LogSink, ExpectChain, LogState, LogApi. */
7
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
8
+ type LogEntry = {
9
+ level: LogLevel;
10
+ event: string;
11
+ data?: unknown;
12
+ ts: number;
13
+ plugin?: string;
14
+ };
15
+ type LogSink = {
16
+ write(entry: LogEntry): void;
17
+ };
18
+ type ExpectChain = {
19
+ toHaveEvent(event: string, partial?: Record<string, unknown>): ExpectChain;
20
+ toHaveEventInOrder(events: string[]): ExpectChain;
21
+ toNotHaveEvent(event: string, partial?: Record<string, unknown>): ExpectChain;
22
+ };
23
+ type LogState = {
24
+ entries: LogEntry[];
25
+ sinks: LogSink[];
26
+ };
27
+ type LogApi = {
28
+ info(event: string, data?: unknown): void;
29
+ debug(event: string, data?: unknown): void;
30
+ warn(event: string, data?: unknown): void;
31
+ error(event: string, data?: unknown, error?: Error): void;
32
+ trace(): readonly LogEntry[];
33
+ expect(): ExpectChain;
34
+ addSink(sink: LogSink): void;
35
+ reset(): void;
36
+ };
37
+ //#endregion
38
+ //#region src/plugins/env/types.d.ts
39
+ /** @file env plugin types — schema, provider, EnvApi. */
40
+ type EnvVarSpec = {
41
+ public: boolean;
42
+ required?: boolean;
43
+ default?: string;
44
+ secret?: boolean;
45
+ };
46
+ type EnvProvider = {
47
+ name: string;
48
+ load(): Record<string, string | undefined>;
49
+ };
50
+ type EnvConfig = {
51
+ schema: Record<string, EnvVarSpec>;
52
+ providers: EnvProvider[];
53
+ publicPrefix: string;
54
+ };
55
+ type EnvState = {
56
+ resolved: Map<string, string>;
57
+ publicMap: Map<string, string>;
58
+ };
59
+ type EnvApi = {
60
+ get<K extends string>(key: K): string | undefined;
61
+ require(key: string): string;
62
+ getPublic(): Readonly<Record<string, string>>;
63
+ getPublicMap(): ReadonlyMap<string, string>;
64
+ has(key: string): boolean;
65
+ };
66
+ //#endregion
67
+ //#region src/config.d.ts
68
+ /** Top-level framework config — flows to all plugins via context. */
69
+ type Config = {
70
+ mode: 'production' | 'development';
71
+ };
72
+ /** Framework-level event map — plugin-specific events added by each plugin's events field. */
73
+ type Events = {
74
+ 'content:ready': {
75
+ articles: Map<string, unknown[]>;
76
+ };
77
+ 'content:invalidated': {
78
+ paths: string[];
79
+ };
80
+ 'router:registered': {
81
+ routeCount: number;
82
+ };
83
+ 'build:phase': {
84
+ phase: 'bundle' | 'content' | 'pages' | 'feeds' | 'sitemap' | 'og' | 'images';
85
+ };
86
+ 'build:complete': {
87
+ pages: number;
88
+ durationMs: number;
89
+ };
90
+ 'component:create': {
91
+ name: string;
92
+ element: Element;
93
+ };
94
+ 'component:mount': {
95
+ name: string;
96
+ element: Element;
97
+ };
98
+ 'component:unmount': {
99
+ name: string;
100
+ reason: 'navigation' | 'destroy';
101
+ };
102
+ 'component:destroy': {
103
+ name: string;
104
+ };
105
+ 'nav:start': {
106
+ url: string;
107
+ fromUrl: string;
108
+ };
109
+ 'nav:end': {
110
+ url: string;
111
+ };
112
+ };
113
+ //#endregion
114
+ //#region src/plugins/site/types.d.ts
115
+ /** @file site plugin types — SiteConfig + SiteState + SiteApi. */
116
+ type SiteConfig = {
117
+ /** Display name of the site. */name: string; /** Base URL of the site (no trailing slash). */
118
+ url: string; /** Default author name for content. */
119
+ author: string; /** Site description for feeds, meta tags, and preview pages. */
120
+ description: string;
121
+ };
122
+ type SiteState = {
123
+ config: Readonly<SiteConfig>;
124
+ };
125
+ type SiteApi = {
126
+ get(): Readonly<SiteConfig>;
127
+ name(): string;
128
+ url(): string;
129
+ author(): string;
130
+ description(): string;
131
+ };
132
+ //#endregion
133
+ //#region src/plugins/i18n/types.d.ts
134
+ /** @file i18n plugin types — I18nConfig (generic over locale tuple), I18nState, I18nApi. */
135
+ type I18nConfig<TLocales extends readonly string[] = readonly string[]> = {
136
+ /** Active locale codes (literal tuple preserved). */locales: TLocales; /** Default locale (must be member of locales). */
137
+ defaultLocale: TLocales[number]; /** Display names per locale. */
138
+ localeNames: Record<TLocales[number], string>; /** OG locale format mapping (e.g., { en: 'en_US' }). */
139
+ ogLocaleMap?: Partial<Record<TLocales[number], string>>; /** UI translation strings per locale. */
140
+ translations?: Record<TLocales[number], Record<string, string>>;
141
+ };
142
+ type I18nState<TLocales extends readonly string[] = readonly string[]> = {
143
+ config: Readonly<I18nConfig<TLocales>>;
144
+ };
145
+ type I18nApi<TLocales extends readonly string[] = readonly string[]> = {
146
+ locales(): TLocales;
147
+ defaultLocale(): TLocales[number];
148
+ localeName(locale: TLocales[number]): string;
149
+ ogLocale(locale: TLocales[number]): string;
150
+ t(locale: TLocales[number], key: string): string;
151
+ };
152
+ //#endregion
153
+ //#region src/plugins/router/types.d.ts
154
+ /** @file router plugin types — RouteSpec (non-accumulating), RouteBuilder, RouterApi. */
155
+ /** Render context passed to route handlers. */
156
+ type RenderContext = {
157
+ url: string;
158
+ locale: string;
159
+ params: Record<string, string>;
160
+ data?: unknown;
161
+ };
162
+ type LayoutComponent = unknown;
163
+ type VNode = unknown;
164
+ type HeadConfig = unknown;
165
+ type RouteSpec = {
166
+ pattern: string;
167
+ load?: (params: Record<string, string>) => unknown;
168
+ layout?: LayoutComponent;
169
+ render?: (ctx: RenderContext) => VNode;
170
+ generate?: (locale: string) => Array<{
171
+ params: Record<string, string>;
172
+ }>;
173
+ head?: (ctx: RenderContext) => HeadConfig;
174
+ meta?: Record<string, unknown>;
175
+ toJson?: (ctx: RenderContext) => object;
176
+ toFile?: (ctx: RenderContext) => {
177
+ name: string;
178
+ content: string | Uint8Array;
179
+ };
180
+ };
181
+ /**
182
+ * Non-accumulating fluent builder. Methods mutate an internal spec and return `this`
183
+ * typed as the same `RouteBuilder` — type information captured in `RouteSpec` shape,
184
+ * not builder generics. Prevents TS inference performance collapse at 50+ routes.
185
+ */
186
+ type RouteBuilder = {
187
+ load<T>(fn: (params: Record<string, string>) => T | Promise<T>): RouteBuilder;
188
+ layout(component: LayoutComponent): RouteBuilder;
189
+ render(fn: (ctx: RenderContext) => VNode): RouteBuilder;
190
+ generate(fn: (locale: string) => Array<{
191
+ params: Record<string, string>;
192
+ }>): RouteBuilder;
193
+ head(fn: (ctx: RenderContext) => HeadConfig): RouteBuilder;
194
+ meta(data: Record<string, unknown>): RouteBuilder;
195
+ toJson(fn: (ctx: RenderContext) => object): RouteBuilder;
196
+ toFile(fn: (ctx: RenderContext) => {
197
+ name: string;
198
+ content: string | Uint8Array;
199
+ }): RouteBuilder; /** Internal: produce the RouteSpec object. */
200
+ _spec(): RouteSpec;
201
+ };
202
+ type RouteEntry = {
203
+ name: string;
204
+ spec: RouteSpec;
205
+ specificity: number;
206
+ };
207
+ type RouterConfig<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
208
+ routes: Routes;
209
+ defaultPage?: keyof Routes & string;
210
+ };
211
+ type RouterState<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
212
+ routes: Routes;
213
+ entries: ReadonlyArray<RouteEntry>;
214
+ };
215
+ type RouterApi<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
216
+ routes: Routes;
217
+ toUrl<K extends keyof Routes>(name: K, params: Record<string, string>): string;
218
+ match(url: string): {
219
+ entry: RouteEntry;
220
+ params: Record<string, string>;
221
+ } | null;
222
+ entries(): ReadonlyArray<RouteEntry>;
223
+ };
224
+ //#endregion
225
+ //#region src/plugins/content/types.d.ts
226
+ type Frontmatter = {
227
+ title: string;
228
+ date: string;
229
+ description: string;
230
+ tags: string[];
231
+ language: string;
232
+ author?: string;
233
+ draft?: boolean;
234
+ [key: string]: unknown;
235
+ };
236
+ type ComputedFields = {
237
+ contentId: string;
238
+ readingTimeMinutes: number;
239
+ wordCount: number;
240
+ };
241
+ type Article = {
242
+ slug: string;
243
+ locale: string;
244
+ frontmatter: Frontmatter;
245
+ html: string;
246
+ computed: ComputedFields;
247
+ };
248
+ type RehypePluginEntry = readonly [unknown, Record<string, unknown>?];
249
+ type RemarkPluginEntry = readonly [unknown, Record<string, unknown>?];
250
+ type ContentConfig = {
251
+ dir: string;
252
+ defaultAuthor?: string;
253
+ trustedContent: boolean;
254
+ rehypePlugins?: RehypePluginEntry[];
255
+ remarkPlugins?: RemarkPluginEntry[];
256
+ };
257
+ type ContentState = {
258
+ processor: Processor | null;
259
+ articles: Map<string, Map<string, Article>>;
260
+ slugs: string[] | null;
261
+ lastPaths: Set<string>; /** Paths marked stale by `invalidate()` — re-read on next `loadAll()` then cleared. */
262
+ dirtyPaths: Set<string>;
263
+ };
264
+ type ContentApi = {
265
+ loadAll(): Promise<Map<string, Article[]>>;
266
+ load(slug: string, locale: string): Promise<Article | null>;
267
+ discoverSlugs(): Promise<string[]>;
268
+ render(markdown: string): Promise<string>;
269
+ invalidate(paths: string[]): void;
270
+ reset(): void;
271
+ };
272
+ //#endregion
273
+ //#region src/plugins/build/types.d.ts
274
+ type BuildConfig = {
275
+ outdir: string;
276
+ mode: 'production' | 'development';
277
+ renderMode: 'ssg' | 'spa' | 'hybrid';
278
+ cssEntry?: string;
279
+ jsEntry?: string;
280
+ articleRouteKey?: string;
281
+ sourcemap?: 'none' | 'external' | 'inline';
282
+ };
283
+ type BundleManifest = {
284
+ cssPaths: string[];
285
+ jsPaths: string[];
286
+ assets: Map<string, string>;
287
+ };
288
+ type BuildState = {
289
+ manifest: BundleManifest | null;
290
+ lastResult: BuildResult | null;
291
+ };
292
+ type BuildResult = {
293
+ pages: number;
294
+ durationMs: number;
295
+ manifest: BundleManifest;
296
+ };
297
+ type BuildApi = {
298
+ run(): Promise<BuildResult>;
299
+ getManifest(): Readonly<BundleManifest> | null;
300
+ };
301
+ //#endregion
302
+ //#region src/project.d.ts
303
+ /**
304
+ * Map each consumer `RouteBuilder` to the `RouteSpec` shape the router stores.
305
+ *
306
+ * Keys are preserved so `toUrl(name, ...)` and `defaultPage` stay typed.
307
+ */
308
+ type RouteSpecMap<Routes extends Record<string, RouteBuilder>> = { [K in keyof Routes]: RouteSpec };
309
+ /**
310
+ * Consumer-facing flat config shape.
311
+ *
312
+ * Generic over Routes (a record of `RouteBuilder`) so the literal route-name
313
+ * keys flow through to `app.router.routes` after the wrapper assembles the app.
314
+ */
315
+ type WebAppConfig<Routes extends Record<string, RouteBuilder>> = {
316
+ mode?: 'production' | 'development';
317
+ site: SiteConfig;
318
+ i18n: I18nConfig;
319
+ routes: Routes;
320
+ components?: ComponentDef[];
321
+ spa?: {
322
+ viewTransitions?: boolean;
323
+ progressBar?: boolean;
324
+ };
325
+ ogImage?: OGImageConfig;
326
+ contentDir: string;
327
+ defaultPage?: keyof Routes & string;
328
+ trustedContent?: boolean;
329
+ };
330
+ //#endregion
331
+ //#region src/plugins/router/route-builder.d.ts
332
+ /**
333
+ * Build a `RouteSpec` via a fluent, non-accumulating builder.
334
+ *
335
+ * Methods mutate a single internal `RouteSpec` and return the same builder typed
336
+ * as `RouteBuilder` (NOT `RouteBuilder<T>`). Type information lives on the
337
+ * `RouteSpec` shape, not in builder generics — this keeps TS inference O(1) per
338
+ * route and prevents the 50+ route inference collapse described in D5.
339
+ *
340
+ * @param pattern - URL pattern (e.g. `/about`, `/{slug}`, `/{lang:?}/{slug}/`).
341
+ * @returns A `RouteBuilder` that mutates an internal spec.
342
+ * @example
343
+ * ```ts
344
+ * const home = route('/{lang:?}/').render(({ locale }) => <Home locale={locale} />)
345
+ * ```
346
+ */
347
+ declare function route(pattern: string): RouteBuilder;
348
+ //#endregion
349
+ export { EnvApi as C, EnvVarSpec as D, EnvState as E, LogApi as O, Events as S, EnvProvider as T, I18nConfig as _, BuildConfig as a, SiteState as b, ContentApi as c, RouteBuilder as d, RouteSpec as f, I18nApi as g, RouterState as h, BuildApi as i, LogState as k, ContentConfig as l, RouterConfig as m, RouteSpecMap as n, BuildState as o, RouterApi as p, WebAppConfig as r, Article as s, route as t, ContentState as u, I18nState as v, EnvConfig as w, Config as x, SiteApi as y };
package/dist/index.cjs ADDED
@@ -0,0 +1,46 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_project = require('./project-C1vtMxE8.cjs');
3
+ const require_factory = require('./factory-CixCpR9C.cjs');
4
+ const require_primitives = require('./primitives-BYUp6kae.cjs');
5
+ const require_plugins_spa_index = require('./plugins/spa/index.cjs');
6
+
7
+ //#region src/index.ts
8
+ /** @file Framework entry — Layer-2 createApp wrapper + barrel re-exports. */
9
+ const { createApp: kernelCreateApp } = require_factory.createCore(require_factory.coreConfig, { plugins: [
10
+ require_factory.site,
11
+ require_factory.i18n,
12
+ require_project.content,
13
+ require_factory.router,
14
+ require_factory.head,
15
+ require_project.build,
16
+ require_plugins_spa_index.spa
17
+ ] });
18
+ /**
19
+ * Layer-2 createApp wrapper — generic-preserving signature.
20
+ *
21
+ * Projects the consumer's flat config into pluginConfigs before delegating to
22
+ * the kernel-bound createApp. The Routes generic flows through to
23
+ * `app.router.routes` so callers get typed access to their route names.
24
+ *
25
+ * @param input - Consumer-facing flat web-app config.
26
+ * @returns The assembled app with typed router routes.
27
+ */
28
+ function createApp(input) {
29
+ const projected = require_project.project(input);
30
+ return kernelCreateApp({
31
+ ...projected.config === void 0 ? {} : { config: projected.config },
32
+ pluginConfigs: projected.pluginConfigs
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ exports.canonical = require_primitives.canonical;
38
+ exports.createApp = createApp;
39
+ exports.createComponent = require_factory.createComponent;
40
+ exports.feedLink = require_primitives.feedLink;
41
+ exports.hreflang = require_primitives.hreflang;
42
+ exports.jsonLd = require_primitives.jsonLd;
43
+ exports.meta = require_primitives.meta;
44
+ exports.og = require_primitives.og;
45
+ exports.route = require_factory.route;
46
+ exports.twitter = require_primitives.twitter;
@@ -0,0 +1,135 @@
1
+ import { C as EnvApi, E as EnvState, O as LogApi, S as Events, _ as I18nConfig, a as BuildConfig, b as SiteState, c as ContentApi, d as RouteBuilder, f as RouteSpec, g as I18nApi, h as RouterState, i as BuildApi, k as LogState, l as ContentConfig, m as RouterConfig, n as RouteSpecMap, o as BuildState, p as RouterApi, r as WebAppConfig, s as Article, t as route, u as ContentState, v as I18nState, x as Config, y as SiteApi } from "./route-builder-Lv6HUVvP.cjs";
2
+ import { a as meta, d as HeadPluginConfig, f as HeadState, i as jsonLd, l as HeadApi, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical } from "./primitives-BBo4wxUL.cjs";
3
+ import { a as SpaConfig, i as SpaApi, n as ComponentDef, o as SpaState, r as ComponentHooks, t as createComponent } from "./factory-D0m7Xil2.cjs";
4
+ import * as _moku_labs_core0 from "@moku-labs/core";
5
+
6
+ //#region src/index.d.ts
7
+ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_core0.AnyPluginInstance[] = readonly []>(options?: _moku_labs_core0.CreateAppOptions<Config, Events, (_moku_labs_core0.PluginInstance<"site", {
8
+ name: string;
9
+ url: string;
10
+ author: string;
11
+ description: string;
12
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
13
+ 'router:registered': {
14
+ routeCount: number;
15
+ };
16
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
17
+ 'component:create': {
18
+ name: string;
19
+ element: Element;
20
+ };
21
+ 'component:mount': {
22
+ name: string;
23
+ element: Element;
24
+ };
25
+ 'component:unmount': {
26
+ name: string;
27
+ reason: "navigation" | "destroy";
28
+ };
29
+ 'component:destroy': {
30
+ name: string;
31
+ };
32
+ 'nav:start': {
33
+ url: string;
34
+ fromUrl: string;
35
+ };
36
+ 'nav:end': {
37
+ url: string;
38
+ };
39
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
40
+ 'content:ready': {
41
+ articles: Map<string, Article[]>;
42
+ };
43
+ 'content:invalidated': {
44
+ paths: string[];
45
+ };
46
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
47
+ 'build:phase': {
48
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
49
+ };
50
+ 'build:complete': {
51
+ pages: number;
52
+ durationMs: number;
53
+ };
54
+ }> & Record<never, never>) | ExtraPlugins[number], [...ExtraPlugins], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
55
+ level: "info";
56
+ mode: "auto";
57
+ }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
58
+ schema: {};
59
+ providers: never[];
60
+ publicPrefix: string;
61
+ }, EnvState, EnvApi>]>> | undefined) => _moku_labs_core0.App<Config, Events, (_moku_labs_core0.PluginInstance<"site", {
62
+ name: string;
63
+ url: string;
64
+ author: string;
65
+ description: string;
66
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
67
+ 'router:registered': {
68
+ routeCount: number;
69
+ };
70
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
71
+ 'component:create': {
72
+ name: string;
73
+ element: Element;
74
+ };
75
+ 'component:mount': {
76
+ name: string;
77
+ element: Element;
78
+ };
79
+ 'component:unmount': {
80
+ name: string;
81
+ reason: "navigation" | "destroy";
82
+ };
83
+ 'component:destroy': {
84
+ name: string;
85
+ };
86
+ 'nav:start': {
87
+ url: string;
88
+ fromUrl: string;
89
+ };
90
+ 'nav:end': {
91
+ url: string;
92
+ };
93
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
94
+ 'content:ready': {
95
+ articles: Map<string, Article[]>;
96
+ };
97
+ 'content:invalidated': {
98
+ paths: string[];
99
+ };
100
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
101
+ 'build:phase': {
102
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
103
+ };
104
+ 'build:complete': {
105
+ pages: number;
106
+ durationMs: number;
107
+ };
108
+ }> & Record<never, never>) | ExtraPlugins[number], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
109
+ level: "info";
110
+ mode: "auto";
111
+ }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
112
+ schema: {};
113
+ providers: never[];
114
+ publicPrefix: string;
115
+ }, EnvState, EnvApi>]>>;
116
+ /**
117
+ * Kernel app augmented so `app.router.routes` carries the consumer's literal
118
+ * route-name keys (with `RouteSpec` values — the shape the router stores).
119
+ */
120
+ type WebApp<Routes extends Record<string, RouteBuilder>> = Omit<ReturnType<typeof kernelCreateApp>, 'router'> & {
121
+ router: RouterApi<RouteSpecMap<Routes>>;
122
+ };
123
+ /**
124
+ * Layer-2 createApp wrapper — generic-preserving signature.
125
+ *
126
+ * Projects the consumer's flat config into pluginConfigs before delegating to
127
+ * the kernel-bound createApp. The Routes generic flows through to
128
+ * `app.router.routes` so callers get typed access to their route names.
129
+ *
130
+ * @param input - Consumer-facing flat web-app config.
131
+ * @returns The assembled app with typed router routes.
132
+ */
133
+ declare function createApp<Routes extends Record<string, RouteBuilder>>(input: WebAppConfig<Routes>): WebApp<Routes>;
134
+ //#endregion
135
+ export { type ComponentDef, type ComponentHooks, type Config, type Events, type RouteBuilder, type RouteSpec, WebApp, type WebAppConfig, canonical, createApp, createComponent, feedLink, hreflang, jsonLd, meta, og, route, twitter };
@@ -0,0 +1,135 @@
1
+ import { C as EnvApi, E as EnvState, O as LogApi, S as Events, _ as I18nConfig, a as BuildConfig, b as SiteState, c as ContentApi, d as RouteBuilder, f as RouteSpec, g as I18nApi, h as RouterState, i as BuildApi, k as LogState, l as ContentConfig, m as RouterConfig, n as RouteSpecMap, o as BuildState, p as RouterApi, r as WebAppConfig, s as Article, t as route, u as ContentState, v as I18nState, x as Config, y as SiteApi } from "./index-CWdZdegx.mjs";
2
+ import { a as meta, d as HeadPluginConfig, f as HeadState, i as jsonLd, l as HeadApi, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical } from "./primitives-kuZFxqV7.mjs";
3
+ import { a as SpaConfig, i as SpaApi, n as ComponentDef, o as SpaState, r as ComponentHooks, t as createComponent } from "./factory-BBVQO5ZG.mjs";
4
+ import * as _moku_labs_core0 from "@moku-labs/core";
5
+
6
+ //#region src/index.d.ts
7
+ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_core0.AnyPluginInstance[] = readonly []>(options?: _moku_labs_core0.CreateAppOptions<Config, Events, (_moku_labs_core0.PluginInstance<"site", {
8
+ name: string;
9
+ url: string;
10
+ author: string;
11
+ description: string;
12
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
13
+ 'router:registered': {
14
+ routeCount: number;
15
+ };
16
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
17
+ 'component:create': {
18
+ name: string;
19
+ element: Element;
20
+ };
21
+ 'component:mount': {
22
+ name: string;
23
+ element: Element;
24
+ };
25
+ 'component:unmount': {
26
+ name: string;
27
+ reason: "navigation" | "destroy";
28
+ };
29
+ 'component:destroy': {
30
+ name: string;
31
+ };
32
+ 'nav:start': {
33
+ url: string;
34
+ fromUrl: string;
35
+ };
36
+ 'nav:end': {
37
+ url: string;
38
+ };
39
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
40
+ 'content:ready': {
41
+ articles: Map<string, Article[]>;
42
+ };
43
+ 'content:invalidated': {
44
+ paths: string[];
45
+ };
46
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
47
+ 'build:phase': {
48
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
49
+ };
50
+ 'build:complete': {
51
+ pages: number;
52
+ durationMs: number;
53
+ };
54
+ }> & Record<never, never>) | ExtraPlugins[number], [...ExtraPlugins], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
55
+ level: "info";
56
+ mode: "auto";
57
+ }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
58
+ schema: {};
59
+ providers: never[];
60
+ publicPrefix: string;
61
+ }, EnvState, EnvApi>]>> | undefined) => _moku_labs_core0.App<Config, Events, (_moku_labs_core0.PluginInstance<"site", {
62
+ name: string;
63
+ url: string;
64
+ author: string;
65
+ description: string;
66
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
67
+ 'router:registered': {
68
+ routeCount: number;
69
+ };
70
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
71
+ 'component:create': {
72
+ name: string;
73
+ element: Element;
74
+ };
75
+ 'component:mount': {
76
+ name: string;
77
+ element: Element;
78
+ };
79
+ 'component:unmount': {
80
+ name: string;
81
+ reason: "navigation" | "destroy";
82
+ };
83
+ 'component:destroy': {
84
+ name: string;
85
+ };
86
+ 'nav:start': {
87
+ url: string;
88
+ fromUrl: string;
89
+ };
90
+ 'nav:end': {
91
+ url: string;
92
+ };
93
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
94
+ 'content:ready': {
95
+ articles: Map<string, Article[]>;
96
+ };
97
+ 'content:invalidated': {
98
+ paths: string[];
99
+ };
100
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
101
+ 'build:phase': {
102
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
103
+ };
104
+ 'build:complete': {
105
+ pages: number;
106
+ durationMs: number;
107
+ };
108
+ }> & Record<never, never>) | ExtraPlugins[number], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
109
+ level: "info";
110
+ mode: "auto";
111
+ }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
112
+ schema: {};
113
+ providers: never[];
114
+ publicPrefix: string;
115
+ }, EnvState, EnvApi>]>>;
116
+ /**
117
+ * Kernel app augmented so `app.router.routes` carries the consumer's literal
118
+ * route-name keys (with `RouteSpec` values — the shape the router stores).
119
+ */
120
+ type WebApp<Routes extends Record<string, RouteBuilder>> = Omit<ReturnType<typeof kernelCreateApp>, 'router'> & {
121
+ router: RouterApi<RouteSpecMap<Routes>>;
122
+ };
123
+ /**
124
+ * Layer-2 createApp wrapper — generic-preserving signature.
125
+ *
126
+ * Projects the consumer's flat config into pluginConfigs before delegating to
127
+ * the kernel-bound createApp. The Routes generic flows through to
128
+ * `app.router.routes` so callers get typed access to their route names.
129
+ *
130
+ * @param input - Consumer-facing flat web-app config.
131
+ * @returns The assembled app with typed router routes.
132
+ */
133
+ declare function createApp<Routes extends Record<string, RouteBuilder>>(input: WebAppConfig<Routes>): WebApp<Routes>;
134
+ //#endregion
135
+ export { type ComponentDef, type ComponentHooks, type Config, type Events, type RouteBuilder, type RouteSpec, WebApp, type WebAppConfig, canonical, createApp, createComponent, feedLink, hreflang, jsonLd, meta, og, route, twitter };