@visual-check/cli 0.0.0 → 0.1.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.
- package/LICENSE +21 -0
- package/dist/addon-build.d.ts +3 -0
- package/dist/addon-build.d.ts.map +1 -0
- package/dist/addon-build.js +4 -0
- package/dist/addon-build.js.map +1 -0
- package/dist/addon-child/addon-child.d.ts +63 -0
- package/dist/addon-child/addon-child.d.ts.map +1 -0
- package/dist/addon-child/addon-child.js +85 -0
- package/dist/addon-child/addon-child.js.map +1 -0
- package/dist/addon-child/image-files.d.ts +11 -0
- package/dist/addon-child/image-files.d.ts.map +1 -0
- package/dist/addon-child/image-files.js +138 -0
- package/dist/addon-child/image-files.js.map +1 -0
- package/dist/addon-child/protocol.d.ts +181 -0
- package/dist/addon-child/protocol.d.ts.map +1 -0
- package/dist/addon-child/protocol.js +2 -0
- package/dist/addon-child/protocol.js.map +1 -0
- package/dist/addon-child/read-request.d.ts +7 -0
- package/dist/addon-child/read-request.d.ts.map +1 -0
- package/dist/addon-child/read-request.js +25 -0
- package/dist/addon-child/read-request.js.map +1 -0
- package/dist/addon-child.d.ts +2 -0
- package/dist/addon-child.d.ts.map +1 -0
- package/dist/addon-child.js +61 -0
- package/dist/addon-child.js.map +1 -0
- package/dist/affected-stories/affected-stories.d.ts +128 -0
- package/dist/affected-stories/affected-stories.d.ts.map +1 -0
- package/dist/affected-stories/affected-stories.js +168 -0
- package/dist/affected-stories/affected-stories.js.map +1 -0
- package/dist/affected-stories/changed-file-rules.d.ts +98 -0
- package/dist/affected-stories/changed-file-rules.d.ts.map +1 -0
- package/dist/affected-stories/changed-file-rules.js +167 -0
- package/dist/affected-stories/changed-file-rules.js.map +1 -0
- package/dist/affected-stories/fallow-graph.d.ts +67 -0
- package/dist/affected-stories/fallow-graph.d.ts.map +1 -0
- package/dist/affected-stories/fallow-graph.js +180 -0
- package/dist/affected-stories/fallow-graph.js.map +1 -0
- package/dist/affected-stories/git-changes.d.ts +57 -0
- package/dist/affected-stories/git-changes.d.ts.map +1 -0
- package/dist/affected-stories/git-changes.js +203 -0
- package/dist/affected-stories/git-changes.js.map +1 -0
- package/dist/affected-stories/group-changes.d.ts +48 -0
- package/dist/affected-stories/group-changes.d.ts.map +1 -0
- package/dist/affected-stories/group-changes.js +41 -0
- package/dist/affected-stories/group-changes.js.map +1 -0
- package/dist/affected-stories/import-graph.d.ts +33 -0
- package/dist/affected-stories/import-graph.d.ts.map +1 -0
- package/dist/affected-stories/import-graph.js +99 -0
- package/dist/affected-stories/import-graph.js.map +1 -0
- package/dist/affected-stories/limited-map.d.ts +9 -0
- package/dist/affected-stories/limited-map.d.ts.map +1 -0
- package/dist/affected-stories/limited-map.js +24 -0
- package/dist/affected-stories/limited-map.js.map +1 -0
- package/dist/affected-stories/package-folder.d.ts +8 -0
- package/dist/affected-stories/package-folder.d.ts.map +1 -0
- package/dist/affected-stories/package-folder.js +45 -0
- package/dist/affected-stories/package-folder.js.map +1 -0
- package/dist/affected-stories/storybook-rules.d.ts +153 -0
- package/dist/affected-stories/storybook-rules.d.ts.map +1 -0
- package/dist/affected-stories/storybook-rules.js +161 -0
- package/dist/affected-stories/storybook-rules.js.map +1 -0
- package/dist/affected-stories/walk-back.d.ts +16 -0
- package/dist/affected-stories/walk-back.d.ts.map +1 -0
- package/dist/affected-stories/walk-back.js +46 -0
- package/dist/affected-stories/walk-back.js.map +1 -0
- package/dist/agent-skill/install-skill.d.ts +34 -0
- package/dist/agent-skill/install-skill.d.ts.map +1 -0
- package/dist/agent-skill/install-skill.js +43 -0
- package/dist/agent-skill/install-skill.js.map +1 -0
- package/dist/agent-skill/refresh-skill.d.ts +62 -0
- package/dist/agent-skill/refresh-skill.d.ts.map +1 -0
- package/dist/agent-skill/refresh-skill.js +105 -0
- package/dist/agent-skill/refresh-skill.js.map +1 -0
- package/dist/agent-skill/setup-file.d.ts +41 -0
- package/dist/agent-skill/setup-file.d.ts.map +1 -0
- package/dist/agent-skill/setup-file.js +38 -0
- package/dist/agent-skill/setup-file.js.map +1 -0
- package/dist/agent-skill/skill-files.d.ts +19 -0
- package/dist/agent-skill/skill-files.d.ts.map +1 -0
- package/dist/agent-skill/skill-files.js +29 -0
- package/dist/agent-skill/skill-files.js.map +1 -0
- package/dist/agent-skill/skill-markdown.d.ts +31 -0
- package/dist/agent-skill/skill-markdown.d.ts.map +1 -0
- package/dist/agent-skill/skill-markdown.js +54 -0
- package/dist/agent-skill/skill-markdown.js.map +1 -0
- package/dist/baselines/baseline-clash.d.ts +31 -0
- package/dist/baselines/baseline-clash.d.ts.map +1 -0
- package/dist/baselines/baseline-clash.js +23 -0
- package/dist/baselines/baseline-clash.js.map +1 -0
- package/dist/baselines/baseline-error.d.ts +39 -0
- package/dist/baselines/baseline-error.d.ts.map +1 -0
- package/dist/baselines/baseline-error.js +42 -0
- package/dist/baselines/baseline-error.js.map +1 -0
- package/dist/baselines/baseline-files.d.ts +130 -0
- package/dist/baselines/baseline-files.d.ts.map +1 -0
- package/dist/baselines/baseline-files.js +292 -0
- package/dist/baselines/baseline-files.js.map +1 -0
- package/dist/baselines/baseline-set.d.ts +42 -0
- package/dist/baselines/baseline-set.d.ts.map +1 -0
- package/dist/baselines/baseline-set.js +104 -0
- package/dist/baselines/baseline-set.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +57 -0
- package/dist/bin.js.map +1 -0
- package/dist/browser/browser-package.d.ts +54 -0
- package/dist/browser/browser-package.d.ts.map +1 -0
- package/dist/browser/browser-package.js +105 -0
- package/dist/browser/browser-package.js.map +1 -0
- package/dist/browser/browser-version.d.ts +67 -0
- package/dist/browser/browser-version.d.ts.map +1 -0
- package/dist/browser/browser-version.js +61 -0
- package/dist/browser/browser-version.js.map +1 -0
- package/dist/browser/chrome-for-testing-platform.d.ts +24 -0
- package/dist/browser/chrome-for-testing-platform.d.ts.map +1 -0
- package/dist/browser/chrome-for-testing-platform.js +39 -0
- package/dist/browser/chrome-for-testing-platform.js.map +1 -0
- package/dist/browser/image-marker.d.ts +46 -0
- package/dist/browser/image-marker.d.ts.map +1 -0
- package/dist/browser/image-marker.js +81 -0
- package/dist/browser/image-marker.js.map +1 -0
- package/dist/browser/read-browser-package.d.ts +58 -0
- package/dist/browser/read-browser-package.d.ts.map +1 -0
- package/dist/browser/read-browser-package.js +130 -0
- package/dist/browser/read-browser-package.js.map +1 -0
- package/dist/browser-download/browser-download-error.d.ts +19 -0
- package/dist/browser-download/browser-download-error.d.ts.map +1 -0
- package/dist/browser-download/browser-download-error.js +21 -0
- package/dist/browser-download/browser-download-error.js.map +1 -0
- package/dist/browser-download/cache-folder.d.ts +7 -0
- package/dist/browser-download/cache-folder.d.ts.map +1 -0
- package/dist/browser-download/cache-folder.js +34 -0
- package/dist/browser-download/cache-folder.js.map +1 -0
- package/dist/browser-download/download-file.d.ts +45 -0
- package/dist/browser-download/download-file.d.ts.map +1 -0
- package/dist/browser-download/download-file.js +340 -0
- package/dist/browser-download/download-file.js.map +1 -0
- package/dist/browser-download/install-headless-shell.d.ts +96 -0
- package/dist/browser-download/install-headless-shell.d.ts.map +1 -0
- package/dist/browser-download/install-headless-shell.js +491 -0
- package/dist/browser-download/install-headless-shell.js.map +1 -0
- package/dist/browser-download/proxy.d.ts +19 -0
- package/dist/browser-download/proxy.d.ts.map +1 -0
- package/dist/browser-download/proxy.js +102 -0
- package/dist/browser-download/proxy.js.map +1 -0
- package/dist/browser-download/unzip.d.ts +11 -0
- package/dist/browser-download/unzip.d.ts.map +1 -0
- package/dist/browser-download/unzip.js +96 -0
- package/dist/browser-download/unzip.js.map +1 -0
- package/dist/browser-process/start-browser-process.d.ts +30 -0
- package/dist/browser-process/start-browser-process.d.ts.map +1 -0
- package/dist/browser-process/start-browser-process.js +131 -0
- package/dist/browser-process/start-browser-process.js.map +1 -0
- package/dist/capture/capture-session.d.ts +472 -0
- package/dist/capture/capture-session.d.ts.map +1 -0
- package/dist/capture/capture-session.js +701 -0
- package/dist/capture/capture-session.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-connection.d.ts +127 -0
- package/dist/capture/driver/cdp/cdp-connection.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-connection.js +243 -0
- package/dist/capture/driver/cdp/cdp-connection.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-driver.d.ts +42 -0
- package/dist/capture/driver/cdp/cdp-driver.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-driver.js +270 -0
- package/dist/capture/driver/cdp/cdp-driver.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-page.d.ts +10 -0
- package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-page.js +704 -0
- package/dist/capture/driver/cdp/cdp-page.js.map +1 -0
- package/dist/capture/driver/cdp/last-lines.d.ts +13 -0
- package/dist/capture/driver/cdp/last-lines.d.ts.map +1 -0
- package/dist/capture/driver/cdp/last-lines.js +49 -0
- package/dist/capture/driver/cdp/last-lines.js.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts +16 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.js +142 -0
- package/dist/capture/driver/cdp/launch-arguments.js.map +1 -0
- package/dist/capture/driver/cdp/loaded-document.d.ts +61 -0
- package/dist/capture/driver/cdp/loaded-document.d.ts.map +1 -0
- package/dist/capture/driver/cdp/loaded-document.js +104 -0
- package/dist/capture/driver/cdp/loaded-document.js.map +1 -0
- package/dist/capture/driver/cdp/main-frame-navigation.d.ts +127 -0
- package/dist/capture/driver/cdp/main-frame-navigation.d.ts.map +1 -0
- package/dist/capture/driver/cdp/main-frame-navigation.js +214 -0
- package/dist/capture/driver/cdp/main-frame-navigation.js.map +1 -0
- package/dist/capture/driver/cdp/request-watch.d.ts +117 -0
- package/dist/capture/driver/cdp/request-watch.d.ts.map +1 -0
- package/dist/capture/driver/cdp/request-watch.js +244 -0
- package/dist/capture/driver/cdp/request-watch.js.map +1 -0
- package/dist/capture/driver/cdp/time-limit.d.ts +29 -0
- package/dist/capture/driver/cdp/time-limit.d.ts.map +1 -0
- package/dist/capture/driver/cdp/time-limit.js +51 -0
- package/dist/capture/driver/cdp/time-limit.js.map +1 -0
- package/dist/capture/driver/driver.d.ts +500 -0
- package/dist/capture/driver/driver.d.ts.map +1 -0
- package/dist/capture/driver/driver.js +283 -0
- package/dist/capture/driver/driver.js.map +1 -0
- package/dist/capture/end-state.d.ts +131 -0
- package/dist/capture/end-state.d.ts.map +1 -0
- package/dist/capture/end-state.js +818 -0
- package/dist/capture/end-state.js.map +1 -0
- package/dist/capture/page-roots.d.ts +18 -0
- package/dist/capture/page-roots.d.ts.map +1 -0
- package/dist/capture/page-roots.js +67 -0
- package/dist/capture/page-roots.js.map +1 -0
- package/dist/capture/page-script.d.ts +118 -0
- package/dist/capture/page-script.d.ts.map +1 -0
- package/dist/capture/page-script.js +399 -0
- package/dist/capture/page-script.js.map +1 -0
- package/dist/capture/prepare-capture.d.ts +228 -0
- package/dist/capture/prepare-capture.d.ts.map +1 -0
- package/dist/capture/prepare-capture.js +480 -0
- package/dist/capture/prepare-capture.js.map +1 -0
- package/dist/capture/read-options.d.ts +65 -0
- package/dist/capture/read-options.d.ts.map +1 -0
- package/dist/capture/read-options.js +211 -0
- package/dist/capture/read-options.js.map +1 -0
- package/dist/capture/remote-content.d.ts +45 -0
- package/dist/capture/remote-content.d.ts.map +1 -0
- package/dist/capture/remote-content.js +309 -0
- package/dist/capture/remote-content.js.map +1 -0
- package/dist/capture/worker-pool.d.ts +35 -0
- package/dist/capture/worker-pool.d.ts.map +1 -0
- package/dist/capture/worker-pool.js +51 -0
- package/dist/capture/worker-pool.js.map +1 -0
- package/dist/commands/abortable.d.ts +9 -0
- package/dist/commands/abortable.d.ts.map +1 -0
- package/dist/commands/abortable.js +18 -0
- package/dist/commands/abortable.js.map +1 -0
- package/dist/commands/browser-route.d.ts +86 -0
- package/dist/commands/browser-route.d.ts.map +1 -0
- package/dist/commands/browser-route.js +27 -0
- package/dist/commands/browser-route.js.map +1 -0
- package/dist/commands/capture-settings.d.ts +8 -0
- package/dist/commands/capture-settings.d.ts.map +1 -0
- package/dist/commands/capture-settings.js +17 -0
- package/dist/commands/capture-settings.js.map +1 -0
- package/dist/commands/check-story.d.ts +91 -0
- package/dist/commands/check-story.d.ts.map +1 -0
- package/dist/commands/check-story.js +52 -0
- package/dist/commands/check-story.js.map +1 -0
- package/dist/commands/check-storybooks.d.ts +71 -0
- package/dist/commands/check-storybooks.d.ts.map +1 -0
- package/dist/commands/check-storybooks.js +49 -0
- package/dist/commands/check-storybooks.js.map +1 -0
- package/dist/commands/consistency-check.d.ts +62 -0
- package/dist/commands/consistency-check.d.ts.map +1 -0
- package/dist/commands/consistency-check.js +63 -0
- package/dist/commands/consistency-check.js.map +1 -0
- package/dist/commands/consistency-output.d.ts +63 -0
- package/dist/commands/consistency-output.d.ts.map +1 -0
- package/dist/commands/consistency-output.js +63 -0
- package/dist/commands/consistency-output.js.map +1 -0
- package/dist/commands/docker-problem.d.ts +23 -0
- package/dist/commands/docker-problem.d.ts.map +1 -0
- package/dist/commands/docker-problem.js +18 -0
- package/dist/commands/docker-problem.js.map +1 -0
- package/dist/commands/launch-browser.d.ts +123 -0
- package/dist/commands/launch-browser.d.ts.map +1 -0
- package/dist/commands/launch-browser.js +113 -0
- package/dist/commands/launch-browser.js.map +1 -0
- package/dist/commands/missing-library.d.ts +6 -0
- package/dist/commands/missing-library.d.ts.map +1 -0
- package/dist/commands/missing-library.js +19 -0
- package/dist/commands/missing-library.js.map +1 -0
- package/dist/commands/network-warning.d.ts +36 -0
- package/dist/commands/network-warning.d.ts.map +1 -0
- package/dist/commands/network-warning.js +92 -0
- package/dist/commands/network-warning.js.map +1 -0
- package/dist/commands/parse-command-line.d.ts +133 -0
- package/dist/commands/parse-command-line.d.ts.map +1 -0
- package/dist/commands/parse-command-line.js +425 -0
- package/dist/commands/parse-command-line.js.map +1 -0
- package/dist/commands/place-browser.d.ts +75 -0
- package/dist/commands/place-browser.d.ts.map +1 -0
- package/dist/commands/place-browser.js +82 -0
- package/dist/commands/place-browser.js.map +1 -0
- package/dist/commands/plan-snapshots.d.ts +134 -0
- package/dist/commands/plan-snapshots.d.ts.map +1 -0
- package/dist/commands/plan-snapshots.js +278 -0
- package/dist/commands/plan-snapshots.js.map +1 -0
- package/dist/commands/platform-problem.d.ts +7 -0
- package/dist/commands/platform-problem.d.ts.map +1 -0
- package/dist/commands/platform-problem.js +12 -0
- package/dist/commands/platform-problem.js.map +1 -0
- package/dist/commands/read-image-fit.d.ts +16 -0
- package/dist/commands/read-image-fit.d.ts.map +1 -0
- package/dist/commands/read-image-fit.js +26 -0
- package/dist/commands/read-image-fit.js.map +1 -0
- package/dist/commands/remote-content-hint.d.ts +6 -0
- package/dist/commands/remote-content-hint.d.ts.map +1 -0
- package/dist/commands/remote-content-hint.js +37 -0
- package/dist/commands/remote-content-hint.js.map +1 -0
- package/dist/commands/report-entries.d.ts +94 -0
- package/dist/commands/report-entries.d.ts.map +1 -0
- package/dist/commands/report-entries.js +384 -0
- package/dist/commands/report-entries.js.map +1 -0
- package/dist/commands/run-browser.d.ts +128 -0
- package/dist/commands/run-browser.d.ts.map +1 -0
- package/dist/commands/run-browser.js +210 -0
- package/dist/commands/run-browser.js.map +1 -0
- package/dist/commands/run-cli.d.ts +125 -0
- package/dist/commands/run-cli.d.ts.map +1 -0
- package/dist/commands/run-cli.js +656 -0
- package/dist/commands/run-cli.js.map +1 -0
- package/dist/commands/run-output.d.ts +78 -0
- package/dist/commands/run-output.d.ts.map +1 -0
- package/dist/commands/run-output.js +71 -0
- package/dist/commands/run-output.js.map +1 -0
- package/dist/commands/run-report.d.ts +147 -0
- package/dist/commands/run-report.d.ts.map +1 -0
- package/dist/commands/run-report.js +137 -0
- package/dist/commands/run-report.js.map +1 -0
- package/dist/commands/run-selection.d.ts +191 -0
- package/dist/commands/run-selection.d.ts.map +1 -0
- package/dist/commands/run-selection.js +150 -0
- package/dist/commands/run-selection.js.map +1 -0
- package/dist/commands/run-snapshots.d.ts +272 -0
- package/dist/commands/run-snapshots.d.ts.map +1 -0
- package/dist/commands/run-snapshots.js +354 -0
- package/dist/commands/run-snapshots.js.map +1 -0
- package/dist/commands/same-address.d.ts +6 -0
- package/dist/commands/same-address.d.ts.map +1 -0
- package/dist/commands/same-address.js +32 -0
- package/dist/commands/same-address.js.map +1 -0
- package/dist/commands/select-stories.d.ts +40 -0
- package/dist/commands/select-stories.d.ts.map +1 -0
- package/dist/commands/select-stories.js +15 -0
- package/dist/commands/select-stories.js.map +1 -0
- package/dist/commands/shard-share.d.ts +41 -0
- package/dist/commands/shard-share.d.ts.map +1 -0
- package/dist/commands/shard-share.js +61 -0
- package/dist/commands/shard-share.js.map +1 -0
- package/dist/commands/snapshot-result.d.ts +165 -0
- package/dist/commands/snapshot-result.d.ts.map +1 -0
- package/dist/commands/snapshot-result.js +135 -0
- package/dist/commands/snapshot-result.js.map +1 -0
- package/dist/commands/stop-message.d.ts +65 -0
- package/dist/commands/stop-message.d.ts.map +1 -0
- package/dist/commands/stop-message.js +186 -0
- package/dist/commands/stop-message.js.map +1 -0
- package/dist/commands/stopped-run.d.ts +116 -0
- package/dist/commands/stopped-run.d.ts.map +1 -0
- package/dist/commands/stopped-run.js +103 -0
- package/dist/commands/stopped-run.js.map +1 -0
- package/dist/commands/story-run.d.ts +196 -0
- package/dist/commands/story-run.d.ts.map +1 -0
- package/dist/commands/story-run.js +258 -0
- package/dist/commands/story-run.js.map +1 -0
- package/dist/commands/take-snapshot.d.ts +27 -0
- package/dist/commands/take-snapshot.d.ts.map +1 -0
- package/dist/commands/take-snapshot.js +16 -0
- package/dist/commands/take-snapshot.js.map +1 -0
- package/dist/commands/test-plan.d.ts +100 -0
- package/dist/commands/test-plan.d.ts.map +1 -0
- package/dist/commands/test-plan.js +66 -0
- package/dist/commands/test-plan.js.map +1 -0
- package/dist/commands/test-snapshot.d.ts +52 -0
- package/dist/commands/test-snapshot.d.ts.map +1 -0
- package/dist/commands/test-snapshot.js +183 -0
- package/dist/commands/test-snapshot.js.map +1 -0
- package/dist/commands/update-baselines.d.ts +93 -0
- package/dist/commands/update-baselines.d.ts.map +1 -0
- package/dist/commands/update-baselines.js +120 -0
- package/dist/commands/update-baselines.js.map +1 -0
- package/dist/commands/update-snapshot.d.ts +69 -0
- package/dist/commands/update-snapshot.d.ts.map +1 -0
- package/dist/commands/update-snapshot.js +214 -0
- package/dist/commands/update-snapshot.js.map +1 -0
- package/dist/commands/update-story.d.ts +70 -0
- package/dist/commands/update-story.d.ts.map +1 -0
- package/dist/commands/update-story.js +64 -0
- package/dist/commands/update-story.js.map +1 -0
- package/dist/commands/warm-browser.d.ts +43 -0
- package/dist/commands/warm-browser.d.ts.map +1 -0
- package/dist/commands/warm-browser.js +192 -0
- package/dist/commands/warm-browser.js.map +1 -0
- package/dist/config/addon-image-folders.d.ts +13 -0
- package/dist/config/addon-image-folders.d.ts.map +1 -0
- package/dist/config/addon-image-folders.js +7 -0
- package/dist/config/addon-image-folders.js.map +1 -0
- package/dist/config/checks.d.ts +108 -0
- package/dist/config/checks.d.ts.map +1 -0
- package/dist/config/checks.js +190 -0
- package/dist/config/checks.js.map +1 -0
- package/dist/config/config-error.d.ts +23 -0
- package/dist/config/config-error.d.ts.map +1 -0
- package/dist/config/config-error.js +23 -0
- package/dist/config/config-error.js.map +1 -0
- package/dist/config/config-thread.d.ts +25 -0
- package/dist/config/config-thread.d.ts.map +1 -0
- package/dist/config/config-thread.js +73 -0
- package/dist/config/config-thread.js.map +1 -0
- package/dist/config/define-config.d.ts +192 -0
- package/dist/config/define-config.d.ts.map +1 -0
- package/dist/config/define-config.js +9 -0
- package/dist/config/define-config.js.map +1 -0
- package/dist/config/evaluate-config.d.ts +6 -0
- package/dist/config/evaluate-config.d.ts.map +1 -0
- package/dist/config/evaluate-config.js +39 -0
- package/dist/config/evaluate-config.js.map +1 -0
- package/dist/config/find-config.d.ts +35 -0
- package/dist/config/find-config.d.ts.map +1 -0
- package/dist/config/find-config.js +71 -0
- package/dist/config/find-config.js.map +1 -0
- package/dist/config/find-storybook-url-problem.d.ts +29 -0
- package/dist/config/find-storybook-url-problem.d.ts.map +1 -0
- package/dist/config/find-storybook-url-problem.js +34 -0
- package/dist/config/find-storybook-url-problem.js.map +1 -0
- package/dist/config/is-ci.d.ts +7 -0
- package/dist/config/is-ci.d.ts.map +1 -0
- package/dist/config/is-ci.js +10 -0
- package/dist/config/is-ci.js.map +1 -0
- package/dist/config/load-config.d.ts +72 -0
- package/dist/config/load-config.d.ts.map +1 -0
- package/dist/config/load-config.js +95 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/load-storybook-config.d.ts +71 -0
- package/dist/config/load-storybook-config.d.ts.map +1 -0
- package/dist/config/load-storybook-config.js +104 -0
- package/dist/config/load-storybook-config.js.map +1 -0
- package/dist/config/mode-rules.d.ts +42 -0
- package/dist/config/mode-rules.d.ts.map +1 -0
- package/dist/config/mode-rules.js +188 -0
- package/dist/config/mode-rules.js.map +1 -0
- package/dist/config/read-config-afresh.d.ts +13 -0
- package/dist/config/read-config-afresh.d.ts.map +1 -0
- package/dist/config/read-config-afresh.js +28 -0
- package/dist/config/read-config-afresh.js.map +1 -0
- package/dist/config/resolve-config.d.ts +162 -0
- package/dist/config/resolve-config.d.ts.map +1 -0
- package/dist/config/resolve-config.js +181 -0
- package/dist/config/resolve-config.js.map +1 -0
- package/dist/config/story-options.d.ts +69 -0
- package/dist/config/story-options.d.ts.map +1 -0
- package/dist/config/story-options.js +174 -0
- package/dist/config/story-options.js.map +1 -0
- package/dist/config/validate-config.d.ts +9 -0
- package/dist/config/validate-config.d.ts.map +1 -0
- package/dist/config/validate-config.js +185 -0
- package/dist/config/validate-config.js.map +1 -0
- package/dist/container/browser-container.d.ts +57 -0
- package/dist/container/browser-container.d.ts.map +1 -0
- package/dist/container/browser-container.js +112 -0
- package/dist/container/browser-container.js.map +1 -0
- package/dist/container/container-error.d.ts +47 -0
- package/dist/container/container-error.d.ts.map +1 -0
- package/dist/container/container-error.js +43 -0
- package/dist/container/container-error.js.map +1 -0
- package/dist/container/docker-probe.d.ts +37 -0
- package/dist/container/docker-probe.d.ts.map +1 -0
- package/dist/container/docker-probe.js +85 -0
- package/dist/container/docker-probe.js.map +1 -0
- package/dist/container/image-pull.d.ts +11 -0
- package/dist/container/image-pull.d.ts.map +1 -0
- package/dist/container/image-pull.js +40 -0
- package/dist/container/image-pull.js.map +1 -0
- package/dist/container/inside-container.d.ts +8 -0
- package/dist/container/inside-container.d.ts.map +1 -0
- package/dist/container/inside-container.js +11 -0
- package/dist/container/inside-container.js.map +1 -0
- package/dist/container/launch-through-proxy.d.ts +16 -0
- package/dist/container/launch-through-proxy.d.ts.map +1 -0
- package/dist/container/launch-through-proxy.js +51 -0
- package/dist/container/launch-through-proxy.js.map +1 -0
- package/dist/container/own-container.d.ts +12 -0
- package/dist/container/own-container.d.ts.map +1 -0
- package/dist/container/own-container.js +61 -0
- package/dist/container/own-container.js.map +1 -0
- package/dist/container/proxy-reach.d.ts +19 -0
- package/dist/container/proxy-reach.d.ts.map +1 -0
- package/dist/container/proxy-reach.js +101 -0
- package/dist/container/proxy-reach.js.map +1 -0
- package/dist/container/run-docker.d.ts +11 -0
- package/dist/container/run-docker.d.ts.map +1 -0
- package/dist/container/run-docker.js +61 -0
- package/dist/container/run-docker.js.map +1 -0
- package/dist/container/socks-proxy.d.ts +28 -0
- package/dist/container/socks-proxy.d.ts.map +1 -0
- package/dist/container/socks-proxy.js +335 -0
- package/dist/container/socks-proxy.js.map +1 -0
- package/dist/docs-site/docs-url.d.ts +7 -0
- package/dist/docs-site/docs-url.d.ts.map +1 -0
- package/dist/docs-site/docs-url.js +13 -0
- package/dist/docs-site/docs-url.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/init/addon-question.d.ts +99 -0
- package/dist/init/addon-question.d.ts.map +1 -0
- package/dist/init/addon-question.js +111 -0
- package/dist/init/addon-question.js.map +1 -0
- package/dist/init/closing-message.d.ts +182 -0
- package/dist/init/closing-message.d.ts.map +1 -0
- package/dist/init/closing-message.js +189 -0
- package/dist/init/closing-message.js.map +1 -0
- package/dist/init/detect-project.d.ts +111 -0
- package/dist/init/detect-project.d.ts.map +1 -0
- package/dist/init/detect-project.js +166 -0
- package/dist/init/detect-project.js.map +1 -0
- package/dist/init/existing-config.d.ts +68 -0
- package/dist/init/existing-config.d.ts.map +1 -0
- package/dist/init/existing-config.js +149 -0
- package/dist/init/existing-config.js.map +1 -0
- package/dist/init/find-storybooks.d.ts +93 -0
- package/dist/init/find-storybooks.d.ts.map +1 -0
- package/dist/init/find-storybooks.js +165 -0
- package/dist/init/find-storybooks.js.map +1 -0
- package/dist/init/init-checks.d.ts +49 -0
- package/dist/init/init-checks.d.ts.map +1 -0
- package/dist/init/init-checks.js +151 -0
- package/dist/init/init-checks.js.map +1 -0
- package/dist/init/install.d.ts +286 -0
- package/dist/init/install.d.ts.map +1 -0
- package/dist/init/install.js +226 -0
- package/dist/init/install.js.map +1 -0
- package/dist/init/list-of.d.ts +10 -0
- package/dist/init/list-of.d.ts.map +1 -0
- package/dist/init/list-of.js +18 -0
- package/dist/init/list-of.js.map +1 -0
- package/dist/init/package-manager.d.ts +214 -0
- package/dist/init/package-manager.d.ts.map +1 -0
- package/dist/init/package-manager.js +308 -0
- package/dist/init/package-manager.js.map +1 -0
- package/dist/init/package-scripts.d.ts +72 -0
- package/dist/init/package-scripts.d.ts.map +1 -0
- package/dist/init/package-scripts.js +29 -0
- package/dist/init/package-scripts.js.map +1 -0
- package/dist/init/prompter.d.ts +143 -0
- package/dist/init/prompter.d.ts.map +1 -0
- package/dist/init/prompter.js +65 -0
- package/dist/init/prompter.js.map +1 -0
- package/dist/init/questions.d.ts +144 -0
- package/dist/init/questions.d.ts.map +1 -0
- package/dist/init/questions.js +342 -0
- package/dist/init/questions.js.map +1 -0
- package/dist/init/run-command.d.ts +27 -0
- package/dist/init/run-command.d.ts.map +1 -0
- package/dist/init/run-command.js +63 -0
- package/dist/init/run-command.js.map +1 -0
- package/dist/init/run-init.d.ts +133 -0
- package/dist/init/run-init.d.ts.map +1 -0
- package/dist/init/run-init.js +330 -0
- package/dist/init/run-init.js.map +1 -0
- package/dist/init/segment.d.ts +60 -0
- package/dist/init/segment.d.ts.map +1 -0
- package/dist/init/segment.js +54 -0
- package/dist/init/segment.js.map +1 -0
- package/dist/init/setup-files.d.ts +85 -0
- package/dist/init/setup-files.d.ts.map +1 -0
- package/dist/init/setup-files.js +191 -0
- package/dist/init/setup-files.js.map +1 -0
- package/dist/init/setup-progress.d.ts +46 -0
- package/dist/init/setup-progress.d.ts.map +1 -0
- package/dist/init/setup-progress.js +36 -0
- package/dist/init/setup-progress.js.map +1 -0
- package/dist/init/skill-setup.d.ts +55 -0
- package/dist/init/skill-setup.d.ts.map +1 -0
- package/dist/init/skill-setup.js +47 -0
- package/dist/init/skill-setup.js.map +1 -0
- package/dist/init/storybook-scripts.d.ts +47 -0
- package/dist/init/storybook-scripts.d.ts.map +1 -0
- package/dist/init/storybook-scripts.js +114 -0
- package/dist/init/storybook-scripts.js.map +1 -0
- package/dist/init/storybook-start.d.ts +145 -0
- package/dist/init/storybook-start.d.ts.map +1 -0
- package/dist/init/storybook-start.js +109 -0
- package/dist/init/storybook-start.js.map +1 -0
- package/dist/init/unlisted-dependencies.d.ts +75 -0
- package/dist/init/unlisted-dependencies.d.ts.map +1 -0
- package/dist/init/unlisted-dependencies.js +142 -0
- package/dist/init/unlisted-dependencies.js.map +1 -0
- package/dist/init/workspace-packages.d.ts +58 -0
- package/dist/init/workspace-packages.d.ts.map +1 -0
- package/dist/init/workspace-packages.js +86 -0
- package/dist/init/workspace-packages.js.map +1 -0
- package/dist/init/workspace.d.ts +109 -0
- package/dist/init/workspace.d.ts.map +1 -0
- package/dist/init/workspace.js +433 -0
- package/dist/init/workspace.js.map +1 -0
- package/dist/report/display-path.d.ts +7 -0
- package/dist/report/display-path.d.ts.map +1 -0
- package/dist/report/display-path.js +10 -0
- package/dist/report/display-path.js.map +1 -0
- package/dist/report/report-document.d.ts +682 -0
- package/dist/report/report-document.d.ts.map +1 -0
- package/dist/report/report-document.js +90 -0
- package/dist/report/report-document.js.map +1 -0
- package/dist/report/report-folder.d.ts +102 -0
- package/dist/report/report-folder.d.ts.map +1 -0
- package/dist/report/report-folder.js +160 -0
- package/dist/report/report-folder.js.map +1 -0
- package/dist/reporter/counts-line.d.ts +14 -0
- package/dist/reporter/counts-line.d.ts.map +1 -0
- package/dist/reporter/counts-line.js +18 -0
- package/dist/reporter/counts-line.js.map +1 -0
- package/dist/reporter/duration.d.ts +8 -0
- package/dist/reporter/duration.d.ts.map +1 -0
- package/dist/reporter/duration.js +18 -0
- package/dist/reporter/duration.js.map +1 -0
- package/dist/reporter/end-block.d.ts +42 -0
- package/dist/reporter/end-block.d.ts.map +1 -0
- package/dist/reporter/end-block.js +121 -0
- package/dist/reporter/end-block.js.map +1 -0
- package/dist/reporter/log-reporter.d.ts +10 -0
- package/dist/reporter/log-reporter.d.ts.map +1 -0
- package/dist/reporter/log-reporter.js +23 -0
- package/dist/reporter/log-reporter.js.map +1 -0
- package/dist/reporter/reporter-choice.d.ts +27 -0
- package/dist/reporter/reporter-choice.d.ts.map +1 -0
- package/dist/reporter/reporter-choice.js +12 -0
- package/dist/reporter/reporter-choice.js.map +1 -0
- package/dist/reporter/run-event.d.ts +90 -0
- package/dist/reporter/run-event.d.ts.map +1 -0
- package/dist/reporter/run-event.js +2 -0
- package/dist/reporter/run-event.js.map +1 -0
- package/dist/sharding/shard.d.ts +17 -0
- package/dist/sharding/shard.d.ts.map +1 -0
- package/dist/sharding/shard.js +2 -0
- package/dist/sharding/shard.js.map +1 -0
- package/dist/sharding/split-stories-files.d.ts +43 -0
- package/dist/sharding/split-stories-files.d.ts.map +1 -0
- package/dist/sharding/split-stories-files.js +70 -0
- package/dist/sharding/split-stories-files.js.map +1 -0
- package/dist/step-summary/step-summary.d.ts +45 -0
- package/dist/step-summary/step-summary.d.ts.map +1 -0
- package/dist/step-summary/step-summary.js +263 -0
- package/dist/step-summary/step-summary.js.map +1 -0
- package/dist/storybook/options-encoding.d.ts +115 -0
- package/dist/storybook/options-encoding.d.ts.map +1 -0
- package/dist/storybook/options-encoding.js +117 -0
- package/dist/storybook/options-encoding.js.map +1 -0
- package/dist/storybook/options-read.d.ts +146 -0
- package/dist/storybook/options-read.d.ts.map +1 -0
- package/dist/storybook/options-read.js +192 -0
- package/dist/storybook/options-read.js.map +1 -0
- package/dist/storybook/preview-script.d.ts +172 -0
- package/dist/storybook/preview-script.d.ts.map +1 -0
- package/dist/storybook/preview-script.js +804 -0
- package/dist/storybook/preview-script.js.map +1 -0
- package/dist/storybook/read-stories.d.ts +72 -0
- package/dist/storybook/read-stories.d.ts.map +1 -0
- package/dist/storybook/read-stories.js +317 -0
- package/dist/storybook/read-stories.js.map +1 -0
- package/dist/storybook/stories-matchers.d.ts +39 -0
- package/dist/storybook/stories-matchers.d.ts.map +1 -0
- package/dist/storybook/stories-matchers.js +149 -0
- package/dist/storybook/stories-matchers.js.map +1 -0
- package/dist/storybook/storybook-error.d.ts +24 -0
- package/dist/storybook/storybook-error.d.ts.map +1 -0
- package/dist/storybook/storybook-error.js +24 -0
- package/dist/storybook/storybook-error.js.map +1 -0
- package/dist/storybook/storybook-version.d.ts +62 -0
- package/dist/storybook/storybook-version.d.ts.map +1 -0
- package/dist/storybook/storybook-version.js +105 -0
- package/dist/storybook/storybook-version.js.map +1 -0
- package/dist/storybook/test-path.d.ts +19 -0
- package/dist/storybook/test-path.d.ts.map +1 -0
- package/dist/storybook/test-path.js +47 -0
- package/dist/storybook/test-path.js.map +1 -0
- package/dist/storybook/wait-hook.d.ts +64 -0
- package/dist/storybook/wait-hook.d.ts.map +1 -0
- package/dist/storybook/wait-hook.js +50 -0
- package/dist/storybook/wait-hook.js.map +1 -0
- package/dist/system-error/system-reason.d.ts +8 -0
- package/dist/system-error/system-reason.d.ts.map +1 -0
- package/dist/system-error/system-reason.js +15 -0
- package/dist/system-error/system-reason.js.map +1 -0
- package/dist/terminal-ui/answered-line.d.ts +21 -0
- package/dist/terminal-ui/answered-line.d.ts.map +1 -0
- package/dist/terminal-ui/answered-line.js +12 -0
- package/dist/terminal-ui/answered-line.js.map +1 -0
- package/dist/terminal-ui/brand-header.d.ts +21 -0
- package/dist/terminal-ui/brand-header.d.ts.map +1 -0
- package/dist/terminal-ui/brand-header.js +12 -0
- package/dist/terminal-ui/brand-header.js.map +1 -0
- package/dist/terminal-ui/checklist-question.d.ts +26 -0
- package/dist/terminal-ui/checklist-question.d.ts.map +1 -0
- package/dist/terminal-ui/checklist-question.js +62 -0
- package/dist/terminal-ui/checklist-question.js.map +1 -0
- package/dist/terminal-ui/choice-line.d.ts +29 -0
- package/dist/terminal-ui/choice-line.d.ts.map +1 -0
- package/dist/terminal-ui/choice-line.js +13 -0
- package/dist/terminal-ui/choice-line.js.map +1 -0
- package/dist/terminal-ui/coloured-text.d.ts +19 -0
- package/dist/terminal-ui/coloured-text.d.ts.map +1 -0
- package/dist/terminal-ui/coloured-text.js +16 -0
- package/dist/terminal-ui/coloured-text.js.map +1 -0
- package/dist/terminal-ui/confirm-question.d.ts +8 -0
- package/dist/terminal-ui/confirm-question.d.ts.map +1 -0
- package/dist/terminal-ui/confirm-question.js +44 -0
- package/dist/terminal-ui/confirm-question.js.map +1 -0
- package/dist/terminal-ui/init-screen.d.ts +23 -0
- package/dist/terminal-ui/init-screen.d.ts.map +1 -0
- package/dist/terminal-ui/init-screen.js +74 -0
- package/dist/terminal-ui/init-screen.js.map +1 -0
- package/dist/terminal-ui/init-view-state.d.ts +294 -0
- package/dist/terminal-ui/init-view-state.d.ts.map +1 -0
- package/dist/terminal-ui/init-view-state.js +148 -0
- package/dist/terminal-ui/init-view-state.js.map +1 -0
- package/dist/terminal-ui/init-view.d.ts +70 -0
- package/dist/terminal-ui/init-view.d.ts.map +1 -0
- package/dist/terminal-ui/init-view.js +128 -0
- package/dist/terminal-ui/init-view.js.map +1 -0
- package/dist/terminal-ui/live-screen.d.ts +22 -0
- package/dist/terminal-ui/live-screen.d.ts.map +1 -0
- package/dist/terminal-ui/live-screen.js +41 -0
- package/dist/terminal-ui/live-screen.js.map +1 -0
- package/dist/terminal-ui/live-view-state.d.ts +64 -0
- package/dist/terminal-ui/live-view-state.d.ts.map +1 -0
- package/dist/terminal-ui/live-view-state.js +54 -0
- package/dist/terminal-ui/live-view-state.js.map +1 -0
- package/dist/terminal-ui/live-view.d.ts +37 -0
- package/dist/terminal-ui/live-view.d.ts.map +1 -0
- package/dist/terminal-ui/live-view.js +67 -0
- package/dist/terminal-ui/live-view.js.map +1 -0
- package/dist/terminal-ui/message-line.d.ts +31 -0
- package/dist/terminal-ui/message-line.d.ts.map +1 -0
- package/dist/terminal-ui/message-line.js +79 -0
- package/dist/terminal-ui/message-line.js.map +1 -0
- package/dist/terminal-ui/output-tail.d.ts +29 -0
- package/dist/terminal-ui/output-tail.d.ts.map +1 -0
- package/dist/terminal-ui/output-tail.js +52 -0
- package/dist/terminal-ui/output-tail.js.map +1 -0
- package/dist/terminal-ui/progress-bar.d.ts +47 -0
- package/dist/terminal-ui/progress-bar.d.ts.map +1 -0
- package/dist/terminal-ui/progress-bar.js +23 -0
- package/dist/terminal-ui/progress-bar.js.map +1 -0
- package/dist/terminal-ui/question-header.d.ts +23 -0
- package/dist/terminal-ui/question-header.d.ts.map +1 -0
- package/dist/terminal-ui/question-header.js +24 -0
- package/dist/terminal-ui/question-header.js.map +1 -0
- package/dist/terminal-ui/question.d.ts +85 -0
- package/dist/terminal-ui/question.d.ts.map +1 -0
- package/dist/terminal-ui/question.js +77 -0
- package/dist/terminal-ui/question.js.map +1 -0
- package/dist/terminal-ui/select-question.d.ts +19 -0
- package/dist/terminal-ui/select-question.d.ts.map +1 -0
- package/dist/terminal-ui/select-question.js +24 -0
- package/dist/terminal-ui/select-question.js.map +1 -0
- package/dist/terminal-ui/spinner.d.ts +26 -0
- package/dist/terminal-ui/spinner.d.ts.map +1 -0
- package/dist/terminal-ui/spinner.js +39 -0
- package/dist/terminal-ui/spinner.js.map +1 -0
- package/dist/terminal-ui/step-list.d.ts +36 -0
- package/dist/terminal-ui/step-list.d.ts.map +1 -0
- package/dist/terminal-ui/step-list.js +122 -0
- package/dist/terminal-ui/step-list.js.map +1 -0
- package/dist/terminal-ui/summary.d.ts +20 -0
- package/dist/terminal-ui/summary.d.ts.map +1 -0
- package/dist/terminal-ui/summary.js +96 -0
- package/dist/terminal-ui/summary.js.map +1 -0
- package/dist/terminal-ui/text-input.d.ts +65 -0
- package/dist/terminal-ui/text-input.d.ts.map +1 -0
- package/dist/terminal-ui/text-input.js +72 -0
- package/dist/terminal-ui/text-input.js.map +1 -0
- package/dist/terminal-ui/text-question.d.ts +18 -0
- package/dist/terminal-ui/text-question.d.ts.map +1 -0
- package/dist/terminal-ui/text-question.js +60 -0
- package/dist/terminal-ui/text-question.js.map +1 -0
- package/dist/terminal-ui/theme.d.ts +106 -0
- package/dist/terminal-ui/theme.d.ts.map +1 -0
- package/dist/terminal-ui/theme.js +97 -0
- package/dist/terminal-ui/theme.js.map +1 -0
- package/dist/terminal-ui/wrapped-lines.d.ts +15 -0
- package/dist/terminal-ui/wrapped-lines.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-lines.js +105 -0
- package/dist/terminal-ui/wrapped-lines.js.map +1 -0
- package/dist/terminal-ui/wrapped-segments.d.ts +27 -0
- package/dist/terminal-ui/wrapped-segments.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-segments.js +37 -0
- package/dist/terminal-ui/wrapped-segments.js.map +1 -0
- package/dist/terminal-ui/wrapped-text.d.ts +21 -0
- package/dist/terminal-ui/wrapped-text.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-text.js +11 -0
- package/dist/terminal-ui/wrapped-text.js.map +1 -0
- package/dist/visual-diff/diff-thread.d.ts +27 -0
- package/dist/visual-diff/diff-thread.d.ts.map +1 -0
- package/dist/visual-diff/diff-thread.js +233 -0
- package/dist/visual-diff/diff-thread.js.map +1 -0
- package/dist/visual-diff/visual-diff.d.ts +259 -0
- package/dist/visual-diff/visual-diff.d.ts.map +1 -0
- package/dist/visual-diff/visual-diff.js +317 -0
- package/dist/visual-diff/visual-diff.js.map +1 -0
- package/fallow-graph.json +1 -0
- package/package.json +61 -4
- package/skill/SKILL.md +92 -0
- package/skill/scripts/run.mjs +1532 -0
- package/README.md +0 -3
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import { optionsEncoderSource } from './options-encoding.js';
|
|
2
|
+
/**
|
|
3
|
+
* The non-enumerable global the adapter's page script keeps its state under, in every document of a page.
|
|
4
|
+
*/
|
|
5
|
+
export const stateGlobal = '__visualCheckStorybook';
|
|
6
|
+
/**
|
|
7
|
+
* The global Storybook's preview sets its channel as.
|
|
8
|
+
*/
|
|
9
|
+
const channelGlobal = '__STORYBOOK_ADDONS_CHANNEL__';
|
|
10
|
+
/**
|
|
11
|
+
* The global Storybook's preview sets itself as.
|
|
12
|
+
*/
|
|
13
|
+
const previewGlobal = '__STORYBOOK_PREVIEW__';
|
|
14
|
+
/**
|
|
15
|
+
* The global Storybook's preview keeps `storybook/test` under, in Storybook 9.1 and later.
|
|
16
|
+
*/
|
|
17
|
+
const testModuleGlobal = '__STORYBOOK_MODULE_TEST__';
|
|
18
|
+
/**
|
|
19
|
+
* The class Storybook puts on the body of the story's page while it shows its error display.
|
|
20
|
+
*/
|
|
21
|
+
const errorDisplayClass = 'sb-show-errordisplay';
|
|
22
|
+
/**
|
|
23
|
+
* Storybook's channel events that say something went wrong in the story, and what each makes of a finished story, in
|
|
24
|
+
* the order they're checked: the first rule with an event the page recorded wins, with the text of the first such
|
|
25
|
+
* event. The page records exactly these events. None carries a story ID, and none needs one: each capture loads one
|
|
26
|
+
* story in a fresh document, so every event in it belongs to that story.
|
|
27
|
+
*/
|
|
28
|
+
const errorRules = [
|
|
29
|
+
{
|
|
30
|
+
event: 'playFunctionThrewException',
|
|
31
|
+
payload: 'error',
|
|
32
|
+
outcome: 'play-threw',
|
|
33
|
+
message: (text) => withDetail("The story's play function threw", ' ', text, 'an error'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
event: 'unhandledErrorsWhilePlaying',
|
|
37
|
+
payload: 'errors',
|
|
38
|
+
outcome: 'play-threw',
|
|
39
|
+
message: (text) => withDetail("The story's play function left unhandled errors", ': ', text),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
event: 'storyThrewException',
|
|
43
|
+
payload: 'error',
|
|
44
|
+
outcome: 'errored',
|
|
45
|
+
message: (text) => withDetail('The story threw', ' ', text, 'an error'),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
event: 'storyErrored',
|
|
49
|
+
payload: 'display',
|
|
50
|
+
outcome: 'errored',
|
|
51
|
+
message: (text) => withDetail('Storybook showed its error display', ': ', text),
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* What each error event's payload is, by the event's name, for the page.
|
|
56
|
+
*/
|
|
57
|
+
const errorPayloads = Object.fromEntries(errorRules.map((rule) => [rule.event, rule.payload]));
|
|
58
|
+
/**
|
|
59
|
+
* How many error events the page keeps: the first ones.
|
|
60
|
+
*/
|
|
61
|
+
const keptErrors = 10;
|
|
62
|
+
/**
|
|
63
|
+
* How many characters the page keeps of each error event's description, and of each line of play's stack.
|
|
64
|
+
*/
|
|
65
|
+
const keptCharacters = 500;
|
|
66
|
+
/**
|
|
67
|
+
* How many frames of play's stack the page keeps: lines that start with `at `, leaving out the error's message.
|
|
68
|
+
*/
|
|
69
|
+
const keptStackLines = 5;
|
|
70
|
+
/**
|
|
71
|
+
* The error events that come from the story's `play` function, whose stack the page keeps.
|
|
72
|
+
*/
|
|
73
|
+
const playErrorEvents = errorRules.filter((rule) => rule.outcome === 'play-threw').map((rule) => rule.event);
|
|
74
|
+
/**
|
|
75
|
+
* Matches the text of the two stylesheets Storybook 9.1 and 10 append to the document on the test path while a story
|
|
76
|
+
* completes: the one that disables animations for a moment, and the one that pauses them for good. Both are a single
|
|
77
|
+
* rule for `*, *:before, *:after`, matched in full so a stylesheet of the page's own never matches. It checks the text,
|
|
78
|
+
* not the version: Storybook 11 adds no stylesheet, so nothing matches there.
|
|
79
|
+
*/
|
|
80
|
+
const pauseSheetPattern = new RegExp([
|
|
81
|
+
String.raw `^\s*\*,\s*\*:before,\s*\*:after\s*\{\s*(?:`,
|
|
82
|
+
String.raw `animation:\s*none\s*!important;`,
|
|
83
|
+
String.raw `|animation-delay:\s*0s\s*!important;`,
|
|
84
|
+
String.raw `\s*animation-direction:\s*(?:reverse|normal)\s*!important;`,
|
|
85
|
+
String.raw `\s*animation-play-state:\s*paused\s*!important;`,
|
|
86
|
+
String.raw `\s*transition:\s*none\s*!important;`,
|
|
87
|
+
String.raw `)\s*\}\s*$`,
|
|
88
|
+
].join(''));
|
|
89
|
+
/**
|
|
90
|
+
* The script that runs at the start of every document of a page, as part of the page script. Its one style change is
|
|
91
|
+
* to empty the pause stylesheets Storybook 9.1 and 10 add on the test path, and it reads the document only once the
|
|
92
|
+
* story finished. It does only this, keeping its state under one non-enumerable, frozen global:
|
|
93
|
+
*
|
|
94
|
+
* - hooks Storybook's channel when the preview sets `__STORYBOOK_ADDONS_CHANNEL__`, to note each `storyFinished` with
|
|
95
|
+
* its story ID and status, each story's last render step, and when its `completing` and `completed` steps came;
|
|
96
|
+
* - records Storybook's error events in the order they come: the first 10, each as `event` and one line of `text` of
|
|
97
|
+
* up to 500 characters. An error is described as `name: message`, or whichever of the two isn't empty, what the
|
|
98
|
+
* error display shows as `title: description` the same way, and a list of errors joined by `; `. Any other payload
|
|
99
|
+
* is described as text. An event from the story's `play` function also keeps `stack`: the error's, or the first
|
|
100
|
+
* error's of a list, as up to its first 5 frames, the lines after its first that start with `at ` once trimmed,
|
|
101
|
+
* each trimmed and cut to 500 characters, so a message over several lines, such as an `expect` diff, is left out;
|
|
102
|
+
* none when it isn't text;
|
|
103
|
+
* - hooks Storybook's preview when it sets `__STORYBOOK_PREVIEW__`, to keep it and note that it started, and calls its
|
|
104
|
+
* `ready()` just after, to note when it becomes ready, or why it failed, on one line of up to 500 characters as an
|
|
105
|
+
* error is described. A preview that replaces another is waited for on its own;
|
|
106
|
+
* - wraps `Node.prototype.appendChild` to empty the text of a `<style>` element that matches Storybook 9.1 and 10's
|
|
107
|
+
* pause or disable stylesheet just before it's appended, so the story keeps running as in plain Storybook. It leaves
|
|
108
|
+
* every other node and style alone, and passes `this`, the arguments, the result and any error of the original
|
|
109
|
+
* through. Where the page has no `Node` or `HTMLStyleElement` it does nothing;
|
|
110
|
+
* - gives `waitForStory`, which the story wait expression calls;
|
|
111
|
+
* - gives `readOptions`, which the options read expression calls with stories files and a time limit. It waits for
|
|
112
|
+
* the latest preview to become ready or fail, then calls its `loadStory` for every story of every file: all files at
|
|
113
|
+
* once, each within its own time limit, counted from then. A file that fails or runs out of time never stops
|
|
114
|
+
* another. It answers with each story's `parameters.visualCheck`, encoded by `optionsEncoderSource` so it crosses
|
|
115
|
+
* as JSON, and the own enumerable string keys of its `storyGlobals`, the globals it or its meta pins, none when they
|
|
116
|
+
* can't be read; or with why each other file didn't load, on one line. It answers too with the globals the
|
|
117
|
+
* Storybook declares: the string names its story store's `userGlobals.allowedGlobalNames` holds, or `null` when
|
|
118
|
+
* that can't be read or isn't a `Set`. It never calls `extract()`, never loads a docs entry, and keeps nothing
|
|
119
|
+
* between reads;
|
|
120
|
+
* - gives `runWait`, which the wait hook expression calls with a story ID and a time limit. It takes the latest
|
|
121
|
+
* preview's `currentRender`, and answers `no-render` unless that's a render of the story with its `story` and a
|
|
122
|
+
* `storyContext()`. When the story's merged `parameters.visualCheck.wait` is a function, it calls it once with a
|
|
123
|
+
* context of only: what the render's `storyContext()` gives, then the render's `viewMode` and `canvasElement`, then
|
|
124
|
+
* `canvas` as `within(canvasElement)` when Storybook's `__STORYBOOK_MODULE_TEST__` has `within`, then `userEvent`
|
|
125
|
+
* when it has `userEvent.setup` and the page has `navigator.clipboard`, as Storybook does for `play`. `userEvent` is
|
|
126
|
+
* set up by `userEvent.setup()` when the hook first reads it, once, and the page's own `navigator.clipboard`, which
|
|
127
|
+
* `setup()` stubs, is put back right after; a `setup()` that throws throws inside the hook. Unlike `play`, the hook
|
|
128
|
+
* gets no `loaded`, `step`, `mount` or `abortSignal`. It waits until the hook settles or the time limit passes. A
|
|
129
|
+
* throw or rejection of the hook, or of a thenable it gives, answers `threw`. A failure to read the hook or build
|
|
130
|
+
* its context answers `context-failed`, without calling the hook. Each is described on one line of up to 500
|
|
131
|
+
* characters, as an error is. It never throws or rejects, and a rejection after the time limit is handled too.
|
|
132
|
+
*
|
|
133
|
+
* It keeps the browser's own `setTimeout`, `clearTimeout` and `performance.now`, so a story that fakes or replaces
|
|
134
|
+
* timers stalls none of the story wait, the options read and the wait hook. A value the page sets as the channel or
|
|
135
|
+
* the preview never makes Storybook's own assignment throw, and the page reads back what it set.
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export const storybookPageScript = `(() => {
|
|
140
|
+
if (Object.prototype.hasOwnProperty.call(globalThis, '${stateGlobal}')) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const setTimer = globalThis.setTimeout.bind(globalThis)
|
|
145
|
+
const clearTimer = globalThis.clearTimeout.bind(globalThis)
|
|
146
|
+
const now = performance.now.bind(performance)
|
|
147
|
+
const errorPayloads = ${JSON.stringify(errorPayloads)}
|
|
148
|
+
const playErrorEvents = ${JSON.stringify(playErrorEvents)}
|
|
149
|
+
const finished = new Map()
|
|
150
|
+
const lastSteps = new Map()
|
|
151
|
+
const completingTimes = new Map()
|
|
152
|
+
const completedTimes = new Map()
|
|
153
|
+
const errors = []
|
|
154
|
+
const waiters = new Set()
|
|
155
|
+
const previewWaiters = new Set()
|
|
156
|
+
const channels = new WeakSet()
|
|
157
|
+
const previews = new WeakMap()
|
|
158
|
+
let latestPreview
|
|
159
|
+
|
|
160
|
+
const readSafely = (read) => {
|
|
161
|
+
try {
|
|
162
|
+
return read()
|
|
163
|
+
} catch {
|
|
164
|
+
return undefined
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Describing error payloads: one line of plain fields, never throwing.
|
|
169
|
+
|
|
170
|
+
const textOf = (value) => {
|
|
171
|
+
try {
|
|
172
|
+
return String(value)
|
|
173
|
+
} catch {
|
|
174
|
+
return '[unprintable]'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const describePair = (value, label, detail) => {
|
|
179
|
+
if (typeof value !== 'object' || value === null) {
|
|
180
|
+
return textOf(value)
|
|
181
|
+
}
|
|
182
|
+
const labelText = value[label]
|
|
183
|
+
const detailText = value[detail]
|
|
184
|
+
if (typeof labelText !== 'string' && typeof detailText !== 'string') {
|
|
185
|
+
return textOf(value)
|
|
186
|
+
}
|
|
187
|
+
return [labelText, detailText].filter((text) => typeof text === 'string' && text !== '').join(': ')
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const describe = (event, value) => {
|
|
191
|
+
const payload = errorPayloads[event]
|
|
192
|
+
if (payload === 'display') {
|
|
193
|
+
return describePair(value, 'title', 'description')
|
|
194
|
+
}
|
|
195
|
+
if (payload === 'errors' && Array.isArray(value)) {
|
|
196
|
+
return value
|
|
197
|
+
.map((item) => describePair(item, 'name', 'message'))
|
|
198
|
+
.filter((text) => text !== '')
|
|
199
|
+
.join('; ')
|
|
200
|
+
}
|
|
201
|
+
return describePair(value, 'name', 'message')
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const oneLine = (text) => text.replace(/\\s+/g, ' ').trim().slice(0, ${keptCharacters})
|
|
205
|
+
|
|
206
|
+
const describeError = (value) => {
|
|
207
|
+
try {
|
|
208
|
+
return oneLine(describePair(value, 'name', 'message'))
|
|
209
|
+
} catch {
|
|
210
|
+
return oneLine(textOf(value))
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const stackOf = (event, value) => {
|
|
215
|
+
try {
|
|
216
|
+
const error = errorPayloads[event] === 'errors' ? (Array.isArray(value) ? value[0] : undefined) : value
|
|
217
|
+
const stack = typeof error === 'object' && error !== null ? error.stack : undefined
|
|
218
|
+
if (typeof stack !== 'string') {
|
|
219
|
+
return []
|
|
220
|
+
}
|
|
221
|
+
return stack
|
|
222
|
+
.split('\\n')
|
|
223
|
+
.slice(1)
|
|
224
|
+
.map((line) => line.trim())
|
|
225
|
+
.filter((line) => line.startsWith('at '))
|
|
226
|
+
.slice(0, ${keptStackLines})
|
|
227
|
+
.map((line) => line.slice(0, ${keptCharacters}))
|
|
228
|
+
} catch {
|
|
229
|
+
return []
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Recording what Storybook sends on its channel.
|
|
234
|
+
|
|
235
|
+
const recordError = (event, value) => {
|
|
236
|
+
try {
|
|
237
|
+
if (errors.length >= ${keptErrors}) {
|
|
238
|
+
return
|
|
239
|
+
}
|
|
240
|
+
let text
|
|
241
|
+
try {
|
|
242
|
+
text = describe(event, value)
|
|
243
|
+
} catch {
|
|
244
|
+
text = textOf(value)
|
|
245
|
+
}
|
|
246
|
+
const recorded = { event, text: oneLine(text) }
|
|
247
|
+
if (playErrorEvents.includes(event)) {
|
|
248
|
+
recorded.stack = stackOf(event, value)
|
|
249
|
+
}
|
|
250
|
+
errors.push(recorded)
|
|
251
|
+
} catch {}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const noteStep = (change) => {
|
|
255
|
+
try {
|
|
256
|
+
if (typeof change !== 'object' || change === null) {
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
const storyId = change.storyId
|
|
260
|
+
const step = change.newPhase
|
|
261
|
+
if (typeof storyId !== 'string' || typeof step !== 'string') {
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
lastSteps.set(storyId, step)
|
|
265
|
+
if (step === 'completing') {
|
|
266
|
+
completingTimes.set(storyId, now())
|
|
267
|
+
completedTimes.delete(storyId)
|
|
268
|
+
}
|
|
269
|
+
if (step === 'completed') {
|
|
270
|
+
completedTimes.set(storyId, now())
|
|
271
|
+
}
|
|
272
|
+
} catch {}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const finish = (payload) => {
|
|
276
|
+
try {
|
|
277
|
+
if (typeof payload !== 'object' || payload === null || typeof payload.storyId !== 'string') {
|
|
278
|
+
return
|
|
279
|
+
}
|
|
280
|
+
finished.set(payload.storyId, typeof payload.status === 'string' ? payload.status : 'unknown')
|
|
281
|
+
for (const waiter of [...waiters]) {
|
|
282
|
+
waiter(payload.storyId)
|
|
283
|
+
}
|
|
284
|
+
} catch {}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Hooking the globals Storybook's preview sets, without ever throwing into its assignments.
|
|
288
|
+
|
|
289
|
+
const listen = (channel) => {
|
|
290
|
+
try {
|
|
291
|
+
if (typeof channel !== 'object' || channel === null || channels.has(channel) || typeof channel.on !== 'function') {
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
channels.add(channel)
|
|
295
|
+
channel.on('storyFinished', finish)
|
|
296
|
+
channel.on('storyRenderPhaseChanged', noteStep)
|
|
297
|
+
for (const event of Object.keys(errorPayloads)) {
|
|
298
|
+
channel.on(event, (value) => recordError(event, value))
|
|
299
|
+
}
|
|
300
|
+
} catch {}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const notePreview = () => {
|
|
304
|
+
try {
|
|
305
|
+
for (const waiter of [...previewWaiters]) {
|
|
306
|
+
waiter()
|
|
307
|
+
}
|
|
308
|
+
} catch {}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const trackPreview = (preview) => {
|
|
312
|
+
if ((typeof preview !== 'object' && typeof preview !== 'function') || preview === null) {
|
|
313
|
+
return
|
|
314
|
+
}
|
|
315
|
+
const known = previews.get(preview)
|
|
316
|
+
if (known !== undefined) {
|
|
317
|
+
latestPreview = known
|
|
318
|
+
return
|
|
319
|
+
}
|
|
320
|
+
const state = { preview, ready: true, failure: undefined }
|
|
321
|
+
previews.set(preview, state)
|
|
322
|
+
latestPreview = state
|
|
323
|
+
if (typeof preview.ready !== 'function') {
|
|
324
|
+
return
|
|
325
|
+
}
|
|
326
|
+
state.ready = false
|
|
327
|
+
Promise.resolve()
|
|
328
|
+
.then(() => preview.ready())
|
|
329
|
+
.then(
|
|
330
|
+
() => {
|
|
331
|
+
state.ready = true
|
|
332
|
+
},
|
|
333
|
+
(error) => {
|
|
334
|
+
state.failure = describeError(error)
|
|
335
|
+
},
|
|
336
|
+
)
|
|
337
|
+
.then(notePreview)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const watchPreview = (preview) => {
|
|
341
|
+
try {
|
|
342
|
+
trackPreview(preview)
|
|
343
|
+
} catch {}
|
|
344
|
+
notePreview()
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const hook = (name, watch) => {
|
|
348
|
+
let current = globalThis[name]
|
|
349
|
+
watch(current)
|
|
350
|
+
try {
|
|
351
|
+
Object.defineProperty(globalThis, name, {
|
|
352
|
+
configurable: true,
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: () => current,
|
|
355
|
+
set: (value) => {
|
|
356
|
+
current = value
|
|
357
|
+
watch(value)
|
|
358
|
+
},
|
|
359
|
+
})
|
|
360
|
+
} catch {}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
hook('${channelGlobal}', listen)
|
|
364
|
+
hook('${previewGlobal}', watchPreview)
|
|
365
|
+
|
|
366
|
+
// Emptying the pause stylesheets Storybook 9.1 and 10 add on the test path, by what they say.
|
|
367
|
+
|
|
368
|
+
if (typeof Node === 'function' && typeof HTMLStyleElement === 'function') {
|
|
369
|
+
const pauseSheet = ${String(pauseSheetPattern)}
|
|
370
|
+
const apply = Reflect.apply
|
|
371
|
+
const StyleElement = HTMLStyleElement
|
|
372
|
+
|
|
373
|
+
try {
|
|
374
|
+
const originalAppendChild = Node.prototype.appendChild
|
|
375
|
+
|
|
376
|
+
Node.prototype.appendChild = function appendChild(node) {
|
|
377
|
+
try {
|
|
378
|
+
if (node instanceof StyleElement && pauseSheet.test(node.textContent)) {
|
|
379
|
+
node.textContent = ''
|
|
380
|
+
}
|
|
381
|
+
} catch {}
|
|
382
|
+
return apply(originalAppendChild, this, arguments)
|
|
383
|
+
}
|
|
384
|
+
} catch {}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// The wait: the page's answer once the story finished, or where it was when the time ran out.
|
|
388
|
+
|
|
389
|
+
const showsErrorDisplay = () => {
|
|
390
|
+
try {
|
|
391
|
+
const body = document.body
|
|
392
|
+
return typeof body === 'object' && body !== null && body.classList.contains('${errorDisplayClass}') === true
|
|
393
|
+
} catch {
|
|
394
|
+
return false
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const finishedAnswer = (storyId) => ({
|
|
399
|
+
outcome: 'finished',
|
|
400
|
+
status: finished.get(storyId),
|
|
401
|
+
errorDisplay: showsErrorDisplay(),
|
|
402
|
+
errors: errors.map((error) => ({ ...error })),
|
|
403
|
+
completingMs:
|
|
404
|
+
completingTimes.has(storyId) && completedTimes.has(storyId)
|
|
405
|
+
? completedTimes.get(storyId) - completingTimes.get(storyId)
|
|
406
|
+
: null,
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
const waitingStep = () => {
|
|
410
|
+
if (latestPreview === undefined) {
|
|
411
|
+
return 'preview-start'
|
|
412
|
+
}
|
|
413
|
+
return latestPreview.ready ? 'story' : 'preview-ready'
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const waitForStory = (storyId, timeoutMs) => new Promise((resolve) => {
|
|
417
|
+
if (finished.has(storyId)) {
|
|
418
|
+
resolve(finishedAnswer(storyId))
|
|
419
|
+
return
|
|
420
|
+
}
|
|
421
|
+
const waiter = (finishedId) => {
|
|
422
|
+
if (finishedId === storyId) {
|
|
423
|
+
waiters.delete(waiter)
|
|
424
|
+
clearTimer(timer)
|
|
425
|
+
resolve(finishedAnswer(storyId))
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const timer = setTimer(() => {
|
|
429
|
+
waiters.delete(waiter)
|
|
430
|
+
resolve({
|
|
431
|
+
outcome: 'timed-out',
|
|
432
|
+
step: waitingStep(),
|
|
433
|
+
lastRenderStep: lastSteps.has(storyId) ? lastSteps.get(storyId) : null,
|
|
434
|
+
})
|
|
435
|
+
}, timeoutMs)
|
|
436
|
+
waiters.add(waiter)
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
// The options read: each story's options, through the latest preview's loadStory, encoded so they cross as JSON, with
|
|
440
|
+
// the globals the Storybook declares and the globals each story pins.
|
|
441
|
+
|
|
442
|
+
const encodeValue = ${optionsEncoderSource}
|
|
443
|
+
|
|
444
|
+
const encodeOptions = (story) => {
|
|
445
|
+
let options
|
|
446
|
+
try {
|
|
447
|
+
options = story?.parameters?.visualCheck
|
|
448
|
+
} catch {
|
|
449
|
+
return { kind: 'instance', name: 'Unreadable' }
|
|
450
|
+
}
|
|
451
|
+
return encodeValue(options)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const keysOf = (value) => (typeof value === 'object' && value !== null ? Object.keys(value) : undefined)
|
|
455
|
+
|
|
456
|
+
// Set.prototype.values throws for anything but a Set, so a look-alike never counts as one.
|
|
457
|
+
const allowedNamesOf = (store) =>
|
|
458
|
+
readSafely(() =>
|
|
459
|
+
Array.from(Set.prototype.values.call(store.userGlobals.allowedGlobalNames)).filter(
|
|
460
|
+
(name) => typeof name === 'string',
|
|
461
|
+
),
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
const declaredGlobalsOf = (preview) => allowedNamesOf(readSafely(() => preview.storyStoreValue)) ?? null
|
|
465
|
+
|
|
466
|
+
const pinnedGlobalsOf = (story) => readSafely(() => keysOf(story.storyGlobals)) ?? []
|
|
467
|
+
|
|
468
|
+
const settledAnswer = () => {
|
|
469
|
+
const latest = latestPreview
|
|
470
|
+
if (latest !== undefined && latest.failure !== undefined) {
|
|
471
|
+
return { outcome: 'preview-failed', message: latest.failure }
|
|
472
|
+
}
|
|
473
|
+
if (latest !== undefined && latest.ready) {
|
|
474
|
+
return { outcome: 'ready', preview: latest.preview }
|
|
475
|
+
}
|
|
476
|
+
return undefined
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const settledPreview = (timeoutMs) => new Promise((resolve) => {
|
|
480
|
+
const settle = (answer) => {
|
|
481
|
+
previewWaiters.delete(waiter)
|
|
482
|
+
clearTimer(timer)
|
|
483
|
+
resolve(answer)
|
|
484
|
+
}
|
|
485
|
+
const waiter = () => {
|
|
486
|
+
const answer = settledAnswer()
|
|
487
|
+
if (answer !== undefined) {
|
|
488
|
+
settle(answer)
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const timer = setTimer(() => {
|
|
492
|
+
settle({ outcome: 'timed-out', step: latestPreview === undefined ? 'preview-start' : 'preview-ready' })
|
|
493
|
+
}, timeoutMs)
|
|
494
|
+
previewWaiters.add(waiter)
|
|
495
|
+
waiter()
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
const canLoadStories = (preview) => {
|
|
499
|
+
try {
|
|
500
|
+
return typeof preview.loadStory === 'function'
|
|
501
|
+
} catch {
|
|
502
|
+
return false
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const loadStories = (preview, storyIds) =>
|
|
507
|
+
Promise.all(
|
|
508
|
+
storyIds.map(
|
|
509
|
+
(storyId) =>
|
|
510
|
+
new Promise((resolve) => {
|
|
511
|
+
resolve(preview.loadStory({ storyId }))
|
|
512
|
+
}),
|
|
513
|
+
),
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
const readFile = (preview, file, timeoutMs) => new Promise((resolve) => {
|
|
517
|
+
const { importPath, storyIds } = file
|
|
518
|
+
const timer = setTimer(() => {
|
|
519
|
+
resolve({ importPath, outcome: 'timed-out' })
|
|
520
|
+
}, timeoutMs)
|
|
521
|
+
loadStories(preview, storyIds).then(
|
|
522
|
+
(stories) => {
|
|
523
|
+
clearTimer(timer)
|
|
524
|
+
resolve({
|
|
525
|
+
importPath,
|
|
526
|
+
outcome: 'loaded',
|
|
527
|
+
stories: storyIds.map((id, index) => ({
|
|
528
|
+
id,
|
|
529
|
+
options: encodeOptions(stories[index]),
|
|
530
|
+
pinnedGlobals: pinnedGlobalsOf(stories[index]),
|
|
531
|
+
})),
|
|
532
|
+
})
|
|
533
|
+
},
|
|
534
|
+
(error) => {
|
|
535
|
+
clearTimer(timer)
|
|
536
|
+
resolve({ importPath, outcome: 'failed', message: describeError(error) })
|
|
537
|
+
},
|
|
538
|
+
)
|
|
539
|
+
})
|
|
540
|
+
|
|
541
|
+
const readOptions = async (files, timeoutMs) => {
|
|
542
|
+
const settled = await settledPreview(timeoutMs)
|
|
543
|
+
if (settled.outcome !== 'ready') {
|
|
544
|
+
return settled
|
|
545
|
+
}
|
|
546
|
+
if (!canLoadStories(settled.preview)) {
|
|
547
|
+
return { outcome: 'unsupported' }
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
outcome: 'read',
|
|
551
|
+
declaredGlobals: declaredGlobalsOf(settled.preview),
|
|
552
|
+
files: await Promise.all(files.map((file) => readFile(settled.preview, file, timeoutMs))),
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// The wait hook: the story's parameters.visualCheck.wait, run on the render on screen with the story's context.
|
|
557
|
+
|
|
558
|
+
const renderOf = (storyId) => {
|
|
559
|
+
try {
|
|
560
|
+
const render = latestPreview?.preview.currentRender
|
|
561
|
+
if (typeof render !== 'object' || render === null || render.id !== storyId) {
|
|
562
|
+
return undefined
|
|
563
|
+
}
|
|
564
|
+
const story = render.story
|
|
565
|
+
if (typeof story !== 'object' || story === null || typeof render.storyContext !== 'function') {
|
|
566
|
+
return undefined
|
|
567
|
+
}
|
|
568
|
+
return render
|
|
569
|
+
} catch {
|
|
570
|
+
return undefined
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const runHook = (hook, context, timeoutMs) => new Promise((resolve) => {
|
|
575
|
+
const timer = setTimer(() => {
|
|
576
|
+
resolve({ outcome: 'timed-out' })
|
|
577
|
+
}, timeoutMs)
|
|
578
|
+
const settle = (answer) => {
|
|
579
|
+
clearTimer(timer)
|
|
580
|
+
resolve(answer)
|
|
581
|
+
}
|
|
582
|
+
new Promise((resolveHook) => {
|
|
583
|
+
resolveHook(hook(context))
|
|
584
|
+
}).then(
|
|
585
|
+
() => settle({ outcome: 'done' }),
|
|
586
|
+
(error) => settle({ outcome: 'threw', text: describeError(error) }),
|
|
587
|
+
)
|
|
588
|
+
})
|
|
589
|
+
|
|
590
|
+
const testHelpers = () => {
|
|
591
|
+
const testModule = readSafely(() => globalThis.${testModuleGlobal})
|
|
592
|
+
const within = readSafely(() => testModule.within)
|
|
593
|
+
const userEvent = readSafely(() => testModule.userEvent)
|
|
594
|
+
return {
|
|
595
|
+
within: typeof within === 'function' ? within : undefined,
|
|
596
|
+
userEvent: readSafely(() => typeof userEvent.setup === 'function') === true ? userEvent : undefined,
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// userEvent.setup() stubs navigator.clipboard. As Storybook does for play, the page sets userEvent up only where the
|
|
601
|
+
// page has a clipboard, and puts the real one back right after.
|
|
602
|
+
const setUpUser = (userEvent, pageNavigator, clipboard) => {
|
|
603
|
+
try {
|
|
604
|
+
return userEvent.setup()
|
|
605
|
+
} finally {
|
|
606
|
+
try {
|
|
607
|
+
Object.defineProperty(pageNavigator, 'clipboard', { configurable: true, get: () => clipboard })
|
|
608
|
+
} catch {}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const defineUserEvent = (context, userEvent) => {
|
|
613
|
+
const pageNavigator = readSafely(() => globalThis.navigator)
|
|
614
|
+
const clipboard = readSafely(() => pageNavigator.clipboard)
|
|
615
|
+
if (!clipboard) {
|
|
616
|
+
return
|
|
617
|
+
}
|
|
618
|
+
Object.defineProperty(context, 'userEvent', {
|
|
619
|
+
configurable: true,
|
|
620
|
+
enumerable: true,
|
|
621
|
+
get: () => {
|
|
622
|
+
const user = setUpUser(userEvent, pageNavigator, clipboard)
|
|
623
|
+
Object.defineProperty(context, 'userEvent', { configurable: true, enumerable: true, writable: true, value: user })
|
|
624
|
+
return user
|
|
625
|
+
},
|
|
626
|
+
})
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const contextOf = (render) => {
|
|
630
|
+
const context = { ...render.storyContext(), viewMode: render.viewMode, canvasElement: render.canvasElement }
|
|
631
|
+
const { within, userEvent } = testHelpers()
|
|
632
|
+
if (within !== undefined) {
|
|
633
|
+
context.canvas = within(context.canvasElement)
|
|
634
|
+
}
|
|
635
|
+
if (userEvent !== undefined) {
|
|
636
|
+
defineUserEvent(context, userEvent)
|
|
637
|
+
}
|
|
638
|
+
return context
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
const runWait = async (storyId, timeoutMs) => {
|
|
642
|
+
const render = renderOf(storyId)
|
|
643
|
+
if (render === undefined) {
|
|
644
|
+
return { outcome: 'no-render' }
|
|
645
|
+
}
|
|
646
|
+
let hook
|
|
647
|
+
let context
|
|
648
|
+
try {
|
|
649
|
+
hook = render.story.parameters?.visualCheck?.wait
|
|
650
|
+
if (typeof hook !== 'function') {
|
|
651
|
+
return { outcome: 'none' }
|
|
652
|
+
}
|
|
653
|
+
context = contextOf(render)
|
|
654
|
+
} catch (error) {
|
|
655
|
+
return { outcome: 'context-failed', text: describeError(error) }
|
|
656
|
+
}
|
|
657
|
+
return await runHook(hook, context, timeoutMs)
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
Object.defineProperty(globalThis, '${stateGlobal}', { value: Object.freeze({ waitForStory, readOptions, runWait }) })
|
|
661
|
+
})()`;
|
|
662
|
+
/**
|
|
663
|
+
* The source of a function, evaluated in the page, that says whether an animation is one Storybook 11 parked on its
|
|
664
|
+
* first frame. On the test path, after `play`, Storybook 11 takes every CSS animation and transition on a
|
|
665
|
+
* `DocumentTimeline`, in the document and in every open shadow root. It calls `finish()` on a finite one, and
|
|
666
|
+
* `pause()` then `currentTime = 0` on an infinite one or on a finite one whose `finish()` throws. It does the same to
|
|
667
|
+
* every one that starts later, until the story is cleaned up, and leaves script animations (`element.animate()`)
|
|
668
|
+
* running.
|
|
669
|
+
*
|
|
670
|
+
* So the function is true for a CSS animation or transition on a `DocumentTimeline`, paused at 0. Each kind is
|
|
671
|
+
* checked only where the page has its class. It matches by behaviour, not by version: on 9.1 and 10 nothing is
|
|
672
|
+
* parked, and a CSS animation the page itself paused at 0 matches too, which pinning leaves looking the same. It never
|
|
673
|
+
* throws: an animation it can't read isn't parked.
|
|
674
|
+
*
|
|
675
|
+
* @public
|
|
676
|
+
*/
|
|
677
|
+
export const parkedByStorybookSource = `(animation) => {
|
|
678
|
+
try {
|
|
679
|
+
const cssAnimation = typeof CSSAnimation === 'function' && animation instanceof CSSAnimation
|
|
680
|
+
const cssTransition = typeof CSSTransition === 'function' && animation instanceof CSSTransition
|
|
681
|
+
return (
|
|
682
|
+
(cssAnimation || cssTransition) &&
|
|
683
|
+
typeof DocumentTimeline === 'function' &&
|
|
684
|
+
animation.timeline instanceof DocumentTimeline &&
|
|
685
|
+
animation.playState === 'paused' &&
|
|
686
|
+
animation.currentTime === 0
|
|
687
|
+
)
|
|
688
|
+
} catch {
|
|
689
|
+
return false
|
|
690
|
+
}
|
|
691
|
+
}`;
|
|
692
|
+
/**
|
|
693
|
+
* Builds the expression that waits in the page until Storybook reports this story finished, or `timeoutMs` passes,
|
|
694
|
+
* rounded up to whole ms. Its value is the page's answer, which `readStoryWait` reads. A `storyFinished` for another
|
|
695
|
+
* story doesn't count, and one that came before the wait started does.
|
|
696
|
+
*
|
|
697
|
+
* @public
|
|
698
|
+
*/
|
|
699
|
+
export function storyWaitExpression(storyId, timeoutMs) {
|
|
700
|
+
return stateCallExpression('waitForStory', [storyId], timeoutMs);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Builds the expression that calls one of the functions the adapter's script keeps in the page, with `args`, each
|
|
704
|
+
* embedded as JSON, and then `timeoutMs`, rounded up to whole ms. Its value is the function's answer, or
|
|
705
|
+
* `{ outcome: 'script-missing' }` when the adapter's script hadn't run in the page.
|
|
706
|
+
*/
|
|
707
|
+
export function stateCallExpression(method, args, timeoutMs) {
|
|
708
|
+
const limit = Math.max(0, Math.ceil(timeoutMs));
|
|
709
|
+
const embedded = [...args.map((arg) => JSON.stringify(arg)), limit].join(', ');
|
|
710
|
+
return `(async () => {
|
|
711
|
+
const state = globalThis.${stateGlobal}
|
|
712
|
+
return state === undefined ? { outcome: 'script-missing' } : state.${method}(${embedded})
|
|
713
|
+
})()`;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Joins the lead of a message and the detail, ending with one period. Without detail, it ends with `fallback`, if any.
|
|
717
|
+
*/
|
|
718
|
+
export function withDetail(lead, separator, detail, fallback) {
|
|
719
|
+
if (detail === '') {
|
|
720
|
+
return fallback === undefined ? `${lead}.` : `${lead} ${fallback}.`;
|
|
721
|
+
}
|
|
722
|
+
return `${lead}${separator}${detail.endsWith('.') ? detail : `${detail}.`}`;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Says what a finished story comes to: an error event, the error display or a status other than success makes it
|
|
726
|
+
* broken, in that order.
|
|
727
|
+
*/
|
|
728
|
+
function classifyFinished(answer) {
|
|
729
|
+
for (const rule of errorRules) {
|
|
730
|
+
const error = answer.errors.find((recorded) => recorded.event === rule.event);
|
|
731
|
+
if (error === undefined) {
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
if (rule.outcome === 'play-threw') {
|
|
735
|
+
return {
|
|
736
|
+
outcome: 'play-threw',
|
|
737
|
+
message: rule.message(error.text),
|
|
738
|
+
errorText: error.text,
|
|
739
|
+
stack: error.stack ?? [],
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
return { outcome: rule.outcome, message: rule.message(error.text) };
|
|
743
|
+
}
|
|
744
|
+
if (answer.errorDisplay) {
|
|
745
|
+
return { outcome: 'errored', message: 'Storybook showed its error display.' };
|
|
746
|
+
}
|
|
747
|
+
if (answer.status !== 'success') {
|
|
748
|
+
return {
|
|
749
|
+
outcome: 'errored',
|
|
750
|
+
message: `Storybook reported the story finished with status ${JSON.stringify(answer.status)}, as it does when a loader, beforeEach or the render throws, or when a check such as accessibility fails.`,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
return { outcome: 'finished', completingMs: answer.completingMs ?? undefined };
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Whether a value is a non-null object.
|
|
757
|
+
*/
|
|
758
|
+
function isRecord(value) {
|
|
759
|
+
return typeof value === 'object' && value !== null;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Whether a value is an error event as the page records it.
|
|
763
|
+
*/
|
|
764
|
+
function isRecordedError(value) {
|
|
765
|
+
return (isRecord(value) &&
|
|
766
|
+
errorRules.some((rule) => rule.event === value.event) &&
|
|
767
|
+
typeof value.text === 'string' &&
|
|
768
|
+
(value.stack === undefined ||
|
|
769
|
+
(Array.isArray(value.stack) && value.stack.every((line) => typeof line === 'string'))));
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Whether a value is a step the wait can time out in.
|
|
773
|
+
*/
|
|
774
|
+
function isWaitStep(value) {
|
|
775
|
+
return value === 'preview-start' || value === 'preview-ready' || value === 'story';
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Reads the value the story wait expression gave, and says what it comes to. Throws, quoting the value, when it's not
|
|
779
|
+
* an answer the page gives.
|
|
780
|
+
*
|
|
781
|
+
* @public
|
|
782
|
+
*/
|
|
783
|
+
export function readStoryWait(value) {
|
|
784
|
+
const answer = isRecord(value) ? { ...value } : {};
|
|
785
|
+
const { completingMs, errors, lastRenderStep } = answer;
|
|
786
|
+
if (answer.outcome === 'finished' &&
|
|
787
|
+
typeof answer.status === 'string' &&
|
|
788
|
+
typeof answer.errorDisplay === 'boolean' &&
|
|
789
|
+
Array.isArray(errors) &&
|
|
790
|
+
errors.every(isRecordedError) &&
|
|
791
|
+
(completingMs === null || typeof completingMs === 'number')) {
|
|
792
|
+
return classifyFinished({ status: answer.status, errorDisplay: answer.errorDisplay, errors, completingMs });
|
|
793
|
+
}
|
|
794
|
+
if (answer.outcome === 'timed-out' &&
|
|
795
|
+
isWaitStep(answer.step) &&
|
|
796
|
+
(lastRenderStep === null || typeof lastRenderStep === 'string')) {
|
|
797
|
+
return { outcome: 'timed-out', step: answer.step, lastRenderStep: lastRenderStep ?? undefined };
|
|
798
|
+
}
|
|
799
|
+
if (answer.outcome === 'script-missing') {
|
|
800
|
+
return { outcome: 'script-missing' };
|
|
801
|
+
}
|
|
802
|
+
throw new Error(`The Storybook wait in the page gave an answer visual-check doesn't know: ${JSON.stringify(value)}.`);
|
|
803
|
+
}
|
|
804
|
+
//# sourceMappingURL=preview-script.js.map
|