@conloca/cloud-astro 0.2.2 → 0.2.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 (241) hide show
  1. package/README.md +378 -207
  2. package/dist/.build-inputs.json +69 -0
  3. package/dist/src/component-manifest.d.ts +5 -3
  4. package/dist/src/component-manifest.d.ts.map +1 -1
  5. package/dist/src/component-manifest.js +7 -7
  6. package/dist/src/component-manifest.js.map +1 -1
  7. package/dist/src/constants.d.ts +14 -13
  8. package/dist/src/constants.d.ts.map +1 -1
  9. package/dist/src/constants.js +14 -13
  10. package/dist/src/constants.js.map +1 -1
  11. package/dist/src/d3-build.d.ts +70 -0
  12. package/dist/src/d3-build.d.ts.map +1 -0
  13. package/dist/src/d3-build.js +272 -0
  14. package/dist/src/d3-build.js.map +1 -0
  15. package/dist/src/descriptors.d.ts +2 -2
  16. package/dist/src/descriptors.d.ts.map +1 -1
  17. package/dist/src/descriptors.js +4 -2
  18. package/dist/src/descriptors.js.map +1 -1
  19. package/dist/src/doctor/checks-address.d.ts +18 -0
  20. package/dist/src/doctor/checks-address.d.ts.map +1 -0
  21. package/dist/src/doctor/checks-address.js +163 -0
  22. package/dist/src/doctor/checks-address.js.map +1 -0
  23. package/dist/src/doctor/checks-live.d.ts +8 -5
  24. package/dist/src/doctor/checks-live.d.ts.map +1 -1
  25. package/dist/src/doctor/checks-live.js +226 -188
  26. package/dist/src/doctor/checks-live.js.map +1 -1
  27. package/dist/src/doctor/checks-offline.d.ts +6 -25
  28. package/dist/src/doctor/checks-offline.d.ts.map +1 -1
  29. package/dist/src/doctor/checks-offline.js +30 -259
  30. package/dist/src/doctor/checks-offline.js.map +1 -1
  31. package/dist/src/doctor/checks-preview-limits.d.ts +11 -0
  32. package/dist/src/doctor/checks-preview-limits.d.ts.map +1 -0
  33. package/dist/src/doctor/checks-preview-limits.js +133 -0
  34. package/dist/src/doctor/checks-preview-limits.js.map +1 -0
  35. package/dist/src/doctor/checks-preview-live.d.ts +14 -0
  36. package/dist/src/doctor/checks-preview-live.d.ts.map +1 -0
  37. package/dist/src/doctor/checks-preview-live.js +72 -0
  38. package/dist/src/doctor/checks-preview-live.js.map +1 -0
  39. package/dist/src/doctor/checks-preview.d.ts +7 -0
  40. package/dist/src/doctor/checks-preview.d.ts.map +1 -0
  41. package/dist/src/doctor/checks-preview.js +287 -0
  42. package/dist/src/doctor/checks-preview.js.map +1 -0
  43. package/dist/src/doctor/config-scan.d.ts +12 -3
  44. package/dist/src/doctor/config-scan.d.ts.map +1 -1
  45. package/dist/src/doctor/config-scan.js +38 -11
  46. package/dist/src/doctor/config-scan.js.map +1 -1
  47. package/dist/src/doctor/run.d.ts.map +1 -1
  48. package/dist/src/doctor/run.js +16 -10
  49. package/dist/src/doctor/run.js.map +1 -1
  50. package/dist/src/doctor/types.d.ts +17 -7
  51. package/dist/src/doctor/types.d.ts.map +1 -1
  52. package/dist/src/doctor/types.js +17 -7
  53. package/dist/src/doctor/types.js.map +1 -1
  54. package/dist/src/editor-page/bundle.d.ts +90 -0
  55. package/dist/src/editor-page/bundle.d.ts.map +1 -0
  56. package/dist/src/editor-page/bundle.js +373 -0
  57. package/dist/src/editor-page/bundle.js.map +1 -0
  58. package/dist/src/editor-page/data-schemas.d.ts +16 -0
  59. package/dist/src/editor-page/data-schemas.d.ts.map +1 -0
  60. package/dist/src/editor-page/data-schemas.js +39 -0
  61. package/dist/src/editor-page/data-schemas.js.map +1 -0
  62. package/dist/src/editor-page/emit.d.ts +69 -0
  63. package/dist/src/editor-page/emit.d.ts.map +1 -0
  64. package/dist/src/editor-page/emit.js +254 -0
  65. package/dist/src/editor-page/emit.js.map +1 -0
  66. package/dist/src/editor-page/framing.d.ts +23 -0
  67. package/dist/src/editor-page/framing.d.ts.map +1 -0
  68. package/dist/src/editor-page/framing.js +39 -0
  69. package/dist/src/editor-page/framing.js.map +1 -0
  70. package/dist/src/editor-page/page.d.ts +9 -0
  71. package/dist/src/editor-page/page.d.ts.map +1 -0
  72. package/dist/src/editor-page/page.js +31 -0
  73. package/dist/src/editor-page/page.js.map +1 -0
  74. package/dist/src/editor-page/site-base.d.ts +4 -0
  75. package/dist/src/editor-page/site-base.d.ts.map +1 -0
  76. package/dist/src/editor-page/site-base.js +13 -0
  77. package/dist/src/editor-page/site-base.js.map +1 -0
  78. package/dist/src/git.d.ts +11 -8
  79. package/dist/src/git.d.ts.map +1 -1
  80. package/dist/src/git.js +25 -8
  81. package/dist/src/git.js.map +1 -1
  82. package/dist/src/index.d.ts +4 -1
  83. package/dist/src/index.d.ts.map +1 -1
  84. package/dist/src/index.js +11 -6
  85. package/dist/src/index.js.map +1 -1
  86. package/dist/src/integration.d.ts +1 -1
  87. package/dist/src/integration.d.ts.map +1 -1
  88. package/dist/src/integration.js +377 -416
  89. package/dist/src/integration.js.map +1 -1
  90. package/dist/src/node.d.ts +3 -1
  91. package/dist/src/node.d.ts.map +1 -1
  92. package/dist/src/node.js +7 -2
  93. package/dist/src/node.js.map +1 -1
  94. package/dist/src/preview/_dispatch.d.ts +12 -0
  95. package/dist/src/preview/_dispatch.d.ts.map +1 -1
  96. package/dist/src/preview/_dispatch.js +31 -0
  97. package/dist/src/preview/_dispatch.js.map +1 -1
  98. package/dist/src/preview/_resolve-opts.d.ts +19 -10
  99. package/dist/src/preview/_resolve-opts.d.ts.map +1 -1
  100. package/dist/src/preview/_resolve-opts.js +24 -11
  101. package/dist/src/preview/_resolve-opts.js.map +1 -1
  102. package/dist/src/preview/banner.d.ts +12 -9
  103. package/dist/src/preview/banner.d.ts.map +1 -1
  104. package/dist/src/preview/banner.js +46 -43
  105. package/dist/src/preview/banner.js.map +1 -1
  106. package/dist/src/preview/cloudflare-adapter.d.ts +35 -0
  107. package/dist/src/preview/cloudflare-adapter.d.ts.map +1 -0
  108. package/dist/src/preview/cloudflare-adapter.js +92 -0
  109. package/dist/src/preview/cloudflare-adapter.js.map +1 -0
  110. package/dist/src/preview/cookie.d.ts +13 -14
  111. package/dist/src/preview/cookie.d.ts.map +1 -1
  112. package/dist/src/preview/cookie.js +19 -26
  113. package/dist/src/preview/cookie.js.map +1 -1
  114. package/dist/src/preview/dispatcher.d.ts +73 -0
  115. package/dist/src/preview/dispatcher.d.ts.map +1 -0
  116. package/dist/src/preview/dispatcher.js +329 -0
  117. package/dist/src/preview/dispatcher.js.map +1 -0
  118. package/dist/src/preview/entry-code.d.ts +33 -0
  119. package/dist/src/preview/entry-code.d.ts.map +1 -0
  120. package/dist/src/preview/entry-code.js +33 -0
  121. package/dist/src/preview/entry-code.js.map +1 -0
  122. package/dist/src/preview/headers.d.ts +24 -4
  123. package/dist/src/preview/headers.d.ts.map +1 -1
  124. package/dist/src/preview/headers.js +35 -7
  125. package/dist/src/preview/headers.js.map +1 -1
  126. package/dist/src/preview/label.d.ts +8 -0
  127. package/dist/src/preview/label.d.ts.map +1 -0
  128. package/dist/src/preview/label.js +14 -0
  129. package/dist/src/preview/label.js.map +1 -0
  130. package/dist/src/preview/landing.d.ts +23 -2
  131. package/dist/src/preview/landing.d.ts.map +1 -1
  132. package/dist/src/preview/landing.js +105 -37
  133. package/dist/src/preview/landing.js.map +1 -1
  134. package/dist/src/preview/middleware.d.ts +49 -22
  135. package/dist/src/preview/middleware.d.ts.map +1 -1
  136. package/dist/src/preview/middleware.js +259 -100
  137. package/dist/src/preview/middleware.js.map +1 -1
  138. package/dist/src/preview/preview-path.d.ts +47 -5
  139. package/dist/src/preview/preview-path.d.ts.map +1 -1
  140. package/dist/src/preview/preview-path.js +65 -8
  141. package/dist/src/preview/preview-path.js.map +1 -1
  142. package/dist/src/preview/redeem-url.d.ts +7 -0
  143. package/dist/src/preview/redeem-url.d.ts.map +1 -0
  144. package/dist/src/preview/redeem-url.js +14 -0
  145. package/dist/src/preview/redeem-url.js.map +1 -0
  146. package/dist/src/preview/site-middleware.d.ts +5 -5
  147. package/dist/src/preview/site-middleware.d.ts.map +1 -1
  148. package/dist/src/preview/site-middleware.js +53 -26
  149. package/dist/src/preview/site-middleware.js.map +1 -1
  150. package/dist/src/preview-build.d.ts +29 -15
  151. package/dist/src/preview-build.d.ts.map +1 -1
  152. package/dist/src/preview-build.js +66 -25
  153. package/dist/src/preview-build.js.map +1 -1
  154. package/dist/src/preview.d.ts +1 -1
  155. package/dist/src/preview.d.ts.map +1 -1
  156. package/dist/src/preview.js +1 -1
  157. package/dist/src/preview.js.map +1 -1
  158. package/dist/src/repository.d.ts +1 -1
  159. package/dist/src/repository.js +1 -1
  160. package/dist/src/resolve-options.d.ts +17 -0
  161. package/dist/src/resolve-options.d.ts.map +1 -0
  162. package/dist/src/resolve-options.js +21 -0
  163. package/dist/src/resolve-options.js.map +1 -0
  164. package/dist/src/site-id.d.ts +0 -2
  165. package/dist/src/site-id.d.ts.map +1 -1
  166. package/dist/src/site-id.js +2 -3
  167. package/dist/src/site-id.js.map +1 -1
  168. package/dist/src/skill.d.ts +11 -0
  169. package/dist/src/skill.d.ts.map +1 -1
  170. package/dist/src/skill.js +32 -9
  171. package/dist/src/skill.js.map +1 -1
  172. package/dist/src/types.d.ts +33 -78
  173. package/dist/src/types.d.ts.map +1 -1
  174. package/package.json +63 -13
  175. package/src/component-manifest.ts +11 -8
  176. package/src/constants.ts +15 -13
  177. package/src/d3-build.ts +315 -0
  178. package/src/descriptors.ts +6 -4
  179. package/src/doctor/checks-address.ts +190 -0
  180. package/src/doctor/checks-live.ts +262 -268
  181. package/src/doctor/checks-offline.ts +32 -279
  182. package/src/doctor/checks-preview-limits.ts +137 -0
  183. package/src/doctor/checks-preview-live.ts +77 -0
  184. package/src/doctor/checks-preview.ts +302 -0
  185. package/src/doctor/config-scan.ts +35 -9
  186. package/src/doctor/run.ts +18 -16
  187. package/src/doctor/types.ts +17 -7
  188. package/src/editor-page/bundle.ts +487 -0
  189. package/src/editor-page/data-schemas.ts +47 -0
  190. package/src/editor-page/emit.ts +362 -0
  191. package/src/editor-page/framing.ts +62 -0
  192. package/src/editor-page/page.ts +37 -0
  193. package/src/editor-page/site-base.ts +11 -0
  194. package/src/git.ts +29 -10
  195. package/src/index.ts +22 -6
  196. package/src/integration.ts +399 -469
  197. package/src/node.ts +18 -2
  198. package/src/preview/_dispatch.ts +36 -1
  199. package/src/preview/_resolve-opts.ts +35 -12
  200. package/src/preview/banner.ts +61 -43
  201. package/src/preview/cloudflare-adapter.ts +103 -0
  202. package/src/preview/cookie.ts +18 -24
  203. package/src/preview/dispatcher.ts +407 -0
  204. package/src/preview/entry-code.ts +51 -0
  205. package/src/preview/headers.ts +35 -7
  206. package/src/preview/label.ts +12 -0
  207. package/src/preview/landing.ts +117 -39
  208. package/src/preview/middleware.ts +302 -115
  209. package/src/preview/preview-path.ts +83 -8
  210. package/src/preview/redeem-url.ts +14 -0
  211. package/src/preview/site-middleware.ts +60 -30
  212. package/src/preview-build.ts +85 -26
  213. package/src/preview-handler.astro +12 -9
  214. package/src/preview.ts +0 -1
  215. package/src/repository.ts +1 -1
  216. package/src/resolve-options.ts +37 -0
  217. package/src/site-id.ts +2 -4
  218. package/src/skill/SKILL.md +63 -55
  219. package/src/skill.ts +36 -8
  220. package/src/types.ts +33 -79
  221. package/src/virtual-modules.d.ts +4 -1
  222. package/dist/src/build-commit.d.ts +0 -19
  223. package/dist/src/build-commit.d.ts.map +0 -1
  224. package/dist/src/build-commit.js +0 -6
  225. package/dist/src/build-commit.js.map +0 -1
  226. package/dist/src/bundle.d.ts +0 -181
  227. package/dist/src/bundle.d.ts.map +0 -1
  228. package/dist/src/bundle.js +0 -413
  229. package/dist/src/bundle.js.map +0 -1
  230. package/dist/src/discovery.d.ts +0 -58
  231. package/dist/src/discovery.d.ts.map +0 -1
  232. package/dist/src/discovery.js +0 -133
  233. package/dist/src/discovery.js.map +0 -1
  234. package/dist/src/register.d.ts +0 -98
  235. package/dist/src/register.d.ts.map +0 -1
  236. package/dist/src/register.js +0 -103
  237. package/dist/src/register.js.map +0 -1
  238. package/src/build-commit.ts +0 -22
  239. package/src/bundle.ts +0 -570
  240. package/src/discovery.ts +0 -183
  241. package/src/register.ts +0 -180
@@ -9,7 +9,7 @@ export interface DetectRepositoryUriInput {
9
9
  }
10
10
  /**
11
11
  * Normalize a provider full_name or common Git remote into `owner/repo`.
12
- * Deliberately rejects local paths and nested groups: a registration names
12
+ * Deliberately rejects local paths and nested groups: the editor page names
13
13
  * its repository GitHub-style, as two segments.
14
14
  */
15
15
  export declare function normalizeRepositoryUri(input: string | undefined): string | undefined;
@@ -1,7 +1,7 @@
1
1
  const REPO_SEGMENT = /^[A-Za-z0-9_.-]+$/;
2
2
  /**
3
3
  * Normalize a provider full_name or common Git remote into `owner/repo`.
4
- * Deliberately rejects local paths and nested groups: a registration names
4
+ * Deliberately rejects local paths and nested groups: the editor page names
5
5
  * its repository GitHub-style, as two segments.
6
6
  */
7
7
  export function normalizeRepositoryUri(input) {
@@ -0,0 +1,17 @@
1
+ import type { EditorDescriptorChannel } from '@conloca/astro-cms/node';
2
+ import type { ConlocaCloudOptions } from './types.js';
3
+ /** The editor options `conlocaCMS` already holds, settled for this build. */
4
+ export interface InheritedOptions {
5
+ puckConfigPath: string;
6
+ siteStyles?: string[];
7
+ editorStyles?: string[];
8
+ editorCss?: string;
9
+ }
10
+ /**
11
+ * Each option given to `conlocaCloud()` wins; the channel `conlocaCMS`
12
+ * published fills the rest. `editorStyles` and `editorCss` come from the
13
+ * channel only. Only `puckConfigPath` is mandatory: without it there is no
14
+ * editor to build.
15
+ */
16
+ export declare function resolveInheritedOptions(options: Pick<ConlocaCloudOptions, 'puckConfigPath' | 'siteStyles'>, channel: Pick<EditorDescriptorChannel, 'puckConfigPath' | 'siteStyles' | 'editorStyles' | 'editorCSS'> | undefined): InheritedOptions;
17
+ //# sourceMappingURL=resolve-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.d.ts","sourceRoot":"","sources":["../../src/resolve-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,GAAG,YAAY,CAAC,EACnE,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,gBAAgB,GAAG,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC,GAAG,SAAS,GACjH,gBAAgB,CAelB"}
@@ -0,0 +1,21 @@
1
+ import { PACKAGE_NAME } from './constants.js';
2
+ /**
3
+ * Each option given to `conlocaCloud()` wins; the channel `conlocaCMS`
4
+ * published fills the rest. `editorStyles` and `editorCss` come from the
5
+ * channel only. Only `puckConfigPath` is mandatory: without it there is no
6
+ * editor to build.
7
+ */
8
+ export function resolveInheritedOptions(options, channel) {
9
+ const puckConfigPath = options.puckConfigPath ?? channel?.puckConfigPath;
10
+ if (!puckConfigPath) {
11
+ throw new Error(`${PACKAGE_NAME}: puckConfigPath is required: add it to conlocaCloud(), or add conlocaCMS() to this site's integrations`);
12
+ }
13
+ const siteStyles = typeof options.siteStyles === 'string' ? [options.siteStyles] : (options.siteStyles ?? channel?.siteStyles);
14
+ return {
15
+ puckConfigPath,
16
+ ...(siteStyles === undefined ? {} : { siteStyles }),
17
+ ...(channel?.editorStyles === undefined ? {} : { editorStyles: channel.editorStyles }),
18
+ ...(channel?.editorCSS === undefined ? {} : { editorCss: channel.editorCSS }),
19
+ };
20
+ }
21
+ //# sourceMappingURL=resolve-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.js","sourceRoot":"","sources":["../../src/resolve-options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAmE,EACnE,OAAkH;IAElH,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,EAAE,cAAc,CAAC;IACzE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,GAAG,YAAY,yGAAyG,CACzH,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GACd,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,EAAE,UAAU,CAAC,CAAC;IAC9G,OAAO;QACL,cAAc;QACd,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;QACtF,GAAG,CAAC,OAAO,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;KAC9E,CAAC;AACJ,CAAC"}
@@ -1,5 +1,3 @@
1
- /** The site-id grammar: lowercase alphanumerics and dashes, 1-64 chars, alphanumeric first. */
2
- export declare const SITE_ID_RE: RegExp;
3
1
  /**
4
2
  * Resolve the build's deployable-site id. STRICT: malformed input fails the
5
3
  * build — a silent mis-attach is the same "deployed, but the editor points at
@@ -1 +1 @@
1
- {"version":3,"file":"site-id.d.ts","sourceRoot":"","sources":["../../src/site-id.ts"],"names":[],"mappings":"AAIA,+FAA+F;AAC/F,eAAO,MAAM,UAAU,QAA8B,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,mFAAmF;IACnF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,GAAG,MAAM,CA0DT"}
1
+ {"version":3,"file":"site-id.d.ts","sourceRoot":"","sources":["../../src/site-id.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,mFAAmF;IACnF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,GAAG,MAAM,CA0DT"}
@@ -1,8 +1,7 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
+ import { SITE_ID_RE } from '@conloca/content-api/editor-host';
3
4
  import { PACKAGE_NAME } from './constants.js';
4
- /** The site-id grammar: lowercase alphanumerics and dashes, 1-64 chars, alphanumeric first. */
5
- export const SITE_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
6
5
  /**
7
6
  * Resolve the build's deployable-site id. STRICT: malformed input fails the
8
7
  * build — a silent mis-attach is the same "deployed, but the editor points at
@@ -42,7 +41,7 @@ export function resolveBuildSiteId(opts) {
42
41
  record.sites === null ||
43
42
  typeof record.sites !== 'object' ||
44
43
  Array.isArray(record.sites)) {
45
- throw new Error(`${PACKAGE_NAME}: ${path} has no "sites" object — refusing to register a broken content model`);
44
+ throw new Error(`${PACKAGE_NAME}: ${path} has no "sites" object — refusing to build on a broken content model`);
46
45
  }
47
46
  let resolved;
48
47
  if ('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YACnG,uCAAuC,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,KAAa;IAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,KAAK,KAAK,KAAK,KAAK,+BAA+B,UAAU,GAAG,CAAC,CAAC;IACnG,CAAC;AACH,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export declare const SKILL_RELATIVE_PATH: string;
2
+ /** The sha256 of every unstamped page a release wrote, so an upgrade can tell an untouched old page from an edited one. */
3
+ export declare const LEGACY_SKILL_CHECKSUMS: readonly string[];
2
4
  /**
3
5
  * The canonical page, located from the package root (through the package's own `./package.json` export) so the
4
6
  * built `dist/src/skill.js` and the source `src/skill.ts` reach the same shipped `src/skill/SKILL.md`. Resolved on
@@ -17,6 +19,15 @@ type SkillLogger = {
17
19
  * root: a project outside any repository gets nothing.
18
20
  */
19
21
  export declare function findClaudeHome(projectRoot: string): string | undefined;
22
+ /**
23
+ * Where the site's agent skill page belongs and the text this release writes there, stamped with the release and the
24
+ * template's checksum. Null without a `.claude/` home or a readable package version.
25
+ */
26
+ export declare function agentSkill(projectRoot: string): {
27
+ path: string;
28
+ text: string;
29
+ legacyChecksums: readonly string[];
30
+ } | null;
20
31
  /**
21
32
  * Write the skill page once — never overwrite, never throw. A read-only CI
22
33
  * checkout must not break a build over documentation.
@@ -1 +1 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,QAAyD,CAAC;AAE1F;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAGtC;AAED,KAAK,WAAW,GAAG;IAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYtE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAoBnH"}
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,QAAyD,CAAC;AAE1F,2HAA2H;AAC3H,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAGnD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAGtC;AAED,KAAK,WAAW,GAAG;IAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYtE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAS3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAuBnH"}
package/dist/src/skill.js CHANGED
@@ -2,8 +2,15 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import { dirname, join } from 'node:path';
4
4
  import { pathToFileURL } from 'node:url';
5
+ import { stampSkill } from '@conloca/content-api/skill-stamp';
5
6
  import { messageOf } from './message-of.js';
7
+ import { packageVersion } from './package-version.js';
6
8
  export const SKILL_RELATIVE_PATH = join('.claude', 'skills', 'conloca-cloud', 'SKILL.md');
9
+ /** The sha256 of every unstamped page a release wrote, so an upgrade can tell an untouched old page from an edited one. */
10
+ export const LEGACY_SKILL_CHECKSUMS = [
11
+ '201dc9a1fe57038c32a46448228ab432cce060b0079225007ec6dec74ba46959', // 0.2.1, 0.2.2
12
+ '82edfffa022797265bee87289a491e7af12d8e13423f541892e281c416f0554a', // 0.2.3
13
+ ];
7
14
  /**
8
15
  * The canonical page, located from the package root (through the package's own `./package.json` export) so the
9
16
  * built `dist/src/skill.js` and the source `src/skill.ts` reach the same shipped `src/skill/SKILL.md`. Resolved on
@@ -36,22 +43,38 @@ export function findClaudeHome(projectRoot) {
36
43
  dir = parent;
37
44
  }
38
45
  }
46
+ /**
47
+ * Where the site's agent skill page belongs and the text this release writes there, stamped with the release and the
48
+ * template's checksum. Null without a `.claude/` home or a readable package version.
49
+ */
50
+ export function agentSkill(projectRoot) {
51
+ const home = findClaudeHome(projectRoot);
52
+ const version = packageVersion();
53
+ if (home === undefined || version === undefined)
54
+ return null;
55
+ return {
56
+ path: join(home, SKILL_RELATIVE_PATH),
57
+ text: stampSkill(readFileSync(skillTemplateUrl(), 'utf8'), version),
58
+ legacyChecksums: LEGACY_SKILL_CHECKSUMS,
59
+ };
60
+ }
39
61
  /**
40
62
  * Write the skill page once — never overwrite, never throw. A read-only CI
41
63
  * checkout must not break a build over documentation.
42
64
  */
43
65
  export function scaffoldSkill(projectRoot, logger) {
44
- const home = findClaudeHome(projectRoot);
45
- if (home === undefined) {
46
- logger.debug('no .claude/ directory between the project and the git root — agent skill not scaffolded');
47
- return 'skipped';
48
- }
49
- const target = join(home, SKILL_RELATIVE_PATH);
50
- if (existsSync(target))
51
- return 'exists';
66
+ let target = SKILL_RELATIVE_PATH;
52
67
  try {
68
+ const skill = agentSkill(projectRoot);
69
+ if (skill === null) {
70
+ logger.debug('no .claude/ directory between the project and the git root, or no readable package version — agent skill not scaffolded');
71
+ return 'skipped';
72
+ }
73
+ target = skill.path;
74
+ if (existsSync(target))
75
+ return 'exists';
53
76
  mkdirSync(dirname(target), { recursive: true });
54
- writeFileSync(target, readFileSync(skillTemplateUrl(), 'utf8'), { flag: 'wx' });
77
+ writeFileSync(target, skill.text, { flag: 'wx' });
55
78
  logger.info(`agent skill written to ${target}`);
56
79
  return 'written';
57
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,CAAC;IACzG,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAID;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,IAAI,GAAG,GAAG,WAAW,CAAC;IACtB,IAAI,IAAwB,CAAC;IAC7B,SAAS,CAAC;QACR,IAAI,IAAI,KAAK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C;QACxC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,0BAA0B,MAAM,EAAE,CAAC,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,6EAA6E;QAC7E,kEAAkE;QAClE,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,8BAA8B,MAAM,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1,12 +1,9 @@
1
1
  import type { AstroIntegration } from 'astro';
2
- import type { Plugin as EsbuildPlugin } from 'esbuild';
3
2
  /**
4
- * Configuration for a recursive preview build that runs immediately after the
5
- * site's production build completes. The preview build emits the SSR routes
6
- * that serve draft preview.
7
- *
8
- * Set to `false` to explicitly opt out of preview builds for sites that do not
9
- * need a draft/preview pipeline.
3
+ * The second build that serves draft previews. Off unless given as an object. A static site's preview server runs on
4
+ * Cloudflare Workers under `/_conloca/preview/` next to the site (it needs `@astrojs/cloudflare` installed); a site
5
+ * with an adapter serves drafts from its own server deploy; `separate: true` builds a separate preview deploy.
6
+ * Refused under `@astrojs/vercel` and `@astrojs/netlify`.
10
7
  */
11
8
  export interface PreviewBuildOptions {
12
9
  /**
@@ -20,31 +17,38 @@ export interface PreviewBuildOptions {
20
17
  config?: Record<string, unknown>;
21
18
  /**
22
19
  * Output directory for the preview build. Defaults to `.conloca/preview-server`
23
- * — outside `dist/`, so the secret-baked artifact can never ride a wholesale
24
- * static upload of the site and Astro's dist-clearing cannot wipe it.
20
+ * — outside `dist/`, so the preview server can never ride a wholesale static
21
+ * upload of the site and Astro's dist-clearing cannot wipe it.
25
22
  */
26
23
  outDir?: string;
27
24
  /**
28
- * If true, fail the parent build when the preview build fails. Defaults to
29
- * true; set false while setting up.
25
+ * If true, fail the site's build when a D2 preview build fails. Defaults to true; set false while setting up.
26
+ * A failed D3 preview build fails the site's build only when its server also serves the live site (`run_worker_first`
27
+ * lists routes beyond the preview route, or `not_found_handling` is `"none"`); otherwise the site ships and its
28
+ * preview route answers "preview unavailable". This option changes neither.
30
29
  */
31
30
  required?: boolean;
31
+ /**
32
+ * Serve previews from a separate deploy (D4) instead of next to the site. The site's build then runs no preview
33
+ * build; a second deploy builds with `CONLOCA_PREVIEW_BUILD=1`, and its address goes in sites.json `previewUrl`.
34
+ */
35
+ separate?: boolean;
32
36
  }
33
37
  /**
34
- * Options accepted by {@link conlocaCloud}.
35
- *
36
- * Registration authenticates with one build token (`cbt_<id>.<secret>`)
37
- * issued by the endpoint. Repository identity is normally detected from CI metadata or the Git
38
- * checkout.
38
+ * Options accepted by {@link conlocaCloud}. Every one is optional: repository
39
+ * identity is normally detected from CI metadata or the Git checkout, and the
40
+ * editor options come from `conlocaCMS`.
39
41
  */
40
42
  export interface ConlocaCloudOptions {
41
- /** Editor endpoint, e.g. 'https://cms.example.com', no trailing slash. */
42
- endpoint: string;
43
+ /**
44
+ * The workspace editor's address, no trailing slash. Defaults to
45
+ * 'https://app.conloca.com'. Its host must start with `app.`.
46
+ */
47
+ endpoint?: string;
43
48
  /**
44
49
  * Advanced override for repository identity, normalized to `owner/repo`.
45
50
  * Normally omit this: Conloca detects GitHub, Vercel, or GitLab CI metadata,
46
- * then falls back to the checkout's `remote.origin.url`. Registration is
47
- * rejected when the token does not cover the detected repo.
51
+ * then falls back to the checkout's `remote.origin.url`.
48
52
  */
49
53
  repoUri?: string;
50
54
  /**
@@ -54,82 +58,33 @@ export interface ConlocaCloudOptions {
54
58
  * that contradicts it fails the build — never a silent pick.
55
59
  */
56
60
  siteId?: string;
57
- /**
58
- * Build token issued by the endpoint. Prefer injecting it via the
59
- * CONLOCA_BUILD_TOKEN environment variable instead of committing it here;
60
- * when neither is present the build skips registration (fail soft, unless
61
- * `requireRegistration` is set).
62
- */
63
- buildToken?: string;
64
61
  /**
65
62
  * Entry module of the puck config to compile into the editor bundle,
66
63
  * e.g. './src/puck.config.tsx'. Same option name as @conloca/astro-cms.
64
+ * Defaults to the `conlocaCMS` value.
67
65
  */
68
- puckConfigPath: string;
66
+ puckConfigPath?: string;
69
67
  /**
70
68
  * Site CSS for accurate preview rendering — same option name and shape
71
69
  * as `conlocaCMS({ siteStyles })`, and compiled the same way: by the site's
72
70
  * own Vite pipeline (its plugins, PostCSS config and preprocessors), into
73
- * the canvas stylesheet each build registers, ahead of the
71
+ * the editor page's canvas stylesheet, ahead of the
74
72
  * component modules, e.g. './src/styles/index.scss'. Paths resolve against
75
73
  * the project root. The assets these stylesheets reference are emitted under
76
- * `/_conloca/`, and an entry that fails to compile fails the build. Component
74
+ * `/_conloca/editor/`, and an entry that fails to compile fails the build. Component
77
75
  * `*.module.(s)css` imports compile in automatically — list here only what
78
- * lives outside the component graph.
76
+ * lives outside the component graph. Defaults to the `conlocaCMS` value.
79
77
  */
80
78
  siteStyles?: string | string[];
81
79
  /**
82
- * esbuild plugins for the editor bundle (puck config, its components and the
83
- * conlocaCMS schemas module). That bundle is built with esbuild, outside the
84
- * site's Vite pipeline, so a source transform the site's Vite plugins apply
85
- * — e.g. Typia's `createValidate<T>()` generation in page schemas — must be
86
- * passed here in its esbuild form too, or the bundle carries untransformed
87
- * calls that throw when the editor loads it.
88
- */
89
- editorBundlePlugins?: EsbuildPlugin[];
90
- /**
91
- * Representative content route for build-time style discovery — the SAME
92
- * name and meaning as `conlocaCMS`'s option: the page whose styles and
93
- * content-wrapper shape prose editing should adopt. When set, the build
94
- * reads that route's rendered page (a prerendered file, or the booted node
95
- * server entry), collects its CSS and wrapper shape, and registers them
96
- * alongside the bundle. Unset: discovery is skipped and the editor falls
97
- * back to the prose-safe derived tier.
98
- *
99
- * @example '/blog/welcome-post'
100
- */
101
- fragmentPreviewRoute?: string;
102
- /**
103
- * Public base URL of the deployed site, used to absolutize the editor
104
- * bundle URL when no dedicated preview domain is configured. Falls back to
105
- * the CF_PAGES_URL env var; without either, registration is skipped.
106
- */
107
- publicBaseUrl?: string;
108
- /**
109
- * Optional dedicated preview deployment as a hostname or absolute URL. A
110
- * hostname is normalized to HTTPS. When set, editor assets and preview links
111
- * use this deployment instead of the production site's public base URL.
112
- */
113
- previewDomain?: string;
114
- /**
115
- * Recursive preview build configuration. Set to `false` to opt out.
116
- * Defaults to enabled with project defaults.
80
+ * Off unless given as an object; the second build that serves draft
81
+ * previews. Refused under @astrojs/vercel and @astrojs/netlify.
117
82
  */
118
83
  previewBuild?: PreviewBuildOptions | false;
119
84
  /**
120
- * The token issuer (the JWT `iss` the preview middleware pins).
121
- * Set it to bake the value into the preview artifact; otherwise the
122
- * deployment must supply `CONLOCA_SAAS_ISSUER` at runtime.
85
+ * The token issuer (the JWT `iss`) every pass must name. Unset, the preview server checks the pass against the
86
+ * endpoint's published keys alone, so a site sets nothing at runtime; set it (or `CONLOCA_SAAS_ISSUER`) to pin it.
123
87
  */
124
88
  saasIssuer?: string;
125
- /**
126
- * Fail the build when registration is SKIPPED for a missing prerequisite
127
- * (no build token, no repository identity, no git sha/branch, no public
128
- * base URL). Default false, so a plain `astro build` without the token
129
- * stays untouched. Turn it on in CI once setup is done: a deploy can
130
- * then never silently leave the editor at the endpoint stale. An ATTEMPTED
131
- * registration that fails always fails the build, regardless of this.
132
- */
133
- requireRegistration?: boolean;
134
89
  }
135
90
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,E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AW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conloca/cloud-astro",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,8 +9,13 @@
9
9
  "url": "git+https://github.com/conloca/conloca.git",
10
10
  "directory": "packages/cloud-astro"
11
11
  },
12
+ "keywords": [
13
+ "astro-integration",
14
+ "withastro",
15
+ "conloca"
16
+ ],
12
17
  "license": "FSL-1.1-ALv2",
13
- "description": "Astro integration that registers each build's editor bundle at an editor endpoint",
18
+ "description": "Astro integration that writes your site's editor page to /_conloca/editor/, plus the modules that serve draft previews",
14
19
  "type": "module",
15
20
  "sideEffects": false,
16
21
  "main": "./dist/src/index.js",
@@ -38,10 +43,10 @@
38
43
  "import": "./dist/src/site-middleware.js",
39
44
  "default": "./dist/src/site-middleware.js"
40
45
  },
41
- "./bundle": {
42
- "types": "./dist/src/bundle.d.ts",
43
- "import": "./dist/src/bundle.js",
44
- "default": "./dist/src/bundle.js"
46
+ "./dispatcher": {
47
+ "types": "./dist/src/preview/dispatcher.d.ts",
48
+ "import": "./dist/src/preview/dispatcher.js",
49
+ "default": "./dist/src/preview/dispatcher.js"
45
50
  },
46
51
  "./doctor": {
47
52
  "types": "./dist/src/doctor.d.ts",
@@ -69,24 +74,28 @@
69
74
  },
70
75
  "peerDependencies": {
71
76
  "@astrojs/react": "^6.0.5",
72
- "@conloca/astro-cms": "0.2.2",
77
+ "@conloca/astro-cms": "0.2.4",
73
78
  "astro": "^7.3.1",
74
79
  "vite": "^8.2.2"
75
80
  },
76
81
  "dependencies": {
77
- "@conloca/content-api": "0.2.2",
78
- "esbuild": "^0.28.2",
82
+ "@conloca/content-api": "0.2.4",
83
+ "@conloca/mdx": "0.2.4",
79
84
  "hast-util-from-html": "^2.0.3",
80
85
  "jose": "^6.2.10",
86
+ "jsonc-parser": "^3.3.1",
81
87
  "sass": "^1.103.1",
82
88
  "tslib": "^2.8.1"
83
89
  },
84
90
  "devDependencies": {
85
91
  "@astrojs/check": "^0.9.10",
86
- "@conloca/astro-cms": "0.2.2",
92
+ "@astrojs/cloudflare": "14.3.2",
93
+ "@astrojs/sitemap": "^3.7.3",
94
+ "@conloca/astro-cms": "0.2.4",
87
95
  "astro": "^7.3.1",
88
96
  "typescript": "^6.0.3",
89
- "vite": "^8.2.2"
97
+ "vite": "^8.2.2",
98
+ "wrangler": "^4.130.0"
90
99
  },
91
100
  "engines": {
92
101
  "node": ">=20.0.0"
@@ -100,7 +109,6 @@
100
109
  "npm:public"
101
110
  ],
102
111
  "targets": {
103
- "clean": {},
104
112
  "lint": {},
105
113
  "typecheck": {
106
114
  "dependsOn": [
@@ -144,7 +152,9 @@
144
152
  "dependsOn": [
145
153
  "typecheck-tests",
146
154
  "build",
147
- "test-packed"
155
+ "test-packed",
156
+ "test-editor-build",
157
+ "test-preview-build"
148
158
  ],
149
159
  "inputs": [
150
160
  "{projectRoot}/**/*",
@@ -157,6 +167,46 @@
157
167
  "killAfterMs": 10000
158
168
  }
159
169
  },
170
+ "test-editor-build": {
171
+ "//": "Real Astro builds of generated fixture sites: slower than the unit lane, and about five times slower on GitHub's 2-core runners, so it has its own budget.",
172
+ "executor": "@smoothbricks/nx-plugin:bounded-exec",
173
+ "cache": true,
174
+ "inputs": [
175
+ "default",
176
+ "^production",
177
+ "{workspaceRoot}/bun.lock"
178
+ ],
179
+ "dependsOn": [
180
+ "build",
181
+ "^build"
182
+ ],
183
+ "options": {
184
+ "command": "bun test --timeout=180000 ./test-editor-build",
185
+ "cwd": "{projectRoot}",
186
+ "timeoutMs": 900000,
187
+ "killAfterMs": 10000
188
+ }
189
+ },
190
+ "test-preview-build": {
191
+ "//": "Real D3 and D4 builds (each runs the preview build too), a dry-run deploy and a local Cloudflare Worker: the slowest lane, with its own budget.",
192
+ "executor": "@smoothbricks/nx-plugin:bounded-exec",
193
+ "cache": true,
194
+ "inputs": [
195
+ "default",
196
+ "^production",
197
+ "{workspaceRoot}/bun.lock"
198
+ ],
199
+ "dependsOn": [
200
+ "build",
201
+ "^build"
202
+ ],
203
+ "options": {
204
+ "command": "bun test --timeout=600000 ./test-preview-build",
205
+ "cwd": "{projectRoot}",
206
+ "timeoutMs": 900000,
207
+ "killAfterMs": 10000
208
+ }
209
+ },
160
210
  "test-packed": {
161
211
  "//": "The packed shape is a function of the built outputs, the manifest and the locked dependency closure; cached on exactly those.",
162
212
  "executor": "nx:run-commands",
@@ -4,13 +4,14 @@ import { join } from 'node:path';
4
4
  import { endpointReaderOptions, type PuckManifest, readPuckConfig } from '@conloca/astro-cms/puck-manifest';
5
5
  import { COMPONENT_MANIFEST_LIMITS, measureJson } from '@conloca/content-api/component-vocabulary';
6
6
 
7
- /** The emitted manifest: its site-relative URL and the full sha-256 hex of its bytes. */
7
+ /** The emitted manifest: its site-relative URL, its file name and the full sha-256 hex of its bytes. */
8
8
  export interface ComponentManifestArtifact {
9
9
  url: string;
10
+ filename: string;
10
11
  hash: string;
11
12
  }
12
13
 
13
- /** Metadata transport ceiling; larger metadata must not be registered as a usable artifact. */
14
+ /** Metadata transport ceiling; larger metadata must not ship as a usable artifact. */
14
15
  const MAX_MANIFEST_BYTES = COMPONENT_MANIFEST_LIMITS.bytes;
15
16
 
16
17
  type Logger = { info(message: string): void; warn(message: string): void };
@@ -19,8 +20,7 @@ type Logger = { info(message: string): void; warn(message: string): void };
19
20
  * Writes the site's component vocabulary — every Puck component the config
20
21
  * declares and what each accepts, read from source and never executed — as a
21
22
  * content-addressed artifact beside the editor bundle:
22
- * `_conloca/component-manifest.<hash16>.json`. The `/_conloca/*` CORS rule the
23
- * bundle wrote already covers it, and `mirrorEditorAssets` copies the dir.
23
+ * `<folder>/component-manifest.<hash16>.json`.
24
24
  *
25
25
  * Fail-soft: the manifest is metadata for agents, so a failure costs the
26
26
  * manifest and warns — never the build. A config the reader cannot fully read
@@ -29,10 +29,13 @@ type Logger = { info(message: string): void; warn(message: string): void };
29
29
  */
30
30
  export async function emitComponentManifest(input: {
31
31
  dir: string;
32
+ /** Folder below `dir` to write into; `_conloca` unless given. */
33
+ folder?: string;
32
34
  puckConfigPath: string;
33
35
  projectRoot: string;
34
36
  logger: Logger;
35
37
  }): Promise<ComponentManifestArtifact | undefined> {
38
+ const folder = input.folder ?? '_conloca';
36
39
  try {
37
40
  const manifest = readPuckConfig(
38
41
  endpointReaderOptions({ puckConfigPath: input.puckConfigPath, projectRoot: input.projectRoot }),
@@ -47,10 +50,10 @@ export async function emitComponentManifest(input: {
47
50
  measureJson(manifest, COMPONENT_MANIFEST_LIMITS);
48
51
  const hash = createHash('sha256').update(bytes).digest('hex');
49
52
  const filename = `component-manifest.${hash.slice(0, 16)}.json`;
50
- await mkdir(join(input.dir, '_conloca'), { recursive: true });
51
- await writeFile(join(input.dir, '_conloca', filename), bytes);
52
- reportManifest(manifest, `/_conloca/${filename}`, input.logger);
53
- return { url: `/_conloca/${filename}`, hash };
53
+ await mkdir(join(input.dir, folder), { recursive: true });
54
+ await writeFile(join(input.dir, folder, filename), bytes);
55
+ reportManifest(manifest, `/${folder}/${filename}`, input.logger);
56
+ return { url: `/${folder}/${filename}`, filename, hash };
54
57
  } catch (error) {
55
58
  input.logger.warn(
56
59
  'component manifest skipped — agents get no component vocabulary from this build ' +
package/src/constants.ts CHANGED
@@ -5,24 +5,26 @@
5
5
  export const PACKAGE_NAME = '@conloca/cloud-astro';
6
6
 
7
7
  /**
8
- * Environment variable that the recursive preview build sets on the child
9
- * Astro process so the integration's own `astro:build:done` hook can detect
10
- * it and skip re-registration / further recursion.
8
+ * Environment variable that makes a build the preview server: the site's build sets it on the child build it starts,
9
+ * and a separate preview deploy (D4) builds with it set.
11
10
  */
12
11
  export const PREVIEW_BUILD_ENV_FLAG = 'CONLOCA_PREVIEW_BUILD';
13
12
 
14
13
  /**
15
- * Environment variable consumed by the recursive preview build to discover
16
- * the per-branch preview secret needed to construct the secret-scoped Astro
17
- * route (`/conloca_preview_<secret>/[...path]`).
14
+ * Environment variable the site's build names the child's mode in (`d2` or `d3`). A build started with
15
+ * {@link PREVIEW_BUILD_ENV_FLAG} alone, as a separate preview deploy runs it, has none: it is D4.
18
16
  */
19
- export const PREVIEW_SECRET_ENV_FLAG = 'CONLOCA_PREVIEW_SECRET';
17
+ export const PREVIEW_MODE_ENV = 'CONLOCA_PREVIEW_MODE';
20
18
 
21
19
  /**
22
- * Environment variable carrying the build token (`cbt_<id>.<secret>`),
23
- * issued by the endpoint, that authenticates the site's build to the
24
- * endpoint's registration route.
25
- * Read when {@link ConlocaCloudOptions.buildToken} is not set, so CI can
26
- * inject the credential without committing it to `astro.config.mjs`.
20
+ * Environment variable the site's build names, for a D3 child, the routes it prerendered (a JSON list of their
21
+ * components): the child keeps exactly those prerendered, and every other route keeps its own setting.
27
22
  */
28
- export const BUILD_TOKEN_ENV_VAR = 'CONLOCA_BUILD_TOKEN';
23
+ export const PREVIEW_PRERENDERED_ENV = 'CONLOCA_PREVIEW_PRERENDERED';
24
+
25
+ /**
26
+ * Adapters the preview build is refused under: they write their deployable
27
+ * output at the project root whatever `outDir` says, so the preview build
28
+ * could replace the live site.
29
+ */
30
+ export const REFUSED_PREVIEW_ADAPTERS: readonly string[] = ['@astrojs/vercel', '@astrojs/netlify'];