@visual-check/cli 0.0.0 → 0.1.1

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 (790) hide show
  1. package/LICENSE +21 -0
  2. package/dist/addon-build.d.ts +3 -0
  3. package/dist/addon-build.d.ts.map +1 -0
  4. package/dist/addon-build.js +4 -0
  5. package/dist/addon-build.js.map +1 -0
  6. package/dist/addon-child/addon-child.d.ts +63 -0
  7. package/dist/addon-child/addon-child.d.ts.map +1 -0
  8. package/dist/addon-child/addon-child.js +85 -0
  9. package/dist/addon-child/addon-child.js.map +1 -0
  10. package/dist/addon-child/image-files.d.ts +11 -0
  11. package/dist/addon-child/image-files.d.ts.map +1 -0
  12. package/dist/addon-child/image-files.js +138 -0
  13. package/dist/addon-child/image-files.js.map +1 -0
  14. package/dist/addon-child/protocol.d.ts +181 -0
  15. package/dist/addon-child/protocol.d.ts.map +1 -0
  16. package/dist/addon-child/protocol.js +2 -0
  17. package/dist/addon-child/protocol.js.map +1 -0
  18. package/dist/addon-child/read-request.d.ts +7 -0
  19. package/dist/addon-child/read-request.d.ts.map +1 -0
  20. package/dist/addon-child/read-request.js +25 -0
  21. package/dist/addon-child/read-request.js.map +1 -0
  22. package/dist/addon-child.d.ts +2 -0
  23. package/dist/addon-child.d.ts.map +1 -0
  24. package/dist/addon-child.js +61 -0
  25. package/dist/addon-child.js.map +1 -0
  26. package/dist/affected-stories/affected-stories.d.ts +128 -0
  27. package/dist/affected-stories/affected-stories.d.ts.map +1 -0
  28. package/dist/affected-stories/affected-stories.js +168 -0
  29. package/dist/affected-stories/affected-stories.js.map +1 -0
  30. package/dist/affected-stories/changed-file-rules.d.ts +98 -0
  31. package/dist/affected-stories/changed-file-rules.d.ts.map +1 -0
  32. package/dist/affected-stories/changed-file-rules.js +167 -0
  33. package/dist/affected-stories/changed-file-rules.js.map +1 -0
  34. package/dist/affected-stories/fallow-graph.d.ts +67 -0
  35. package/dist/affected-stories/fallow-graph.d.ts.map +1 -0
  36. package/dist/affected-stories/fallow-graph.js +180 -0
  37. package/dist/affected-stories/fallow-graph.js.map +1 -0
  38. package/dist/affected-stories/git-changes.d.ts +57 -0
  39. package/dist/affected-stories/git-changes.d.ts.map +1 -0
  40. package/dist/affected-stories/git-changes.js +203 -0
  41. package/dist/affected-stories/git-changes.js.map +1 -0
  42. package/dist/affected-stories/group-changes.d.ts +48 -0
  43. package/dist/affected-stories/group-changes.d.ts.map +1 -0
  44. package/dist/affected-stories/group-changes.js +41 -0
  45. package/dist/affected-stories/group-changes.js.map +1 -0
  46. package/dist/affected-stories/import-graph.d.ts +33 -0
  47. package/dist/affected-stories/import-graph.d.ts.map +1 -0
  48. package/dist/affected-stories/import-graph.js +99 -0
  49. package/dist/affected-stories/import-graph.js.map +1 -0
  50. package/dist/affected-stories/limited-map.d.ts +9 -0
  51. package/dist/affected-stories/limited-map.d.ts.map +1 -0
  52. package/dist/affected-stories/limited-map.js +24 -0
  53. package/dist/affected-stories/limited-map.js.map +1 -0
  54. package/dist/affected-stories/package-folder.d.ts +8 -0
  55. package/dist/affected-stories/package-folder.d.ts.map +1 -0
  56. package/dist/affected-stories/package-folder.js +45 -0
  57. package/dist/affected-stories/package-folder.js.map +1 -0
  58. package/dist/affected-stories/storybook-rules.d.ts +153 -0
  59. package/dist/affected-stories/storybook-rules.d.ts.map +1 -0
  60. package/dist/affected-stories/storybook-rules.js +161 -0
  61. package/dist/affected-stories/storybook-rules.js.map +1 -0
  62. package/dist/affected-stories/walk-back.d.ts +16 -0
  63. package/dist/affected-stories/walk-back.d.ts.map +1 -0
  64. package/dist/affected-stories/walk-back.js +46 -0
  65. package/dist/affected-stories/walk-back.js.map +1 -0
  66. package/dist/agent-skill/install-skill.d.ts +34 -0
  67. package/dist/agent-skill/install-skill.d.ts.map +1 -0
  68. package/dist/agent-skill/install-skill.js +43 -0
  69. package/dist/agent-skill/install-skill.js.map +1 -0
  70. package/dist/agent-skill/refresh-skill.d.ts +62 -0
  71. package/dist/agent-skill/refresh-skill.d.ts.map +1 -0
  72. package/dist/agent-skill/refresh-skill.js +105 -0
  73. package/dist/agent-skill/refresh-skill.js.map +1 -0
  74. package/dist/agent-skill/setup-file.d.ts +41 -0
  75. package/dist/agent-skill/setup-file.d.ts.map +1 -0
  76. package/dist/agent-skill/setup-file.js +38 -0
  77. package/dist/agent-skill/setup-file.js.map +1 -0
  78. package/dist/agent-skill/skill-files.d.ts +19 -0
  79. package/dist/agent-skill/skill-files.d.ts.map +1 -0
  80. package/dist/agent-skill/skill-files.js +29 -0
  81. package/dist/agent-skill/skill-files.js.map +1 -0
  82. package/dist/agent-skill/skill-markdown.d.ts +31 -0
  83. package/dist/agent-skill/skill-markdown.d.ts.map +1 -0
  84. package/dist/agent-skill/skill-markdown.js +54 -0
  85. package/dist/agent-skill/skill-markdown.js.map +1 -0
  86. package/dist/baselines/baseline-clash.d.ts +31 -0
  87. package/dist/baselines/baseline-clash.d.ts.map +1 -0
  88. package/dist/baselines/baseline-clash.js +23 -0
  89. package/dist/baselines/baseline-clash.js.map +1 -0
  90. package/dist/baselines/baseline-error.d.ts +39 -0
  91. package/dist/baselines/baseline-error.d.ts.map +1 -0
  92. package/dist/baselines/baseline-error.js +42 -0
  93. package/dist/baselines/baseline-error.js.map +1 -0
  94. package/dist/baselines/baseline-files.d.ts +130 -0
  95. package/dist/baselines/baseline-files.d.ts.map +1 -0
  96. package/dist/baselines/baseline-files.js +292 -0
  97. package/dist/baselines/baseline-files.js.map +1 -0
  98. package/dist/baselines/baseline-set.d.ts +42 -0
  99. package/dist/baselines/baseline-set.d.ts.map +1 -0
  100. package/dist/baselines/baseline-set.js +104 -0
  101. package/dist/baselines/baseline-set.js.map +1 -0
  102. package/dist/bin.d.ts +3 -0
  103. package/dist/bin.d.ts.map +1 -0
  104. package/dist/bin.js +57 -0
  105. package/dist/bin.js.map +1 -0
  106. package/dist/browser/browser-package.d.ts +54 -0
  107. package/dist/browser/browser-package.d.ts.map +1 -0
  108. package/dist/browser/browser-package.js +105 -0
  109. package/dist/browser/browser-package.js.map +1 -0
  110. package/dist/browser/browser-version.d.ts +67 -0
  111. package/dist/browser/browser-version.d.ts.map +1 -0
  112. package/dist/browser/browser-version.js +61 -0
  113. package/dist/browser/browser-version.js.map +1 -0
  114. package/dist/browser/chrome-for-testing-platform.d.ts +24 -0
  115. package/dist/browser/chrome-for-testing-platform.d.ts.map +1 -0
  116. package/dist/browser/chrome-for-testing-platform.js +39 -0
  117. package/dist/browser/chrome-for-testing-platform.js.map +1 -0
  118. package/dist/browser/image-marker.d.ts +46 -0
  119. package/dist/browser/image-marker.d.ts.map +1 -0
  120. package/dist/browser/image-marker.js +81 -0
  121. package/dist/browser/image-marker.js.map +1 -0
  122. package/dist/browser/read-browser-package.d.ts +58 -0
  123. package/dist/browser/read-browser-package.d.ts.map +1 -0
  124. package/dist/browser/read-browser-package.js +130 -0
  125. package/dist/browser/read-browser-package.js.map +1 -0
  126. package/dist/browser-download/browser-download-error.d.ts +19 -0
  127. package/dist/browser-download/browser-download-error.d.ts.map +1 -0
  128. package/dist/browser-download/browser-download-error.js +21 -0
  129. package/dist/browser-download/browser-download-error.js.map +1 -0
  130. package/dist/browser-download/cache-folder.d.ts +7 -0
  131. package/dist/browser-download/cache-folder.d.ts.map +1 -0
  132. package/dist/browser-download/cache-folder.js +34 -0
  133. package/dist/browser-download/cache-folder.js.map +1 -0
  134. package/dist/browser-download/download-file.d.ts +45 -0
  135. package/dist/browser-download/download-file.d.ts.map +1 -0
  136. package/dist/browser-download/download-file.js +340 -0
  137. package/dist/browser-download/download-file.js.map +1 -0
  138. package/dist/browser-download/install-headless-shell.d.ts +96 -0
  139. package/dist/browser-download/install-headless-shell.d.ts.map +1 -0
  140. package/dist/browser-download/install-headless-shell.js +491 -0
  141. package/dist/browser-download/install-headless-shell.js.map +1 -0
  142. package/dist/browser-download/proxy.d.ts +19 -0
  143. package/dist/browser-download/proxy.d.ts.map +1 -0
  144. package/dist/browser-download/proxy.js +102 -0
  145. package/dist/browser-download/proxy.js.map +1 -0
  146. package/dist/browser-download/unzip.d.ts +11 -0
  147. package/dist/browser-download/unzip.d.ts.map +1 -0
  148. package/dist/browser-download/unzip.js +96 -0
  149. package/dist/browser-download/unzip.js.map +1 -0
  150. package/dist/browser-process/start-browser-process.d.ts +30 -0
  151. package/dist/browser-process/start-browser-process.d.ts.map +1 -0
  152. package/dist/browser-process/start-browser-process.js +131 -0
  153. package/dist/browser-process/start-browser-process.js.map +1 -0
  154. package/dist/capture/capture-session.d.ts +479 -0
  155. package/dist/capture/capture-session.d.ts.map +1 -0
  156. package/dist/capture/capture-session.js +723 -0
  157. package/dist/capture/capture-session.js.map +1 -0
  158. package/dist/capture/driver/cdp/cdp-connection.d.ts +127 -0
  159. package/dist/capture/driver/cdp/cdp-connection.d.ts.map +1 -0
  160. package/dist/capture/driver/cdp/cdp-connection.js +243 -0
  161. package/dist/capture/driver/cdp/cdp-connection.js.map +1 -0
  162. package/dist/capture/driver/cdp/cdp-driver.d.ts +42 -0
  163. package/dist/capture/driver/cdp/cdp-driver.d.ts.map +1 -0
  164. package/dist/capture/driver/cdp/cdp-driver.js +270 -0
  165. package/dist/capture/driver/cdp/cdp-driver.js.map +1 -0
  166. package/dist/capture/driver/cdp/cdp-page.d.ts +10 -0
  167. package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -0
  168. package/dist/capture/driver/cdp/cdp-page.js +765 -0
  169. package/dist/capture/driver/cdp/cdp-page.js.map +1 -0
  170. package/dist/capture/driver/cdp/last-lines.d.ts +13 -0
  171. package/dist/capture/driver/cdp/last-lines.d.ts.map +1 -0
  172. package/dist/capture/driver/cdp/last-lines.js +49 -0
  173. package/dist/capture/driver/cdp/last-lines.js.map +1 -0
  174. package/dist/capture/driver/cdp/launch-arguments.d.ts +16 -0
  175. package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -0
  176. package/dist/capture/driver/cdp/launch-arguments.js +142 -0
  177. package/dist/capture/driver/cdp/launch-arguments.js.map +1 -0
  178. package/dist/capture/driver/cdp/loaded-document.d.ts +61 -0
  179. package/dist/capture/driver/cdp/loaded-document.d.ts.map +1 -0
  180. package/dist/capture/driver/cdp/loaded-document.js +104 -0
  181. package/dist/capture/driver/cdp/loaded-document.js.map +1 -0
  182. package/dist/capture/driver/cdp/main-frame-navigation.d.ts +127 -0
  183. package/dist/capture/driver/cdp/main-frame-navigation.d.ts.map +1 -0
  184. package/dist/capture/driver/cdp/main-frame-navigation.js +214 -0
  185. package/dist/capture/driver/cdp/main-frame-navigation.js.map +1 -0
  186. package/dist/capture/driver/cdp/request-watch.d.ts +117 -0
  187. package/dist/capture/driver/cdp/request-watch.d.ts.map +1 -0
  188. package/dist/capture/driver/cdp/request-watch.js +244 -0
  189. package/dist/capture/driver/cdp/request-watch.js.map +1 -0
  190. package/dist/capture/driver/cdp/time-limit.d.ts +29 -0
  191. package/dist/capture/driver/cdp/time-limit.d.ts.map +1 -0
  192. package/dist/capture/driver/cdp/time-limit.js +51 -0
  193. package/dist/capture/driver/cdp/time-limit.js.map +1 -0
  194. package/dist/capture/driver/driver.d.ts +511 -0
  195. package/dist/capture/driver/driver.d.ts.map +1 -0
  196. package/dist/capture/driver/driver.js +283 -0
  197. package/dist/capture/driver/driver.js.map +1 -0
  198. package/dist/capture/end-state.d.ts +131 -0
  199. package/dist/capture/end-state.d.ts.map +1 -0
  200. package/dist/capture/end-state.js +818 -0
  201. package/dist/capture/end-state.js.map +1 -0
  202. package/dist/capture/page-roots.d.ts +18 -0
  203. package/dist/capture/page-roots.d.ts.map +1 -0
  204. package/dist/capture/page-roots.js +67 -0
  205. package/dist/capture/page-roots.js.map +1 -0
  206. package/dist/capture/page-script.d.ts +118 -0
  207. package/dist/capture/page-script.d.ts.map +1 -0
  208. package/dist/capture/page-script.js +399 -0
  209. package/dist/capture/page-script.js.map +1 -0
  210. package/dist/capture/prepare-capture.d.ts +228 -0
  211. package/dist/capture/prepare-capture.d.ts.map +1 -0
  212. package/dist/capture/prepare-capture.js +480 -0
  213. package/dist/capture/prepare-capture.js.map +1 -0
  214. package/dist/capture/read-options.d.ts +65 -0
  215. package/dist/capture/read-options.d.ts.map +1 -0
  216. package/dist/capture/read-options.js +211 -0
  217. package/dist/capture/read-options.js.map +1 -0
  218. package/dist/capture/remote-content.d.ts +45 -0
  219. package/dist/capture/remote-content.d.ts.map +1 -0
  220. package/dist/capture/remote-content.js +309 -0
  221. package/dist/capture/remote-content.js.map +1 -0
  222. package/dist/capture/worker-pool.d.ts +35 -0
  223. package/dist/capture/worker-pool.d.ts.map +1 -0
  224. package/dist/capture/worker-pool.js +51 -0
  225. package/dist/capture/worker-pool.js.map +1 -0
  226. package/dist/commands/abortable.d.ts +9 -0
  227. package/dist/commands/abortable.d.ts.map +1 -0
  228. package/dist/commands/abortable.js +18 -0
  229. package/dist/commands/abortable.js.map +1 -0
  230. package/dist/commands/browser-route.d.ts +86 -0
  231. package/dist/commands/browser-route.d.ts.map +1 -0
  232. package/dist/commands/browser-route.js +27 -0
  233. package/dist/commands/browser-route.js.map +1 -0
  234. package/dist/commands/capture-settings.d.ts +8 -0
  235. package/dist/commands/capture-settings.d.ts.map +1 -0
  236. package/dist/commands/capture-settings.js +17 -0
  237. package/dist/commands/capture-settings.js.map +1 -0
  238. package/dist/commands/check-story.d.ts +91 -0
  239. package/dist/commands/check-story.d.ts.map +1 -0
  240. package/dist/commands/check-story.js +52 -0
  241. package/dist/commands/check-story.js.map +1 -0
  242. package/dist/commands/check-storybooks.d.ts +71 -0
  243. package/dist/commands/check-storybooks.d.ts.map +1 -0
  244. package/dist/commands/check-storybooks.js +49 -0
  245. package/dist/commands/check-storybooks.js.map +1 -0
  246. package/dist/commands/consistency-check.d.ts +62 -0
  247. package/dist/commands/consistency-check.d.ts.map +1 -0
  248. package/dist/commands/consistency-check.js +63 -0
  249. package/dist/commands/consistency-check.js.map +1 -0
  250. package/dist/commands/consistency-output.d.ts +63 -0
  251. package/dist/commands/consistency-output.d.ts.map +1 -0
  252. package/dist/commands/consistency-output.js +63 -0
  253. package/dist/commands/consistency-output.js.map +1 -0
  254. package/dist/commands/docker-problem.d.ts +23 -0
  255. package/dist/commands/docker-problem.d.ts.map +1 -0
  256. package/dist/commands/docker-problem.js +18 -0
  257. package/dist/commands/docker-problem.js.map +1 -0
  258. package/dist/commands/launch-browser.d.ts +123 -0
  259. package/dist/commands/launch-browser.d.ts.map +1 -0
  260. package/dist/commands/launch-browser.js +113 -0
  261. package/dist/commands/launch-browser.js.map +1 -0
  262. package/dist/commands/missing-library.d.ts +6 -0
  263. package/dist/commands/missing-library.d.ts.map +1 -0
  264. package/dist/commands/missing-library.js +19 -0
  265. package/dist/commands/missing-library.js.map +1 -0
  266. package/dist/commands/network-warning.d.ts +36 -0
  267. package/dist/commands/network-warning.d.ts.map +1 -0
  268. package/dist/commands/network-warning.js +92 -0
  269. package/dist/commands/network-warning.js.map +1 -0
  270. package/dist/commands/parse-command-line.d.ts +133 -0
  271. package/dist/commands/parse-command-line.d.ts.map +1 -0
  272. package/dist/commands/parse-command-line.js +425 -0
  273. package/dist/commands/parse-command-line.js.map +1 -0
  274. package/dist/commands/place-browser.d.ts +75 -0
  275. package/dist/commands/place-browser.d.ts.map +1 -0
  276. package/dist/commands/place-browser.js +82 -0
  277. package/dist/commands/place-browser.js.map +1 -0
  278. package/dist/commands/plan-snapshots.d.ts +134 -0
  279. package/dist/commands/plan-snapshots.d.ts.map +1 -0
  280. package/dist/commands/plan-snapshots.js +278 -0
  281. package/dist/commands/plan-snapshots.js.map +1 -0
  282. package/dist/commands/platform-problem.d.ts +7 -0
  283. package/dist/commands/platform-problem.d.ts.map +1 -0
  284. package/dist/commands/platform-problem.js +12 -0
  285. package/dist/commands/platform-problem.js.map +1 -0
  286. package/dist/commands/read-image-fit.d.ts +16 -0
  287. package/dist/commands/read-image-fit.d.ts.map +1 -0
  288. package/dist/commands/read-image-fit.js +26 -0
  289. package/dist/commands/read-image-fit.js.map +1 -0
  290. package/dist/commands/remote-content-hint.d.ts +6 -0
  291. package/dist/commands/remote-content-hint.d.ts.map +1 -0
  292. package/dist/commands/remote-content-hint.js +37 -0
  293. package/dist/commands/remote-content-hint.js.map +1 -0
  294. package/dist/commands/report-entries.d.ts +94 -0
  295. package/dist/commands/report-entries.d.ts.map +1 -0
  296. package/dist/commands/report-entries.js +384 -0
  297. package/dist/commands/report-entries.js.map +1 -0
  298. package/dist/commands/run-browser.d.ts +128 -0
  299. package/dist/commands/run-browser.d.ts.map +1 -0
  300. package/dist/commands/run-browser.js +210 -0
  301. package/dist/commands/run-browser.js.map +1 -0
  302. package/dist/commands/run-cli.d.ts +125 -0
  303. package/dist/commands/run-cli.d.ts.map +1 -0
  304. package/dist/commands/run-cli.js +656 -0
  305. package/dist/commands/run-cli.js.map +1 -0
  306. package/dist/commands/run-output.d.ts +78 -0
  307. package/dist/commands/run-output.d.ts.map +1 -0
  308. package/dist/commands/run-output.js +71 -0
  309. package/dist/commands/run-output.js.map +1 -0
  310. package/dist/commands/run-report.d.ts +147 -0
  311. package/dist/commands/run-report.d.ts.map +1 -0
  312. package/dist/commands/run-report.js +137 -0
  313. package/dist/commands/run-report.js.map +1 -0
  314. package/dist/commands/run-selection.d.ts +191 -0
  315. package/dist/commands/run-selection.d.ts.map +1 -0
  316. package/dist/commands/run-selection.js +150 -0
  317. package/dist/commands/run-selection.js.map +1 -0
  318. package/dist/commands/run-snapshots.d.ts +272 -0
  319. package/dist/commands/run-snapshots.d.ts.map +1 -0
  320. package/dist/commands/run-snapshots.js +354 -0
  321. package/dist/commands/run-snapshots.js.map +1 -0
  322. package/dist/commands/same-address.d.ts +6 -0
  323. package/dist/commands/same-address.d.ts.map +1 -0
  324. package/dist/commands/same-address.js +32 -0
  325. package/dist/commands/same-address.js.map +1 -0
  326. package/dist/commands/select-stories.d.ts +40 -0
  327. package/dist/commands/select-stories.d.ts.map +1 -0
  328. package/dist/commands/select-stories.js +15 -0
  329. package/dist/commands/select-stories.js.map +1 -0
  330. package/dist/commands/shard-share.d.ts +41 -0
  331. package/dist/commands/shard-share.d.ts.map +1 -0
  332. package/dist/commands/shard-share.js +61 -0
  333. package/dist/commands/shard-share.js.map +1 -0
  334. package/dist/commands/snapshot-result.d.ts +165 -0
  335. package/dist/commands/snapshot-result.d.ts.map +1 -0
  336. package/dist/commands/snapshot-result.js +136 -0
  337. package/dist/commands/snapshot-result.js.map +1 -0
  338. package/dist/commands/stop-message.d.ts +65 -0
  339. package/dist/commands/stop-message.d.ts.map +1 -0
  340. package/dist/commands/stop-message.js +186 -0
  341. package/dist/commands/stop-message.js.map +1 -0
  342. package/dist/commands/stopped-run.d.ts +116 -0
  343. package/dist/commands/stopped-run.d.ts.map +1 -0
  344. package/dist/commands/stopped-run.js +103 -0
  345. package/dist/commands/stopped-run.js.map +1 -0
  346. package/dist/commands/story-run.d.ts +196 -0
  347. package/dist/commands/story-run.d.ts.map +1 -0
  348. package/dist/commands/story-run.js +258 -0
  349. package/dist/commands/story-run.js.map +1 -0
  350. package/dist/commands/take-snapshot.d.ts +27 -0
  351. package/dist/commands/take-snapshot.d.ts.map +1 -0
  352. package/dist/commands/take-snapshot.js +16 -0
  353. package/dist/commands/take-snapshot.js.map +1 -0
  354. package/dist/commands/test-plan.d.ts +100 -0
  355. package/dist/commands/test-plan.d.ts.map +1 -0
  356. package/dist/commands/test-plan.js +66 -0
  357. package/dist/commands/test-plan.js.map +1 -0
  358. package/dist/commands/test-snapshot.d.ts +52 -0
  359. package/dist/commands/test-snapshot.d.ts.map +1 -0
  360. package/dist/commands/test-snapshot.js +183 -0
  361. package/dist/commands/test-snapshot.js.map +1 -0
  362. package/dist/commands/update-baselines.d.ts +93 -0
  363. package/dist/commands/update-baselines.d.ts.map +1 -0
  364. package/dist/commands/update-baselines.js +120 -0
  365. package/dist/commands/update-baselines.js.map +1 -0
  366. package/dist/commands/update-snapshot.d.ts +69 -0
  367. package/dist/commands/update-snapshot.d.ts.map +1 -0
  368. package/dist/commands/update-snapshot.js +214 -0
  369. package/dist/commands/update-snapshot.js.map +1 -0
  370. package/dist/commands/update-story.d.ts +70 -0
  371. package/dist/commands/update-story.d.ts.map +1 -0
  372. package/dist/commands/update-story.js +64 -0
  373. package/dist/commands/update-story.js.map +1 -0
  374. package/dist/commands/warm-browser.d.ts +43 -0
  375. package/dist/commands/warm-browser.d.ts.map +1 -0
  376. package/dist/commands/warm-browser.js +192 -0
  377. package/dist/commands/warm-browser.js.map +1 -0
  378. package/dist/config/addon-image-folders.d.ts +13 -0
  379. package/dist/config/addon-image-folders.d.ts.map +1 -0
  380. package/dist/config/addon-image-folders.js +7 -0
  381. package/dist/config/addon-image-folders.js.map +1 -0
  382. package/dist/config/checks.d.ts +108 -0
  383. package/dist/config/checks.d.ts.map +1 -0
  384. package/dist/config/checks.js +190 -0
  385. package/dist/config/checks.js.map +1 -0
  386. package/dist/config/config-error.d.ts +23 -0
  387. package/dist/config/config-error.d.ts.map +1 -0
  388. package/dist/config/config-error.js +23 -0
  389. package/dist/config/config-error.js.map +1 -0
  390. package/dist/config/config-thread.d.ts +25 -0
  391. package/dist/config/config-thread.d.ts.map +1 -0
  392. package/dist/config/config-thread.js +73 -0
  393. package/dist/config/config-thread.js.map +1 -0
  394. package/dist/config/define-config.d.ts +192 -0
  395. package/dist/config/define-config.d.ts.map +1 -0
  396. package/dist/config/define-config.js +9 -0
  397. package/dist/config/define-config.js.map +1 -0
  398. package/dist/config/evaluate-config.d.ts +6 -0
  399. package/dist/config/evaluate-config.d.ts.map +1 -0
  400. package/dist/config/evaluate-config.js +39 -0
  401. package/dist/config/evaluate-config.js.map +1 -0
  402. package/dist/config/find-config.d.ts +35 -0
  403. package/dist/config/find-config.d.ts.map +1 -0
  404. package/dist/config/find-config.js +71 -0
  405. package/dist/config/find-config.js.map +1 -0
  406. package/dist/config/find-storybook-url-problem.d.ts +29 -0
  407. package/dist/config/find-storybook-url-problem.d.ts.map +1 -0
  408. package/dist/config/find-storybook-url-problem.js +34 -0
  409. package/dist/config/find-storybook-url-problem.js.map +1 -0
  410. package/dist/config/is-ci.d.ts +7 -0
  411. package/dist/config/is-ci.d.ts.map +1 -0
  412. package/dist/config/is-ci.js +10 -0
  413. package/dist/config/is-ci.js.map +1 -0
  414. package/dist/config/load-config.d.ts +72 -0
  415. package/dist/config/load-config.d.ts.map +1 -0
  416. package/dist/config/load-config.js +95 -0
  417. package/dist/config/load-config.js.map +1 -0
  418. package/dist/config/load-storybook-config.d.ts +71 -0
  419. package/dist/config/load-storybook-config.d.ts.map +1 -0
  420. package/dist/config/load-storybook-config.js +104 -0
  421. package/dist/config/load-storybook-config.js.map +1 -0
  422. package/dist/config/mode-rules.d.ts +42 -0
  423. package/dist/config/mode-rules.d.ts.map +1 -0
  424. package/dist/config/mode-rules.js +188 -0
  425. package/dist/config/mode-rules.js.map +1 -0
  426. package/dist/config/read-config-afresh.d.ts +13 -0
  427. package/dist/config/read-config-afresh.d.ts.map +1 -0
  428. package/dist/config/read-config-afresh.js +28 -0
  429. package/dist/config/read-config-afresh.js.map +1 -0
  430. package/dist/config/resolve-config.d.ts +162 -0
  431. package/dist/config/resolve-config.d.ts.map +1 -0
  432. package/dist/config/resolve-config.js +181 -0
  433. package/dist/config/resolve-config.js.map +1 -0
  434. package/dist/config/story-options.d.ts +73 -0
  435. package/dist/config/story-options.d.ts.map +1 -0
  436. package/dist/config/story-options.js +175 -0
  437. package/dist/config/story-options.js.map +1 -0
  438. package/dist/config/validate-config.d.ts +9 -0
  439. package/dist/config/validate-config.d.ts.map +1 -0
  440. package/dist/config/validate-config.js +185 -0
  441. package/dist/config/validate-config.js.map +1 -0
  442. package/dist/container/browser-container.d.ts +57 -0
  443. package/dist/container/browser-container.d.ts.map +1 -0
  444. package/dist/container/browser-container.js +112 -0
  445. package/dist/container/browser-container.js.map +1 -0
  446. package/dist/container/container-error.d.ts +47 -0
  447. package/dist/container/container-error.d.ts.map +1 -0
  448. package/dist/container/container-error.js +43 -0
  449. package/dist/container/container-error.js.map +1 -0
  450. package/dist/container/docker-probe.d.ts +37 -0
  451. package/dist/container/docker-probe.d.ts.map +1 -0
  452. package/dist/container/docker-probe.js +85 -0
  453. package/dist/container/docker-probe.js.map +1 -0
  454. package/dist/container/image-pull.d.ts +11 -0
  455. package/dist/container/image-pull.d.ts.map +1 -0
  456. package/dist/container/image-pull.js +40 -0
  457. package/dist/container/image-pull.js.map +1 -0
  458. package/dist/container/inside-container.d.ts +8 -0
  459. package/dist/container/inside-container.d.ts.map +1 -0
  460. package/dist/container/inside-container.js +11 -0
  461. package/dist/container/inside-container.js.map +1 -0
  462. package/dist/container/launch-through-proxy.d.ts +16 -0
  463. package/dist/container/launch-through-proxy.d.ts.map +1 -0
  464. package/dist/container/launch-through-proxy.js +51 -0
  465. package/dist/container/launch-through-proxy.js.map +1 -0
  466. package/dist/container/own-container.d.ts +12 -0
  467. package/dist/container/own-container.d.ts.map +1 -0
  468. package/dist/container/own-container.js +61 -0
  469. package/dist/container/own-container.js.map +1 -0
  470. package/dist/container/proxy-reach.d.ts +19 -0
  471. package/dist/container/proxy-reach.d.ts.map +1 -0
  472. package/dist/container/proxy-reach.js +101 -0
  473. package/dist/container/proxy-reach.js.map +1 -0
  474. package/dist/container/run-docker.d.ts +11 -0
  475. package/dist/container/run-docker.d.ts.map +1 -0
  476. package/dist/container/run-docker.js +61 -0
  477. package/dist/container/run-docker.js.map +1 -0
  478. package/dist/container/socks-proxy.d.ts +28 -0
  479. package/dist/container/socks-proxy.d.ts.map +1 -0
  480. package/dist/container/socks-proxy.js +335 -0
  481. package/dist/container/socks-proxy.js.map +1 -0
  482. package/dist/docs-site/docs-url.d.ts +7 -0
  483. package/dist/docs-site/docs-url.d.ts.map +1 -0
  484. package/dist/docs-site/docs-url.js +13 -0
  485. package/dist/docs-site/docs-url.js.map +1 -0
  486. package/dist/index.d.ts +5 -0
  487. package/dist/index.d.ts.map +1 -0
  488. package/dist/index.js +3 -0
  489. package/dist/index.js.map +1 -0
  490. package/dist/init/addon-question.d.ts +99 -0
  491. package/dist/init/addon-question.d.ts.map +1 -0
  492. package/dist/init/addon-question.js +111 -0
  493. package/dist/init/addon-question.js.map +1 -0
  494. package/dist/init/closing-message.d.ts +182 -0
  495. package/dist/init/closing-message.d.ts.map +1 -0
  496. package/dist/init/closing-message.js +189 -0
  497. package/dist/init/closing-message.js.map +1 -0
  498. package/dist/init/detect-project.d.ts +111 -0
  499. package/dist/init/detect-project.d.ts.map +1 -0
  500. package/dist/init/detect-project.js +166 -0
  501. package/dist/init/detect-project.js.map +1 -0
  502. package/dist/init/existing-config.d.ts +68 -0
  503. package/dist/init/existing-config.d.ts.map +1 -0
  504. package/dist/init/existing-config.js +149 -0
  505. package/dist/init/existing-config.js.map +1 -0
  506. package/dist/init/find-storybooks.d.ts +93 -0
  507. package/dist/init/find-storybooks.d.ts.map +1 -0
  508. package/dist/init/find-storybooks.js +165 -0
  509. package/dist/init/find-storybooks.js.map +1 -0
  510. package/dist/init/init-checks.d.ts +49 -0
  511. package/dist/init/init-checks.d.ts.map +1 -0
  512. package/dist/init/init-checks.js +151 -0
  513. package/dist/init/init-checks.js.map +1 -0
  514. package/dist/init/install.d.ts +286 -0
  515. package/dist/init/install.d.ts.map +1 -0
  516. package/dist/init/install.js +226 -0
  517. package/dist/init/install.js.map +1 -0
  518. package/dist/init/list-of.d.ts +10 -0
  519. package/dist/init/list-of.d.ts.map +1 -0
  520. package/dist/init/list-of.js +18 -0
  521. package/dist/init/list-of.js.map +1 -0
  522. package/dist/init/package-manager.d.ts +214 -0
  523. package/dist/init/package-manager.d.ts.map +1 -0
  524. package/dist/init/package-manager.js +308 -0
  525. package/dist/init/package-manager.js.map +1 -0
  526. package/dist/init/package-scripts.d.ts +72 -0
  527. package/dist/init/package-scripts.d.ts.map +1 -0
  528. package/dist/init/package-scripts.js +29 -0
  529. package/dist/init/package-scripts.js.map +1 -0
  530. package/dist/init/prompter.d.ts +143 -0
  531. package/dist/init/prompter.d.ts.map +1 -0
  532. package/dist/init/prompter.js +65 -0
  533. package/dist/init/prompter.js.map +1 -0
  534. package/dist/init/questions.d.ts +144 -0
  535. package/dist/init/questions.d.ts.map +1 -0
  536. package/dist/init/questions.js +342 -0
  537. package/dist/init/questions.js.map +1 -0
  538. package/dist/init/run-command.d.ts +27 -0
  539. package/dist/init/run-command.d.ts.map +1 -0
  540. package/dist/init/run-command.js +63 -0
  541. package/dist/init/run-command.js.map +1 -0
  542. package/dist/init/run-init.d.ts +133 -0
  543. package/dist/init/run-init.d.ts.map +1 -0
  544. package/dist/init/run-init.js +330 -0
  545. package/dist/init/run-init.js.map +1 -0
  546. package/dist/init/segment.d.ts +60 -0
  547. package/dist/init/segment.d.ts.map +1 -0
  548. package/dist/init/segment.js +54 -0
  549. package/dist/init/segment.js.map +1 -0
  550. package/dist/init/setup-files.d.ts +85 -0
  551. package/dist/init/setup-files.d.ts.map +1 -0
  552. package/dist/init/setup-files.js +191 -0
  553. package/dist/init/setup-files.js.map +1 -0
  554. package/dist/init/setup-progress.d.ts +46 -0
  555. package/dist/init/setup-progress.d.ts.map +1 -0
  556. package/dist/init/setup-progress.js +36 -0
  557. package/dist/init/setup-progress.js.map +1 -0
  558. package/dist/init/skill-setup.d.ts +55 -0
  559. package/dist/init/skill-setup.d.ts.map +1 -0
  560. package/dist/init/skill-setup.js +47 -0
  561. package/dist/init/skill-setup.js.map +1 -0
  562. package/dist/init/storybook-scripts.d.ts +47 -0
  563. package/dist/init/storybook-scripts.d.ts.map +1 -0
  564. package/dist/init/storybook-scripts.js +114 -0
  565. package/dist/init/storybook-scripts.js.map +1 -0
  566. package/dist/init/storybook-start.d.ts +145 -0
  567. package/dist/init/storybook-start.d.ts.map +1 -0
  568. package/dist/init/storybook-start.js +109 -0
  569. package/dist/init/storybook-start.js.map +1 -0
  570. package/dist/init/unlisted-dependencies.d.ts +75 -0
  571. package/dist/init/unlisted-dependencies.d.ts.map +1 -0
  572. package/dist/init/unlisted-dependencies.js +142 -0
  573. package/dist/init/unlisted-dependencies.js.map +1 -0
  574. package/dist/init/workspace-packages.d.ts +58 -0
  575. package/dist/init/workspace-packages.d.ts.map +1 -0
  576. package/dist/init/workspace-packages.js +86 -0
  577. package/dist/init/workspace-packages.js.map +1 -0
  578. package/dist/init/workspace.d.ts +109 -0
  579. package/dist/init/workspace.d.ts.map +1 -0
  580. package/dist/init/workspace.js +433 -0
  581. package/dist/init/workspace.js.map +1 -0
  582. package/dist/report/display-path.d.ts +7 -0
  583. package/dist/report/display-path.d.ts.map +1 -0
  584. package/dist/report/display-path.js +10 -0
  585. package/dist/report/display-path.js.map +1 -0
  586. package/dist/report/report-document.d.ts +682 -0
  587. package/dist/report/report-document.d.ts.map +1 -0
  588. package/dist/report/report-document.js +90 -0
  589. package/dist/report/report-document.js.map +1 -0
  590. package/dist/report/report-folder.d.ts +102 -0
  591. package/dist/report/report-folder.d.ts.map +1 -0
  592. package/dist/report/report-folder.js +160 -0
  593. package/dist/report/report-folder.js.map +1 -0
  594. package/dist/reporter/counts-line.d.ts +14 -0
  595. package/dist/reporter/counts-line.d.ts.map +1 -0
  596. package/dist/reporter/counts-line.js +18 -0
  597. package/dist/reporter/counts-line.js.map +1 -0
  598. package/dist/reporter/duration.d.ts +8 -0
  599. package/dist/reporter/duration.d.ts.map +1 -0
  600. package/dist/reporter/duration.js +18 -0
  601. package/dist/reporter/duration.js.map +1 -0
  602. package/dist/reporter/end-block.d.ts +42 -0
  603. package/dist/reporter/end-block.d.ts.map +1 -0
  604. package/dist/reporter/end-block.js +121 -0
  605. package/dist/reporter/end-block.js.map +1 -0
  606. package/dist/reporter/log-reporter.d.ts +10 -0
  607. package/dist/reporter/log-reporter.d.ts.map +1 -0
  608. package/dist/reporter/log-reporter.js +23 -0
  609. package/dist/reporter/log-reporter.js.map +1 -0
  610. package/dist/reporter/reporter-choice.d.ts +27 -0
  611. package/dist/reporter/reporter-choice.d.ts.map +1 -0
  612. package/dist/reporter/reporter-choice.js +12 -0
  613. package/dist/reporter/reporter-choice.js.map +1 -0
  614. package/dist/reporter/run-event.d.ts +90 -0
  615. package/dist/reporter/run-event.d.ts.map +1 -0
  616. package/dist/reporter/run-event.js +2 -0
  617. package/dist/reporter/run-event.js.map +1 -0
  618. package/dist/sharding/shard.d.ts +17 -0
  619. package/dist/sharding/shard.d.ts.map +1 -0
  620. package/dist/sharding/shard.js +2 -0
  621. package/dist/sharding/shard.js.map +1 -0
  622. package/dist/sharding/split-stories-files.d.ts +43 -0
  623. package/dist/sharding/split-stories-files.d.ts.map +1 -0
  624. package/dist/sharding/split-stories-files.js +70 -0
  625. package/dist/sharding/split-stories-files.js.map +1 -0
  626. package/dist/step-summary/step-summary.d.ts +45 -0
  627. package/dist/step-summary/step-summary.d.ts.map +1 -0
  628. package/dist/step-summary/step-summary.js +263 -0
  629. package/dist/step-summary/step-summary.js.map +1 -0
  630. package/dist/storybook/options-encoding.d.ts +115 -0
  631. package/dist/storybook/options-encoding.d.ts.map +1 -0
  632. package/dist/storybook/options-encoding.js +117 -0
  633. package/dist/storybook/options-encoding.js.map +1 -0
  634. package/dist/storybook/options-read.d.ts +146 -0
  635. package/dist/storybook/options-read.d.ts.map +1 -0
  636. package/dist/storybook/options-read.js +192 -0
  637. package/dist/storybook/options-read.js.map +1 -0
  638. package/dist/storybook/preview-script.d.ts +172 -0
  639. package/dist/storybook/preview-script.d.ts.map +1 -0
  640. package/dist/storybook/preview-script.js +804 -0
  641. package/dist/storybook/preview-script.js.map +1 -0
  642. package/dist/storybook/read-stories.d.ts +72 -0
  643. package/dist/storybook/read-stories.d.ts.map +1 -0
  644. package/dist/storybook/read-stories.js +317 -0
  645. package/dist/storybook/read-stories.js.map +1 -0
  646. package/dist/storybook/stories-matchers.d.ts +39 -0
  647. package/dist/storybook/stories-matchers.d.ts.map +1 -0
  648. package/dist/storybook/stories-matchers.js +149 -0
  649. package/dist/storybook/stories-matchers.js.map +1 -0
  650. package/dist/storybook/storybook-error.d.ts +24 -0
  651. package/dist/storybook/storybook-error.d.ts.map +1 -0
  652. package/dist/storybook/storybook-error.js +24 -0
  653. package/dist/storybook/storybook-error.js.map +1 -0
  654. package/dist/storybook/storybook-version.d.ts +62 -0
  655. package/dist/storybook/storybook-version.d.ts.map +1 -0
  656. package/dist/storybook/storybook-version.js +105 -0
  657. package/dist/storybook/storybook-version.js.map +1 -0
  658. package/dist/storybook/test-path.d.ts +19 -0
  659. package/dist/storybook/test-path.d.ts.map +1 -0
  660. package/dist/storybook/test-path.js +47 -0
  661. package/dist/storybook/test-path.js.map +1 -0
  662. package/dist/storybook/wait-hook.d.ts +64 -0
  663. package/dist/storybook/wait-hook.d.ts.map +1 -0
  664. package/dist/storybook/wait-hook.js +50 -0
  665. package/dist/storybook/wait-hook.js.map +1 -0
  666. package/dist/system-error/system-reason.d.ts +8 -0
  667. package/dist/system-error/system-reason.d.ts.map +1 -0
  668. package/dist/system-error/system-reason.js +15 -0
  669. package/dist/system-error/system-reason.js.map +1 -0
  670. package/dist/terminal-ui/answered-line.d.ts +21 -0
  671. package/dist/terminal-ui/answered-line.d.ts.map +1 -0
  672. package/dist/terminal-ui/answered-line.js +12 -0
  673. package/dist/terminal-ui/answered-line.js.map +1 -0
  674. package/dist/terminal-ui/brand-header.d.ts +21 -0
  675. package/dist/terminal-ui/brand-header.d.ts.map +1 -0
  676. package/dist/terminal-ui/brand-header.js +12 -0
  677. package/dist/terminal-ui/brand-header.js.map +1 -0
  678. package/dist/terminal-ui/checklist-question.d.ts +26 -0
  679. package/dist/terminal-ui/checklist-question.d.ts.map +1 -0
  680. package/dist/terminal-ui/checklist-question.js +62 -0
  681. package/dist/terminal-ui/checklist-question.js.map +1 -0
  682. package/dist/terminal-ui/choice-line.d.ts +29 -0
  683. package/dist/terminal-ui/choice-line.d.ts.map +1 -0
  684. package/dist/terminal-ui/choice-line.js +13 -0
  685. package/dist/terminal-ui/choice-line.js.map +1 -0
  686. package/dist/terminal-ui/coloured-text.d.ts +19 -0
  687. package/dist/terminal-ui/coloured-text.d.ts.map +1 -0
  688. package/dist/terminal-ui/coloured-text.js +16 -0
  689. package/dist/terminal-ui/coloured-text.js.map +1 -0
  690. package/dist/terminal-ui/confirm-question.d.ts +8 -0
  691. package/dist/terminal-ui/confirm-question.d.ts.map +1 -0
  692. package/dist/terminal-ui/confirm-question.js +44 -0
  693. package/dist/terminal-ui/confirm-question.js.map +1 -0
  694. package/dist/terminal-ui/init-screen.d.ts +23 -0
  695. package/dist/terminal-ui/init-screen.d.ts.map +1 -0
  696. package/dist/terminal-ui/init-screen.js +74 -0
  697. package/dist/terminal-ui/init-screen.js.map +1 -0
  698. package/dist/terminal-ui/init-view-state.d.ts +294 -0
  699. package/dist/terminal-ui/init-view-state.d.ts.map +1 -0
  700. package/dist/terminal-ui/init-view-state.js +148 -0
  701. package/dist/terminal-ui/init-view-state.js.map +1 -0
  702. package/dist/terminal-ui/init-view.d.ts +70 -0
  703. package/dist/terminal-ui/init-view.d.ts.map +1 -0
  704. package/dist/terminal-ui/init-view.js +128 -0
  705. package/dist/terminal-ui/init-view.js.map +1 -0
  706. package/dist/terminal-ui/live-screen.d.ts +22 -0
  707. package/dist/terminal-ui/live-screen.d.ts.map +1 -0
  708. package/dist/terminal-ui/live-screen.js +41 -0
  709. package/dist/terminal-ui/live-screen.js.map +1 -0
  710. package/dist/terminal-ui/live-view-state.d.ts +64 -0
  711. package/dist/terminal-ui/live-view-state.d.ts.map +1 -0
  712. package/dist/terminal-ui/live-view-state.js +54 -0
  713. package/dist/terminal-ui/live-view-state.js.map +1 -0
  714. package/dist/terminal-ui/live-view.d.ts +37 -0
  715. package/dist/terminal-ui/live-view.d.ts.map +1 -0
  716. package/dist/terminal-ui/live-view.js +67 -0
  717. package/dist/terminal-ui/live-view.js.map +1 -0
  718. package/dist/terminal-ui/message-line.d.ts +31 -0
  719. package/dist/terminal-ui/message-line.d.ts.map +1 -0
  720. package/dist/terminal-ui/message-line.js +79 -0
  721. package/dist/terminal-ui/message-line.js.map +1 -0
  722. package/dist/terminal-ui/output-tail.d.ts +29 -0
  723. package/dist/terminal-ui/output-tail.d.ts.map +1 -0
  724. package/dist/terminal-ui/output-tail.js +52 -0
  725. package/dist/terminal-ui/output-tail.js.map +1 -0
  726. package/dist/terminal-ui/progress-bar.d.ts +47 -0
  727. package/dist/terminal-ui/progress-bar.d.ts.map +1 -0
  728. package/dist/terminal-ui/progress-bar.js +23 -0
  729. package/dist/terminal-ui/progress-bar.js.map +1 -0
  730. package/dist/terminal-ui/question-header.d.ts +23 -0
  731. package/dist/terminal-ui/question-header.d.ts.map +1 -0
  732. package/dist/terminal-ui/question-header.js +24 -0
  733. package/dist/terminal-ui/question-header.js.map +1 -0
  734. package/dist/terminal-ui/question.d.ts +85 -0
  735. package/dist/terminal-ui/question.d.ts.map +1 -0
  736. package/dist/terminal-ui/question.js +77 -0
  737. package/dist/terminal-ui/question.js.map +1 -0
  738. package/dist/terminal-ui/select-question.d.ts +19 -0
  739. package/dist/terminal-ui/select-question.d.ts.map +1 -0
  740. package/dist/terminal-ui/select-question.js +24 -0
  741. package/dist/terminal-ui/select-question.js.map +1 -0
  742. package/dist/terminal-ui/spinner.d.ts +26 -0
  743. package/dist/terminal-ui/spinner.d.ts.map +1 -0
  744. package/dist/terminal-ui/spinner.js +39 -0
  745. package/dist/terminal-ui/spinner.js.map +1 -0
  746. package/dist/terminal-ui/step-list.d.ts +36 -0
  747. package/dist/terminal-ui/step-list.d.ts.map +1 -0
  748. package/dist/terminal-ui/step-list.js +122 -0
  749. package/dist/terminal-ui/step-list.js.map +1 -0
  750. package/dist/terminal-ui/summary.d.ts +20 -0
  751. package/dist/terminal-ui/summary.d.ts.map +1 -0
  752. package/dist/terminal-ui/summary.js +96 -0
  753. package/dist/terminal-ui/summary.js.map +1 -0
  754. package/dist/terminal-ui/text-input.d.ts +65 -0
  755. package/dist/terminal-ui/text-input.d.ts.map +1 -0
  756. package/dist/terminal-ui/text-input.js +72 -0
  757. package/dist/terminal-ui/text-input.js.map +1 -0
  758. package/dist/terminal-ui/text-question.d.ts +18 -0
  759. package/dist/terminal-ui/text-question.d.ts.map +1 -0
  760. package/dist/terminal-ui/text-question.js +60 -0
  761. package/dist/terminal-ui/text-question.js.map +1 -0
  762. package/dist/terminal-ui/theme.d.ts +106 -0
  763. package/dist/terminal-ui/theme.d.ts.map +1 -0
  764. package/dist/terminal-ui/theme.js +97 -0
  765. package/dist/terminal-ui/theme.js.map +1 -0
  766. package/dist/terminal-ui/wrapped-lines.d.ts +15 -0
  767. package/dist/terminal-ui/wrapped-lines.d.ts.map +1 -0
  768. package/dist/terminal-ui/wrapped-lines.js +105 -0
  769. package/dist/terminal-ui/wrapped-lines.js.map +1 -0
  770. package/dist/terminal-ui/wrapped-segments.d.ts +27 -0
  771. package/dist/terminal-ui/wrapped-segments.d.ts.map +1 -0
  772. package/dist/terminal-ui/wrapped-segments.js +37 -0
  773. package/dist/terminal-ui/wrapped-segments.js.map +1 -0
  774. package/dist/terminal-ui/wrapped-text.d.ts +21 -0
  775. package/dist/terminal-ui/wrapped-text.d.ts.map +1 -0
  776. package/dist/terminal-ui/wrapped-text.js +11 -0
  777. package/dist/terminal-ui/wrapped-text.js.map +1 -0
  778. package/dist/visual-diff/diff-thread.d.ts +27 -0
  779. package/dist/visual-diff/diff-thread.d.ts.map +1 -0
  780. package/dist/visual-diff/diff-thread.js +233 -0
  781. package/dist/visual-diff/diff-thread.js.map +1 -0
  782. package/dist/visual-diff/visual-diff.d.ts +259 -0
  783. package/dist/visual-diff/visual-diff.d.ts.map +1 -0
  784. package/dist/visual-diff/visual-diff.js +317 -0
  785. package/dist/visual-diff/visual-diff.js.map +1 -0
  786. package/fallow-graph.json +1 -0
  787. package/package.json +61 -4
  788. package/skill/SKILL.md +93 -0
  789. package/skill/scripts/run.mjs +1532 -0
  790. package/README.md +0 -3
@@ -0,0 +1,765 @@
1
+ import { CaptureTooLargeError, consoleMessageFunction, keptConsoleMessages, maxCaptureSide, PageCrashedError, PageTimeoutError, readConsoleMessage, } from '../driver.js';
2
+ import { isRecord } from './cdp-connection.js';
3
+ import { LoadedDocument } from './loaded-document.js';
4
+ import { MainFrameNavigation } from './main-frame-navigation.js';
5
+ import { RequestWatch } from './request-watch.js';
6
+ import { settlesWithin, startTimeLimit, withinTimeLimit } from './time-limit.js';
7
+ /**
8
+ * How long opening a page, a viewport change, a capture or clearing storage may take, in ms. Generous, so only a
9
+ * browser that stopped answering hits it.
10
+ */
11
+ const commandTimeLimitMs = 30_000;
12
+ /**
13
+ * How long closing a page waits for the browser to dispose its context, in ms.
14
+ */
15
+ const disposeTimeLimitMs = 5_000;
16
+ /**
17
+ * How many touch points a touch viewport's page reports, as `navigator.maxTouchPoints`, like a phone.
18
+ */
19
+ const maxTouchPoints = 5;
20
+ /**
21
+ * Reads a string field the browser's answer must carry. Throws, naming the method and the field, when it's missing.
22
+ */
23
+ function readString(reply, field, method) {
24
+ const value = reply[field];
25
+ if (typeof value !== 'string') {
26
+ throw new Error(`The browser's answer to ${method} has no ${field}.`);
27
+ }
28
+ return value;
29
+ }
30
+ /**
31
+ * Reads the full page's box out of a `Page.getLayoutMetrics` answer: the layout viewport's width by the content's
32
+ * height, in whole CSS pixels rounded up, so a capture of that box takes in the whole content at the viewport's width.
33
+ * Throws, naming the field, when the answer lacks either.
34
+ */
35
+ function readFullPageBox(reply) {
36
+ const viewport = reply.cssLayoutViewport;
37
+ const content = reply.cssContentSize;
38
+ if (!isRecord(viewport) || typeof viewport.clientWidth !== 'number' || !Number.isFinite(viewport.clientWidth)) {
39
+ throw new Error("The browser's answer to Page.getLayoutMetrics has no cssLayoutViewport.");
40
+ }
41
+ if (!isRecord(content) || typeof content.height !== 'number' || !Number.isFinite(content.height)) {
42
+ throw new Error("The browser's answer to Page.getLayoutMetrics has no cssContentSize.");
43
+ }
44
+ return { x: 0, y: 0, width: Math.ceil(viewport.clientWidth), height: Math.ceil(content.height) };
45
+ }
46
+ /**
47
+ * Says whether the box, in CSS pixels of the document, lies inside the visual viewport a `Page.getLayoutMetrics`
48
+ * answer gives, edges included. Throws when the answer lacks the visual viewport.
49
+ */
50
+ function fitsVisualViewport(box, reply) {
51
+ const viewport = reply.cssVisualViewport;
52
+ const fields = ['pageX', 'pageY', 'clientWidth', 'clientHeight'];
53
+ if (!isRecord(viewport) ||
54
+ !fields.every((field) => typeof viewport[field] === 'number' && Number.isFinite(viewport[field]))) {
55
+ throw new Error("The browser's answer to Page.getLayoutMetrics has no cssVisualViewport.");
56
+ }
57
+ const { pageX, pageY, clientWidth, clientHeight } = viewport;
58
+ return (box.x >= pageX &&
59
+ box.y >= pageY &&
60
+ box.x + box.width <= pageX + clientWidth &&
61
+ box.y + box.height <= pageY + clientHeight);
62
+ }
63
+ /**
64
+ * Throws a `CaptureTooLargeError` when a capture of the box at this device scale factor would be over 32,767 device
65
+ * pixels on a side, each side rounded up to whole device pixels.
66
+ */
67
+ function checkCaptureSize(box, deviceScaleFactor) {
68
+ const deviceWidth = Math.ceil(box.width * deviceScaleFactor);
69
+ const deviceHeight = Math.ceil(box.height * deviceScaleFactor);
70
+ if (deviceWidth > maxCaptureSide || deviceHeight > maxCaptureSide) {
71
+ throw new CaptureTooLargeError(deviceWidth, deviceHeight);
72
+ }
73
+ }
74
+ /**
75
+ * Says what a `Runtime.evaluate` exception was: the value of a thrown primitive as JSON, such as `"nope"` or `42`;
76
+ * else the exception's description, such as `Error: boom` with its stack; else the exception's text, such as
77
+ * `Uncaught (in promise)`.
78
+ */
79
+ function describeException(details) {
80
+ const { exception, text } = details;
81
+ if (isRecord(exception) && 'value' in exception) {
82
+ return JSON.stringify(exception.value);
83
+ }
84
+ if (isRecord(exception) && typeof exception.description === 'string') {
85
+ return exception.description;
86
+ }
87
+ return typeof text === 'string' ? text : 'an unknown exception';
88
+ }
89
+ /**
90
+ * Reads the value out of a `Runtime.evaluate` answer. Throws, saying what was thrown, when the expression threw or its
91
+ * promise rejected, and when the value is one JSON can't carry, such as `NaN`, `Infinity`, `-0` or a bigint.
92
+ */
93
+ function readEvaluation(reply) {
94
+ const { exceptionDetails, result } = reply;
95
+ if (isRecord(exceptionDetails)) {
96
+ throw new Error(`The expression evaluated in the page threw: ${describeException(exceptionDetails)}`);
97
+ }
98
+ if (!isRecord(result)) {
99
+ return undefined;
100
+ }
101
+ if (typeof result.unserializableValue === 'string') {
102
+ throw new Error(`The expression evaluated in the page gave ${result.unserializableValue}, which JSON can't carry.`);
103
+ }
104
+ return result.value;
105
+ }
106
+ /**
107
+ * Says why an event means the page can no longer be used, or undefined when it doesn't: its renderer crashed, or the
108
+ * browser closed it without a crash, which the page's session reports as `Inspector.detached` and the browser as
109
+ * `Target.detachedFromTarget` for the session.
110
+ */
111
+ function pageFailureOf(event, sessionId) {
112
+ if (event.sessionId === sessionId && event.method === 'Inspector.targetCrashed') {
113
+ return new PageCrashedError();
114
+ }
115
+ const detached = event.sessionId === sessionId
116
+ ? event.method === 'Inspector.detached'
117
+ : event.sessionId === undefined &&
118
+ event.method === 'Target.detachedFromTarget' &&
119
+ event.params.sessionId === sessionId;
120
+ return detached ? new Error('The browser closed the page.') : undefined;
121
+ }
122
+ /**
123
+ * Gives the frame that a `Page.frameNavigated` event of the page's session commits in the main frame, whose id is the
124
+ * page's target id, or undefined for any other event, a subframe's commit included.
125
+ */
126
+ function mainFrameCommitOf(event, mainFrameId) {
127
+ const { frame } = event.params;
128
+ return event.method === 'Page.frameNavigated' && isRecord(frame) && frame.id === mainFrameId ? frame : undefined;
129
+ }
130
+ /**
131
+ * Reads a frame's security origin, such as `http://127.0.0.1:6006`, or undefined when it is opaque, which Chromium
132
+ * reports as `://`, as for `about:blank`, a `data:` URL or an error page.
133
+ */
134
+ function tupleOriginOf(securityOrigin) {
135
+ if (typeof securityOrigin !== 'string' || !URL.canParse(securityOrigin)) {
136
+ return undefined;
137
+ }
138
+ const { origin } = new URL(securityOrigin);
139
+ return origin === 'null' ? undefined : origin;
140
+ }
141
+ /**
142
+ * Says whether a `Page.javascriptDialogOpening` event's dialog is accepted: an `alert` and a `beforeunload` are, a
143
+ * `confirm` and a `prompt` are dismissed.
144
+ */
145
+ function acceptsDialog(type) {
146
+ return type === 'alert' || type === 'beforeunload';
147
+ }
148
+ /**
149
+ * Gives the id of the popup a `Target.targetCreated` event reports, or undefined when the target isn't one: a `page`
150
+ * target of the page's own browser context other than the page itself. The browser reports it at the browser level.
151
+ */
152
+ function popupIdOf(event, ids) {
153
+ const { targetInfo } = event.params;
154
+ if (event.sessionId !== undefined || event.method !== 'Target.targetCreated' || !isRecord(targetInfo)) {
155
+ return undefined;
156
+ }
157
+ const isPopup = targetInfo.type === 'page' &&
158
+ targetInfo.browserContextId === ids.browserContextId &&
159
+ targetInfo.targetId !== ids.targetId;
160
+ return isPopup && typeof targetInfo.targetId === 'string' ? targetInfo.targetId : undefined;
161
+ }
162
+ /**
163
+ * Gives the id of the execution context a `Runtime.executionContextCreated` event reports when it is the main world of
164
+ * a document of the main frame, whose id is the page's target id, or undefined for any other event or context, such as
165
+ * a subframe's or an isolated world's.
166
+ */
167
+ function mainWorldContextOf(event, mainFrameId) {
168
+ const { context } = event.params;
169
+ if (event.method !== 'Runtime.executionContextCreated' ||
170
+ !isRecord(context) ||
171
+ typeof context.id !== 'number' ||
172
+ !isRecord(context.auxData)) {
173
+ return undefined;
174
+ }
175
+ const { frameId, isDefault } = context.auxData;
176
+ return frameId === mainFrameId && isDefault === true ? context.id : undefined;
177
+ }
178
+ /**
179
+ * Reads the message a `Runtime.bindingCalled` event carries when the page script called the message function in one
180
+ * of `contexts`, or undefined for any other event, another function's call, a call from another context or a payload
181
+ * it can't read.
182
+ */
183
+ function consoleMessageOf(event, contexts) {
184
+ const { name, payload, executionContextId } = event.params;
185
+ if (event.method !== 'Runtime.bindingCalled' ||
186
+ name !== consoleMessageFunction ||
187
+ typeof payload !== 'string' ||
188
+ typeof executionContextId !== 'number' ||
189
+ !contexts.has(executionContextId)) {
190
+ return undefined;
191
+ }
192
+ return readConsoleMessage(payload);
193
+ }
194
+ /**
195
+ * Asks the browser to dispose a browser context, closing its pages. Resolves once the browser has answered, either way,
196
+ * or after 5 s.
197
+ */
198
+ async function disposeContext(connection, browserContextId) {
199
+ await settlesWithin(connection.send('Target.disposeBrowserContext', { browserContextId }), disposeTimeLimitMs);
200
+ }
201
+ /**
202
+ * A page over CDP: a target in a browser context of its own, attached in a flat session. Every command it sends goes
203
+ * in its session, but for those about its whole browser context, which go at the browser level. It listens only to its
204
+ * session's events and to the browser's word that its session detached or that a target of its context opened. It
205
+ * handles the page's hazards itself: it accepts `alert()` and `beforeunload` dialogs and dismisses `confirm()` and
206
+ * `prompt()`, closes every popup, and denies downloads and permission requests.
207
+ *
208
+ * It follows the document each `goto` loads, and fails with a `PageNavigatedAwayError` once its main frame commits a
209
+ * new document. A call the browser fails as that document comes, while a navigation of the main frame to a new
210
+ * document is pending, such as a link the page follows or its `history.back()`, fails with one too.
211
+ *
212
+ * It keeps the console messages and errors the page script sends through the message function, a binding the Runtime
213
+ * domain reports calls to. Chromium 157 reports none while that domain is off, so it turns the domain on in its
214
+ * session, which also has the browser report each console call and exception on its own: the page ignores those. It
215
+ * keeps only the calls from the main world of a document of the main frame created since the last `goto` started, so
216
+ * a call the document before it makes as that `goto` runs doesn't count.
217
+ *
218
+ * When its setup asks it to watch requests, it also turns the Network domain on in its session and attaches to the
219
+ * service workers of its browser context, as `RequestWatch` describes, and listens to their sessions too. Otherwise it
220
+ * sends no `Network` command and attaches to no service worker.
221
+ */
222
+ class CdpPage {
223
+ /**
224
+ * The browser's CDP connection.
225
+ */
226
+ connection;
227
+ /**
228
+ * The page's browser context, target and session.
229
+ */
230
+ ids;
231
+ /**
232
+ * Watches the real network requests the page makes, or undefined when its setup doesn't ask for that.
233
+ */
234
+ requestWatch;
235
+ /**
236
+ * Aborted, with the reason, once the page can no longer be used: it crashed, the browser closed it or went, it
237
+ * navigated away from the document its last `goto` loaded, or it was closed. Each call listens for the abort while it
238
+ * runs, and stops listening when it settles, so a page that lives long keeps nothing of its calls.
239
+ */
240
+ usable = new AbortController();
241
+ /**
242
+ * Stops watching the page's session for a crash, a detach, its main frame's navigations, its dialogs and, when it
243
+ * watches requests, its requests and service workers, the browser for its popups, and its service workers' sessions.
244
+ */
245
+ stopWatching;
246
+ /**
247
+ * Stops listening for the connection's close.
248
+ */
249
+ stopListeningForClose;
250
+ /**
251
+ * The closing `close()` started, or undefined before it is called.
252
+ */
253
+ closing;
254
+ /**
255
+ * The origin of the document the main frame last committed since the last `goto` started, such as
256
+ * `http://127.0.0.1:6006`. Once that `goto` has loaded, it is the `goto`'s own document's, wherever a server redirect
257
+ * took it: an earlier navigation's late commit, which the `goto` ignores, such as a failed navigation's error page,
258
+ * comes before the `goto`'s own commit, and a commit with any other loader fails the `goto`, or the page once the
259
+ * `goto` has loaded. Undefined before that commit, and when the origin is opaque. Reset when a `goto` starts, so a
260
+ * commit before it, such as the first `about:blank`, doesn't count.
261
+ */
262
+ gotoOrigin;
263
+ /**
264
+ * The document the last `goto` loaded, followed from its load event on: set the moment the `goto` takes that event in,
265
+ * before the `goto` resolves. Undefined before any `goto` has loaded, from the start of a `goto` until its load event,
266
+ * and after a `goto` failed, so the main frame's commits and navigations count for nothing here then: a running
267
+ * `goto` follows them itself.
268
+ */
269
+ loadedDocument;
270
+ /**
271
+ * The loaders of the page's navigations since its main frame last committed the document a `goto` asked for, from
272
+ * the answers to `Page.navigate`, failed ones and late answers included. A later `goto` ignores their commits, such
273
+ * as a failed navigation's error page that commits late.
274
+ */
275
+ loaderIds = new Set();
276
+ /**
277
+ * The viewport the page last set successfully, or undefined before `setViewport` has set one. Unchanged when setting
278
+ * one fails, since the caller then replaces the page.
279
+ */
280
+ viewport;
281
+ /**
282
+ * The last 50 messages the page script sent since the last `goto` started, oldest first.
283
+ */
284
+ recentConsoleMessages = [];
285
+ /**
286
+ * The execution contexts whose messages count: the main world of each document of the main frame created since the
287
+ * last `goto` started, or since the page opened before any.
288
+ */
289
+ messageContexts = new Set();
290
+ /**
291
+ * Watches the page's session for a crash, a detach, its main frame's navigations and its dialogs, the browser for its
292
+ * popups, and the connection for its close. Watches the page's requests and service workers too when `watchRequests`
293
+ * says so.
294
+ */
295
+ constructor(connection, ids, watchRequests) {
296
+ this.connection = connection;
297
+ this.ids = ids;
298
+ this.requestWatch = watchRequests ? new RequestWatch(connection, ids.browserContextId, ids.sessionId) : undefined;
299
+ this.stopWatching = connection.onEvent((event) => this.watch(event));
300
+ this.stopListeningForClose = connection.onClose((error) => this.fail(error));
301
+ }
302
+ /**
303
+ * Sets the page up once: the user agent, the emulated time zone, locale, colour scheme, motion and focus, the message
304
+ * function and the init script, and denies downloads and every permission in the page's browser context. When the
305
+ * page watches requests, it also turns the Network domain on in its session and has the session report service
306
+ * workers. A failed discovery never fails the setup. The commands go in parallel, but the browser takes a session's
307
+ * commands in order, so the message function is in every document before the init script runs there, including after
308
+ * a navigation.
309
+ */
310
+ async setUp(browserUserAgent, setup) {
311
+ await this.unlessFailed(Promise.all([
312
+ this.send('Page.enable'),
313
+ this.send('Inspector.enable'),
314
+ this.send('Emulation.setUserAgentOverride', {
315
+ userAgent: `${browserUserAgent}${setup.userAgentSuffix}`,
316
+ acceptLanguage: setup.locale,
317
+ }),
318
+ this.send('Emulation.setTimezoneOverride', { timezoneId: setup.timezone }),
319
+ this.send('Emulation.setLocaleOverride', { locale: setup.locale }),
320
+ this.send('Emulation.setEmulatedMedia', {
321
+ features: [
322
+ { name: 'prefers-color-scheme', value: setup.colorScheme },
323
+ { name: 'prefers-reduced-motion', value: 'no-preference' },
324
+ ],
325
+ }),
326
+ this.send('Emulation.setFocusEmulationEnabled', { enabled: true }),
327
+ this.send('Runtime.enable'),
328
+ this.send('Runtime.addBinding', { name: consoleMessageFunction }),
329
+ this.send('Page.addScriptToEvaluateOnNewDocument', { source: setup.initScript }),
330
+ this.connection.send('Browser.setDownloadBehavior', {
331
+ behavior: 'deny',
332
+ browserContextId: this.ids.browserContextId,
333
+ }),
334
+ // Deprecated in the protocol in favour of `Browser.setPermission`, but only this denies every permission at once,
335
+ // by granting an empty set. Check it again on a Chromium bump.
336
+ this.connection.send('Browser.grantPermissions', {
337
+ permissions: [],
338
+ browserContextId: this.ids.browserContextId,
339
+ }),
340
+ ...(this.requestWatch?.setUp() ?? []),
341
+ ]));
342
+ }
343
+ /**
344
+ * Overrides the device metrics with the viewport, which also serves as the screen size, and turns touch emulation on
345
+ * or off with it. A touch viewport is a mobile one too. The page is reused across captures, so both are set either
346
+ * way. The commands go in parallel. Keeps the viewport once the browser has taken it, so captures are sized in its
347
+ * device pixels and a touch viewport's emulation holds in them.
348
+ */
349
+ async setViewport(viewport) {
350
+ this.throwIfFailed();
351
+ await this.guarded(this.overrideDeviceMetrics(viewport, viewport.height), commandTimeLimitMs, `The page didn't set its viewport within ${commandTimeLimitMs / 1000} s.`);
352
+ this.viewport = viewport;
353
+ }
354
+ /**
355
+ * Measures the full page and, when it's taller than the viewport but fits a capture, overrides the device metrics
356
+ * again with the viewport's height set to the page's and the screen's kept. The kept viewport stays the one
357
+ * `setViewport` set, so its device scale factor and touch still size and drive captures. Before any `setViewport`, it
358
+ * does nothing: there is no viewport to grow.
359
+ *
360
+ * It leaves touch emulation alone, which holds through the new metrics. In Chromium 157, turning touch emulation off
361
+ * on a loaded page sets `(hover: none)` and drops the hover and pointer types the browser was launched with, so a
362
+ * page without touch would lose its hover styles until the next navigation.
363
+ */
364
+ async growViewportToContent() {
365
+ this.throwIfFailed();
366
+ const viewport = this.viewport;
367
+ if (viewport === undefined) {
368
+ return false;
369
+ }
370
+ return this.guarded((async () => {
371
+ const { height } = readFullPageBox(await this.send('Page.getLayoutMetrics'));
372
+ if (height <= viewport.height || Math.ceil(height * viewport.deviceScaleFactor) > maxCaptureSide) {
373
+ return false;
374
+ }
375
+ this.throwIfFailed();
376
+ await this.setDeviceMetrics(viewport, height);
377
+ return true;
378
+ })(), commandTimeLimitMs, `The page didn't grow its viewport within ${commandTimeLimitMs / 1000} s.`);
379
+ }
380
+ /**
381
+ * Navigates the main frame to `url` and resolves on the new document's load event. Listens before it navigates, and
382
+ * stops listening once it settles. Forgets the document the last `goto` loaded at once, and follows the new one from
383
+ * the moment its load event is taken in, so a commit right behind that event already counts. Once it has settled, it
384
+ * stops the navigation, so a load that a late answer to `Page.navigate` reveals after the `goto` failed doesn't count.
385
+ * Forgets the messages the page sent before it.
386
+ */
387
+ async goto(url, timeoutMs) {
388
+ this.throwIfFailed();
389
+ this.loadedDocument = undefined;
390
+ this.gotoOrigin = undefined;
391
+ this.requestWatch?.reset();
392
+ this.recentConsoleMessages = [];
393
+ this.messageContexts.clear();
394
+ const navigation = new MainFrameNavigation(url, this.ids.targetId, this.loaderIds, (later) => this.followLoadedDocument(url, later));
395
+ const stopListening = this.onSessionEvent((event) => navigation.observe(event));
396
+ try {
397
+ this.send('Page.navigate', { url }).then((result) => {
398
+ this.rememberLoader(result);
399
+ navigation.answer(result);
400
+ }, (error) => navigation.fail(error));
401
+ await this.guarded(navigation.done, timeoutMs, `The page didn't load ${url} within ${timeoutMs / 1000} s.`);
402
+ }
403
+ finally {
404
+ navigation.stop();
405
+ stopListening();
406
+ if (navigation.committed) {
407
+ this.loaderIds.clear();
408
+ }
409
+ }
410
+ }
411
+ /**
412
+ * Evaluates the expression in the main frame with a user gesture, awaiting its promise, and resolves with its value
413
+ * passed through JSON.
414
+ */
415
+ async evaluate(expression, timeoutMs) {
416
+ this.throwIfFailed();
417
+ const reply = await this.guarded(this.send('Runtime.evaluate', { expression, returnByValue: true, awaitPromise: true, userGesture: true }), timeoutMs, `The expression evaluated in the page didn't finish within ${timeoutMs / 1000} s.`);
418
+ return readEvaluation(reply);
419
+ }
420
+ /**
421
+ * Captures the area as PNG, beyond the viewport only when it reaches past the visual viewport, and resolves with the
422
+ * bytes as the browser sent them. The full page is the layout viewport's width by the content's height. A touch
423
+ * viewport's emulation holds in the capture and is still on afterwards. A capture over 32,767 device pixels on a side fails with a `CaptureTooLargeError` before the
424
+ * browser is asked for it.
425
+ */
426
+ async capture(area) {
427
+ this.throwIfFailed();
428
+ return this.guarded(this.captureBox(area), commandTimeLimitMs, `The page wasn't captured within ${commandTimeLimitMs / 1000} s.`);
429
+ }
430
+ /**
431
+ * Clears every cookie of the page's browser context, at the browser level, and the storage of the origin of the
432
+ * document the last `goto` loaded, if it isn't opaque. The commands go in parallel, and none turns a domain on. Like
433
+ * every call, it fails at once with a `PageNavigatedAwayError`, sending nothing, once the page has navigated away from
434
+ * that document: the storage that document and the next one left may then be in origins the page no longer shows.
435
+ */
436
+ async clearStorage() {
437
+ this.throwIfFailed();
438
+ const origin = this.gotoOrigin;
439
+ await this.guarded(Promise.all([
440
+ this.connection.send('Storage.clearCookies', { browserContextId: this.ids.browserContextId }),
441
+ ...(origin === undefined ? [] : this.clearOrigin(origin)),
442
+ ]), commandTimeLimitMs, `The page didn't clear its storage within ${commandTimeLimitMs / 1000} s.`);
443
+ }
444
+ /**
445
+ * Gives the hosts of the real network requests the page made since its main frame committed a document, each once,
446
+ * in the order first sent, as `RequestWatch` decides them now, against the origin of that document. Always empty when
447
+ * the page doesn't watch requests.
448
+ */
449
+ requestHosts() {
450
+ return this.requestWatch?.hosts(this.gotoOrigin) ?? [];
451
+ }
452
+ /**
453
+ * Gives a copy of the last 50 messages the page script sent since the last `goto` started, oldest first.
454
+ */
455
+ consoleMessages() {
456
+ return [...this.recentConsoleMessages];
457
+ }
458
+ /**
459
+ * Closes the page: fails every call in flight and every later one, stops listening, and disposes the page's browser
460
+ * context. Resolves once the browser has answered, either way, or after 5 s. Calling it again returns the same
461
+ * promise.
462
+ */
463
+ close() {
464
+ this.closing ??= this.shutDown();
465
+ return this.closing;
466
+ }
467
+ /**
468
+ * Starts clearing the origin's storage, in the page's session, which reaches the storage of the page's own context:
469
+ * `localStorage` and IndexedDB through `Storage.clearDataForOrigin`, and `sessionStorage` through `DOMStorage.clear`,
470
+ * which needs the main frame to show a document of the origin. In Chromium 157, `local_storage` clears
471
+ * `sessionStorage` too, but the protocol doesn't say so, so `DOMStorage.clear` stays: it is the documented way. When
472
+ * it fails, the clearing fails, which costs nothing: the caller replaces a page once a call on it fails.
473
+ */
474
+ clearOrigin(origin) {
475
+ return [
476
+ this.send('Storage.clearDataForOrigin', { origin, storageTypes: 'local_storage,indexeddb' }),
477
+ this.send('DOMStorage.clear', { storageId: { securityOrigin: origin, isLocalStorage: false } }),
478
+ ];
479
+ }
480
+ /**
481
+ * Fails the page when an event says it can no longer be used or that it navigated away from the document its last
482
+ * `goto` loaded, keeps a message the page script sent, handles its dialogs and popups, and, when it watches requests,
483
+ * tells the watch about the event.
484
+ */
485
+ watch(event) {
486
+ const failure = pageFailureOf(event, this.ids.sessionId);
487
+ if (failure !== undefined) {
488
+ this.fail(failure);
489
+ }
490
+ this.keepMessage(event);
491
+ if (event.sessionId === this.ids.sessionId) {
492
+ this.followMainFrame(event);
493
+ }
494
+ this.handleHazards(event);
495
+ this.requestWatch?.observe(event);
496
+ }
497
+ /**
498
+ * Starts following the document a `goto` to `url` loaded, and tells it about the events that came after its load
499
+ * event while the `goto` held them, which `watch` saw before that document loaded.
500
+ */
501
+ followLoadedDocument(url, later) {
502
+ this.loadedDocument = new LoadedDocument(url, this.ids.targetId);
503
+ for (const event of later) {
504
+ this.tellLoadedDocument(event);
505
+ }
506
+ }
507
+ /**
508
+ * Keeps the origin of each document the main frame commits and forgets the requests the document before it sent.
509
+ * Tells the document the last `goto` loaded about an event of the page's session.
510
+ */
511
+ followMainFrame(event) {
512
+ const frame = mainFrameCommitOf(event, this.ids.targetId);
513
+ if (frame !== undefined) {
514
+ this.gotoOrigin = tupleOriginOf(frame.securityOrigin);
515
+ this.requestWatch?.reset();
516
+ }
517
+ this.tellLoadedDocument(event);
518
+ }
519
+ /**
520
+ * Tells the document the last `goto` loaded, if one did, about an event of the page's session, and fails the page
521
+ * when the event says the page left that document.
522
+ */
523
+ tellLoadedDocument(event) {
524
+ const left = this.loadedDocument?.observe(event);
525
+ if (left !== undefined) {
526
+ this.fail(left);
527
+ }
528
+ }
529
+ /**
530
+ * Notes the main world of each new document of the main frame that the page's session reports, and keeps the message
531
+ * a `Runtime.bindingCalled` event of the session carries from one of those, if it carries one, with the 49 before it.
532
+ */
533
+ keepMessage(event) {
534
+ if (event.sessionId !== this.ids.sessionId) {
535
+ return;
536
+ }
537
+ const context = mainWorldContextOf(event, this.ids.targetId);
538
+ if (context !== undefined) {
539
+ this.messageContexts.add(context);
540
+ }
541
+ const message = consoleMessageOf(event, this.messageContexts);
542
+ if (message === undefined) {
543
+ return;
544
+ }
545
+ this.recentConsoleMessages.push(message);
546
+ this.recentConsoleMessages.splice(0, this.recentConsoleMessages.length - keptConsoleMessages);
547
+ }
548
+ /**
549
+ * Answers a dialog the page's session reports, accepting an `alert` and a `beforeunload` and dismissing a `confirm`
550
+ * and a `prompt`, and closes a popup the browser reports in the page's browser context. The replies are not awaited,
551
+ * and a failed one changes nothing: the dialog or popup may have gone already.
552
+ */
553
+ handleHazards(event) {
554
+ if (event.sessionId === this.ids.sessionId && event.method === 'Page.javascriptDialogOpening') {
555
+ this.send('Page.handleJavaScriptDialog', { accept: acceptsDialog(event.params.type) }).catch(() => undefined);
556
+ }
557
+ const popupId = popupIdOf(event, this.ids);
558
+ if (popupId !== undefined) {
559
+ this.connection.send('Target.closeTarget', { targetId: popupId }).catch(() => undefined);
560
+ }
561
+ }
562
+ /**
563
+ * Captures the area: a box as given, or, for the full page, the box the layout gives. Checks its size in device
564
+ * pixels, with the last viewport's device scale factor, or 1 before any, before sending the capture.
565
+ *
566
+ * A box inside the visual viewport is captured from what the viewport shows, which leaves the page alone. Only a box
567
+ * that reaches past it is captured beyond the viewport, because that resizes the page while it runs: the page gets
568
+ * `resize` events to 1 x 1 and back, and a page that reacts to them changes after the capture
569
+ * ([#165](https://github.com/visual-check/visual-check/issues/165)).
570
+ *
571
+ * A capture beyond the viewport swaps the page's web preferences for its own while it runs, and puts them back once
572
+ * it's done. Each swap resets the hover and pointer media that touch emulation sets. So for a touch viewport, touch
573
+ * emulation goes on again twice. First right behind the screenshot command, without waiting for its answer: Chromium
574
+ * 157 takes that in before it paints the capture, so the capture has no hover and a coarse pointer. The protocol doesn't promise that order, so check it again on a Chromium bump: the
575
+ * hover box in the e2e Modes stories shows a regression, as a hover style in a touch mode's snapshot. Then again
576
+ * once the capture is done. The next `setViewport` would turn it on anyway, but this keeps the page's contract: a
577
+ * touch viewport's emulation is still on after a capture, for later calls on the same page.
578
+ */
579
+ async captureBox(area) {
580
+ const metrics = await this.send('Page.getLayoutMetrics');
581
+ const box = area === 'full-page' ? readFullPageBox(metrics) : area;
582
+ const beyondViewport = !fitsVisualViewport(box, metrics);
583
+ this.throwIfFailed();
584
+ checkCaptureSize(box, this.viewport?.deviceScaleFactor ?? 1);
585
+ const touch = beyondViewport && this.viewport?.touch === true;
586
+ const [reply] = await Promise.all([
587
+ this.send('Page.captureScreenshot', {
588
+ format: 'png',
589
+ captureBeyondViewport: beyondViewport,
590
+ clip: { x: box.x, y: box.y, width: box.width, height: box.height, scale: 1 },
591
+ }),
592
+ ...(touch ? [this.setTouchEmulation(true)] : []),
593
+ ]);
594
+ if (touch) {
595
+ this.throwIfFailed();
596
+ await this.setTouchEmulation(true);
597
+ }
598
+ return Buffer.from(readString(reply, 'data', 'Page.captureScreenshot'), 'base64');
599
+ }
600
+ /**
601
+ * Overrides the device metrics with the viewport's width, device scale factor and touch, at `height`, with the
602
+ * viewport's own size as the screen's, and turns touch emulation on or off with it. A touch viewport is a mobile one
603
+ * too. The commands go in parallel.
604
+ */
605
+ overrideDeviceMetrics(viewport, height) {
606
+ return Promise.all([this.setDeviceMetrics(viewport, height), this.setTouchEmulation(viewport.touch)]);
607
+ }
608
+ /**
609
+ * Overrides the device metrics alone with the viewport's width, device scale factor and touch, at `height`, with the
610
+ * viewport's own size as the screen's. Touch emulation holds through it.
611
+ */
612
+ setDeviceMetrics(viewport, height) {
613
+ const { width, deviceScaleFactor, touch } = viewport;
614
+ return this.send('Emulation.setDeviceMetricsOverride', {
615
+ width,
616
+ height,
617
+ deviceScaleFactor,
618
+ mobile: touch,
619
+ screenWidth: width,
620
+ screenHeight: viewport.height,
621
+ });
622
+ }
623
+ /**
624
+ * Turns touch emulation on, with as many touch points as a phone, or off. Chromium takes no touch points below 1, so
625
+ * they go only with `enabled`.
626
+ */
627
+ setTouchEmulation(enabled) {
628
+ return this.send('Emulation.setTouchEmulationEnabled', enabled ? { enabled, maxTouchPoints } : { enabled });
629
+ }
630
+ /**
631
+ * Fails the page's calls, stops watching it, and disposes its context.
632
+ */
633
+ async shutDown() {
634
+ this.fail(new Error('The page was closed.'));
635
+ this.stopWatching();
636
+ this.stopListeningForClose();
637
+ await disposeContext(this.connection, this.ids.browserContextId);
638
+ }
639
+ /**
640
+ * Remembers the loader a `Page.navigate` answer names, if it names one.
641
+ */
642
+ rememberLoader(result) {
643
+ if (typeof result.loaderId === 'string') {
644
+ this.loaderIds.add(result.loaderId);
645
+ }
646
+ }
647
+ /**
648
+ * Calls a CDP method in the page's session.
649
+ */
650
+ send(method, params = {}) {
651
+ return this.connection.send(method, params, this.ids.sessionId);
652
+ }
653
+ /**
654
+ * Calls `listener` for every event of the page's session. Returns the function that stops listening.
655
+ */
656
+ onSessionEvent(listener) {
657
+ return this.connection.onEvent((event) => {
658
+ if (event.sessionId === this.ids.sessionId) {
659
+ listener(event);
660
+ }
661
+ });
662
+ }
663
+ /**
664
+ * Marks the page as no longer usable, and fails every call in flight with `error`. The first reason is kept.
665
+ */
666
+ fail(error) {
667
+ this.usable.abort(error);
668
+ }
669
+ /**
670
+ * Throws the reason the page can no longer be used, so a later call fails at once and sends nothing.
671
+ */
672
+ throwIfFailed() {
673
+ this.usable.signal.throwIfAborted();
674
+ }
675
+ /**
676
+ * Settles as `operation` does, unless the page can no longer be used first, which includes a failure that came while
677
+ * the operation's command was being sent. It listens for that only while it waits, so nothing keeps `operation`'s
678
+ * result once it has settled. It always takes in `operation`'s outcome, so a rejection after a failure never goes
679
+ * unhandled.
680
+ */
681
+ async unlessFailed(operation) {
682
+ const { signal } = this.usable;
683
+ let onAbort = () => undefined;
684
+ const failed = new Promise((_resolve, reject) => {
685
+ onAbort = () => reject(signal.reason);
686
+ if (signal.aborted) {
687
+ onAbort();
688
+ }
689
+ });
690
+ signal.addEventListener('abort', onAbort, { once: true });
691
+ try {
692
+ return await Promise.race([operation, failed]);
693
+ }
694
+ finally {
695
+ signal.removeEventListener('abort', onAbort);
696
+ }
697
+ }
698
+ /**
699
+ * Settles as `operation` does, unless the page can no longer be used first, or `timeLimitMs` passes first, which
700
+ * fails it with a `PageTimeoutError` carrying `timeoutMessage`. A `CdpError` that comes as the page navigates away
701
+ * from the document its last `goto` loaded, once it has requested or started that navigation, fails it with a
702
+ * `PageNavigatedAwayError` instead.
703
+ */
704
+ async guarded(operation, timeLimitMs, timeoutMessage) {
705
+ try {
706
+ return await withinTimeLimit(this.unlessFailed(operation), timeLimitMs, () => new PageTimeoutError(timeoutMessage, timeLimitMs));
707
+ }
708
+ catch (error) {
709
+ throw this.loadedDocument?.explain(error) ?? error;
710
+ }
711
+ }
712
+ }
713
+ /**
714
+ * Creates a target in the browser context, attaches to it in a flat session, and sets it up, each step raced against
715
+ * `limit`. When a step fails, it disposes the context and rethrows.
716
+ */
717
+ async function openInContext(connection, browserContextId, browserUserAgent, setup, limit) {
718
+ let page;
719
+ try {
720
+ const targetReply = await limit.race(connection.send('Target.createTarget', { url: 'about:blank', browserContextId }));
721
+ const targetId = readString(targetReply, 'targetId', 'Target.createTarget');
722
+ const attachReply = await limit.race(connection.send('Target.attachToTarget', { targetId, flatten: true }));
723
+ const sessionId = readString(attachReply, 'sessionId', 'Target.attachToTarget');
724
+ page = new CdpPage(connection, { browserContextId, targetId, sessionId }, setup.watchRequests);
725
+ await limit.race(page.setUp(browserUserAgent, setup));
726
+ return page;
727
+ }
728
+ catch (error) {
729
+ await (page?.close() ?? disposeContext(connection, browserContextId));
730
+ throw error;
731
+ }
732
+ }
733
+ /**
734
+ * Creates a fresh browser context, raced against `limit`. When the limit runs out first, it disposes the context if the
735
+ * browser creates it after all.
736
+ */
737
+ async function createContext(connection, limit) {
738
+ const creating = connection.send('Target.createBrowserContext', { disposeOnDetach: true });
739
+ let reply;
740
+ try {
741
+ reply = await limit.race(creating);
742
+ }
743
+ catch (error) {
744
+ creating.then((late) => typeof late.browserContextId === 'string' ? disposeContext(connection, late.browserContextId) : undefined, () => undefined);
745
+ throw error;
746
+ }
747
+ return readString(reply, 'browserContextId', 'Target.createBrowserContext');
748
+ }
749
+ /**
750
+ * Opens a page over CDP: creates a target in a fresh browser context, attaches to it in a flat session, and sets it up
751
+ * once. It gets the browser's own user agent with the setup's suffix, and watches its requests when the setup says
752
+ * so. From then on the page handles its hazards itself.
753
+ * When a step fails, or the page isn't open within 30 s, it disposes the context and rethrows.
754
+ */
755
+ export async function openCdpPage(connection, browserUserAgent, setup) {
756
+ const limit = startTimeLimit(commandTimeLimitMs, () => new Error(`The browser didn't open a page within ${commandTimeLimitMs / 1000} s.`));
757
+ try {
758
+ const browserContextId = await createContext(connection, limit);
759
+ return await openInContext(connection, browserContextId, browserUserAgent, setup, limit);
760
+ }
761
+ finally {
762
+ limit.clear();
763
+ }
764
+ }
765
+ //# sourceMappingURL=cdp-page.js.map