@moku-labs/web 0.1.0-alpha.3 → 0.2.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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +71 -23
  3. package/dist/chunk-DQk6qfdC.mjs +18 -0
  4. package/dist/index.cjs +5514 -36
  5. package/dist/index.d.cts +2078 -104
  6. package/dist/index.d.mts +2078 -104
  7. package/dist/index.mjs +5394 -28
  8. package/package.json +60 -60
  9. package/dist/bin/moku.cjs +0 -1383
  10. package/dist/bin/moku.d.cts +0 -1
  11. package/dist/bin/moku.d.mts +0 -1
  12. package/dist/bin/moku.mjs +0 -1383
  13. package/dist/factory-BHhulW27.d.mts +0 -90
  14. package/dist/factory-D0m7Xil2.d.cts +0 -90
  15. package/dist/factory-DVcAQYEZ.cjs +0 -1710
  16. package/dist/factory-DwpBwjDk.mjs +0 -1602
  17. package/dist/index-CddOHo8I.d.mts +0 -413
  18. package/dist/plugins/head/build.cjs +0 -35
  19. package/dist/plugins/head/build.d.cts +0 -17
  20. package/dist/plugins/head/build.d.mts +0 -17
  21. package/dist/plugins/head/build.mjs +0 -27
  22. package/dist/plugins/spa/index.cjs +0 -26
  23. package/dist/plugins/spa/index.d.cts +0 -30
  24. package/dist/plugins/spa/index.d.mts +0 -30
  25. package/dist/plugins/spa/index.mjs +0 -24
  26. package/dist/primitives-BBo4wxUL.d.cts +0 -69
  27. package/dist/primitives-BYUp6kae.cjs +0 -100
  28. package/dist/primitives-Dlfi3JTx.d.mts +0 -69
  29. package/dist/primitives-gO5i1tD8.mjs +0 -58
  30. package/dist/project-1pAh4RxJ.cjs +0 -1270
  31. package/dist/project-BaG_ipVz.mjs +0 -1203
  32. package/dist/route-builder-CKvvehVO.d.cts +0 -413
  33. package/dist/test.cjs +0 -82
  34. package/dist/test.d.cts +0 -61
  35. package/dist/test.d.mts +0 -61
  36. package/dist/test.mjs +0 -79
  37. package/dist/wrangler-BHdkyMRj.cjs +0 -423
  38. package/dist/wrangler-Coyrznz4.mjs +0 -369
@@ -1,413 +0,0 @@
1
- import { p as OGImageConfig } from "./primitives-Dlfi3JTx.mjs";
2
- import { n as ComponentDef } from "./factory-BHhulW27.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/content/types.d.ts
154
- type Frontmatter = {
155
- title: string;
156
- date: string;
157
- description: string;
158
- tags: string[];
159
- language: string;
160
- author?: string;
161
- draft?: boolean;
162
- [key: string]: unknown;
163
- };
164
- type ComputedFields = {
165
- contentId: string;
166
- readingTimeMinutes: number;
167
- wordCount: number;
168
- };
169
- type Article = {
170
- slug: string;
171
- locale: string;
172
- frontmatter: Frontmatter;
173
- html: string;
174
- computed: ComputedFields;
175
- };
176
- type RehypePluginEntry = readonly [unknown, Record<string, unknown>?];
177
- type RemarkPluginEntry = readonly [unknown, Record<string, unknown>?];
178
- type ContentConfig = {
179
- dir: string;
180
- defaultAuthor?: string;
181
- trustedContent: boolean;
182
- rehypePlugins?: RehypePluginEntry[];
183
- remarkPlugins?: RemarkPluginEntry[];
184
- };
185
- type ContentState = {
186
- processor: Processor | null;
187
- articles: Map<string, Map<string, Article>>;
188
- slugs: string[] | null;
189
- lastPaths: Set<string>; /** Paths marked stale by `invalidate()` — re-read on next `loadAll()` then cleared. */
190
- dirtyPaths: Set<string>;
191
- };
192
- type ContentApi = {
193
- loadAll(): Promise<Map<string, Article[]>>;
194
- load(slug: string, locale: string): Promise<Article | null>;
195
- discoverSlugs(): Promise<string[]>;
196
- render(markdown: string): Promise<string>;
197
- invalidate(paths: string[]): void;
198
- reset(): void;
199
- };
200
- //#endregion
201
- //#region src/plugins/router/types.d.ts
202
- /** @file router plugin types — RouteSpec (non-accumulating), RouteBuilder, RouterApi. */
203
- /** Render context passed to route handlers. */
204
- type RenderContext = {
205
- url: string;
206
- locale: string;
207
- params: Record<string, string>;
208
- data?: unknown;
209
- };
210
- type LayoutComponent = unknown;
211
- type VNode = unknown;
212
- type HeadConfig = unknown;
213
- type RouteSpec = {
214
- pattern: string;
215
- load?: (params: Record<string, string>) => unknown;
216
- layout?: LayoutComponent;
217
- render?: (ctx: RenderContext) => VNode;
218
- generate?: (locale: string) => Array<{
219
- params: Record<string, string>;
220
- }>;
221
- head?: (ctx: RenderContext) => HeadConfig;
222
- meta?: Record<string, unknown>;
223
- toJson?: (ctx: RenderContext) => object;
224
- toFile?: (ctx: RenderContext) => {
225
- name: string;
226
- content: string | Uint8Array;
227
- };
228
- };
229
- /**
230
- * Non-accumulating fluent builder. Methods mutate an internal spec and return `this`
231
- * typed as the same `RouteBuilder` — type information captured in `RouteSpec` shape,
232
- * not builder generics. Prevents TS inference performance collapse at 50+ routes.
233
- */
234
- type RouteBuilder = {
235
- load<T>(fn: (params: Record<string, string>) => T | Promise<T>): RouteBuilder;
236
- layout(component: LayoutComponent): RouteBuilder;
237
- render(fn: (ctx: RenderContext) => VNode): RouteBuilder;
238
- generate(fn: (locale: string) => Array<{
239
- params: Record<string, string>;
240
- }>): RouteBuilder;
241
- head(fn: (ctx: RenderContext) => HeadConfig): RouteBuilder;
242
- meta(data: Record<string, unknown>): RouteBuilder;
243
- toJson(fn: (ctx: RenderContext) => object): RouteBuilder;
244
- toFile(fn: (ctx: RenderContext) => {
245
- name: string;
246
- content: string | Uint8Array;
247
- }): RouteBuilder; /** Internal: produce the RouteSpec object. */
248
- _spec(): RouteSpec;
249
- };
250
- type RouteEntry = {
251
- name: string;
252
- spec: RouteSpec;
253
- specificity: number;
254
- };
255
- type RouterConfig<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
256
- routes: Routes;
257
- defaultPage?: keyof Routes & string;
258
- };
259
- type RouterState<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
260
- routes: Routes;
261
- entries: ReadonlyArray<RouteEntry>;
262
- };
263
- type RouterApi<Routes extends Record<string, RouteSpec> = Record<string, RouteSpec>> = {
264
- routes: Routes;
265
- toUrl<K extends keyof Routes>(name: K, params: Record<string, string>): string;
266
- match(url: string): {
267
- entry: RouteEntry;
268
- params: Record<string, string>;
269
- } | null;
270
- entries(): ReadonlyArray<RouteEntry>;
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/plugins/deploy/types.d.ts
303
- /** @file deploy plugin types — DeployConfig, DeployState, DeployResult, RunOptions, DeployApi. */
304
- /**
305
- * Deployment target. Phase 1 ships `'pages'` only; `'workers'` is reserved
306
- * for the Workers Static Assets expansion path and `buildWranglerArgs`
307
- * throws "not implemented in Phase 1" if invoked with it.
308
- */
309
- type DeployTarget = 'pages' | 'workers';
310
- /**
311
- * deploy plugin config.
312
- *
313
- * `outdir` precedence at deploy time: `wrangler.jsonc#pages_build_output_dir`
314
- * (written by `moku deploy init`) — this is the deploy-time single source of
315
- * truth, NOT `DeployConfig.outdir`. The config field is the *init-time* default;
316
- * once `wrangler.jsonc` exists, it owns the value.
317
- *
318
- * Forbidden: reading the `build` plugin's config via `ctx.has(build)` /
319
- * `ctx.require(build).config.outdir`. The core `HasFunction` takes a name
320
- * string and returns a non-narrowing boolean; `RequireFunction` returns the
321
- * API surface only (`BuildApi = { run, getManifest }`). The optional coupling
322
- * is a `ctx.log.warn` at init time when divergence is detectable through the
323
- * directly-imported `build` plugin instance, never via the core API.
324
- */
325
- type DeployConfig = {
326
- /** Deployment target. Default: `'pages'`. */target: DeployTarget; /** Build output directory used at init only. Default: `'dist'` (matches build plugin default). */
327
- outdir: string; /** Production branch name. Default: `'main'`. Overwritten by `init` via `git symbolic-ref`. */
328
- productionBranch: string; /** Optional explicit override for the Cloudflare Pages project name. Default: derived from `site.name`. */
329
- projectName?: string;
330
- };
331
- /**
332
- * In-memory deploy plugin state.
333
- *
334
- * `lastDeployment` is reset per `createApp()` call and captures the most
335
- * recent deploy's metadata (URL, deployment ID, branch, duration). Used by
336
- * the future REST-API-based rollback command (deferred from Phase 1).
337
- */
338
- type DeployState = {
339
- lastDeployment: DeployResult | null;
340
- };
341
- /** Result of a successful `app.deploy.run()` invocation. */
342
- type DeployResult = {
343
- /** Production URL (e.g., `https://<project>.pages.dev`) or branch-alias preview URL. */url: string; /** Cloudflare deployment ID — captured for future rollback support. */
344
- deploymentId: string; /** Branch the deploy was published to. */
345
- branch: string; /** Total subprocess duration in milliseconds (init + upload + finalize). */
346
- durationMs: number;
347
- };
348
- /**
349
- * Options accepted by `app.deploy.run()`.
350
- *
351
- * `branch` overrides the production branch from wrangler.jsonc (defaults to
352
- * `DeployConfig.productionBranch`). `build` runs `app.build.run()` first
353
- * when true — used only for local convenience; the generated CI workflow
354
- * always issues the two-step `moku build` then `moku deploy` pattern.
355
- */
356
- type RunOptions = {
357
- /** Override the production branch for this deploy. */branch?: string; /** Run `app.build.run()` first (local convenience). Default: `false`. */
358
- build?: boolean;
359
- };
360
- /** Public deploy plugin API surface, attached as `app.deploy`. */
361
- type DeployApi = {
362
- /** Run a deploy. Reads outdir from wrangler.jsonc; errors if missing. */run(options?: RunOptions): Promise<DeployResult>; /** Read the last deployment result without re-running. */
363
- getLastDeployment(): Readonly<DeployResult> | null;
364
- };
365
- //#endregion
366
- //#region src/project.d.ts
367
- /**
368
- * Map each consumer `RouteBuilder` to the `RouteSpec` shape the router stores.
369
- *
370
- * Keys are preserved so `toUrl(name, ...)` and `defaultPage` stay typed.
371
- */
372
- type RouteSpecMap<Routes extends Record<string, RouteBuilder>> = { [K in keyof Routes]: RouteSpec };
373
- /**
374
- * Consumer-facing flat config shape.
375
- *
376
- * Generic over Routes (a record of `RouteBuilder`) so the literal route-name
377
- * keys flow through to `app.router.routes` after the wrapper assembles the app.
378
- */
379
- type WebAppConfig<Routes extends Record<string, RouteBuilder>> = {
380
- mode?: 'production' | 'development';
381
- site: SiteConfig;
382
- i18n: I18nConfig;
383
- routes: Routes;
384
- components?: ComponentDef[];
385
- spa?: {
386
- viewTransitions?: boolean;
387
- progressBar?: boolean;
388
- };
389
- ogImage?: OGImageConfig;
390
- contentDir: string;
391
- defaultPage?: keyof Routes & string;
392
- trustedContent?: boolean;
393
- };
394
- //#endregion
395
- //#region src/plugins/router/route-builder.d.ts
396
- /**
397
- * Build a `RouteSpec` via a fluent, non-accumulating builder.
398
- *
399
- * Methods mutate a single internal `RouteSpec` and return the same builder typed
400
- * as `RouteBuilder` (NOT `RouteBuilder<T>`). Type information lives on the
401
- * `RouteSpec` shape, not in builder generics — this keeps TS inference O(1) per
402
- * route and prevents the 50+ route inference collapse described in D5.
403
- *
404
- * @param pattern - URL pattern (e.g. `/about`, `/{slug}`, `/{lang:?}/{slug}/`).
405
- * @returns A `RouteBuilder` that mutates an internal spec.
406
- * @example
407
- * ```ts
408
- * const home = route('/{lang:?}/').render(({ locale }) => <Home locale={locale} />)
409
- * ```
410
- */
411
- declare function route(pattern: string): RouteBuilder;
412
- //#endregion
413
- export { EnvVarSpec as A, SiteState as C, EnvConfig as D, EnvApi as E, LogState as M, EnvProvider as O, SiteApi as S, Events as T, ContentConfig as _, DeployConfig as a, I18nConfig as b, BuildConfig as c, RouteSpec as d, RouterApi as f, ContentApi as g, Article as h, DeployApi as i, LogApi as j, EnvState as k, BuildState as l, RouterState as m, RouteSpecMap as n, DeployState as o, RouterConfig as p, WebAppConfig as r, BuildApi as s, route as t, RouteBuilder as u, ContentState as v, Config as w, I18nState as x, I18nApi as y };
@@ -1,35 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_primitives = require('../../primitives-BYUp6kae.cjs');
3
-
4
- //#region src/plugins/head/build.ts
5
- /** @file Sub-path /build entry — pure build-time helpers (no plugin state access). */
6
- /**
7
- * Build a list of head elements for an article page from its frontmatter.
8
- * Pure function — safe to call at build time without a plugin context.
9
- *
10
- * Always emits `<link rel=canonical>` and `<meta property=og:type content=article>`.
11
- * Adds `og:article:*` meta tags for any provided frontmatter fields.
12
- *
13
- * @param meta - Article frontmatter (publishedTime, modifiedTime, author, section, tags).
14
- * @param canonicalUrl - The fully-qualified canonical URL for the article.
15
- * @returns Ordered array of HeadElements ready to feed into `head.render()`.
16
- */
17
- const buildArticleHead = (meta, canonicalUrl) => {
18
- const elements = [require_primitives.canonical(canonicalUrl), require_primitives.og("type", "article")];
19
- if (meta.publishedTime) elements.push(require_primitives.og("article:published_time", meta.publishedTime));
20
- if (meta.modifiedTime) elements.push(require_primitives.og("article:modified_time", meta.modifiedTime));
21
- if (meta.author) elements.push(require_primitives.og("article:author", meta.author));
22
- if (meta.section) elements.push(require_primitives.og("article:section", meta.section));
23
- if (meta.tags) for (const tag of meta.tags) elements.push(require_primitives.og("article:tag", tag));
24
- return elements;
25
- };
26
-
27
- //#endregion
28
- exports.buildArticleHead = buildArticleHead;
29
- exports.canonical = require_primitives.canonical;
30
- exports.feedLink = require_primitives.feedLink;
31
- exports.hreflang = require_primitives.hreflang;
32
- exports.jsonLd = require_primitives.jsonLd;
33
- exports.meta = require_primitives.meta;
34
- exports.og = require_primitives.og;
35
- exports.twitter = require_primitives.twitter;
@@ -1,17 +0,0 @@
1
- import { a as meta, c as ArticleMeta, i as jsonLd, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical, u as HeadElement } from "../../primitives-BBo4wxUL.cjs";
2
-
3
- //#region src/plugins/head/build.d.ts
4
- /**
5
- * Build a list of head elements for an article page from its frontmatter.
6
- * Pure function — safe to call at build time without a plugin context.
7
- *
8
- * Always emits `<link rel=canonical>` and `<meta property=og:type content=article>`.
9
- * Adds `og:article:*` meta tags for any provided frontmatter fields.
10
- *
11
- * @param meta - Article frontmatter (publishedTime, modifiedTime, author, section, tags).
12
- * @param canonicalUrl - The fully-qualified canonical URL for the article.
13
- * @returns Ordered array of HeadElements ready to feed into `head.render()`.
14
- */
15
- declare const buildArticleHead: (meta: ArticleMeta, canonicalUrl: string) => HeadElement[];
16
- //#endregion
17
- export { type ArticleMeta, type HeadElement, buildArticleHead, canonical, feedLink, hreflang, jsonLd, meta, og, twitter };
@@ -1,17 +0,0 @@
1
- import { a as meta, c as ArticleMeta, i as jsonLd, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical, u as HeadElement } from "../../primitives-Dlfi3JTx.mjs";
2
-
3
- //#region src/plugins/head/build.d.ts
4
- /**
5
- * Build a list of head elements for an article page from its frontmatter.
6
- * Pure function — safe to call at build time without a plugin context.
7
- *
8
- * Always emits `<link rel=canonical>` and `<meta property=og:type content=article>`.
9
- * Adds `og:article:*` meta tags for any provided frontmatter fields.
10
- *
11
- * @param meta - Article frontmatter (publishedTime, modifiedTime, author, section, tags).
12
- * @param canonicalUrl - The fully-qualified canonical URL for the article.
13
- * @returns Ordered array of HeadElements ready to feed into `head.render()`.
14
- */
15
- declare const buildArticleHead: (meta: ArticleMeta, canonicalUrl: string) => HeadElement[];
16
- //#endregion
17
- export { type ArticleMeta, type HeadElement, buildArticleHead, canonical, feedLink, hreflang, jsonLd, meta, og, twitter };
@@ -1,27 +0,0 @@
1
- import { a as meta, i as jsonLd, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical } from "../../primitives-gO5i1tD8.mjs";
2
-
3
- //#region src/plugins/head/build.ts
4
- /** @file Sub-path /build entry — pure build-time helpers (no plugin state access). */
5
- /**
6
- * Build a list of head elements for an article page from its frontmatter.
7
- * Pure function — safe to call at build time without a plugin context.
8
- *
9
- * Always emits `<link rel=canonical>` and `<meta property=og:type content=article>`.
10
- * Adds `og:article:*` meta tags for any provided frontmatter fields.
11
- *
12
- * @param meta - Article frontmatter (publishedTime, modifiedTime, author, section, tags).
13
- * @param canonicalUrl - The fully-qualified canonical URL for the article.
14
- * @returns Ordered array of HeadElements ready to feed into `head.render()`.
15
- */
16
- const buildArticleHead = (meta, canonicalUrl) => {
17
- const elements = [canonical(canonicalUrl), og("type", "article")];
18
- if (meta.publishedTime) elements.push(og("article:published_time", meta.publishedTime));
19
- if (meta.modifiedTime) elements.push(og("article:modified_time", meta.modifiedTime));
20
- if (meta.author) elements.push(og("article:author", meta.author));
21
- if (meta.section) elements.push(og("article:section", meta.section));
22
- if (meta.tags) for (const tag of meta.tags) elements.push(og("article:tag", tag));
23
- return elements;
24
- };
25
-
26
- //#endregion
27
- export { buildArticleHead, canonical, feedLink, hreflang, jsonLd, meta, og, twitter };
@@ -1,26 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_factory = require('../../factory-DVcAQYEZ.cjs');
3
-
4
- //#region src/plugins/spa/index.ts
5
- /** @file spa plugin: Very Complex tier — router + head + progress + components sub-modules. */
6
- const defaultConfig = {
7
- config: {
8
- viewTransitions: false,
9
- progressBar: true
10
- },
11
- components: []
12
- };
13
- const spa = require_factory.createPlugin("spa", {
14
- depends: [require_factory.router, require_factory.head],
15
- config: defaultConfig,
16
- events: require_factory.registerSpaEvents,
17
- createState: require_factory.createSpaState,
18
- api: require_factory.createSpaApi,
19
- onStart: async (ctx) => {
20
- if (typeof window !== "undefined") await require_factory.createClientRuntime(ctx).start();
21
- }
22
- });
23
-
24
- //#endregion
25
- exports.createComponent = require_factory.createComponent;
26
- exports.spa = spa;
@@ -1,30 +0,0 @@
1
- import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-D0m7Xil2.cjs";
2
- import * as _moku_labs_core0 from "@moku-labs/core";
3
-
4
- //#region src/plugins/spa/index.d.ts
5
- declare const spa: _moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
6
- 'component:create': {
7
- name: string;
8
- element: Element;
9
- };
10
- 'component:mount': {
11
- name: string;
12
- element: Element;
13
- };
14
- 'component:unmount': {
15
- name: string;
16
- reason: "navigation" | "destroy";
17
- };
18
- 'component:destroy': {
19
- name: string;
20
- };
21
- 'nav:start': {
22
- url: string;
23
- fromUrl: string;
24
- };
25
- 'nav:end': {
26
- url: string;
27
- };
28
- }> & Record<never, never>;
29
- //#endregion
30
- export { createComponent, spa };
@@ -1,30 +0,0 @@
1
- import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-BHhulW27.mjs";
2
- import * as _moku_labs_core0 from "@moku-labs/core";
3
-
4
- //#region src/plugins/spa/index.d.ts
5
- declare const spa: _moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
6
- 'component:create': {
7
- name: string;
8
- element: Element;
9
- };
10
- 'component:mount': {
11
- name: string;
12
- element: Element;
13
- };
14
- 'component:unmount': {
15
- name: string;
16
- reason: "navigation" | "destroy";
17
- };
18
- 'component:destroy': {
19
- name: string;
20
- };
21
- 'nav:start': {
22
- url: string;
23
- fromUrl: string;
24
- };
25
- 'nav:end': {
26
- url: string;
27
- };
28
- }> & Record<never, never>;
29
- //#endregion
30
- export { createComponent, spa };
@@ -1,24 +0,0 @@
1
- import { a as createSpaApi, i as createClientRuntime, n as createSpaState, o as head, p as createPlugin, r as registerSpaEvents, s as router, t as createComponent } from "../../factory-DwpBwjDk.mjs";
2
-
3
- //#region src/plugins/spa/index.ts
4
- /** @file spa plugin: Very Complex tier — router + head + progress + components sub-modules. */
5
- const defaultConfig = {
6
- config: {
7
- viewTransitions: false,
8
- progressBar: true
9
- },
10
- components: []
11
- };
12
- const spa = createPlugin("spa", {
13
- depends: [router, head],
14
- config: defaultConfig,
15
- events: registerSpaEvents,
16
- createState: createSpaState,
17
- api: createSpaApi,
18
- onStart: async (ctx) => {
19
- if (typeof window !== "undefined") await createClientRuntime(ctx).start();
20
- }
21
- });
22
-
23
- //#endregion
24
- export { createComponent, spa };