inlaycms 0.4.1 → 0.6.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 (151) hide show
  1. package/README.md +18 -709
  2. package/assets/admin/admin.css +1 -1
  3. package/assets/admin/admin.js +1 -1
  4. package/assets/admin/editor.js +63 -46
  5. package/assets/site/consent.js +1 -0
  6. package/dist/adapters/admin/context.d.ts +1 -1
  7. package/dist/adapters/admin/context.js +1 -0
  8. package/dist/adapters/admin/publish.js +2 -2
  9. package/dist/adapters/admin/routes.d.ts +2 -0
  10. package/dist/adapters/admin/routes.js +2 -0
  11. package/dist/adapters/admin/screens/backups.js +2 -2
  12. package/dist/adapters/admin/screens/editor.js +5 -2
  13. package/dist/adapters/admin/screens/integrations.d.ts +4 -0
  14. package/dist/adapters/admin/screens/integrations.js +140 -0
  15. package/dist/adapters/admin/screens/lists.js +2 -1
  16. package/dist/adapters/admin/screens/releases.js +9 -4
  17. package/dist/adapters/admin/views/data-table.js +1 -1
  18. package/dist/adapters/admin/views/layout.d.ts +1 -1
  19. package/dist/adapters/admin/views/layout.js +15 -2
  20. package/dist/adapters/cli/bin.js +8 -3
  21. package/dist/adapters/cli/main.js +12 -2
  22. package/dist/adapters/mcp/agent-refs.d.ts +2 -1
  23. package/dist/adapters/mcp/agent-refs.js +4 -4
  24. package/dist/adapters/mcp/tools/publish.js +1 -1
  25. package/dist/adapters/mcp/tools/read.js +19 -4
  26. package/dist/adapters/mcp/tools/write.js +5 -1
  27. package/dist/adapters/site/cache.d.ts +8 -2
  28. package/dist/adapters/site/cache.js +13 -4
  29. package/dist/adapters/site/code-files.d.ts +44 -0
  30. package/dist/adapters/site/code-files.js +212 -0
  31. package/dist/adapters/site/consent.d.ts +9 -0
  32. package/dist/adapters/site/consent.js +26 -0
  33. package/dist/adapters/site/context.d.ts +9 -1
  34. package/dist/adapters/site/context.js +106 -27
  35. package/dist/adapters/site/csp.d.ts +11 -0
  36. package/dist/adapters/site/csp.js +36 -0
  37. package/dist/adapters/site/head.d.ts +2 -0
  38. package/dist/adapters/site/head.js +7 -20
  39. package/dist/adapters/site/headers.d.ts +5 -2
  40. package/dist/adapters/site/headers.js +13 -6
  41. package/dist/adapters/site/integrations.d.ts +48 -0
  42. package/dist/adapters/site/integrations.js +118 -0
  43. package/dist/adapters/site/media-routes.d.ts +2 -0
  44. package/dist/adapters/site/media-routes.js +2 -1
  45. package/dist/adapters/site/plugin.d.ts +2 -0
  46. package/dist/adapters/site/plugin.js +78 -40
  47. package/dist/adapters/site/preview.d.ts +2 -0
  48. package/dist/adapters/site/preview.js +10 -5
  49. package/dist/adapters/site/render.d.ts +31 -14
  50. package/dist/adapters/site/render.js +33 -7
  51. package/dist/adapters/site/routes.d.ts +3 -0
  52. package/dist/adapters/site/routes.js +11 -6
  53. package/dist/adapters/site/scripts.d.ts +6 -0
  54. package/dist/adapters/site/scripts.js +27 -0
  55. package/dist/adapters/site/sitemap.d.ts +2 -1
  56. package/dist/adapters/site/sitemap.js +3 -3
  57. package/dist/core/auth/roles.d.ts +1 -1
  58. package/dist/core/auth/roles.js +1 -0
  59. package/dist/core/boot.d.ts +2 -0
  60. package/dist/core/boot.js +3 -0
  61. package/dist/core/content/shipped-input.js +1 -2
  62. package/dist/core/content/validate.d.ts +7 -0
  63. package/dist/core/content/validate.js +24 -1
  64. package/dist/core/core.d.ts +29 -0
  65. package/dist/core/core.js +10 -2
  66. package/dist/core/db/migrate.js +2 -0
  67. package/dist/core/db/migrations/0008_integrations.d.ts +3 -0
  68. package/dist/core/db/migrations/0008_integrations.js +11 -0
  69. package/dist/core/db/schema.d.ts +11 -0
  70. package/dist/core/export/export.js +4 -0
  71. package/dist/core/export/format.d.ts +11 -0
  72. package/dist/core/export/format.js +4 -0
  73. package/dist/core/export/import.js +2 -1
  74. package/dist/core/export/replace.d.ts +6 -1
  75. package/dist/core/export/replace.js +4 -1
  76. package/dist/core/export/report.d.ts +6 -0
  77. package/dist/core/export/report.js +7 -0
  78. package/dist/core/fields/builtins.d.ts +4 -0
  79. package/dist/core/fields/builtins.js +11 -1
  80. package/dist/core/fields/widgets.js +5 -1
  81. package/dist/core/integrations/integrations.d.ts +32 -0
  82. package/dist/core/integrations/integrations.js +80 -0
  83. package/dist/core/integrations/warnings.d.ts +4 -0
  84. package/dist/core/integrations/warnings.js +29 -0
  85. package/dist/core/media/store.d.ts +2 -0
  86. package/dist/core/media/store.js +17 -1
  87. package/dist/core/media/variants.d.ts +14 -0
  88. package/dist/core/media/variants.js +54 -0
  89. package/dist/core/messages/en.d.ts +83 -2
  90. package/dist/core/messages/en.js +83 -2
  91. package/dist/core/registry/code-image.d.ts +16 -0
  92. package/dist/core/registry/code-image.js +13 -0
  93. package/dist/core/registry/define.d.ts +12 -0
  94. package/dist/core/registry/define.js +3 -0
  95. package/dist/core/registry/designed.d.ts +6 -0
  96. package/dist/core/registry/designed.js +8 -0
  97. package/dist/core/registry/integration.d.ts +48 -0
  98. package/dist/core/registry/integration.js +29 -0
  99. package/dist/core/registry/js.d.ts +9 -0
  100. package/dist/core/registry/js.js +39 -0
  101. package/dist/core/registry/registry.js +46 -0
  102. package/dist/core/registry/render.d.ts +45 -5
  103. package/dist/core/release/bundle.d.ts +3 -1
  104. package/dist/core/release/bundle.js +169 -11
  105. package/dist/core/release/manifest.d.ts +29 -6
  106. package/dist/core/release/manifest.js +26 -25
  107. package/dist/core/release/pack.js +13 -2
  108. package/dist/core/release/pointer.js +14 -3
  109. package/dist/core/release/read.d.ts +4 -2
  110. package/dist/core/release/read.js +12 -12
  111. package/dist/core/release/window.d.ts +11 -0
  112. package/dist/core/release/window.js +34 -0
  113. package/dist/core/report.d.ts +3 -0
  114. package/dist/core/richtext/headings.d.ts +10 -0
  115. package/dist/core/richtext/headings.js +37 -0
  116. package/dist/core/richtext/html.d.ts +10 -1
  117. package/dist/core/richtext/html.js +17 -6
  118. package/dist/core/richtext/markdown-text.d.ts +24 -0
  119. package/dist/core/richtext/markdown-text.js +38 -0
  120. package/dist/core/richtext/markdown.js +44 -3
  121. package/dist/core/richtext/schema.d.ts +12 -3
  122. package/dist/core/richtext/schema.js +34 -0
  123. package/dist/core/site/live.d.ts +6 -0
  124. package/dist/core/site/live.js +25 -0
  125. package/dist/core/site/paths.d.ts +5 -0
  126. package/dist/core/site/paths.js +32 -0
  127. package/dist/core/site/resolve.js +17 -6
  128. package/dist/core/version.d.ts +4 -0
  129. package/dist/core/version.js +4 -0
  130. package/dist/host/activate.js +2 -1
  131. package/dist/host/app.d.ts +2 -0
  132. package/dist/host/app.js +1 -0
  133. package/dist/host/diff.d.ts +11 -0
  134. package/dist/host/diff.js +40 -0
  135. package/dist/host/ipc.d.ts +2 -0
  136. package/dist/host/ipc.js +5 -1
  137. package/dist/host/preview-worker.js +2 -2
  138. package/dist/host/primary.js +15 -4
  139. package/dist/host/push.d.ts +5 -1
  140. package/dist/host/push.js +18 -6
  141. package/dist/host/serve.js +1 -1
  142. package/dist/host/store.d.ts +1 -2
  143. package/dist/host/store.js +32 -6
  144. package/dist/host/worker.js +9 -3
  145. package/dist/image-modules.d.ts +29 -0
  146. package/dist/image-modules.js +1 -0
  147. package/dist/index.d.ts +7 -1
  148. package/dist/index.js +4 -0
  149. package/dist/site.d.ts +9 -2
  150. package/dist/site.js +5 -0
  151. package/package.json +5 -1
@@ -33,6 +33,7 @@ export const en = {
33
33
  'issue.tooShort': '{field} is too short (at least {min} characters).',
34
34
  'issue.tooMany': '{field} has too many items (at most {max}).',
35
35
  'issue.tooFew': '{field} has too few items (at least {min}).',
36
+ 'issue.pattern': "{field} isn't in the expected format.{hint}",
36
37
  'issue.tooHigh': '{field} must be at most {max}.',
37
38
  'issue.tooLow': '{field} must be at least {min}.',
38
39
  'definition.localeInvalid': 'The locale "{locale}" is not a valid locale code. Use a lowercase language code such as "en", optionally followed by a region such as "pt-BR".',
@@ -57,11 +58,15 @@ export const en = {
57
58
  'config.renderMissing': 'The template "{name}" has no render function, so its pages can\'t be shown. Add a render function to the template.',
58
59
  'config.headJsonLd': "A template added JSON-LD that can't be written as JSON.",
59
60
  'config.headHref': 'A template added a link to "{href}", which isn\'t a safe address. Use a path on this site or an http or https URL.',
61
+ 'config.scriptValue': "A template put a value into a script that can't be written as JSON (value number {position}). Use text, numbers, true or false, null, lists and plain objects.",
62
+ 'config.scriptCode': "A template's script contains </script or <!--, which can't be written safely into a page.",
63
+ 'config.scriptSrc': 'A template added a script from "{src}", which isn\'t allowed. Use an https URL or a path on this site.',
60
64
  'config.publicKey': "That isn't a public key. It should look like ed25519: followed by letters and digits (as printed by inlaycms keygen), but it was: {text}",
61
65
  'config.baseUrl': 'The baseUrl option "{value}" can\'t be used. It must be the full address of the site starting with https:// or http://, with nothing after the domain, such as https://example.com.',
62
66
  'config.secret': 'The secret option must be at least 32 characters long. Use a long random value and keep it private.',
63
67
  'config.adminTheme': 'The admin theme option "{value}" can\'t be used. Use the name of a built-in theme, or colors written as hex values such as #0b5fff.',
64
68
  'config.adminAssetsMissing': 'The admin\'s style and script files are missing from {dir}. Run "pnpm run build:admin" to create them.',
69
+ 'config.siteAssetsMissing': 'The script Inlay adds to pages for visitor consent is missing from {dir}. Run "pnpm run build:admin" to create it.',
65
70
  'config.backupKeep': 'The backupSchedule option keep is "{value}", but it must be a whole number of at least 1, such as 14.',
66
71
  'config.backupsMissing': 'Backups aren\'t set up for this site, so none can be listed or made. Set the backups folder in the site options.',
67
72
  'config.host.dataDir': 'INLAY_DATA_DIR is not set. Set it to the folder where the site keeps its database, media, backups and releases, such as /data.',
@@ -120,6 +125,9 @@ export const en = {
120
125
  'import.siteLock.exportOn': 'This export makes the site private.',
121
126
  'import.siteLock.exportOff': 'This export makes the site public.',
122
127
  'import.siteLock.exportNoPassword': 'This export has no site password.',
128
+ 'import.integrations.replace': 'Integration settings will be replaced: {list}',
129
+ 'import.integrations.on': '{name} (on)',
130
+ 'import.integrations.off': '{name} (off)',
123
131
  'site.notFound.title': 'Page not found',
124
132
  'site.notFound': "We couldn't find the page you were looking for. It may have moved, or the address may be mistyped.",
125
133
  'site.error.title': 'Something went wrong',
@@ -134,6 +142,8 @@ export const en = {
134
142
  'site.lock.wrong': "That password isn't right. Check it and try again.",
135
143
  'site.lock.tooMany': 'Too many tries. Wait a minute and try again.',
136
144
  'log.renderFailed': 'The page {path} could not be shown because of an error.',
145
+ 'log.integrationFailed': 'The integration {name} was left out of a page because of an error.',
146
+ 'log.integrationsUnreadable': 'The integration settings could not be read, so a page was shown without its integrations.',
137
147
  'site.unsupported.title': "This can't be sent here",
138
148
  'site.unsupported': 'This address accepts only plain form fields or JSON. Files and other kinds of data can\'t be sent here.',
139
149
  'site.tooLarge.title': 'Too much to send',
@@ -171,6 +181,16 @@ export const en = {
171
181
  'definition.secretName': 'The site\'s secrets list "{name}" more than once or in the wrong form. Each secret is listed once, in capital letters, digits and underscores starting with a letter, such as SLACK_WEBHOOK.',
172
182
  'definition.headerName': 'The site\'s headers list "{name}", which is not allowed. List each header once, by a name made of letters, digits and hyphens, such as Permissions-Policy. Inlay sets Cache-Control, Content-Type, Set-Cookie, Location, ETag and Vary itself.',
173
183
  'definition.headerValue': 'The site\'s header "{name}" has a value that is not allowed. Give it a single line of text, or false to leave Inlay\'s default out.',
184
+ 'definition.integrationName': 'An integration is named "{name}". Name each integration in lowercase letters and digits, with single hyphens between words, such as tag-manager.',
185
+ 'definition.integrationDuplicate': 'Two integrations are named "{name}". Give each integration its own name.',
186
+ 'definition.integrationField': 'The integration "{name}" has a field "{field}" that integrations can\'t use. Use text, text area, number, yes/no or select fields.',
187
+ 'definition.integrationRender': 'The integration "{name}" has nothing to render. Give it a head, bodyStart or bodyEnd function.',
188
+ 'definition.integrationConsent': 'The integration "{name}" asks for the consent category "{value}". Use analytics, marketing or functional.',
189
+ 'definition.integrationFieldReserved': 'The integration "{name}" has a field called "enabled", a name the admin uses for its on/off switch. Give the field another name.',
190
+ 'definition.cspOwnerSite': 'The site',
191
+ 'definition.cspOwnerIntegration': 'The integration "{name}"',
192
+ 'definition.cspDirective': '{where} lists sources for "{directive}", which can\'t be declared. Use one of: {directives}.',
193
+ 'definition.cspSource': '{where} lists "{source}" under {directive}, which is not a valid source. Use an origin in lowercase with no path, such as https://www.example.com or https://*.example.com, a scheme such as data:, or \'unsafe-inline\' or \'unsafe-eval\' with the quotes.',
174
194
  'definition.migrationName': 'The site\'s migrations use the name "{name}" more than once or leave it empty. Give each migration its own name, such as team-to-people.',
175
195
  'definition.routePath': 'The route path "{path}" must start with "/", have no empty or dot segments, no "/" at the end, and contain no ":", "*", "?", "#" or "%".',
176
196
  'definition.routeReserved': 'The route path "{path}" belongs to Inlay itself (the home page, the admin, sign-in, MCP, media, public files, the sitemap or robots.txt). Pick another path.',
@@ -205,6 +225,7 @@ export const en = {
205
225
  'error.createLocale': 'New entries are created in the default language ({locale}). Add other languages as translations of an entry.',
206
226
  'label.system': 'System',
207
227
  'label.sitePassword': 'Site password',
228
+ 'integrations.unknown': 'This site has no integration called "{name}".',
208
229
  'error.sitePasswordMissing': 'Set a site password before making the site private.',
209
230
  'label.untitled': 'Untitled',
210
231
  'issue.notFound': "{field} points to content that doesn't exist.",
@@ -272,9 +293,27 @@ export const en = {
272
293
  'error.packFile': 'The shipped content names the file {path}, but there is no file there.',
273
294
  'error.markdownImageReference': "{file}, line {line}: this image is written as a reference ([alt][name]), which Inlay can't follow in a Markdown file. Write the image inline instead, such as ![A chart](images/chart.png).",
274
295
  'error.markdownImageUnplaced': "{file}, line {line}: Inlay couldn't work out where this image's file is. Put the image on a line of its own, written simply, such as ![A chart](images/chart.png).",
296
+ 'error.markdownProblem': '{file}: {problem}',
297
+ 'error.markdownImageMissing': '{file}, line {line}: there is no file for the image {src}.',
298
+ 'error.markdownImageOutside': "{file}, line {line}: the image {src} isn't inside the site folder, so a release can't include it.",
299
+ 'error.markdownImageNotImage': "{file}, line {line}: the file for the image {src} isn't a picture Inlay can use.",
300
+ 'error.markdownImageRemote': "{file}, line {line}: the image {src} is on another website, and a release never downloads anything. Download it into the site folder and name it by its path from this file, such as images/chart.png.",
301
+ 'error.markdownImageRooted': '{file}, line {line}: the image {src} starts with "/", which is an address on the site, not a file. Name the file by its path from this file, such as images/chart.png.',
302
+ 'error.markdownImageOther': "{file}, line {line}: the image {src} isn't a file Inlay can find. Name a picture file by its path from this file, such as images/chart.png.",
303
+ 'error.markdownImageSvg': "{file}, line {line}: the image {src} is an SVG file, which Inlay doesn't show. Save it as a PNG or WebP picture instead.",
304
+ 'error.markdownImageExtension': "{file}, line {line}: the name of the image {src} doesn't end in one of {extensions}. Rename the file so its name ends in the one for its kind of picture.",
305
+ 'error.markdownImageMismatch': "{file}, line {line}: the name of the image {src} ends in {ext}, but the file holds another kind of picture. Rename the file so its name ends in the one for its kind of picture.",
306
+ 'error.imageImportOutside': "{file} imports the image {image}, which isn't inside the site folder, so a release can't include it.",
307
+ 'error.imageImportSvg': "{file} imports the image {image}, an SVG file, which Inlay doesn't resize or show as an image. Save it as a PNG or WebP picture instead.",
308
+ 'error.imageImportMismatch': "{file} imports the image {image}, whose name ends in one kind of picture but whose file holds another. Rename the file so its name ends in the one for its kind of picture.",
309
+ 'error.imageImportUnreadable': "{file} imports the image {image}, which can't be read as a picture: the file may be damaged or cut short. Save it again from your image editor.",
310
+ 'error.imageNotImported': "ctx.image was given a value that isn't an image imported through Inlay. Import the picture in the site's own code (import hero from './hero.jpg'), which Inlay bundles, and pass what the import gives.",
311
+ 'error.markdownRender': "This page's Markdown couldn't be shown. {problem}",
312
+ 'error.markdownRenderImage': "This page's Markdown couldn't be shown. Line {line}: the image {src} can't be used. Use an image from the media library, or put the Markdown in a .md file the site imports and name the picture by its path from there.",
275
313
  'error.releaseSignature': "This release isn't signed by a trusted key, so it wasn't opened.",
276
314
  'error.releaseInvalid': "This release file is damaged or wasn't made by inlaycms pack.",
277
- 'error.releaseVersion': 'This release needs Inlay {need} or a later {series} version, but this server runs Inlay {version}.',
315
+ 'error.releaseTooOld': 'This release was packed with Inlay {packed}. Inlay {version} runs releases packed with Inlay {oldest} or later. Pack the site again with this version and push it.',
316
+ 'error.releaseTooNew': 'This release was packed with Inlay {packed}, which is newer than the Inlay {version} on this server. Upgrade Inlay on the server, then push it again.',
278
317
  'error.releaseNoSite': "The site code in this release doesn't export a site as its default export.",
279
318
  'error.releaseDirNotEmpty': 'The folder {dir} to open the release into must be empty.',
280
319
  'error.releaseDirMissing': "The folder {dir} to open the release into doesn't exist.",
@@ -305,6 +344,8 @@ export const en = {
305
344
  'error.pushContentType': 'Send the release file as the request body, with the content type application/gzip.',
306
345
  'error.pushTooLarge': 'This release file is larger than {mb} MB, so it wasn\'t accepted.',
307
346
  'error.pushFailed': 'The release couldn\'t be received: {problem}',
347
+ 'release.packAgain': 'Packed with Inlay {packed}. The next version of Inlay that changes what sites use won\'t run it: pack the site again with this version and push it.',
348
+ 'push.packAgain': 'This release was packed with Inlay {packed}. The next version of Inlay that changes what sites use won\'t run it: pack the site again with this version.',
308
349
  'push.diffUnavailable': "What this release would change in your existing content couldn't be worked out: {reason} The rest of the report is complete.",
309
350
  'error.pushDiffTimeout': 'The preview of the release took more than {seconds} seconds to answer.',
310
351
  'error.pushDiffAnswer': 'The preview of the release answered with an error (status {status}).',
@@ -350,6 +391,11 @@ export const en = {
350
391
  'diff.release.redirectAdded': 'Adds the redirect {from} to {to} ({status}).',
351
392
  'diff.release.redirectRemoved': 'Removes the redirect {from} to {to}.',
352
393
  'diff.release.redirectChanged': 'The redirect from {from} now goes to {to} ({status}).',
394
+ 'diff.release.integrationAdded': 'Adds the integration {name}.',
395
+ 'diff.release.integrationRemoved': 'Removes the integration {name}.',
396
+ 'diff.release.integrationChanged': 'The integration {name} changed.',
397
+ 'diff.release.cspAdded': 'The site may now load from: {source}',
398
+ 'diff.release.cspRemoved': 'The site may no longer load from: {source}',
353
399
  'diff.release.secrets': 'Needs the {count|secret|secrets} {names} set on the server.',
354
400
  'error.previewUnavailable': "The preview of this release couldn't be started. Try again in a moment.",
355
401
  'error.previewNotStaged': "{name} isn't waiting to go live any more (it was made live or deleted), so it can't be previewed.",
@@ -375,6 +421,7 @@ export const en = {
375
421
  'cli.activateNotFound': "There's no release file at {path} and no release with the ID {id}.",
376
422
  'cli.activateName': '--name names a release file as it is stored. Leave it out when activating a stored release by its ID.',
377
423
  'cli.releasesNone': 'There are no releases on this server yet.',
424
+ 'cli.releaseWarning': ' {warning}',
378
425
  'cli.releaseLine': '{id} {name} {state} pushed {pushedAt} made live {activatedAt}',
379
426
  'cli.releaseNeverLive': 'never',
380
427
  'cli.releaseState.staged': 'not live yet',
@@ -429,6 +476,10 @@ export const en = {
429
476
  'report.slugShadowed': '"{title}" ({locale}) has the slug "{slug}", but its page {path} is hidden by a page or path Inlay serves first. Editors can\'t save it until the slug changes.',
430
477
  'report.redirectHidden': 'The redirect from {from} never fires: a published page now answers at that address. That is expected once the page has replaced the old URL, and you can remove the rule from the code when convenient.',
431
478
  'report.redirectLoop': 'The redirect from {from} sends visitors round in a loop together with the other redirects, so the server skips it. Change its target or remove one of the rules.',
479
+ 'report.cspUnsafeInline': "{owner} allows 'unsafe-inline' scripts, which switches off the protection the Content-Security-Policy gives against injected scripts. Use ctx.script or page.script for inline code instead.",
480
+ 'report.cspUnsafeEval': "{owner} allows 'unsafe-eval' scripts, which lets text be run as code and weakens the Content-Security-Policy. Remove it if the script works without.",
481
+ 'report.cspScriptScheme': "{owner} allows scripts from any {source} address, which switches off the protection the Content-Security-Policy gives against injected scripts. List the exact sites the scripts come from instead, such as https://tags.example.",
482
+ 'report.cspOverridden': "The site sets its own content-security-policy header, so the sources that integrations declare are not added to it. Remove the header, or list the sources in it yourself.",
432
483
  'richtext.unsupported': "Line {line}: rich text can't contain {feature}. Remove it, or write it as normal text instead.",
433
484
  'richtext.notAllowed': "Line {line}: this field can't contain {feature}. Remove it, or write it as normal text instead.",
434
485
  'richtext.headingLevel': "Line {line}: this field can't contain a level {level} heading (one with {level} # signs). Use one of these levels instead: {levels}.",
@@ -436,6 +487,9 @@ export const en = {
436
487
  'richtext.tableNested': "Line {line}: tables can't go inside a list or a quote. Move the table out so it stands on its own.",
437
488
  'richtext.tableCell': "Line {line}: table cells can't contain {feature}. Keep each cell to text, bold, italic, code and links.",
438
489
  'richtext.codeEmphasis': "Line {line}: code can't be bold or italic. Move the code (the text between backticks) out of the bold or italic text.",
490
+ 'richtext.codeLanguage': 'Line {line}: "{language}" can\'t be used as the language of a code block. Write only the language\'s name after the opening backticks or tildes, like ```ts, or leave it out.',
491
+ 'richtext.unclosedCode': 'Line {line}: this code block is never closed. Put the same line of backticks (or tildes) that opens it after the code to end it.',
492
+ 'richtext.indentedCode': 'Line {line}: this text is indented by four or more spaces, which makes it a code block. Put a line of three backticks (```) before and after it to keep it as code, or remove the indent.',
439
493
  'richtext.imageSource': 'Line {line}: images must come from the media library, not from another address ("{src}"). Upload the image to the media library and use that instead.',
440
494
  'richtext.linkUrl': 'Line {line}: the link address "{href}" can\'t be used. Links must start with https://, http://, mailto:, tel: or /, or point to a page of this site.',
441
495
  'richtext.title': "Line {line}: {feature} can't have a title (the text in quotes after the address). Remove the title.",
@@ -532,6 +586,7 @@ export const en = {
532
586
  'admin.nav.users': 'Users',
533
587
  'admin.nav.backups': 'Backups & export',
534
588
  'admin.nav.security': 'Security',
589
+ 'admin.nav.integrations': 'Integrations',
535
590
  'admin.nav.account': 'Your account',
536
591
  'admin.nav.content': 'Content',
537
592
  'admin.nav.blocks': 'Building blocks',
@@ -562,6 +617,7 @@ export const en = {
562
617
  'admin.error.tooLarge': 'What you sent is too large for the site to accept. Go back, make it smaller (for example, fewer or smaller images, or less text), and try again.',
563
618
  'admin.error.badRequest.title': "This couldn't be sent",
564
619
  'admin.error.badRequest': "The site couldn't read what your browser sent. Go back, reload the page and try again.",
620
+ 'admin.notice.dismiss': 'Dismiss',
565
621
  'admin.notice.saved': 'Your changes are saved.',
566
622
  'admin.notice.unchanged': 'Nothing had changed, so there was nothing to save.',
567
623
  'admin.notice.created': 'Created.',
@@ -576,6 +632,20 @@ export const en = {
576
632
  'admin.notice.siteLocked': 'Your site is now private.',
577
633
  'admin.notice.siteUnlocked': 'Your site is now public.',
578
634
  'admin.notice.sitePasswordSaved': 'The site password is saved.',
635
+ 'admin.notice.integrationSaved': 'The integration is saved.',
636
+ 'admin.integrations.title': 'Integrations',
637
+ 'admin.integrations.description': "Scripts your site's developer has set up. Switch one on and fill in its details.",
638
+ 'admin.integrations.public': "What you enter here is visible in your pages' source.",
639
+ 'admin.integrations.on': 'Switched on',
640
+ 'admin.integrations.consent': 'Waits for visitors to agree to: {category}',
641
+ 'admin.integrations.always': 'Loads for every visitor',
642
+ 'admin.integrations.preview': 'Also runs in preview',
643
+ 'admin.integrations.unsafeInline': "This switches off part of your site's script protection.",
644
+ 'admin.integrations.notRunning': "This is switched on but isn't running, because its details no longer fit what the site expects. Check the details below and save again.",
645
+ 'admin.integrations.save': 'Save',
646
+ 'admin.integrations.category.analytics': 'analytics',
647
+ 'admin.integrations.category.marketing': 'marketing',
648
+ 'admin.integrations.category.functional': 'functional',
579
649
  'admin.security.title': 'Security',
580
650
  'admin.security.description': 'Choose whether people need a password to see your site.',
581
651
  'admin.security.statusOn': 'Your site is private. Visitors need the password to see it.',
@@ -624,6 +694,7 @@ export const en = {
624
694
  'admin.import.damaged': 'Damaged media files',
625
695
  'admin.import.shippedTitle': 'Shipped content that will be added or updated',
626
696
  'admin.import.siteLockTitle': 'Site password',
697
+ 'admin.import.integrationsTitle': 'Integrations',
627
698
  'admin.import.replaceWarning': 'Restoring replaces all of the site\'s content and media with what is in this export. A backup of the current content is made first. Users and their passwords stay as they are.',
628
699
  'admin.import.restore': 'Restore content',
629
700
  'admin.import.cannotRestore': 'This export can\'t be restored. Ask whoever looks after the server for help.',
@@ -636,6 +707,7 @@ export const en = {
636
707
  'admin.notice.releaseDeleted': 'The release is deleted.',
637
708
  'admin.releases.title': 'Releases',
638
709
  'admin.releases.intro': 'A release is a version of the site\'s design and code. Upload or push a new one, check what it changes, then activate it to make it live.',
710
+ 'admin.releases.packAgainBadge': 'Pack again',
639
711
  'admin.releases.table': 'Releases',
640
712
  'admin.releases.empty': 'No releases yet. Push one from the command line or upload a release file.',
641
713
  'admin.releases.name': 'Name',
@@ -892,6 +964,7 @@ export const en = {
892
964
  'admin.gaps.intro': "A site update requires information that some published content doesn't have yet.",
893
965
  'admin.gaps.summary': '{label}: {count} published {count|item needs|items need} attention',
894
966
  'admin.gaps.badge': 'Needs attention',
967
+ 'admin.list.designedInCode': 'Designed in code',
895
968
  'admin.gaps.editor': 'This is live with {count} required {count|field|fields} left empty: {labels}. Fill {count|it|them} in and publish again.',
896
969
  'admin.activity.today': 'Today',
897
970
  'admin.activity.yesterday': 'Yesterday',
@@ -1034,6 +1107,7 @@ export const en = {
1034
1107
  'admin.history.backToEditor': 'Back to the page',
1035
1108
  'admin.editor.unpublish': 'Unpublish',
1036
1109
  'admin.editor.unsaved': 'Your changes are not saved yet. Choose Save when you are done.',
1110
+ 'admin.editor.designedInCode': "This page is designed in code: its words and layout are part of the site's design, so there is nothing to edit here. To change them, ask your developer.",
1037
1111
  'admin.editor.problems': 'Your changes are not saved yet. Fix the problems marked below, then save again.',
1038
1112
  'admin.editor.badBase': "This form is out of date, so your changes weren't saved. Copy anything you typed that you want to keep, then open the page again.",
1039
1113
  'admin.editor.conflict': '{name} ({source}) saved changes to this page while you were editing, so your changes are not saved yet. To keep their changes, copy what you typed, then open the page again. To replace their changes with yours, choose "Save over their changes".',
@@ -1063,6 +1137,10 @@ export const en = {
1063
1137
  'admin.richtext.bulletList': 'Bulleted list',
1064
1138
  'admin.richtext.orderedList': 'Numbered list',
1065
1139
  'admin.richtext.blockquote': 'Quote',
1140
+ 'admin.richtext.codeBlock': 'Code block',
1141
+ 'admin.richtext.codeLanguage': 'Code language',
1142
+ 'admin.richtext.codeLanguageHint': 'Language, for example ts',
1143
+ 'admin.richtext.codeLanguageInvalid': 'Use only letters, digits and + # _ . - (up to 32), with no spaces.',
1066
1144
  'admin.richtext.image': 'Image',
1067
1145
  'admin.richtext.hardBreak': 'Line break',
1068
1146
  'admin.richtext.table': 'Insert table',
@@ -1240,6 +1318,7 @@ export const en = {
1240
1318
  'mcp.change.required': "{field} is required, so it can't be removed. Give it a new value instead.",
1241
1319
  'mcp.change.neither': 'This change has no value. Give a value to set the field, or remove: true to remove it.',
1242
1320
  'mcp.tool.update_document.title': 'Change a page or entry',
1321
+ 'mcp.designedInCode': "This page is designed in code: its words and layout are written into the site's template, so it has nothing to edit. Tell the person to ask their developer to change it.",
1243
1322
  'mcp.tool.update_document.description': "Changes fields of one page, entry or global in one language, saved as a draft that visitors don't see until it is published. Give its document id and the revisionId you got from get_document as baseRevisionId. Each change sets the value at a dotted path (such as slots.hero.data.headline or fields.faq.0.question), in the same form get_document returns, or removes an optional field with remove: true. If anything is wrong, nothing is saved. Returns the new revisionId, the changes in plain words, and a preview link to give the user.",
1244
1323
  'mcp.tool.create_entry.title': 'Add an entry',
1245
1324
  'mcp.tool.create_entry.description': "Adds a new entry to a collection, as an unpublished draft. Give the collection's name from describe_site and the content in the form get_document returns (read describe_type first). Leave out the slug to make one from the title. Entries are created in the main language; add other languages with create_translation. Returns the new entry's id and groupId, and a preview link to give the user.",
@@ -1338,7 +1417,9 @@ export const en = {
1338
1417
  'host.workerGaveUp': 'The site kept stopping, so visitors now see the "temporarily unavailable" page. The admin still works. Look at the messages above for the cause, then make a release live again or restart the server.',
1339
1418
  'host.noSiteFailed': 'Even the page shown while the site is down kept stopping, so the server has stopped. Look at the messages above for the cause.',
1340
1419
  'host.releaseMissing': 'The live release {name} is missing from this server, so visitors see the "temporarily unavailable" page. Make it live again with inlaycms activate <file> to bring the site back.',
1341
- 'host.releaseVersion': 'The live release {name} needs Inlay {need} or a later {series} version, but this server runs Inlay {version}, so visitors see the "temporarily unavailable" page. Run a matching version of Inlay, or make another release live.',
1420
+ 'host.releaseTooOld': 'The live release {name} was packed with Inlay {packed}, and Inlay {version} runs releases packed with Inlay {oldest} or later, so visitors see the "temporarily unavailable" page. Pack the site again with this version and push it, or make another release live.',
1421
+ 'host.releasePackAgain': 'The live release {name} was packed with Inlay {packed}. The next version of Inlay that changes what sites use won\'t run it: pack the site again with this version and push it.',
1422
+ 'host.releaseTooNew': 'The live release {name} was packed with Inlay {packed}, which is newer than the Inlay {version} on this server, so visitors see the "temporarily unavailable" page. Upgrade Inlay on the server, or make another release live.',
1342
1423
  'host.servingUnavailable': 'The site is running at {url}, but visitors see the "temporarily unavailable" page until the problem above is fixed.',
1343
1424
  'host.pointerRepaired': 'The note of which release is live was out of date. It now names {name} again, as the database does.',
1344
1425
  'host.pointerUnreadable': "The note of which release is live couldn't be read: {problem}",
@@ -0,0 +1,16 @@
1
+ /**
2
+ * An image site code imports (`import hero from './hero.jpg'`), measured when the site is bundled: `source` is the
3
+ * file's `file:` URL, `sha` the sha256 hex of its bytes, `ext` its lowercase extension, and `width` and `height` its
4
+ * displayed size in pixels (after EXIF rotation).
5
+ */
6
+ export interface CodeImage {
7
+ readonly kind: 'codeImage';
8
+ source: string;
9
+ sha: string;
10
+ ext: string;
11
+ mime: string;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ /** True if `v` has the shape of a `CodeImage`. */
16
+ export declare function isCodeImage(v: unknown): v is CodeImage;
@@ -0,0 +1,13 @@
1
+ /** True if `v` has the shape of a `CodeImage`. */
2
+ export function isCodeImage(v) {
3
+ if (typeof v !== 'object' || v === null)
4
+ return false;
5
+ const o = v;
6
+ return (o.kind === 'codeImage' &&
7
+ typeof o.source === 'string' &&
8
+ typeof o.sha === 'string' &&
9
+ typeof o.ext === 'string' &&
10
+ typeof o.mime === 'string' &&
11
+ typeof o.width === 'number' &&
12
+ typeof o.height === 'number');
13
+ }
@@ -1,10 +1,13 @@
1
1
  import type { z } from 'zod';
2
2
  import type { Renderable, SafeHtml } from '../../jsx/html.js';
3
3
  import type { AdminTheme } from '../types.js';
4
+ import type { CspSources, IntegrationDef } from './integration.js';
4
5
  import type { ShippedContent } from './content.js';
5
6
  import type { ReleaseMigration } from './migration.js';
6
7
  import type { PageInfo, RenderContext } from './render.js';
7
8
  import type { RouteDef } from './route.js';
9
+ import type { TrailingSlash } from '../site/paths.js';
10
+ export type { TrailingSlash };
8
11
  export interface BlockDef<S extends z.ZodObject = z.ZodObject> {
9
12
  kind: 'block';
10
13
  name: string;
@@ -139,6 +142,8 @@ export interface SiteDefinition {
139
142
  globals: GlobalDef[];
140
143
  /** Serve the default-locale page when a translation is missing (default `true`). */
141
144
  translationFallback: boolean;
145
+ /** `'always'` serves and writes page URLs with a trailing slash (default `'never'`). */
146
+ trailingSlash: TrailingSlash;
142
147
  /** Content shipped with the site, activated by editions. */
143
148
  content: ShippedContent[];
144
149
  guide?: string;
@@ -156,6 +161,10 @@ export interface SiteDefinition {
156
161
  * sets itself (the admin's CSP, a route's own) wins over both.
157
162
  */
158
163
  headers: Record<string, string | false>;
164
+ /** Third-party scripts the owner can switch on in the admin. */
165
+ integrations: IntegrationDef[];
166
+ /** Sources the site's own code needs in the Content-Security-Policy, by directive. */
167
+ csp: CspSources;
159
168
  routes: RouteDef[];
160
169
  /** Redirects shipped with the site's code. */
161
170
  redirects: RedirectDef[];
@@ -170,6 +179,7 @@ export interface SiteInput {
170
179
  collections?: CollectionDef[];
171
180
  globals?: GlobalDef[];
172
181
  translationFallback?: boolean;
182
+ trailingSlash?: TrailingSlash;
173
183
  content?: ShippedContent[];
174
184
  guide?: string;
175
185
  admin?: AdminSettings;
@@ -178,6 +188,8 @@ export interface SiteInput {
178
188
  publicPaths?: string[];
179
189
  secrets?: string[];
180
190
  headers?: Record<string, string | false>;
191
+ integrations?: IntegrationDef[];
192
+ csp?: CspSources;
181
193
  routes?: RouteDef[];
182
194
  redirects?: RedirectDef[];
183
195
  migrations?: ReleaseMigration[];
@@ -30,6 +30,7 @@ export function defineSite(def) {
30
30
  collections: def.collections ?? [],
31
31
  globals: def.globals ?? [],
32
32
  translationFallback: def.translationFallback ?? true,
33
+ trailingSlash: def.trailingSlash ?? 'never',
33
34
  content: def.content ?? [],
34
35
  admin: def.admin ?? {},
35
36
  seo: def.seo ?? {},
@@ -37,6 +38,8 @@ export function defineSite(def) {
37
38
  publicPaths: def.publicPaths ?? [],
38
39
  secrets: def.secrets ?? [],
39
40
  headers: def.headers ?? {},
41
+ integrations: def.integrations ?? [],
42
+ csp: def.csp ?? {},
40
43
  routes: def.routes ?? [],
41
44
  redirects: def.redirects ?? [],
42
45
  migrations: def.migrations ?? [],
@@ -0,0 +1,6 @@
1
+ import type { TemplateDef } from './define.js';
2
+ /**
3
+ * True when `template` has no fields and no slots: a page designed in code, whose words are all in the template.
4
+ * The admin and MCP say so instead of offering an empty form.
5
+ */
6
+ export declare function designedInCode(template: TemplateDef): boolean;
@@ -0,0 +1,8 @@
1
+ import { defOf } from '../fields/zod-internals.js';
2
+ /**
3
+ * True when `template` has no fields and no slots: a page designed in code, whose words are all in the template.
4
+ * The admin and MCP say so instead of offering an empty form.
5
+ */
6
+ export function designedInCode(template) {
7
+ return Object.keys(defOf(template.fields).shape ?? {}).length === 0 && Object.keys(template.slots).length === 0;
8
+ }
@@ -0,0 +1,48 @@
1
+ import type { z } from 'zod';
2
+ import type { Renderable } from '../../jsx/html.js';
3
+ import type { ScriptApi } from './render.js';
4
+ export declare const CONSENT_CATEGORIES: readonly ['analytics', 'marketing', 'functional'];
5
+ export type ConsentCategory = (typeof CONSENT_CATEGORIES)[number];
6
+ export declare const CSP_DIRECTIVES: readonly ['script-src', 'style-src', 'img-src', 'font-src', 'connect-src', 'frame-src', 'media-src', 'form-action', 'worker-src'];
7
+ export type CspDirective = (typeof CSP_DIRECTIVES)[number];
8
+ /** Sources a site or integration adds to the Content-Security-Policy, by directive. */
9
+ export type CspSources = Partial<Record<CspDirective, readonly string[]>>;
10
+ export interface IntegrationPage {
11
+ path: string;
12
+ locale: string;
13
+ preview: boolean;
14
+ /** Writes an inline script the page's Content-Security-Policy allows. */
15
+ script: ScriptApi;
16
+ }
17
+ export type IntegrationRender<V> = (values: V, page: IntegrationPage) => Renderable;
18
+ export interface IntegrationDef<T extends z.ZodObject = z.ZodObject> {
19
+ kind: 'integration';
20
+ name: string;
21
+ label: string;
22
+ description?: string;
23
+ /** What the owner fills in; `z.object({})` when the integration has none. */
24
+ fields: T;
25
+ /** When set, the integration's output stays inert until the visitor agrees to this category. */
26
+ consent?: ConsentCategory;
27
+ /** Also render in the admin's preview (default `false`). */
28
+ preview: boolean;
29
+ csp: CspSources;
30
+ head?: IntegrationRender<z.output<T>>;
31
+ bodyStart?: IntegrationRender<z.output<T>>;
32
+ bodyEnd?: IntegrationRender<z.output<T>>;
33
+ }
34
+ export interface IntegrationInput<T extends z.ZodObject> {
35
+ name: string;
36
+ label: string;
37
+ description?: string;
38
+ fields?: T;
39
+ consent?: ConsentCategory;
40
+ preview?: boolean;
41
+ csp?: CspSources;
42
+ head?: IntegrationRender<z.output<T>>;
43
+ bodyStart?: IntegrationRender<z.output<T>>;
44
+ bodyEnd?: IntegrationRender<z.output<T>>;
45
+ }
46
+ export declare function defineIntegration<T extends z.ZodObject = z.ZodObject>(def: IntegrationInput<T>): IntegrationDef<T>;
47
+ /** True for a Content-Security-Policy source Inlay accepts: a keyword, a bare scheme or an origin. */
48
+ export declare function isCspSource(source: string): boolean;
@@ -0,0 +1,29 @@
1
+ import { z as zod } from 'zod';
2
+ export const CONSENT_CATEGORIES = ['analytics', 'marketing', 'functional'];
3
+ export const CSP_DIRECTIVES = [
4
+ 'script-src',
5
+ 'style-src',
6
+ 'img-src',
7
+ 'font-src',
8
+ 'connect-src',
9
+ 'frame-src',
10
+ 'media-src',
11
+ 'form-action',
12
+ 'worker-src',
13
+ ];
14
+ export function defineIntegration(def) {
15
+ return {
16
+ ...def,
17
+ kind: 'integration',
18
+ fields: def.fields ?? zod.object({}),
19
+ preview: def.preview ?? false,
20
+ csp: def.csp ?? {},
21
+ };
22
+ }
23
+ const KEYWORDS = new Set(["'unsafe-inline'", "'unsafe-eval'", "'wasm-unsafe-eval'"]);
24
+ const SCHEME = /^[a-z][a-z0-9+.-]*:$/;
25
+ const ORIGIN = /^(https?|wss?):\/\/(\*\.)?[a-z0-9-]+(\.[a-z0-9-]+)*(:\d+)?$/;
26
+ /** True for a Content-Security-Policy source Inlay accepts: a keyword, a bare scheme or an origin. */
27
+ export function isCspSource(source) {
28
+ return typeof source === 'string' && (KEYWORDS.has(source) || SCHEME.test(source) || ORIGIN.test(source));
29
+ }
@@ -0,0 +1,9 @@
1
+ /** `value` as JSON that can't end its `<script>` or open an HTML comment in it. */
2
+ export declare function scriptJson(value: unknown): string;
3
+ /** Script code written with `js`, safe to put between `<script>` and `</script>`. */
4
+ export declare class JsCode {
5
+ readonly code: string;
6
+ constructor(code: string);
7
+ }
8
+ /** A template tag for script code: each value is written as JSON, so it stays data whatever it contains. */
9
+ export declare function js(strings: TemplateStringsArray, ...values: unknown[]): JsCode;
@@ -0,0 +1,39 @@
1
+ import { InlayError } from '../errors.js';
2
+ const SCRIPT_UNSAFE = {
3
+ '<': '\\u003c',
4
+ '>': '\\u003e',
5
+ '&': '\\u0026',
6
+ '\u2028': '\\u2028',
7
+ '\u2029': '\\u2029',
8
+ };
9
+ /** `value` as JSON that can't end its `<script>` or open an HTML comment in it. */
10
+ export function scriptJson(value) {
11
+ const json = JSON.stringify(value);
12
+ if (json === undefined)
13
+ throw new InlayError('config', 'config.headJsonLd');
14
+ return json.replace(/[<>&\u2028\u2029]/g, (c) => SCRIPT_UNSAFE[c]);
15
+ }
16
+ /** Script code written with `js`, safe to put between `<script>` and `</script>`. */
17
+ export class JsCode {
18
+ code;
19
+ constructor(code) {
20
+ this.code = code;
21
+ }
22
+ }
23
+ /** A template tag for script code: each value is written as JSON, so it stays data whatever it contains. */
24
+ export function js(strings, ...values) {
25
+ let code = strings[0] ?? '';
26
+ values.forEach((value, i) => {
27
+ let json;
28
+ try {
29
+ json = JSON.stringify(value);
30
+ }
31
+ catch {
32
+ json = undefined;
33
+ }
34
+ if (json === undefined)
35
+ throw new InlayError('config', 'config.scriptValue', { position: i + 1 });
36
+ code += scriptJson(value) + (strings[i + 1] ?? '');
37
+ });
38
+ return new JsCode(code);
39
+ }
@@ -3,9 +3,11 @@ import { InlayError } from '../errors.js';
3
3
  import { isTitleTemplate } from '../fields/builtins.js';
4
4
  import { fieldMeta } from '../fields/define.js';
5
5
  import { defOf, unwrap } from '../fields/zod-internals.js';
6
+ import { t } from '../messages/index.js';
6
7
  import { isReserved, normalizePath, routeRegExp, singletonPath, withLocale } from '../site/paths.js';
7
8
  import { paramNames, ruleIndex } from '../redirects/collapse.js';
8
9
  import { cleanPath, defaultLocalePrefix, externalTarget, redirectFrom } from '../redirects/rule.js';
10
+ import { CONSENT_CATEGORIES, CSP_DIRECTIVES, isCspSource } from './integration.js';
9
11
  import { KEY_PATTERN } from './content.js';
10
12
  const LOCALE = /^[a-z]{2,3}(-[A-Za-z0-9]+)*$/;
11
13
  const NAME = /^[a-z][A-Za-z0-9_]*$/;
@@ -148,6 +150,49 @@ function checkSettings(site, types) {
148
150
  migrations.add(name);
149
151
  }
150
152
  }
153
+ const INTEGRATION_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
154
+ const INTEGRATION_FIELD_KINDS = new Set(['text', 'textarea', 'number', 'boolean', 'select']);
155
+ function checkCsp(sources, where) {
156
+ if (sources === null || typeof sources !== 'object')
157
+ return;
158
+ for (const [directive, list] of Object.entries(sources)) {
159
+ if (!CSP_DIRECTIVES.includes(directive)) {
160
+ fail('definition.cspDirective', { where, directive, directives: CSP_DIRECTIVES.join(', ') });
161
+ }
162
+ if (!Array.isArray(list))
163
+ fail('definition.cspSource', { where, directive, source: String(list) });
164
+ for (const source of list) {
165
+ if (typeof source !== 'string' || !isCspSource(source))
166
+ fail('definition.cspSource', { where, directive, source: String(source) });
167
+ }
168
+ }
169
+ }
170
+ function checkIntegrations(site) {
171
+ const names = new Set();
172
+ for (const integration of site.integrations) {
173
+ const name = String(integration.name);
174
+ if (!INTEGRATION_NAME.test(name))
175
+ fail('definition.integrationName', { name });
176
+ if (names.has(name))
177
+ fail('definition.integrationDuplicate', { name });
178
+ names.add(name);
179
+ for (const [key, schema] of Object.entries(integration.fields.shape)) {
180
+ if (key === 'enabled')
181
+ fail('definition.integrationFieldReserved', { name });
182
+ const kind = fieldMeta(schema)?.kind;
183
+ if (!NAME.test(key) || kind === undefined || !INTEGRATION_FIELD_KINDS.has(kind)) {
184
+ fail('definition.integrationField', { name, field: key });
185
+ }
186
+ }
187
+ if (!integration.head && !integration.bodyStart && !integration.bodyEnd)
188
+ fail('definition.integrationRender', { name });
189
+ if (integration.consent !== undefined && !CONSENT_CATEGORIES.includes(integration.consent)) {
190
+ fail('definition.integrationConsent', { name, value: String(integration.consent) });
191
+ }
192
+ checkCsp(integration.csp, t('definition.cspOwnerIntegration', { name }));
193
+ }
194
+ checkCsp(site.csp, t('definition.cspOwnerSite'));
195
+ }
151
196
  /** Paths a route can't take: Inlay's reserved paths and the home page. */
152
197
  const isRouteReserved = (path) => path === '/' || isReserved(path);
153
198
  /** The type whose pages `path` would hide, in any locale, with or without its locale prefix. */
@@ -359,5 +404,6 @@ export function buildRegistry(site) {
359
404
  },
360
405
  };
361
406
  checkRoutes(registry);
407
+ checkIntegrations(site);
362
408
  return registry;
363
409
  }