@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
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Alex Kucherenko
3
+ Copyright (c) 2026 moku-labs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,38 +1,86 @@
1
1
  # @moku-labs/web
2
2
 
3
- Layer-2 static-site framework built on [`@moku-labs/core`](https://github.com/moku-labs/core). Plugin-composed, Bun-native, with built-in LLM-verifiable test trace and universal env injection.
3
+ **A content static-site generator + SPA web framework for TypeScript.** Built on
4
+ [@moku-labs/core](https://github.com/moku-labs/core) — three layers of isolation, plugins all the
5
+ way down, types doing the heavy lifting.
4
6
 
5
- **Status:** Alpha. Skeleton phase — see `.planning/` for specs.
6
-
7
- ## Quick Start
8
-
9
- ```bash
7
+ ```
10
8
  bun add @moku-labs/web
11
9
  ```
12
10
 
11
+ > Status: `0.1.0` — early. The API is settling but not yet frozen.
12
+
13
+ ---
14
+
15
+ ## What it is
16
+
17
+ `@moku-labs/web` composes a small set of focused plugins into one framework: author Markdown
18
+ content, declare type-safe routes, generate SEO-complete HTML + feeds + sitemap at build time, and
19
+ optionally hydrate islands and deploy to Cloudflare Pages.
20
+
21
+ The consumer surface is one `createApp` call plus a typed routing DSL — you never import from
22
+ `@moku-labs/core` directly.
23
+
24
+ ## Quick start
25
+
13
26
  ```ts
14
- import { createApp, route, meta, og, canonical } from '@moku-labs/web'
27
+ import { createApp, defineRoutes, route } from "@moku-labs/web";
28
+
29
+ const routes = defineRoutes({
30
+ home: route("/")
31
+ .render(() => <h1>My Blog</h1>)
32
+ .head(() => ({ title: "My Blog" })),
33
+ article: route("/{lang:?}/{slug}/")
34
+ .generate((locale) => listSlugs(locale).map((slug) => ({ lang: locale, slug })))
35
+ .load(({ slug }, locale) => loadArticle(slug, locale)) // widens ctx.data
36
+ .render((ctx) => <Article article={ctx.data} />)
37
+ .head((ctx) => ({ title: ctx.data.title, description: ctx.data.description }))
38
+ });
15
39
 
16
40
  const app = createApp({
17
- mode: 'production',
18
- site: { name: 'My Blog', url: 'https://example.com', author: 'Jane Doe', description: 'Personal blog' },
19
- i18n: { locales: ['en'] as const, defaultLocale: 'en', localeNames: { en: 'English' } },
20
- contentDir: '/abs/path/to/content',
21
- routes: {
22
- home: route('/').render(() => <HomePage />),
23
- },
24
- })
25
-
26
- await app.build.run()
41
+ config: { mode: "production" },
42
+ pluginConfigs: {
43
+ site: { name: "My Blog", url: "https://blog.dev", author: "Me", description: "A personal blog." },
44
+ i18n: { locales: ["en", "uk"], defaultLocale: "en" },
45
+ content: { contentDir: "./content" },
46
+ router: { routes, mode: "ssg" },
47
+ head: { titleTemplate: "%s — My Blog" },
48
+ build: { outDir: "dist", feeds: true, sitemap: true }
49
+ }
50
+ });
51
+
52
+ await app.build.run(); // → static site in dist/ (HTML, feed.xml, sitemap.xml)
27
53
  ```
28
54
 
29
- ## Architecture
55
+ Content lives on disk as `content/{slug}/{locale}.md` with YAML frontmatter
56
+ (`title`, `date`, `description`, `tags`, `language`, optional `draft`/`author`). Drafts are excluded
57
+ from production builds.
58
+
59
+ ## Plugins
60
+
61
+ | Plugin | Responsibility |
62
+ |---|---|
63
+ | `site` | Site identity (name, URL, author) + canonical URL helper |
64
+ | `i18n` | Locales, default-locale fallback, translations, hreflang/ogLocale maps |
65
+ | `router` | Type-safe route DSL (`route`/`defineRoutes`), matching, URL/file derivation |
66
+ | `content` | Markdown pipeline → sanitized HTML, frontmatter, reading time, locale model |
67
+ | `head` | SEO `<head>` composition: title template, canonical, OG/Twitter, JSON-LD, hreflang |
68
+ | `build` | SSG orchestrator: pages, feeds (RSS/Atom/JSON), sitemap, OG images |
69
+ | `spa` | Client runtime: island hydration + intercepted navigation |
70
+ | `deploy` | Cloudflare Pages: `wrangler.jsonc` scaffolding + deploy |
71
+ | `log`, `env` | Core plugins: structured logging + validated environment access |
30
72
 
31
- - **9 domain-grouped plugins** wired via `@moku-labs/core` micro-kernel
32
- - **Bun-native bundler** (no Vite subprocess)
33
- - **Generic-preserving `createApp` wrapper** projects flat config → `pluginConfigs`
34
- - **Dev mode** lives in `bin/moku.ts dev` (NOT a plugin)
73
+ SEO primitives are exported for route `.head()` handlers: `meta`, `og`, `twitter`, `jsonLd`,
74
+ `canonical`, `hreflang`, `feedLink`, `buildArticleHead`.
75
+
76
+ ## Scripts
77
+
78
+ ```
79
+ bun run build # build with tsdown
80
+ bun run test # vitest (unit + integration)
81
+ bun run lint # biome + eslint
82
+ ```
35
83
 
36
84
  ## License
37
85
 
38
- MIT
86
+ MIT © moku-labs
@@ -0,0 +1,18 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!no_symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll as t };