inlaycms 0.0.0-stage → 0.1.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 (364) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +462 -2
  3. package/assets/admin/admin.css +2 -0
  4. package/assets/admin/admin.js +1 -0
  5. package/assets/admin/editor.js +125 -0
  6. package/dist/adapters/admin/activity.d.ts +17 -0
  7. package/dist/adapters/admin/activity.js +59 -0
  8. package/dist/adapters/admin/assets.d.ts +14 -0
  9. package/dist/adapters/admin/assets.js +64 -0
  10. package/dist/adapters/admin/attention.d.ts +15 -0
  11. package/dist/adapters/admin/attention.js +34 -0
  12. package/dist/adapters/admin/context.d.ts +40 -0
  13. package/dist/adapters/admin/context.js +142 -0
  14. package/dist/adapters/admin/form/walk.d.ts +61 -0
  15. package/dist/adapters/admin/form/walk.js +565 -0
  16. package/dist/adapters/admin/pages.d.ts +38 -0
  17. package/dist/adapters/admin/pages.js +66 -0
  18. package/dist/adapters/admin/publish.d.ts +12 -0
  19. package/dist/adapters/admin/publish.js +195 -0
  20. package/dist/adapters/admin/routes.d.ts +47 -0
  21. package/dist/adapters/admin/routes.js +255 -0
  22. package/dist/adapters/admin/screens/backups.d.ts +11 -0
  23. package/dist/adapters/admin/screens/backups.js +223 -0
  24. package/dist/adapters/admin/screens/dashboard.d.ts +4 -0
  25. package/dist/adapters/admin/screens/dashboard.js +160 -0
  26. package/dist/adapters/admin/screens/editor.d.ts +67 -0
  27. package/dist/adapters/admin/screens/editor.js +416 -0
  28. package/dist/adapters/admin/screens/history.d.ts +4 -0
  29. package/dist/adapters/admin/screens/history.js +105 -0
  30. package/dist/adapters/admin/screens/lists.d.ts +4 -0
  31. package/dist/adapters/admin/screens/lists.js +297 -0
  32. package/dist/adapters/admin/screens/media.d.ts +20 -0
  33. package/dist/adapters/admin/screens/media.js +186 -0
  34. package/dist/adapters/admin/screens/pickers.d.ts +29 -0
  35. package/dist/adapters/admin/screens/pickers.js +134 -0
  36. package/dist/adapters/admin/screens/preview-pane.d.ts +10 -0
  37. package/dist/adapters/admin/screens/preview-pane.js +74 -0
  38. package/dist/adapters/admin/screens/redirects.d.ts +4 -0
  39. package/dist/adapters/admin/screens/redirects.js +137 -0
  40. package/dist/adapters/admin/screens/releases.d.ts +7 -0
  41. package/dist/adapters/admin/screens/releases.js +287 -0
  42. package/dist/adapters/admin/screens/search.d.ts +22 -0
  43. package/dist/adapters/admin/screens/search.js +113 -0
  44. package/dist/adapters/admin/screens/security.d.ts +4 -0
  45. package/dist/adapters/admin/screens/security.js +85 -0
  46. package/dist/adapters/admin/screens/users.d.ts +4 -0
  47. package/dist/adapters/admin/screens/users.js +330 -0
  48. package/dist/adapters/admin/theme.d.ts +1 -0
  49. package/dist/adapters/admin/theme.js +1 -0
  50. package/dist/adapters/admin/translations.d.ts +16 -0
  51. package/dist/adapters/admin/translations.js +23 -0
  52. package/dist/adapters/admin/upload.d.ts +8 -0
  53. package/dist/adapters/admin/upload.js +116 -0
  54. package/dist/adapters/admin/views/data-table.d.ts +82 -0
  55. package/dist/adapters/admin/views/data-table.js +117 -0
  56. package/dist/adapters/admin/views/icons.d.ts +48 -0
  57. package/dist/adapters/admin/views/icons.js +47 -0
  58. package/dist/adapters/admin/views/layout.d.ts +51 -0
  59. package/dist/adapters/admin/views/layout.js +145 -0
  60. package/dist/adapters/admin/views/sheet.d.ts +15 -0
  61. package/dist/adapters/admin/views/sheet.js +6 -0
  62. package/dist/adapters/admin/views/status.d.ts +32 -0
  63. package/dist/adapters/admin/views/status.js +74 -0
  64. package/dist/adapters/auth/handler.d.ts +10 -0
  65. package/dist/adapters/auth/handler.js +63 -0
  66. package/dist/adapters/auth/request.d.ts +8 -0
  67. package/dist/adapters/auth/request.js +14 -0
  68. package/dist/adapters/cli/bin.d.ts +2 -0
  69. package/dist/adapters/cli/bin.js +42 -0
  70. package/dist/adapters/cli/main.d.ts +7 -0
  71. package/dist/adapters/cli/main.js +982 -0
  72. package/dist/adapters/cli/remote.d.ts +52 -0
  73. package/dist/adapters/cli/remote.js +161 -0
  74. package/dist/adapters/mcp/agent-refs.d.ts +9 -0
  75. package/dist/adapters/mcp/agent-refs.js +25 -0
  76. package/dist/adapters/mcp/documents.d.ts +15 -0
  77. package/dist/adapters/mcp/documents.js +26 -0
  78. package/dist/adapters/mcp/fetch-url.d.ts +19 -0
  79. package/dist/adapters/mcp/fetch-url.js +244 -0
  80. package/dist/adapters/mcp/request-state.d.ts +15 -0
  81. package/dist/adapters/mcp/request-state.js +38 -0
  82. package/dist/adapters/mcp/results.d.ts +20 -0
  83. package/dist/adapters/mcp/results.js +61 -0
  84. package/dist/adapters/mcp/route.d.ts +34 -0
  85. package/dist/adapters/mcp/route.js +52 -0
  86. package/dist/adapters/mcp/server.d.ts +44 -0
  87. package/dist/adapters/mcp/server.js +49 -0
  88. package/dist/adapters/mcp/tools/history.d.ts +5 -0
  89. package/dist/adapters/mcp/tools/history.js +84 -0
  90. package/dist/adapters/mcp/tools/media.d.ts +5 -0
  91. package/dist/adapters/mcp/tools/media.js +102 -0
  92. package/dist/adapters/mcp/tools/publish.d.ts +5 -0
  93. package/dist/adapters/mcp/tools/publish.js +157 -0
  94. package/dist/adapters/mcp/tools/read.d.ts +5 -0
  95. package/dist/adapters/mcp/tools/read.js +279 -0
  96. package/dist/adapters/mcp/tools/redirects.d.ts +5 -0
  97. package/dist/adapters/mcp/tools/redirects.js +74 -0
  98. package/dist/adapters/mcp/tools/write.d.ts +5 -0
  99. package/dist/adapters/mcp/tools/write.js +304 -0
  100. package/dist/adapters/site/backup-schedule.d.ts +8 -0
  101. package/dist/adapters/site/backup-schedule.js +31 -0
  102. package/dist/adapters/site/cache.d.ts +29 -0
  103. package/dist/adapters/site/cache.js +63 -0
  104. package/dist/adapters/site/context.d.ts +29 -0
  105. package/dist/adapters/site/context.js +278 -0
  106. package/dist/adapters/site/head.d.ts +23 -0
  107. package/dist/adapters/site/head.js +44 -0
  108. package/dist/adapters/site/limiter.d.ts +17 -0
  109. package/dist/adapters/site/limiter.js +39 -0
  110. package/dist/adapters/site/lock.d.ts +30 -0
  111. package/dist/adapters/site/lock.js +143 -0
  112. package/dist/adapters/site/media-routes.d.ts +4 -0
  113. package/dist/adapters/site/media-routes.js +55 -0
  114. package/dist/adapters/site/plugin.d.ts +122 -0
  115. package/dist/adapters/site/plugin.js +436 -0
  116. package/dist/adapters/site/preview.d.ts +36 -0
  117. package/dist/adapters/site/preview.js +82 -0
  118. package/dist/adapters/site/public.d.ts +6 -0
  119. package/dist/adapters/site/public.js +87 -0
  120. package/dist/adapters/site/render.d.ts +45 -0
  121. package/dist/adapters/site/render.js +191 -0
  122. package/dist/adapters/site/routes.d.ts +17 -0
  123. package/dist/adapters/site/routes.js +125 -0
  124. package/dist/adapters/site/sitemap.d.ts +10 -0
  125. package/dist/adapters/site/sitemap.js +10 -0
  126. package/dist/adapters/web.d.ts +22 -0
  127. package/dist/adapters/web.js +75 -0
  128. package/dist/config.d.ts +21 -0
  129. package/dist/config.js +58 -0
  130. package/dist/core/agent/format.d.ts +62 -0
  131. package/dist/core/agent/format.js +211 -0
  132. package/dist/core/agent/schema.d.ts +6 -0
  133. package/dist/core/agent/schema.js +86 -0
  134. package/dist/core/archive.d.ts +12 -0
  135. package/dist/core/archive.js +72 -0
  136. package/dist/core/auth/auth.d.ts +4911 -0
  137. package/dist/core/auth/auth.js +61 -0
  138. package/dist/core/auth/roles.d.ts +10 -0
  139. package/dist/core/auth/roles.js +38 -0
  140. package/dist/core/auth/service.d.ts +118 -0
  141. package/dist/core/auth/service.js +424 -0
  142. package/dist/core/auth/upload-token.d.ts +8 -0
  143. package/dist/core/auth/upload-token.js +27 -0
  144. package/dist/core/backup/backup.d.ts +28 -0
  145. package/dist/core/backup/backup.js +126 -0
  146. package/dist/core/backup/restore.d.ts +41 -0
  147. package/dist/core/backup/restore.js +264 -0
  148. package/dist/core/backup/schedule.d.ts +12 -0
  149. package/dist/core/backup/schedule.js +29 -0
  150. package/dist/core/boot.d.ts +63 -0
  151. package/dist/core/boot.js +141 -0
  152. package/dist/core/check.d.ts +32 -0
  153. package/dist/core/check.js +111 -0
  154. package/dist/core/content/activity.d.ts +8 -0
  155. package/dist/core/content/activity.js +101 -0
  156. package/dist/core/content/delete.d.ts +5 -0
  157. package/dist/core/content/delete.js +100 -0
  158. package/dist/core/content/diff.d.ts +6 -0
  159. package/dist/core/content/diff.js +129 -0
  160. package/dist/core/content/dry-run.d.ts +24 -0
  161. package/dist/core/content/dry-run.js +69 -0
  162. package/dist/core/content/gaps.d.ts +25 -0
  163. package/dist/core/content/gaps.js +50 -0
  164. package/dist/core/content/hidden.d.ts +33 -0
  165. package/dist/core/content/hidden.js +103 -0
  166. package/dist/core/content/history.d.ts +15 -0
  167. package/dist/core/content/history.js +62 -0
  168. package/dist/core/content/patch.d.ts +40 -0
  169. package/dist/core/content/patch.js +287 -0
  170. package/dist/core/content/path.d.ts +6 -0
  171. package/dist/core/content/path.js +38 -0
  172. package/dist/core/content/publish.d.ts +26 -0
  173. package/dist/core/content/publish.js +211 -0
  174. package/dist/core/content/read.d.ts +99 -0
  175. package/dist/core/content/read.js +141 -0
  176. package/dist/core/content/reader.d.ts +37 -0
  177. package/dist/core/content/reader.js +195 -0
  178. package/dist/core/content/refs.d.ts +44 -0
  179. package/dist/core/content/refs.js +161 -0
  180. package/dist/core/content/release-migrations.d.ts +12 -0
  181. package/dist/core/content/release-migrations.js +154 -0
  182. package/dist/core/content/save.d.ts +25 -0
  183. package/dist/core/content/save.js +87 -0
  184. package/dist/core/content/schema.d.ts +22 -0
  185. package/dist/core/content/schema.js +127 -0
  186. package/dist/core/content/search.d.ts +8 -0
  187. package/dist/core/content/search.js +89 -0
  188. package/dist/core/content/shipped-input.d.ts +39 -0
  189. package/dist/core/content/shipped-input.js +221 -0
  190. package/dist/core/content/shipped.d.ts +112 -0
  191. package/dist/core/content/shipped.js +437 -0
  192. package/dist/core/content/slug.d.ts +23 -0
  193. package/dist/core/content/slug.js +182 -0
  194. package/dist/core/content/stats.d.ts +11 -0
  195. package/dist/core/content/stats.js +30 -0
  196. package/dist/core/content/translate.d.ts +3 -0
  197. package/dist/core/content/translate.js +68 -0
  198. package/dist/core/content/usages.d.ts +13 -0
  199. package/dist/core/content/usages.js +70 -0
  200. package/dist/core/content/validate.d.ts +21 -0
  201. package/dist/core/content/validate.js +124 -0
  202. package/dist/core/content/write.d.ts +10 -0
  203. package/dist/core/content/write.js +93 -0
  204. package/dist/core/core.d.ts +227 -0
  205. package/dist/core/core.js +251 -0
  206. package/dist/core/db/connection.d.ts +6 -0
  207. package/dist/core/db/connection.js +12 -0
  208. package/dist/core/db/migrate.d.ts +9 -0
  209. package/dist/core/db/migrate.js +42 -0
  210. package/dist/core/db/migrations/0001_content.d.ts +2 -0
  211. package/dist/core/db/migrations/0001_content.js +69 -0
  212. package/dist/core/db/migrations/0002_media.d.ts +2 -0
  213. package/dist/core/db/migrations/0002_media.js +26 -0
  214. package/dist/core/db/migrations/0003_redirects.d.ts +2 -0
  215. package/dist/core/db/migrations/0003_redirects.js +19 -0
  216. package/dist/core/db/migrations/0004_token_cutoffs.d.ts +3 -0
  217. package/dist/core/db/migrations/0004_token_cutoffs.js +8 -0
  218. package/dist/core/db/migrations/0005_site_lock.d.ts +3 -0
  219. package/dist/core/db/migrations/0005_site_lock.js +10 -0
  220. package/dist/core/db/migrations/0006_releases.d.ts +3 -0
  221. package/dist/core/db/migrations/0006_releases.js +34 -0
  222. package/dist/core/db/schema.d.ts +155 -0
  223. package/dist/core/db/schema.js +1 -0
  224. package/dist/core/errors.d.ts +27 -0
  225. package/dist/core/errors.js +15 -0
  226. package/dist/core/export/export.d.ts +17 -0
  227. package/dist/core/export/export.js +185 -0
  228. package/dist/core/export/format.d.ts +241 -0
  229. package/dist/core/export/format.js +106 -0
  230. package/dist/core/export/import.d.ts +54 -0
  231. package/dist/core/export/import.js +180 -0
  232. package/dist/core/export/read.d.ts +16 -0
  233. package/dist/core/export/read.js +234 -0
  234. package/dist/core/export/replace.d.ts +17 -0
  235. package/dist/core/export/replace.js +36 -0
  236. package/dist/core/export/report.d.ts +55 -0
  237. package/dist/core/export/report.js +50 -0
  238. package/dist/core/export/schema.d.ts +8 -0
  239. package/dist/core/export/schema.js +47 -0
  240. package/dist/core/export/stage.d.ts +25 -0
  241. package/dist/core/export/stage.js +192 -0
  242. package/dist/core/fields/builtins.d.ts +70 -0
  243. package/dist/core/fields/builtins.js +335 -0
  244. package/dist/core/fields/define.d.ts +86 -0
  245. package/dist/core/fields/define.js +34 -0
  246. package/dist/core/fields/walk.d.ts +49 -0
  247. package/dist/core/fields/walk.js +270 -0
  248. package/dist/core/fields/widgets.d.ts +27 -0
  249. package/dist/core/fields/widgets.js +330 -0
  250. package/dist/core/fields/zod-internals.d.ts +29 -0
  251. package/dist/core/fields/zod-internals.js +28 -0
  252. package/dist/core/media/detect.d.ts +5 -0
  253. package/dist/core/media/detect.js +66 -0
  254. package/dist/core/media/labels.d.ts +6 -0
  255. package/dist/core/media/labels.js +17 -0
  256. package/dist/core/media/library.d.ts +45 -0
  257. package/dist/core/media/library.js +239 -0
  258. package/dist/core/media/store.d.ts +11 -0
  259. package/dist/core/media/store.js +49 -0
  260. package/dist/core/media/variants.d.ts +10 -0
  261. package/dist/core/media/variants.js +59 -0
  262. package/dist/core/messages/en.d.ts +1278 -0
  263. package/dist/core/messages/en.js +1287 -0
  264. package/dist/core/messages/index.d.ts +7 -0
  265. package/dist/core/messages/index.js +14 -0
  266. package/dist/core/preview.d.ts +16 -0
  267. package/dist/core/preview.js +42 -0
  268. package/dist/core/redirects/collapse.d.ts +68 -0
  269. package/dist/core/redirects/collapse.js +153 -0
  270. package/dist/core/redirects/csv.d.ts +15 -0
  271. package/dist/core/redirects/csv.js +68 -0
  272. package/dist/core/redirects/redirects.d.ts +58 -0
  273. package/dist/core/redirects/redirects.js +545 -0
  274. package/dist/core/registry/content.d.ts +26 -0
  275. package/dist/core/registry/content.js +9 -0
  276. package/dist/core/registry/define.d.ts +145 -0
  277. package/dist/core/registry/define.js +41 -0
  278. package/dist/core/registry/migration.d.ts +44 -0
  279. package/dist/core/registry/migration.js +4 -0
  280. package/dist/core/registry/registry.d.ts +18 -0
  281. package/dist/core/registry/registry.js +255 -0
  282. package/dist/core/registry/render.d.ts +98 -0
  283. package/dist/core/registry/render.js +1 -0
  284. package/dist/core/registry/route.d.ts +42 -0
  285. package/dist/core/registry/route.js +3 -0
  286. package/dist/core/release/bundle.d.ts +21 -0
  287. package/dist/core/release/bundle.js +252 -0
  288. package/dist/core/release/keys.d.ts +11 -0
  289. package/dist/core/release/keys.js +60 -0
  290. package/dist/core/release/manifest.d.ts +103 -0
  291. package/dist/core/release/manifest.js +138 -0
  292. package/dist/core/release/pack.d.ts +20 -0
  293. package/dist/core/release/pack.js +97 -0
  294. package/dist/core/release/pointer.d.ts +19 -0
  295. package/dist/core/release/pointer.js +53 -0
  296. package/dist/core/release/read.d.ts +59 -0
  297. package/dist/core/release/read.js +256 -0
  298. package/dist/core/report.d.ts +31 -0
  299. package/dist/core/report.js +37 -0
  300. package/dist/core/richtext/html.d.ts +15 -0
  301. package/dist/core/richtext/html.js +81 -0
  302. package/dist/core/richtext/markdown.d.ts +19 -0
  303. package/dist/core/richtext/markdown.js +951 -0
  304. package/dist/core/richtext/schema.d.ts +98 -0
  305. package/dist/core/richtext/schema.js +275 -0
  306. package/dist/core/site/live.d.ts +56 -0
  307. package/dist/core/site/live.js +145 -0
  308. package/dist/core/site/paths.d.ts +15 -0
  309. package/dist/core/site/paths.js +64 -0
  310. package/dist/core/site/resolve.d.ts +9 -0
  311. package/dist/core/site/resolve.js +202 -0
  312. package/dist/core/site/sitemap.d.ts +11 -0
  313. package/dist/core/site/sitemap.js +24 -0
  314. package/dist/core/site-lock/site-lock.d.ts +21 -0
  315. package/dist/core/site-lock/site-lock.js +65 -0
  316. package/dist/core/site-lock/token.d.ts +7 -0
  317. package/dist/core/site-lock/token.js +24 -0
  318. package/dist/core/theme.d.ts +22 -0
  319. package/dist/core/theme.js +133 -0
  320. package/dist/core/types.d.ts +253 -0
  321. package/dist/core/types.js +1 -0
  322. package/dist/core/version.d.ts +1 -0
  323. package/dist/core/version.js +5 -0
  324. package/dist/host/activate.d.ts +53 -0
  325. package/dist/host/activate.js +162 -0
  326. package/dist/host/app.d.ts +46 -0
  327. package/dist/host/app.js +129 -0
  328. package/dist/host/bin.d.ts +5 -0
  329. package/dist/host/bin.js +8 -0
  330. package/dist/host/config.d.ts +36 -0
  331. package/dist/host/config.js +152 -0
  332. package/dist/host/dev.d.ts +10 -0
  333. package/dist/host/dev.js +293 -0
  334. package/dist/host/diff.d.ts +78 -0
  335. package/dist/host/diff.js +346 -0
  336. package/dist/host/hooks.d.ts +41 -0
  337. package/dist/host/hooks.js +49 -0
  338. package/dist/host/ipc.d.ts +123 -0
  339. package/dist/host/ipc.js +61 -0
  340. package/dist/host/preview-proxy.d.ts +24 -0
  341. package/dist/host/preview-proxy.js +154 -0
  342. package/dist/host/preview-worker.d.ts +42 -0
  343. package/dist/host/preview-worker.js +242 -0
  344. package/dist/host/primary.d.ts +38 -0
  345. package/dist/host/primary.js +357 -0
  346. package/dist/host/push.d.ts +125 -0
  347. package/dist/host/push.js +420 -0
  348. package/dist/host/serve.d.ts +16 -0
  349. package/dist/host/serve.js +150 -0
  350. package/dist/host/store.d.ts +48 -0
  351. package/dist/host/store.js +109 -0
  352. package/dist/host/worker.d.ts +67 -0
  353. package/dist/host/worker.js +310 -0
  354. package/dist/index.d.ts +47 -0
  355. package/dist/index.js +32 -0
  356. package/dist/jsx/html.d.ts +16 -0
  357. package/dist/jsx/html.js +65 -0
  358. package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
  359. package/dist/jsx/jsx-dev-runtime.js +5 -0
  360. package/dist/jsx/jsx-runtime.d.ts +17 -0
  361. package/dist/jsx/jsx-runtime.js +41 -0
  362. package/dist/site.d.ts +17 -0
  363. package/dist/site.js +14 -0
  364. package/package.json +111 -3
@@ -0,0 +1,252 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { existsSync } from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { builtinModules } from 'node:module';
5
+ import { dirname, extname, isAbsolute, join, relative, resolve } from 'node:path';
6
+ import { fileURLToPath, pathToFileURL } from 'node:url';
7
+ import { build, transform } from 'esbuild';
8
+ import { InlayError } from '../errors.js';
9
+ import { INLAY_ENTRIES } from './read.js';
10
+ /** What a release's `site.js` may import; everything else is bundled into it or refused. */
11
+ export const RELEASE_IMPORTS = ['inlaycms/site', 'inlaycms/jsx-runtime', 'inlaycms/jsx-dev-runtime'];
12
+ /** Free names site code may not use: they reach the server's process or run code from text. */
13
+ const FORBIDDEN = [
14
+ 'process',
15
+ 'require',
16
+ 'eval',
17
+ 'Function',
18
+ 'globalThis.process',
19
+ 'global.process',
20
+ 'globalThis.eval',
21
+ 'global.eval',
22
+ 'globalThis.Function',
23
+ 'global.Function',
24
+ ];
25
+ /** Values pinned at bundle time instead of read from the server's process. */
26
+ const DEFINES = { 'process.env.NODE_ENV': JSON.stringify('production') };
27
+ const BUILTINS = new Set(builtinModules);
28
+ const LOADERS = {
29
+ '.ts': 'ts',
30
+ '.mts': 'ts',
31
+ '.cts': 'ts',
32
+ '.tsx': 'tsx',
33
+ '.jsx': 'jsx',
34
+ '.js': 'js',
35
+ '.mjs': 'js',
36
+ '.cjs': 'js',
37
+ };
38
+ function isInlay(specifier) {
39
+ return specifier === 'inlaycms' || specifier.startsWith('inlaycms/');
40
+ }
41
+ function isBuiltin(specifier) {
42
+ return specifier.startsWith('node:') || BUILTINS.has(specifier) || BUILTINS.has(specifier.split('/')[0] ?? '');
43
+ }
44
+ /** Whether `file` is part of an installed package rather than the site's own code. */
45
+ function isPackage(file) {
46
+ return file.split(/[\\/]/).includes('node_modules');
47
+ }
48
+ /** The text of the `tsconfig.json` nearest above each folder, looked up once per folder. */
49
+ function tsconfigs() {
50
+ const found = new Map();
51
+ const lookup = (dir) => {
52
+ let text = found.get(dir);
53
+ if (text === undefined) {
54
+ const file = join(dir, 'tsconfig.json');
55
+ const parent = dirname(dir);
56
+ text = existsSync(file) ? readFile(file, 'utf8') : parent === dir ? Promise.resolve(undefined) : lookup(parent);
57
+ found.set(dir, text);
58
+ }
59
+ return text;
60
+ };
61
+ return lookup;
62
+ }
63
+ /**
64
+ * What the site's own module `text` uses that a release refuses: a free `process`, `require`, `eval` or
65
+ * `Function` (or one of those read off `globalThis` or `global`), or an `import()` of a computed name; null when
66
+ * nothing. esbuild only replaces free names through `define`, so a local variable, a property or a string of the
67
+ * same name passes; and with dynamic imports turned into `__toESM(require(...))` calls, a computed one is a call
68
+ * whose argument is neither a plain string nor a template starting `./` or `../`, which esbuild bundles as a glob.
69
+ */
70
+ async function forbiddenUse(text, loader, file, tsconfigRaw) {
71
+ const marker = `__inlay_forbidden_${randomBytes(6).toString('hex')}_`;
72
+ const define = Object.fromEntries(FORBIDDEN.map((name, i) => [name, `${marker}${i}`]));
73
+ const { code } = await transform(text, {
74
+ loader,
75
+ sourcefile: file,
76
+ format: 'esm',
77
+ jsx: 'preserve',
78
+ tsconfigRaw,
79
+ supported: { 'dynamic-import': false },
80
+ define: { ...DEFINES, ...define, 'import.meta.url': '""' },
81
+ logLevel: 'silent',
82
+ });
83
+ const found = new RegExp(`${marker}(\\d+)`).exec(code);
84
+ if (found)
85
+ return FORBIDDEN[Number(found[1])] ?? null;
86
+ return /__toESM\d*\(require\(\s*(?!"|`\.\.?\/)\S/.test(code) ? 'import()' : null;
87
+ }
88
+ /** A `file:` URL import as the path esbuild reads, or undefined to leave it to esbuild. */
89
+ function fileUrlPath(specifier) {
90
+ if (!specifier.startsWith('file:'))
91
+ return undefined;
92
+ try {
93
+ return { path: fileURLToPath(specifier) };
94
+ }
95
+ catch {
96
+ return undefined;
97
+ }
98
+ }
99
+ /** Module `text` at `file` with `import.meta.url` naming `file` itself; undefined when it doesn't use it. */
100
+ async function withOwnUrl(text, file, loader, tsconfigRaw) {
101
+ if (!text.includes('import.meta.url'))
102
+ return undefined;
103
+ const out = await transform(text, {
104
+ loader,
105
+ sourcefile: file,
106
+ format: 'esm',
107
+ jsx: 'preserve',
108
+ tsconfigRaw,
109
+ define: { 'import.meta.url': JSON.stringify(pathToFileURL(file).href) },
110
+ logLevel: 'silent',
111
+ });
112
+ return { contents: out.code, loader: loader === 'tsx' || loader === 'jsx' ? 'jsx' : 'js' };
113
+ }
114
+ /** The esbuild options `bundleSite` and `bundleConfig` share. */
115
+ function buildOptions(configFile, outFile, plugin) {
116
+ return {
117
+ entryPoints: [configFile],
118
+ bundle: true,
119
+ format: 'esm',
120
+ platform: 'node',
121
+ target: 'node24',
122
+ outfile: outFile,
123
+ jsx: 'automatic',
124
+ jsxImportSource: 'inlaycms',
125
+ define: { ...DEFINES, 'import.meta.url': JSON.stringify(pathToFileURL(resolve(configFile)).href) },
126
+ logLevel: 'silent',
127
+ plugins: [plugin],
128
+ };
129
+ }
130
+ /**
131
+ * Bundles the config module at `configFile` and everything it imports into one ESM file at `outFile` for the CLI
132
+ * to import, so loading a site's TypeScript and JSX needs nothing but Inlay. `inlaycms` imports point at the running
133
+ * copy, as a release's do; nothing is refused, since `bundleSite` is what holds a release to its boundary. A build
134
+ * failure is `cli.configFailed`.
135
+ */
136
+ export async function bundleConfig(configFile, outFile) {
137
+ const tsconfigFor = tsconfigs();
138
+ // The running copy's own folder (`src/` or `dist/`): a file in it is imported, never bundled as a second copy.
139
+ const inlayDir = dirname(INLAY_ENTRIES.inlaycms ?? '');
140
+ const resolving = Symbol('resolving');
141
+ const plugin = {
142
+ name: 'inlay-config',
143
+ setup(b) {
144
+ b.onResolve({ filter: /.*/ }, async (args) => {
145
+ if (args.kind === 'entry-point' || args.pluginData === resolving)
146
+ return undefined;
147
+ const running = INLAY_ENTRIES[args.path];
148
+ if (running !== undefined)
149
+ return { path: pathToFileURL(running).href, external: true };
150
+ const url = fileUrlPath(args.path);
151
+ const found = await b.resolve(url?.path ?? args.path, {
152
+ kind: args.kind,
153
+ importer: args.importer,
154
+ resolveDir: args.resolveDir,
155
+ pluginData: resolving,
156
+ });
157
+ if (found.errors.length > 0)
158
+ return url;
159
+ const rel = relative(inlayDir, found.path);
160
+ if (rel !== '' && !rel.startsWith('..') && !isAbsolute(rel))
161
+ return { path: pathToFileURL(found.path).href, external: true };
162
+ return { path: found.path, namespace: found.namespace, external: found.external, sideEffects: found.sideEffects };
163
+ });
164
+ b.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
165
+ const loader = LOADERS[extname(args.path)];
166
+ if (loader === undefined || args.namespace !== 'file')
167
+ return undefined;
168
+ return withOwnUrl(await readFile(args.path, 'utf8'), args.path, loader, await tsconfigFor(dirname(args.path)));
169
+ });
170
+ },
171
+ };
172
+ try {
173
+ await build(buildOptions(configFile, outFile, plugin));
174
+ }
175
+ catch (e) {
176
+ const errors = e.errors;
177
+ throw new InlayError('config', 'cli.configFailed', { path: resolve(configFile), error: errors?.[0]?.text ?? String(e) });
178
+ }
179
+ }
180
+ /**
181
+ * Bundles the config module at `configFile` and everything it imports into one ESM file at `outFile`, leaving
182
+ * `inlaycms/site` and the JSX runtime to the host. `import.meta.url` in each module keeps naming its source file,
183
+ * so `new URL('./x', import.meta.url)` in content means what it meant before bundling. Refuses Node built-ins and
184
+ * any other import left outside the bundle (`inlaycms` itself included) with `error.packImport`, and site code
185
+ * (not installed packages) that reaches for the server with `error.packForbidden`; other build failures are
186
+ * `error.packBundle`. These checks catch mistakes: the release's signature is what makes it trusted. Returns the
187
+ * imports left in the bundle.
188
+ */
189
+ export async function bundleSite(configFile, outFile) {
190
+ const base = dirname(resolve(configFile));
191
+ const shown = (file) => {
192
+ const rel = relative(base, file);
193
+ return rel === '' || rel.startsWith('..') || isAbsolute(rel) ? file : rel;
194
+ };
195
+ const refused = [];
196
+ const forbidden = [];
197
+ const tsconfigFor = tsconfigs();
198
+ const guard = {
199
+ name: 'inlay-release',
200
+ setup(b) {
201
+ b.onResolve({ filter: /.*/ }, (args) => {
202
+ if (args.kind === 'entry-point')
203
+ return undefined;
204
+ if (isBuiltin(args.path) || (isInlay(args.path) && !RELEASE_IMPORTS.includes(args.path))) {
205
+ refused.push({ file: shown(args.importer), specifier: args.path });
206
+ return { errors: [{ text: `refused import ${args.path}` }] };
207
+ }
208
+ return fileUrlPath(args.path);
209
+ });
210
+ b.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
211
+ const loader = LOADERS[extname(args.path)];
212
+ if (loader === undefined || args.namespace !== 'file')
213
+ return undefined;
214
+ const text = await readFile(args.path, 'utf8');
215
+ if (!isPackage(args.path)) {
216
+ const what = await forbiddenUse(text, loader, args.path, await tsconfigFor(dirname(args.path)));
217
+ if (what !== null) {
218
+ forbidden.push({ file: shown(args.path), what });
219
+ return { errors: [{ text: `refused ${what}` }] };
220
+ }
221
+ }
222
+ return withOwnUrl(text, args.path, loader, await tsconfigFor(dirname(args.path)));
223
+ });
224
+ },
225
+ };
226
+ let result;
227
+ try {
228
+ result = await build({ ...buildOptions(configFile, outFile, guard), external: [...RELEASE_IMPORTS], metafile: true });
229
+ }
230
+ catch (e) {
231
+ const first = refused[0];
232
+ if (first)
233
+ throw new InlayError('release', 'error.packImport', first);
234
+ const use = forbidden[0];
235
+ if (use)
236
+ throw new InlayError('release', 'error.packForbidden', use);
237
+ const errors = e.errors;
238
+ throw new InlayError('release', 'error.packBundle', { problem: errors?.[0]?.text ?? String(e) });
239
+ }
240
+ const imports = new Set();
241
+ for (const output of Object.values(result.metafile?.outputs ?? {})) {
242
+ for (const imported of output.imports)
243
+ if (imported.external)
244
+ imports.add(imported.path);
245
+ }
246
+ for (const specifier of imports) {
247
+ if (!RELEASE_IMPORTS.includes(specifier)) {
248
+ throw new InlayError('release', 'error.packImport', { file: shown(resolve(configFile)), specifier });
249
+ }
250
+ }
251
+ return { imports: [...imports] };
252
+ }
@@ -0,0 +1,11 @@
1
+ export declare const PUBLIC_KEY_PREFIX = "ed25519:";
2
+ export declare function generateKeyPair(): {
3
+ privateKey: string;
4
+ publicKey: string;
5
+ };
6
+ export declare function publicKeyOf(privateKeyPem: string): string;
7
+ export declare function fingerprint(publicKey: string): string;
8
+ export declare function sign(privateKeyPem: string, data: Uint8Array): string;
9
+ export declare function verify(publicKey: string, data: Uint8Array, signature: string): boolean;
10
+ export declare function parsePublicKey(text: string): string;
11
+ export declare function parsePublicKeys(text: string): string[];
@@ -0,0 +1,60 @@
1
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, sign as cryptoSign, verify as cryptoVerify, } from 'node:crypto';
2
+ import { InlayError } from '../errors.js';
3
+ export const PUBLIC_KEY_PREFIX = 'ed25519:';
4
+ const SPKI_PREFIX = Buffer.from('302a300506032b6570032100', 'hex');
5
+ function encodePublic(key) {
6
+ const der = key.export({ type: 'spki', format: 'der' });
7
+ return PUBLIC_KEY_PREFIX + der.subarray(der.length - 32).toString('base64');
8
+ }
9
+ function rawBytes(publicKey) {
10
+ if (!publicKey.startsWith(PUBLIC_KEY_PREFIX))
11
+ throw new Error('missing prefix');
12
+ const raw = Buffer.from(publicKey.slice(PUBLIC_KEY_PREFIX.length), 'base64');
13
+ if (raw.length !== 32)
14
+ throw new Error('wrong length');
15
+ return raw;
16
+ }
17
+ function importPublic(publicKey) {
18
+ return createPublicKey({ key: Buffer.concat([SPKI_PREFIX, rawBytes(publicKey)]), format: 'der', type: 'spki' });
19
+ }
20
+ export function generateKeyPair() {
21
+ const { privateKey, publicKey } = generateKeyPairSync('ed25519');
22
+ return {
23
+ privateKey: privateKey.export({ type: 'pkcs8', format: 'pem' }).toString(),
24
+ publicKey: encodePublic(publicKey),
25
+ };
26
+ }
27
+ export function publicKeyOf(privateKeyPem) {
28
+ return encodePublic(createPublicKey(createPrivateKey(privateKeyPem)));
29
+ }
30
+ export function fingerprint(publicKey) {
31
+ return createHash('sha256').update(rawBytes(publicKey)).digest('hex').slice(0, 16);
32
+ }
33
+ export function sign(privateKeyPem, data) {
34
+ return cryptoSign(null, data, createPrivateKey(privateKeyPem)).toString('base64');
35
+ }
36
+ export function verify(publicKey, data, signature) {
37
+ try {
38
+ return cryptoVerify(null, data, importPublic(publicKey), Buffer.from(signature, 'base64'));
39
+ }
40
+ catch {
41
+ return false;
42
+ }
43
+ }
44
+ export function parsePublicKey(text) {
45
+ const key = text.trim();
46
+ try {
47
+ rawBytes(key);
48
+ }
49
+ catch {
50
+ throw new InlayError('config', 'config.publicKey', { text: key });
51
+ }
52
+ return key;
53
+ }
54
+ export function parsePublicKeys(text) {
55
+ return text
56
+ .split(/[\n,]/)
57
+ .map((part) => part.trim())
58
+ .filter((part) => part !== '' && !part.startsWith('#'))
59
+ .map(parsePublicKey);
60
+ }
@@ -0,0 +1,103 @@
1
+ import { z } from 'zod';
2
+ import type { Registry } from '../registry/registry.js';
3
+ export declare const MANIFEST_FORMAT = 1;
4
+ /** What `manifest.json` in a release says; `manifest.sig` signs its bytes. */
5
+ export interface ReleaseManifest {
6
+ format: 1;
7
+ name: string;
8
+ createdAt: string;
9
+ inlay: {
10
+ version: string;
11
+ range: string;
12
+ };
13
+ /** Names of the secrets the site needs; never their values. */
14
+ secrets: string[];
15
+ /** Every file in the release except the manifest and its signature, to its sha256 (hex). */
16
+ files: Record<string, string>;
17
+ /** Each shipped image or file as the site names it, to where the release keeps it (`content/<sha256><ext>`). */
18
+ content: Array<{
19
+ source: string;
20
+ path: string;
21
+ }>;
22
+ /** The JSON Schema of each type's stored data, by type name, as the export manifest has it. */
23
+ schema: Record<string, unknown>;
24
+ /**
25
+ * Each shipped document with its edition and, per locale, the sha256 (hex) of the canonical JSON of its content
26
+ * as written, with each file named by where the release keeps it.
27
+ */
28
+ shipped: Array<{
29
+ type: string;
30
+ key: string;
31
+ edition: number;
32
+ locales: Record<string, string>;
33
+ }>;
34
+ /** Names of the site's migration functions, in order. */
35
+ migrations: string[];
36
+ routes: Array<{
37
+ method: string;
38
+ path: string;
39
+ }>;
40
+ locales: string[];
41
+ /** Each type's kind and slot names, by type name. */
42
+ types: Record<string, {
43
+ kind: 'singleton' | 'collection' | 'global';
44
+ slots: string[];
45
+ }>;
46
+ }
47
+ export declare const manifestSchema: z.ZodObject<{
48
+ format: z.ZodLiteral<1>;
49
+ name: z.ZodString;
50
+ createdAt: z.ZodString;
51
+ inlay: z.ZodObject<{
52
+ version: z.ZodString;
53
+ range: z.ZodString;
54
+ }, z.core.$strict>;
55
+ secrets: z.ZodArray<z.ZodString>;
56
+ files: z.ZodRecord<z.ZodString, z.ZodString>;
57
+ content: z.ZodArray<z.ZodObject<{
58
+ source: z.ZodString;
59
+ path: z.ZodString;
60
+ }, z.core.$strict>>;
61
+ schema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
62
+ shipped: z.ZodArray<z.ZodObject<{
63
+ type: z.ZodString;
64
+ key: z.ZodString;
65
+ edition: z.ZodNumber;
66
+ locales: z.ZodRecord<z.ZodString, z.ZodString>;
67
+ }, z.core.$strict>>;
68
+ migrations: z.ZodArray<z.ZodString>;
69
+ routes: z.ZodArray<z.ZodObject<{
70
+ method: z.ZodString;
71
+ path: z.ZodString;
72
+ }, z.core.$strict>>;
73
+ locales: z.ZodArray<z.ZodString>;
74
+ types: z.ZodRecord<z.ZodString, z.ZodObject<{
75
+ kind: z.ZodEnum<{
76
+ collection: "collection";
77
+ global: "global";
78
+ singleton: "singleton";
79
+ }>;
80
+ slots: z.ZodArray<z.ZodString>;
81
+ }, z.core.$strict>>;
82
+ }, z.core.$strict>;
83
+ /**
84
+ * Whether `version` falls in `range`, which is `^MAJOR.MINOR.PATCH`: for major 0, the same minor and a patch at
85
+ * least as high; otherwise the same major and a minor and patch at least as high.
86
+ */
87
+ export declare function satisfies(version: string, range: string): boolean;
88
+ export declare function sha256Hex(bytes: Uint8Array): string;
89
+ /** Where a release keeps a shipped file: named by its sha256, keeping its extension. */
90
+ export declare function contentPath(file: string, bytes: Uint8Array): string;
91
+ /** `value` as JSON with every object's keys sorted, so equal values give equal text. */
92
+ export declare function canonicalJson(value: unknown): string;
93
+ /**
94
+ * The manifest of the site `registry` describes, without its files: what `packRelease` writes, given the shipped
95
+ * files it packed as `content`. Without `content`, shipped files are read here to name them the way a release
96
+ * would, so a site running from source has a manifest to compare a release with; a file that can't be read is
97
+ * named by its source.
98
+ */
99
+ export declare function manifestOfRegistry(registry: Registry, opts: {
100
+ name: string;
101
+ now: Date;
102
+ content?: ReleaseManifest['content'];
103
+ }): ReleaseManifest;
@@ -0,0 +1,138 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { extname } from 'node:path';
4
+ import { z } from 'zod';
5
+ import { shippedFiles } from '../content/shipped-input.js';
6
+ import { typeSchemas } from '../export/schema.js';
7
+ import { inlayVersion } from '../version.js';
8
+ export const MANIFEST_FORMAT = 1;
9
+ const SHA256 = /^[0-9a-f]{64}$/;
10
+ export const manifestSchema = z.strictObject({
11
+ format: z.literal(MANIFEST_FORMAT),
12
+ name: z.string().min(1),
13
+ createdAt: z.string(),
14
+ inlay: z.strictObject({ version: z.string(), range: z.string() }),
15
+ secrets: z.array(z.string()),
16
+ files: z.record(z.string(), z.string().regex(SHA256)),
17
+ content: z.array(z.strictObject({ source: z.string(), path: z.string() })),
18
+ schema: z.record(z.string(), z.record(z.string(), z.unknown())),
19
+ shipped: z.array(z.strictObject({
20
+ type: z.string(),
21
+ key: z.string(),
22
+ edition: z.number().int(),
23
+ locales: z.record(z.string(), z.string().regex(SHA256)),
24
+ })),
25
+ migrations: z.array(z.string()),
26
+ routes: z.array(z.strictObject({ method: z.string(), path: z.string() })),
27
+ locales: z.array(z.string()),
28
+ types: z.record(z.string(), z.strictObject({ kind: z.enum(['singleton', 'collection', 'global']), slots: z.array(z.string()) })),
29
+ });
30
+ const VERSION = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
31
+ function parts(version) {
32
+ const m = VERSION.exec(version);
33
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
34
+ }
35
+ /**
36
+ * Whether `version` falls in `range`, which is `^MAJOR.MINOR.PATCH`: for major 0, the same minor and a patch at
37
+ * least as high; otherwise the same major and a minor and patch at least as high.
38
+ */
39
+ export function satisfies(version, range) {
40
+ if (!range.startsWith('^'))
41
+ return false;
42
+ const want = parts(range.slice(1));
43
+ const have = parts(version);
44
+ if (!want || !have)
45
+ return false;
46
+ const [major, minor, patch] = want;
47
+ const [hMajor, hMinor, hPatch] = have;
48
+ if (hMajor !== major)
49
+ return false;
50
+ if (major === 0)
51
+ return hMinor === minor && hPatch >= patch;
52
+ return hMinor > minor || (hMinor === minor && hPatch >= patch);
53
+ }
54
+ export function sha256Hex(bytes) {
55
+ return createHash('sha256').update(bytes).digest('hex');
56
+ }
57
+ /** Where a release keeps a shipped file: named by its sha256, keeping its extension. */
58
+ export function contentPath(file, bytes) {
59
+ return `content/${sha256Hex(bytes)}${extname(file).toLowerCase()}`;
60
+ }
61
+ /** `value` as JSON with every object's keys sorted, so equal values give equal text. */
62
+ export function canonicalJson(value) {
63
+ const sorted = (v) => {
64
+ if (v !== null && typeof v === 'object' && typeof v.toJSON === 'function') {
65
+ return sorted(v.toJSON());
66
+ }
67
+ if (Array.isArray(v))
68
+ return v.map(sorted);
69
+ if (v === null || typeof v !== 'object')
70
+ return v;
71
+ const out = {};
72
+ for (const key of Object.keys(v).sort())
73
+ out[key] = sorted(v[key]);
74
+ return out;
75
+ };
76
+ return JSON.stringify(sorted(value)) ?? 'null';
77
+ }
78
+ /** `value` with each `{ file }` whose source `paths` knows naming the release's copy instead. */
79
+ function withReleaseFiles(value, paths) {
80
+ if (Array.isArray(value))
81
+ return value.map((v) => withReleaseFiles(v, paths));
82
+ if (value === null || typeof value !== 'object' || value instanceof URL || value instanceof Date)
83
+ return value;
84
+ const out = {};
85
+ for (const [key, v] of Object.entries(value)) {
86
+ const source = key === 'file' ? (v instanceof URL ? v.href : typeof v === 'string' ? v : null) : null;
87
+ const path = source === null ? undefined : paths.get(source);
88
+ out[key] = path ?? withReleaseFiles(v, paths);
89
+ }
90
+ return out;
91
+ }
92
+ /**
93
+ * The manifest of the site `registry` describes, without its files: what `packRelease` writes, given the shipped
94
+ * files it packed as `content`. Without `content`, shipped files are read here to name them the way a release
95
+ * would, so a site running from source has a manifest to compare a release with; a file that can't be read is
96
+ * named by its source.
97
+ */
98
+ export function manifestOfRegistry(registry, opts) {
99
+ const paths = new Map();
100
+ if (opts.content) {
101
+ for (const { source, path } of opts.content)
102
+ paths.set(source, path);
103
+ }
104
+ else {
105
+ for (const { source, path } of shippedFiles(registry)) {
106
+ try {
107
+ paths.set(source, contentPath(path, readFileSync(path)));
108
+ }
109
+ catch {
110
+ // Left as its source; applying the content reports it.
111
+ }
112
+ }
113
+ }
114
+ const { site } = registry;
115
+ return {
116
+ format: MANIFEST_FORMAT,
117
+ name: opts.name,
118
+ createdAt: opts.now.toISOString(),
119
+ inlay: { version: inlayVersion(), range: '^' + inlayVersion() },
120
+ secrets: [...site.secrets],
121
+ files: {},
122
+ content: opts.content ?? [],
123
+ schema: typeSchemas(registry),
124
+ shipped: [...registry.content].flatMap(([type, documents]) => documents.map((doc) => ({
125
+ type,
126
+ key: doc.key,
127
+ edition: doc.edition,
128
+ locales: Object.fromEntries(Object.entries(doc.content).map(([locale, input]) => [
129
+ locale,
130
+ sha256Hex(Buffer.from(canonicalJson(withReleaseFiles(input, paths)))),
131
+ ])),
132
+ }))),
133
+ migrations: site.migrations.map((m) => m.name),
134
+ routes: site.routes.map(({ method, path }) => ({ method, path })),
135
+ locales: [...registry.locales],
136
+ types: Object.fromEntries([...registry.types].map(([name, def]) => [name, { kind: def.kind, slots: Object.keys(def.template.slots) }])),
137
+ };
138
+ }
@@ -0,0 +1,20 @@
1
+ import { type ReleaseManifest } from './manifest.js';
2
+ /** Every regular file under `dir`, as `/`-separated paths relative to it. Dotfiles and symlinks are left out. */
3
+ export declare function listFiles(dir: string, skipDotfiles?: boolean): Promise<string[]>;
4
+ /** `<short commit>-<YYYYMMDD>` when `dir` is in a git checkout, else the date. */
5
+ export declare function releaseName(dir: string, now: Date): Promise<string>;
6
+ /**
7
+ * Turns the site at `configFile` into a signed release file at `out`: the bundled site code, the files its
8
+ * shipped content names, the `public/` folder beside the config, and a manifest of them signed with `privateKey`.
9
+ * Never runs the bundle.
10
+ */
11
+ export declare function packRelease(opts: {
12
+ configFile: string;
13
+ privateKey: string;
14
+ out: string;
15
+ name?: string;
16
+ now?: () => Date;
17
+ }): Promise<{
18
+ manifest: ReleaseManifest;
19
+ out: string;
20
+ }>;