@superblocksteam/vite-plugin-file-sync 2.0.174-next.0 → 2.0.175-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/dist/agent-tool-executor/codex-drafts.d.ts +12 -0
  2. package/dist/agent-tool-executor/codex-drafts.d.ts.map +1 -0
  3. package/dist/agent-tool-executor/codex-drafts.js +48 -0
  4. package/dist/agent-tool-executor/codex-drafts.js.map +1 -0
  5. package/dist/agent-tool-executor/codex-exec-server.d.ts +42 -0
  6. package/dist/agent-tool-executor/codex-exec-server.d.ts.map +1 -0
  7. package/dist/agent-tool-executor/codex-exec-server.js +405 -0
  8. package/dist/agent-tool-executor/codex-exec-server.js.map +1 -0
  9. package/dist/agent-tool-executor/codex-execution-policy.d.ts +12 -0
  10. package/dist/agent-tool-executor/codex-execution-policy.d.ts.map +1 -0
  11. package/dist/agent-tool-executor/codex-execution-policy.js +201 -0
  12. package/dist/agent-tool-executor/codex-execution-policy.js.map +1 -0
  13. package/dist/agent-tool-executor/native-dotenv-watch-scope.d.ts +12 -0
  14. package/dist/agent-tool-executor/native-dotenv-watch-scope.d.ts.map +1 -0
  15. package/dist/agent-tool-executor/native-dotenv-watch-scope.js +74 -0
  16. package/dist/agent-tool-executor/native-dotenv-watch-scope.js.map +1 -0
  17. package/dist/ai-service/agent/middleware.d.ts.map +1 -1
  18. package/dist/ai-service/agent/middleware.js +45 -0
  19. package/dist/ai-service/agent/middleware.js.map +1 -1
  20. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  21. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +17 -2
  22. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  23. package/dist/ai-service/agent/prompts/build-security-scan-prompt.d.ts.map +1 -1
  24. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js +106 -11
  25. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js.map +1 -1
  26. package/dist/ai-service/agent/security-scan-tools.d.ts +12 -0
  27. package/dist/ai-service/agent/security-scan-tools.d.ts.map +1 -0
  28. package/dist/ai-service/agent/security-scan-tools.js +44 -0
  29. package/dist/ai-service/agent/security-scan-tools.js.map +1 -0
  30. package/dist/ai-service/agent/tool-permission-delivery-metrics.d.ts +1 -1
  31. package/dist/ai-service/agent/tool-permission-delivery-metrics.d.ts.map +1 -1
  32. package/dist/ai-service/agent/tool-permission-delivery-metrics.js +1 -1
  33. package/dist/ai-service/agent/tool-permission-delivery-metrics.js.map +1 -1
  34. package/dist/ai-service/agent/tool-permission-delivery.d.ts +2 -0
  35. package/dist/ai-service/agent/tool-permission-delivery.d.ts.map +1 -1
  36. package/dist/ai-service/agent/tool-permission-delivery.js +7 -0
  37. package/dist/ai-service/agent/tool-permission-delivery.js.map +1 -1
  38. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +3 -3
  39. package/dist/ai-service/agent/tools/apis/test-api.d.ts +78 -13
  40. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  41. package/dist/ai-service/agent/tools/apis/test-api.js +80 -58
  42. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  43. package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
  44. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts +11 -3
  45. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  46. package/dist/ai-service/agent/tools/build-capture-screenshot.js +13 -8
  47. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  48. package/dist/ai-service/agent/tools/build-delete-file.d.ts +1 -1
  49. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +1 -1
  50. package/dist/ai-service/agent/tools/build-navigate-preview.d.ts +6 -0
  51. package/dist/ai-service/agent/tools/build-navigate-preview.d.ts.map +1 -1
  52. package/dist/ai-service/agent/tools/build-navigate-preview.js +5 -4
  53. package/dist/ai-service/agent/tools/build-navigate-preview.js.map +1 -1
  54. package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.d.ts +4 -1
  55. package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.d.ts.map +1 -1
  56. package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.js +6 -3
  57. package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.js.map +1 -1
  58. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts +11 -4
  59. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts.map +1 -1
  60. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js +21 -3
  61. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js.map +1 -1
  62. package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts.map +1 -1
  63. package/dist/ai-service/agent/tools/databases/dev-database-tools.js +32 -5
  64. package/dist/ai-service/agent/tools/databases/dev-database-tools.js.map +1 -1
  65. package/dist/ai-service/agent/tools/get-logs.d.ts +5 -2
  66. package/dist/ai-service/agent/tools/get-logs.d.ts.map +1 -1
  67. package/dist/ai-service/agent/tools/get-logs.js +6 -3
  68. package/dist/ai-service/agent/tools/get-logs.js.map +1 -1
  69. package/dist/ai-service/agent/tools/get-runtime-errors.d.ts +2 -0
  70. package/dist/ai-service/agent/tools/get-runtime-errors.d.ts.map +1 -1
  71. package/dist/ai-service/agent/tools/get-runtime-errors.js +3 -2
  72. package/dist/ai-service/agent/tools/get-runtime-errors.js.map +1 -1
  73. package/dist/ai-service/agent/tools/get-security-findings.js +1 -1
  74. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
  75. package/dist/ai-service/agent/tools/integrations/execute-request.js +28 -3
  76. package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
  77. package/dist/ai-service/agent/tools/integrations/managed-app-database.d.ts +28 -0
  78. package/dist/ai-service/agent/tools/integrations/managed-app-database.d.ts.map +1 -1
  79. package/dist/ai-service/agent/tools/integrations/managed-app-database.js +30 -1
  80. package/dist/ai-service/agent/tools/integrations/managed-app-database.js.map +1 -1
  81. package/dist/ai-service/agent/tools/integrations/metadata.d.ts +6 -3
  82. package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
  83. package/dist/ai-service/agent/tools/integrations/metadata.js +34 -17
  84. package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
  85. package/dist/ai-service/agent/tools/report-security-findings.d.ts +3 -3
  86. package/dist/ai-service/agent/tools/report-security-findings.d.ts.map +1 -1
  87. package/dist/ai-service/agent/tools/report-security-findings.js +6 -4
  88. package/dist/ai-service/agent/tools/report-security-findings.js.map +1 -1
  89. package/dist/ai-service/agent/tools.d.ts +1 -5
  90. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  91. package/dist/ai-service/agent/tools.js +7 -42
  92. package/dist/ai-service/agent/tools.js.map +1 -1
  93. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +4 -3
  94. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
  95. package/dist/ai-service/agent/tools2/tools/grep-metadata.js +4 -2
  96. package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
  97. package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
  98. package/dist/ai-service/agent/tools2/tools/grep.js +27 -5
  99. package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
  100. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  101. package/dist/ai-service/agent/utils.js +12 -8
  102. package/dist/ai-service/agent/utils.js.map +1 -1
  103. package/dist/ai-service/app-interface/file-system-interface.d.ts +1 -1
  104. package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.d.ts +2 -1
  105. package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.d.ts.map +1 -1
  106. package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.js +9 -2
  107. package/dist/ai-service/app-interface/filesystem/handlers/skill-handler.js.map +1 -1
  108. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +1 -0
  109. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -1
  110. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +1 -1
  111. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -1
  112. package/dist/ai-service/app-interface/npm-registry.d.ts +1 -0
  113. package/dist/ai-service/app-interface/npm-registry.d.ts.map +1 -1
  114. package/dist/ai-service/app-interface/npm-registry.js +45 -6
  115. package/dist/ai-service/app-interface/npm-registry.js.map +1 -1
  116. package/dist/ai-service/app-interface/shell.d.ts +7 -1
  117. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  118. package/dist/ai-service/app-interface/shell.js +84 -30
  119. package/dist/ai-service/app-interface/shell.js.map +1 -1
  120. package/dist/ai-service/builder-conversation.d.ts +70 -0
  121. package/dist/ai-service/builder-conversation.d.ts.map +1 -0
  122. package/dist/ai-service/builder-conversation.js +660 -0
  123. package/dist/ai-service/builder-conversation.js.map +1 -0
  124. package/dist/ai-service/builder-inference-auth.d.ts +11 -0
  125. package/dist/ai-service/builder-inference-auth.d.ts.map +1 -0
  126. package/dist/ai-service/builder-inference-auth.js +48 -0
  127. package/dist/ai-service/builder-inference-auth.js.map +1 -0
  128. package/dist/ai-service/builder-runtime.d.ts +181 -0
  129. package/dist/ai-service/builder-runtime.d.ts.map +1 -0
  130. package/dist/ai-service/builder-runtime.js +337 -0
  131. package/dist/ai-service/builder-runtime.js.map +1 -0
  132. package/dist/ai-service/builder-session-store.d.ts +26 -0
  133. package/dist/ai-service/builder-session-store.d.ts.map +1 -0
  134. package/dist/ai-service/builder-session-store.js +66 -0
  135. package/dist/ai-service/builder-session-store.js.map +1 -0
  136. package/dist/ai-service/builder-tool-callbacks.d.ts +26 -0
  137. package/dist/ai-service/builder-tool-callbacks.d.ts.map +1 -0
  138. package/dist/ai-service/builder-tool-callbacks.js +114 -0
  139. package/dist/ai-service/builder-tool-callbacks.js.map +1 -0
  140. package/dist/ai-service/builder-tools.d.ts +46 -0
  141. package/dist/ai-service/builder-tools.d.ts.map +1 -0
  142. package/dist/ai-service/builder-tools.js +181 -0
  143. package/dist/ai-service/builder-tools.js.map +1 -0
  144. package/dist/ai-service/chat/chat-session-store.d.ts +10 -1
  145. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  146. package/dist/ai-service/chat/chat-session-store.js +30 -1
  147. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  148. package/dist/ai-service/chat/switch-chat-seed.d.ts +8 -0
  149. package/dist/ai-service/chat/switch-chat-seed.d.ts.map +1 -0
  150. package/dist/ai-service/chat/switch-chat-seed.js +47 -0
  151. package/dist/ai-service/chat/switch-chat-seed.js.map +1 -0
  152. package/dist/ai-service/dev-database-client.d.ts +1 -0
  153. package/dist/ai-service/dev-database-client.d.ts.map +1 -1
  154. package/dist/ai-service/dev-database-client.js +1 -0
  155. package/dist/ai-service/dev-database-client.js.map +1 -1
  156. package/dist/ai-service/dev-database-file-sync.d.ts +3 -1
  157. package/dist/ai-service/dev-database-file-sync.d.ts.map +1 -1
  158. package/dist/ai-service/dev-database-file-sync.js.map +1 -1
  159. package/dist/ai-service/edit-after-clark.d.ts.map +1 -1
  160. package/dist/ai-service/edit-after-clark.js +10 -5
  161. package/dist/ai-service/edit-after-clark.js.map +1 -1
  162. package/dist/ai-service/features.d.ts +15 -8
  163. package/dist/ai-service/features.d.ts.map +1 -1
  164. package/dist/ai-service/features.js +15 -8
  165. package/dist/ai-service/features.js.map +1 -1
  166. package/dist/ai-service/index.d.ts +47 -19
  167. package/dist/ai-service/index.d.ts.map +1 -1
  168. package/dist/ai-service/index.js +564 -743
  169. package/dist/ai-service/index.js.map +1 -1
  170. package/dist/ai-service/integrations/store.d.ts +5 -1
  171. package/dist/ai-service/integrations/store.d.ts.map +1 -1
  172. package/dist/ai-service/integrations/store.js +8 -0
  173. package/dist/ai-service/integrations/store.js.map +1 -1
  174. package/dist/ai-service/llm/context-v2/context-metrics.js +2 -2
  175. package/dist/ai-service/llm/context-v2/manager.d.ts +3 -1
  176. package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -1
  177. package/dist/ai-service/llm/context-v2/manager.js +5 -0
  178. package/dist/ai-service/llm/context-v2/manager.js.map +1 -1
  179. package/dist/ai-service/llm/context-v2/types.d.ts +1 -1
  180. package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
  181. package/dist/ai-service/llm/context-v2/types.js.map +1 -1
  182. package/dist/ai-service/llm/error.d.ts.map +1 -1
  183. package/dist/ai-service/llm/error.js +17 -3
  184. package/dist/ai-service/llm/error.js.map +1 -1
  185. package/dist/ai-service/llm/request-settings.d.ts +6 -0
  186. package/dist/ai-service/llm/request-settings.d.ts.map +1 -0
  187. package/dist/ai-service/llm/request-settings.js +21 -0
  188. package/dist/ai-service/llm/request-settings.js.map +1 -0
  189. package/dist/ai-service/llm/stream/config.d.ts +1 -1
  190. package/dist/ai-service/llm/stream/config.d.ts.map +1 -1
  191. package/dist/ai-service/llm/stream/config.js.map +1 -1
  192. package/dist/ai-service/llm/stream/errors.d.ts +4 -1
  193. package/dist/ai-service/llm/stream/errors.d.ts.map +1 -1
  194. package/dist/ai-service/llm/stream/errors.js +8 -2
  195. package/dist/ai-service/llm/stream/errors.js.map +1 -1
  196. package/dist/ai-service/llm/stream/observers/llmobs.d.ts.map +1 -1
  197. package/dist/ai-service/llm/stream/observers/llmobs.js +5 -2
  198. package/dist/ai-service/llm/stream/observers/llmobs.js.map +1 -1
  199. package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
  200. package/dist/ai-service/llm/stream/orchestrator.js +3 -6
  201. package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
  202. package/dist/ai-service/llmobs/otel-exporter.d.ts.map +1 -1
  203. package/dist/ai-service/llmobs/otel-exporter.js +4 -0
  204. package/dist/ai-service/llmobs/otel-exporter.js.map +1 -1
  205. package/dist/ai-service/llmobs/tracer.d.ts.map +1 -1
  206. package/dist/ai-service/llmobs/tracer.js +4 -21
  207. package/dist/ai-service/llmobs/tracer.js.map +1 -1
  208. package/dist/ai-service/managed-native-db-availability.d.ts +1 -1
  209. package/dist/ai-service/managed-native-db-availability.d.ts.map +1 -1
  210. package/dist/ai-service/managed-native-db-availability.js +4 -2
  211. package/dist/ai-service/managed-native-db-availability.js.map +1 -1
  212. package/dist/ai-service/native-callback-order.d.ts +7 -0
  213. package/dist/ai-service/native-callback-order.d.ts.map +1 -0
  214. package/dist/ai-service/native-callback-order.js +39 -0
  215. package/dist/ai-service/native-callback-order.js.map +1 -0
  216. package/dist/ai-service/native-secret-redactor.d.ts +4 -0
  217. package/dist/ai-service/native-secret-redactor.d.ts.map +1 -0
  218. package/dist/ai-service/native-secret-redactor.js +34 -0
  219. package/dist/ai-service/native-secret-redactor.js.map +1 -0
  220. package/dist/ai-service/policy-agent-metrics.d.ts +1 -1
  221. package/dist/ai-service/policy-agent-metrics.d.ts.map +1 -1
  222. package/dist/ai-service/policy-agent-metrics.js +1 -0
  223. package/dist/ai-service/policy-agent-metrics.js.map +1 -1
  224. package/dist/ai-service/policy-gate-error.d.ts.map +1 -1
  225. package/dist/ai-service/policy-gate-error.js +34 -3
  226. package/dist/ai-service/policy-gate-error.js.map +1 -1
  227. package/dist/ai-service/policy-gate-remediation-usage.d.ts +2 -1
  228. package/dist/ai-service/policy-gate-remediation-usage.d.ts.map +1 -1
  229. package/dist/ai-service/policy-gate-remediation-usage.js +2 -1
  230. package/dist/ai-service/policy-gate-remediation-usage.js.map +1 -1
  231. package/dist/ai-service/policy-gate-review.d.ts +42 -0
  232. package/dist/ai-service/policy-gate-review.d.ts.map +1 -0
  233. package/dist/ai-service/policy-gate-review.js +664 -0
  234. package/dist/ai-service/policy-gate-review.js.map +1 -0
  235. package/dist/ai-service/skills/system/materialized.d.ts +3 -1
  236. package/dist/ai-service/skills/system/materialized.d.ts.map +1 -1
  237. package/dist/ai-service/skills/system/materialized.js +3 -3
  238. package/dist/ai-service/skills/system/materialized.js.map +1 -1
  239. package/dist/ai-service/skills/system/native.d.ts +7 -0
  240. package/dist/ai-service/skills/system/native.d.ts.map +1 -0
  241. package/dist/ai-service/skills/system/native.js +25 -0
  242. package/dist/ai-service/skills/system/native.js.map +1 -0
  243. package/dist/ai-service/skills/system/paths.d.ts +2 -0
  244. package/dist/ai-service/skills/system/paths.d.ts.map +1 -0
  245. package/dist/ai-service/skills/system/paths.js +2 -0
  246. package/dist/ai-service/skills/system/paths.js.map +1 -0
  247. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  248. package/dist/ai-service/state-machine/handlers/llm-generating.js +31 -8
  249. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  250. package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
  251. package/dist/ai-service/state-machine/helpers/peer.js +5 -4
  252. package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
  253. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.d.ts +1 -1
  254. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.d.ts.map +1 -1
  255. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js +2 -1
  256. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js.map +1 -1
  257. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts +2 -0
  258. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts.map +1 -1
  259. package/dist/ai-service/state-machine/helpers/stable-peer.js +29 -4
  260. package/dist/ai-service/state-machine/helpers/stable-peer.js.map +1 -1
  261. package/dist/ai-service/state-machine/helpers/user-response-message.d.ts.map +1 -1
  262. package/dist/ai-service/state-machine/helpers/user-response-message.js +4 -2
  263. package/dist/ai-service/state-machine/helpers/user-response-message.js.map +1 -1
  264. package/dist/ai-service/types.d.ts +3 -0
  265. package/dist/ai-service/types.d.ts.map +1 -1
  266. package/dist/ai-service/types.js.map +1 -1
  267. package/dist/ai-service/util/rpc-timeout.d.ts +2 -0
  268. package/dist/ai-service/util/rpc-timeout.d.ts.map +1 -1
  269. package/dist/ai-service/util/rpc-timeout.js +2 -0
  270. package/dist/ai-service/util/rpc-timeout.js.map +1 -1
  271. package/dist/ai-service/util/stop-condition.d.ts +8 -0
  272. package/dist/ai-service/util/stop-condition.d.ts.map +1 -1
  273. package/dist/ai-service/util/stop-condition.js +15 -0
  274. package/dist/ai-service/util/stop-condition.js.map +1 -1
  275. package/dist/extract-api-integrations.d.ts +52 -87
  276. package/dist/extract-api-integrations.d.ts.map +1 -1
  277. package/dist/extract-api-integrations.js +512 -473
  278. package/dist/extract-api-integrations.js.map +1 -1
  279. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  280. package/dist/file-sync-vite-plugin.js +53 -5
  281. package/dist/file-sync-vite-plugin.js.map +1 -1
  282. package/dist/file-system-helpers.d.ts +2 -0
  283. package/dist/file-system-helpers.d.ts.map +1 -1
  284. package/dist/file-system-helpers.js +7 -3
  285. package/dist/file-system-helpers.js.map +1 -1
  286. package/dist/git-service/credential-scope.d.ts +16 -0
  287. package/dist/git-service/credential-scope.d.ts.map +1 -0
  288. package/dist/git-service/credential-scope.js +91 -0
  289. package/dist/git-service/credential-scope.js.map +1 -0
  290. package/dist/git-service/index.d.ts +1 -0
  291. package/dist/git-service/index.d.ts.map +1 -1
  292. package/dist/git-service/index.js +11 -32
  293. package/dist/git-service/index.js.map +1 -1
  294. package/dist/git-service/managed-excludes.d.ts.map +1 -1
  295. package/dist/git-service/managed-excludes.js +2 -0
  296. package/dist/git-service/managed-excludes.js.map +1 -1
  297. package/dist/index.d.ts +1 -0
  298. package/dist/index.d.ts.map +1 -1
  299. package/dist/index.js +1 -0
  300. package/dist/index.js.map +1 -1
  301. package/dist/injected-index.d.ts +1 -3
  302. package/dist/injected-index.d.ts.map +1 -1
  303. package/dist/injected-index.js +3 -8
  304. package/dist/injected-index.js.map +1 -1
  305. package/dist/lock-service/index.d.ts +3 -0
  306. package/dist/lock-service/index.d.ts.map +1 -1
  307. package/dist/lock-service/index.js +7 -0
  308. package/dist/lock-service/index.js.map +1 -1
  309. package/dist/migration/get-fullstack-template-dir.d.ts +2 -5
  310. package/dist/migration/get-fullstack-template-dir.d.ts.map +1 -1
  311. package/dist/migration/get-fullstack-template-dir.js +5 -8
  312. package/dist/migration/get-fullstack-template-dir.js.map +1 -1
  313. package/dist/migration-templates/app-fullstack/client/components/hooks/use-mobile.ts +9 -14
  314. package/dist/migration-templates/app-fullstack/package.json +43 -43
  315. package/dist/plugin-options.d.ts +1 -1
  316. package/dist/plugin-options.d.ts.map +1 -1
  317. package/dist/policy-gate-runner.d.ts +32 -7
  318. package/dist/policy-gate-runner.d.ts.map +1 -1
  319. package/dist/policy-gate-runner.js +23 -6
  320. package/dist/policy-gate-runner.js.map +1 -1
  321. package/dist/review-runner.d.ts +25 -0
  322. package/dist/review-runner.d.ts.map +1 -0
  323. package/dist/review-runner.js +196 -0
  324. package/dist/review-runner.js.map +1 -0
  325. package/dist/socket-manager.d.ts +9 -2
  326. package/dist/socket-manager.d.ts.map +1 -1
  327. package/dist/socket-manager.js +160 -19
  328. package/dist/socket-manager.js.map +1 -1
  329. package/dist/sync-service/download.d.ts +22 -0
  330. package/dist/sync-service/download.d.ts.map +1 -1
  331. package/dist/sync-service/download.js +154 -1
  332. package/dist/sync-service/download.js.map +1 -1
  333. package/dist/sync-service/draft-helpers.d.ts +23 -3
  334. package/dist/sync-service/draft-helpers.d.ts.map +1 -1
  335. package/dist/sync-service/draft-helpers.js +196 -72
  336. package/dist/sync-service/draft-helpers.js.map +1 -1
  337. package/dist/sync-service/draft-mutation.d.ts +11 -0
  338. package/dist/sync-service/draft-mutation.d.ts.map +1 -0
  339. package/dist/sync-service/draft-mutation.js +121 -0
  340. package/dist/sync-service/draft-mutation.js.map +1 -0
  341. package/dist/sync-service/draft-state-report-metrics.d.ts +3 -0
  342. package/dist/sync-service/draft-state-report-metrics.d.ts.map +1 -1
  343. package/dist/sync-service/draft-state-report-metrics.js +9 -0
  344. package/dist/sync-service/draft-state-report-metrics.js.map +1 -1
  345. package/dist/sync-service/index.d.ts +29 -1
  346. package/dist/sync-service/index.d.ts.map +1 -1
  347. package/dist/sync-service/index.js +241 -10
  348. package/dist/sync-service/index.js.map +1 -1
  349. package/dist/sync-service/list-dir.d.ts +3 -1
  350. package/dist/sync-service/list-dir.d.ts.map +1 -1
  351. package/dist/sync-service/list-dir.js +9 -2
  352. package/dist/sync-service/list-dir.js.map +1 -1
  353. package/dist/sync-service/native-draft-session.d.ts +22 -0
  354. package/dist/sync-service/native-draft-session.d.ts.map +1 -0
  355. package/dist/sync-service/native-draft-session.js +229 -0
  356. package/dist/sync-service/native-draft-session.js.map +1 -0
  357. package/dist/sync-service/safe-directory-reader.d.ts +24 -0
  358. package/dist/sync-service/safe-directory-reader.d.ts.map +1 -0
  359. package/dist/sync-service/safe-directory-reader.js +124 -0
  360. package/dist/sync-service/safe-directory-reader.js.map +1 -0
  361. package/dist/util/log-sanitizer.d.ts +4 -0
  362. package/dist/util/log-sanitizer.d.ts.map +1 -1
  363. package/dist/util/log-sanitizer.js +7 -0
  364. package/dist/util/log-sanitizer.js.map +1 -1
  365. package/package.json +57 -52
  366. package/dist/migration-templates/app-fullstack/.gitignore +0 -50
@@ -1,5 +1,6 @@
1
1
  import { posix as posixPath } from "node:path";
2
2
  import { parse } from "@babel/parser";
3
+ import * as t from "@babel/types";
3
4
  function isNode(value) {
4
5
  return !!value && typeof value === "object";
5
6
  }
@@ -76,154 +77,48 @@ function unwrapExpression(node) {
76
77
  }
77
78
  return node;
78
79
  }
80
+ function specifiersOf(statement) {
81
+ return Array.isArray(statement.specifiers)
82
+ ? statement.specifiers.filter(isNode)
83
+ : [];
84
+ }
79
85
  function isTypeOnly(node) {
80
86
  return (node.importKind === "type" ||
81
87
  node.importKind === "typeof" ||
82
88
  node.exportKind === "type");
83
89
  }
84
90
  function valueSpecifiersOf(statement) {
85
- if (isTypeOnly(statement) || !Array.isArray(statement.specifiers)) {
86
- return [];
87
- }
88
- return statement.specifiers.filter((specifier) => isNode(specifier) && !isTypeOnly(specifier));
91
+ return isTypeOnly(statement)
92
+ ? []
93
+ : specifiersOf(statement).filter((specifier) => !isTypeOnly(specifier));
89
94
  }
90
95
  /**
91
- * Walks top-level variable declarations in a program body, calling `visitor`
92
- * for each individual declarator of a binding `bindings` trusts. Unwraps
93
- * `export const x = ...` (`ExportNamedDeclaration` whose `.declaration` is
94
- * a `VariableDeclaration`) to its inner `VariableDeclaration` so exported
95
- * declarations are visited the same as bare ones. A `declare` statement has
96
- * no runtime value, so it is never visited.
96
+ * The declarators of a top-level `const`, `let`, or `var` statement,
97
+ * including an exported one, and none for a `declare` statement, which has
98
+ * no runtime value.
97
99
  */
98
- function visitVariableDeclarations(programBody, bindings, visitor) {
99
- for (const statement of programBody) {
100
- if (!isNode(statement)) {
101
- continue;
102
- }
103
- const declarationNode = statement.type === "ExportNamedDeclaration" &&
104
- isNode(statement.declaration)
105
- ? statement.declaration
106
- : statement;
107
- if (declarationNode.type !== "VariableDeclaration" ||
108
- declarationNode.declare === true ||
109
- (bindings === "const-only" && declarationNode.kind !== "const") ||
110
- !Array.isArray(declarationNode.declarations)) {
111
- continue;
112
- }
113
- for (const declaration of declarationNode.declarations) {
114
- if (isNode(declaration)) {
115
- visitor(declaration);
116
- }
117
- }
118
- }
119
- }
120
- function buildVariableInitializerMap(programBody, bindings) {
121
- const initializers = new Map();
122
- visitVariableDeclarations(programBody, bindings, (declaration) => {
123
- const identifier = declaration.id;
124
- if (!isNode(identifier) ||
125
- identifier.type !== "Identifier" ||
126
- typeof identifier.name !== "string") {
127
- return;
128
- }
129
- initializers.set(identifier.name, declaration.init);
130
- });
131
- return initializers;
132
- }
133
- function resolveApiConfigObject(expression, variableInitializers) {
134
- const resolvedExpression = unwrapExpression(expression);
135
- if (!resolvedExpression) {
136
- return undefined;
137
- }
138
- if (resolvedExpression.type === "Identifier" &&
139
- typeof resolvedExpression.name === "string") {
140
- return resolveApiConfigObject(variableInitializers.get(resolvedExpression.name), variableInitializers);
141
- }
142
- if (resolvedExpression.type !== "CallExpression" ||
143
- getCalleeName(resolvedExpression.callee) !== "api" ||
144
- !Array.isArray(resolvedExpression.arguments)) {
145
- return undefined;
146
- }
147
- const config = unwrapExpression(resolvedExpression.arguments[0]);
148
- if (!config || config.type !== "ObjectExpression") {
149
- return undefined;
150
- }
151
- return config;
152
- }
153
- function findExportedApiConfigObject(programBody, bindings) {
154
- const variableInitializers = buildVariableInitializerMap(programBody, bindings);
155
- for (const statement of programBody) {
156
- if (!isNode(statement)) {
157
- continue;
158
- }
159
- if (statement.type === "ExportDefaultDeclaration") {
160
- return resolveApiConfigObject(statement.declaration, variableInitializers);
161
- }
162
- if (statement.type === "ExportNamedDeclaration" &&
163
- !isNode(statement.source)) {
164
- for (const specifier of valueSpecifiersOf(statement)) {
165
- if (specifier.type !== "ExportSpecifier" ||
166
- getPropertyName(specifier.exported) !== "default") {
167
- continue;
168
- }
169
- return resolveApiConfigObject(specifier.local, variableInitializers);
170
- }
171
- }
100
+ function variableDeclaratorsOf(statement) {
101
+ const declaration = statement.type === "ExportNamedDeclaration" && isNode(statement.declaration)
102
+ ? statement.declaration
103
+ : statement;
104
+ if (declaration.type !== "VariableDeclaration" ||
105
+ declaration.declare === true ||
106
+ !Array.isArray(declaration.declarations)) {
107
+ return [];
172
108
  }
173
- return undefined;
109
+ return declaration.declarations
110
+ .filter(isNode)
111
+ .map((declarator) => ({ kind: declaration.kind, declarator }));
174
112
  }
175
- function buildVariableReferenceMap(programBody, stringLiterals, bindings) {
176
- const refs = new Map();
177
- visitVariableDeclarations(programBody, bindings, (declaration) => {
178
- const identifier = declaration.id;
179
- const init = declaration.init;
180
- if (!isNode(identifier) ||
181
- identifier.type !== "Identifier" ||
182
- typeof identifier.name !== "string") {
183
- return;
184
- }
185
- if (!isNode(init) ||
186
- init.type !== "CallExpression" ||
187
- !Array.isArray(init.arguments)) {
188
- return;
189
- }
190
- const pluginId = getCalleeName(init.callee);
191
- const id = resolveStringArgument(init.arguments[0], stringLiterals);
192
- if (!pluginId || !id) {
193
- return;
194
- }
195
- refs.set(identifier.name, { pluginId, id });
196
- });
197
- return refs;
198
- }
199
- function buildStringLiteralMap(programBody, bindings) {
200
- const literals = new Map();
201
- visitVariableDeclarations(programBody, bindings, (declaration) => {
202
- const identifier = declaration.id;
203
- if (!isNode(identifier) ||
204
- identifier.type !== "Identifier" ||
205
- typeof identifier.name !== "string") {
206
- return;
207
- }
208
- const value = getLiteralString(declaration.init);
209
- if (value !== undefined) {
210
- literals.set(identifier.name, value);
211
- }
212
- });
213
- return literals;
214
- }
215
- function resolveStringArgument(node, stringLiterals) {
216
- const literal = getLiteralString(node);
217
- if (literal !== undefined) {
218
- return literal;
219
- }
220
- if (isNode(node) &&
221
- node.type === "Identifier" &&
222
- typeof node.name === "string") {
223
- return stringLiterals.get(node.name);
113
+ function declaredNames(declaration) {
114
+ if (!t.isNode(declaration)) {
115
+ return [];
224
116
  }
225
- return undefined;
117
+ const names = Object.keys(t.getOuterBindingIdentifiers(declaration));
118
+ const declaredName = "id" in declaration ? getPropertyName(declaration.id) : undefined;
119
+ return declaredName ? [...names, declaredName] : names;
226
120
  }
121
+ const UNRESOLVED_EXPORT = { kind: "unresolved" };
227
122
  /**
228
123
  * The object literals an `api()` config declares its integrations in, and
229
124
  * whether they are all it declares. A spread, a computed key, an
@@ -245,216 +140,97 @@ function readIntegrationsObjects(apiConfig) {
245
140
  members.every((member) => getMemberKeyName(member) !== undefined),
246
141
  };
247
142
  }
248
- function extractFromProgram(programBody, importedRefs, bindings) {
249
- const stringLiterals = buildStringLiteralMap(programBody, bindings);
250
- // Seed with imported id constants (e.g. `import { SHEETS_ID } from
251
- // "../lib/constants.js"`) so a same-file declaration like
252
- // `const sheets = restApiIntegration(SHEETS_ID)` can resolve them. Only
253
- // fill in names the same-file scan didn't already find, so a same-file
254
- // literal always wins over an imported one of the same name. In practice
255
- // this `!stringLiterals.has(name)` check is defensive and unreachable for
256
- // valid input: a same-file `const X` and an `import { X }` of the same
257
- // name is a duplicate lexical binding, which is a parse/type error in
258
- // real TS/ESM and can't occur in a file that actually compiles.
259
- for (const [name, ref] of importedRefs) {
260
- if (ref.kind === "id" && !stringLiterals.has(name)) {
261
- stringLiterals.set(name, ref.id);
262
- }
263
- }
264
- const variableRefs = buildVariableReferenceMap(programBody, stringLiterals, bindings);
265
- const apiConfig = findExportedApiConfigObject(programBody, bindings);
266
- if (!apiConfig) {
267
- return { integrations: [], unresolvedKeys: [] };
268
- }
269
- const { objects, isDefinitive } = readIntegrationsObjects(apiConfig);
270
- const integrations = [];
271
- const unresolvedKeys = isDefinitive ? [] : ["*"];
272
- for (const property of objects.flatMap(membersOf)) {
273
- if (property.type !== "ObjectProperty") {
274
- // Not a key/value property at all (e.g. a spread element or a method),
275
- // so there is no key to report as unresolved.
276
- unresolvedKeys.push("(dynamic)");
277
- continue;
278
- }
279
- const key = getMemberKeyName(property);
280
- if (!key) {
281
- unresolvedKeys.push("(unknown)");
282
- continue;
283
- }
284
- if (isNode(property.value) &&
285
- property.value.type === "CallExpression" &&
286
- Array.isArray(property.value.arguments)) {
287
- const pluginId = getCalleeName(property.value.callee);
288
- const arg = property.value.arguments[0];
289
- let id = resolveStringArgument(arg, stringLiterals);
290
- if (!id &&
291
- isNode(arg) &&
292
- arg.type === "Identifier" &&
293
- typeof arg.name === "string") {
294
- const imported = importedRefs.get(arg.name);
295
- if (imported?.kind === "id") {
296
- id = imported.id;
297
- }
298
- }
299
- if (pluginId && id) {
300
- integrations.push({ key, pluginId, id });
301
- }
302
- else {
303
- unresolvedKeys.push(key);
304
- }
305
- continue;
306
- }
307
- if (isNode(property.value) &&
308
- property.value.type === "Identifier" &&
309
- typeof property.value.name === "string") {
310
- const resolved = variableRefs.get(property.value.name);
311
- if (resolved) {
312
- integrations.push({ key, ...resolved });
313
- continue;
314
- }
315
- const imported = importedRefs.get(property.value.name);
316
- if (imported?.kind === "declaration") {
317
- integrations.push({
318
- key,
319
- pluginId: imported.pluginId,
320
- id: imported.id,
321
- });
322
- continue;
323
- }
324
- unresolvedKeys.push(key);
325
- continue;
326
- }
327
- unresolvedKeys.push(key);
143
+ function unresolvedKeyOf(member) {
144
+ if (member.type !== "ObjectProperty") {
145
+ return "(dynamic)";
328
146
  }
329
- return { integrations, unresolvedKeys };
147
+ return getMemberKeyName(member) ?? "(unknown)";
330
148
  }
331
149
  /**
332
- * Extract integration declarations from an SDK API source file.
333
- *
334
- * Anchors on the exported `api({ ... })` config object and extracts
335
- * integrations from its `integrations` property.
336
- *
337
- * Supports inline declarations:
338
- * `integrations: { db: postgres("uuid") }`
339
- *
340
- * Top-level variable references:
341
- * `const DB = postgres("uuid"); integrations: { db: DB }`
342
- *
343
- * And string variable indirection:
344
- * `const ID = "uuid"; integrations: { db: postgres(ID) }`
345
- *
346
- * Also resolves top-level `export const` declarations and `as const`
347
- * literals in the same file (e.g. `export const ID = "uuid" as const;`) —
348
- * a deliberate, additive improvement over the previous bare-declaration-only
349
- * behavior. This is still single-file scope: only same-file declarations
350
- * (exported or not) are considered, imports are never followed.
351
- *
352
- * Single-file only: does not follow imports, so an integration declared via
353
- * an imported constant or an imported `integrations` object cannot be
354
- * resolved here — it is silently dropped (its key is simply absent from the
355
- * returned array, with no signal that it was seen but unresolved). Callers
356
- * that need imported declarations resolved, or that need to know about
357
- * unresolved keys instead of silently losing them, must use
358
- * {@link extractApiIntegrations} instead.
150
+ * Extracts the integrations a file's default `api()` export declares from the
151
+ * file alone. A `let` or `var` reads as its initializer, since callers use
152
+ * the result to list every integration an API may touch, such as the
153
+ * migration write policy, which must not drop one. A declaration whose ID
154
+ * comes from an import is left out without a trace;
155
+ * {@link extractApiIntegrations} follows imports and reports the keys it
156
+ * cannot resolve.
359
157
  */
360
158
  export function extractIntegrationsFromSource(source) {
361
- let ast;
159
+ let body;
362
160
  try {
363
- ast = parse(source, {
364
- sourceType: "module",
365
- plugins: ["typescript"],
366
- });
161
+ body = parseProgramBody(source, "");
367
162
  }
368
163
  catch {
369
164
  return [];
370
165
  }
371
- return extractFromProgram(ast.program.body, new Map(), "any").integrations;
166
+ const module = new SourceModule("", body);
167
+ return new ApiModule(module, new ModuleScope(module, new Map(), "any")).integrationsOf("default").integrations;
372
168
  }
373
- /**
374
- * Single-file only: does not follow imports, so an integration declared via
375
- * an imported constant or an imported `integrations` object cannot be
376
- * resolved here — it is silently dropped (its `id` is simply absent from the
377
- * returned array, with no signal that it was seen but unresolved). Callers
378
- * that need imported declarations resolved, or that need to know about
379
- * unresolved keys instead of silently losing them, must use
380
- * {@link extractApiIntegrations} instead.
381
- */
169
+ /** The IDs {@link extractIntegrationsFromSource} finds, in declaration order. */
382
170
  export function extractIntegrationIdsFromSource(source) {
383
171
  return extractIntegrationsFromSource(source).map((integration) => integration.id);
384
172
  }
385
173
  /**
386
- * Async variant of {@link extractIntegrationsFromSource} that also resolves
387
- * integrations declared via imports from other files, and reports which
388
- * `integrations` object keys could not be resolved to a complete
389
- * `{ key, pluginId, id }` triple.
174
+ * Extracts the integrations an SDK API module's `api()` export declares,
175
+ * following relative imports, and reports the `integrations` keys it could
176
+ * not resolve.
390
177
  *
391
- * Import resolution supports one-hop relative imports (e.g., `../lib/integrations.js`).
392
- * For each imported name, resolves it in the imported module via:
393
- * 1. Imported string-literal constants: `export const SHEETS_ID = "sheets-uuid"`
394
- * (including `as const`/type-assertion wrapping and re-exports via
395
- * `export { name }` specifiers).
396
- * 2. Imported integration declarations: `export const jira = restApiIntegration("jira-uuid")`
397
- * including string-literal indirection within the imported module, and
398
- * the same `export { name }` specifier form.
178
+ * `exportName` selects the default export when omitted or `"default"`,
179
+ * otherwise a named one: `export const <name> = api({...})`,
180
+ * `export const <name> = someApi`, or `export { someApi as <name> }`.
399
181
  *
400
- * Non-relative imports (package imports), type-only imports and exports,
401
- * `declare` bindings, re-exports from another module
402
- * (`export { name } from "..."`), and imports that more than one candidate
403
- * file could satisfy are not followed.
182
+ * A declaration resolves when its ID is a string literal, or a binding,
183
+ * alias, or integration declaration that leads to one, in the entry file or
184
+ * in a module it reaches within {@link MAX_IMPORT_HOPS} imports or
185
+ * re-exports. Package imports, type-only imports and exports, `declare`
186
+ * bindings, and imports that more than one candidate file could satisfy are
187
+ * not followed. `bindings` defaults to `"any"`; a caller that skips an
188
+ * approval based on the result passes `"const-only"`.
404
189
  *
405
- * `bindings` defaults to `"any"`, which reads `let` and `var` bindings as
406
- * their initializer. A caller that skips an approval based on the result
407
- * passes `"const-only"`, since a `let` or `var` can be reassigned before
408
- * `api()` reads it.
409
- *
410
- * `params.entryPoint` MUST be an app-root-relative posix path (e.g.
411
- * `server/apis/get-rows.ts`), never an absolute path or one containing a
412
- * backslash — an entry point that violates this contract skips import
413
- * resolution entirely (see the guard at the top of
414
- * `buildImportedIntegrationRefs`). Within that contract, resolved relative
415
- * import candidates that would escape the app root (e.g. `../../../secrets.ts`)
416
- * are skipped without reading them, but that `..`-prefix skip is only a
417
- * best-effort guard against traversal *relative to entryPoint's own
418
- * directory* — it is not a substitute for real containment enforcement.
419
- * Authoritative containment against the actual filesystem root lives in the
420
- * caller's `readSource` implementation (see `resolveContainedPath` in
421
- * `collect-sdk-apis.mts`), which re-resolves every candidate against the app
422
- * root before touching disk.
190
+ * `entryPoint` must be an app-root-relative posix path such as
191
+ * `server/apis/get-rows.ts`; imports of an absolute or backslashed one are
192
+ * not followed. Candidates above the app root are skipped without being
193
+ * read, but containment is enforced by `readSource`, as
194
+ * `createContainedSourceReader` does for testApi and
195
+ * `resolveContainedRealPath` does for the CLI build manifest.
423
196
  *
424
197
  * `unresolvedKeys` entries are one of:
425
- * - a specific `integrations` object key that could not be resolved
426
- * - `"(unknown)"` for an `ObjectProperty` whose key itself couldn't be read
427
- * (e.g. a computed key)
428
- * - `"(dynamic)"` for a non-`ObjectProperty` member of the integrations
429
- * object (spread elements, methods)
430
- * - `"*"` as a sentinel meaning the config may declare integrations other
431
- * than the ones read: `api({ integrations })` shorthand,
432
- * `api({ integrations: sharedObject })` referencing a non-literal value, a
433
- * spread or computed key in the config, an `integrations` accessor or
434
- * method, a second `integrations` property, or the entry file itself
435
- * failing to parse. `integrations` then lists only the declarations that
436
- * could be read.
198
+ * - an `integrations` key whose declaration could not be resolved
199
+ * - `"(unknown)"` for a declaration whose key is not static
200
+ * - `"(dynamic)"` for a spread or method inside `integrations`
201
+ * - `"*"` when the export may declare integrations other than the ones read:
202
+ * the entry file has no local export by that name, which includes one it
203
+ * re-exports from another module, its value is not an `api({...})` call,
204
+ * its config has a spread, a computed key, an `integrations` accessor or
205
+ * method, a second or non-literal `integrations` property, or the entry
206
+ * file does not parse. `integrations` then lists only the declarations
207
+ * that could be read.
437
208
  */
438
209
  export async function extractApiIntegrations(params) {
439
- let ast;
210
+ let body;
440
211
  try {
441
- ast = parse(params.source, {
442
- sourceType: "module",
443
- plugins: ["typescript"],
444
- });
212
+ body = parseProgramBody(params.source, params.entryPoint);
445
213
  }
446
214
  catch {
447
- // The entry file itself failed to parse (e.g. parser-config drift: a
448
- // real build compiles syntax our @babel/parser config rejects, such as
449
- // decorators or import attributes). Report the "*" sentinel instead of
450
- // silently returning an empty result — this is maximal uncertainty
451
- // about the whole integrations surface, exactly what "*" means below.
452
215
  return { integrations: [], unresolvedKeys: ["*"] };
453
216
  }
454
- const bindings = params.bindings ?? "any";
455
- const importedRefs = await buildImportedIntegrationRefs(ast.program.body, params.entryPoint, params.readSource, bindings);
456
- return extractFromProgram(ast.program.body, importedRefs, bindings);
217
+ const exportName = params.exportName ?? "default";
218
+ const entry = new SourceModule(params.entryPoint, body);
219
+ const scope = await new ImportedIntegrationResolver(params.readSource, params.bindings ?? "any").entryScope(entry, (probe) => new ApiModule(entry, probe).integrationsOf(exportName));
220
+ return new ApiModule(entry, scope).integrationsOf(exportName);
221
+ }
222
+ /**
223
+ * Parses a module as TypeScript, and as JSX too when its path is a `.tsx` or
224
+ * `.jsx` file. A `.ts` file cannot also be read as JSX, since `<T>value` is a
225
+ * type assertion there.
226
+ */
227
+ function parseProgramBody(source, path) {
228
+ const plugins = JSX_EXTENSIONS.includes(posixPath.extname(path))
229
+ ? ["typescript", "jsx"]
230
+ : ["typescript"];
231
+ return parse(source, { sourceType: "module", plugins }).program.body;
457
232
  }
233
+ const JSX_EXTENSIONS = [".tsx", ".jsx"];
458
234
  const TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
459
235
  const SCRIPT_EXTENSIONS = [...TS_EXTENSIONS, ".js", ".jsx", ".mjs", ".cjs"];
460
236
  const JS_TO_TS_EXTENSIONS = {
@@ -481,185 +257,448 @@ export function resolveRelativeImportPath(fromPath, importPath) {
481
257
  }
482
258
  return SCRIPT_EXTENSIONS.map((ext) => resolved + ext);
483
259
  }
484
- /** A file whose read throws counts as existing, since the bundler may load it. */
485
- async function readCandidate(path, readSource) {
486
- let source;
487
- try {
488
- source = await readSource(path);
260
+ /**
261
+ * One parsed module, addressed by its app-root-relative posix path, and the
262
+ * statements that matter for resolving integrations. Type-only and `declare`
263
+ * statements have no runtime value, so only `explicitExportNames` sees them.
264
+ */
265
+ class SourceModule {
266
+ path;
267
+ body;
268
+ constructor(path, body) {
269
+ this.path = path;
270
+ this.body = body;
271
+ }
272
+ /**
273
+ * The app-root-relative paths an import or re-export source of this module
274
+ * may name, or none when it must not be followed: package imports, and any
275
+ * specifier containing a backslash, which `posixPath.join` would treat as
276
+ * a filename character so the `..`-prefix skip could not catch a traversal
277
+ * spelled with it. Candidates above the app root are dropped unread.
278
+ */
279
+ candidatePathsFor(sourceNode) {
280
+ const specifier = isNode(sourceNode) ? sourceNode.value : undefined;
281
+ if (typeof specifier !== "string" ||
282
+ !specifier.startsWith(".") ||
283
+ specifier.includes("\\")) {
284
+ return [];
285
+ }
286
+ return resolveRelativeImportPath(this.path, specifier).filter((candidate) => !candidate.startsWith(".."));
287
+ }
288
+ variableDeclarators() {
289
+ return this.statements().flatMap(variableDeclaratorsOf);
290
+ }
291
+ /** `import { a, b as c } from "..."` statements. */
292
+ namedImports() {
293
+ return this.references("ImportDeclaration", "ImportSpecifier");
294
+ }
295
+ /**
296
+ * The source and source-side name of an `export { a as name } from "..."`
297
+ * that exports `name`.
298
+ */
299
+ namedReExportOf(name) {
300
+ for (const { source, specifiers } of this.references("ExportNamedDeclaration", "ExportSpecifier")) {
301
+ for (const specifier of specifiers) {
302
+ const localName = getPropertyName(specifier.local);
303
+ if (localName && getPropertyName(specifier.exported) === name) {
304
+ return { source, localName };
305
+ }
306
+ }
307
+ }
308
+ return undefined;
489
309
  }
490
- catch {
491
- return { exists: true };
310
+ /** The sources of `export * from "..."` statements. */
311
+ starReExportSources() {
312
+ return this.statementsOfType("ExportAllDeclaration")
313
+ .filter((statement) => !isTypeOnly(statement))
314
+ .map((statement) => statement.source);
315
+ }
316
+ /**
317
+ * The expression behind each value the module exports from its own scope:
318
+ * `export default <expr>`, the binding of `export const <name>`, and the
319
+ * local of `export { <local> as <name> }`.
320
+ */
321
+ localExports() {
322
+ const exports = new Map();
323
+ for (const statement of this.statementsOfType("ExportDefaultDeclaration")) {
324
+ if (isNode(statement.declaration)) {
325
+ exports.set("default", statement.declaration);
326
+ }
327
+ }
328
+ for (const statement of this.statementsOfType("ExportNamedDeclaration")) {
329
+ if (isNode(statement.source)) {
330
+ continue;
331
+ }
332
+ for (const { declarator } of variableDeclaratorsOf(statement)) {
333
+ const name = getPropertyName(declarator.id);
334
+ if (name && isNode(declarator.id)) {
335
+ exports.set(name, declarator.id);
336
+ }
337
+ }
338
+ for (const specifier of valueSpecifiersOf(statement)) {
339
+ const exportedName = getPropertyName(specifier.exported);
340
+ if (exportedName && isNode(specifier.local)) {
341
+ exports.set(exportedName, specifier.local);
342
+ }
343
+ }
344
+ }
345
+ return exports;
346
+ }
347
+ /**
348
+ * Every name the module exports other than through `export *`, which ESM
349
+ * shadows with them and which never provides `default`. Type-only and
350
+ * `declare` exports count: TypeScript resolves the name to them while the
351
+ * runtime would take a star source's value, so the name stays unresolved.
352
+ */
353
+ explicitExportNames() {
354
+ const names = new Set(["default"]);
355
+ for (const statement of this.statementsOfType("TSImportEqualsDeclaration")) {
356
+ const name = statement.isExport
357
+ ? getPropertyName(statement.id)
358
+ : undefined;
359
+ if (name) {
360
+ names.add(name);
361
+ }
362
+ }
363
+ for (const statement of this.statementsOfType("ExportNamedDeclaration")) {
364
+ for (const name of declaredNames(statement.declaration)) {
365
+ names.add(name);
366
+ }
367
+ for (const specifier of specifiersOf(statement)) {
368
+ const exportedName = getPropertyName(specifier.exported);
369
+ if (exportedName) {
370
+ names.add(exportedName);
371
+ }
372
+ }
373
+ }
374
+ return names;
492
375
  }
493
- if (source === undefined) {
494
- return { exists: false };
376
+ references(statementType, specifierType) {
377
+ return this.statementsOfType(statementType)
378
+ .filter((statement) => isNode(statement.source))
379
+ .map((statement) => ({
380
+ source: statement.source,
381
+ specifiers: valueSpecifiersOf(statement).filter((specifier) => specifier.type === specifierType),
382
+ }))
383
+ .filter(({ specifiers }) => specifiers.length > 0);
495
384
  }
496
- try {
497
- return {
498
- exists: true,
499
- body: parse(source, {
500
- sourceType: "module",
501
- plugins: ["typescript"],
502
- }).program.body,
503
- };
385
+ statementsOfType(type) {
386
+ return this.statements().filter((statement) => statement.type === type);
504
387
  }
505
- catch {
506
- return { exists: true };
388
+ statements() {
389
+ return this.body.filter(isNode);
507
390
  }
508
391
  }
509
392
  /**
510
- * The program body of the file an import loads when exactly one of its
511
- * candidate files exists. With more than one, which the bundler loads depends
512
- * on its resolution order, so the import is left unresolved.
393
+ * What the top-level bindings of one module and the names it imports refer
394
+ * to: string IDs, integration declarations, aliases of either, and `api()`
395
+ * configs.
513
396
  */
514
- async function readUnambiguous(candidatePaths, readSource, cache) {
515
- const existing = [];
516
- for (const candidate of candidatePaths) {
517
- let file = cache.get(candidate);
518
- if (!file) {
519
- file = await readCandidate(candidate, readSource);
520
- cache.set(candidate, file);
521
- }
522
- if (file.exists) {
523
- existing.push(file);
397
+ class ModuleScope {
398
+ importedRefs;
399
+ initializers = new Map();
400
+ constructor(module, importedRefs, bindings) {
401
+ this.importedRefs = importedRefs;
402
+ for (const { kind, declarator } of module.variableDeclarators()) {
403
+ const name = getPropertyName(declarator.id);
404
+ if (name && (bindings === "any" || kind === "const")) {
405
+ this.initializers.set(name, declarator.init);
406
+ }
524
407
  }
525
408
  }
526
- return existing.length === 1 ? existing[0]?.body : undefined;
527
- }
528
- function buildExportedIntegrationRefMap(programBody, bindings) {
529
- const refs = new Map();
530
- const stringLiterals = buildStringLiteralMap(programBody, bindings);
531
- // Resolves specifier-based exports (`const jira = ...; export { jira };`)
532
- // against the module's bare top-level variable declarations.
533
- const variableRefs = buildVariableReferenceMap(programBody, stringLiterals, bindings);
534
- // Resolve `export const x = ...` declarations directly. Filtering to only
535
- // `ExportNamedDeclaration` statements before delegating to the shared
536
- // walker means bare (non-exported) top-level consts are correctly excluded
537
- // here, even though they're visible for same-file indirection above.
538
- const exportedDeclarationStatements = programBody.filter((statement) => isNode(statement) && statement.type === "ExportNamedDeclaration");
539
- visitVariableDeclarations(exportedDeclarationStatements, bindings, (declaration) => {
540
- const identifier = declaration.id;
541
- if (!isNode(identifier) ||
542
- identifier.type !== "Identifier" ||
543
- typeof identifier.name !== "string") {
544
- return;
545
- }
546
- const literal = getLiteralString(declaration.init);
409
+ resolveExpression(node, followedNames = new Set()) {
410
+ const literal = getLiteralString(node);
547
411
  if (literal !== undefined) {
548
- refs.set(identifier.name, { kind: "id", id: literal });
549
- return;
550
- }
551
- const init = declaration.init;
552
- if (isNode(init) &&
553
- init.type === "CallExpression" &&
554
- Array.isArray(init.arguments)) {
555
- const pluginId = getCalleeName(init.callee);
556
- const id = resolveStringArgument(init.arguments[0], stringLiterals);
557
- if (pluginId && id) {
558
- refs.set(identifier.name, { kind: "declaration", pluginId, id });
559
- }
412
+ return { kind: "id", id: literal };
560
413
  }
561
- });
562
- // A specifier of `export { name } from "..."` names a binding of that
563
- // other module, which is not followed, never a same-named local one.
564
- for (const statement of programBody) {
565
- if (!isNode(statement) ||
566
- statement.type !== "ExportNamedDeclaration" ||
567
- isNode(statement.source)) {
568
- continue;
569
- }
570
- for (const specifier of valueSpecifiersOf(statement)) {
571
- if (specifier.type !== "ExportSpecifier") {
572
- continue;
573
- }
574
- const localName = getPropertyName(specifier.local);
575
- const exportedName = getPropertyName(specifier.exported);
576
- if (!localName || !exportedName) {
577
- continue;
414
+ const expression = unwrapExpression(node);
415
+ if (expression?.type === "Identifier" &&
416
+ typeof expression.name === "string") {
417
+ return this.resolveName(expression.name, followedNames);
418
+ }
419
+ if (expression?.type === "CallExpression" &&
420
+ Array.isArray(expression.arguments)) {
421
+ const pluginId = getCalleeName(expression.callee);
422
+ const argument = this.resolveExpression(expression.arguments[0], followedNames);
423
+ return pluginId && argument?.kind === "id"
424
+ ? { kind: "declaration", pluginId, id: argument.id }
425
+ : undefined;
426
+ }
427
+ return undefined;
428
+ }
429
+ resolveDeclaration(node) {
430
+ const ref = this.resolveExpression(node);
431
+ return ref?.kind === "declaration"
432
+ ? { pluginId: ref.pluginId, id: ref.id }
433
+ : undefined;
434
+ }
435
+ /** The config object of the `api({...})` call an expression evaluates to. */
436
+ resolveApiConfig(node, followedNames = new Set()) {
437
+ const expression = unwrapExpression(node);
438
+ if (expression?.type === "Identifier" &&
439
+ typeof expression.name === "string") {
440
+ const name = expression.name;
441
+ if (followedNames.has(name) || !this.initializers.has(name)) {
442
+ return undefined;
578
443
  }
579
- const literal = stringLiterals.get(localName);
580
- if (literal !== undefined) {
581
- refs.set(exportedName, { kind: "id", id: literal });
582
- continue;
444
+ followedNames.add(name);
445
+ return this.resolveApiConfig(this.initializers.get(name), followedNames);
446
+ }
447
+ if (expression?.type !== "CallExpression" ||
448
+ getCalleeName(expression.callee) !== "api" ||
449
+ !Array.isArray(expression.arguments)) {
450
+ return undefined;
451
+ }
452
+ const config = unwrapExpression(expression.arguments[0]);
453
+ return config?.type === "ObjectExpression" ? config : undefined;
454
+ }
455
+ resolveName(name, followedNames) {
456
+ if (!this.initializers.has(name)) {
457
+ return this.importedRefs.get(name);
458
+ }
459
+ if (followedNames.has(name)) {
460
+ return undefined;
461
+ }
462
+ followedNames.add(name);
463
+ return this.resolveExpression(this.initializers.get(name), followedNames);
464
+ }
465
+ }
466
+ /** An API module's `api()` export and the integrations its config declares. */
467
+ class ApiModule {
468
+ module;
469
+ scope;
470
+ constructor(module, scope) {
471
+ this.module = module;
472
+ this.scope = scope;
473
+ }
474
+ integrationsOf(exportName) {
475
+ const exported = this.module.localExports().get(exportName);
476
+ const apiConfig = exported && this.scope.resolveApiConfig(exported);
477
+ if (!apiConfig) {
478
+ return { integrations: [], unresolvedKeys: ["*"] };
479
+ }
480
+ return this.readDeclarations(apiConfig);
481
+ }
482
+ readDeclarations(apiConfig) {
483
+ const { objects, isDefinitive } = readIntegrationsObjects(apiConfig);
484
+ const integrations = [];
485
+ const unresolvedKeys = isDefinitive ? [] : ["*"];
486
+ for (const member of objects.flatMap(membersOf)) {
487
+ const key = member.type === "ObjectProperty" ? getMemberKeyName(member) : undefined;
488
+ const declaration = key === undefined
489
+ ? undefined
490
+ : this.scope.resolveDeclaration(member.value);
491
+ if (key !== undefined && declaration) {
492
+ integrations.push({ key, ...declaration });
583
493
  }
584
- const varRef = variableRefs.get(localName);
585
- if (varRef) {
586
- refs.set(exportedName, {
587
- kind: "declaration",
588
- pluginId: varRef.pluginId,
589
- id: varRef.id,
590
- });
494
+ else {
495
+ unresolvedKeys.push(unresolvedKeyOf(member));
591
496
  }
592
497
  }
498
+ return { integrations, unresolvedKeys };
593
499
  }
594
- return refs;
595
500
  }
596
- async function buildImportedIntegrationRefs(programBody, entryPoint, readSource, bindings) {
597
- const refs = new Map();
598
- // entryPoint is contractually an app-root-relative posix path (see the
599
- // JSDoc on extractApiIntegrations). An absolute path or one containing a
600
- // backslash is out-of-contract input: resolveRelativeImportPath's
601
- // `..`-prefix skip only guards against traversal relative to entryPoint's
602
- // own directory, so a malformed entryPoint (e.g. an absolute path) could
603
- // still let a resolved candidate land outside the app root even though it
604
- // doesn't start with "..". Refuse to resolve any imports at all for such
605
- // input rather than rely on that guard holding — callers that violate the
606
- // contract get unresolved keys instead of a potential traversal.
607
- if (entryPoint.startsWith("/") || entryPoint.includes("\\")) {
501
+ function isSameRef(left, right) {
502
+ const pluginIdOf = (ref) => ref.kind === "declaration" ? ref.pluginId : undefined;
503
+ return (left.kind === right.kind &&
504
+ left.id === right.id &&
505
+ pluginIdOf(left) === pluginIdOf(right));
506
+ }
507
+ /**
508
+ * The most modules an imported name is followed through, counting the module
509
+ * the entry point imports it from as the first.
510
+ */
511
+ const MAX_IMPORT_HOPS = 5;
512
+ /**
513
+ * The most candidate files one call reads, so an app whose modules import
514
+ * widely cannot make one lookup read it whole. Every candidate of an import
515
+ * counts, whether or not it exists. An import that needs more is left
516
+ * unresolved.
517
+ */
518
+ export const MAX_SOURCE_READS = 256;
519
+ /**
520
+ * Resolves the names an API entry point imports, following relative imports
521
+ * and re-exports through at most {@link MAX_IMPORT_HOPS} modules. It follows
522
+ * only the names a lookup reaches: one export of a module at a time, and of
523
+ * that export only the imports its value refers to. One instance serves one
524
+ * entry point: it reads and parses each file at most once, and cuts an
525
+ * import cycle where it closes, leaving the names that depend on the cycle
526
+ * unresolved.
527
+ */
528
+ class ImportedIntegrationResolver {
529
+ readSource;
530
+ bindings;
531
+ files = new Map();
532
+ exportRefs = new Map();
533
+ exportsInProgress = new Set();
534
+ sourceReadsLeft = MAX_SOURCE_READS;
535
+ constructor(readSource, bindings) {
536
+ this.readSource = readSource;
537
+ this.bindings = bindings;
538
+ }
539
+ /** A scope of the entry point with the imports `use` looks up resolved. */
540
+ async entryScope(entry, use) {
541
+ // The `..`-prefix skip only guards against traversal relative to the
542
+ // entry point's own directory, so an absolute or backslashed entry point
543
+ // could still resolve candidates outside the app root.
544
+ if (entry.path.startsWith("/") || entry.path.includes("\\")) {
545
+ return new ModuleScope(entry, new Map(), this.bindings);
546
+ }
547
+ this.files.set(entry.path, { exists: true, module: entry });
548
+ return this.scopeFor(entry, 1, use);
549
+ }
550
+ /**
551
+ * Run `use` once with no imports to find which imported names it reads,
552
+ * then resolve only those. An imported name resolves to an ID or a
553
+ * declaration, never to another name, so the second run reads the same
554
+ * names.
555
+ */
556
+ async scopeFor(module, hop, use) {
557
+ const lookedUp = new Set();
558
+ use(new ModuleScope(module, {
559
+ get: (name) => {
560
+ lookedUp.add(name);
561
+ return undefined;
562
+ },
563
+ }, this.bindings));
564
+ return new ModuleScope(module, await this.resolveImports(module, lookedUp, hop), this.bindings);
565
+ }
566
+ async resolveImports(importer, localNames, hop) {
567
+ const refs = new Map();
568
+ for (const { source, specifiers } of importer.namedImports()) {
569
+ for (const specifier of specifiers) {
570
+ const importedName = getPropertyName(specifier.imported);
571
+ const localName = getPropertyName(specifier.local);
572
+ if (!importedName || !localName || !localNames.has(localName)) {
573
+ continue;
574
+ }
575
+ const ref = await this.exportOfImport(importer, source, importedName, hop);
576
+ if (ref && ref.kind !== "unresolved") {
577
+ refs.set(localName, ref);
578
+ }
579
+ }
580
+ }
608
581
  return refs;
609
582
  }
610
- // Deliberately scoped to this call (one per entry point), not shared/module
611
- // -level: each call to extractApiIntegrations gets its own cache, so
612
- // repeated imports of the same relative path within a single entry point's
613
- // import graph are only read and parsed once, without leaking parsed
614
- // bodies across unrelated entry points or app roots.
615
- const candidateFiles = new Map();
616
- for (const statement of programBody) {
617
- if (!isNode(statement) || statement.type !== "ImportDeclaration") {
618
- continue;
619
- }
620
- const importSource = statement.source;
621
- const importPath = isNode(importSource) ? importSource.value : undefined;
622
- const specifiers = valueSpecifiersOf(statement);
623
- if (typeof importPath !== "string" ||
624
- !importPath.startsWith(".") ||
625
- specifiers.length === 0) {
626
- continue;
627
- }
628
- // Real ESM/TS import specifiers always use forward slashes, and no
629
- // bundler resolves a backslash as a path separator either — a backslash
630
- // here only ever comes from hostile or broken input (e.g.
631
- // `..\\..\\..\\secret.js`). `posixPath.join` treats `\` as an ordinary
632
- // filename character rather than a separator, so the `..`-prefix guard
633
- // below cannot catch a traversal spelled with backslashes. Treat the
634
- // specifier as unresolvable, the same as a bare package import, and
635
- // never attempt to read it.
636
- if (importPath.includes("\\")) {
637
- continue;
638
- }
639
- // Skip candidates that resolve outside the app root (e.g.
640
- // `../../../secrets.ts` escaping above the entry point's directory) —
641
- // never read files outside the app being built.
642
- const candidatePaths = resolveRelativeImportPath(entryPoint, importPath).filter((candidate) => !candidate.startsWith(".."));
643
- if (candidatePaths.length === 0) {
644
- continue;
645
- }
646
- const importedBody = await readUnambiguous(candidatePaths, readSource, candidateFiles);
647
- if (!importedBody) {
648
- continue;
649
- }
650
- const exportedRefs = buildExportedIntegrationRefMap(importedBody, bindings);
651
- for (const specifier of specifiers) {
652
- if (specifier.type !== "ImportSpecifier") {
653
- continue;
583
+ async exportOfImport(importer, sourceNode, name, hop) {
584
+ if (hop > MAX_IMPORT_HOPS) {
585
+ return UNRESOLVED_EXPORT;
586
+ }
587
+ const imported = await this.readUnambiguous(importer.candidatePathsFor(sourceNode));
588
+ return imported ? this.exportOf(imported, name, hop) : UNRESOLVED_EXPORT;
589
+ }
590
+ async exportOf(module, name, hop) {
591
+ const exportKey = JSON.stringify([module.path, name]);
592
+ if (this.exportsInProgress.has(exportKey)) {
593
+ return UNRESOLVED_EXPORT;
594
+ }
595
+ const cacheKey = JSON.stringify([hop, module.path, name]);
596
+ if (this.exportRefs.has(cacheKey)) {
597
+ return this.exportRefs.get(cacheKey);
598
+ }
599
+ this.exportsInProgress.add(exportKey);
600
+ try {
601
+ const ref = await this.resolveExport(module, name, hop);
602
+ if (ref?.kind !== "unresolved") {
603
+ this.exportRefs.set(cacheKey, ref);
654
604
  }
655
- const importedName = getPropertyName(specifier.imported);
656
- const localName = getPropertyName(specifier.local);
657
- const ref = importedName ? exportedRefs.get(importedName) : undefined;
658
- if (localName && ref) {
659
- refs.set(localName, ref);
605
+ return ref;
606
+ }
607
+ finally {
608
+ this.exportsInProgress.delete(exportKey);
609
+ }
610
+ }
611
+ /**
612
+ * What `module` exports as `name`. A name the module exports explicitly,
613
+ * even as a type, a `declare`, or a namespace, shadows `export *`.
614
+ */
615
+ async resolveExport(module, name, hop) {
616
+ const local = module.localExports().get(name);
617
+ if (local) {
618
+ const scope = await this.scopeFor(module, hop + 1, (probe) => probe.resolveExpression(local));
619
+ return scope.resolveExpression(local) ?? UNRESOLVED_EXPORT;
620
+ }
621
+ const reExport = module.namedReExportOf(name);
622
+ if (reExport) {
623
+ return ((await this.exportOfImport(module, reExport.source, reExport.localName, hop + 1)) ?? UNRESOLVED_EXPORT);
624
+ }
625
+ return module.explicitExportNames().has(name)
626
+ ? UNRESOLVED_EXPORT
627
+ : this.starExportOf(module, name, hop);
628
+ }
629
+ /**
630
+ * What the `export *` sources of `module` provide as `name`, when they
631
+ * agree. A name two sources disagree on is ambiguous in ESM.
632
+ */
633
+ async starExportOf(module, name, hop) {
634
+ const refs = [];
635
+ for (const sourceNode of module.starReExportSources()) {
636
+ const ref = await this.exportOfImport(module, sourceNode, name, hop + 1);
637
+ if (ref?.kind === "unresolved") {
638
+ return UNRESOLVED_EXPORT;
639
+ }
640
+ if (ref) {
641
+ refs.push(ref);
642
+ }
643
+ }
644
+ const [first] = refs;
645
+ if (first && refs.some((ref) => !isSameRef(ref, first))) {
646
+ return UNRESOLVED_EXPORT;
647
+ }
648
+ return first;
649
+ }
650
+ /**
651
+ * The module a specifier loads when exactly one of its candidate files
652
+ * exists. With more than one, which the bundler loads depends on its
653
+ * resolution order, so the import is left unresolved.
654
+ */
655
+ async readUnambiguous(candidatePaths) {
656
+ const existing = [];
657
+ for (const path of candidatePaths) {
658
+ const file = await this.read(path);
659
+ if (file.exists) {
660
+ existing.push(file);
660
661
  }
661
662
  }
663
+ return existing.length === 1 ? existing[0]?.module : undefined;
664
+ }
665
+ async read(path) {
666
+ const cached = this.files.get(path);
667
+ if (cached) {
668
+ return cached;
669
+ }
670
+ const file = await this.readAndParse(path);
671
+ this.files.set(path, file);
672
+ return file;
673
+ }
674
+ /**
675
+ * A file whose read throws counts as existing, since the bundler may load
676
+ * it, and so does one past {@link MAX_SOURCE_READS}, which is not read.
677
+ */
678
+ async readAndParse(path) {
679
+ if (this.sourceReadsLeft === 0) {
680
+ return { exists: true };
681
+ }
682
+ this.sourceReadsLeft -= 1;
683
+ let source;
684
+ try {
685
+ source = await this.readSource(path);
686
+ }
687
+ catch {
688
+ return { exists: true };
689
+ }
690
+ if (source === undefined) {
691
+ return { exists: false };
692
+ }
693
+ try {
694
+ return {
695
+ exists: true,
696
+ module: new SourceModule(path, parseProgramBody(source, path)),
697
+ };
698
+ }
699
+ catch {
700
+ return { exists: true };
701
+ }
662
702
  }
663
- return refs;
664
703
  }
665
704
  //# sourceMappingURL=extract-api-integrations.js.map