@moku-labs/web 0.1.0-alpha.1 → 0.1.0-alpha.4

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 (33) hide show
  1. package/README.md +36 -1
  2. package/dist/bin/moku.cjs +575 -1
  3. package/dist/bin/moku.mjs +576 -2
  4. package/dist/chunk-DQk6qfdC.mjs +18 -0
  5. package/dist/{factory-CixCpR9C.cjs → factory-CMOo4n6a.cjs} +13 -1
  6. package/dist/{factory-BBVQO5ZG.d.mts → factory-DRFGSslp.d.mts} +26 -2
  7. package/dist/{factory-DwpBwjDk.mjs → factory-DiKypQqs.mjs} +2 -2
  8. package/dist/{factory-D0m7Xil2.d.cts → factory-k-YoScgB.d.cts} +26 -2
  9. package/dist/{index-CWdZdegx.d.mts → index-DH3jlpNi.d.mts} +215 -61
  10. package/dist/{route-builder-Lv6HUVvP.d.cts → index-DaY7vTuo.d.cts} +215 -61
  11. package/dist/index.cjs +75 -3
  12. package/dist/index.d.cts +41 -40
  13. package/dist/index.d.mts +41 -40
  14. package/dist/index.mjs +6 -5
  15. package/dist/plugins/head/build.d.cts +1 -1
  16. package/dist/plugins/head/build.d.mts +1 -1
  17. package/dist/plugins/head/build.mjs +1 -1
  18. package/dist/plugins/spa/index.cjs +1 -1
  19. package/dist/plugins/spa/index.d.cts +1 -1
  20. package/dist/plugins/spa/index.d.mts +1 -1
  21. package/dist/plugins/spa/index.mjs +1 -1
  22. package/dist/{primitives-BBo4wxUL.d.cts → primitives-DKgZfRAO.d.mts} +4 -2
  23. package/dist/{primitives-kuZFxqV7.d.mts → primitives-yZqQkOVR.d.cts} +4 -2
  24. package/dist/{project-C1vtMxE8.cjs → project-B8z4jeMC.cjs} +307 -5
  25. package/dist/{project-BTNUWbGQ.mjs → project-guCYpUeD.mjs} +232 -8
  26. package/dist/test.cjs +2 -2
  27. package/dist/test.d.cts +1 -1
  28. package/dist/test.d.mts +1 -1
  29. package/dist/test.mjs +2 -2
  30. package/dist/wrangler-BlZWVmX9.mjs +369 -0
  31. package/dist/wrangler-Bomk9mU-.cjs +423 -0
  32. package/package.json +9 -1
  33. /package/dist/{primitives-gO5i1tD8.mjs → primitives-Dhko-oLM.mjs} +0 -0
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
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";
1
+ import { A as ContentState, B as Events, C as RouterApi, D as Article, E as types_d_exports$7, F as types_d_exports$5, G as EnvState, H as EnvApi, I as SiteApi, J as LogApi, L as SiteState, M as I18nApi, N as I18nConfig, O as ContentApi, P as I18nState, R as types_d_exports$8, S as RouteSpec, T as RouterState, V as createPlugin, X as types_d_exports$6, Y as LogState, _ as BuildApi, a as i18n, b as types_d_exports, c as deploy, d as RouteSpecMap, f as WebAppConfig, g as types_d_exports$2, h as DeployState, i as log, j as types_d_exports$1, k as ContentConfig, l as content, m as DeployConfig, n as router, o as head, p as DeployApi, q as types_d_exports$3, r as route, s as env, t as site, u as build, v as BuildConfig, w as RouterConfig, x as RouteBuilder, y as BuildState, z as Config } from "./index-DH3jlpNi.mjs";
2
+ import { a as meta, d as HeadPluginConfig, f as HeadState, i as jsonLd, l as HeadApi, m as types_d_exports$4, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical } from "./primitives-DKgZfRAO.mjs";
3
+ import { a as SpaConfig, i as SpaApi, n as ComponentDef, o as SpaState, r as ComponentHooks, s as types_d_exports$9, t as createComponent } from "./factory-DRFGSslp.mjs";
4
+ import { spa } from "./plugins/spa/index.mjs";
4
5
  import * as _moku_labs_core0 from "@moku-labs/core";
5
6
 
6
7
  //#region src/index.d.ts
@@ -9,11 +10,26 @@ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_c
9
10
  url: string;
10
11
  author: string;
11
12
  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
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
14
+ 'content:ready': {
15
+ articles: Map<string, Article[]>;
16
+ };
17
+ 'content:invalidated': {
18
+ paths: string[];
19
+ };
20
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
13
21
  'router:registered': {
14
22
  routeCount: number;
15
23
  };
16
- }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
24
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
25
+ 'build:phase': {
26
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
27
+ };
28
+ 'build:complete': {
29
+ pages: number;
30
+ durationMs: number;
31
+ };
32
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
17
33
  'component:create': {
18
34
  name: string;
19
35
  element: Element;
@@ -36,22 +52,7 @@ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_c
36
52
  'nav:end': {
37
53
  url: string;
38
54
  };
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
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"deploy", DeployConfig, DeployState, DeployApi, {}> & Record<never, never>) | ExtraPlugins[number], [...ExtraPlugins], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
55
56
  level: "info";
56
57
  mode: "auto";
57
58
  }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
@@ -63,11 +64,26 @@ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_c
63
64
  url: string;
64
65
  author: string;
65
66
  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
+ }, SiteState, SiteApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"i18n", I18nConfig, I18nState<readonly string[]>, I18nApi<readonly string[]>, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"content", ContentConfig, ContentState, ContentApi, {
68
+ 'content:ready': {
69
+ articles: Map<string, Article[]>;
70
+ };
71
+ 'content:invalidated': {
72
+ paths: string[];
73
+ };
74
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"router", RouterConfig, RouterState, RouterApi, {
67
75
  'router:registered': {
68
76
  routeCount: number;
69
77
  };
70
- }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
78
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"head", HeadPluginConfig, HeadState, HeadApi, {}> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"build", BuildConfig, BuildState, BuildApi, {
79
+ 'build:phase': {
80
+ phase: "bundle" | "content" | "pages" | "feeds" | "sitemap" | "og" | "images";
81
+ };
82
+ 'build:complete': {
83
+ pages: number;
84
+ durationMs: number;
85
+ };
86
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
71
87
  'component:create': {
72
88
  name: string;
73
89
  element: Element;
@@ -90,22 +106,7 @@ declare const kernelCreateApp: <const ExtraPlugins extends readonly _moku_labs_c
90
106
  'nav:end': {
91
107
  url: string;
92
108
  };
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
+ }> & Record<never, never>) | (_moku_labs_core0.PluginInstance<"deploy", DeployConfig, DeployState, DeployApi, {}> & Record<never, never>) | ExtraPlugins[number], _moku_labs_core0.CoreApisFromTuple<[_moku_labs_core0.CorePluginInstance<"log", {
109
110
  level: "info";
110
111
  mode: "auto";
111
112
  }, LogState, LogApi>, _moku_labs_core0.CorePluginInstance<"env", {
@@ -132,4 +133,4 @@ type WebApp<Routes extends Record<string, RouteBuilder>> = Omit<ReturnType<typeo
132
133
  */
133
134
  declare function createApp<Routes extends Record<string, RouteBuilder>>(input: WebAppConfig<Routes>): WebApp<Routes>;
134
135
  //#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 };
136
+ export { types_d_exports as Build, type ComponentDef, type ComponentHooks, type Config, types_d_exports$1 as Content, types_d_exports$2 as Deploy, types_d_exports$3 as Env, type Events, types_d_exports$4 as Head, types_d_exports$5 as I18n, types_d_exports$6 as Log, type RouteBuilder, type RouteSpec, types_d_exports$7 as Router, types_d_exports$8 as Site, types_d_exports$9 as Spa, WebApp, type WebAppConfig, build, canonical, content, createApp, createComponent, createPlugin, deploy, env, feedLink, head, hreflang, i18n, jsonLd, log, meta, og, route, router, site, spa, twitter };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { c as route, d as coreConfig, f as createCore, l as site, o as head, s as router, t as createComponent, u as i18n } from "./factory-DwpBwjDk.mjs";
2
- import { n as build, r as content, t as project } from "./project-BTNUWbGQ.mjs";
3
- 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";
1
+ import { _ as env, c as route, d as coreConfig, f as createCore, l as site, m as log, o as head, p as createPlugin, s as router, t as createComponent, u as i18n } from "./factory-DiKypQqs.mjs";
2
+ import { a as types_exports$6, c as types_exports$3, d as types_exports$1, f as types_exports, i as types_exports$7, l as types_exports$2, m as content, n as types_exports$9, o as types_exports$5, p as build, r as types_exports$8, s as types_exports$4, t as project, u as deploy } from "./project-guCYpUeD.mjs";
3
+ import { a as meta, i as jsonLd, n as feedLink, o as og, r as hreflang, s as twitter, t as canonical } from "./primitives-Dhko-oLM.mjs";
4
4
  import { spa } from "./plugins/spa/index.mjs";
5
5
 
6
6
  //#region src/index.ts
@@ -12,7 +12,8 @@ const { createApp: kernelCreateApp } = createCore(coreConfig, { plugins: [
12
12
  router,
13
13
  head,
14
14
  build,
15
- spa
15
+ spa,
16
+ deploy
16
17
  ] });
17
18
  /**
18
19
  * Layer-2 createApp wrapper — generic-preserving signature.
@@ -33,4 +34,4 @@ function createApp(input) {
33
34
  }
34
35
 
35
36
  //#endregion
36
- export { canonical, createApp, createComponent, feedLink, hreflang, jsonLd, meta, og, route, twitter };
37
+ export { types_exports as Build, types_exports$1 as Content, types_exports$2 as Deploy, types_exports$3 as Env, types_exports$4 as Head, types_exports$5 as I18n, types_exports$6 as Log, types_exports$7 as Router, types_exports$8 as Site, types_exports$9 as Spa, build, canonical, content, createApp, createComponent, createPlugin, deploy, env, feedLink, head, hreflang, i18n, jsonLd, log, meta, og, route, router, site, spa, twitter };
@@ -1,4 +1,4 @@
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";
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-yZqQkOVR.cjs";
2
2
 
3
3
  //#region src/plugins/head/build.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
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-kuZFxqV7.mjs";
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-DKgZfRAO.mjs";
2
2
 
3
3
  //#region src/plugins/head/build.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
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";
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-Dhko-oLM.mjs";
2
2
 
3
3
  //#region src/plugins/head/build.ts
4
4
  /** @file Sub-path /build entry — pure build-time helpers (no plugin state access). */
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_factory = require('../../factory-CixCpR9C.cjs');
2
+ const require_factory = require('../../factory-CMOo4n6a.cjs');
3
3
 
4
4
  //#region src/plugins/spa/index.ts
5
5
  /** @file spa plugin: Very Complex tier — router + head + progress + components sub-modules. */
@@ -1,4 +1,4 @@
1
- import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-D0m7Xil2.cjs";
1
+ import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-k-YoScgB.cjs";
2
2
  import * as _moku_labs_core0 from "@moku-labs/core";
3
3
 
4
4
  //#region src/plugins/spa/index.d.ts
@@ -1,4 +1,4 @@
1
- import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-BBVQO5ZG.mjs";
1
+ import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-DRFGSslp.mjs";
2
2
  import * as _moku_labs_core0 from "@moku-labs/core";
3
3
 
4
4
  //#region src/plugins/spa/index.d.ts
@@ -1,4 +1,4 @@
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";
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-DiKypQqs.mjs";
2
2
 
3
3
  //#region src/plugins/spa/index.ts
4
4
  /** @file spa plugin: Very Complex tier — router + head + progress + components sub-modules. */
@@ -1,4 +1,6 @@
1
- //#region src/plugins/head/types.d.ts
1
+ declare namespace types_d_exports {
2
+ export { ArticleMeta, HeadApi, HeadConfig, HeadElement, HeadPluginConfig, HeadState, OGFontConfig, OGImageConfig, RenderContext };
3
+ }
2
4
  /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
3
5
  type HeadElement = {
4
6
  tag: 'meta' | 'link' | 'script' | 'title';
@@ -66,4 +68,4 @@ declare const hreflang: (locale: string, url: string) => HeadElement;
66
68
  declare const twitter: (name: string, content: string) => HeadElement;
67
69
  declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
68
70
  //#endregion
69
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
71
+ export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, types_d_exports as m, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
@@ -1,4 +1,6 @@
1
- //#region src/plugins/head/types.d.ts
1
+ declare namespace types_d_exports {
2
+ export { ArticleMeta, HeadApi, HeadConfig, HeadElement, HeadPluginConfig, HeadState, OGFontConfig, OGImageConfig, RenderContext };
3
+ }
2
4
  /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
3
5
  type HeadElement = {
4
6
  tag: 'meta' | 'link' | 'script' | 'title';
@@ -66,4 +68,4 @@ declare const hreflang: (locale: string, url: string) => HeadElement;
66
68
  declare const twitter: (name: string, content: string) => HeadElement;
67
69
  declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
68
70
  //#endregion
69
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
71
+ export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, types_d_exports as m, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
@@ -5,6 +5,19 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
8
21
  var __copyProps = (to, from, except, desc) => {
9
22
  if (from && typeof from === "object" || typeof from === "function") {
10
23
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -25,7 +38,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
38
  }) : target, mod));
26
39
 
27
40
  //#endregion
28
- const require_factory = require('./factory-CixCpR9C.cjs');
41
+ const require_factory = require('./factory-CMOo4n6a.cjs');
42
+ const require_wrangler = require('./wrangler-Bomk9mU-.cjs');
29
43
  let node_fs = require("node:fs");
30
44
  let node_fs_promises = require("node:fs/promises");
31
45
  let node_path = require("node:path");
@@ -442,7 +456,7 @@ const wireContentApi = (ctx) => {
442
456
  //#endregion
443
457
  //#region src/plugins/content/index.ts
444
458
  /** @file content plugin: markdown pipeline + invalidate(). Complex tier. */
445
- const defaultConfig$1 = {
459
+ const defaultConfig$2 = {
446
460
  dir: "",
447
461
  trustedContent: false,
448
462
  rehypePlugins: [],
@@ -450,7 +464,7 @@ const defaultConfig$1 = {
450
464
  };
451
465
  const content = require_factory.createPlugin("content", {
452
466
  depends: [require_factory.i18n],
453
- config: defaultConfig$1,
467
+ config: defaultConfig$2,
454
468
  events: (register) => ({
455
469
  "content:ready": register("Articles loaded"),
456
470
  "content:invalidated": register("Paths invalidated")
@@ -981,7 +995,7 @@ const validateBuildConfig = (ctx) => {
981
995
  //#endregion
982
996
  //#region src/plugins/build/index.ts
983
997
  /** @file build plugin: app.build.run() orchestrator + in-memory manifest. Complex tier. */
984
- const defaultConfig = {
998
+ const defaultConfig$1 = {
985
999
  outdir: "dist",
986
1000
  mode: "production",
987
1001
  renderMode: "hybrid"
@@ -993,7 +1007,7 @@ const build = require_factory.createPlugin("build", {
993
1007
  require_factory.router,
994
1008
  require_factory.head
995
1009
  ],
996
- config: defaultConfig,
1010
+ config: defaultConfig$1,
997
1011
  events: (register) => ({
998
1012
  "build:phase": register("Build phase started"),
999
1013
  "build:complete": register("Build pipeline complete")
@@ -1003,6 +1017,228 @@ const build = require_factory.createPlugin("build", {
1003
1017
  onInit: validateBuildConfig
1004
1018
  });
1005
1019
 
1020
+ //#endregion
1021
+ //#region src/plugins/build/types.ts
1022
+ var types_exports$9 = /* @__PURE__ */ __exportAll({});
1023
+
1024
+ //#endregion
1025
+ //#region src/plugins/content/types.ts
1026
+ var types_exports$8 = /* @__PURE__ */ __exportAll({});
1027
+
1028
+ //#endregion
1029
+ //#region src/plugins/deploy/api.ts
1030
+ /** @file deploy plugin API factory — orchestrates app.deploy.run(). */
1031
+ /** Free-tier Cloudflare Pages limit. The paid tier (100,000) requires extra env. */
1032
+ const FREE_TIER_FILE_LIMIT = 2e4;
1033
+ /** Per-file size cap for Cloudflare Pages (25 MiB). */
1034
+ const MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
1035
+ const sanitizedProcessEnv = () => {
1036
+ const out = {};
1037
+ for (const [k, v] of Object.entries(process.env)) if (typeof v === "string") out[k] = v;
1038
+ return out;
1039
+ };
1040
+ const checkFile = (path, state) => {
1041
+ state.count += 1;
1042
+ if ((0, node_fs.statSync)(path).size > MAX_FILE_SIZE_BYTES) state.oversize = path;
1043
+ };
1044
+ const walkOutdir = (current, state) => {
1045
+ for (const entry of (0, node_fs.readdirSync)(current, { withFileTypes: true })) {
1046
+ if (state.oversize !== null) return;
1047
+ const path = (0, node_path.join)(current, entry.name);
1048
+ if (entry.isDirectory()) walkOutdir(path, state);
1049
+ else if (entry.isFile()) checkFile(path, state);
1050
+ }
1051
+ };
1052
+ /** Recursively count files and check max size under `dir`. Short-circuits on first oversize file. */
1053
+ const inspectOutdir = (dir) => {
1054
+ const state = {
1055
+ count: 0,
1056
+ oversize: null
1057
+ };
1058
+ walkOutdir(dir, state);
1059
+ return {
1060
+ fileCount: state.count,
1061
+ oversize: state.oversize
1062
+ };
1063
+ };
1064
+ /** Throw if any pre-flight constraint on the resolved outdir fails. */
1065
+ const assertOutdirReady = (outdir, outdirAbsolute) => {
1066
+ if (!(0, node_fs.existsSync)(outdirAbsolute)) throw new Error(`deploy: outdir "${outdir}" does not exist — run \`moku build\` first (or pass --build).`);
1067
+ const inspection = inspectOutdir(outdirAbsolute);
1068
+ if (inspection.fileCount === 0) throw new Error(`deploy: outdir "${outdir}" is empty — nothing to deploy.`);
1069
+ if (inspection.fileCount > FREE_TIER_FILE_LIMIT) throw new Error(`deploy: outdir contains ${inspection.fileCount} files; free tier limit is ${FREE_TIER_FILE_LIMIT}. Paid tier supports up to 100,000 files (requires PAGES_WRANGLER_MAJOR_VERSION=4 in CI env).`);
1070
+ if (inspection.oversize !== null) throw new Error(`deploy: file "${inspection.oversize}" exceeds Cloudflare Pages per-file limit (25 MiB).`);
1071
+ return inspection;
1072
+ };
1073
+ /** Resolve outdir from `wrangler.jsonc#pages_build_output_dir` or throw if missing. */
1074
+ const resolveOutdir = (cwd) => {
1075
+ const wrangler = require_wrangler.readWranglerConfig(cwd);
1076
+ if (wrangler === null) throw new Error("deploy: wrangler.jsonc not found — run `moku deploy init` first");
1077
+ return wrangler.pages_build_output_dir;
1078
+ };
1079
+ /**
1080
+ * Build the public `app.deploy` API surface.
1081
+ *
1082
+ * `run()` reads outdir from `wrangler.jsonc#pages_build_output_dir` (the
1083
+ * deploy-time SSoT — `DeployConfig.outdir` is only the init-time default).
1084
+ * Errors with a "run `moku deploy init` first" message if `wrangler.jsonc` is
1085
+ * missing.
1086
+ *
1087
+ * @param ctx - The deploy plugin context.
1088
+ * @param deps - Optional injectables for testing.
1089
+ * @returns The {@link DeployApi}.
1090
+ */
1091
+ /** Trigger the optional pre-build hook for `--build`. */
1092
+ const maybeRunBuild = async (deps, build) => {
1093
+ if (build !== true) return;
1094
+ if (deps.runBuild === void 0) throw new Error("deploy: --build flag set but no `runBuild` hook provided to createDeployApi. Wire `app.build.run` through the plugin index.");
1095
+ await deps.runBuild();
1096
+ };
1097
+ /** Invoke wrangler and shape its output into a {@link DeployResult}. */
1098
+ const invokeWranglerForDeploy = async (ctx, deps, outdir, branch, startedAt, now) => {
1099
+ const env = deps.env ?? sanitizedProcessEnv();
1100
+ const info = require_wrangler.extractDeploymentInfo((await require_wrangler.runWrangler(require_wrangler.buildWranglerArgs(ctx.config.target, outdir, branch), env, deps.spawn)).ndJson);
1101
+ if (info === null) ctx.log.warn("deploy:no-deployment-info", { note: "wrangler exited 0 but no deployment URL/id was found in ND-JSON output." });
1102
+ return {
1103
+ url: info?.url ?? "",
1104
+ deploymentId: info?.deploymentId ?? "",
1105
+ branch,
1106
+ durationMs: now() - startedAt
1107
+ };
1108
+ };
1109
+ /**
1110
+ * Build the public `app.deploy` API surface.
1111
+ *
1112
+ * `run()` reads outdir from `wrangler.jsonc#pages_build_output_dir` (the
1113
+ * deploy-time SSoT — `DeployConfig.outdir` is only the init-time default).
1114
+ * Errors with a "run `moku deploy init` first" message if `wrangler.jsonc` is
1115
+ * missing.
1116
+ *
1117
+ * @param ctx - The deploy plugin context.
1118
+ * @param deps - Optional injectables for testing.
1119
+ * @returns The {@link DeployApi}.
1120
+ */
1121
+ const createDeployApi = (ctx, deps = {}) => {
1122
+ const cwd = deps.cwd ?? process.cwd();
1123
+ const now = deps.now ?? Date.now;
1124
+ const run = async (options = {}) => {
1125
+ await maybeRunBuild(deps, options.build);
1126
+ const outdir = resolveOutdir(cwd);
1127
+ const branch = options.branch ?? ctx.config.productionBranch;
1128
+ const inspection = assertOutdirReady(outdir, (0, node_path.join)(cwd, outdir));
1129
+ const deployResult = await invokeWranglerForDeploy(ctx, deps, outdir, branch, now(), now);
1130
+ ctx.state.lastDeployment = deployResult;
1131
+ ctx.log.info("deploy:complete", {
1132
+ url: deployResult.url,
1133
+ branch,
1134
+ durationMs: deployResult.durationMs,
1135
+ files: inspection.fileCount
1136
+ });
1137
+ return deployResult;
1138
+ };
1139
+ const getLastDeployment = () => ctx.state.lastDeployment;
1140
+ return {
1141
+ run,
1142
+ getLastDeployment
1143
+ };
1144
+ };
1145
+
1146
+ //#endregion
1147
+ //#region src/plugins/deploy/state.ts
1148
+ /**
1149
+ * Create a fresh deploy state.
1150
+ *
1151
+ * `lastDeployment` starts as `null` and is set after the first successful
1152
+ * `app.deploy.run()` call. State is per-`createApp` instance — never a module
1153
+ * singleton — so parallel vitest workers do not share state.
1154
+ *
1155
+ * @returns A new {@link DeployState}.
1156
+ */
1157
+ const createDeployState = () => ({ lastDeployment: null });
1158
+
1159
+ //#endregion
1160
+ //#region src/plugins/deploy/validate.ts
1161
+ /** @file deploy plugin onInit hook — config-shape validation only. NEVER spawns wrangler. */
1162
+ const VALID_TARGETS = new Set(["pages", "workers"]);
1163
+ /**
1164
+ * Validate `DeployConfig` shape at `onInit` time.
1165
+ *
1166
+ * Checks: `target` is in the valid enum; `outdir` is a non-empty string and
1167
+ * does not escape the current working directory via `..` traversal;
1168
+ * `productionBranch` is a non-empty string.
1169
+ *
1170
+ * Does NOT check wrangler presence — `ensureWrangler()` in `wrangler.ts` is
1171
+ * lazy and called only on first `run()`/`init()` invocation. This keeps
1172
+ * `moku dev`, `moku build`, and `moku preview` unaffected by wrangler absence.
1173
+ *
1174
+ * @param ctx - The deploy plugin context.
1175
+ * @throws Error when any config field is structurally invalid.
1176
+ */
1177
+ const validateDeployConfig = (ctx) => {
1178
+ const { target, outdir, productionBranch } = ctx.config;
1179
+ if (!VALID_TARGETS.has(target)) throw new Error(`deploy: target must be "pages" or "workers" (got "${target}")`);
1180
+ if (typeof outdir !== "string" || outdir === "") throw new Error("deploy: outdir must be a non-empty string");
1181
+ const resolved = (0, node_path.isAbsolute)(outdir) ? outdir : (0, node_path.resolve)(process.cwd(), outdir);
1182
+ const cwd = process.cwd();
1183
+ if (!resolved.startsWith(cwd)) throw new Error(`deploy: outdir "${outdir}" must resolve inside the project root (got "${resolved}")`);
1184
+ if (typeof productionBranch !== "string" || productionBranch === "") throw new Error("deploy: productionBranch must be a non-empty string");
1185
+ };
1186
+
1187
+ //#endregion
1188
+ //#region src/plugins/deploy/index.ts
1189
+ /** @file deploy plugin: Cloudflare Pages publishing via wrangler subprocess. Standard tier.
1190
+ *
1191
+ * Wave 4 placement alongside `build`. `depends: []` — no plugin-graph edge to `build`;
1192
+ * ordering via the framework's plugin registration array is sufficient. Consumers who want
1193
+ * auto-outdir resolution must register the `build` plugin alongside this one; otherwise the
1194
+ * `'dist'` default fallback applies.
1195
+ *
1196
+ * @see README.md
1197
+ */
1198
+ const defaultConfig = {
1199
+ target: "pages",
1200
+ outdir: "dist",
1201
+ productionBranch: "main"
1202
+ };
1203
+ const deploy = require_factory.createPlugin("deploy", {
1204
+ config: defaultConfig,
1205
+ createState: createDeployState,
1206
+ api: createDeployApi,
1207
+ onInit: validateDeployConfig
1208
+ });
1209
+
1210
+ //#endregion
1211
+ //#region src/plugins/deploy/types.ts
1212
+ var types_exports$7 = /* @__PURE__ */ __exportAll({});
1213
+
1214
+ //#endregion
1215
+ //#region src/plugins/env/types.ts
1216
+ var types_exports$6 = /* @__PURE__ */ __exportAll({});
1217
+
1218
+ //#endregion
1219
+ //#region src/plugins/head/types.ts
1220
+ var types_exports$5 = /* @__PURE__ */ __exportAll({});
1221
+
1222
+ //#endregion
1223
+ //#region src/plugins/i18n/types.ts
1224
+ var types_exports$4 = /* @__PURE__ */ __exportAll({});
1225
+
1226
+ //#endregion
1227
+ //#region src/plugins/log/types.ts
1228
+ var types_exports$3 = /* @__PURE__ */ __exportAll({});
1229
+
1230
+ //#endregion
1231
+ //#region src/plugins/router/types.ts
1232
+ var types_exports$2 = /* @__PURE__ */ __exportAll({});
1233
+
1234
+ //#endregion
1235
+ //#region src/plugins/site/types.ts
1236
+ var types_exports$1 = /* @__PURE__ */ __exportAll({});
1237
+
1238
+ //#endregion
1239
+ //#region src/plugins/spa/types.ts
1240
+ var types_exports = /* @__PURE__ */ __exportAll({});
1241
+
1006
1242
  //#endregion
1007
1243
  //#region src/project.ts
1008
1244
  /**
@@ -1073,9 +1309,75 @@ Object.defineProperty(exports, 'content', {
1073
1309
  return content;
1074
1310
  }
1075
1311
  });
1312
+ Object.defineProperty(exports, 'deploy', {
1313
+ enumerable: true,
1314
+ get: function () {
1315
+ return deploy;
1316
+ }
1317
+ });
1076
1318
  Object.defineProperty(exports, 'project', {
1077
1319
  enumerable: true,
1078
1320
  get: function () {
1079
1321
  return project;
1080
1322
  }
1323
+ });
1324
+ Object.defineProperty(exports, 'types_exports', {
1325
+ enumerable: true,
1326
+ get: function () {
1327
+ return types_exports;
1328
+ }
1329
+ });
1330
+ Object.defineProperty(exports, 'types_exports$1', {
1331
+ enumerable: true,
1332
+ get: function () {
1333
+ return types_exports$1;
1334
+ }
1335
+ });
1336
+ Object.defineProperty(exports, 'types_exports$2', {
1337
+ enumerable: true,
1338
+ get: function () {
1339
+ return types_exports$2;
1340
+ }
1341
+ });
1342
+ Object.defineProperty(exports, 'types_exports$3', {
1343
+ enumerable: true,
1344
+ get: function () {
1345
+ return types_exports$3;
1346
+ }
1347
+ });
1348
+ Object.defineProperty(exports, 'types_exports$4', {
1349
+ enumerable: true,
1350
+ get: function () {
1351
+ return types_exports$4;
1352
+ }
1353
+ });
1354
+ Object.defineProperty(exports, 'types_exports$5', {
1355
+ enumerable: true,
1356
+ get: function () {
1357
+ return types_exports$5;
1358
+ }
1359
+ });
1360
+ Object.defineProperty(exports, 'types_exports$6', {
1361
+ enumerable: true,
1362
+ get: function () {
1363
+ return types_exports$6;
1364
+ }
1365
+ });
1366
+ Object.defineProperty(exports, 'types_exports$7', {
1367
+ enumerable: true,
1368
+ get: function () {
1369
+ return types_exports$7;
1370
+ }
1371
+ });
1372
+ Object.defineProperty(exports, 'types_exports$8', {
1373
+ enumerable: true,
1374
+ get: function () {
1375
+ return types_exports$8;
1376
+ }
1377
+ });
1378
+ Object.defineProperty(exports, 'types_exports$9', {
1379
+ enumerable: true,
1380
+ get: function () {
1381
+ return types_exports$9;
1382
+ }
1081
1383
  });