@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
@@ -0,0 +1,942 @@
1
+ /**
2
+ * The import codemod: v7 `@decocms/*` imports in the site's `src/`.
3
+ *
4
+ * It rewrites only what has a v8 equivalent with the same meaning:
5
+ *
6
+ * - an import of a vendored module (`@decocms/apps-shopify/loaders/…`)
7
+ * points at the copy in `src/vendor`;
8
+ * - `createInstrumentedFetch` from `@decocms/blocks/sdk/instrumentedFetch`
9
+ * comes from `@decocms/blocks/fetch`, and `createInstrumentedFetch("x")`
10
+ * becomes `createInstrumentedFetch({ provider: "x" })`;
11
+ * - names a v8 binding exports with v7's props and behaviour move to it
12
+ * (`MOVES`): `createDecoRouter` to `@decocms/tanstack/router`,
13
+ * `NavigationProgress` and, on a TanStack site, `Image`/`Picture`/`Source`
14
+ * to `@decocms/tanstack/react`, and so on; a name whose home depends on the
15
+ * binding (the draft names and Studio's origins: `@decocms/tanstack` or
16
+ * `@decocms/nextjs`, never `@decocms/blocks`) moves to the site's. An import
17
+ * declaration that mixes moved and other names is split.
18
+ *
19
+ * Every other v7 import is reported with where its replacement lives, name by
20
+ * name where the bindings replace them (`NAME_HINTS`); none is shimmed.
21
+ * Imports of the next major's documented entry points are left alone.
22
+ */
23
+ import fs from "node:fs";
24
+ import path from "node:path";
25
+ import ts from "typescript";
26
+ import {
27
+ COMPAT_MOVES,
28
+ COMPAT_NAME_HINTS,
29
+ COMPAT_V7_ENTRIES,
30
+ compatCommerceSpecifier,
31
+ } from "./compat";
32
+ import { type Framework, siteBlocksVersion, siteFramework } from "./framework";
33
+ import {
34
+ copyDecoCdnOptions,
35
+ findImageCopies,
36
+ type ImageCopy,
37
+ leadingStripChanges,
38
+ } from "./imageCopy";
39
+ import { imageModule, writeImageUrl } from "./imageModule";
40
+ import type { Report } from "./report";
41
+ import { relativeSpecifier, resolvePackageFile } from "./vendor";
42
+
43
+ /** The next major's documented API (/next/api-reference): imports of these stay. */
44
+ export const V8_API: Record<string, ReadonlySet<string> | "*"> = {
45
+ // The root's next-major exports (packages/blocks/src/index.ts, from ./v8).
46
+ "@decocms/blocks": new Set([
47
+ "Analytics",
48
+ "Block",
49
+ "BlockFunction",
50
+ "Blocks",
51
+ "Client",
52
+ "ClientOptions",
53
+ "CMS",
54
+ "CMSError",
55
+ "CMSSettings",
56
+ "ContentUnavailableError",
57
+ "ContentUnavailableReason",
58
+ "createCMS",
59
+ "currentClient",
60
+ "DraftPointer",
61
+ "EffectiveSettings",
62
+ "formatDraftPointer",
63
+ "Lazy",
64
+ "ListOptions",
65
+ "Loader",
66
+ "Match",
67
+ "matchRoute",
68
+ "Page",
69
+ "parseDraftPointer",
70
+ "parseVersion",
71
+ "Redirect",
72
+ "RequestLike",
73
+ "RequestVersion",
74
+ "Result",
75
+ "Route",
76
+ "remoteLoader",
77
+ "resetForTests",
78
+ "Seo",
79
+ "Snapshot",
80
+ "Telemetry",
81
+ "TelemetryConfig",
82
+ "Variant",
83
+ ]),
84
+ "@decocms/blocks/fetch": "*",
85
+ // Who is in which A/B test: pure helpers a site's own code may call.
86
+ "@decocms/blocks/experiments": "*",
87
+ "@decocms/blocks/analytics": "*",
88
+ "@decocms/blocks/cli": "*",
89
+ // Platform-neutral image URLs only; a platform's URLs are its client's /image.
90
+ "@decocms/blocks/image": new Set([
91
+ "createImageUrl",
92
+ "decoCdn",
93
+ "DecoCdnOptions",
94
+ "Fit",
95
+ "ImageProvider",
96
+ "ImageUrl",
97
+ "parseSrcSet",
98
+ "PreloadLink",
99
+ "PreloadOptions",
100
+ "preloadLink",
101
+ "Quality",
102
+ "QualityTier",
103
+ "ResizeOptions",
104
+ "SrcSetOptions",
105
+ "srcSet",
106
+ ]),
107
+ // The platforms' image URL helpers (pure functions, for createImageUrl). v7 had no such subpath.
108
+ "@decocms/apps-vtex/image": "*",
109
+ "@decocms/apps-shopify/image": "*",
110
+ "@decocms/blocks/vite": "*",
111
+ // v7 had a /preview too, with other names (DraftPreviewBadge).
112
+ "@decocms/blocks/preview": new Set([
113
+ "DraftBadge",
114
+ "DraftBadgeProps",
115
+ "StudioBridge",
116
+ "StudioBridgeProps",
117
+ "StudioChannel",
118
+ "StudioChannelProps",
119
+ "StudioPage",
120
+ "StudioPageInfo",
121
+ ]),
122
+ // The v8 bindings. Subpaths v7 never had are whole; the rest list v8's names.
123
+ // The draft names and Studio's origins live in each binding's root, not in @decocms/blocks.
124
+ "@decocms/tanstack": new Set([
125
+ "ASSIGNMENTS_HEADER",
126
+ "DEFAULT_STUDIO_ORIGINS",
127
+ "DRAFT_COOKIE",
128
+ "DRAFT_PARAM",
129
+ "draftResponseHeaders",
130
+ "isStudioOrigin",
131
+ "STUDIO_FRAME_ANCESTORS",
132
+ "STUDIO_ORIGIN",
133
+ "STUDIO_ORIGINS",
134
+ "StudioCspOptions",
135
+ "studioOrigins",
136
+ "VERSION_HEADER",
137
+ "VISITOR_HEADER",
138
+ "withStudioCsp",
139
+ ]),
140
+ "@decocms/tanstack/worker": "*",
141
+ "@decocms/tanstack/server": "*",
142
+ "@decocms/tanstack/start": "*",
143
+ "@decocms/tanstack/router": "*",
144
+ "@decocms/tanstack/react": "*",
145
+ "@decocms/tanstack/scope": "*",
146
+ "@decocms/tanstack/vite": new Set([
147
+ "decoTanstack",
148
+ "DecoTanstackOptions",
149
+ "gitBuildHash",
150
+ "resolveBuildHash",
151
+ ]),
152
+ "@decocms/nextjs/proxy": "*",
153
+ "@decocms/nextjs/server": "*",
154
+ "@decocms/nextjs/image-loader": "*",
155
+ // v7's DraftPreviewIndicator kept its name but now shows what bindDraft bound: reported.
156
+ "@decocms/nextjs": new Set([
157
+ "ASSIGNMENTS_HEADER",
158
+ "DEFAULT_STUDIO_ORIGINS",
159
+ "DRAFT_COOKIE",
160
+ "DRAFT_PARAM",
161
+ "DraftBadge",
162
+ "DraftPreviewIndicatorProps",
163
+ "draftResponseHeaders",
164
+ "isStudioOrigin",
165
+ "STUDIO_FRAME_ANCESTORS",
166
+ "STUDIO_ORIGIN",
167
+ "STUDIO_ORIGINS",
168
+ "StudioBridge",
169
+ "StudioBridgeProps",
170
+ "StudioPage",
171
+ "StudioCspOptions",
172
+ "StudioPageInfo",
173
+ "studioOrigins",
174
+ "VERSION_HEADER",
175
+ "VISITOR_HEADER",
176
+ "withStudioCsp",
177
+ ]),
178
+ "@decocms/nextjs/config": new Set([
179
+ "DECO_DRAFT_HEADERS",
180
+ "HeaderRule",
181
+ "STUDIO_DEV_ORIGINS",
182
+ "withDeco",
183
+ "WithDecoOptions",
184
+ ]),
185
+ // v7's pure helpers, with v7's output (the product owner's one home for them).
186
+ ...Object.fromEntries(COMPAT_V7_ENTRIES.map((e) => [e, "*" as const])),
187
+ };
188
+
189
+ const IMAGE_COMPONENTS = [
190
+ "Image",
191
+ "ImageProps",
192
+ "Picture",
193
+ "PictureProps",
194
+ "Source",
195
+ "SourceProps",
196
+ ];
197
+
198
+ /** v7's image URL helpers (`@decocms/blocks/hooks`). */
199
+ const IMAGE_URL_NAMES = [
200
+ "registerImageCdnDomain",
201
+ "registerImageQuality",
202
+ "getOptimizedMediaUrl",
203
+ "getSrcSet",
204
+ ];
205
+
206
+ /** The draft names and Studio's origins: each binding's root exports them, `@decocms/blocks` doesn't. */
207
+ export const BINDING_NAMES = [
208
+ "DRAFT_COOKIE",
209
+ "DRAFT_PARAM",
210
+ "draftResponseHeaders",
211
+ "isStudioOrigin",
212
+ "STUDIO_FRAME_ANCESTORS",
213
+ "STUDIO_ORIGINS",
214
+ ];
215
+
216
+ /** A move's target: one entry point, or one per binding. */
217
+ type MoveTarget = string | Partial<Record<Framework, string>>;
218
+
219
+ /**
220
+ * v7 names a v8 binding exports with the same props and behaviour, by v7
221
+ * specifier: the codemod points the import at the binding. `only` limits a
222
+ * move to sites on that binding; a per-binding target moves a name only on a
223
+ * site with one of those bindings.
224
+ */
225
+ export const MOVES: Record<string, { only?: Framework; names: Record<string, MoveTarget> }> = {
226
+ // v7's helpers @decocms/compat-v7 has (./compat.ts), whatever the binding.
227
+ ...Object.fromEntries(Object.entries(COMPAT_MOVES).map(([s, names]) => [s, { names }])),
228
+ "@decocms/blocks": {
229
+ names: {
230
+ ...Object.fromEntries(
231
+ BINDING_NAMES.map((n) => [n, { tanstack: "@decocms/tanstack", nextjs: "@decocms/nextjs" }]),
232
+ ),
233
+ ...COMPAT_MOVES["@decocms/blocks"],
234
+ },
235
+ },
236
+ "@decocms/tanstack": {
237
+ names: {
238
+ createDecoRouter: "@decocms/tanstack/router",
239
+ decoParseSearch: "@decocms/tanstack/router",
240
+ decoStringifySearch: "@decocms/tanstack/router",
241
+ NavigationProgress: "@decocms/tanstack/react",
242
+ StableOutlet: "@decocms/tanstack/react",
243
+ },
244
+ },
245
+ "@decocms/tanstack/sdk/serverFnFetch": {
246
+ names: { decoServerFnFetch: "@decocms/tanstack/start" },
247
+ },
248
+ "@decocms/blocks/hooks": {
249
+ only: "tanstack",
250
+ names: Object.fromEntries(IMAGE_COMPONENTS.map((n) => [n, "@decocms/tanstack/react"])),
251
+ },
252
+ };
253
+
254
+ const IMAGE_HELPERS =
255
+ "createImageUrl and decoCdn from @decocms/blocks/image, vtexCatalog from @decocms/apps-vtex/image, shopifyCdn from @decocms/apps-shopify/image; keep both helpers whatever the site's platform, since v7 resized VTEX and Shopify images on every site";
256
+
257
+ /**
258
+ * v7's image URLs as v8 code, for the `@decocms/blocks` 7.x version the site
259
+ * ran: the platform helpers (their client packages' /image) before the Deco
260
+ * CDN, with the `decoCdn` options that reproduce that release's `Image`
261
+ * (checked against each release's `hooks/Image.tsx`):
262
+ * - before 7.71.0: decoims.com was the default domain, every Deco asset host
263
+ * was stripped wherever it was, and no legacy host was stripped;
264
+ * - 7.71.0 to 7.71.3: assets.decocms.com became the default, the rest alike;
265
+ * - 7.71.4: only a leading asset host is stripped, and decoims.com on any CDN;
266
+ * decoCdn's default since 8.3 ("leading"), which the PO approved for the
267
+ * older releases too (2026-10-15): `rewriteImports` reports the URLs it changes;
268
+ * - 7.71.5 on: decoims.com only on the Cloudflare CDNs (decoCdn's default);
269
+ * - 7.77.1 on: Nuvemshop product images got the CDN's fixed sizes too, which
270
+ * no @decocms/apps-* package covers: such a store lists its own provider.
271
+ */
272
+ export function v7ImageUrl(version: string | undefined): string {
273
+ const [major, minor, patch] = (version ?? "").split(".").map(Number);
274
+ const at = (m: number, p: number) => major === 7 && (minor > m || (minor === m && patch >= p));
275
+ const nuvemshop =
276
+ "; a store with Nuvemshop images lists its own provider before decoCdn (references/framework-code.md)";
277
+ const providers = (deco: string) =>
278
+ `createImageUrl({ providers: [vtexCatalog(), shopifyCdn(), decoCdn({ ${deco} })] })`;
279
+ const registered =
280
+ "domain and quality as the site registered them with registerImageCdnDomain/registerImageQuality, else leave them out";
281
+ if (major !== 7 || Number.isNaN(minor)) {
282
+ return `${providers('domain, quality, sources: "all"')} (${IMAGE_HELPERS}; ${registered}; that is the latest 7.x, and references/framework-code.md lists the decoCdn options for older 7.x releases${nuvemshop})`;
283
+ }
284
+ if (!at(71, 0)) {
285
+ return `${providers('domain, quality, sources: "all", legacyHosts: []')} (${IMAGE_HELPERS}; domain as the site registered it with registerImageCdnDomain, else "decoims.com", the default before 7.71.0; quality as registered with registerImageQuality, else leave it out)`;
286
+ }
287
+ if (!at(71, 4)) {
288
+ return `${providers('domain, quality, sources: "all", legacyHosts: []')} (${IMAGE_HELPERS}; ${registered})`;
289
+ }
290
+ if (!at(71, 5)) {
291
+ return `${providers('domain, quality, sources: "all", legacyHosts: ["decoims.com"]')} (${IMAGE_HELPERS}; ${registered})`;
292
+ }
293
+ return `${providers('domain, quality, sources: "all"')} (${IMAGE_HELPERS}; ${registered}${at(77, 1) ? nuvemshop : ""})`;
294
+ }
295
+
296
+ /** Whether the `@decocms/blocks` 7.x release's `Image` stripped the asset hosts anywhere (before 7.71.4). */
297
+ export function v7StripsAnywhere(version: string | undefined): boolean {
298
+ const [major, minor, patch] = (version ?? "").split(".").map(Number);
299
+ if (major !== 7 || Number.isNaN(minor)) return false;
300
+ return minor < 71 || (minor === 71 && !(patch >= 4));
301
+ }
302
+
303
+ /**
304
+ * v7's image URLs as v8 code for a site that kept its own copy of v7's image
305
+ * helper: the options are read from the copy (and what the site registers
306
+ * with it), since the copy's URLs, not the release's, are what the site serves.
307
+ */
308
+ export function copyImageUrl(
309
+ copy: ImageCopy,
310
+ registered: { domain?: string | null; quality?: string | null } = {},
311
+ ): string | undefined {
312
+ const rules = copy.rules;
313
+ if (!rules) return undefined;
314
+ const providers = [
315
+ rules.vtex ? "vtexCatalog()" : "",
316
+ rules.shopify ? "shopifyCdn()" : "",
317
+ rules.nuvemshop ? "nuvemshop" : "",
318
+ `decoCdn({ ${copyDecoCdnOptions(rules, registered)} })`,
319
+ ].filter(Boolean);
320
+ const helpers = [
321
+ "createImageUrl and decoCdn from @decocms/blocks/image",
322
+ rules.vtex ? "vtexCatalog from @decocms/apps-vtex/image" : "",
323
+ rules.shopify ? "shopifyCdn from @decocms/apps-shopify/image" : "",
324
+ rules.nuvemshop
325
+ ? "nuvemshop: the store's own provider for v7's Nuvemshop rule (references/framework-code.md)"
326
+ : "",
327
+ ].filter(Boolean);
328
+ return `createImageUrl({ providers: [${providers.join(", ")}] }) (${helpers.join(", ")}; read from the site's copy of v7's image helper, ${copy.file}: these options reproduce its URLs, which win over its 7.x release's where they differ)`;
329
+ }
330
+
331
+ /** Stands for `v7ImageUrl(<the site's version>)` in a hint, replaced when reported. */
332
+ const V7_IMAGE_URL = "\u0001v7-image-url\u0001";
333
+
334
+ /** The hints for names the bindings replace, by v7 specifier: checked before `HINTS`. */
335
+ const NAME_HINTS: { specifier: RegExp; names: string[]; hint: string }[] = [
336
+ ...COMPAT_NAME_HINTS,
337
+ {
338
+ specifier: /^@decocms\/(blocks|tanstack|nextjs)$/,
339
+ names: ["DRAFT_HEADER"],
340
+ hint: "VERSION_HEADER (x-deco-version) from the site's binding root: the request header carrying the version alone (a draft pointer or a release SHA); what the proxy or worker decided rides on ASSIGNMENTS_HEADER (x-deco-assignments), and contentClient reads both",
341
+ },
342
+ {
343
+ specifier: /^@decocms\/tanstack$/,
344
+ names: ["createDecoWorkerEntry"],
345
+ hint: "createDecoWorker({ serverEntry, cms, pageCache }) from @decocms/tanstack/worker: drafts on the hosts Studio lists, liveness, Studio framing, CMS redirects and cookies are built in; the page cache is the site's own (pageCache: copy examples/tanstack-worker-smoke/src/worker-entry.ts from decocms/blocks, the report lists what v7's options configured); what else the site's entry did goes in its options (csp, preload, routes)",
346
+ },
347
+ {
348
+ specifier: /^@decocms\/tanstack$/,
349
+ names: ["DecoRootLayout", "PreviewProviders", "DraftPreviewIndicator"],
350
+ hint: "DecoDocument from @decocms/tanstack/react, the root route's component: it mounts StudioBridge and DraftBadge",
351
+ },
352
+ {
353
+ specifier: /^@decocms\/tanstack$/,
354
+ names: [
355
+ "cmsRouteConfig",
356
+ "cmsHomeRouteConfig",
357
+ "loadCmsPage",
358
+ "loadCmsHomePage",
359
+ "CmsPage",
360
+ "NotFoundPage",
361
+ "withSiteGlobals",
362
+ "DecoPageRenderer",
363
+ "SectionRenderer",
364
+ "SectionList",
365
+ "loadDeferredSection",
366
+ ],
367
+ hint: "render pages with createCMS and matchRoute (/next/tanstack-start-descriptors), reading the draft the worker accepted with contentClient(cms) from @decocms/tanstack/server",
368
+ },
369
+ {
370
+ specifier: /^@decocms\/tanstack$/,
371
+ names: ["decoInvokeRouteConfig", "decoMetaRouteConfig", "decoRenderRouteConfig"],
372
+ hint: "v7's admin and invoke routes: delete them (createDecoWorker answers 404 on v7's admin paths; /deco/invoke becomes server functions)",
373
+ },
374
+ {
375
+ specifier: /^@decocms\/tanstack$/,
376
+ names: ["setupTanstackFastDeploy", "kvLoader"],
377
+ hint: "fast deploy is the hosted CMS: createCMS({ site, token }) (/next/content#create-the-cms)",
378
+ },
379
+ {
380
+ specifier: /^@decocms\/nextjs$/,
381
+ names: [
382
+ "createDecoPage",
383
+ "createDecoPreviewPage",
384
+ "DecoPageRenderer",
385
+ "SectionRenderer",
386
+ "DeferredSectionBoundary",
387
+ "ClientOnlySection",
388
+ "DecoRootLayout",
389
+ ],
390
+ hint: "render pages with createCMS (/next/nextjs); drafts with bindDraft and contentClient from @decocms/nextjs/server, and StudioBridge from @decocms/nextjs in the root layout",
391
+ },
392
+ {
393
+ specifier: /^@decocms\/nextjs$/,
394
+ names: ["DraftPreviewIndicator"],
395
+ hint: "the same name in @decocms/nextjs 8: it shows the draft bindDraft(cms, { searchParams, site }) from @decocms/nextjs/server bound for the page, so call that first",
396
+ },
397
+ {
398
+ specifier: /^@decocms\/(nextjs|blocks\/preview)$/,
399
+ names: [
400
+ "DraftPreviewBadge",
401
+ "DraftPreviewBadgeProps",
402
+ "buildExitUrl",
403
+ "buildShareUrl",
404
+ "isFramed",
405
+ "DECO_MARK_DATA_URI",
406
+ ],
407
+ hint: "DraftBadge from @decocms/blocks/preview (DecoDocument and DraftPreviewIndicator mount it)",
408
+ },
409
+ {
410
+ specifier: /^@decocms\/nextjs\/config$/,
411
+ names: ["DECO_REWRITES"],
412
+ hint: "gone with v7's /deco/* handlers: withDeco from @decocms/nextjs/config adds no rewrites",
413
+ },
414
+ {
415
+ specifier: /^@decocms\/blocks\/hooks$/,
416
+ names: IMAGE_COMPONENTS,
417
+ hint: "on Next.js, next/image with createDecoImageLoader from @decocms/nextjs/image-loader; elsewhere, URLs from createImageUrl, srcSet and preloadLink in @decocms/blocks/image, with the platform's helper listed first (vtexCatalog from @decocms/apps-vtex/image, shopifyCdn from @decocms/apps-shopify/image)",
418
+ },
419
+ {
420
+ specifier: /^@decocms\/blocks\/hooks$/,
421
+ names: [
422
+ "registerImageCdnDomain",
423
+ "registerImageQuality",
424
+ "getImageCdnDomain",
425
+ "getImageQuality",
426
+ "getOptimizedMediaUrl",
427
+ "getSrcSet",
428
+ "FACTORS",
429
+ "ImageQuality",
430
+ "FitOptions",
431
+ ],
432
+ hint: `${V7_IMAGE_URL} gives v7's URLs; url(src, { width, height, fit }) and srcSet(url, src, …) replace getOptimizedMediaUrl and getSrcSet; on TanStack, pass it to ImageUrlProvider from @decocms/tanstack/react`,
433
+ },
434
+ {
435
+ specifier: /^@decocms\/blocks\/hooks$/,
436
+ names: ["LiveControls"],
437
+ hint: "StudioBridge from @decocms/blocks/preview: DecoDocument (@decocms/tanstack/react) mounts it; a Next.js root layout renders StudioBridge from @decocms/nextjs",
438
+ },
439
+ ];
440
+
441
+ /** Where each v7 import's replacement lives, first match wins. */
442
+ const HINTS: [RegExp, string][] = [
443
+ [/^@decocms\/start(\/|$)/, "a 6.x import: upgrade the site to 7.x first"],
444
+ [
445
+ /^@decocms\/blocks\/sdk\/cachedLoader$/,
446
+ "cachedLoader is gone: an upstream cache is your own fetch, passed to createInstrumentedFetch (/next/caching#upstream-data)",
447
+ ],
448
+ [
449
+ /(^|\/)(invoke|createInvoke)$|\/sdk\/invoke/,
450
+ "/deco/invoke is gone: one server function per loader or action, imported by each call site, never a rebuilt invoke tree (/next/renames-and-migrations#loaders-actions-and-invoke)",
451
+ ],
452
+ [
453
+ /^@decocms\/blocks-admin(\/|$)/,
454
+ "next-major sites serve no admin endpoints; the site editor uses the content protocol (/next/studio-compatibility)",
455
+ ],
456
+ [
457
+ /^@decocms\/blocks-cli(\/|$)/,
458
+ "codegen is the deco CLI in @decocms/blocks: deco schema, deco content, deco check (/next/cli)",
459
+ ],
460
+ [
461
+ /^@decocms\/blocks\/(setup|cms)(\/|$)/,
462
+ "setup is createCMS from @decocms/blocks, with the block map in .deco/index.ts (/next/content#create-the-cms)",
463
+ ],
464
+ [
465
+ /^@decocms\/blocks\/sdk\/instrumentedFetch$/,
466
+ "createInstrumentedFetch({ provider, fetch?, retry?, circuitBreaker? }) from @decocms/blocks/fetch (/next/api-reference#createinstrumentedfetch-options)",
467
+ ],
468
+ [
469
+ /^@decocms\/blocks\/(sdk\/(otel|observability|logger)|middleware\/observability)/,
470
+ "telemetry is the telemetry option of createCMS (/next/telemetry)",
471
+ ],
472
+ [
473
+ /(OneDollarStats|Analytics)$|^@decocms\/blocks\/sdk\/analytics$/,
474
+ "AnalyticsScript and track from @decocms/blocks/analytics, with the analytics section of cms.settings() (/next/analytics)",
475
+ ],
476
+ [
477
+ /^@decocms\/apps-salesforce(\/|$)|^@decocms\/apps\/salesforce(\/|$)/,
478
+ "the Salesforce client is @decocms/apps-sfmc-personalization (/next/upstream-clients#what-a-client-is)",
479
+ ],
480
+ [
481
+ /^@decocms\/apps-commerce(\/|$)/,
482
+ "v7's app runtime (app-types, registry, resolve, manifest-utils) has no v8 equivalent: an app is its upstream client, created in code (/next/upstream-clients); v7's commerce types and helpers are @decocms/compat-v7/commerce/*",
483
+ ],
484
+ [
485
+ /^@decocms\/apps\/commerce(\/|$)/,
486
+ "a 6.x import: upgrade the site to 7.x first (7.x's @decocms/apps-commerce becomes @decocms/compat-v7/commerce)",
487
+ ],
488
+ [
489
+ /^@decocms\/apps-website(\/|$)|^@decocms\/apps\/website(\/|$)/,
490
+ "website features (SEO, sitemaps, redirects) live in your platform template (/next/upstream-clients#what-a-client-is)",
491
+ ],
492
+ [
493
+ /^@decocms\/apps(-[a-z]+)?(\/|$)/,
494
+ "apps are thin upstream clients now; call the platform's client from your own code (/next/upstream-clients)",
495
+ ],
496
+ [
497
+ /^@decocms\/blocks\/sdk\/(cacheHeaders|responseCache|cacheStorage|mergeCacheControl)$/,
498
+ "on TanStack Start, the page cache in the site's worker entry (the recipe in @decocms/tanstack's README: its PROFILES are v7's, change them there); a Next.js site keeps its own cache headers",
499
+ ],
500
+ [
501
+ /^@decocms\/blocks\/sdk\/csp$/,
502
+ "createDecoWorker's csp option (@decocms/tanstack/worker): Studio's origins are always added to frame-ancestors and script-src",
503
+ ],
504
+ [
505
+ /^@decocms\/blocks\/sdk\/redirects$/,
506
+ "createDecoWorker applies the CMS redirects before any route",
507
+ ],
508
+ [
509
+ /^@decocms\/blocks\/sdk\/abTesting$/,
510
+ "withABTesting is abTestingRoutes({ worker: () => worker, ...the same options }) from @decocms/compat-v7/tanstack/worker, a handler run first in createDecoWorker's routes (not a wrapper around the worker): same KV entry, buckets, cookie and fallback proxy (references/site-code.md)",
511
+ ],
512
+ [
513
+ /^@decocms\/tanstack\/vite$/,
514
+ "decoTanstack({ buildHash }) from @decocms/tanstack/vite; it includes decoContent() from @decocms/blocks/vite",
515
+ ],
516
+ [
517
+ /^@decocms\/tanstack\/sdk\/startEntry$/,
518
+ "createStart(() => ({ serverFns: { fetch: decoServerFnFetch } })) with decoServerFnFetch from @decocms/tanstack/start; createDecoWorker decides the draft, so no draft middleware",
519
+ ],
520
+ [
521
+ /^@decocms\/tanstack\/sdk\/cdnSegment$/,
522
+ "the segment of the site's page cache (buildSegment in the worker entry); the cache passes the __cseg token to render({ csegToken }), DecoDocument publishes it and decoServerFnFetch sends it",
523
+ ],
524
+ [
525
+ /^@decocms\/tanstack\/sdk\/cookiePassthrough$/,
526
+ "createDecoWorker sends one Set-Cookie per cookie; a server function sets cookies with TanStack Start's own setCookie",
527
+ ],
528
+ [
529
+ /^@decocms\/tanstack\/sdk\/deferredSectionLoader$/,
530
+ "the next major has no async rendering (the script unwrapped the Lazy and Deferred sections)",
531
+ ],
532
+ [
533
+ /^@decocms\/tanstack\/daemon$/,
534
+ "local editing is deco pull and deco push --draft=<name> (/next/cli)",
535
+ ],
536
+ [
537
+ /^@decocms\/nextjs\/routeHandlers$/,
538
+ "v7's /deco/* route handlers: delete them; the site editor uses the content protocol (/next/studio-compatibility)",
539
+ ],
540
+ [
541
+ /^@decocms\/nextjs\/setup$/,
542
+ "setup is createCMS from @decocms/blocks, with the block map in .deco/index.ts (/next/content#create-the-cms)",
543
+ ],
544
+ [
545
+ /^@decocms\/nextjs\/middleware$/,
546
+ "draft previews and the visitor in proxy.ts: decideDraft, decideVisitor, draftRequestHeaders, visitorRequestHeaders, rewriteToDraftRoute, applyDraft and applyVisitor from @decocms/nextjs/proxy, or draftProxy",
547
+ ],
548
+ [
549
+ /^@decocms\/tanstack(\/|$)/,
550
+ "a v7 name: @decocms/tanstack 8 has createDecoWorker (/worker), DecoDocument and Image (/react), createDecoRouter (/router), decoServerFnFetch (/start), contentClient (/server) and decoTanstack (/vite); see the skill's import map",
551
+ ],
552
+ [
553
+ /^@decocms\/nextjs(\/|$)/,
554
+ "a v7 name: @decocms/nextjs 8 has the draft proxy (/proxy), bindDraft and contentClient (/server), withDeco (/config), createDecoImageLoader (/image-loader) and StudioBridge; see the skill's import map",
555
+ ],
556
+ ];
557
+ const DEFAULT_HINT = "no v8 equivalent";
558
+ /** Prerelease root exports that became CMS methods. */
559
+ const DRAFT_HELPERS = new Set(["draftPointer", "draftCookie"]);
560
+ const DRAFT_HINT =
561
+ "draftPointer and draftCookie are the async cms.draftPointer and cms.draftCookie now: pass cms.draftPointer the request, or { url, headers } (/next/api-reference#draft-pointers); on TanStack Start and Next.js the binding decides the draft (contentClient from @decocms/tanstack/server, bindDraft from @decocms/nextjs/server)";
562
+ const BINDING_NAMES_HINT =
563
+ "the draft names and Studio's origins come from the site's binding, not @decocms/blocks: @decocms/tanstack on TanStack Start, @decocms/nextjs on Next.js";
564
+
565
+ const SOURCE = /\.(tsx?|mts|cts)$/;
566
+
567
+ function listSources(dir: string): string[] {
568
+ if (!fs.existsSync(dir)) return [];
569
+ return fs
570
+ .readdirSync(dir, { recursive: true, withFileTypes: true })
571
+ .filter((d) => d.isFile() && SOURCE.test(d.name) && !d.name.endsWith(".d.ts"))
572
+ .map((d) => path.join(d.parentPath, d.name))
573
+ .filter((f) => !f.split(path.sep).includes("node_modules"));
574
+ }
575
+
576
+ interface Found {
577
+ /** The string literal node holding the specifier. */
578
+ literal: ts.StringLiteral;
579
+ /** Named imports (`*` for a namespace or default import). */
580
+ names: string[];
581
+ declaration?: ts.ImportDeclaration;
582
+ }
583
+
584
+ function findImports(source: ts.SourceFile): Found[] {
585
+ const found: Found[] = [];
586
+ const visit = (node: ts.Node) => {
587
+ if (
588
+ (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
589
+ node.moduleSpecifier &&
590
+ ts.isStringLiteral(node.moduleSpecifier)
591
+ ) {
592
+ const names: string[] = [];
593
+ if (ts.isImportDeclaration(node)) {
594
+ const clause = node.importClause;
595
+ if (clause?.name) names.push("default");
596
+ const bindings = clause?.namedBindings;
597
+ if (bindings && ts.isNamespaceImport(bindings)) names.push("*");
598
+ if (bindings && ts.isNamedImports(bindings)) {
599
+ for (const el of bindings.elements) names.push((el.propertyName ?? el.name).text);
600
+ }
601
+ } else if (node.exportClause && ts.isNamedExports(node.exportClause)) {
602
+ for (const el of node.exportClause.elements) names.push((el.propertyName ?? el.name).text);
603
+ } else {
604
+ names.push("*");
605
+ }
606
+ found.push({
607
+ literal: node.moduleSpecifier,
608
+ names,
609
+ declaration: ts.isImportDeclaration(node) ? node : undefined,
610
+ });
611
+ } else if (
612
+ ts.isCallExpression(node) &&
613
+ node.expression.kind === ts.SyntaxKind.ImportKeyword &&
614
+ node.arguments[0] &&
615
+ ts.isStringLiteral(node.arguments[0])
616
+ ) {
617
+ found.push({ literal: node.arguments[0], names: ["*"] });
618
+ } else if (
619
+ ts.isImportTypeNode(node) &&
620
+ ts.isLiteralTypeNode(node.argument) &&
621
+ ts.isStringLiteral(node.argument.literal)
622
+ ) {
623
+ found.push({ literal: node.argument.literal, names: ["*"] });
624
+ }
625
+ ts.forEachChild(node, visit);
626
+ };
627
+ visit(source);
628
+ return found;
629
+ }
630
+
631
+ /** The hint for each of `names` imported from `specifier`, names grouped by hint. */
632
+ function hintsFor(specifier: string, names: string[]): Map<string, string[]> {
633
+ const out = new Map<string, string[]>();
634
+ const add = (hint: string, name: string) => out.set(hint, [...(out.get(hint) ?? []), name]);
635
+ const general = HINTS.find(([pattern]) => pattern.test(specifier))?.[1] ?? DEFAULT_HINT;
636
+ for (const name of names) {
637
+ if (specifier === "@decocms/blocks" && DRAFT_HELPERS.has(name)) {
638
+ add(DRAFT_HINT, name);
639
+ continue;
640
+ }
641
+ if (specifier === "@decocms/blocks" && BINDING_NAMES.includes(name)) {
642
+ add(BINDING_NAMES_HINT, name);
643
+ continue;
644
+ }
645
+ const byName = NAME_HINTS.find((h) => h.specifier.test(specifier) && h.names.includes(name));
646
+ add(byName?.hint ?? general, name);
647
+ }
648
+ return out;
649
+ }
650
+
651
+ /** The names of `specifier` the next major doesn't export (all of them for an unknown entry point). */
652
+ function undocumented(specifier: string, names: string[]): string[] {
653
+ const api = V8_API[specifier];
654
+ if (api === "*") return [];
655
+ return api ? names.filter((n) => !api.has(n)) : names;
656
+ }
657
+
658
+ /** `createInstrumentedFetch("x")` calls, or null when one has another argument shape. */
659
+ function instrumentedFetchCalls(source: ts.SourceFile, local: string): ts.CallExpression[] | null {
660
+ const calls: ts.CallExpression[] = [];
661
+ let convertible = true;
662
+ const visit = (node: ts.Node) => {
663
+ if (
664
+ ts.isCallExpression(node) &&
665
+ ts.isIdentifier(node.expression) &&
666
+ node.expression.text === local
667
+ ) {
668
+ const [arg] = node.arguments;
669
+ if (node.arguments.length === 1 && arg && ts.isStringLiteralLike(arg)) calls.push(node);
670
+ else convertible = false;
671
+ }
672
+ ts.forEachChild(node, visit);
673
+ };
674
+ visit(source);
675
+ return convertible ? calls : null;
676
+ }
677
+
678
+ interface Edit {
679
+ start: number;
680
+ end: number;
681
+ text: string;
682
+ }
683
+
684
+ /** How many changed URLs the report spells out; the rest are counted. */
685
+ const LISTED_URLS = 10;
686
+
687
+ /**
688
+ * A site whose v7 image code stripped the Deco asset hosts anywhere in a
689
+ * source now gets decoCdn's "leading" (approved, PO 2026-10-15): the report
690
+ * counts the URLs in the content and code whose image URL changes.
691
+ */
692
+ function reportLeadingStrip(root: string, report: Report, copy: string | undefined): void {
693
+ const changes = leadingStripChanges(root);
694
+ const by = copy
695
+ ? `its copy of v7's image helper (${copy})`
696
+ : "its 7.x release's Image (before 7.71.4)";
697
+ const rule = `v7 stripped the Deco asset hosts (assets.decocache.com, the S3 bucket) anywhere in an image source, by ${by}; decoCdn strips only a leading one, an approved difference (PO 2026-10-15), so a source that merely contains an asset URL keeps it`;
698
+ if (changes.length === 0) {
699
+ report.done.push({
700
+ step: "imports",
701
+ subject: "image URLs",
702
+ message: `${rule}. No URL in .deco/blocks or src/ changes`,
703
+ });
704
+ return;
705
+ }
706
+ const files = new Set(changes.map((c) => c.file));
707
+ const listed = changes
708
+ .slice(0, LISTED_URLS)
709
+ .map((c) => `${c.url} (${c.file})`)
710
+ .join(", ");
711
+ const more = changes.length > LISTED_URLS ? `, +${changes.length - LISTED_URLS} more` : "";
712
+ report.manual.push({
713
+ step: "imports",
714
+ subject: "image URLs",
715
+ message: `${rule}. ${changes.length} URL${changes.length === 1 ? "" : "s"} in ${files.size} file${files.size === 1 ? "" : "s"} change${changes.length === 1 ? "s" : ""}: ${listed}${more}. List them as the approved difference in the PR; nothing to change`,
716
+ });
717
+ }
718
+
719
+ /**
720
+ * Rewrite and report the `@decocms/*` imports of every source file in `src/`.
721
+ * `vendored` maps an installed source file to its copy in the site.
722
+ */
723
+ export function rewriteImports(root: string, report: Report, vendored: Map<string, string>): void {
724
+ const reported = new Map<string, { names: Set<string>; files: Set<string> }>();
725
+ let rewrittenFiles = 0;
726
+ const framework = siteFramework(root);
727
+ const images = findImageCopies(root);
728
+ const fromCopy = images.copies
729
+ .map((copy) => copyImageUrl(copy, images.registered))
730
+ .find((url) => url !== undefined);
731
+ const version = siteBlocksVersion(root);
732
+ const imageUrl = fromCopy ?? v7ImageUrl(version);
733
+ const readCopy = images.copies.find((copy) => copy.rules !== null);
734
+ const stripsAnywhere = readCopy
735
+ ? readCopy.rules?.stripAssetHosts === "anywhere"
736
+ : v7StripsAnywhere(version);
737
+ /** Names moved to a binding, by target, for the report. */
738
+ const moved = new Map<string, Set<string>>();
739
+ /** Whether the site uses v7's image components or URL helpers. */
740
+ let usesImages = images.copies.length > 0;
741
+
742
+ for (const file of listSources(path.join(root, "src"))) {
743
+ const text = fs.readFileSync(file, "utf8");
744
+ if (!text.includes("@decocms/")) continue;
745
+ const source = ts.createSourceFile(
746
+ file,
747
+ text,
748
+ ts.ScriptTarget.Latest,
749
+ true,
750
+ file.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS,
751
+ );
752
+ const edits: Edit[] = [];
753
+ const rel = path.relative(root, file).split(path.sep).join("/");
754
+
755
+ for (const found of findImports(source)) {
756
+ const specifier = found.literal.text;
757
+ if (!specifier.startsWith("@decocms/")) continue;
758
+ if (
759
+ specifier === "@decocms/blocks/hooks" &&
760
+ found.names.some((n) => IMAGE_COMPONENTS.includes(n) || IMAGE_URL_NAMES.includes(n))
761
+ ) {
762
+ usesImages = true;
763
+ }
764
+ const replace = (to: string) =>
765
+ edits.push({
766
+ start: found.literal.getStart(source) + 1,
767
+ end: found.literal.getEnd() - 1,
768
+ text: to,
769
+ });
770
+
771
+ // 1. A vendored module: import the copy.
772
+ const target = resolvePackageFile(root, specifier);
773
+ const copy = target ? vendored.get(target) : undefined;
774
+ if (copy) {
775
+ replace(relativeSpecifier(file, copy));
776
+ continue;
777
+ }
778
+
779
+ // 1b. v7's commerce types and helpers: the same file under @decocms/compat-v7/commerce.
780
+ const commerce = compatCommerceSpecifier(specifier);
781
+ if (commerce) {
782
+ replace(commerce);
783
+ const set = moved.get("@decocms/compat-v7/commerce/*") ?? new Set();
784
+ set.add(specifier.replace(/^@decocms\/(apps-commerce|apps\/commerce)\//, ""));
785
+ moved.set("@decocms/compat-v7/commerce/*", set);
786
+ continue;
787
+ }
788
+
789
+ // 2. createInstrumentedFetch moved to @decocms/blocks/fetch, options-only.
790
+ const decl = found.declaration;
791
+ const bindings = decl?.importClause?.namedBindings;
792
+ if (
793
+ specifier === "@decocms/blocks/sdk/instrumentedFetch" &&
794
+ decl &&
795
+ !decl.importClause?.isTypeOnly &&
796
+ !decl.importClause?.name &&
797
+ bindings &&
798
+ ts.isNamedImports(bindings) &&
799
+ bindings.elements.length === 1 &&
800
+ (bindings.elements[0].propertyName ?? bindings.elements[0].name).text ===
801
+ "createInstrumentedFetch"
802
+ ) {
803
+ const calls = instrumentedFetchCalls(source, bindings.elements[0].name.text);
804
+ if (calls) {
805
+ replace("@decocms/blocks/fetch");
806
+ for (const call of calls) {
807
+ const arg = call.arguments[0];
808
+ edits.push({
809
+ start: arg.getStart(source),
810
+ end: arg.getEnd(),
811
+ text: `{ provider: ${arg.getText(source)} }`,
812
+ });
813
+ }
814
+ continue;
815
+ }
816
+ }
817
+
818
+ // 3. Names a v8 binding exports unchanged: point them at it, splitting the declaration.
819
+ let names = found.names;
820
+ const move = MOVES[specifier];
821
+ if (
822
+ move &&
823
+ (!move.only || move.only === framework) &&
824
+ decl &&
825
+ !decl.importClause?.name &&
826
+ bindings &&
827
+ ts.isNamedImports(bindings)
828
+ ) {
829
+ const byTarget = new Map<string, ts.ImportSpecifier[]>();
830
+ const rest: ts.ImportSpecifier[] = [];
831
+ for (const el of bindings.elements) {
832
+ const to = move.names[(el.propertyName ?? el.name).text];
833
+ const target = typeof to === "string" ? to : framework && to?.[framework];
834
+ if (target) byTarget.set(target, [...(byTarget.get(target) ?? []), el]);
835
+ else rest.push(el);
836
+ }
837
+ if (byTarget.size > 0) {
838
+ const typeOnly = decl.importClause?.isTypeOnly ? "type " : "";
839
+ const quote = found.literal.getText(source)[0];
840
+ const line = (els: ts.ImportSpecifier[], from: string) =>
841
+ `import ${typeOnly}{ ${els.map((el) => el.getText(source)).join(", ")} } from ${quote}${from}${quote};`;
842
+ const lines = [...byTarget].map(([target, els]) => line(els, target));
843
+ if (rest.length > 0) lines.push(line(rest, specifier));
844
+ edits.push({ start: decl.getStart(source), end: decl.getEnd(), text: lines.join("\n") });
845
+ for (const [target, els] of byTarget) {
846
+ const set = moved.get(target) ?? new Set();
847
+ for (const el of els) set.add((el.propertyName ?? el.name).text);
848
+ moved.set(target, set);
849
+ }
850
+ names = rest.map((el) => (el.propertyName ?? el.name).text);
851
+ if (names.length === 0) continue;
852
+ }
853
+ }
854
+
855
+ // 4. The next major's documented API: nothing to do.
856
+ const left = undocumented(specifier, names);
857
+ if (left.length === 0) continue;
858
+
859
+ // 5. Everything else: report, by hint.
860
+ const where = `${rel}:${source.getLineAndCharacterOfPosition(found.literal.getStart(source)).line + 1}`;
861
+ for (const [hint, group] of hintsFor(specifier, left)) {
862
+ const key = `${specifier}\0${hint}`;
863
+ const entry = reported.get(key) ?? { names: new Set(), files: new Set() };
864
+ for (const n of group) entry.names.add(n);
865
+ entry.files.add(where);
866
+ reported.set(key, entry);
867
+ }
868
+ }
869
+
870
+ if (edits.length > 0) {
871
+ let out = text;
872
+ for (const edit of edits.sort((a, b) => b.start - a.start)) {
873
+ out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);
874
+ }
875
+ fs.writeFileSync(file, out);
876
+ rewrittenFiles++;
877
+ }
878
+ }
879
+
880
+ if (rewrittenFiles > 0) {
881
+ report.done.push({
882
+ step: "imports",
883
+ subject: "src/",
884
+ message: `rewrote imports in ${rewrittenFiles} files`,
885
+ });
886
+ }
887
+ for (const [target, names] of [...moved].sort(([a], [b]) => (a < b ? -1 : 1))) {
888
+ report.done.push({
889
+ step: "imports",
890
+ subject: target,
891
+ message: target.startsWith("@decocms/compat-v7/commerce")
892
+ ? `${[...names].join(", ")} from @decocms/apps-commerce are the same files under @decocms/compat-v7/commerce (v7's types and helpers, with v7's output)`
893
+ : target.startsWith("@decocms/compat-v7")
894
+ ? `${[...names].join(", ")} now come from @decocms/compat-v7 (v7's own helpers, with v7's output)`
895
+ : `${[...names].join(", ")} now come from the v8 binding`,
896
+ });
897
+ }
898
+ const contextDevice = [
899
+ ...(moved.get("@decocms/compat-v7/tanstack") ?? []),
900
+ ...(moved.get("@decocms/compat-v7/nextjs") ?? []),
901
+ ];
902
+ if (contextDevice.includes("useDevice") || contextDevice.includes("DeviceProvider")) {
903
+ report.manual.push({
904
+ step: "imports",
905
+ subject: "useDevice",
906
+ message: `v7 seeded it from its request scope, which v8 has none of: render the page under <DeviceProvider value={device}> from @decocms/compat-v7/${framework}, with device = ${framework === "tanstack" ? "requestDevice()" : "await requestDevice()"} from @decocms/compat-v7/${framework}/server returned with the page's data, so the server and the browser render the same device; without a provider the server renders "desktop"`,
907
+ });
908
+ }
909
+ if (framework === "tanstack" && usesImages) {
910
+ const plan = imageModule(version, images);
911
+ writeImageUrl(
912
+ root,
913
+ report,
914
+ plan,
915
+ `they take their URLs from ImageUrlProvider (@decocms/tanstack/react) now, and @decocms/tanstack knows no commerce platform: without a provider every source goes through the Deco image CDN, where v7 resized VTEX catalog and Shopify images on their own hosts. The script couldn't write src/imageUrl.ts (${plan.reason}): write imageUrl = ${imageUrl}, and wrap every page in <ImageUrlProvider value={imageUrl}> through createDecoRouter's Wrap option, so every URL stays v7's`,
916
+ );
917
+ }
918
+ for (const copy of images.copies) {
919
+ const url = copyImageUrl(copy, images.registered);
920
+ report.manual.push({
921
+ step: "imports",
922
+ subject: copy.file,
923
+ message: url
924
+ ? `a copy of v7's image helper (getOptimizedMediaUrl): on v8, imageUrl = ${url}. url(src, { width, height, fit }) and srcSet(url, src, …) from @decocms/blocks/image replace its getOptimizedMediaUrl and getSrcSet, and on TanStack Start its Image, Picture and Source are @decocms/tanstack/react's under <ImageUrlProvider value={imageUrl}>. One difference, approved: an already-resized Deco CDN URL in the content (https://assets.decocms.com/image?…&src=…) is re-resized from its src, where the copy wrote src=image`
925
+ : "a copy of v7's image helper (getOptimizedMediaUrl) whose URL rules the script can't read (it was edited): compare its URLs with createImageUrl's before replacing it, and pick the decoCdn options that reproduce them (references/framework-code.md)",
926
+ });
927
+ }
928
+ if (stripsAnywhere) reportLeadingStrip(root, report, readCopy?.file);
929
+ const resolved = [...reported].map(
930
+ ([key, entry]) => [key.replaceAll(V7_IMAGE_URL, imageUrl), entry] as const,
931
+ );
932
+ for (const [key, { names, files }] of resolved.sort(([a], [b]) => (a < b ? -1 : 1))) {
933
+ const [specifier, hint] = key.split("\0");
934
+ const list = [...files];
935
+ const where = `${list.slice(0, 3).join(", ")}${list.length > 3 ? `, +${list.length - 3} more` : ""}`;
936
+ report.manual.push({
937
+ step: "imports",
938
+ subject: `${specifier} {${[...names].join(", ")}}`,
939
+ message: `${hint}; in ${where}`,
940
+ });
941
+ }
942
+ }