@decocms/blocks 8.9.1 → 8.11.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 (409) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/protocol/channel.d.ts +98 -0
  6. package/dist/protocol/channel.d.ts.map +1 -0
  7. package/dist/protocol/channel.js +58 -0
  8. package/dist/protocol/channel.js.map +1 -0
  9. package/dist/protocol/client.js +2 -2
  10. package/dist/protocol/client.js.map +1 -1
  11. package/dist/protocol/conformance/blockMetaVectors.json +214 -0
  12. package/dist/protocol/conformance/contentHashFixtures.d.ts +22 -0
  13. package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -1
  14. package/dist/protocol/conformance/contentHashFixtures.js +55 -0
  15. package/dist/protocol/conformance/contentHashFixtures.js.map +1 -1
  16. package/dist/protocol/conformance/index.d.ts +2 -1
  17. package/dist/protocol/conformance/index.d.ts.map +1 -1
  18. package/dist/protocol/conformance/index.js +2 -1
  19. package/dist/protocol/conformance/index.js.map +1 -1
  20. package/dist/protocol/conformance/vectors.d.ts +33 -0
  21. package/dist/protocol/conformance/vectors.d.ts.map +1 -0
  22. package/dist/protocol/conformance/vectors.js +3 -0
  23. package/dist/protocol/conformance/vectors.js.map +1 -0
  24. package/dist/protocol/index.d.ts +11 -1
  25. package/dist/protocol/index.d.ts.map +1 -1
  26. package/dist/protocol/index.js +11 -1
  27. package/dist/protocol/index.js.map +1 -1
  28. package/dist/protocol/keys.d.ts +1 -1
  29. package/dist/protocol/keys.js +1 -1
  30. package/dist/v8/background.d.ts +13 -0
  31. package/dist/v8/background.d.ts.map +1 -1
  32. package/dist/v8/background.js +41 -0
  33. package/dist/v8/background.js.map +1 -1
  34. package/dist/v8/blockMeta.d.ts +27 -0
  35. package/dist/v8/blockMeta.d.ts.map +1 -0
  36. package/dist/v8/blockMeta.js +75 -0
  37. package/dist/v8/blockMeta.js.map +1 -0
  38. package/dist/v8/blockStore.d.ts +43 -0
  39. package/dist/v8/blockStore.d.ts.map +1 -0
  40. package/dist/v8/blockStore.js +95 -0
  41. package/dist/v8/blockStore.js.map +1 -0
  42. package/dist/v8/boundedJson.d.ts +5 -0
  43. package/dist/v8/boundedJson.d.ts.map +1 -1
  44. package/dist/v8/boundedJson.js +10 -2
  45. package/dist/v8/boundedJson.js.map +1 -1
  46. package/dist/v8/boundedMap.d.ts +19 -0
  47. package/dist/v8/boundedMap.d.ts.map +1 -0
  48. package/dist/v8/boundedMap.js +52 -0
  49. package/dist/v8/boundedMap.js.map +1 -0
  50. package/dist/v8/builtins/data.d.ts +18 -2
  51. package/dist/v8/builtins/data.d.ts.map +1 -1
  52. package/dist/v8/builtins/data.js +17 -1
  53. package/dist/v8/builtins/data.js.map +1 -1
  54. package/dist/v8/builtins/index.d.ts.map +1 -1
  55. package/dist/v8/builtins/index.js +2 -1
  56. package/dist/v8/builtins/index.js.map +1 -1
  57. package/dist/v8/builtins/legacy.d.ts +6 -3
  58. package/dist/v8/builtins/legacy.d.ts.map +1 -1
  59. package/dist/v8/builtins/legacy.js +6 -3
  60. package/dist/v8/builtins/legacy.js.map +1 -1
  61. package/dist/v8/canonical.d.ts +8 -0
  62. package/dist/v8/canonical.d.ts.map +1 -1
  63. package/dist/v8/canonical.js +15 -0
  64. package/dist/v8/canonical.js.map +1 -1
  65. package/dist/v8/cli/builtins.d.ts.map +1 -1
  66. package/dist/v8/cli/builtins.js +1 -0
  67. package/dist/v8/cli/builtins.js.map +1 -1
  68. package/dist/v8/cli/check/index.d.ts +10 -0
  69. package/dist/v8/cli/check/index.d.ts.map +1 -1
  70. package/dist/v8/cli/check/index.js +91 -7
  71. package/dist/v8/cli/check/index.js.map +1 -1
  72. package/dist/v8/cli/content.d.ts +12 -25
  73. package/dist/v8/cli/content.d.ts.map +1 -1
  74. package/dist/v8/cli/content.js +46 -75
  75. package/dist/v8/cli/content.js.map +1 -1
  76. package/dist/v8/cli/index.d.ts +2 -2
  77. package/dist/v8/cli/index.d.ts.map +1 -1
  78. package/dist/v8/cli/index.js +2 -2
  79. package/dist/v8/cli/index.js.map +1 -1
  80. package/dist/v8/cli/remote/commands.d.ts +71 -0
  81. package/dist/v8/cli/remote/commands.d.ts.map +1 -0
  82. package/dist/v8/cli/remote/commands.js +644 -0
  83. package/dist/v8/cli/remote/commands.js.map +1 -0
  84. package/dist/v8/cli/remote/diff.d.ts +15 -0
  85. package/dist/v8/cli/remote/diff.d.ts.map +1 -0
  86. package/dist/v8/cli/remote/diff.js +102 -0
  87. package/dist/v8/cli/remote/diff.js.map +1 -0
  88. package/dist/v8/cli/remote/env.d.ts +35 -0
  89. package/dist/v8/cli/remote/env.d.ts.map +1 -0
  90. package/dist/v8/cli/remote/env.js +84 -0
  91. package/dist/v8/cli/remote/env.js.map +1 -0
  92. package/dist/v8/cli/remote/http.d.ts +149 -0
  93. package/dist/v8/cli/remote/http.d.ts.map +1 -0
  94. package/dist/v8/cli/remote/http.js +381 -0
  95. package/dist/v8/cli/remote/http.js.map +1 -0
  96. package/dist/v8/cli/remote/local.d.ts +90 -0
  97. package/dist/v8/cli/remote/local.d.ts.map +1 -0
  98. package/dist/v8/cli/remote/local.js +309 -0
  99. package/dist/v8/cli/remote/local.js.map +1 -0
  100. package/dist/v8/cli/root.d.ts +29 -0
  101. package/dist/v8/cli/root.d.ts.map +1 -1
  102. package/dist/v8/cli/root.js +28 -0
  103. package/dist/v8/cli/root.js.map +1 -1
  104. package/dist/v8/cli/run.d.ts +13 -1
  105. package/dist/v8/cli/run.d.ts.map +1 -1
  106. package/dist/v8/cli/run.js +310 -124
  107. package/dist/v8/cli/run.js.map +1 -1
  108. package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -1
  109. package/dist/v8/cli/schema/builtinSchemas.js +28 -10
  110. package/dist/v8/cli/schema/builtinSchemas.js.map +1 -1
  111. package/dist/v8/cli/schema/generate.js +1 -1
  112. package/dist/v8/cli/schema/generate.js.map +1 -1
  113. package/dist/v8/cli/skills.d.ts +25 -0
  114. package/dist/v8/cli/skills.d.ts.map +1 -0
  115. package/dist/v8/cli/skills.js +70 -0
  116. package/dist/v8/cli/skills.js.map +1 -0
  117. package/dist/v8/client.d.ts +9 -9
  118. package/dist/v8/client.d.ts.map +1 -1
  119. package/dist/v8/client.js +138 -50
  120. package/dist/v8/client.js.map +1 -1
  121. package/dist/v8/cms.d.ts +2 -1
  122. package/dist/v8/cms.d.ts.map +1 -1
  123. package/dist/v8/cms.js +55 -46
  124. package/dist/v8/cms.js.map +1 -1
  125. package/dist/v8/content.d.ts +39 -78
  126. package/dist/v8/content.d.ts.map +1 -1
  127. package/dist/v8/content.js +155 -195
  128. package/dist/v8/content.js.map +1 -1
  129. package/dist/v8/contentIndex.d.ts +71 -0
  130. package/dist/v8/contentIndex.d.ts.map +1 -0
  131. package/dist/v8/contentIndex.js +137 -0
  132. package/dist/v8/contentIndex.js.map +1 -0
  133. package/dist/v8/draft.d.ts +7 -7
  134. package/dist/v8/draft.d.ts.map +1 -1
  135. package/dist/v8/draft.js +10 -9
  136. package/dist/v8/draft.js.map +1 -1
  137. package/dist/v8/draftChanges.d.ts +59 -32
  138. package/dist/v8/draftChanges.d.ts.map +1 -1
  139. package/dist/v8/draftChanges.js +139 -75
  140. package/dist/v8/draftChanges.js.map +1 -1
  141. package/dist/v8/errors.d.ts +21 -0
  142. package/dist/v8/errors.d.ts.map +1 -1
  143. package/dist/v8/errors.js +22 -0
  144. package/dist/v8/errors.js.map +1 -1
  145. package/dist/v8/hostedSource.d.ts +57 -0
  146. package/dist/v8/hostedSource.d.ts.map +1 -0
  147. package/dist/v8/hostedSource.js +18 -0
  148. package/dist/v8/hostedSource.js.map +1 -0
  149. package/dist/v8/identity.d.ts +1 -1
  150. package/dist/v8/identity.js +1 -1
  151. package/dist/v8/index.d.ts +1 -0
  152. package/dist/v8/index.d.ts.map +1 -1
  153. package/dist/v8/index.js +1 -0
  154. package/dist/v8/index.js.map +1 -1
  155. package/dist/v8/matchRoute.js +7 -4
  156. package/dist/v8/matchRoute.js.map +1 -1
  157. package/dist/v8/pin.d.ts +34 -0
  158. package/dist/v8/pin.d.ts.map +1 -0
  159. package/dist/v8/pin.js +156 -0
  160. package/dist/v8/pin.js.map +1 -0
  161. package/dist/v8/preview/StudioBridge.d.ts +8 -8
  162. package/dist/v8/preview/StudioBridge.d.ts.map +1 -1
  163. package/dist/v8/preview/StudioBridge.js +8 -10
  164. package/dist/v8/preview/StudioBridge.js.map +1 -1
  165. package/dist/v8/preview/StudioChannel.d.ts +51 -0
  166. package/dist/v8/preview/StudioChannel.d.ts.map +1 -0
  167. package/dist/v8/preview/StudioChannel.js +104 -0
  168. package/dist/v8/preview/StudioChannel.js.map +1 -0
  169. package/dist/v8/preview/index.d.ts +3 -0
  170. package/dist/v8/preview/index.d.ts.map +1 -1
  171. package/dist/v8/preview/index.js +3 -0
  172. package/dist/v8/preview/index.js.map +1 -1
  173. package/dist/v8/remoteLoader.d.ts +42 -5
  174. package/dist/v8/remoteLoader.d.ts.map +1 -1
  175. package/dist/v8/remoteLoader.js +317 -259
  176. package/dist/v8/remoteLoader.js.map +1 -1
  177. package/dist/v8/resolver.d.ts +22 -8
  178. package/dist/v8/resolver.d.ts.map +1 -1
  179. package/dist/v8/resolver.js +37 -32
  180. package/dist/v8/resolver.js.map +1 -1
  181. package/dist/v8/revisionId.d.ts +11 -0
  182. package/dist/v8/revisionId.d.ts.map +1 -0
  183. package/dist/v8/revisionId.js +13 -0
  184. package/dist/v8/revisionId.js.map +1 -0
  185. package/dist/v8/settings.d.ts +6 -6
  186. package/dist/v8/settings.d.ts.map +1 -1
  187. package/dist/v8/settings.js +8 -7
  188. package/dist/v8/settings.js.map +1 -1
  189. package/dist/v8/telemetry.d.ts +4 -2
  190. package/dist/v8/telemetry.d.ts.map +1 -1
  191. package/dist/v8/telemetry.js +2 -2
  192. package/dist/v8/telemetry.js.map +1 -1
  193. package/dist/v8/types.d.ts +52 -40
  194. package/dist/v8/types.d.ts.map +1 -1
  195. package/dist/v8/variants.d.ts +7 -2
  196. package/dist/v8/variants.d.ts.map +1 -1
  197. package/dist/v8/variants.js +21 -24
  198. package/dist/v8/variants.js.map +1 -1
  199. package/dist/v8/vite/index.d.ts +2 -2
  200. package/dist/v8/vite/index.js +1 -1
  201. package/dist/v8/vite/index.js.map +1 -1
  202. package/package.json +3 -2
  203. package/skills/deco-apps/SKILL.md +82 -0
  204. package/skills/deco-apps/references/algolia.md +51 -0
  205. package/skills/deco-apps/references/commerce-types.md +132 -0
  206. package/skills/deco-apps/references/instrumented-fetch.md +144 -0
  207. package/skills/deco-apps/references/magento.md +55 -0
  208. package/skills/deco-apps/references/messaging.md +76 -0
  209. package/skills/deco-apps/references/shopify.md +69 -0
  210. package/skills/deco-apps/references/vendored-loaders.md +135 -0
  211. package/skills/deco-apps/references/vtex-cookies-auth.md +146 -0
  212. package/skills/deco-apps/references/vtex.md +150 -0
  213. package/skills/deco-apps/references/wake.md +75 -0
  214. package/skills/deco-cms-schema/SKILL.md +80 -0
  215. package/skills/deco-cms-schema/references/annotations.md +147 -0
  216. package/skills/deco-cms-schema/references/content-hygiene.md +91 -0
  217. package/skills/deco-cms-schema/references/formats-and-widgets.md +112 -0
  218. package/skills/deco-cms-schema/references/shapes-that-break-the-form.md +165 -0
  219. package/skills/deco-cms-schema/references/types-to-fields.md +112 -0
  220. package/skills/deco-go-live/SKILL.md +127 -0
  221. package/skills/deco-go-live/references/content-releases.md +90 -0
  222. package/skills/deco-go-live/references/process.md +106 -0
  223. package/skills/deco-go-live/references/proxy-headers-checkout.md +139 -0
  224. package/skills/deco-go-live/references/qa-checklist-template.md +150 -0
  225. package/skills/deco-go-live/references/qa-inventory.md +120 -0
  226. package/skills/deco-go-live/references/react-spa.md +183 -0
  227. package/skills/deco-go-live/references/seo-analytics.md +114 -0
  228. package/skills/deco-go-live/references/traffic-ramp.md +87 -0
  229. package/skills/deco-go-live/references/worker-runtime.md +93 -0
  230. package/skills/deco-go-live/scripts/preflight.sh +221 -0
  231. package/skills/deco-images-media/SKILL.md +64 -0
  232. package/skills/deco-images-media/references/asset-upload.md +191 -0
  233. package/skills/deco-images-media/references/components-per-binding.md +167 -0
  234. package/skills/deco-images-media/references/providers-and-cdn.md +145 -0
  235. package/skills/deco-images-media/references/quality-and-lcp.md +93 -0
  236. package/skills/deco-images-media/references/troubleshooting.md +147 -0
  237. package/skills/deco-images-media/references/video.md +122 -0
  238. package/skills/deco-make-editable/SKILL.md +94 -0
  239. package/skills/deco-make-editable/references/a11y-and-e2e.md +104 -0
  240. package/skills/deco-make-editable/references/content-shapes.md +198 -0
  241. package/skills/deco-make-editable/references/from-figma.md +110 -0
  242. package/skills/deco-make-editable/references/i18n-fields.md +112 -0
  243. package/skills/deco-make-editable/references/inventory.md +79 -0
  244. package/skills/deco-make-editable/references/pixel-parity.md +175 -0
  245. package/skills/deco-make-editable/references/seeding-content.md +119 -0
  246. package/skills/deco-nextjs-site/SKILL.md +74 -0
  247. package/skills/deco-nextjs-site/references/caching.md +116 -0
  248. package/skills/deco-nextjs-site/references/metadata-seo.md +100 -0
  249. package/skills/deco-nextjs-site/references/proxy-and-drafts.md +177 -0
  250. package/skills/deco-nextjs-site/references/rendering.md +171 -0
  251. package/skills/deco-nextjs-site/references/setup.md +190 -0
  252. package/skills/deco-nextjs-site/references/studio-bridge.md +130 -0
  253. package/skills/deco-site-authoring/SKILL.md +75 -0
  254. package/skills/deco-site-authoring/references/lazy-blocks.md +155 -0
  255. package/skills/deco-site-authoring/references/loaders.md +192 -0
  256. package/skills/deco-site-authoring/references/pages.md +156 -0
  257. package/skills/deco-site-authoring/references/review-before-publish.md +95 -0
  258. package/skills/deco-site-authoring/references/sections.md +158 -0
  259. package/skills/deco-site-authoring/references/seo.md +116 -0
  260. package/skills/deco-site-workflow/SKILL.md +92 -0
  261. package/skills/deco-site-workflow/references/check.md +116 -0
  262. package/skills/deco-site-workflow/references/cli-reference.md +104 -0
  263. package/skills/deco-site-workflow/references/content-layout.md +93 -0
  264. package/skills/deco-site-workflow/references/content-sync.md +146 -0
  265. package/skills/deco-site-workflow/references/delivery.md +51 -0
  266. package/skills/deco-site-workflow/references/deploy.md +87 -0
  267. package/skills/deco-site-workflow/references/schema.md +173 -0
  268. package/skills/deco-site-workflow/references/serve-and-studio.md +138 -0
  269. package/skills/deco-storefront-caching/SKILL.md +67 -0
  270. package/skills/deco-storefront-caching/references/cache-keys.md +129 -0
  271. package/skills/deco-storefront-caching/references/case-study.md +82 -0
  272. package/skills/deco-storefront-caching/references/egress-traps.md +153 -0
  273. package/skills/deco-storefront-caching/references/nextjs.md +60 -0
  274. package/skills/deco-storefront-caching/references/perf-guardrails-e2e.md +123 -0
  275. package/skills/deco-storefront-caching/references/verification.md +136 -0
  276. package/skills/deco-storefront-caching/references/worker-page-cache.md +160 -0
  277. package/skills/deco-storefront-caching/scripts/html-anatomy.mjs +97 -0
  278. package/skills/deco-storefront-performance/SKILL.md +81 -0
  279. package/skills/deco-storefront-performance/references/cls-third-party.md +90 -0
  280. package/skills/deco-storefront-performance/references/hydration.md +116 -0
  281. package/skills/deco-storefront-performance/references/loaders-n-plus-1.md +107 -0
  282. package/skills/deco-storefront-performance/references/navigation-ux.md +130 -0
  283. package/skills/deco-storefront-performance/references/payload-trim.md +163 -0
  284. package/skills/deco-storefront-performance/references/render-location.md +152 -0
  285. package/skills/deco-storefront-performance/references/request-dedupe.md +147 -0
  286. package/skills/deco-storefront-performance/references/trace-reading.md +79 -0
  287. package/skills/deco-storefront-performance/references/worker-memory.md +176 -0
  288. package/skills/deco-tanstack-site/SKILL.md +68 -0
  289. package/skills/deco-tanstack-site/references/document-and-security.md +155 -0
  290. package/skills/deco-tanstack-site/references/router-and-navigation.md +137 -0
  291. package/skills/deco-tanstack-site/references/routes-and-pages.md +183 -0
  292. package/skills/deco-tanstack-site/references/server-functions.md +123 -0
  293. package/skills/deco-tanstack-site/references/setup.md +153 -0
  294. package/skills/deco-tanstack-site/references/worker-entry.md +152 -0
  295. package/skills/deco-v7-to-v8-migration/SKILL.md +122 -0
  296. package/skills/deco-v7-to-v8-migration/references/caching-and-privacy.md +10 -0
  297. package/skills/deco-v7-to-v8-migration/references/content.md +25 -0
  298. package/skills/deco-v7-to-v8-migration/references/editor-forms.md +27 -0
  299. package/skills/deco-v7-to-v8-migration/references/faststore.md +40 -0
  300. package/skills/deco-v7-to-v8-migration/references/framework-code.md +53 -0
  301. package/skills/deco-v7-to-v8-migration/references/hosted-releases.md +16 -0
  302. package/skills/deco-v7-to-v8-migration/references/import-map.md +81 -0
  303. package/skills/deco-v7-to-v8-migration/references/legacy-names.md +33 -0
  304. package/skills/deco-v7-to-v8-migration/references/manual-steps.md +10 -0
  305. package/skills/deco-v7-to-v8-migration/references/native-apps.md +43 -0
  306. package/skills/deco-v7-to-v8-migration/references/nextjs.md +19 -0
  307. package/skills/deco-v7-to-v8-migration/references/parity.md +66 -0
  308. package/skills/deco-v7-to-v8-migration/references/rendering.md +13 -0
  309. package/skills/deco-v7-to-v8-migration/references/running-the-script.md +29 -0
  310. package/skills/deco-v7-to-v8-migration/references/script-steps.md +13 -0
  311. package/skills/deco-v7-to-v8-migration/references/server-functions.md +15 -0
  312. package/skills/deco-v7-to-v8-migration/references/sibling-port.md +11 -0
  313. package/skills/deco-v7-to-v8-migration/references/site-code.md +15 -0
  314. package/skills/deco-v7-to-v8-migration/references/telemetry.md +10 -0
  315. package/skills/deco-v7-to-v8-migration/references/verify.md +20 -0
  316. package/skills/deco-v7-to-v8-migration/scripts/apps.ts +297 -0
  317. package/skills/deco-v7-to-v8-migration/scripts/asyncRendering.ts +73 -0
  318. package/skills/deco-v7-to-v8-migration/scripts/blockMap.ts +584 -0
  319. package/skills/deco-v7-to-v8-migration/scripts/ciSchemaCheck.ts +145 -0
  320. package/skills/deco-v7-to-v8-migration/scripts/compat.ts +357 -0
  321. package/skills/deco-v7-to-v8-migration/scripts/content.ts +121 -0
  322. package/skills/deco-v7-to-v8-migration/scripts/experiments.ts +81 -0
  323. package/skills/deco-v7-to-v8-migration/scripts/framework.ts +61 -0
  324. package/skills/deco-v7-to-v8-migration/scripts/imageCopy.ts +276 -0
  325. package/skills/deco-v7-to-v8-migration/scripts/imageModule.ts +285 -0
  326. package/skills/deco-v7-to-v8-migration/scripts/imports.ts +942 -0
  327. package/skills/deco-v7-to-v8-migration/scripts/invoke.ts +624 -0
  328. package/skills/deco-v7-to-v8-migration/scripts/legacyNames.ts +45 -0
  329. package/skills/deco-v7-to-v8-migration/scripts/main.ts +59 -0
  330. package/skills/deco-v7-to-v8-migration/scripts/matchers.ts +41 -0
  331. package/skills/deco-v7-to-v8-migration/scripts/migrate.ts +176 -0
  332. package/skills/deco-v7-to-v8-migration/scripts/redirects.ts +455 -0
  333. package/skills/deco-v7-to-v8-migration/scripts/report.ts +50 -0
  334. package/skills/deco-v7-to-v8-migration/scripts/scaffold.ts +1119 -0
  335. package/skills/deco-v7-to-v8-migration/scripts/secrets.ts +35 -0
  336. package/skills/deco-v7-to-v8-migration/scripts/sectionLoaders.ts +216 -0
  337. package/skills/deco-v7-to-v8-migration/scripts/siteSettings.ts +261 -0
  338. package/skills/deco-v7-to-v8-migration/scripts/stubs.ts +388 -0
  339. package/skills/deco-v7-to-v8-migration/scripts/tsconfig.json +7 -0
  340. package/skills/deco-v7-to-v8-migration/scripts/vendor.ts +249 -0
  341. package/skills/deco-v7-to-v8-migration/scripts/vtexInvoke.ts +240 -0
  342. package/skills/deco-v7-to-v8-migration/scripts/walk.ts +30 -0
  343. package/skills/deco-variants/SKILL.md +57 -0
  344. package/skills/deco-variants/references/caching-variants.md +63 -0
  345. package/skills/deco-variants/references/custom-matchers.md +83 -0
  346. package/skills/deco-variants/references/draft-preview.md +59 -0
  347. package/skills/deco-variants/references/experiments-and-campaigns.md +104 -0
  348. package/skills/deco-variants/references/multivariate.md +85 -0
  349. package/skills/deco-variants/references/v7-matchers.md +71 -0
  350. package/src/index.ts +2 -0
  351. package/src/protocol/channel.ts +127 -0
  352. package/src/protocol/client.ts +2 -2
  353. package/src/protocol/conformance/blockMetaVectors.json +214 -0
  354. package/src/protocol/conformance/contentHashFixtures.ts +74 -0
  355. package/src/protocol/conformance/index.ts +9 -1
  356. package/src/protocol/conformance/vectors.ts +36 -0
  357. package/src/protocol/index.ts +32 -0
  358. package/src/protocol/keys.ts +1 -1
  359. package/src/v8/background.ts +42 -0
  360. package/src/v8/blockMeta.ts +100 -0
  361. package/src/v8/blockStore.ts +124 -0
  362. package/src/v8/boundedJson.ts +20 -2
  363. package/src/v8/boundedMap.ts +53 -0
  364. package/src/v8/builtins/data.ts +26 -2
  365. package/src/v8/builtins/index.ts +2 -1
  366. package/src/v8/builtins/legacy.ts +6 -3
  367. package/src/v8/canonical.ts +15 -0
  368. package/src/v8/cli/builtins.ts +1 -0
  369. package/src/v8/cli/check/index.ts +97 -7
  370. package/src/v8/cli/content.ts +49 -91
  371. package/src/v8/cli/index.ts +2 -2
  372. package/src/v8/cli/remote/commands.ts +834 -0
  373. package/src/v8/cli/remote/diff.ts +100 -0
  374. package/src/v8/cli/remote/env.ts +107 -0
  375. package/src/v8/cli/remote/http.ts +484 -0
  376. package/src/v8/cli/remote/local.ts +343 -0
  377. package/src/v8/cli/root.ts +40 -0
  378. package/src/v8/cli/run.ts +366 -135
  379. package/src/v8/cli/schema/builtinSchemas.ts +29 -10
  380. package/src/v8/cli/schema/generate.ts +1 -1
  381. package/src/v8/cli/skills.ts +91 -0
  382. package/src/v8/client.ts +162 -60
  383. package/src/v8/cms.ts +62 -53
  384. package/src/v8/content.ts +179 -229
  385. package/src/v8/contentIndex.ts +183 -0
  386. package/src/v8/draft.ts +15 -14
  387. package/src/v8/draftChanges.ts +151 -85
  388. package/src/v8/errors.ts +37 -0
  389. package/src/v8/hostedSource.ts +67 -0
  390. package/src/v8/identity.ts +1 -1
  391. package/src/v8/index.ts +1 -0
  392. package/src/v8/matchRoute.ts +7 -4
  393. package/src/v8/pin.ts +176 -0
  394. package/src/v8/preview/StudioBridge.ts +8 -10
  395. package/src/v8/preview/StudioChannel.ts +116 -0
  396. package/src/v8/preview/index.ts +3 -0
  397. package/src/v8/remoteLoader.ts +350 -286
  398. package/src/v8/resolver.ts +56 -33
  399. package/src/v8/revisionId.ts +14 -0
  400. package/src/v8/settings.ts +10 -9
  401. package/src/v8/telemetry.ts +3 -3
  402. package/src/v8/types.ts +52 -40
  403. package/src/v8/variants.ts +30 -26
  404. package/src/v8/vite/index.ts +3 -3
  405. package/dist/v8/cli/serve/server.d.ts +0 -29
  406. package/dist/v8/cli/serve/server.d.ts.map +0 -1
  407. package/dist/v8/cli/serve/server.js +0 -296
  408. package/dist/v8/cli/serve/server.js.map +0 -1
  409. package/src/v8/cli/serve/server.ts +0 -348
@@ -26,7 +26,7 @@ import {
26
26
  CAMPAIGNS_BLOCK,
27
27
  campaignTime,
28
28
  } from "../../builtins/campaigns.ts";
29
- import { SETTINGS_BLOCK, SETTINGS_TYPE } from "../../builtins/data.ts";
29
+ import { REDIRECTS_TYPE, SETTINGS_BLOCK, SETTINGS_TYPE } from "../../builtins/data.ts";
30
30
  import {
31
31
  EXPERIMENT_RULE,
32
32
  EXPERIMENTS_BLOCK,
@@ -54,6 +54,20 @@ export interface Problem {
54
54
 
55
55
  type Json = any;
56
56
  const DOC_ID = "deco";
57
+ /** The per-rule redirect type: it resolves, but routing reads only the redirects block. */
58
+ const REDIRECT_TYPE = "redirect";
59
+ /**
60
+ * v7's redirect block types, per-rule and list: v8 routes neither (only a
61
+ * block typed `redirects`), so their rules belong in the Redirects block.
62
+ * `website/loaders/redirect.ts` still resolves (an alias of `redirect`);
63
+ * `website/loaders/redirects.ts` has no alias.
64
+ */
65
+ const V7_REDIRECT_TYPES: ReadonlySet<string> = new Set([
66
+ "website/loaders/redirect.ts",
67
+ "website/loaders/redirects.ts",
68
+ ]);
69
+ /** The block routing reads its redirects from, canonically. */
70
+ const REDIRECTS_BLOCK = "Redirects";
57
71
 
58
72
  /** JSON-parsed objects only, so any non-array object is a plain one. */
59
73
  function isObject(value: unknown): value is Record<string, Json> {
@@ -90,6 +104,16 @@ const FOLDED_BUILT_INS: Record<string, string> = {
90
104
  "website/loaders/secret.ts": SECRETS_MOVED,
91
105
  };
92
106
 
107
+ /**
108
+ * A `__resolveType` that names no block type, built-in, alias or saved block:
109
+ * what a delete leaves behind (a section, banner or saved rule), or a block
110
+ * type the site doesn't export. Block types are bare keys too, so the check
111
+ * can't tell which and names both.
112
+ */
113
+ function missingName(name: string): string {
114
+ return `no saved block or block type "${name}"`;
115
+ }
116
+
93
117
  /** A `CMS` block saved with preview hosts, which Studio keeps now (in the release it publishes). */
94
118
  const PREVIEW_FIELD_GONE =
95
119
  "the site editor now keeps the addresses this site can be previewed on, so this field isn't read any more: you can delete it";
@@ -657,7 +681,7 @@ class Checker {
657
681
  ? oldDateRuleProblem(block)
658
682
  : Object.hasOwn(FOLDED_BUILT_INS, name)
659
683
  ? `unknown block type "${name}": ${FOLDED_BUILT_INS[name]}`
660
- : `unknown block type "${name}"`,
684
+ : missingName(name),
661
685
  );
662
686
  return;
663
687
  }
@@ -726,7 +750,6 @@ class Checker {
726
750
  ctx,
727
751
  joinPath(path, "/name"),
728
752
  `no test "${name}" in the saved block "${EXPERIMENTS_BLOCK}": this rule is always false`,
729
- "warning",
730
753
  );
731
754
  }
732
755
  return;
@@ -751,7 +774,6 @@ class Checker {
751
774
  ctx,
752
775
  joinPath(path, "/name"),
753
776
  `no campaign "${campaign}" in the saved block "${CAMPAIGNS_BLOCK}": this rule is always false`,
754
- "warning",
755
777
  );
756
778
  }
757
779
  return;
@@ -913,10 +935,66 @@ class Checker {
913
935
  this.report(ctx, "preview", PREVIEW_FIELD_GONE, "warning");
914
936
  continue;
915
937
  }
938
+ // A v7 redirect block left over: redirectBlockProblems says to fold it into
939
+ // Redirects. With no alias its type is unknown here, which isn't an error.
940
+ if (V7_REDIRECT_TYPES.has(entry.__resolveType) && !this.canonicalType(entry.__resolveType)) {
941
+ continue;
942
+ }
916
943
  this.checkBlock(ctx, entry, "", null);
917
944
  }
918
945
  problems.push(...this.builtInOverrides());
919
946
  problems.push(...this.routeProblems());
947
+ problems.push(...this.redirectBlockProblems());
948
+ return problems;
949
+ }
950
+
951
+ /**
952
+ * Routing reads its redirects from one block: the first `redirects`-typed
953
+ * one in code-unit name order (see /next/routing). A per-rule `redirect`
954
+ * block still resolves but is never routed, and a second `redirects`
955
+ * block is ignored: both are warnings. So is a block under one of v7's
956
+ * redirect types, which v8 doesn't route: its rules belong in Redirects.
957
+ */
958
+ private redirectBlockProblems(): Problem[] {
959
+ const problems: Problem[] = [];
960
+ let routed: string | null = null;
961
+ const names = Object.keys(this.saved.blocks).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
962
+ for (const name of names) {
963
+ const entry = this.saved.blocks[name];
964
+ if (!isBlock(entry)) continue;
965
+ const file = `.deco/blocks/${this.saved.files[name]}`;
966
+ if (V7_REDIRECT_TYPES.has(entry.__resolveType)) {
967
+ problems.push({
968
+ file,
969
+ path: "",
970
+ severity: "warning",
971
+ message:
972
+ `v7 redirect block (type ${entry.__resolveType}) isn't routed: v8 routes only a block ` +
973
+ `typed "${REDIRECTS_TYPE}". Fold its rules into the "${REDIRECTS_BLOCK}" block ` +
974
+ `(type "${REDIRECTS_TYPE}"; v7's type permanent is permanent: true) and delete it`,
975
+ });
976
+ continue;
977
+ }
978
+ const { type } = this.underlyingType(entry.__resolveType);
979
+ if (type !== REDIRECT_TYPE && type !== REDIRECTS_TYPE) continue;
980
+ if (type === REDIRECT_TYPE) {
981
+ problems.push({
982
+ file,
983
+ path: "",
984
+ severity: "warning",
985
+ message: "not routed; move it into the redirects block",
986
+ });
987
+ } else if (routed === null) {
988
+ routed = name;
989
+ } else {
990
+ problems.push({
991
+ file,
992
+ path: "",
993
+ severity: "warning",
994
+ message: `another redirects block, "${routed}", is the one routed; this one is ignored. Move its rules there`,
995
+ });
996
+ }
997
+ }
920
998
  return problems;
921
999
  }
922
1000
 
@@ -1031,7 +1109,7 @@ export interface CheckOptions {
1031
1109
  reporter?: Reporter;
1032
1110
  }
1033
1111
 
1034
- function readSchemaFile(file: string): DecoMeta {
1112
+ export function readSchemaFile(file: string): DecoMeta {
1035
1113
  let text: string;
1036
1114
  try {
1037
1115
  text = fs.readFileSync(file, "utf8");
@@ -1073,7 +1151,19 @@ export function check(options: CheckOptions = {}): number {
1073
1151
  const reporter = options.reporter ?? consoleReporter;
1074
1152
  const paths = decoPaths(findDecoRoot(options));
1075
1153
  const meta = readSchemaFile(paths.schema);
1076
- const saved = readSavedBlocks(paths.blocks);
1154
+ return reportCheck(meta, readSavedBlocks(paths.blocks), reporter).exitCode;
1155
+ }
1156
+
1157
+ export interface CheckReport {
1158
+ exitCode: number;
1159
+ count: number;
1160
+ errors: number;
1161
+ warnings: number;
1162
+ problems: Problem[];
1163
+ }
1164
+
1165
+ /** Check saved blocks against the local schema and print the problems and a summary. */
1166
+ export function reportCheck(meta: DecoMeta, saved: SavedBlocks, reporter: Reporter): CheckReport {
1077
1167
  const problems = checkContent(meta, saved);
1078
1168
  const errors = problems.filter((p) => p.severity === "error").length;
1079
1169
  const warnings = problems.length - errors;
@@ -1086,7 +1176,7 @@ export function check(options: CheckOptions = {}): number {
1086
1176
  const summary = checkSummary(count, errors, warnings, reporter.color);
1087
1177
  if (errors > 0) reporter.error(summary);
1088
1178
  else reporter.info(summary);
1089
- return errors > 0 ? 1 : 0;
1179
+ return { exitCode: errors > 0 ? 1 : 0, count, errors, warnings, problems };
1090
1180
  }
1091
1181
 
1092
1182
  /**
@@ -1,13 +1,17 @@
1
1
  /**
2
- * `deco content`: turns the JSON files in `.deco/blocks` into the content
3
- * module, `.deco/blocks.gen.ts` (spec: content › The content module). It never
4
- * reads the block map.
2
+ * Reading `.deco/blocks` (every command that reads saved blocks), and the
3
+ * content module, `.deco/blocks.gen.ts`, for content without a site: tests,
4
+ * the example apps, self-hosted content and git-backed sites
5
+ * (`createCMS({ blocks, content })`, what the v7 migration writes). It never
6
+ * reads the block map. `deco content` (and `content()` from
7
+ * `@decocms/blocks/cli`) writes the module; a site with `site` set gets its
8
+ * content at runtime instead, and its `.deco/blocks` is what `deco pull` wrote.
5
9
  */
6
- import { execFileSync } from "node:child_process";
7
10
  import fs from "node:fs";
8
11
  import path from "node:path";
9
- import { canonicalJson, computeContentRevision, sha256Hex } from "../../protocol/canonical.ts";
12
+ import { computeContentRevision } from "../../protocol/canonical.ts";
10
13
  import {
14
+ blockFileName,
11
15
  blockNameFromFile,
12
16
  checkBlockName,
13
17
  entryHasPath,
@@ -23,7 +27,7 @@ import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "./root.ts";
23
27
  export interface ContentDiagnostic {
24
28
  /** The file name inside `.deco/blocks`. */
25
29
  file: string;
26
- /** "error" stops `deco content` and fails `deco check`; "warning" doesn't. */
30
+ /** "error" stops the content module, `deco push` and `deco check`; "warning" doesn't. */
27
31
  severity: "error" | "warning";
28
32
  message: string;
29
33
  }
@@ -114,6 +118,38 @@ export function readSavedBlocks(blocksDir: string): SavedBlocks {
114
118
  return { blocks, files, diagnostics };
115
119
  }
116
120
 
121
+ /**
122
+ * Blocks fetched from a draft or a revision, as if read from `.deco/blocks`
123
+ * (`deco check`, `--draft`, `--revision`): each at its file name; a name the
124
+ * file-name rule rejects, or a value that isn't a JSON object, is a
125
+ * diagnostic, as on disk.
126
+ */
127
+ export function savedBlocksFromMap(map: Record<string, unknown>): SavedBlocks {
128
+ const blocks: Record<string, Record<string, unknown>> = Object.create(null);
129
+ const files: Record<string, string> = Object.create(null);
130
+ const diagnostics: ContentDiagnostic[] = [];
131
+ for (const name of Object.keys(map).sort()) {
132
+ const file = blockFileName(name);
133
+ const entry = map[name];
134
+ const [invalid] = checkBlockName(name);
135
+ if (invalid) {
136
+ diagnostics.push({
137
+ file,
138
+ severity: "error",
139
+ message: `not a valid entry name (${invalid.message})`,
140
+ });
141
+ continue;
142
+ }
143
+ if (!isPlainObject(entry)) {
144
+ diagnostics.push({ file, severity: "error", message: "a saved block must be a JSON object" });
145
+ continue;
146
+ }
147
+ blocks[name] = entry;
148
+ files[name] = file;
149
+ }
150
+ return { blocks, files, diagnostics };
151
+ }
152
+
117
153
  const RESERVED = new Set(
118
154
  `break case catch class const continue debugger default delete do else enum export extends false
119
155
  finally for function if import in instanceof new null return super switch this throw true try
@@ -140,7 +176,7 @@ function identifierFor(name: string, taken: Set<string>): string {
140
176
  * Node reads it as a URL and loads `a b.json` instead. No spelling of the
141
177
  * specifier names the same file everywhere, so those entries are written into
142
178
  * the module, and hand edits to them need `deco content` again (`--watch`
143
- * does it; `deco serve` regenerates after every save).
179
+ * does it).
144
180
  */
145
181
  const IMPORTABLE_FILE = /^[A-Za-z0-9_][A-Za-z0-9._-]*\.json$/;
146
182
 
@@ -167,66 +203,8 @@ export function contentRoot(deco: string): string {
167
203
  }
168
204
  }
169
205
 
170
- /**
171
- * The `schemaHash` of a `.deco/schema.gen.json`: the SHA-256 of its parsed
172
- * JSON in canonical form (`sha256Hex(canonicalJson(JSON.parse(text)))`, the
173
- * `@decocms/blocks/protocol` helpers), so Studio computes the same value
174
- * from the file at a commit. Hosted releases swap only when it matches.
175
- */
176
- async function computeSchemaHash(text: string): Promise<string> {
177
- return sha256Hex(canonicalJson(JSON.parse(text)));
178
- }
179
-
180
- /** `schema.gen.json`'s hash, or `undefined` when there's no such file. */
181
- async function readSchemaHash(schemaFile: string): Promise<string | undefined> {
182
- let text: string;
183
- try {
184
- text = fs.readFileSync(schemaFile, "utf8");
185
- } catch (error) {
186
- if ((error as NodeJS.ErrnoException).code === "ENOENT") return undefined;
187
- throw error;
188
- }
189
- try {
190
- return await computeSchemaHash(text);
191
- } catch (error) {
192
- throw new CliError(
193
- `.deco/schema.gen.json: not valid JSON (${(error as Error).message}); run deco schema`,
194
- );
195
- }
196
- }
197
-
198
- /**
199
- * The commit time of git HEAD in `dir` (committer date, ISO 8601), or
200
- * undefined when git is missing, `dir` isn't in a repository, or it has no
201
- * commits. Commit time, not build time: a slow build of an older commit that
202
- * finishes after a publish must not win over it.
203
- */
204
- export function readCommittedAt(dir: string): string | undefined {
205
- try {
206
- const out = execFileSync("git", ["log", "-1", "--format=%cI"], {
207
- cwd: dir,
208
- encoding: "utf8",
209
- stdio: ["ignore", "pipe", "ignore"],
210
- }).trim();
211
- return out === "" || Number.isNaN(Date.parse(out)) ? undefined : out;
212
- } catch {
213
- return undefined;
214
- }
215
- }
216
-
217
- /**
218
- * The source of `.deco/blocks.gen.ts` for a set of saved blocks, with the
219
- * `schemaHash` of the schema it was built with when there is one, and
220
- * `committedAt`: the commit time of git HEAD it was built from (ISO 8601),
221
- * when there is one. A hosted release replaces the bundled content only when
222
- * it was published later (see ../remoteLoader.ts).
223
- */
224
- export async function renderContentModule(
225
- saved: SavedBlocks,
226
- root = ".deco",
227
- schemaHash?: string,
228
- committedAt?: string,
229
- ): Promise<string> {
206
+ /** The source of `.deco/blocks.gen.ts` for a set of saved blocks. */
207
+ export async function renderContentModule(saved: SavedBlocks, root = ".deco"): Promise<string> {
230
208
  const names = Object.keys(saved.blocks).sort();
231
209
  const revision = await computeContentRevision(saved.blocks);
232
210
  const taken = new Set<string>();
@@ -249,20 +227,16 @@ export async function renderContentModule(
249
227
  ([alias, target]) => ` ${JSON.stringify(alias)}: ${JSON.stringify(target)},`,
250
228
  );
251
229
  return [
252
- "// Generated by deco content; don't edit.",
230
+ "// Generated from .deco/blocks; don't edit.",
253
231
  ...imports,
254
232
  "",
255
233
  "const content: {",
256
234
  " revision: string;",
257
- ...(schemaHash === undefined ? [] : [" schemaHash: string;"]),
258
- ...(committedAt === undefined ? [] : [" committedAt: string;"]),
259
235
  " blocks: Record<string, unknown>;",
260
236
  " aliases: Record<string, string>;",
261
237
  " root: string;",
262
238
  "} = {",
263
239
  ` revision: ${JSON.stringify(revision)},`,
264
- ...(schemaHash === undefined ? [] : [` schemaHash: ${JSON.stringify(schemaHash)},`]),
265
- ...(committedAt === undefined ? [] : [` committedAt: ${JSON.stringify(committedAt)},`]),
266
240
  " blocks: {",
267
241
  ...entries,
268
242
  " },",
@@ -281,14 +255,7 @@ export interface ContentResult {
281
255
  root: string;
282
256
  file: string;
283
257
  revision: string;
284
- /** The hash of `.deco/schema.gen.json`, written into the module; absent without one. */
285
- schemaHash?: string;
286
258
  count: number;
287
- /**
288
- * The commit time of git HEAD in the root, written into the module as
289
- * `committedAt`; absent when git isn't available there.
290
- */
291
- committedAt?: string;
292
259
  /** False when the file already had this content. */
293
260
  changed: boolean;
294
261
  /** Files written into the module instead of imported (see `inlinedFiles`). */
@@ -317,16 +284,12 @@ export async function writeContent(paths: DecoPaths): Promise<ContentResult> {
317
284
  if (errors.length > 0) {
318
285
  throw new CliError(errors.map((d) => `.deco/blocks/${d.file}: ${d.message}`).join("\n"));
319
286
  }
320
- const schemaHash = await readSchemaHash(paths.schema);
321
- const committedAt = readCommittedAt(paths.root);
322
- const source = await renderContentModule(saved, contentRoot(paths.deco), schemaHash, committedAt);
287
+ const source = await renderContentModule(saved, contentRoot(paths.deco));
323
288
  const changed = writeIfChanged(paths.content, source);
324
289
  return {
325
290
  root: paths.root,
326
291
  file: paths.content,
327
292
  revision: await computeContentRevision(saved.blocks),
328
- ...(schemaHash === undefined ? {} : { schemaHash }),
329
- ...(committedAt === undefined ? {} : { committedAt }),
330
293
  count: Object.keys(saved.blocks).length,
331
294
  changed,
332
295
  inlined: inlinedFiles(saved),
@@ -338,21 +301,16 @@ export interface ContentOptions {
338
301
  root?: string;
339
302
  cwd?: string;
340
303
  reporter?: Reporter;
341
- /** Set by `--watch`: inlined files are kept up to date, so no hint about them. */
304
+ /** Set when something rewrites the module on every change: no hint about inlined files. */
342
305
  watching?: boolean;
343
306
  }
344
307
 
345
- /** `deco content`, once. Returns the exit code. */
308
+ /** Write `.deco/blocks.gen.ts` once (content without a site). Returns the exit code. */
346
309
  export async function content(options: ContentOptions = {}): Promise<number> {
347
310
  const reporter = options.reporter ?? consoleReporter;
348
311
  const paths = decoPaths(findDecoRoot(options));
349
312
  const result = await writeContent(paths);
350
313
  for (const d of result.diagnostics) reporter.warn(`.deco/blocks/${d.file}: ${d.message}`);
351
- if (result.committedAt === undefined) {
352
- reporter.info(
353
- "no git commit found, so .deco/blocks.gen.ts has no committedAt: hosted releases with the same schema will replace it",
354
- );
355
- }
356
314
  reporter.info(
357
315
  `${result.changed ? "wrote" : "unchanged"} .deco/blocks.gen.ts (${result.count} blocks, revision ${result.revision.slice(0, 12)})`,
358
316
  );
@@ -4,7 +4,7 @@
4
4
  * does either, so neither the CLI nor the TypeScript compiler it loads ever
5
5
  * reaches an app bundle.
6
6
  *
7
- * The four commands and their options, plus what the one-time migration
7
+ * The commands and their options, plus what the one-time migration
8
8
  * (the `deco-v7-to-v8-migration` skill) reads: the built-in block names, the alias
9
9
  * table, the saved-blocks reader and the host-pattern parser.
10
10
  */
@@ -15,4 +15,4 @@ export { type ContentOptions, content, readSavedBlocks, type SavedBlocks } from
15
15
  export { type Reporter, silentReporter } from "./log.ts";
16
16
  export { runCli } from "./run.ts";
17
17
  export { type SchemaOptions, schema } from "./schema/index.ts";
18
- export { type ServeOptions, serve } from "./serve/server.ts";
18
+ export { type InstalledSkills, type InstallSkillsOptions, installSkills } from "./skills.ts";