@decocms/blocks 8.1.0-next.1 → 8.1.0-next.2

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 (384) hide show
  1. package/bin/deco.js +5 -12
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +4 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/protocol/assets.d.ts +46 -0
  7. package/dist/protocol/assets.d.ts.map +1 -0
  8. package/dist/protocol/assets.js +105 -0
  9. package/dist/protocol/assets.js.map +1 -0
  10. package/dist/protocol/canonical.d.ts +8 -0
  11. package/dist/protocol/canonical.d.ts.map +1 -0
  12. package/dist/protocol/canonical.js +8 -0
  13. package/dist/protocol/canonical.js.map +1 -0
  14. package/dist/protocol/ciphertext.d.ts +7 -0
  15. package/dist/protocol/ciphertext.d.ts.map +1 -0
  16. package/dist/protocol/ciphertext.js +7 -0
  17. package/dist/protocol/ciphertext.js.map +1 -0
  18. package/dist/protocol/client.d.ts +54 -0
  19. package/dist/protocol/client.d.ts.map +1 -0
  20. package/dist/protocol/client.js +104 -0
  21. package/dist/protocol/client.js.map +1 -0
  22. package/dist/protocol/conformance/cases/assets.d.ts +3 -0
  23. package/dist/protocol/conformance/cases/assets.d.ts.map +1 -0
  24. package/dist/protocol/conformance/cases/assets.js +71 -0
  25. package/dist/protocol/conformance/cases/assets.js.map +1 -0
  26. package/dist/protocol/conformance/cases/guards.d.ts +3 -0
  27. package/dist/protocol/conformance/cases/guards.d.ts.map +1 -0
  28. package/dist/protocol/conformance/cases/guards.js +265 -0
  29. package/dist/protocol/conformance/cases/guards.js.map +1 -0
  30. package/dist/protocol/conformance/cases/reads.d.ts +3 -0
  31. package/dist/protocol/conformance/cases/reads.d.ts.map +1 -0
  32. package/dist/protocol/conformance/cases/reads.js +140 -0
  33. package/dist/protocol/conformance/cases/reads.js.map +1 -0
  34. package/dist/protocol/conformance/cases/types.d.ts +9 -0
  35. package/dist/protocol/conformance/cases/types.d.ts.map +1 -0
  36. package/dist/protocol/conformance/cases/types.js +2 -0
  37. package/dist/protocol/conformance/cases/types.js.map +1 -0
  38. package/dist/protocol/conformance/cases/wire.d.ts +3 -0
  39. package/dist/protocol/conformance/cases/wire.d.ts.map +1 -0
  40. package/dist/protocol/conformance/cases/wire.js +130 -0
  41. package/dist/protocol/conformance/cases/wire.js.map +1 -0
  42. package/dist/protocol/conformance/cases/writes.d.ts +3 -0
  43. package/dist/protocol/conformance/cases/writes.d.ts.map +1 -0
  44. package/dist/protocol/conformance/cases/writes.js +278 -0
  45. package/dist/protocol/conformance/cases/writes.js.map +1 -0
  46. package/dist/protocol/conformance/contentHashFixtures.d.ts +22 -0
  47. package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -0
  48. package/dist/protocol/conformance/contentHashFixtures.js +64 -0
  49. package/dist/protocol/conformance/contentHashFixtures.js.map +1 -0
  50. package/dist/protocol/conformance/context.d.ts +100 -0
  51. package/dist/protocol/conformance/context.d.ts.map +1 -0
  52. package/dist/protocol/conformance/context.js +155 -0
  53. package/dist/protocol/conformance/context.js.map +1 -0
  54. package/dist/protocol/conformance/index.d.ts +32 -0
  55. package/dist/protocol/conformance/index.d.ts.map +1 -0
  56. package/dist/protocol/conformance/index.js +90 -0
  57. package/dist/protocol/conformance/index.js.map +1 -0
  58. package/dist/protocol/errors.d.ts +85 -0
  59. package/dist/protocol/errors.d.ts.map +1 -0
  60. package/dist/protocol/errors.js +62 -0
  61. package/dist/protocol/errors.js.map +1 -0
  62. package/dist/protocol/index.d.ts +25 -0
  63. package/dist/protocol/index.d.ts.map +1 -0
  64. package/dist/protocol/index.js +25 -0
  65. package/dist/protocol/index.js.map +1 -0
  66. package/dist/protocol/keys.d.ts +101 -0
  67. package/dist/protocol/keys.d.ts.map +1 -0
  68. package/dist/protocol/keys.js +223 -0
  69. package/dist/protocol/keys.js.map +1 -0
  70. package/dist/protocol/params.d.ts +10 -0
  71. package/dist/protocol/params.d.ts.map +1 -0
  72. package/dist/protocol/params.js +54 -0
  73. package/dist/protocol/params.js.map +1 -0
  74. package/dist/protocol/secrets.d.ts +22 -0
  75. package/dist/protocol/secrets.d.ts.map +1 -0
  76. package/dist/protocol/secrets.js +200 -0
  77. package/dist/protocol/secrets.js.map +1 -0
  78. package/dist/protocol/server/assets.d.ts +20 -0
  79. package/dist/protocol/server/assets.d.ts.map +1 -0
  80. package/dist/protocol/server/assets.js +77 -0
  81. package/dist/protocol/server/assets.js.map +1 -0
  82. package/dist/protocol/server/auth.d.ts +31 -0
  83. package/dist/protocol/server/auth.d.ts.map +1 -0
  84. package/dist/protocol/server/auth.js +32 -0
  85. package/dist/protocol/server/auth.js.map +1 -0
  86. package/dist/protocol/server/bodyCache.d.ts +28 -0
  87. package/dist/protocol/server/bodyCache.d.ts.map +1 -0
  88. package/dist/protocol/server/bodyCache.js +75 -0
  89. package/dist/protocol/server/bodyCache.js.map +1 -0
  90. package/dist/protocol/server/content.d.ts +44 -0
  91. package/dist/protocol/server/content.d.ts.map +1 -0
  92. package/dist/protocol/server/content.js +132 -0
  93. package/dist/protocol/server/content.js.map +1 -0
  94. package/dist/protocol/server/core.d.ts +63 -0
  95. package/dist/protocol/server/core.d.ts.map +1 -0
  96. package/dist/protocol/server/core.js +77 -0
  97. package/dist/protocol/server/core.js.map +1 -0
  98. package/dist/protocol/server/handler.d.ts +5 -0
  99. package/dist/protocol/server/handler.d.ts.map +1 -0
  100. package/dist/protocol/server/handler.js +70 -0
  101. package/dist/protocol/server/handler.js.map +1 -0
  102. package/dist/protocol/server/http.d.ts +24 -0
  103. package/dist/protocol/server/http.d.ts.map +1 -0
  104. package/dist/protocol/server/http.js +133 -0
  105. package/dist/protocol/server/http.js.map +1 -0
  106. package/dist/protocol/server/index.d.ts +11 -0
  107. package/dist/protocol/server/index.d.ts.map +1 -0
  108. package/dist/protocol/server/index.js +9 -0
  109. package/dist/protocol/server/index.js.map +1 -0
  110. package/dist/protocol/server/methods/apply.d.ts +4 -0
  111. package/dist/protocol/server/methods/apply.d.ts.map +1 -0
  112. package/dist/protocol/server/methods/apply.js +275 -0
  113. package/dist/protocol/server/methods/apply.js.map +1 -0
  114. package/dist/protocol/server/methods/read.d.ts +14 -0
  115. package/dist/protocol/server/methods/read.d.ts.map +1 -0
  116. package/dist/protocol/server/methods/read.js +132 -0
  117. package/dist/protocol/server/methods/read.js.map +1 -0
  118. package/dist/protocol/server/rpc.d.ts +7 -0
  119. package/dist/protocol/server/rpc.d.ts.map +1 -0
  120. package/dist/protocol/server/rpc.js +115 -0
  121. package/dist/protocol/server/rpc.js.map +1 -0
  122. package/dist/protocol/storage/fs/hash.d.ts +8 -0
  123. package/dist/protocol/storage/fs/hash.d.ts.map +1 -0
  124. package/dist/protocol/storage/fs/hash.js +20 -0
  125. package/dist/protocol/storage/fs/hash.js.map +1 -0
  126. package/dist/protocol/storage/fs/index.d.ts +30 -0
  127. package/dist/protocol/storage/fs/index.d.ts.map +1 -0
  128. package/dist/protocol/storage/fs/index.js +301 -0
  129. package/dist/protocol/storage/fs/index.js.map +1 -0
  130. package/dist/protocol/storage/fs/lock.d.ts +8 -0
  131. package/dist/protocol/storage/fs/lock.d.ts.map +1 -0
  132. package/dist/protocol/storage/fs/lock.js +61 -0
  133. package/dist/protocol/storage/fs/lock.js.map +1 -0
  134. package/dist/protocol/storage/fs/transaction.d.ts +19 -0
  135. package/dist/protocol/storage/fs/transaction.d.ts.map +1 -0
  136. package/dist/protocol/storage/fs/transaction.js +174 -0
  137. package/dist/protocol/storage/fs/transaction.js.map +1 -0
  138. package/dist/protocol/storage/fs/unsupported.d.ts +10 -0
  139. package/dist/protocol/storage/fs/unsupported.d.ts.map +1 -0
  140. package/dist/protocol/storage/fs/unsupported.js +4 -0
  141. package/dist/protocol/storage/fs/unsupported.js.map +1 -0
  142. package/dist/protocol/storage/memory.d.ts +40 -0
  143. package/dist/protocol/storage/memory.d.ts.map +1 -0
  144. package/dist/protocol/storage/memory.js +179 -0
  145. package/dist/protocol/storage/memory.js.map +1 -0
  146. package/dist/protocol/storage.d.ts +178 -0
  147. package/dist/protocol/storage.d.ts.map +1 -0
  148. package/dist/protocol/storage.js +29 -0
  149. package/dist/protocol/storage.js.map +1 -0
  150. package/dist/protocol/types.d.ts +194 -0
  151. package/dist/protocol/types.d.ts.map +1 -0
  152. package/dist/protocol/types.js +31 -0
  153. package/dist/protocol/types.js.map +1 -0
  154. package/dist/v8/analytics.d.ts +31 -0
  155. package/dist/v8/analytics.d.ts.map +1 -0
  156. package/dist/v8/analytics.js +46 -0
  157. package/dist/v8/analytics.js.map +1 -0
  158. package/dist/v8/background.d.ts +26 -0
  159. package/dist/v8/background.d.ts.map +1 -0
  160. package/dist/v8/background.js +95 -0
  161. package/dist/v8/background.js.map +1 -0
  162. package/dist/v8/builtins/data.d.ts +15 -0
  163. package/dist/v8/builtins/data.d.ts.map +1 -0
  164. package/dist/v8/builtins/data.js +18 -0
  165. package/dist/v8/builtins/data.js.map +1 -0
  166. package/dist/v8/builtins/index.d.ts +9 -0
  167. package/dist/v8/builtins/index.d.ts.map +1 -0
  168. package/dist/v8/builtins/index.js +24 -0
  169. package/dist/v8/builtins/index.js.map +1 -0
  170. package/dist/v8/builtins/lazy.d.ts +17 -0
  171. package/dist/v8/builtins/lazy.d.ts.map +1 -0
  172. package/dist/v8/builtins/lazy.js +13 -0
  173. package/dist/v8/builtins/lazy.js.map +1 -0
  174. package/dist/v8/builtins/legacy.d.ts +41 -0
  175. package/dist/v8/builtins/legacy.d.ts.map +1 -0
  176. package/dist/v8/builtins/legacy.js +62 -0
  177. package/dist/v8/builtins/legacy.js.map +1 -0
  178. package/dist/v8/builtins/matchers.d.ts +19 -0
  179. package/dist/v8/builtins/matchers.d.ts.map +1 -0
  180. package/dist/v8/builtins/matchers.js +24 -0
  181. package/dist/v8/builtins/matchers.js.map +1 -0
  182. package/dist/v8/builtins/multivariate.d.ts +15 -0
  183. package/dist/v8/builtins/multivariate.d.ts.map +1 -0
  184. package/dist/v8/builtins/multivariate.js +18 -0
  185. package/dist/v8/builtins/multivariate.js.map +1 -0
  186. package/dist/v8/builtins/secret.d.ts +7 -0
  187. package/dist/v8/builtins/secret.d.ts.map +1 -0
  188. package/dist/v8/builtins/secret.js +68 -0
  189. package/dist/v8/builtins/secret.js.map +1 -0
  190. package/dist/v8/canonical.d.ts +42 -0
  191. package/dist/v8/canonical.d.ts.map +1 -0
  192. package/dist/v8/canonical.js +111 -0
  193. package/dist/v8/canonical.js.map +1 -0
  194. package/dist/v8/ciphertext.d.ts +58 -0
  195. package/dist/v8/ciphertext.d.ts.map +1 -0
  196. package/dist/v8/ciphertext.js +134 -0
  197. package/dist/v8/ciphertext.js.map +1 -0
  198. package/dist/v8/cli/builtins.d.ts +11 -0
  199. package/dist/v8/cli/builtins.d.ts.map +1 -0
  200. package/dist/v8/cli/builtins.js +18 -0
  201. package/dist/v8/cli/builtins.js.map +1 -0
  202. package/dist/v8/cli/check/index.d.ts +41 -0
  203. package/dist/v8/cli/check/index.d.ts.map +1 -0
  204. package/dist/v8/cli/check/index.js +713 -0
  205. package/dist/v8/cli/check/index.js.map +1 -0
  206. package/dist/v8/cli/check/messages.d.ts +24 -0
  207. package/dist/v8/cli/check/messages.d.ts.map +1 -0
  208. package/dist/v8/cli/check/messages.js +150 -0
  209. package/dist/v8/cli/check/messages.js.map +1 -0
  210. package/dist/v8/cli/content.d.ts +60 -0
  211. package/dist/v8/cli/content.d.ts.map +1 -0
  212. package/dist/v8/cli/content.js +231 -0
  213. package/dist/v8/cli/content.js.map +1 -0
  214. package/dist/v8/cli/index.d.ts +18 -0
  215. package/dist/v8/cli/index.d.ts.map +1 -0
  216. package/dist/v8/cli/index.js +18 -0
  217. package/dist/v8/cli/index.js.map +1 -0
  218. package/dist/v8/cli/log.d.ts +9 -0
  219. package/dist/v8/cli/log.d.ts.map +1 -0
  220. package/dist/v8/cli/log.js +11 -0
  221. package/dist/v8/cli/log.js.map +1 -0
  222. package/dist/v8/cli/main.d.ts +2 -0
  223. package/dist/v8/cli/main.d.ts.map +1 -0
  224. package/dist/v8/cli/main.js +9 -0
  225. package/dist/v8/cli/main.js.map +1 -0
  226. package/dist/v8/cli/root.d.ts +28 -0
  227. package/dist/v8/cli/root.d.ts.map +1 -0
  228. package/dist/v8/cli/root.js +64 -0
  229. package/dist/v8/cli/root.js.map +1 -0
  230. package/dist/v8/cli/run.d.ts +13 -0
  231. package/dist/v8/cli/run.d.ts.map +1 -0
  232. package/dist/v8/cli/run.js +210 -0
  233. package/dist/v8/cli/run.js.map +1 -0
  234. package/dist/v8/cli/schema/builtinSchemas.d.ts +22 -0
  235. package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -0
  236. package/dist/v8/cli/schema/builtinSchemas.js +213 -0
  237. package/dist/v8/cli/schema/builtinSchemas.js.map +1 -0
  238. package/dist/v8/cli/schema/generate.d.ts +50 -0
  239. package/dist/v8/cli/schema/generate.d.ts.map +1 -0
  240. package/dist/v8/cli/schema/generate.js +415 -0
  241. package/dist/v8/cli/schema/generate.js.map +1 -0
  242. package/dist/v8/cli/schema/index.d.ts +21 -0
  243. package/dist/v8/cli/schema/index.d.ts.map +1 -0
  244. package/dist/v8/cli/schema/index.js +51 -0
  245. package/dist/v8/cli/schema/index.js.map +1 -0
  246. package/dist/v8/cli/schema/tsProgram.d.ts +120 -0
  247. package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -0
  248. package/dist/v8/cli/schema/tsProgram.js +418 -0
  249. package/dist/v8/cli/schema/tsProgram.js.map +1 -0
  250. package/dist/v8/cli/schema/typeToSchema.d.ts +81 -0
  251. package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -0
  252. package/dist/v8/cli/schema/typeToSchema.js +683 -0
  253. package/dist/v8/cli/schema/typeToSchema.js.map +1 -0
  254. package/dist/v8/cli/serve/server.d.ts +31 -0
  255. package/dist/v8/cli/serve/server.d.ts.map +1 -0
  256. package/dist/v8/cli/serve/server.js +247 -0
  257. package/dist/v8/cli/serve/server.js.map +1 -0
  258. package/dist/v8/cli/watch.d.ts +20 -0
  259. package/dist/v8/cli/watch.d.ts.map +1 -0
  260. package/dist/v8/cli/watch.js +79 -0
  261. package/dist/v8/cli/watch.js.map +1 -0
  262. package/dist/v8/client.d.ts +20 -0
  263. package/dist/v8/client.d.ts.map +1 -0
  264. package/dist/v8/client.js +115 -0
  265. package/dist/v8/client.js.map +1 -0
  266. package/dist/v8/cms.d.ts +9 -0
  267. package/dist/v8/cms.d.ts.map +1 -0
  268. package/dist/v8/cms.js +206 -0
  269. package/dist/v8/cms.js.map +1 -0
  270. package/dist/v8/content.d.ts +35 -0
  271. package/dist/v8/content.d.ts.map +1 -0
  272. package/dist/v8/content.js +183 -0
  273. package/dist/v8/content.js.map +1 -0
  274. package/dist/v8/draft.d.ts +44 -0
  275. package/dist/v8/draft.d.ts.map +1 -0
  276. package/dist/v8/draft.js +133 -0
  277. package/dist/v8/draft.js.map +1 -0
  278. package/dist/v8/errors.d.ts +21 -0
  279. package/dist/v8/errors.d.ts.map +1 -0
  280. package/dist/v8/errors.js +39 -0
  281. package/dist/v8/errors.js.map +1 -0
  282. package/dist/v8/fetch.d.ts +26 -0
  283. package/dist/v8/fetch.d.ts.map +1 -0
  284. package/dist/v8/fetch.js +98 -0
  285. package/dist/v8/fetch.js.map +1 -0
  286. package/dist/v8/identity.d.ts +19 -0
  287. package/dist/v8/identity.d.ts.map +1 -0
  288. package/dist/v8/identity.js +54 -0
  289. package/dist/v8/identity.js.map +1 -0
  290. package/dist/v8/index.d.ts +11 -0
  291. package/dist/v8/index.d.ts.map +1 -0
  292. package/dist/v8/index.js +10 -0
  293. package/dist/v8/index.js.map +1 -0
  294. package/dist/v8/json.d.ts +19 -0
  295. package/dist/v8/json.d.ts.map +1 -0
  296. package/dist/v8/json.js +65 -0
  297. package/dist/v8/json.js.map +1 -0
  298. package/dist/v8/matchRoute.d.ts +30 -0
  299. package/dist/v8/matchRoute.d.ts.map +1 -0
  300. package/dist/v8/matchRoute.js +175 -0
  301. package/dist/v8/matchRoute.js.map +1 -0
  302. package/dist/v8/remoteLoader.d.ts +16 -0
  303. package/dist/v8/remoteLoader.d.ts.map +1 -0
  304. package/dist/v8/remoteLoader.js +243 -0
  305. package/dist/v8/remoteLoader.js.map +1 -0
  306. package/dist/v8/resolver.d.ts +34 -0
  307. package/dist/v8/resolver.d.ts.map +1 -0
  308. package/dist/v8/resolver.js +219 -0
  309. package/dist/v8/resolver.js.map +1 -0
  310. package/dist/v8/secrets.d.ts +9 -0
  311. package/dist/v8/secrets.d.ts.map +1 -0
  312. package/dist/v8/secrets.js +14 -0
  313. package/dist/v8/secrets.js.map +1 -0
  314. package/dist/v8/telemetry.d.ts +61 -0
  315. package/dist/v8/telemetry.d.ts.map +1 -0
  316. package/dist/v8/telemetry.js +460 -0
  317. package/dist/v8/telemetry.js.map +1 -0
  318. package/dist/v8/types.d.ts +214 -0
  319. package/dist/v8/types.d.ts.map +1 -0
  320. package/dist/v8/types.js +2 -0
  321. package/dist/v8/types.js.map +1 -0
  322. package/package.json +64 -18
  323. package/src/index.ts +1 -1
  324. package/src/protocol/canonical.ts +1 -1
  325. package/src/protocol/ciphertext.ts +1 -1
  326. package/src/protocol/client.ts +2 -2
  327. package/src/protocol/conformance/cases/assets.ts +3 -3
  328. package/src/protocol/conformance/cases/guards.ts +4 -4
  329. package/src/protocol/conformance/cases/reads.ts +4 -4
  330. package/src/protocol/conformance/cases/types.ts +1 -1
  331. package/src/protocol/conformance/cases/wire.ts +4 -4
  332. package/src/protocol/conformance/cases/writes.ts +4 -4
  333. package/src/protocol/conformance/context.ts +4 -4
  334. package/src/protocol/conformance/index.ts +10 -10
  335. package/src/protocol/index.ts +6 -6
  336. package/src/protocol/params.ts +2 -2
  337. package/src/protocol/secrets.ts +3 -3
  338. package/src/protocol/server/assets.ts +6 -6
  339. package/src/protocol/server/auth.ts +1 -1
  340. package/src/protocol/server/content.ts +5 -5
  341. package/src/protocol/server/core.ts +12 -6
  342. package/src/protocol/server/handler.ts +6 -6
  343. package/src/protocol/server/http.ts +1 -1
  344. package/src/protocol/server/index.ts +3 -3
  345. package/src/protocol/server/methods/apply.ts +9 -9
  346. package/src/protocol/server/methods/read.ts +5 -5
  347. package/src/protocol/server/rpc.ts +6 -6
  348. package/src/protocol/storage/fs/index.ts +7 -7
  349. package/src/protocol/storage/fs/lock.ts +1 -1
  350. package/src/protocol/storage/fs/unsupported.ts +2 -2
  351. package/src/protocol/storage/memory.ts +4 -4
  352. package/src/protocol/storage.ts +1 -1
  353. package/src/v8/analytics.ts +2 -2
  354. package/src/v8/builtins/data.ts +1 -1
  355. package/src/v8/builtins/index.ts +6 -6
  356. package/src/v8/builtins/lazy.ts +1 -1
  357. package/src/v8/builtins/legacy.ts +1 -1
  358. package/src/v8/builtins/multivariate.ts +1 -1
  359. package/src/v8/builtins/secret.ts +2 -2
  360. package/src/v8/cli/builtins.ts +2 -2
  361. package/src/v8/cli/check/index.ts +11 -11
  362. package/src/v8/cli/content.ts +6 -6
  363. package/src/v8/cli/index.ts +7 -7
  364. package/src/v8/cli/main.ts +1 -1
  365. package/src/v8/cli/run.ts +7 -7
  366. package/src/v8/cli/schema/builtinSchemas.ts +1 -1
  367. package/src/v8/cli/schema/generate.ts +6 -6
  368. package/src/v8/cli/schema/index.ts +4 -4
  369. package/src/v8/cli/schema/tsProgram.ts +1 -1
  370. package/src/v8/cli/schema/typeToSchema.ts +24 -2
  371. package/src/v8/cli/serve/server.ts +9 -9
  372. package/src/v8/client.ts +5 -5
  373. package/src/v8/cms.ts +9 -9
  374. package/src/v8/content.ts +4 -4
  375. package/src/v8/draft.ts +1 -1
  376. package/src/v8/errors.ts +1 -1
  377. package/src/v8/fetch.ts +1 -1
  378. package/src/v8/identity.ts +1 -1
  379. package/src/v8/index.ts +5 -5
  380. package/src/v8/matchRoute.ts +1 -1
  381. package/src/v8/remoteLoader.ts +6 -6
  382. package/src/v8/resolver.ts +6 -6
  383. package/src/v8/secrets.ts +1 -1
  384. package/src/v8/telemetry.ts +5 -5
@@ -1,18 +1,24 @@
1
1
  /**
2
2
  * The shared state of one content handler: its storage, options and caches.
3
3
  */
4
- import { ContentProtocolError, invalidBlock, notFound, unavailable, unsupported } from "../errors";
5
- import { blockNameFromFile } from "../keys";
4
+ import {
5
+ ContentProtocolError,
6
+ invalidBlock,
7
+ notFound,
8
+ unavailable,
9
+ unsupported,
10
+ } from "../errors.ts";
11
+ import { blockNameFromFile } from "../keys.ts";
6
12
  import {
7
13
  type ContentStorage,
8
14
  type StorageDescription,
9
15
  StorageInvalidFileError,
10
16
  StorageNotFoundError,
11
17
  StorageUnavailableError,
12
- } from "../storage";
13
- import { DEFAULT_LIMITS, type DecoMeta, type Limits } from "../types";
14
- import type { AuthOptions } from "./auth";
15
- import { BodyCache } from "./bodyCache";
18
+ } from "../storage.ts";
19
+ import { DEFAULT_LIMITS, type DecoMeta, type Limits } from "../types.ts";
20
+ import type { AuthOptions } from "./auth.ts";
21
+ import { BodyCache } from "./bodyCache.ts";
16
22
 
17
23
  export interface ContentHandlerOptions extends AuthOptions {
18
24
  /** Reported by `describe`, such as `{ name: "deco-cli", version: "8.0.0" }`. */
@@ -23,18 +23,18 @@ import {
23
23
  limitExceeded,
24
24
  parseError,
25
25
  unauthorized,
26
- } from "../errors";
27
- import type { ContentStorage } from "../storage";
28
- import { assertAuthOptions, authenticate } from "./auth";
29
- import { type ContentHandlerOptions, Core } from "./core";
26
+ } from "../errors.ts";
27
+ import type { ContentStorage } from "../storage.ts";
28
+ import { assertAuthOptions, authenticate } from "./auth.ts";
29
+ import { type ContentHandlerOptions, Core } from "./core.ts";
30
30
  import {
31
31
  BodyEncodingError,
32
32
  BodyTooLargeError,
33
33
  isJsonContentType,
34
34
  jsonResponse,
35
35
  readBody,
36
- } from "./http";
37
- import { dispatch } from "./rpc";
36
+ } from "./http.ts";
37
+ import { dispatch } from "./rpc.ts";
38
38
 
39
39
  export type ContentHandler = (request: Request) => Promise<Response>;
40
40
 
@@ -4,7 +4,7 @@
4
4
  * only (Request, Response, CompressionStream), so it runs on Node, Bun,
5
5
  * Workers and Deno.
6
6
  */
7
- import { sha256Hex } from "../canonical";
7
+ import { sha256Hex } from "../canonical.ts";
8
8
 
9
9
  /** The body was larger than allowed (after decompression). */
10
10
  export class BodyTooLargeError extends Error {
@@ -6,6 +6,6 @@
6
6
  * and Deno. (`deco serve`'s asset uploads use `./assets`, which isn't public.)
7
7
  */
8
8
 
9
- export type { AuthOptions, AuthorizeResult } from "./auth";
10
- export type { ContentHandlerOptions } from "./core";
11
- export { type ContentHandler, createContentHandler } from "./handler";
9
+ export type { AuthOptions, AuthorizeResult } from "./auth.ts";
10
+ export type { ContentHandlerOptions } from "./core.ts";
11
+ export { type ContentHandler, createContentHandler } from "./handler.ts";
@@ -18,7 +18,7 @@
18
18
  * key reserved meanwhile) is retried against a new snapshot after a jittered
19
19
  * backoff, rechecking every guard, up to `maxCommitAttempts` times.
20
20
  */
21
- import { applyRequestDigest, canonicalJson } from "../../canonical";
21
+ import { applyRequestDigest, canonicalJson } from "../../canonical.ts";
22
22
  import {
23
23
  type BlockViolation,
24
24
  conflict,
@@ -29,7 +29,7 @@ import {
29
29
  unavailable,
30
30
  unsupported,
31
31
  type VersionMismatch,
32
- } from "../../errors";
32
+ } from "../../errors.ts";
33
33
  import {
34
34
  blockFileName,
35
35
  blockNameFromFile,
@@ -39,13 +39,13 @@ import {
39
39
  isBlockFileName,
40
40
  serializeBlock,
41
41
  spellingKey,
42
- } from "../../keys";
43
- import { checkSecrets } from "../../secrets";
44
- import type { StorageDescription, StoredReceipt } from "../../storage";
45
- import type { BlocksApplyParams, BlocksApplyResult, DecoMeta, Limits } from "../../types";
46
- import { type LoadedContent, type LoadedEntry, loadCurrentContent } from "../content";
47
- import type { Core } from "../core";
48
- import { parseSchema, readSchema } from "./read";
42
+ } from "../../keys.ts";
43
+ import { checkSecrets } from "../../secrets.ts";
44
+ import type { StorageDescription, StoredReceipt } from "../../storage.ts";
45
+ import type { BlocksApplyParams, BlocksApplyResult, DecoMeta, Limits } from "../../types.ts";
46
+ import { type LoadedContent, type LoadedEntry, loadCurrentContent } from "../content.ts";
47
+ import type { Core } from "../core.ts";
48
+ import { parseSchema, readSchema } from "./read.ts";
49
49
 
50
50
  const utf8 = new TextEncoder();
51
51
 
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The three read methods: `describe`, `schema.get` and `blocks.list`.
3
3
  */
4
- import { publicKeyDerFromPem } from "../../ciphertext";
5
- import { limitExceeded, notFound, unavailable } from "../../errors";
4
+ import { publicKeyDerFromPem } from "../../ciphertext.ts";
5
+ import { limitExceeded, notFound, unavailable } from "../../errors.ts";
6
6
  import {
7
7
  ASSETS_URL_PREFIX,
8
8
  type BlocksListResult,
@@ -13,9 +13,9 @@ import {
13
13
  type ReadParams,
14
14
  SCHEMA_FORMAT,
15
15
  type SchemaGetResult,
16
- } from "../../types";
17
- import { loadCurrentContent } from "../content";
18
- import type { Core } from "../core";
16
+ } from "../../types.ts";
17
+ import { loadCurrentContent } from "../content.ts";
18
+ import type { Core } from "../core.ts";
19
19
 
20
20
  const DEFAULT_SERVER = { name: "deco-blocks", version: "unknown" };
21
21
 
@@ -15,12 +15,12 @@ import {
15
15
  invalidRequest,
16
16
  limitExceeded,
17
17
  methodNotFound,
18
- } from "../errors";
19
- import { validateParams } from "../params";
20
- import { MAX_BATCH_CALLS, METHOD_NAMES, type MethodName, type RpcId } from "../types";
21
- import { type Core, toProtocolError } from "./core";
22
- import { blocksApply } from "./methods/apply";
23
- import { blocksList, describe, schemaGet } from "./methods/read";
18
+ } from "../errors.ts";
19
+ import { validateParams } from "../params.ts";
20
+ import { MAX_BATCH_CALLS, METHOD_NAMES, type MethodName, type RpcId } from "../types.ts";
21
+ import { type Core, toProtocolError } from "./core.ts";
22
+ import { blocksApply } from "./methods/apply.ts";
23
+ import { blocksList, describe, schemaGet } from "./methods/read.ts";
24
24
 
25
25
  const utf8 = new TextEncoder();
26
26
 
@@ -21,8 +21,8 @@
21
21
  */
22
22
  import { lstat, mkdir, open, readdir, readFile, stat } from "node:fs/promises";
23
23
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
24
- import { suffixedAssetName } from "../../assets";
25
- import { isBlockFileName } from "../../keys";
24
+ import { suffixedAssetName } from "../../assets.ts";
25
+ import { isBlockFileName } from "../../keys.ts";
26
26
  import {
27
27
  type CommitResult,
28
28
  type ContentStorage,
@@ -34,11 +34,11 @@ import {
34
34
  StorageUnavailableError,
35
35
  type StoredFileBody,
36
36
  type StoredSchema,
37
- } from "../../storage";
38
- import type { Limits } from "../../types";
39
- import { gitBlobHash, revisionOf } from "./hash";
40
- import { withCommitLock } from "./lock";
41
- import { applyFileChange, sweepStaleTransactions } from "./transaction";
37
+ } from "../../storage.ts";
38
+ import type { Limits } from "../../types.ts";
39
+ import { gitBlobHash, revisionOf } from "./hash.ts";
40
+ import { withCommitLock } from "./lock.ts";
41
+ import { applyFileChange, sweepStaleTransactions } from "./transaction.ts";
42
42
 
43
43
  export interface FsStorageOptions {
44
44
  /** The app root: the folder that contains `.deco/`. */
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { open, rm, stat } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
- import { StorageUnavailableError } from "../../storage";
8
+ import { StorageUnavailableError } from "../../storage.ts";
9
9
 
10
10
  const LOCK_FILE = ".blocks.lock";
11
11
  const queues = new Map<string, Promise<unknown>>();
@@ -4,9 +4,9 @@
4
4
  * filesystem storage needs `node:fs`; on Workers or in a browser, implement
5
5
  * `ContentStorage` over the storage you have instead.
6
6
  */
7
- import type { createFsStorage as nodeCreateFsStorage } from "./index";
7
+ import type { createFsStorage as nodeCreateFsStorage } from "./index.ts";
8
8
 
9
- export type { FsStorage, FsStorageOptions } from "./index";
9
+ export type { FsStorage, FsStorageOptions } from "./index.ts";
10
10
 
11
11
  export const createFsStorage: typeof nodeCreateFsStorage = () => {
12
12
  throw new Error(
@@ -6,9 +6,9 @@
6
6
  * for tests: its state can be dumped and restored to simulate a restart, and
7
7
  * hooks let a test change files between a snapshot and a commit. Browser-safe.
8
8
  */
9
- import { suffixedAssetName } from "../assets";
10
- import { sha256Hex } from "../canonical";
11
- import { isBlockFileName } from "../keys";
9
+ import { suffixedAssetName } from "../assets.ts";
10
+ import { sha256Hex } from "../canonical.ts";
11
+ import { isBlockFileName } from "../keys.ts";
12
12
  import {
13
13
  type CommitAttempt,
14
14
  type CommitResult,
@@ -20,7 +20,7 @@ import {
20
20
  type StoredFileBody,
21
21
  type StoredReceipt,
22
22
  type StoredSchema,
23
- } from "../storage";
23
+ } from "../storage.ts";
24
24
 
25
25
  const DAY_MS = 24 * 60 * 60 * 1000;
26
26
 
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Browser-safe: types and small error classes only.
12
12
  */
13
- import type { Limits, StorageKind } from "./types";
13
+ import type { Limits, StorageKind } from "./types.ts";
14
14
 
15
15
  /** What a storage tells `describe`. */
16
16
  export interface StorageDescription {
@@ -17,8 +17,8 @@
17
17
  * `navigator.sendBeacon` or a `POST`.
18
18
  */
19
19
  import { createElement, type ReactNode } from "react";
20
- import { HOSTED_ANALYTICS_COLLECTOR } from "./builtins/data";
21
- import type { Analytics } from "./types";
20
+ import { HOSTED_ANALYTICS_COLLECTOR } from "./builtins/data.ts";
21
+ import type { Analytics } from "./types.ts";
22
22
 
23
23
  const GLOBAL = "__decoAnalytics";
24
24
 
@@ -1,4 +1,4 @@
1
- import type { Analytics, Redirect, Telemetry } from "../types";
1
+ import type { Analytics, Redirect, Telemetry } from "../types.ts";
2
2
 
3
3
  /** The hosted Deco CMS collector: where page views go when `collector` is left out. */
4
4
  export const HOSTED_ANALYTICS_COLLECTOR = "https://d.lilstts.com/events";
@@ -1,9 +1,9 @@
1
- import type { BlockFunction } from "../types";
2
- import { analytics, page, redirect, telemetry } from "./data";
3
- import { lazy } from "./lazy";
4
- import { always, date, never } from "./matchers";
5
- import { multivariate } from "./multivariate";
6
- import { secretBlock } from "./secret";
1
+ import type { BlockFunction } from "../types.ts";
2
+ import { analytics, page, redirect, telemetry } from "./data.ts";
3
+ import { lazy } from "./lazy.ts";
4
+ import { always, date, never } from "./matchers.ts";
5
+ import { multivariate } from "./multivariate.ts";
6
+ import { secretBlock } from "./secret.ts";
7
7
 
8
8
  /**
9
9
  * The built-in blocks every block map gets. `secret` here has no key, so it
@@ -1,4 +1,4 @@
1
- import type { Lazy } from "../types";
1
+ import type { Lazy } from "../types.ts";
2
2
 
3
3
  /** Marks the built-in `lazy` function, the resolver's one special case. */
4
4
  const LAZY_BLOCK: unique symbol = Symbol.for("decocms.blocks.v8.lazy");
@@ -16,7 +16,7 @@
16
16
  * - Legacy variants are saved as plain values; on the way to `multivariate`
17
17
  * each one is wrapped in a `lazy` block, so only the chosen one runs.
18
18
  */
19
- import { isPlainObject, type JsonObject } from "../json";
19
+ import { isPlainObject, type JsonObject } from "../json.ts";
20
20
 
21
21
  /**
22
22
  * Legacy type name → built-in. The one table: the runtime falls back to it,
@@ -1,4 +1,4 @@
1
- import type { Variant } from "../types";
1
+ import type { Variant } from "../types.ts";
2
2
 
3
3
  interface MultivariateProps<T> {
4
4
  variants?: Variant<T>[];
@@ -17,8 +17,8 @@
17
17
  * telemetry). A decrypted value stays on the server because it's resolved
18
18
  * there; tainting it (React's taint API) is up to the site's own code.
19
19
  */
20
- import { parseCiphertext } from "../ciphertext";
21
- import type { BlockFunction } from "../types";
20
+ import { parseCiphertext } from "../ciphertext.ts";
21
+ import type { BlockFunction } from "../types.ts";
22
22
 
23
23
  /** True in a browser, where a secret must never be decrypted. */
24
24
  function inBrowser(): boolean {
@@ -2,7 +2,7 @@
2
2
  * Names the CLI knows without reading any code: the built-in blocks (the
3
3
  * core's reserved names) and the legacy alias table.
4
4
  */
5
- import { RESERVED_NAMES } from "../builtins";
5
+ import { RESERVED_NAMES } from "../builtins/index.ts";
6
6
 
7
7
  /** Spec: built-in-blocks. Every block map gets these, in this order. */
8
8
  export const BUILT_IN_BLOCKS: readonly string[] = [...RESERVED_NAMES];
@@ -17,4 +17,4 @@ export function isBuiltIn(name: string): boolean {
17
17
  * editor's special screens still look types up by these names (spec:
18
18
  * studio-compatibility › Well-known types and the alias table).
19
19
  */
20
- export { LEGACY_ALIASES, storesPlainVariants } from "../builtins/legacy";
20
+ export { LEGACY_ALIASES, storesPlainVariants } from "../builtins/legacy.ts";
@@ -18,17 +18,17 @@
18
18
  */
19
19
 
20
20
  import fs from "node:fs";
21
- import Ajv, { type ValidateFunction } from "ajv";
22
- import { isWellFormedCiphertext } from "../../../protocol/secrets";
23
- import { isBlock, own } from "../../json";
24
- import { findRouteConflicts } from "../../matchRoute";
25
- import { isBuiltIn, storesPlainVariants } from "../builtins";
26
- import { readSavedBlocks, type SavedBlocks } from "../content";
27
- import { consoleReporter, type Reporter } from "../log";
28
- import { CliError, decoPaths, findDecoRoot } from "../root";
29
- import type { DecoMeta } from "../schema/generate";
30
- import { SECTION_REF_KEY, toBase64 } from "../schema/typeToSchema";
31
- import { BLOCK_DEF, joinPath, rewriteErrors } from "./messages";
21
+ import { Ajv, type ValidateFunction } from "ajv";
22
+ import { isWellFormedCiphertext } from "../../../protocol/secrets.ts";
23
+ import { isBlock, own } from "../../json.ts";
24
+ import { findRouteConflicts } from "../../matchRoute.ts";
25
+ import { isBuiltIn, storesPlainVariants } from "../builtins.ts";
26
+ import { readSavedBlocks, type SavedBlocks } from "../content.ts";
27
+ import { consoleReporter, type Reporter } from "../log.ts";
28
+ import { CliError, decoPaths, findDecoRoot } from "../root.ts";
29
+ import type { DecoMeta } from "../schema/generate.ts";
30
+ import { SECTION_REF_KEY, toBase64 } from "../schema/typeToSchema.ts";
31
+ import { BLOCK_DEF, joinPath, rewriteErrors } from "./messages.ts";
32
32
 
33
33
  export interface Problem {
34
34
  /** The saved block's file, relative to the root: `.deco/blocks/HomePage.json`. */
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import fs from "node:fs";
7
7
  import path from "node:path";
8
- import { computeContentRevision } from "../../protocol/canonical";
8
+ import { computeContentRevision } from "../../protocol/canonical.ts";
9
9
  import {
10
10
  blockNameFromFile,
11
11
  checkBlockName,
@@ -13,11 +13,11 @@ import {
13
13
  isBlockFileName,
14
14
  resolveSpellings,
15
15
  type SpellingCandidate,
16
- } from "../../protocol/keys";
17
- import { isPlainObject } from "../json";
18
- import { LEGACY_ALIASES } from "./builtins";
19
- import { consoleReporter, type Reporter } from "./log";
20
- import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "./root";
16
+ } from "../../protocol/keys.ts";
17
+ import { isPlainObject } from "../json.ts";
18
+ import { LEGACY_ALIASES } from "./builtins.ts";
19
+ import { consoleReporter, type Reporter } from "./log.ts";
20
+ import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "./root.ts";
21
21
 
22
22
  export interface ContentDiagnostic {
23
23
  /** The file name inside `.deco/blocks`. */
@@ -8,10 +8,10 @@
8
8
  * (the `deco-v7-to-v8-migration` skill) reads: the built-in block names, the alias
9
9
  * table and the saved-blocks reader.
10
10
  */
11
- export { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "./builtins";
12
- export { type CheckOptions, check } from "./check/index";
13
- export { type ContentOptions, content, readSavedBlocks, type SavedBlocks } from "./content";
14
- export { type Reporter, silentReporter } from "./log";
15
- export { runCli } from "./run";
16
- export { type SchemaOptions, schema } from "./schema/index";
17
- export { type ServeOptions, serve } from "./serve/server";
11
+ export { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "./builtins.ts";
12
+ export { type CheckOptions, check } from "./check/index.ts";
13
+ export { type ContentOptions, content, readSavedBlocks, type SavedBlocks } from "./content.ts";
14
+ export { type Reporter, silentReporter } from "./log.ts";
15
+ export { runCli } from "./run.ts";
16
+ export { type SchemaOptions, schema } from "./schema/index.ts";
17
+ export { type ServeOptions, serve } from "./serve/server.ts";
@@ -1,5 +1,5 @@
1
1
  /** The `deco` bin's entry: run the command line, then exit with its code. */
2
- import { runCli } from "./run";
2
+ import { runCli } from "./run.ts";
3
3
 
4
4
  runCli(process.argv.slice(2)).then(
5
5
  (code) => {
package/src/v8/cli/run.ts CHANGED
@@ -2,13 +2,13 @@
2
2
  * The `deco` command line: `deco <schema|content|check|serve> [flags]`
3
3
  * (spec: cli). Parses flags, runs one command and returns its exit code.
4
4
  */
5
- import { check } from "./check/index";
6
- import { content, writeContent } from "./content";
7
- import { consoleReporter, type Reporter } from "./log";
8
- import { CliError, decoPaths, findDecoRoot } from "./root";
9
- import { reportSchema, schema, writeSchema } from "./schema/index";
10
- import { serve, startServer } from "./serve/server";
11
- import { watchFiles, watchTree } from "./watch";
5
+ import { check } from "./check/index.ts";
6
+ import { content, writeContent } from "./content.ts";
7
+ import { consoleReporter, type Reporter } from "./log.ts";
8
+ import { CliError, decoPaths, findDecoRoot } from "./root.ts";
9
+ import { reportSchema, schema, writeSchema } from "./schema/index.ts";
10
+ import { serve, startServer } from "./serve/server.ts";
11
+ import { watchFiles, watchTree } from "./watch.ts";
12
12
 
13
13
  type FlagKind = "string" | "boolean" | "list";
14
14
 
@@ -3,7 +3,7 @@
3
3
  * in api-reference › Types). They're always in the schema, unless the block
4
4
  * map declares the same key, which replaces the built-in.
5
5
  */
6
- import { lazySchema, resolvableRef, sectionRef } from "./typeToSchema";
6
+ import { lazySchema, resolvableRef, sectionRef } from "./typeToSchema.ts";
7
7
 
8
8
  export type ManifestGroup = "sections" | "matchers" | "loaders" | "pages" | "redirects" | "content";
9
9
 
@@ -12,17 +12,17 @@
12
12
  */
13
13
  import fs from "node:fs";
14
14
  import path from "node:path";
15
- import { SCHEMA_FORMAT } from "../../../protocol/types";
16
- import { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "../builtins";
17
- import { CliError, type DecoPaths, packageVersion } from "../root";
15
+ import { SCHEMA_FORMAT } from "../../../protocol/types.ts";
16
+ import { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "../builtins.ts";
17
+ import { CliError, type DecoPaths, packageVersion } from "../root.ts";
18
18
  import {
19
19
  BUILT_IN_GROUPS,
20
20
  builtInDefinition,
21
21
  flatDefinition,
22
22
  legacyMultivariateValue,
23
23
  type ManifestGroup,
24
- } from "./builtinSchemas";
25
- import { createTsProject, type TsNode as Node, type TsType as Type } from "./tsProgram";
24
+ } from "./builtinSchemas.ts";
25
+ import { createTsProject, type TsNode as Node, type TsType as Type } from "./tsProgram.ts";
26
26
  import {
27
27
  awaitedOf,
28
28
  getJsDocTags,
@@ -35,7 +35,7 @@ import {
35
35
  stableFileId,
36
36
  toBase64,
37
37
  typeToJsonSchema,
38
- } from "./typeToSchema";
38
+ } from "./typeToSchema.ts";
39
39
 
40
40
  const MANIFEST_GROUPS: ManifestGroup[] = [
41
41
  "sections",
@@ -1,8 +1,8 @@
1
1
  import path from "node:path";
2
- import { writeIfChanged } from "../content";
3
- import { consoleReporter, type Reporter } from "../log";
4
- import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "../root";
5
- import { generateSchema, type SchemaResult } from "./generate";
2
+ import { writeIfChanged } from "../content.ts";
3
+ import { consoleReporter, type Reporter } from "../log.ts";
4
+ import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "../root.ts";
5
+ import { generateSchema, type SchemaResult } from "./generate.ts";
6
6
 
7
7
  export interface SchemaOptions {
8
8
  root?: string;
@@ -17,7 +17,7 @@
17
17
  import fs from "node:fs";
18
18
  import path from "node:path";
19
19
  import type * as TS from "typescript";
20
- import { CliError } from "../root";
20
+ import { CliError } from "../root.ts";
21
21
 
22
22
  type TypeScript = typeof TS;
23
23
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  import fs from "node:fs";
25
25
  import path from "node:path";
26
- import type { TsSymbol as MorphSymbol, TsType as Type } from "./tsProgram";
26
+ import type { TsSymbol as MorphSymbol, TsType as Type } from "./tsProgram.ts";
27
27
 
28
28
  export const RESOLVABLE_KEY = "Resolvable";
29
29
  export const SECTION_REF_KEY = "__SECTION_REF__";
@@ -662,9 +662,14 @@ export function typeToJsonSchema(
662
662
  * A machine-independent id for a source file: relative to the app root, or
663
663
  * `<package name>/<path in package>` for a file in a dependency (including a
664
664
  * workspace package the checker reached through a symlink).
665
+ *
666
+ * A declaration file with a declaration map (`x.d.ts` + `x.d.ts.map`, as
667
+ * `tsc` emits into a package's dist/) is named after the source it was
668
+ * compiled from, so a type keeps one id whether the checker read the
669
+ * package's compiled `.d.ts` or its `.ts` source (the "source" condition).
665
670
  */
666
671
  export function stableFileId(filePath: string, root: string): string {
667
- const file = filePath.replace(/^file:\/+/, "/");
672
+ const file = sourceOfDeclaration(filePath.replace(/^file:\/+/, "/"));
668
673
  const nm = file.lastIndexOf("/node_modules/");
669
674
  if (nm >= 0) return file.slice(nm + "/node_modules/".length);
670
675
  const rel = path.relative(root, file).split(path.sep).join("/");
@@ -687,3 +692,20 @@ export function stableFileId(filePath: string, root: string): string {
687
692
  dir = parent;
688
693
  }
689
694
  }
695
+
696
+ /** The `.ts` file a `.d.ts` was emitted from, per its declaration map; else the file itself. */
697
+ function sourceOfDeclaration(file: string): string {
698
+ if (!/\.d\.[cm]?ts$/.test(file)) return file;
699
+ try {
700
+ const map = JSON.parse(fs.readFileSync(`${file}.map`, "utf8")) as {
701
+ sources?: unknown;
702
+ sourceRoot?: unknown;
703
+ };
704
+ const source = Array.isArray(map.sources) ? map.sources[0] : undefined;
705
+ if (typeof source !== "string") return file;
706
+ const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
707
+ return path.resolve(path.dirname(file), sourceRoot, source);
708
+ } catch {
709
+ return file;
710
+ }
711
+ }
@@ -20,15 +20,15 @@ import http from "node:http";
20
20
  import type { AddressInfo } from "node:net";
21
21
  import path from "node:path";
22
22
  import { Readable } from "node:stream";
23
- import { ErrorCode } from "../../../protocol/errors";
24
- import { blockNameFromFile } from "../../../protocol/keys";
25
- import { createContentHandler } from "../../../protocol/server";
26
- import { createAssetHandler } from "../../../protocol/server/assets";
27
- import type { ContentStorage } from "../../../protocol/storage";
28
- import { createFsStorage } from "../../../protocol/storage/fs";
29
- import { readSavedBlocks, writeContent } from "../content";
30
- import { consoleReporter, type Reporter } from "../log";
31
- import { CliError, decoPaths, findDecoRoot, packageVersion } from "../root";
23
+ import { ErrorCode } from "../../../protocol/errors.ts";
24
+ import { blockNameFromFile } from "../../../protocol/keys.ts";
25
+ import { createAssetHandler } from "../../../protocol/server/assets.ts";
26
+ import { createContentHandler } from "../../../protocol/server/index.ts";
27
+ import { createFsStorage } from "../../../protocol/storage/fs/index.ts";
28
+ import type { ContentStorage } from "../../../protocol/storage.ts";
29
+ import { readSavedBlocks, writeContent } from "../content.ts";
30
+ import { consoleReporter, type Reporter } from "../log.ts";
31
+ import { CliError, decoPaths, findDecoRoot, packageVersion } from "../root.ts";
32
32
 
33
33
  /** The site editor's origins: the browser origins allowed by default. */
34
34
  const STUDIO_ORIGINS = [
package/src/v8/client.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  * A client: one revision, loaded on first use and read for the rest of its
3
3
  * life, plus a memo of block results. Create one per request.
4
4
  */
5
- import { errors, isResolutionError, ResolutionError } from "./errors";
6
- import { isBlock } from "./json";
7
- import { Resolver } from "./resolver";
8
- import type { ClientTelemetry } from "./telemetry";
5
+ import { errors, isResolutionError, ResolutionError } from "./errors.ts";
6
+ import { isBlock } from "./json.ts";
7
+ import { Resolver } from "./resolver.ts";
8
+ import type { ClientTelemetry } from "./telemetry.ts";
9
9
  import type {
10
10
  Block,
11
11
  Blocks,
@@ -15,7 +15,7 @@ import type {
15
15
  ResolveOptions,
16
16
  Result,
17
17
  Snapshot,
18
- } from "./types";
18
+ } from "./types.ts";
19
19
 
20
20
  interface ClientOptions {
21
21
  /** Loads this client's snapshot; called at most once. */
package/src/v8/cms.ts CHANGED
@@ -6,15 +6,15 @@
6
6
  * a package loaded twice (two bundles, a dev reload) still shares one content
7
7
  * cache. See /next/api-reference#one-instance-per-process.
8
8
  */
9
- import { runInBackground } from "./background";
10
- import { builtIns } from "./builtins/index";
11
- import { secretBlock } from "./builtins/secret";
12
- import { CMSClient } from "./client";
13
- import { ContentStore, isLoader, isSnapshot } from "./content";
14
- import { clearGlobals, contentIdentity, fnv1a, readEnv } from "./identity";
15
- import { remoteLoader, resetRemoteLoaders } from "./remoteLoader";
16
- import { resolveDestination, setCurrentTelemetry, TelemetryPipeline } from "./telemetry";
17
- import type { Blocks, Client, CMS, CMSConfig, Loader, Snapshot } from "./types";
9
+ import { runInBackground } from "./background.ts";
10
+ import { builtIns } from "./builtins/index.ts";
11
+ import { secretBlock } from "./builtins/secret.ts";
12
+ import { CMSClient } from "./client.ts";
13
+ import { ContentStore, isLoader, isSnapshot } from "./content.ts";
14
+ import { clearGlobals, contentIdentity, fnv1a, readEnv } from "./identity.ts";
15
+ import { remoteLoader, resetRemoteLoaders } from "./remoteLoader.ts";
16
+ import { resolveDestination, setCurrentTelemetry, TelemetryPipeline } from "./telemetry.ts";
17
+ import type { Blocks, Client, CMS, CMSConfig, Loader, Snapshot } from "./types.ts";
18
18
 
19
19
  const INSTANCE_PREFIX = "decocms.blocks.cms:";
20
20
  const MIN_INTERVAL = 60_000;