veryfront 0.1.1238 → 0.1.1239

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 (472) hide show
  1. package/esm/cli/auth/login.d.ts +24 -2
  2. package/esm/cli/auth/login.d.ts.map +1 -1
  3. package/esm/cli/auth/login.js +444 -35
  4. package/esm/cli/commands/build/error-handler.js +1 -1
  5. package/esm/cli/commands/generate/command.d.ts.map +1 -1
  6. package/esm/cli/commands/generate/command.js +2 -3
  7. package/esm/cli/commands/init/init-command.d.ts.map +1 -1
  8. package/esm/cli/commands/init/init-command.js +23 -31
  9. package/esm/cli/commands/install/registry.d.ts.map +1 -1
  10. package/esm/cli/commands/install/registry.js +6 -9
  11. package/esm/cli/commands/login/command-help.d.ts.map +1 -1
  12. package/esm/cli/commands/login/command-help.js +3 -1
  13. package/esm/cli/commands/pull/command.d.ts +1 -0
  14. package/esm/cli/commands/pull/command.d.ts.map +1 -1
  15. package/esm/cli/commands/pull/command.js +49 -6
  16. package/esm/cli/commands/push/command-help.d.ts.map +1 -1
  17. package/esm/cli/commands/push/command-help.js +7 -0
  18. package/esm/cli/commands/push/command.d.ts +23 -12
  19. package/esm/cli/commands/push/command.d.ts.map +1 -1
  20. package/esm/cli/commands/push/command.js +461 -44
  21. package/esm/cli/commands/push/plan.d.ts +35 -0
  22. package/esm/cli/commands/push/plan.d.ts.map +1 -0
  23. package/esm/cli/commands/push/plan.js +96 -0
  24. package/esm/cli/commands/schedule/handler.d.ts +21 -2
  25. package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
  26. package/esm/cli/commands/schedule/handler.js +74 -27
  27. package/esm/cli/commands/schema/command-help.js +1 -1
  28. package/esm/cli/commands/up/command.js +1 -1
  29. package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
  30. package/esm/cli/commands/webhook/handler.js +3 -1
  31. package/esm/cli/router.d.ts.map +1 -1
  32. package/esm/cli/router.js +27 -5
  33. package/esm/cli/shared/args.d.ts +10 -0
  34. package/esm/cli/shared/args.d.ts.map +1 -1
  35. package/esm/cli/shared/args.js +15 -2
  36. package/esm/cli/shared/config.d.ts +11 -2
  37. package/esm/cli/shared/config.d.ts.map +1 -1
  38. package/esm/cli/shared/config.js +72 -27
  39. package/esm/cli/shared/project-creation.js +1 -1
  40. package/esm/cli/sync/state.d.ts +20 -0
  41. package/esm/cli/sync/state.d.ts.map +1 -0
  42. package/esm/cli/sync/state.js +193 -0
  43. package/esm/deno.js +2 -2
  44. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
  45. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
  46. package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
  47. package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
  48. package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
  49. package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
  50. package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
  51. package/esm/src/agent/conversation/delegation-policy.js +13 -3
  52. package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
  53. package/esm/src/agent/conversation/hosted-terminal.js +6 -2
  54. package/esm/src/agent/factory.d.ts.map +1 -1
  55. package/esm/src/agent/factory.js +22 -11
  56. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
  57. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
  58. package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
  59. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
  60. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
  61. package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
  62. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
  63. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
  64. package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
  65. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
  66. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
  67. package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
  68. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
  69. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
  70. package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
  71. package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
  72. package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
  73. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
  74. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
  75. package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
  76. package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
  77. package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
  78. package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
  79. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
  80. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
  81. package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
  82. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
  83. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
  84. package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
  85. package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
  86. package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
  87. package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
  88. package/esm/src/agent/index.d.ts +3 -3
  89. package/esm/src/agent/index.d.ts.map +1 -1
  90. package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
  91. package/esm/src/agent/project/agent-runtime.js +6 -3
  92. package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
  93. package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
  94. package/esm/src/agent/runtime/agent-definition.js +15 -2
  95. package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
  96. package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
  97. package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
  98. package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
  99. package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
  100. package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
  101. package/esm/src/agent/runtime/call-context.d.ts +42 -11
  102. package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
  103. package/esm/src/agent/runtime/call-context.js +480 -42
  104. package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
  105. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  106. package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
  107. package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
  108. package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
  109. package/esm/src/agent/runtime/effective-agent-system.js +29 -0
  110. package/esm/src/agent/runtime/index.d.ts +1 -0
  111. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  112. package/esm/src/agent/runtime/index.js +638 -53
  113. package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
  114. package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
  115. package/esm/src/agent/runtime/load-skill-tool.js +152 -21
  116. package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
  117. package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
  118. package/esm/src/agent/runtime/model-resolution.js +14 -0
  119. package/esm/src/agent/runtime/model-transport.d.ts +1 -0
  120. package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
  121. package/esm/src/agent/runtime/model-transport.js +5 -2
  122. package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
  123. package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
  124. package/esm/src/agent/runtime/run-runtime-context.js +9 -3
  125. package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
  126. package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
  127. package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
  128. package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
  129. package/esm/src/agent/runtime/skill-prompt.js +113 -25
  130. package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
  131. package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
  132. package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
  133. package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
  134. package/esm/src/agent/runtime/tool-inventory.js +13 -9
  135. package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
  136. package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
  137. package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
  138. package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
  139. package/esm/src/agent/service/runtime.js +1 -1
  140. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
  141. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  142. package/esm/src/agent/types.d.ts +14 -1
  143. package/esm/src/agent/types.d.ts.map +1 -1
  144. package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
  145. package/esm/src/chat/chat-ui-message-helpers.js +75 -16
  146. package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
  147. package/esm/src/errors/catalog/build-errors.js +14 -0
  148. package/esm/src/errors/error-registry/build.d.ts +2 -0
  149. package/esm/src/errors/error-registry/build.d.ts.map +1 -1
  150. package/esm/src/errors/error-registry/build.js +8 -0
  151. package/esm/src/errors/error-registry/deploy.d.ts +4 -0
  152. package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
  153. package/esm/src/errors/error-registry/deploy.js +16 -0
  154. package/esm/src/errors/error-registry.d.ts +3 -0
  155. package/esm/src/errors/error-registry.d.ts.map +1 -1
  156. package/esm/src/errors/index.d.ts +2 -1
  157. package/esm/src/errors/index.d.ts.map +1 -1
  158. package/esm/src/errors/index.js +4 -3
  159. package/esm/src/errors/tenant-classification.d.ts +25 -0
  160. package/esm/src/errors/tenant-classification.d.ts.map +1 -0
  161. package/esm/src/errors/tenant-classification.js +61 -0
  162. package/esm/src/extensions/builtin-extensions.d.ts +10 -15
  163. package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
  164. package/esm/src/extensions/builtin-extensions.js +32 -26
  165. package/esm/src/extensions/deferred-extension.d.ts +4 -4
  166. package/esm/src/extensions/deferred-extension.js +4 -4
  167. package/esm/src/extensions/index.d.ts +1 -0
  168. package/esm/src/extensions/index.d.ts.map +1 -1
  169. package/esm/src/extensions/index.js +1 -0
  170. package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
  171. package/esm/src/integrations/_data.d.ts.map +1 -1
  172. package/esm/src/integrations/_data.js +6 -0
  173. package/esm/src/integrations/schema.d.ts +8 -0
  174. package/esm/src/integrations/schema.d.ts.map +1 -1
  175. package/esm/src/integrations/schema.js +3 -0
  176. package/esm/src/integrations/types.d.ts +2 -0
  177. package/esm/src/integrations/types.d.ts.map +1 -1
  178. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  179. package/esm/src/internal-agents/run-stream.js +35 -20
  180. package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
  181. package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
  182. package/esm/src/internal-agents/run-system-prompt.js +19 -13
  183. package/esm/src/internal-agents/schema.d.ts +2 -0
  184. package/esm/src/internal-agents/schema.d.ts.map +1 -1
  185. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  186. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +2 -18
  187. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
  188. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
  189. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
  190. package/esm/src/observability/application-error-contract.d.ts +4 -0
  191. package/esm/src/observability/application-error-contract.d.ts.map +1 -1
  192. package/esm/src/observability/application-errors.d.ts.map +1 -1
  193. package/esm/src/observability/application-errors.js +55 -2
  194. package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
  195. package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
  196. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
  197. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
  198. package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
  199. package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
  200. package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
  201. package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
  202. package/esm/src/provider/runtime-loader/provider-http.js +55 -17
  203. package/esm/src/provider/shared/index.d.ts +1 -0
  204. package/esm/src/provider/shared/index.d.ts.map +1 -1
  205. package/esm/src/provider/shared/index.js +2 -0
  206. package/esm/src/provider/types.d.ts +1 -0
  207. package/esm/src/provider/types.d.ts.map +1 -1
  208. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
  209. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
  210. package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
  211. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
  212. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
  213. package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
  214. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
  215. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
  216. package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
  217. package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
  218. package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
  219. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
  220. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
  221. package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
  222. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
  223. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
  224. package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
  225. package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
  226. package/esm/src/react/components/ui/adapter/context.js +10 -0
  227. package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
  228. package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
  229. package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
  230. package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
  231. package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
  232. package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
  233. package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
  234. package/esm/src/react/components/ui/alert-dialog.js +181 -0
  235. package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
  236. package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
  237. package/esm/src/react/components/ui/aspect-ratio.js +13 -0
  238. package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
  239. package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
  240. package/esm/src/react/components/ui/autocomplete.js +59 -0
  241. package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
  242. package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
  243. package/esm/src/react/components/ui/breadcrumb.js +67 -0
  244. package/esm/src/react/components/ui/calendar.d.ts +40 -0
  245. package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
  246. package/esm/src/react/components/ui/calendar.js +170 -0
  247. package/esm/src/react/components/ui/combobox.d.ts +74 -0
  248. package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
  249. package/esm/src/react/components/ui/combobox.js +100 -0
  250. package/esm/src/react/components/ui/context-menu.d.ts +116 -0
  251. package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
  252. package/esm/src/react/components/ui/context-menu.js +168 -0
  253. package/esm/src/react/components/ui/date-picker.d.ts +69 -0
  254. package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
  255. package/esm/src/react/components/ui/date-picker.js +96 -0
  256. package/esm/src/react/components/ui/dialog.d.ts +41 -11
  257. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  258. package/esm/src/react/components/ui/dialog.js +47 -28
  259. package/esm/src/react/components/ui/drawer.d.ts +31 -8
  260. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  261. package/esm/src/react/components/ui/drawer.js +33 -22
  262. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  263. package/esm/src/react/components/ui/dropdown-menu.js +7 -75
  264. package/esm/src/react/components/ui/field.d.ts +70 -0
  265. package/esm/src/react/components/ui/field.d.ts.map +1 -0
  266. package/esm/src/react/components/ui/field.js +161 -0
  267. package/esm/src/react/components/ui/file-type.d.ts +9 -8
  268. package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
  269. package/esm/src/react/components/ui/file-type.js +8 -8
  270. package/esm/src/react/components/ui/hover-card.d.ts +82 -0
  271. package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
  272. package/esm/src/react/components/ui/hover-card.js +140 -0
  273. package/esm/src/react/components/ui/index.d.ts +23 -2
  274. package/esm/src/react/components/ui/index.d.ts.map +1 -1
  275. package/esm/src/react/components/ui/index.js +21 -0
  276. package/esm/src/react/components/ui/input-otp.d.ts +37 -0
  277. package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
  278. package/esm/src/react/components/ui/input-otp.js +42 -0
  279. package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
  280. package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
  281. package/esm/src/react/components/ui/menu-keyboard.js +76 -0
  282. package/esm/src/react/components/ui/menubar.d.ts +98 -0
  283. package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
  284. package/esm/src/react/components/ui/menubar.js +173 -0
  285. package/esm/src/react/components/ui/meter.d.ts +45 -0
  286. package/esm/src/react/components/ui/meter.d.ts.map +1 -0
  287. package/esm/src/react/components/ui/meter.js +59 -0
  288. package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
  289. package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
  290. package/esm/src/react/components/ui/modal-surface.js +23 -6
  291. package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
  292. package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
  293. package/esm/src/react/components/ui/navigation-menu.js +195 -0
  294. package/esm/src/react/components/ui/number-field.d.ts +46 -0
  295. package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
  296. package/esm/src/react/components/ui/number-field.js +121 -0
  297. package/esm/src/react/components/ui/pagination.d.ts +77 -0
  298. package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
  299. package/esm/src/react/components/ui/pagination.js +62 -0
  300. package/esm/src/react/components/ui/popover.d.ts +42 -13
  301. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  302. package/esm/src/react/components/ui/popover.js +25 -12
  303. package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
  304. package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
  305. package/esm/src/react/components/ui/scroll-area.js +35 -0
  306. package/esm/src/react/components/ui/separator.d.ts +20 -0
  307. package/esm/src/react/components/ui/separator.d.ts.map +1 -0
  308. package/esm/src/react/components/ui/separator.js +13 -0
  309. package/esm/src/react/components/ui/slider.d.ts +44 -0
  310. package/esm/src/react/components/ui/slider.d.ts.map +1 -0
  311. package/esm/src/react/components/ui/slider.js +46 -0
  312. package/esm/src/react/components/ui/status.d.ts +6 -5
  313. package/esm/src/react/components/ui/status.d.ts.map +1 -1
  314. package/esm/src/react/components/ui/status.js +4 -4
  315. package/esm/src/react/components/ui/tabs.d.ts +32 -9
  316. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  317. package/esm/src/react/components/ui/tabs.js +46 -22
  318. package/esm/src/react/components/ui/toggle.d.ts +26 -0
  319. package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
  320. package/esm/src/react/components/ui/toggle.js +29 -0
  321. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
  322. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
  323. package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
  324. package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
  325. package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
  326. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
  327. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
  328. package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
  329. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
  330. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
  331. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
  332. package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
  333. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  334. package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
  335. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
  336. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
  337. package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
  338. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  339. package/esm/src/rendering/orchestrator/pipeline.js +12 -1
  340. package/esm/src/runs/runs-client.d.ts +2 -4
  341. package/esm/src/runs/runs-client.d.ts.map +1 -1
  342. package/esm/src/runs/schemas.d.ts +18 -8
  343. package/esm/src/runs/schemas.d.ts.map +1 -1
  344. package/esm/src/runs/schemas.js +26 -0
  345. package/esm/src/runtime/model-call-context.d.ts +6 -1
  346. package/esm/src/runtime/model-call-context.d.ts.map +1 -1
  347. package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
  348. package/esm/src/runtime/runtime-bridge.js +133 -15
  349. package/esm/src/schedule/factory.d.ts +8 -2
  350. package/esm/src/schedule/factory.d.ts.map +1 -1
  351. package/esm/src/schedule/factory.js +0 -8
  352. package/esm/src/schedule/index.d.ts +10 -1
  353. package/esm/src/schedule/index.d.ts.map +1 -1
  354. package/esm/src/schedule/index.js +9 -0
  355. package/esm/src/schedule/types.d.ts +30 -11
  356. package/esm/src/schedule/types.d.ts.map +1 -1
  357. package/esm/src/schedule/validation.d.ts +17 -0
  358. package/esm/src/schedule/validation.d.ts.map +1 -1
  359. package/esm/src/schedule/validation.js +93 -5
  360. package/esm/src/server/dev-server/index.d.ts +1 -1
  361. package/esm/src/server/dev-server/index.d.ts.map +1 -1
  362. package/esm/src/server/dev-server/server.d.ts +7 -3
  363. package/esm/src/server/dev-server/server.d.ts.map +1 -1
  364. package/esm/src/server/dev-server/server.js +12 -3
  365. package/esm/src/server/dev-server/types.d.ts +7 -1
  366. package/esm/src/server/dev-server/types.d.ts.map +1 -1
  367. package/esm/src/server/dev-server.d.ts +1 -1
  368. package/esm/src/server/dev-server.d.ts.map +1 -1
  369. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  370. package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
  371. package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
  372. package/esm/src/server/handlers/dev/projects/index.js +3 -0
  373. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  374. package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
  375. package/esm/src/server/index.d.ts +3 -3
  376. package/esm/src/server/index.d.ts.map +1 -1
  377. package/esm/src/server/index.js +10 -5
  378. package/esm/src/server/node-handler.d.ts.map +1 -1
  379. package/esm/src/server/node-handler.js +4 -1
  380. package/esm/src/server/production-server.d.ts.map +1 -1
  381. package/esm/src/server/production-server.js +2 -1
  382. package/esm/src/server/project-env/cache.d.ts +17 -0
  383. package/esm/src/server/project-env/cache.d.ts.map +1 -1
  384. package/esm/src/server/project-env/cache.js +78 -2
  385. package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
  386. package/esm/src/server/project-env/fetcher.js +13 -3
  387. package/esm/src/server/project-env/index.d.ts +1 -1
  388. package/esm/src/server/project-env/index.d.ts.map +1 -1
  389. package/esm/src/server/project-env/index.js +1 -1
  390. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  391. package/esm/src/server/runtime-handler/index.js +1 -1
  392. package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
  393. package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
  394. package/esm/src/server/runtime-handler/projects-handler.js +4 -2
  395. package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
  396. package/esm/src/transforms/esm/http-bundler.js +6 -5
  397. package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
  398. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  399. package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
  400. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  401. package/esm/src/transforms/esm/http-cache.js +16 -10
  402. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  403. package/esm/src/transforms/esm/specifier-resolver.js +87 -7
  404. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
  405. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
  406. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
  407. package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
  408. package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
  409. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
  410. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
  411. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
  412. package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
  413. package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
  414. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
  415. package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +8 -2
  416. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
  417. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
  418. package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +3 -0
  419. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
  420. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
  421. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
  422. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
  423. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
  424. package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
  425. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
  426. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
  427. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
  428. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
  429. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
  430. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
  431. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
  432. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
  433. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
  434. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  435. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
  436. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
  437. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
  438. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
  439. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
  440. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
  441. package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
  442. package/esm/src/transforms/pipeline/stages/compile.js +44 -0
  443. package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
  444. package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
  445. package/esm/src/transforms/shared/specifier-suffix.js +43 -0
  446. package/esm/src/trigger/index.d.ts +2 -2
  447. package/esm/src/trigger/index.d.ts.map +1 -1
  448. package/esm/src/trigger/index.js +1 -1
  449. package/esm/src/trigger/local-runner.d.ts +2 -2
  450. package/esm/src/trigger/local-runner.d.ts.map +1 -1
  451. package/esm/src/trigger/local-runner.js +11 -4
  452. package/esm/src/trigger/target.d.ts +97 -5
  453. package/esm/src/trigger/target.d.ts.map +1 -1
  454. package/esm/src/trigger/target.js +175 -5
  455. package/esm/src/utils/version-constant.d.ts +1 -1
  456. package/esm/src/utils/version-constant.js +1 -1
  457. package/esm/src/webhook/types.d.ts +21 -6
  458. package/esm/src/webhook/types.d.ts.map +1 -1
  459. package/esm/src/webhook/validation.d.ts.map +1 -1
  460. package/esm/src/webhook/validation.js +27 -39
  461. package/esm/templates/index.d.ts +1 -1
  462. package/esm/templates/index.d.ts.map +1 -1
  463. package/esm/templates/loader.d.ts +6 -6
  464. package/esm/templates/loader.d.ts.map +1 -1
  465. package/esm/templates/loader.js +34 -18
  466. package/esm/templates/manifest.generated.d.ts +3 -0
  467. package/esm/templates/manifest.generated.d.ts.map +1 -0
  468. package/esm/templates/manifest.generated.js +2 -0
  469. package/package.json +8 -8
  470. package/esm/templates/manifest.d.ts +0 -664
  471. package/esm/templates/manifest.d.ts.map +0 -1
  472. package/esm/templates/manifest.js +0 -662
@@ -15,6 +15,7 @@ import { readHttpModuleText } from "../shared/http-module-response.js";
15
15
  import { sanitizeUrlForSpan } from "../../utils/logger/redact.js";
16
16
  import { snapshotThrowableDiagnostic } from "../../errors/safe-diagnostics.js";
17
17
  import { MAX_TIMER_DELAY_MS } from "../../utils/constants/limits.js";
18
+ import { describeHtmlModuleResponse } from "./http-cache-helpers.js";
18
19
  const LOG_PREFIX = "[HTTP-HANDLER]";
19
20
  /**
20
21
  * User agent string for HTTP fetches.
@@ -141,11 +142,11 @@ export function createHTTPPlugin(options = {}) {
141
142
  /<title>ESM[^<]*<\/title>/i.test(contents.slice(0, 500));
142
143
  if (isHtmlContent) {
143
144
  logger.warn(`${LOG_PREFIX} Received HTML instead of JS for ${safeUrl}`);
144
- return {
145
- errors: [{
146
- text: `Received HTML instead of JavaScript from ${safeUrl}. Package may not exist or failed to build on esm.sh.`,
147
- }],
148
- };
145
+ // Blaming esm.sh for every host that answers HTML sends the reader
146
+ // to a registry that was never involved. The shared helper reports
147
+ // the real cause, including an unresolved "@/" alias that fell
148
+ // through to the site origin (VERYFRONT-SERVER-G).
149
+ return { errors: [{ text: describeHtmlModuleResponse(safeUrl) }] };
149
150
  }
150
151
  return { contents, loader: "js" };
151
152
  }
@@ -79,6 +79,15 @@ export declare function getEffectiveHttpCacheRequest<T extends HttpCacheIdentity
79
79
  * separate local files.
80
80
  */
81
81
  export declare function isCanonicalReactEsmUrl(rawUrl: string): boolean;
82
+ /**
83
+ * Diagnostic for an HTTP module fetch that answered with HTML.
84
+ *
85
+ * Only esm.sh gets the "package failed to build" explanation. For any other
86
+ * host, direct the reader to verify that the import resolves to JavaScript.
87
+ * A path starting with "/@/" is the "@/" project alias in absolute form, so it
88
+ * gets a specific alias-resolution instruction.
89
+ */
90
+ export declare function describeHtmlModuleResponse(rawUrl: string): string;
82
91
  export declare function isExternalScheme(specifier: string): boolean;
83
92
  export declare function isRelative(specifier: string): boolean;
84
93
  /**
@@ -101,6 +110,8 @@ export declare function isInternalBare(specifier: string): boolean;
101
110
  export declare const SERVER_ESM_TARGET = "node";
102
111
  export declare function normalizeEsmShUrl(url: URL): void;
103
112
  export declare function normalizeHttpUrl(raw: string): string;
113
+ /** Build an opaque identity for correlating one exact HTTP module request. */
114
+ export declare function fingerprintHttpModuleRequest(rawUrl: string): Promise<string>;
104
115
  export declare function resolveBareSpecifier(specifier: string, importMap: ImportMapConfig, reactVersion?: string): string;
105
116
  /**
106
117
  * Check if cached HTTP bundle code has file:// paths from a different environment.
@@ -1 +1 @@
1
- {"version":3,"file":"http-cache-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAsNhE;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IACvB,GAAG,CAAC,KAAK,EA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CAE5E;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,eAAe,EAC1B,YAAY,GAAE,MAA8B,GAC3C,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAoBrF"}
@@ -182,6 +182,7 @@ function decodeEncodedCommas(value) {
182
182
  return decoded;
183
183
  }
184
184
  const HTTP_CACHE_REQUEST_IDENTITY_CONTEXT = Symbol("http-cache-request-identity-context");
185
+ const HTTP_MODULE_REQUEST_FINGERPRINT_NAMESPACE = "veryfront:http-module-request:v1";
185
186
  function compareImportMapKeys(left, right) {
186
187
  return left[0] < right[0] ? -1 : left[0] > right[0] ? 1 : 0;
187
188
  }
@@ -358,6 +359,36 @@ export function getEffectiveHttpCacheRequest(rawUrl, options) {
358
359
  export function isCanonicalReactEsmUrl(rawUrl) {
359
360
  return getCanonicalReactEsmVersion(rawUrl) !== null;
360
361
  }
362
+ /**
363
+ * Diagnostic for an HTTP module fetch that answered with HTML.
364
+ *
365
+ * Only esm.sh gets the "package failed to build" explanation. For any other
366
+ * host, direct the reader to verify that the import resolves to JavaScript.
367
+ * A path starting with "/@/" is the "@/" project alias in absolute form, so it
368
+ * gets a specific alias-resolution instruction.
369
+ */
370
+ export function describeHtmlModuleResponse(rawUrl) {
371
+ let hostname = "";
372
+ let pathname = "";
373
+ try {
374
+ const url = new IntrinsicURL(rawUrl);
375
+ hostname = getURLHostname(url);
376
+ pathname = getURLPathname(url);
377
+ }
378
+ catch (_) {
379
+ /* expected: URL may be malformed */
380
+ }
381
+ const received = `Received HTML instead of JavaScript from ${rawUrl}.`;
382
+ if (hostname === "esm.sh") {
383
+ return `${received} The package may not exist or failed to build on esm.sh.`;
384
+ }
385
+ const resolutionInstruction = stringStartsWith(pathname, "/@/")
386
+ ? 'Verify that the "@/" alias import resolves to a project module and does not fall ' +
387
+ "through to the site origin."
388
+ : "Verify that the import resolves to a JavaScript module and does not fall through " +
389
+ "to the site origin.";
390
+ return `${received} ${resolutionInstruction}`;
391
+ }
361
392
  export function isExternalScheme(specifier) {
362
393
  return stringStartsWith(specifier, "node:") ||
363
394
  stringStartsWith(specifier, "data:") ||
@@ -455,6 +486,10 @@ export function normalizeHttpUrl(raw) {
455
486
  return raw;
456
487
  }
457
488
  }
489
+ /** Build an opaque identity for correlating one exact HTTP module request. */
490
+ export function fingerprintHttpModuleRequest(rawUrl) {
491
+ return computeHash(`${HTTP_MODULE_REQUEST_FINGERPRINT_NAMESPACE}\0${normalizeHttpUrl(rawUrl)}`);
492
+ }
458
493
  export function resolveBareSpecifier(specifier, importMap, reactVersion = DEFAULT_REACT_VERSION) {
459
494
  const reactMap = getReactImportMap(reactVersion);
460
495
  const reactMapped = reactMap[specifier];
@@ -1 +1 @@
1
- {"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAGL,KAAK,YAAY,EAMjB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAElB,gBAAgB,EAEhB,KAAK,OAAO,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA2B,MAAM,4BAA4B,CAAC;AAYxF,OAAO,EACL,0BAA0B,EAU3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,sBAAsB,EAKvB,MAAM,uBAAuB,CAAC;AAa/B,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,QACT,CAAC;AAgOlC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAk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B,CAAC"}
1
+ {"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAGL,KAAK,YAAY,EAQjB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAElB,gBAAgB,EAEhB,KAAK,OAAO,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA2B,MAAM,4BAA4B,CAAC;AAYxF,OAAO,EACL,0BAA0B,EAU3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,sBAAsB,EAKvB,MAAM,uBAAuB,CAAC;AAa/B,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,QACT,CAAC;AAmPlC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC;AAGF,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAiWlC,wEAAwE;AACxE,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,sBAAsB,CAAC,CA0CjC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,wBAAwB,GAClC,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,wBAAwB,GAClC,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAGD,eAAO,MAAM,wBAAwB,0BAAoB,CAAC"}
@@ -29,7 +29,7 @@ import { guardedOutboundFetch, OutboundRequestBlockedError, } from "../../securi
29
29
  // Extracted modules
30
30
  import { embedSourceUrl, extractSourceUrl } from "./source-url-embed.js";
31
31
  import { isDegradedArtifact } from "./degraded-artifact.js";
32
- import { buildHttpCacheIdentity, buildHttpCacheIdentityMetadata, deriveHttpCacheRequestOptions, ensureAbsoluteDir, ensurePreparedHttpCacheRequestOptions, getEffectiveHttpCacheRequest, hashHttpCacheIdentity, hasIncompatibleFilePaths, isHttpUrl, normalizeHttpUrl, prepareHttpCacheRequestOptions, } from "./http-cache-helpers.js";
32
+ import { buildHttpCacheIdentity, buildHttpCacheIdentityMetadata, deriveHttpCacheRequestOptions, describeHtmlModuleResponse, ensureAbsoluteDir, ensurePreparedHttpCacheRequestOptions, fingerprintHttpModuleRequest, getEffectiveHttpCacheRequest, hashHttpCacheIdentity, hasIncompatibleFilePaths, isHttpUrl, normalizeHttpUrl, prepareHttpCacheRequestOptions, } from "./http-cache-helpers.js";
33
33
  import { extractBundleDeps, validateBundleDepsExist } from "./bundle-deps-validator.js";
34
34
  import { bundleAccumulatorStorage, createBundleAccumulator, trackCachedBundleGraph, trackWrittenBundle, } from "./bundle-accumulator.js";
35
35
  import { isHttpBundleCodeWithinLimit, MAX_CACHED_HTTP_BUNDLE_BYTES, readCachedHttpBundleFile, } from "./http-bundle-file.js";
@@ -97,6 +97,12 @@ async function publishHttpBundleGeneration(cacheKey, cachePath, code, fs, abortS
97
97
  }
98
98
  }
99
99
  }
100
+ function terminalHttpModuleFetchError(detail, context = {}) {
101
+ return BUILD_FAILED.create({
102
+ detail,
103
+ context: { phase: "http-module-fetch", ...context },
104
+ });
105
+ }
100
106
  class HttpModuleResponseError extends Error {
101
107
  status;
102
108
  constructor(status) {
@@ -198,17 +204,17 @@ async function fetchHttpModule(url, abortSignal) {
198
204
  }
199
205
  catch (error) {
200
206
  if (error instanceof HttpModuleResponseError) {
201
- throw BUILD_FAILED.create({ detail: `Failed to fetch ${safeUrl}: ${error.status}` });
207
+ throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.status}`, {
208
+ httpStatus: error.status,
209
+ httpModuleUrl: safeUrl,
210
+ httpModuleRequestFingerprint: await fingerprintHttpModuleRequest(url),
211
+ });
202
212
  }
203
213
  if (error instanceof HttpModuleRequestError) {
204
- throw BUILD_FAILED.create({
205
- detail: `Failed to fetch ${safeUrl}: ${error.requestErrorType}`,
206
- });
214
+ throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.requestErrorType}`);
207
215
  }
208
216
  if (error instanceof HttpModuleBodyError) {
209
- throw BUILD_FAILED.create({
210
- detail: `Failed to fetch ${safeUrl}: ${error.message}`,
211
- });
217
+ throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.message}`);
212
218
  }
213
219
  if (error instanceof OutboundRequestBlockedError) {
214
220
  // Preserve the policy-denial type so downstream specifier resolution can
@@ -396,12 +402,12 @@ async function cacheHttpModuleInternal(url, options) {
396
402
  const contentType = fetchedModule.contentType;
397
403
  const isHtmlContent = contentType.includes("text/html") || looksLikeHtmlNotJs(code);
398
404
  if (isHtmlContent) {
399
- logger.error("[HTTP-CACHE] Received HTML instead of JavaScript, likely an esm.sh error page", {
405
+ logger.error("[HTTP-CACHE] Received HTML instead of JavaScript", {
400
406
  url: safeUrl,
401
407
  contentType,
402
408
  });
403
409
  throw BUNDLE_ERROR.create({
404
- detail: `Received HTML instead of JavaScript from ${safeUrl}. The package may not exist or failed to build on esm.sh.`,
410
+ detail: describeHtmlModuleResponse(safeUrl),
405
411
  });
406
412
  }
407
413
  reportProgress({
@@ -1 +1 @@
1
- {"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,EACL,KAAK,YAAY,EAQlB,MAAM,yBAAyB,CAAC;AAcjC,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AA0I/F,sDAAsD;AACtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
1
+ {"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,EACL,KAAK,YAAY,EAWlB,MAAM,yBAAyB,CAAC;AAgDjC,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAoM/F,sDAAsD;AACtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
@@ -7,24 +7,53 @@
7
7
  * @module transforms/esm/specifier-resolver
8
8
  */
9
9
  import { basename } from "../../platform/compat/path/index.js";
10
+ import { BUILD_FAILED } from "../../errors/index.js";
11
+ import { snapshotVeryfrontError } from "../../errors/types.js";
10
12
  import { resolveImport } from "../../modules/import-map/resolver.js";
11
13
  import { OutboundRequestBlockedError } from "../../security/http/outbound-fetch.js";
12
- import { appendSameOriginSSRDependencyPinningKey } from "../import-rewriter/url-builder.js";
14
+ import { appendSameOriginSSRDependencyPinningKey, normalizeExtension, } from "../import-rewriter/url-builder.js";
15
+ import { splitSpecifierSuffix } from "../shared/specifier-suffix.js";
13
16
  import { parseBarePackageSpecifier } from "../shared/package-specifier.js";
14
17
  import { isServerOnlyPackage } from "../shared/server-only-packages.js";
15
18
  import { parseImports, replaceSpecifiers } from "./lexer.js";
16
- import { isCanonicalReactEsmUrl, isExternalScheme, isHttpUrl, isInternalBare, isParentHttpModule, isRelative, resolveBareSpecifier, } from "./http-cache-helpers.js";
19
+ import { fingerprintHttpModuleRequest, getEffectiveHttpCacheRequest, isCanonicalReactEsmUrl, isExternalScheme, isHttpUrl, isInternalBare, isParentHttpModule, isRelative, normalizeHttpUrl, resolveBareSpecifier, } from "./http-cache-helpers.js";
17
20
  const ReflectApply = Reflect.apply;
21
+ const RegExpTest = RegExp.prototype.test;
18
22
  const StringSlice = String.prototype.slice;
19
23
  const StringStartsWith = String.prototype.startsWith;
24
+ function regexpTest(pattern, value) {
25
+ return ReflectApply(RegExpTest, pattern, [value]);
26
+ }
20
27
  function stringSlice(value, start, end) {
21
28
  return ReflectApply(StringSlice, value, end === undefined ? [start] : [start, end]);
22
29
  }
23
30
  function stringStartsWith(value, search) {
24
31
  return ReflectApply(StringStartsWith, value, [search]);
25
32
  }
33
+ function classifyAuthoredPackageFetchError(error, requestedPackageFingerprint) {
34
+ const snapshot = snapshotVeryfrontError(error);
35
+ const context = snapshot?.context;
36
+ if (snapshot?.slug !== BUILD_FAILED.slug ||
37
+ typeof context !== "object" || context === null ||
38
+ typeof requestedPackageFingerprint !== "string" ||
39
+ context.httpStatus !== 404 ||
40
+ context.httpModuleRequestFingerprint !==
41
+ requestedPackageFingerprint) {
42
+ return error;
43
+ }
44
+ return BUILD_FAILED.create({
45
+ message: snapshot.message,
46
+ detail: snapshot.detail,
47
+ cause: error,
48
+ context: {
49
+ httpStatus: 404,
50
+ httpModuleRequestFingerprint: requestedPackageFingerprint,
51
+ tenantBuildFailure: true,
52
+ },
53
+ });
54
+ }
26
55
  function parseHttpBase(value) {
27
- if (!value || !/^https?:\/\//i.test(value))
56
+ if (!value || !regexpTest(/^https?:\/\//i, value))
28
57
  return undefined;
29
58
  try {
30
59
  return new URL(value);
@@ -34,7 +63,7 @@ function parseHttpBase(value) {
34
63
  }
35
64
  }
36
65
  function canonicalizeHttpSpecifier(specifier, baseUrl, moduleServerOrigin) {
37
- if (/^https?:\/\//i.test(specifier))
66
+ if (regexpTest(/^https?:\/\//i, specifier))
38
67
  return new URL(specifier).toString();
39
68
  if (!stringStartsWith(specifier, "//"))
40
69
  return specifier;
@@ -67,13 +96,41 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
67
96
  specifier = canonicalizeHttpSpecifier(specifier, baseUrl, options.moduleServerOrigin);
68
97
  if (isExternalScheme(specifier))
69
98
  return null;
99
+ // The "@/" project alias always denotes the project's own module transport.
100
+ // An alias that escaped every upstream rewrite must land there too: treating
101
+ // it as a bare specifier would route it to esm.sh as a bogus scoped package,
102
+ // and a project import map that maps "@/" to a relative prefix would resolve
103
+ // it against the page's public origin, which answers with HTML
104
+ // (VERYFRONT-SERVER-G).
105
+ //
106
+ // The URL shape is not invented here. It reproduces `AliasStrategy.rewrite`
107
+ // (transforms/import-rewriter/strategies/alias-strategy.ts), the framework's
108
+ // canonical "@/" rewriter, which emits this same shape for both its `ssr` and
109
+ // its browser target: `normalizeExtension`, then append `.js` unless the
110
+ // result already ends in a JS-like or CSS extension. A different shape here
111
+ // would resolve one specifier to two different module URLs.
112
+ if (stringStartsWith(specifier, "@/")) {
113
+ const mappedAlias = resolveImport(specifier, options.importMap);
114
+ if (mappedAlias !== specifier && isLocalMappedSpecifier(mappedAlias))
115
+ return mappedAlias;
116
+ const { path: pathOnly, suffix } = splitSpecifierSuffix(stringSlice(specifier, 2));
117
+ const normalizedPath = normalizeExtension(pathOnly);
118
+ const jsPath = regexpTest(/\.(js|mjs|cjs|css)$/, normalizedPath)
119
+ ? normalizedPath
120
+ : `${normalizedPath}.js`;
121
+ const projectModulePath = `/_vf_modules/${jsPath}${suffix}`;
122
+ const moduleServerOrigin = parseHttpBase(options.moduleServerOrigin);
123
+ if (!moduleServerOrigin)
124
+ return projectModulePath;
125
+ return resolveSpecifier(new URL(projectModulePath, moduleServerOrigin).toString(), baseUrl, options, cacheHttpModule);
126
+ }
70
127
  // Server-only packages (`redis`, `pg`, …), including their explicit `npm:`
71
128
  // form, must never be routed through esm.sh. esm.sh either 500s building them
72
129
  // or emits a browser bundle with Node built-ins stubbed that can never
73
130
  // connect. The framework's adapters only `import()` them behind a lazy,
74
131
  // configured code path, so leaving the specifier external lets the runtime
75
132
  // resolve the real package (node_modules on Node, npm: on Deno) if and when
76
- // the backend is actually used — and costs nothing when it is not.
133
+ // the backend is actually used, and costs nothing when it is not.
77
134
  const serverOnlyCandidate = stringStartsWith(specifier, "npm:")
78
135
  ? stringSlice(specifier, 4)
79
136
  : specifier;
@@ -90,7 +147,16 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
90
147
  }
91
148
  if (stringStartsWith(specifier, "npm:")) {
92
149
  const bareSpecifier = stringSlice(specifier, 4);
93
- const cached = await cacheHttpModule(`https://esm.sh/${bareSpecifier}`, options);
150
+ const requestedPackageUrl = `https://esm.sh/${bareSpecifier}`;
151
+ let cached;
152
+ try {
153
+ cached = await cacheHttpModule(requestedPackageUrl, options);
154
+ }
155
+ catch (error) {
156
+ const effective = getEffectiveHttpCacheRequest(requestedPackageUrl, options);
157
+ const requestedPackageFingerprint = await fingerprintHttpModuleRequest(normalizeHttpUrl(effective.url));
158
+ throw classifyAuthoredPackageFetchError(error, requestedPackageFingerprint);
159
+ }
94
160
  if (!cached)
95
161
  return bareSpecifier;
96
162
  if (isParentHttpModule(baseUrl)) {
@@ -136,7 +202,21 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
136
202
  return null;
137
203
  if (isLocalMappedSpecifier(mapped))
138
204
  return mapped;
139
- return resolveSpecifier(mapped, baseUrl, options, cacheHttpModule);
205
+ let requestedPackageUrl;
206
+ const cacheAuthoredPackage = async (url, cacheOptions) => {
207
+ const effective = getEffectiveHttpCacheRequest(url, cacheOptions);
208
+ requestedPackageUrl ??= normalizeHttpUrl(effective.url);
209
+ return await cacheHttpModule(url, cacheOptions);
210
+ };
211
+ try {
212
+ return await resolveSpecifier(mapped, baseUrl, options, cacheAuthoredPackage);
213
+ }
214
+ catch (error) {
215
+ const requestedPackageFingerprint = requestedPackageUrl === undefined
216
+ ? undefined
217
+ : await fingerprintHttpModuleRequest(requestedPackageUrl);
218
+ throw classifyAuthoredPackageFetchError(error, requestedPackageFingerprint);
219
+ }
140
220
  }
141
221
  /**
142
222
  * Build a map of specifier replacements by resolving all imports in the code.
@@ -1,4 +1,6 @@
1
1
  import type { ImportRewriteStrategy, ImportSpecifierInfo, RewriteContext, RewriteResult } from "../types.js";
2
+ /** Rewrite a project alias through the canonical SSR module-path rule. */
3
+ export declare function rewriteSsrProjectAliasSpecifier(specifier: string): string | null;
2
4
  export declare class AliasStrategy implements ImportRewriteStrategy {
3
5
  readonly name = "alias";
4
6
  readonly priority = 1;
@@ -1 +1 @@
1
- {"version":3,"file":"alias-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/import-rewriter/strategies/alias-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB,qBAAa,aAAc,YAAW,qBAAqB;IACzD,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAIzD,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,cAAc,GAAG,aAAa;CAmDvE;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
1
+ {"version":3,"file":"alias-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/import-rewriter/strategies/alias-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhF;AAED,qBAAa,aAAc,YAAW,qBAAqB;IACzD,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAIzD,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,cAAc,GAAG,aAAa;CA8CvE;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
@@ -1,5 +1,15 @@
1
1
  import { appendDependencyPinningPathKey, normalizeExtension } from "../url-builder.js";
2
2
  import { getProjectRelativePath } from "../project-paths.js";
3
+ /** Rewrite a project alias through the canonical SSR module-path rule. */
4
+ export function rewriteSsrProjectAliasSpecifier(specifier) {
5
+ if (!specifier.startsWith("@/"))
6
+ return null;
7
+ let normalizedPath = normalizeExtension(specifier.slice(2));
8
+ if (!/\.(tsx?|jsx?|mjs|cjs|mdx|css)$/.test(normalizedPath)) {
9
+ normalizedPath = `${normalizedPath}.js`;
10
+ }
11
+ return `/_vf_modules/${normalizedPath}`;
12
+ }
3
13
  export class AliasStrategy {
4
14
  name = "alias";
5
15
  priority = 1;
@@ -10,15 +20,10 @@ export class AliasStrategy {
10
20
  const path = info.specifier.slice(2);
11
21
  // SSR uses /_vf_modules/ paths for HTTP module resolution
12
22
  if (ctx.target === "ssr") {
13
- let normalizedPath = normalizeExtension(path);
14
- // Add .js if no extension present
15
- if (!/\.(tsx?|jsx?|mjs|cjs|mdx|css)$/.test(normalizedPath)) {
16
- normalizedPath = `${normalizedPath}.js`;
17
- }
18
23
  // The SSR adapter adds `ssr`, routing, cache-buster, and dependency
19
24
  // snapshot params together after this strategy runs. Keeping this URL
20
25
  // query-free ensures its `.js` matcher still sees the edge.
21
- return { specifier: `/_vf_modules/${normalizedPath}` };
26
+ return { specifier: rewriteSsrProjectAliasSpecifier(info.specifier) ?? info.specifier };
22
27
  }
23
28
  // Browser: Use /_vf_modules/ absolute paths when moduleServerUrl is configured.
24
29
  // This avoids relative path calculation issues when the file index path structure
@@ -1 +1 @@
1
- {"version":3,"file":"md-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/md/compiler/md-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AAM9C,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAsClC"}
1
+ {"version":3,"file":"md-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/md/compiler/md-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AAW9C,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAwClC"}
@@ -1,8 +1,12 @@
1
1
  import { rendererLogger } from "../../../utils/index.js";
2
2
  import { resolve as resolveContract } from "../../../extensions/contracts.js";
3
- import { createError, toError } from "../../../errors/index.js";
3
+ import { MARKDOWN_COMPILE_ERROR, VeryfrontError } from "../../../errors/index.js";
4
4
  import { withSpan } from "../../../observability/tracing/otlp-setup.js";
5
+ import { isFrontmatterSyntaxError } from "../../mdx/compiler/frontmatter-extractor.js";
5
6
  const logger = rendererLogger.component("md-compiler");
7
+ function isMarkdownSourceCompileError(error) {
8
+ return isFrontmatterSyntaxError(error);
9
+ }
6
10
  export function compileMarkdownRuntime(mode, projectDir, content, frontmatter, filePath, target = "server", baseUrl, studioEmbed) {
7
11
  return withSpan("transforms.compileMarkdownRuntime", async () => {
8
12
  try {
@@ -25,10 +29,13 @@ export function compileMarkdownRuntime(mode, projectDir, content, frontmatter, f
25
29
  error: err.message,
26
30
  stack: err.stack,
27
31
  });
28
- throw toError(createError({
29
- type: "build",
30
- message: `Markdown compilation error: ${err.message} | file: ${filePath ?? "<memory>"}`,
31
- }));
32
+ if (err instanceof VeryfrontError || !isMarkdownSourceCompileError(err)) {
33
+ throw err;
34
+ }
35
+ throw MARKDOWN_COMPILE_ERROR.create({
36
+ detail: `Markdown compilation error: ${err.message} | file: ${filePath ?? "<memory>"}`,
37
+ cause: err,
38
+ });
32
39
  }
33
40
  }, {
34
41
  "md.filePath": filePath ?? "memory",
@@ -2,5 +2,7 @@ export interface FrontmatterExtractionResult {
2
2
  body: string;
3
3
  frontmatter: Record<string, unknown>;
4
4
  }
5
+ /** Return true when an error came from MDX or Markdown YAML frontmatter parsing. */
6
+ export declare function isFrontmatterSyntaxError(error: unknown): error is SyntaxError;
5
7
  export declare function extractFrontmatter(content: string, providedFrontmatter?: Record<string, unknown>): FrontmatterExtractionResult;
6
8
  //# sourceMappingURL=frontmatter-extractor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter-extractor.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/frontmatter-extractor.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AA0CD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5C,2BAA2B,CAc7B"}
1
+ {"version":3,"file":"frontmatter-extractor.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/frontmatter-extractor.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAQD,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAU7E;AAsDD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5C,2BAA2B,CAc7B"}
@@ -1,9 +1,41 @@
1
1
  import { rendererLogger as logger } from "../../../utils/logger/logger.js";
2
2
  import { extract } from "../../../platform/compat/std/front-matter-yaml.js";
3
+ const FRONTMATTER_SYNTAX_ERROR = Symbol.for("veryfront.transforms.mdx.frontmatter-syntax-error");
4
+ const ObjectDefineProperty = Object.defineProperty;
5
+ const ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
6
+ const ReflectApply = Reflect.apply;
7
+ const ReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor;
8
+ /** Return true when an error came from MDX or Markdown YAML frontmatter parsing. */
9
+ export function isFrontmatterSyntaxError(error) {
10
+ try {
11
+ if (!(error instanceof SyntaxError))
12
+ return false;
13
+ const descriptor = ReflectGetOwnPropertyDescriptor(error, FRONTMATTER_SYNTAX_ERROR);
14
+ return descriptor !== undefined &&
15
+ ReflectApply(ObjectPrototypeHasOwnProperty, descriptor, ["value"]) === true &&
16
+ descriptor.value === true;
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ }
22
+ function createFrontmatterSyntaxError(cause) {
23
+ const error = new SyntaxError(`Invalid YAML frontmatter: ${cause.message}`, { cause });
24
+ ObjectDefineProperty(error, FRONTMATTER_SYNTAX_ERROR, { value: true });
25
+ return error;
26
+ }
3
27
  function extractYamlFrontmatter(content) {
4
28
  if (!content.trim().startsWith("---"))
5
29
  return { body: content, frontmatter: {} };
6
- const extracted = extract(content);
30
+ let extracted;
31
+ try {
32
+ extracted = extract(content);
33
+ }
34
+ catch (error) {
35
+ if (error instanceof SyntaxError)
36
+ throw createFrontmatterSyntaxError(error);
37
+ throw error;
38
+ }
7
39
  return {
8
40
  body: extracted.body,
9
41
  frontmatter: extracted.attrs,
@@ -1 +1 @@
1
- {"version":3,"file":"mdx-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/mdx-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AAM9C,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAuClC"}
1
+ {"version":3,"file":"mdx-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/mdx-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AA4C9C,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAwClC"}
@@ -1,8 +1,43 @@
1
1
  import { rendererLogger } from "../../../utils/index.js";
2
2
  import { resolve as resolveContract } from "../../../extensions/contracts.js";
3
- import { createError, toError } from "../../../errors/index.js";
3
+ import { MDX_COMPILE_ERROR, VeryfrontError } from "../../../errors/index.js";
4
4
  import { withSpan } from "../../../observability/tracing/otlp-setup.js";
5
+ import { isFrontmatterSyntaxError } from "./frontmatter-extractor.js";
5
6
  const logger = rendererLogger.component("mdx-compiler");
7
+ const ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
8
+ const ReflectApply = Reflect.apply;
9
+ const ReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor;
10
+ function readOwnDataProperty(value, key) {
11
+ try {
12
+ const descriptor = ReflectGetOwnPropertyDescriptor(value, key);
13
+ if (descriptor !== undefined &&
14
+ ReflectApply(ObjectPrototypeHasOwnProperty, descriptor, ["value"]) === true) {
15
+ return descriptor.value;
16
+ }
17
+ }
18
+ catch {
19
+ // A hostile proxy cannot provide trusted source-diagnostic evidence.
20
+ }
21
+ return undefined;
22
+ }
23
+ function isMdxSourceCompileError(error) {
24
+ const source = readOwnDataProperty(error, "source");
25
+ const ruleId = readOwnDataProperty(error, "ruleId");
26
+ const line = readOwnDataProperty(error, "line");
27
+ const column = readOwnDataProperty(error, "column");
28
+ const isMdxParserError = typeof source === "string" &&
29
+ /(?:^|-)mdx(?:-|$)|micromark|remark|recma|rehype/.test(source) &&
30
+ typeof ruleId === "string" &&
31
+ Number.isSafeInteger(line) &&
32
+ Number.isSafeInteger(column);
33
+ // Frontmatter failures are identified by the symbol `extractFrontmatter`
34
+ // stamps at the throw site, not by matching stack-frame paths: `extract()` is
35
+ // the only frontmatter path and it tags every SyntaxError it raises. A
36
+ // stack-path heuristic would only add false positives (any SyntaxError whose
37
+ // stack happened to pass through the YAML shim) and does not survive
38
+ // `deno compile` anyway.
39
+ return isMdxParserError || isFrontmatterSyntaxError(error);
40
+ }
6
41
  export function compileMDXRuntime(mode, projectDir, content, frontmatter, filePath, target = "server", baseUrl, studioEmbed) {
7
42
  return withSpan("transforms.compileMDXRuntime", async () => {
8
43
  try {
@@ -19,15 +54,19 @@ export function compileMDXRuntime(mode, projectDir, content, frontmatter, filePa
19
54
  });
20
55
  }
21
56
  catch (error) {
57
+ const err = error instanceof Error ? error : new Error(String(error));
22
58
  logger.error("Compilation failed:", {
23
59
  filePath,
24
- error: error instanceof Error ? error.message : String(error),
25
- stack: error instanceof Error ? error.stack : undefined,
60
+ error: err.message,
61
+ stack: err.stack,
62
+ });
63
+ if (err instanceof VeryfrontError || !isMdxSourceCompileError(err)) {
64
+ throw err;
65
+ }
66
+ throw MDX_COMPILE_ERROR.create({
67
+ detail: `MDX compilation error: ${err.message} | file: ${filePath ?? "<memory>"}`,
68
+ cause: err,
26
69
  });
27
- throw toError(createError({
28
- type: "build",
29
- message: `MDX compilation error: ${error instanceof Error ? error.message : String(error)} | file: ${filePath ?? "<memory>"}`,
30
- }));
31
70
  }
32
71
  }, {
33
72
  "mdx.filePath": filePath ?? "memory",
@@ -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,CAAC,EAAE,MAAM,GACpB,OAAO,CAaT;AAED,wBAAsB,mCAAmC,CACvD,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,SAAwB,EACpC,SAAS,GAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAiD,EAChF,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC,CAwBlB;AAOD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAevD;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAkEf;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc1D;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOzD;AAoBD,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EAMnB,YAAY,CAAC,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,EAChE,YAAY,SAAwB,EACpC,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC,CA+J5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAe5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,MAAM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AED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAkEf;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc1D;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOzD;AAoBD,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EAMnB,YAAY,CAAC,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,EAChE,YAAY,SAAwB,EACpC,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC,CA+J5B"}
@@ -14,7 +14,7 @@ import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
14
14
  import { LRUCache } from "../../../../utils/lru-wrapper.js";
15
15
  import { registerCache } from "../../../../utils/memory/index.js";
16
16
  import { hashCodeHex } from "../../../../utils/hash-utils.js";
17
- import { buildMdxEsmPathCacheKey, MDX_ESM_ALL_FILE_URL_PATTERN_SOURCE } from "../cache-format.js";
17
+ import { buildMdxEsmPathCacheKey, MDX_ESM_ALL_FILE_URL_PATTERN_SOURCE, UNRESOLVED_IMPORTS_SIDECAR_SUFFIX, } from "../cache-format.js";
18
18
  import { ensureMdxModuleDependencies } from "../module-fetcher/dependency-recovery.js";
19
19
  import { findStaticImportFromSpans } from "../utils/source-spans.js";
20
20
  import { formatCacheVersionSegment, isCacheVersionSegment, } from "../../../../utils/cache-version.js";
@@ -299,7 +299,7 @@ export function invalidateModulePaths(changedPaths) {
299
299
  });
300
300
  }
301
301
  }
302
- // Delete stale .mjs files from disk
302
+ // Delete stale modules and their tenant-attribution evidence from disk.
303
303
  for (const mjsPath of staleMjsFiles) {
304
304
  try {
305
305
  await localFs.remove(mjsPath);
@@ -308,6 +308,12 @@ export function invalidateModulePaths(changedPaths) {
308
308
  catch (_) {
309
309
  /* expected: file may already be gone */
310
310
  }
311
+ try {
312
+ await localFs.remove(`${mjsPath}${UNRESOLVED_IMPORTS_SIDECAR_SUFFIX}`);
313
+ }
314
+ catch (_) {
315
+ /* expected: most modules have no unresolved-import evidence */
316
+ }
311
317
  }
312
318
  };
313
319
  _pendingDiskCleanup = _pendingDiskCleanup.then(cleanup, cleanup).catch((error) => {
@@ -1,3 +1,4 @@
1
+ export declare const UNRESOLVED_IMPORTS_SIDECAR_SUFFIX = ".unresolved-imports.json";
1
2
  export declare const MDX_ESM_ALL_FILE_URL_PATTERN_SOURCE: string;
2
3
  export declare const MDX_ESM_MJS_FILE_URL_PATTERN_SOURCE: string;
3
4
  export declare const MDX_ESM_CACHE_NAMESPACE: string;