checkly 9.5.0 → 10.0.0-prerelease-4f88d60
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/README.md +10 -0
- package/bin/launch.cjs +12 -0
- package/dist/ai-context/context.js +1 -0
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/onboarding-boilerplate/checkly-config-template.ts +2 -2
- package/dist/ai-context/public-skills/checkly/SKILL.md +34 -5
- package/dist/ai-context/skills-command/references/communicate.md +8 -5
- package/dist/ai-context/skills-command/references/configure-api-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-browser-checks.md +1 -8
- package/dist/ai-context/skills-command/references/configure-check-groups.md +1 -0
- package/dist/ai-context/skills-command/references/configure-dns-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-grpc-monitors.md +24 -0
- package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-multistep-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-playwright-checks.md +2 -2
- package/dist/ai-context/skills-command/references/configure-supporting-constructs.md +6 -2
- package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure-url-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure.md +17 -5
- package/dist/ai-context/skills-command/references/initialize.md +11 -3
- package/dist/ai-context/skills-command/references/investigate-checks.md +1 -1
- package/dist/auth/api-key.d.ts +24 -0
- package/dist/auth/api-key.js +104 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/device-flow.d.ts +58 -0
- package/dist/auth/device-flow.js +228 -0
- package/dist/auth/device-flow.js.map +1 -0
- package/dist/auth/index.d.ts +6 -6
- package/dist/auth/index.js +64 -64
- package/dist/auth/index.js.map +1 -1
- package/dist/commands/account/plan.js +1 -1
- package/dist/commands/account/plan.js.map +1 -1
- package/dist/commands/account/usage/projections.d.ts +16 -0
- package/dist/commands/account/usage/projections.js +40 -0
- package/dist/commands/account/usage/projections.js.map +1 -0
- package/dist/commands/account/usage/series.d.ts +7 -3
- package/dist/commands/account/usage/series.js +30 -87
- package/dist/commands/account/usage/series.js.map +1 -1
- package/dist/commands/account/usage/summary.d.ts +4 -1
- package/dist/commands/account/usage/summary.js +19 -27
- package/dist/commands/account/usage/summary.js.map +1 -1
- package/dist/commands/account/usage/term.d.ts +15 -0
- package/dist/commands/account/usage/term.js +32 -0
- package/dist/commands/account/usage/term.js.map +1 -0
- package/dist/commands/account/usage/terms.d.ts +4 -0
- package/dist/commands/account/usage/terms.js +19 -27
- package/dist/commands/account/usage/terms.js.map +1 -1
- package/dist/commands/alert-channels/get.js +2 -1
- package/dist/commands/alert-channels/get.js.map +1 -1
- package/dist/commands/alert-channels/list.js +2 -1
- package/dist/commands/alert-channels/list.js.map +1 -1
- package/dist/commands/alert-channels/logs.js +2 -1
- package/dist/commands/alert-channels/logs.js.map +1 -1
- package/dist/commands/api.js +53 -10
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/assets/download.js +11 -7
- package/dist/commands/assets/download.js.map +1 -1
- package/dist/commands/assets/list.js +2 -3
- package/dist/commands/assets/list.js.map +1 -1
- package/dist/commands/authCommand.d.ts +19 -0
- package/dist/commands/authCommand.js +118 -12
- package/dist/commands/authCommand.js.map +1 -1
- package/dist/commands/baseCommand.d.ts +12 -1
- package/dist/commands/baseCommand.js +24 -5
- package/dist/commands/baseCommand.js.map +1 -1
- package/dist/commands/checks/delete.js +1 -1
- package/dist/commands/checks/delete.js.map +1 -1
- package/dist/commands/checks/run.js +3 -1
- package/dist/commands/checks/run.js.map +1 -1
- package/dist/commands/debug/parse-project.d.ts +1 -0
- package/dist/commands/debug/parse-project.js +5 -2
- package/dist/commands/debug/parse-project.js.map +1 -1
- package/dist/commands/deploy.d.ts +8 -2
- package/dist/commands/deploy.js +735 -274
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.js +3 -3
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/env/add.js +2 -2
- package/dist/commands/env/add.js.map +1 -1
- package/dist/commands/env/ls.js +2 -1
- package/dist/commands/env/ls.js.map +1 -1
- package/dist/commands/env/pull.js +3 -3
- package/dist/commands/env/pull.js.map +1 -1
- package/dist/commands/env/update.js +2 -2
- package/dist/commands/env/update.js.map +1 -1
- package/dist/commands/import/apply.js +12 -10
- package/dist/commands/import/apply.js.map +1 -1
- package/dist/commands/import/cancel.js +4 -4
- package/dist/commands/import/cancel.js.map +1 -1
- package/dist/commands/import/commit.js +11 -9
- package/dist/commands/import/commit.js.map +1 -1
- package/dist/commands/import/plan.js +82 -62
- package/dist/commands/import/plan.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +62 -41
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +38 -2
- package/dist/commands/login.js +848 -52
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +10 -4
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/pw-test.js +6 -3
- package/dist/commands/pw-test.js.map +1 -1
- package/dist/commands/rca/get.js +1 -1
- package/dist/commands/rca/get.js.map +1 -1
- package/dist/commands/rca/run.js +1 -1
- package/dist/commands/rca/run.js.map +1 -1
- package/dist/commands/skills/index.js +1 -1
- package/dist/commands/skills/index.js.map +1 -1
- package/dist/commands/skills/install.js +12 -12
- package/dist/commands/skills/install.js.map +1 -1
- package/dist/commands/switch.d.ts +10 -1
- package/dist/commands/switch.js +75 -13
- package/dist/commands/switch.js.map +1 -1
- package/dist/commands/sync-playwright.js +5 -10
- package/dist/commands/sync-playwright.js.map +1 -1
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/test.js +58 -29
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/trigger.d.ts +1 -2
- package/dist/commands/trigger.js +27 -20
- package/dist/commands/trigger.js.map +1 -1
- package/dist/commands/validate.js +1 -0
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/whoami.d.ts +8 -0
- package/dist/commands/whoami.js +57 -6
- package/dist/commands/whoami.js.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +8 -1
- package/dist/constants.js.map +1 -1
- package/dist/constructs/alert-channel-codegen.d.ts +6 -1
- package/dist/constructs/alert-channel-codegen.js +12 -6
- package/dist/constructs/alert-channel-codegen.js.map +1 -1
- package/dist/constructs/alert-channel-subscription.d.ts +1 -0
- package/dist/constructs/alert-channel-subscription.js +4 -0
- package/dist/constructs/alert-channel-subscription.js.map +1 -1
- package/dist/constructs/alert-channel.js +8 -5
- package/dist/constructs/alert-channel.js.map +1 -1
- package/dist/constructs/alert-escalation-policy-codegen.d.ts +7 -0
- package/dist/constructs/alert-escalation-policy-codegen.js +25 -8
- package/dist/constructs/alert-escalation-policy-codegen.js.map +1 -1
- package/dist/constructs/api-assertion.d.ts +0 -2
- package/dist/constructs/api-assertion.js +0 -4
- package/dist/constructs/api-assertion.js.map +1 -1
- package/dist/constructs/api-check-bundle.d.ts +4 -124
- package/dist/constructs/api-check-codegen.js +1 -1
- package/dist/constructs/api-check-codegen.js.map +1 -1
- package/dist/constructs/api-check.d.ts +8 -128
- package/dist/constructs/api-check.js +15 -17
- package/dist/constructs/api-check.js.map +1 -1
- package/dist/constructs/api-request-codegen.js +10 -8
- package/dist/constructs/api-request-codegen.js.map +1 -1
- package/dist/constructs/browser-check-bundle.d.ts +11 -125
- package/dist/constructs/browser-check-bundle.js +5 -1
- package/dist/constructs/browser-check-bundle.js.map +1 -1
- package/dist/constructs/browser-check.d.ts +5 -107
- package/dist/constructs/browser-check.js +1 -1
- package/dist/constructs/browser-check.js.map +1 -1
- package/dist/constructs/check-codegen.d.ts +46 -14
- package/dist/constructs/check-codegen.js +118 -34
- package/dist/constructs/check-codegen.js.map +1 -1
- package/dist/constructs/check-group-codegen.js +23 -9
- package/dist/constructs/check-group-codegen.js.map +1 -1
- package/dist/constructs/check-group-v1.d.ts +28 -16
- package/dist/constructs/check-group-v1.js +48 -17
- package/dist/constructs/check-group-v1.js.map +1 -1
- package/dist/constructs/check-group-v2.d.ts +2 -21
- package/dist/constructs/check-group-v2.js +4 -4
- package/dist/constructs/check-group-v2.js.map +1 -1
- package/dist/constructs/check.d.ts +68 -220
- package/dist/constructs/check.js +106 -37
- package/dist/constructs/check.js.map +1 -1
- package/dist/constructs/construct-codegen.d.ts +1 -2
- package/dist/constructs/construct-diagnostics.d.ts +3 -0
- package/dist/constructs/construct-diagnostics.js +11 -0
- package/dist/constructs/construct-diagnostics.js.map +1 -1
- package/dist/constructs/construct.d.ts +30 -4
- package/dist/constructs/construct.js +52 -6
- package/dist/constructs/construct.js.map +1 -1
- package/dist/constructs/dashboard.js +11 -7
- package/dist/constructs/dashboard.js.map +1 -1
- package/dist/constructs/dns-monitor.d.ts +4 -100
- package/dist/constructs/dns-request-codegen.js +1 -1
- package/dist/constructs/dns-request-codegen.js.map +1 -1
- package/dist/constructs/email-alert-channel-codegen.js +1 -1
- package/dist/constructs/email-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/engine.d.ts +4 -2
- package/dist/constructs/engine.js +3 -1
- package/dist/constructs/engine.js.map +1 -1
- package/dist/constructs/frequency-codegen.js +10 -2
- package/dist/constructs/frequency-codegen.js.map +1 -1
- package/dist/constructs/frequency.d.ts +8 -3
- package/dist/constructs/frequency.js +7 -2
- package/dist/constructs/frequency.js.map +1 -1
- package/dist/constructs/grpc-monitor.d.ts +4 -100
- package/dist/constructs/grpc-monitor.js +19 -0
- package/dist/constructs/grpc-monitor.js.map +1 -1
- package/dist/constructs/grpc-request-codegen.js +13 -4
- package/dist/constructs/grpc-request-codegen.js.map +1 -1
- package/dist/constructs/grpc-request.d.ts +23 -0
- package/dist/constructs/heartbeat-monitor.d.ts +2 -1
- package/dist/constructs/heartbeat-monitor.js +2 -2
- package/dist/constructs/heartbeat-monitor.js.map +1 -1
- package/dist/constructs/icmp-monitor.d.ts +4 -100
- package/dist/constructs/icmp-request-codegen.js +1 -1
- package/dist/constructs/icmp-request-codegen.js.map +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.js +14 -8
- package/dist/constructs/incidentio-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/index.d.ts +1 -1
- package/dist/constructs/index.js +1 -1
- package/dist/constructs/index.js.map +1 -1
- package/dist/constructs/internal/assertion-validation.js +1 -2
- package/dist/constructs/internal/assertion-validation.js.map +1 -1
- package/dist/constructs/internal/codegen/context.d.ts +73 -6
- package/dist/constructs/internal/codegen/context.js +78 -6
- package/dist/constructs/internal/codegen/context.js.map +1 -1
- package/dist/constructs/internal/codegen/index.d.ts +3 -1
- package/dist/constructs/internal/codegen/index.js +2 -1
- package/dist/constructs/internal/codegen/index.js.map +1 -1
- package/dist/constructs/internal/codegen/render.d.ts +68 -0
- package/dist/constructs/internal/codegen/render.js +75 -0
- package/dist/constructs/internal/codegen/render.js.map +1 -0
- package/dist/constructs/internal/common-diagnostics.d.ts +1 -2
- package/dist/constructs/internal/common-diagnostics.js +7 -17
- package/dist/constructs/internal/common-diagnostics.js.map +1 -1
- package/dist/constructs/internal/declaring-file.d.ts +39 -0
- package/dist/constructs/internal/declaring-file.js +139 -0
- package/dist/constructs/internal/declaring-file.js.map +1 -0
- package/dist/constructs/internal/default-retry-strategy.d.ts +9 -0
- package/dist/constructs/internal/default-retry-strategy.js +13 -0
- package/dist/constructs/internal/default-retry-strategy.js.map +1 -0
- package/dist/constructs/internal/retry-strategy-defaults.d.ts +13 -0
- package/dist/constructs/internal/retry-strategy-defaults.js +14 -0
- package/dist/constructs/internal/retry-strategy-defaults.js.map +1 -0
- package/dist/constructs/key-value-pair-codegen.d.ts +6 -1
- package/dist/constructs/key-value-pair-codegen.js +24 -3
- package/dist/constructs/key-value-pair-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window-codegen.d.ts +7 -0
- package/dist/constructs/maintenance-window-codegen.js +36 -19
- package/dist/constructs/maintenance-window-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window.d.ts +37 -3
- package/dist/constructs/maintenance-window.js +34 -1
- package/dist/constructs/maintenance-window.js.map +1 -1
- package/dist/constructs/monitor.d.ts +6 -119
- package/dist/constructs/monitor.js +3 -5
- package/dist/constructs/monitor.js.map +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.js +8 -18
- package/dist/constructs/msteams-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/multi-step-check-bundle.d.ts +4 -109
- package/dist/constructs/multi-step-check.d.ts +4 -100
- package/dist/constructs/opsgenie-alert-channel-codegen.js +1 -1
- package/dist/constructs/opsgenie-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/playwright-check-bundle.d.ts +10 -130
- package/dist/constructs/playwright-check-bundle.js +3 -3
- package/dist/constructs/playwright-check-bundle.js.map +1 -1
- package/dist/constructs/playwright-check-codegen.d.ts +85 -0
- package/dist/constructs/playwright-check-codegen.js +212 -0
- package/dist/constructs/playwright-check-codegen.js.map +1 -0
- package/dist/constructs/playwright-check.d.ts +14 -122
- package/dist/constructs/playwright-check.js +17 -51
- package/dist/constructs/playwright-check.js.map +1 -1
- package/dist/constructs/private-location-check-assignment.d.ts +1 -0
- package/dist/constructs/private-location-check-assignment.js +4 -0
- package/dist/constructs/private-location-check-assignment.js.map +1 -1
- package/dist/constructs/private-location-group-assignment.d.ts +1 -0
- package/dist/constructs/private-location-group-assignment.js +4 -0
- package/dist/constructs/private-location-group-assignment.js.map +1 -1
- package/dist/constructs/private-location.js +3 -1
- package/dist/constructs/private-location.js.map +1 -1
- package/dist/constructs/retry-strategy-codegen.d.ts +7 -1
- package/dist/constructs/retry-strategy-codegen.js +41 -32
- package/dist/constructs/retry-strategy-codegen.js.map +1 -1
- package/dist/constructs/retry-strategy.d.ts +0 -4
- package/dist/constructs/retry-strategy.js +5 -8
- package/dist/constructs/retry-strategy.js.map +1 -1
- package/dist/constructs/session.d.ts +38 -1
- package/dist/constructs/session.js +73 -3
- package/dist/constructs/session.js.map +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/ssl-monitor.d.ts +4 -142
- package/dist/constructs/ssl-request-codegen.js +4 -3
- package/dist/constructs/ssl-request-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-automation-rule-codegen.js +5 -4
- package/dist/constructs/status-page-v3-automation-rule-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-codegen.js +3 -2
- package/dist/constructs/status-page-v3-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-component-codegen.js +8 -7
- package/dist/constructs/status-page-v3-component-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor-codegen.js +3 -2
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor.d.ts +8 -103
- package/dist/constructs/tcp-monitor.js +3 -2
- package/dist/constructs/tcp-monitor.js.map +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.js +14 -8
- package/dist/constructs/telegram-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/time-zone.d.ts +24 -0
- package/dist/constructs/time-zone.js +455 -0
- package/dist/constructs/time-zone.js.map +1 -0
- package/dist/constructs/traceroute-monitor.d.ts +4 -100
- package/dist/constructs/traceroute-request-codegen.js +2 -2
- package/dist/constructs/traceroute-request-codegen.js.map +1 -1
- package/dist/constructs/url-monitor-codegen.js +1 -1
- package/dist/constructs/url-monitor-codegen.js.map +1 -1
- package/dist/constructs/url-monitor.d.ts +7 -123
- package/dist/constructs/url-monitor.js +3 -0
- package/dist/constructs/url-monitor.js.map +1 -1
- package/dist/constructs/url-request-codegen.js +4 -3
- package/dist/constructs/url-request-codegen.js.map +1 -1
- package/dist/constructs/webhook-alert-channel-codegen.js +3 -3
- package/dist/constructs/webhook-alert-channel-codegen.js.map +1 -1
- package/dist/formatters/check-result-detail.js +0 -185
- package/dist/formatters/check-result-detail.js.map +1 -1
- package/dist/formatters/render.d.ts +2 -1
- package/dist/formatters/render.js +2 -2
- package/dist/formatters/render.js.map +1 -1
- package/dist/formatters/usage.d.ts +18 -12
- package/dist/formatters/usage.js +285 -245
- package/dist/formatters/usage.js.map +1 -1
- package/dist/help/help-extension.js +2 -1
- package/dist/help/help-extension.js.map +1 -1
- package/dist/helpers/accounts.d.ts +28 -0
- package/dist/helpers/accounts.js +50 -0
- package/dist/helpers/accounts.js.map +1 -0
- package/dist/helpers/activate-account.d.ts +13 -0
- package/dist/helpers/activate-account.js +24 -0
- package/dist/helpers/activate-account.js.map +1 -0
- package/dist/helpers/api-fields.js +3 -2
- package/dist/helpers/api-fields.js.map +1 -1
- package/dist/helpers/cli-mode.d.ts +24 -0
- package/dist/helpers/cli-mode.js +64 -8
- package/dist/helpers/cli-mode.js.map +1 -1
- package/dist/helpers/command-preview.d.ts +44 -0
- package/dist/helpers/command-preview.js +29 -9
- package/dist/helpers/command-preview.js.map +1 -1
- package/dist/helpers/command-style.d.ts +1 -0
- package/dist/helpers/command-style.js +51 -37
- package/dist/helpers/command-style.js.map +1 -1
- package/dist/helpers/flags.d.ts +10 -0
- package/dist/helpers/flags.js +18 -0
- package/dist/helpers/flags.js.map +1 -1
- package/dist/helpers/import-plan-selection.d.ts +1 -1
- package/dist/helpers/import-plan-selection.js +8 -20
- package/dist/helpers/import-plan-selection.js.map +1 -1
- package/dist/helpers/invalid-input-error.d.ts +15 -0
- package/dist/helpers/invalid-input-error.js +17 -0
- package/dist/helpers/invalid-input-error.js.map +1 -0
- package/dist/helpers/number.js +4 -3
- package/dist/helpers/number.js.map +1 -1
- package/dist/helpers/onboarding/boilerplate.js +15 -3
- package/dist/helpers/onboarding/boilerplate.js.map +1 -1
- package/dist/helpers/onboarding/index.d.ts +1 -1
- package/dist/helpers/onboarding/index.js +1 -1
- package/dist/helpers/onboarding/index.js.map +1 -1
- package/dist/helpers/onboarding/messages.d.ts +7 -0
- package/dist/helpers/onboarding/messages.js +14 -0
- package/dist/helpers/onboarding/messages.js.map +1 -1
- package/dist/helpers/onboarding/prompt-display.js +2 -2
- package/dist/helpers/onboarding/prompt-display.js.map +1 -1
- package/dist/helpers/onboarding/prompts-helpers.js +3 -1
- package/dist/helpers/onboarding/prompts-helpers.js.map +1 -1
- package/dist/helpers/onboarding/skill-install.js +4 -4
- package/dist/helpers/onboarding/skill-install.js.map +1 -1
- package/dist/helpers/prompts.d.ts +7 -0
- package/dist/helpers/prompts.js +10 -0
- package/dist/helpers/prompts.js.map +1 -0
- package/dist/helpers/result-assets.js +4 -3
- package/dist/helpers/result-assets.js.map +1 -1
- package/dist/helpers/test-helper.d.ts +14 -0
- package/dist/helpers/test-helper.js +33 -3
- package/dist/helpers/test-helper.js.map +1 -1
- package/dist/helpers/usage.d.ts +51 -14
- package/dist/helpers/usage.js +193 -53
- package/dist/helpers/usage.js.map +1 -1
- package/dist/helpers/wrap.js +1 -1
- package/dist/helpers/wrap.js.map +1 -1
- package/dist/messages/common-messages.d.ts +1 -0
- package/dist/messages/common-messages.js +4 -2
- package/dist/messages/common-messages.js.map +1 -1
- package/dist/reporters/abstract-list.d.ts +9 -2
- package/dist/reporters/abstract-list.js +105 -32
- package/dist/reporters/abstract-list.js.map +1 -1
- package/dist/reporters/ci.js +7 -4
- package/dist/reporters/ci.js.map +1 -1
- package/dist/reporters/dot.d.ts +1 -0
- package/dist/reporters/dot.js +19 -7
- package/dist/reporters/dot.js.map +1 -1
- package/dist/reporters/github.d.ts +2 -0
- package/dist/reporters/github.js +29 -4
- package/dist/reporters/github.js.map +1 -1
- package/dist/reporters/json.d.ts +2 -0
- package/dist/reporters/json.js +27 -4
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/list.js +10 -8
- package/dist/reporters/list.js.map +1 -1
- package/dist/reporters/reporter.d.ts +1 -0
- package/dist/reporters/reporter.js.map +1 -1
- package/dist/reporters/util.d.ts +5 -2
- package/dist/reporters/util.js +25 -61
- package/dist/reporters/util.js.map +1 -1
- package/dist/rest/analytics.js +0 -4
- package/dist/rest/analytics.js.map +1 -1
- package/dist/rest/api.d.ts +10 -1
- package/dist/rest/api.js +44 -9
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/check-results.d.ts +1 -50
- package/dist/rest/check-results.js.map +1 -1
- package/dist/rest/checkly-storage.d.ts +6 -1
- package/dist/rest/checkly-storage.js +13 -2
- package/dist/rest/checkly-storage.js.map +1 -1
- package/dist/rest/errors.d.ts +19 -0
- package/dist/rest/errors.js +20 -1
- package/dist/rest/errors.js.map +1 -1
- package/dist/rest/projects.d.ts +254 -4
- package/dist/rest/projects.js +208 -17
- package/dist/rest/projects.js.map +1 -1
- package/dist/rest/usage.d.ts +164 -73
- package/dist/rest/usage.js +21 -10
- package/dist/rest/usage.js.map +1 -1
- package/dist/services/abstract-check-runner.d.ts +34 -2
- package/dist/services/abstract-check-runner.js +183 -56
- package/dist/services/abstract-check-runner.js.map +1 -1
- package/dist/services/check-parser/bundler.d.ts +26 -0
- package/dist/services/check-parser/bundler.js +81 -7
- package/dist/services/check-parser/bundler.js.map +1 -1
- package/dist/services/check-parser/cache-hash.d.ts +1 -4
- package/dist/services/check-parser/cache-hash.js.map +1 -1
- package/dist/services/check-parser/package-files/json-text-source-file.d.ts +0 -2
- package/dist/services/check-parser/package-files/json-text-source-file.js +6 -6
- package/dist/services/check-parser/package-files/json-text-source-file.js.map +1 -1
- package/dist/services/check-parser/parser.d.ts +3 -2
- package/dist/services/check-parser/parser.js +31 -40
- package/dist/services/check-parser/parser.js.map +1 -1
- package/dist/services/checkly-config-codegen.js +4 -4
- package/dist/services/checkly-config-codegen.js.map +1 -1
- package/dist/services/checkly-config-loader.d.ts +18 -33
- package/dist/services/checkly-config-loader.js +50 -47
- package/dist/services/checkly-config-loader.js.map +1 -1
- package/dist/services/config.d.ts +42 -1
- package/dist/services/config.js +93 -9
- package/dist/services/config.js.map +1 -1
- package/dist/services/content-hash.d.ts +14 -0
- package/dist/services/content-hash.js +22 -0
- package/dist/services/content-hash.js.map +1 -0
- package/dist/services/deploy-diff/diff-lines.d.ts +52 -0
- package/dist/services/deploy-diff/diff-lines.js +327 -0
- package/dist/services/deploy-diff/diff-lines.js.map +1 -0
- package/dist/services/deploy-diff/double-check.d.ts +9 -0
- package/dist/services/deploy-diff/double-check.js +21 -0
- package/dist/services/deploy-diff/double-check.js.map +1 -0
- package/dist/services/deploy-diff/import-shape.d.ts +171 -0
- package/dist/services/deploy-diff/import-shape.js +633 -0
- package/dist/services/deploy-diff/import-shape.js.map +1 -0
- package/dist/services/deploy-diff/legacy-payload.d.ts +22 -0
- package/dist/services/deploy-diff/legacy-payload.js +51 -0
- package/dist/services/deploy-diff/legacy-payload.js.map +1 -0
- package/dist/services/deploy-diff/plan-summary.d.ts +81 -0
- package/dist/services/deploy-diff/plan-summary.js +262 -0
- package/dist/services/deploy-diff/plan-summary.js.map +1 -0
- package/dist/services/deploy-diff/preview-output.d.ts +63 -0
- package/dist/services/deploy-diff/preview-output.js +403 -0
- package/dist/services/deploy-diff/preview-output.js.map +1 -0
- package/dist/services/deploy-diff/render.d.ts +59 -0
- package/dist/services/deploy-diff/render.js +326 -0
- package/dist/services/deploy-diff/render.js.map +1 -0
- package/dist/services/deploy-diff/shape-changes.d.ts +2 -0
- package/dist/services/deploy-diff/shape-changes.js +48 -0
- package/dist/services/deploy-diff/shape-changes.js.map +1 -0
- package/dist/services/deploy-diff/source-index.d.ts +18 -0
- package/dist/services/deploy-diff/source-index.js +48 -0
- package/dist/services/deploy-diff/source-index.js.map +1 -0
- package/dist/services/deploy-diff/variable-names.d.ts +30 -0
- package/dist/services/deploy-diff/variable-names.js +64 -0
- package/dist/services/deploy-diff/variable-names.js.map +1 -0
- package/dist/services/engine-resolver.js +3 -0
- package/dist/services/engine-resolver.js.map +1 -1
- package/dist/services/engine-rules-loader.d.ts +6 -0
- package/dist/services/engine-rules-loader.js +12 -3
- package/dist/services/engine-rules-loader.js.map +1 -1
- package/dist/services/oxc-parser.d.ts +26 -0
- package/dist/services/oxc-parser.js +70 -0
- package/dist/services/oxc-parser.js.map +1 -0
- package/dist/services/project-cli.d.ts +75 -0
- package/dist/services/project-cli.js +302 -0
- package/dist/services/project-cli.js.map +1 -0
- package/dist/services/project-parser.d.ts +5 -0
- package/dist/services/project-parser.js +25 -13
- package/dist/services/project-parser.js.map +1 -1
- package/dist/services/skills.js +3 -3
- package/dist/services/skills.js.map +1 -1
- package/dist/services/snapshot-service.d.ts +25 -8
- package/dist/services/snapshot-service.js +46 -4
- package/dist/services/snapshot-service.js.map +1 -1
- package/dist/services/socket-client.js +1 -1
- package/dist/services/socket-client.js.map +1 -1
- package/dist/services/test-filters.d.ts +18 -0
- package/dist/services/test-filters.js +10 -0
- package/dist/services/test-filters.js.map +1 -1
- package/dist/services/test-runner.d.ts +1 -1
- package/dist/services/test-runner.js +10 -11
- package/dist/services/test-runner.js.map +1 -1
- package/dist/services/test-session-cancel.d.ts +5 -0
- package/dist/services/test-session-cancel.js +28 -3
- package/dist/services/test-session-cancel.js.map +1 -1
- package/dist/services/trigger-runner.d.ts +1 -1
- package/dist/services/trigger-runner.js +2 -2
- package/dist/services/trigger-runner.js.map +1 -1
- package/dist/services/two-installs.d.ts +39 -0
- package/dist/services/two-installs.js +155 -0
- package/dist/services/two-installs.js.map +1 -0
- package/dist/services/util.d.ts +17 -2
- package/dist/services/util.js +118 -11
- package/dist/services/util.js.map +1 -1
- package/dist/services/write-back/apply-edits.d.ts +29 -0
- package/dist/services/write-back/apply-edits.js +255 -0
- package/dist/services/write-back/apply-edits.js.map +1 -0
- package/dist/services/write-back/helper-edit.d.ts +135 -0
- package/dist/services/write-back/helper-edit.js +343 -0
- package/dist/services/write-back/helper-edit.js.map +1 -0
- package/dist/services/write-back/imports.d.ts +30 -0
- package/dist/services/write-back/imports.js +88 -0
- package/dist/services/write-back/imports.js.map +1 -0
- package/dist/services/write-back/literal-edit.d.ts +183 -0
- package/dist/services/write-back/literal-edit.js +359 -0
- package/dist/services/write-back/literal-edit.js.map +1 -0
- package/dist/services/write-back/output.d.ts +26 -0
- package/dist/services/write-back/output.js +110 -0
- package/dist/services/write-back/output.js.map +1 -0
- package/dist/services/write-back/plan.d.ts +180 -0
- package/dist/services/write-back/plan.js +1046 -0
- package/dist/services/write-back/plan.js.map +1 -0
- package/dist/services/write-back/source-file.d.ts +133 -0
- package/dist/services/write-back/source-file.js +460 -0
- package/dist/services/write-back/source-file.js.map +1 -0
- package/dist/sourcegen/index.d.ts +1 -1
- package/dist/sourcegen/index.js +1 -1
- package/dist/sourcegen/index.js.map +1 -1
- package/dist/sourcegen/program.d.ts +19 -1
- package/dist/sourcegen/program.js +32 -7
- package/dist/sourcegen/program.js.map +1 -1
- package/dist/testing/clear-git-env.d.ts +1 -0
- package/dist/testing/clear-git-env.js +25 -0
- package/dist/testing/clear-git-env.js.map +1 -0
- package/dist/testing/global-setup.d.ts +1 -0
- package/dist/testing/global-setup.js +3 -0
- package/dist/testing/global-setup.js.map +1 -1
- package/oclif.manifest.json +1113 -884
- package/package.json +21 -19
- package/dist/commands/rules.d.ts +0 -9
- package/dist/commands/rules.js +0 -13
- package/dist/commands/rules.js.map +0 -1
- package/dist/constructs/agentic-check-codegen.d.ts +0 -22
- package/dist/constructs/agentic-check-codegen.js +0 -59
- package/dist/constructs/agentic-check-codegen.js.map +0 -1
- package/dist/constructs/agentic-check.d.ts +0 -237
- package/dist/constructs/agentic-check.js +0 -100
- package/dist/constructs/agentic-check.js.map +0 -1
- package/dist/services/check-parser/package-files/json-text-source-file-parser.d.ts +0 -7
- package/dist/services/check-parser/package-files/json-text-source-file-parser.js +0 -47
- package/dist/services/check-parser/package-files/json-text-source-file-parser.js.map +0 -1
- package/dist/services/check-parser/package-files/source-file-parser.d.ts +0 -10
- package/dist/services/check-parser/package-files/source-file-parser.js +0 -13
- package/dist/services/check-parser/package-files/source-file-parser.js.map +0 -1
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import * as acorn from 'acorn';
|
|
3
|
+
import * as constructs from '../../constructs/index.js';
|
|
4
|
+
import { loadOxcParser, parseWithOxc } from '../oxc-parser.js';
|
|
5
|
+
/**
|
|
6
|
+
* Reads a construct's source file far enough to find the `new X('id', { … })`
|
|
7
|
+
* that declared it, so `literal-edit.ts` can splice values into that options
|
|
8
|
+
* object by byte range.
|
|
9
|
+
*
|
|
10
|
+
* Two parsers, one AST shape: `.js`/`.mjs`/`.cjs` go through acorn and
|
|
11
|
+
* TypeScript and JSX through oxc-parser, as the check dependency parser reads
|
|
12
|
+
* them. Both produce ESTree nodes carrying `range` (oxc's TypeScript nodes
|
|
13
|
+
* are the ones `@typescript-eslint/types` describes), and only `range` and
|
|
14
|
+
* the node types below are read. Recast (which edits `checkly.config.ts` elsewhere in the CLI) is not
|
|
15
|
+
* used: its acorn parser cannot read TypeScript, and reprinting a touched
|
|
16
|
+
* node re-quotes it, whereas splicing by range leaves every other byte of the
|
|
17
|
+
* file exactly as the user wrote it.
|
|
18
|
+
*/
|
|
19
|
+
const SOURCE_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx']);
|
|
20
|
+
/** Why a file, a construct or a value cannot be edited; the message is shown to the user as the reason it was skipped. */
|
|
21
|
+
export class WriteBackSkipped extends Error {
|
|
22
|
+
}
|
|
23
|
+
const WORD_CHARACTER = /[\p{ID_Continue}$\u200c\u200d]/u;
|
|
24
|
+
/**
|
|
25
|
+
* The tokens and comments lying within `[start, end)`, read off the text of
|
|
26
|
+
* a gap between two nodes, such as between a list's last member and its
|
|
27
|
+
* closing bracket, or between `import` and a specifier. Such a gap holds
|
|
28
|
+
* only whitespace, comments, punctuation and keywords or names (`from`, a
|
|
29
|
+
* default import), never a string or a regular expression, so outside the
|
|
30
|
+
* parser's comments each run of word characters is one token and every
|
|
31
|
+
* other non-space character is a one-character token.
|
|
32
|
+
*/
|
|
33
|
+
export function gapTokens(source, start, end) {
|
|
34
|
+
const { text, comments } = source;
|
|
35
|
+
const tokens = [];
|
|
36
|
+
const first = comments.findIndex(comment => comment[0] >= start);
|
|
37
|
+
let next = first === -1 ? comments.length : first;
|
|
38
|
+
let at = start;
|
|
39
|
+
while (at < end) {
|
|
40
|
+
const comment = comments[next];
|
|
41
|
+
if (comment !== undefined && comment[0] === at) {
|
|
42
|
+
if (comment[1] <= end) {
|
|
43
|
+
tokens.push({ kind: 'comment', value: '', range: comment });
|
|
44
|
+
}
|
|
45
|
+
at = comment[1];
|
|
46
|
+
next++;
|
|
47
|
+
}
|
|
48
|
+
else if (/\s/.test(text[at])) {
|
|
49
|
+
at++;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
let tokenEnd = at + 1;
|
|
53
|
+
if (WORD_CHARACTER.test(text[at])) {
|
|
54
|
+
while (tokenEnd < end && WORD_CHARACTER.test(text[tokenEnd])) {
|
|
55
|
+
tokenEnd++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
tokens.push({ kind: 'token', value: text.slice(at, tokenEnd), range: [at, tokenEnd] });
|
|
59
|
+
at = tokenEnd;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return tokens;
|
|
63
|
+
}
|
|
64
|
+
const CHECKLY_MODULE = /^checkly(\/.*)?$/;
|
|
65
|
+
/** The one module that exports the constructs and their helpers by name. */
|
|
66
|
+
export const CONSTRUCTS_MODULE = 'checkly/constructs';
|
|
67
|
+
export function parseSource(filePath, text, loadParser = loadOxcParser) {
|
|
68
|
+
const extension = path.extname(filePath);
|
|
69
|
+
if (!SOURCE_EXTENSIONS.has(extension)) {
|
|
70
|
+
throw new WriteBackSkipped(`${extension === '' ? 'the file' : `"${extension}"`} is not a JavaScript or TypeScript file`);
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
if (extension === '.js' || extension === '.mjs' || extension === '.cjs') {
|
|
74
|
+
const comments = [];
|
|
75
|
+
// The same options the check dependency parser reads .js files with,
|
|
76
|
+
// so the two agree on what parses.
|
|
77
|
+
const program = acorn.parse(text, {
|
|
78
|
+
ecmaVersion: 'latest',
|
|
79
|
+
ranges: true,
|
|
80
|
+
allowHashBang: true,
|
|
81
|
+
allowImportExportEverywhere: true,
|
|
82
|
+
allowReturnOutsideFunction: true,
|
|
83
|
+
allowAwaitOutsideFunction: true,
|
|
84
|
+
onComment: (_block, _text, start, end) => comments.push([start, end]),
|
|
85
|
+
});
|
|
86
|
+
return { text, program, comments };
|
|
87
|
+
}
|
|
88
|
+
let parseSync;
|
|
89
|
+
try {
|
|
90
|
+
parseSync = loadParser();
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
// oxc-parser's own reason, e.g. "Cannot find native binding.", without
|
|
94
|
+
// the reinstall instructions or require stack that follow it.
|
|
95
|
+
const cause = err?.cause ?? err;
|
|
96
|
+
const reason = String(cause instanceof Error ? cause.message : cause).split('\n')[0].split(/(?<=\.)\s/)[0];
|
|
97
|
+
throw new WriteBackSkipped(`oxc-parser, which reads TypeScript and JSX files, failed to load (${reason});`
|
|
98
|
+
+ ' reinstall the project\'s dependencies');
|
|
99
|
+
}
|
|
100
|
+
// Without `preserveParens`, a parenthesized expression's range excludes
|
|
101
|
+
// its parentheses, as typescript-estree's and acorn's do.
|
|
102
|
+
const result = parseWithOxc(parseSync, filePath, text, { range: true, preserveParens: false });
|
|
103
|
+
return {
|
|
104
|
+
text,
|
|
105
|
+
program: result.program,
|
|
106
|
+
comments: result.comments.map(({ start, end }) => [start, end]),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
if (err instanceof WriteBackSkipped) {
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
throw new WriteBackSkipped(`could not parse the file: ${err.message}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Every node below (and including) `root`, in source order: a parent before
|
|
118
|
+
* its children, and siblings by where they start, whatever order the parser
|
|
119
|
+
* put their keys in. Only object-valued keys are followed, which covers every
|
|
120
|
+
* ESTree child slot.
|
|
121
|
+
*/
|
|
122
|
+
export function* walk(root) {
|
|
123
|
+
const stack = [root];
|
|
124
|
+
while (stack.length > 0) {
|
|
125
|
+
const node = stack.pop();
|
|
126
|
+
yield node;
|
|
127
|
+
const children = [];
|
|
128
|
+
for (const [key, value] of Object.entries(node)) {
|
|
129
|
+
// `parent` would cycle.
|
|
130
|
+
if (key === 'parent') {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(value)) {
|
|
134
|
+
for (const element of value) {
|
|
135
|
+
if (isNode(element)) {
|
|
136
|
+
children.push(element);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (isNode(value)) {
|
|
141
|
+
children.push(value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
children.sort((a, b) => a.range[0] - b.range[0]);
|
|
145
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
146
|
+
stack.push(children[i]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function isNode(value) {
|
|
151
|
+
return typeof value === 'object' && value !== null && typeof value.type === 'string';
|
|
152
|
+
}
|
|
153
|
+
/** The string a literal argument spells, for a plain string literal or a template with no `${}` in it. */
|
|
154
|
+
export function stringOf(node) {
|
|
155
|
+
if (node === null || node === undefined) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
if (node.type === 'Literal' && typeof node.value === 'string') {
|
|
159
|
+
return node.value;
|
|
160
|
+
}
|
|
161
|
+
if (node.type === 'TemplateLiteral' && node.expressions.length === 0 && node.quasis.length === 1) {
|
|
162
|
+
return node.quasis[0].value.cooked ?? undefined;
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The local names this file binds to the given exported names of a checkly
|
|
168
|
+
* package: `import { ApiCheck } from 'checkly/constructs'`,
|
|
169
|
+
* `import { ApiCheck as Api } from 'checkly'`, and the top-level
|
|
170
|
+
* `const { ApiCheck } = require('checkly/constructs')` (with or without a
|
|
171
|
+
* rename). Anything bound another way — a namespace import, a re-export from
|
|
172
|
+
* the user's own module, a wrapper class — is not a construct call this
|
|
173
|
+
* module can recognise, which keeps it from editing the options of a class
|
|
174
|
+
* that merely shares the name. A type-only import (`import type`, or a
|
|
175
|
+
* `type` specifier) binds nothing at runtime and is not a binding here.
|
|
176
|
+
* Scope is not tracked: a local that shadows the import inside a function
|
|
177
|
+
* is taken for it, which the logical id and the later read-back of the edit
|
|
178
|
+
* bound.
|
|
179
|
+
*/
|
|
180
|
+
export function checklyBindings(program, exportedNames) {
|
|
181
|
+
const locals = new Set();
|
|
182
|
+
for (const statement of program.body) {
|
|
183
|
+
if (statement.type === 'ImportDeclaration') {
|
|
184
|
+
if (typeof statement.source.value !== 'string' || !CHECKLY_MODULE.test(statement.source.value)
|
|
185
|
+
|| statement.importKind === 'type') {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
for (const specifier of statement.specifiers) {
|
|
189
|
+
if (specifier.type !== 'ImportSpecifier' || specifier.importKind === 'type') {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const imported = specifier.imported.type === 'Identifier' ? specifier.imported.name : stringOf(specifier.imported);
|
|
193
|
+
if (imported !== undefined && exportedNames.has(imported)) {
|
|
194
|
+
locals.add(specifier.local.name);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (statement.type === 'VariableDeclaration') {
|
|
199
|
+
for (const declarator of statement.declarations) {
|
|
200
|
+
if (declarator.id.type !== 'ObjectPattern' || !isChecklyRequire(declarator.init)) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
for (const property of declarator.id.properties) {
|
|
204
|
+
if (property.type !== 'Property' || property.computed || property.value.type !== 'Identifier') {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const imported = property.key.type === 'Identifier' ? property.key.name : stringOf(property.key);
|
|
208
|
+
if (imported !== undefined && exportedNames.has(imported)) {
|
|
209
|
+
locals.add(property.value.name);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return locals;
|
|
216
|
+
}
|
|
217
|
+
/** The one local name the file binds an exported name to, if any (the first when several). */
|
|
218
|
+
export function localBinding(program, name) {
|
|
219
|
+
return [...checklyBindings(program, new Set([name]))][0];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The splice that appends `members` to a multi-line list after its last
|
|
223
|
+
* member: one per line at `indentation`, after the line the last member
|
|
224
|
+
* (or its comma) ends on, so a comment on that line stays with that
|
|
225
|
+
* member — unless a comment runs on past that line end, in which case they
|
|
226
|
+
* go right after the member's comma rather than into the comment. The
|
|
227
|
+
* trailing comma is kept when the list has one, and added to the last
|
|
228
|
+
* member when it has none; `close` is the offset of the closing bracket.
|
|
229
|
+
*/
|
|
230
|
+
export function appendAfterLast(source, last, close, members, indentation, lineEnding) {
|
|
231
|
+
const { text } = source;
|
|
232
|
+
const comma = gapTokens(source, last.range[1], close).find(token => token.kind === 'token' && token.value === ',');
|
|
233
|
+
const afterMember = comma === undefined ? last.range[1] : comma.range[1];
|
|
234
|
+
const breakAt = text.indexOf('\n', afterMember);
|
|
235
|
+
const lineEnd = breakAt === -1 || breakAt >= close
|
|
236
|
+
? afterMember
|
|
237
|
+
: text[breakAt - 1] === '\r' ? breakAt - 1 : breakAt;
|
|
238
|
+
const straddles = gapTokens(source, last.range[1], close)
|
|
239
|
+
.some(token => token.range[0] < lineEnd && token.range[1] > lineEnd);
|
|
240
|
+
const at = straddles ? afterMember : lineEnd;
|
|
241
|
+
const lines = members.map(member => `${lineEnding}${indentation}${member}`).join(',');
|
|
242
|
+
if (comma === undefined) {
|
|
243
|
+
// The comma goes on the member; whatever sat between it and the line
|
|
244
|
+
// end (a comment) is kept, and the new lines follow.
|
|
245
|
+
return { start: last.range[1], end: at, text: `,${text.slice(last.range[1], at)}${lines}` };
|
|
246
|
+
}
|
|
247
|
+
return { start: at, end: at, text: `${lines},` };
|
|
248
|
+
}
|
|
249
|
+
export function isChecklyRequire(node) {
|
|
250
|
+
return node !== null && node !== undefined
|
|
251
|
+
&& node.type === 'CallExpression'
|
|
252
|
+
&& node.callee.type === 'Identifier' && node.callee.name === 'require'
|
|
253
|
+
&& node.arguments.length === 1
|
|
254
|
+
&& CHECKLY_MODULE.test(stringOf(node.arguments[0]) ?? '');
|
|
255
|
+
}
|
|
256
|
+
/** A name that can be written as an identifier: a variable, or an object key without quotes. */
|
|
257
|
+
export const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
258
|
+
/** The names `checkly/constructs` exports for a construct's class; empty for a class of the user's own. */
|
|
259
|
+
export function exportedNamesOf(construct) {
|
|
260
|
+
const names = new Set();
|
|
261
|
+
for (const [name, value] of Object.entries(constructs)) {
|
|
262
|
+
if (value === construct.constructor) {
|
|
263
|
+
names.add(name);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return names;
|
|
267
|
+
}
|
|
268
|
+
/** Whether a node is `new <Class>('<logicalId>', …)` of a class one of `locals` is bound to. */
|
|
269
|
+
function isConstructCall(node, locals, logicalId) {
|
|
270
|
+
return node?.type === 'NewExpression' && node.callee.type === 'Identifier' && locals.has(node.callee.name)
|
|
271
|
+
&& stringOf(node.arguments[0]) === logicalId;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The options object literal of the one `new <Class>('<logicalId>', { … })`
|
|
275
|
+
* in the file, where `<Class>` is bound to one of `exportedNames` from a
|
|
276
|
+
* checkly package.
|
|
277
|
+
*
|
|
278
|
+
* @throws WriteBackSkipped when the file has no such call, several of them,
|
|
279
|
+
* or its options are not a plain object literal (a variable, a spread, a call,
|
|
280
|
+
* a TypeScript `as`/`satisfies` wrapper): anything the rewriter cannot edit
|
|
281
|
+
* without guessing what the code means.
|
|
282
|
+
*/
|
|
283
|
+
export function findConstructOptions({ program }, logicalId, exportedNames) {
|
|
284
|
+
const locals = checklyBindings(program, exportedNames);
|
|
285
|
+
const names = [...exportedNames].sort().join(' or ');
|
|
286
|
+
if (locals.size === 0) {
|
|
287
|
+
throw new WriteBackSkipped(`${names} is not imported from checkly in this file`);
|
|
288
|
+
}
|
|
289
|
+
const matches = [];
|
|
290
|
+
for (const node of walk(program)) {
|
|
291
|
+
if (isConstructCall(node, locals, logicalId)) {
|
|
292
|
+
matches.push(node);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (matches.length === 0) {
|
|
296
|
+
throw new WriteBackSkipped(`no \`new ${[...locals].sort().join('|')}('${logicalId}', …)\` found in this file`);
|
|
297
|
+
}
|
|
298
|
+
if (matches.length > 1) {
|
|
299
|
+
throw new WriteBackSkipped(`several constructs use the logical id '${logicalId}' in this file`);
|
|
300
|
+
}
|
|
301
|
+
const options = matches[0].arguments[1];
|
|
302
|
+
if (options === undefined || options.type !== 'ObjectExpression') {
|
|
303
|
+
throw new WriteBackSkipped('its options are not a plain object literal');
|
|
304
|
+
}
|
|
305
|
+
if (options.properties.some(property => property.type === 'SpreadElement')) {
|
|
306
|
+
throw new WriteBackSkipped('its options spread another object');
|
|
307
|
+
}
|
|
308
|
+
return options;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* The name of the top-level variable the file initialises with its one
|
|
312
|
+
* `new <Class>('<logicalId>', …)`, exported or not, where `<Class>` is bound
|
|
313
|
+
* to one of `exportedNames` from a checkly package. None when the construct
|
|
314
|
+
* is not declared that way (made inside a function or a loop, passed straight
|
|
315
|
+
* to another call, destructured), or when several declarations match.
|
|
316
|
+
*/
|
|
317
|
+
export function findConstructVariable({ program }, logicalId, exportedNames) {
|
|
318
|
+
const locals = checklyBindings(program, exportedNames);
|
|
319
|
+
const names = [];
|
|
320
|
+
for (const statement of program.body) {
|
|
321
|
+
const declaration = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;
|
|
322
|
+
if (declaration?.type !== 'VariableDeclaration') {
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
for (const { id, init } of declaration.declarations) {
|
|
326
|
+
if (id.type === 'Identifier' && isConstructCall(init, locals, logicalId)) {
|
|
327
|
+
names.push(id.name);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return names.length === 1 ? names[0] : undefined;
|
|
332
|
+
}
|
|
333
|
+
/** The name of a plain `key: value` member, or undefined for a spread, method, accessor or computed key. */
|
|
334
|
+
export function memberName(property) {
|
|
335
|
+
if (property.type !== 'Property' || property.computed || property.kind !== 'init' || property.method) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
if (property.key.type === 'Identifier') {
|
|
339
|
+
return property.key.name;
|
|
340
|
+
}
|
|
341
|
+
if (property.key.type === 'Literal' && typeof property.key.value === 'string') {
|
|
342
|
+
return property.key.value;
|
|
343
|
+
}
|
|
344
|
+
return undefined;
|
|
345
|
+
}
|
|
346
|
+
/** A value with the TypeScript wrappers that change nothing at run time (`as`, `satisfies`, `!`) taken off. */
|
|
347
|
+
function unwrapped(node) {
|
|
348
|
+
let current = node;
|
|
349
|
+
while (current.type === 'TSAsExpression' || current.type === 'TSSatisfiesExpression'
|
|
350
|
+
|| current.type === 'TSNonNullExpression') {
|
|
351
|
+
current = current.expression;
|
|
352
|
+
}
|
|
353
|
+
return current;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The properties a construct's options literal spells out, as the dotted
|
|
357
|
+
* paths `ContextOptions.spelledOut` takes: every plain `key: value` member,
|
|
358
|
+
* the members of an object value under its key, the members of the one
|
|
359
|
+
* object argument of a call or `new` (a builder such as
|
|
360
|
+
* `RetryStrategyBuilder.linearStrategy({ … })`) under the property's key,
|
|
361
|
+
* and, for an object element of an array with a string `key` property, its
|
|
362
|
+
* members under `<path>[<key>]`. Spreads, computed keys, methods and
|
|
363
|
+
* elements without such a key add nothing, and neither do the arguments of a
|
|
364
|
+
* call with several (`AlertEscalationBuilder.runBasedEscalation(1, { … })`):
|
|
365
|
+
* the codegen could not tell which value they stand for.
|
|
366
|
+
*/
|
|
367
|
+
export function spelledOutPaths(options) {
|
|
368
|
+
const paths = new Set();
|
|
369
|
+
const visitValue = (value, path) => {
|
|
370
|
+
const node = unwrapped(value);
|
|
371
|
+
if (node.type === 'ObjectExpression') {
|
|
372
|
+
visitObject(node, path);
|
|
373
|
+
}
|
|
374
|
+
else if ((node.type === 'CallExpression' || node.type === 'NewExpression') && node.arguments.length === 1) {
|
|
375
|
+
const argument = unwrapped(node.arguments[0]);
|
|
376
|
+
if (argument.type === 'ObjectExpression') {
|
|
377
|
+
visitObject(argument, path);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else if (node.type === 'ArrayExpression') {
|
|
381
|
+
for (const element of node.elements) {
|
|
382
|
+
const unwrappedElement = element === null ? null : unwrapped(element);
|
|
383
|
+
if (unwrappedElement?.type !== 'ObjectExpression') {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const keyProperty = unwrappedElement.properties.find(property => memberName(property) === 'key');
|
|
387
|
+
const key = keyProperty === undefined
|
|
388
|
+
? undefined
|
|
389
|
+
: stringOf(unwrapped(keyProperty.value));
|
|
390
|
+
if (key !== undefined) {
|
|
391
|
+
visitObject(unwrappedElement, `${path}[${key}]`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
const visitObject = (object, prefix) => {
|
|
397
|
+
for (const property of object.properties) {
|
|
398
|
+
const name = memberName(property);
|
|
399
|
+
if (name === undefined) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
const path = prefix === '' ? name : `${prefix}.${name}`;
|
|
403
|
+
paths.add(path);
|
|
404
|
+
visitValue(property.value, path);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
visitObject(options, '');
|
|
408
|
+
return paths;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Whether `name` is used as an identifier anywhere in the program: a
|
|
412
|
+
* declaration, an import, a reference, a type name. Member and property
|
|
413
|
+
* names (`x.name`, `{ name: 1 }`) are not identifiers of the name. `walk`
|
|
414
|
+
* yields a parent before its children, so the key or property node to
|
|
415
|
+
* ignore is known by the time it comes up.
|
|
416
|
+
*/
|
|
417
|
+
/**
|
|
418
|
+
* Whether the program binds `name` at its top level: an import, a variable,
|
|
419
|
+
* function or class declaration. A global such as `Date` that a file binds
|
|
420
|
+
* to something of its own is not the global there.
|
|
421
|
+
*/
|
|
422
|
+
export function declaresName(program, name) {
|
|
423
|
+
for (const statement of program.body) {
|
|
424
|
+
const declaration = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;
|
|
425
|
+
if (declaration === null || declaration === undefined) {
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (declaration.type === 'ImportDeclaration') {
|
|
429
|
+
if (declaration.specifiers.some(specifier => specifier.local.name === name)) {
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else if (declaration.type === 'VariableDeclaration') {
|
|
434
|
+
if (declaration.declarations.some(declarator => usesIdentifier(declarator.id, name))) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
else if ((declaration.type === 'FunctionDeclaration' || declaration.type === 'ClassDeclaration')
|
|
439
|
+
&& declaration.id?.name === name) {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
export function usesIdentifier(root, name) {
|
|
446
|
+
const ignored = new Set();
|
|
447
|
+
for (const node of walk(root)) {
|
|
448
|
+
if (node.type === 'MemberExpression' && !node.computed) {
|
|
449
|
+
ignored.add(node.property);
|
|
450
|
+
}
|
|
451
|
+
if ('key' in node && 'computed' in node && node.computed === false) {
|
|
452
|
+
ignored.add(node.key);
|
|
453
|
+
}
|
|
454
|
+
if (node.type === 'Identifier' && node.name === name && !ignored.has(node)) {
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
//# sourceMappingURL=source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.js","sourceRoot":"","sources":["../../../src/services/write-back/source-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,kBAAkB,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AAEH,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtH,0HAA0H;AAC1H,MAAM,OAAO,gBAAiB,SAAQ,KAAK;CAAG;AA+B9C,MAAM,cAAc,GAAG,iCAAiC,CAAA;AAExD;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAE,MAAoB,EAAE,KAAa,EAAE,GAAW;IACzE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AAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC5B,CAAC;QACD,IAAI,KAAK,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAW,CAAC,CAAA;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3E,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -12,7 +12,7 @@ export { expr, ExpressionValueBuilder } from './exprbuilder.js';
|
|
|
12
12
|
export { ident, IdentifierValue } from './identifier.js';
|
|
13
13
|
export { NullValue } from './null.js';
|
|
14
14
|
export { NumberValue } from './number.js';
|
|
15
|
-
export { ObjectValue } from './object.js';
|
|
15
|
+
export { ObjectValue, sortObjectPropertiesByOrderAndName } from './object.js';
|
|
16
16
|
export { object, ObjectValueBuilder } from './objectbuilder.js';
|
|
17
17
|
export { Output } from './output.js';
|
|
18
18
|
export { Program, GeneratedFile, StaticAuxiliaryFile as AuxiliaryFile } from './program.js';
|
package/dist/sourcegen/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { expr, ExpressionValueBuilder } from './exprbuilder.js';
|
|
|
12
12
|
export { ident, IdentifierValue } from './identifier.js';
|
|
13
13
|
export { NullValue } from './null.js';
|
|
14
14
|
export { NumberValue } from './number.js';
|
|
15
|
-
export { ObjectValue } from './object.js';
|
|
15
|
+
export { ObjectValue, sortObjectPropertiesByOrderAndName } from './object.js';
|
|
16
16
|
export { object, ObjectValueBuilder } from './objectbuilder.js';
|
|
17
17
|
export { Output } from './output.js';
|
|
18
18
|
export { Program, GeneratedFile, StaticAuxiliaryFile as AuxiliaryFile } from './program.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sourcegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EACL,KAAK,EAEL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,kBAAkB,GACnB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,IAAI,EACJ,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EA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7E,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -15,6 +15,15 @@ export declare class Program {
|
|
|
15
15
|
#private;
|
|
16
16
|
constructor(options: ProgramOptions);
|
|
17
17
|
get paths(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* The files declaring constructs, in the order they were first asked for.
|
|
20
|
+
*
|
|
21
|
+
* Support and static auxiliary files are not included: a caller that wants
|
|
22
|
+
* the construct a single `gencode` call produced has no other way to tell
|
|
23
|
+
* that file apart from the script, snippet and stylesheet files the same
|
|
24
|
+
* call may register beside it.
|
|
25
|
+
*/
|
|
26
|
+
get generatedConstructFiles(): GeneratedFile[];
|
|
18
27
|
generatedConstructFile(path: string): GeneratedFile;
|
|
19
28
|
generatedSupportFile(path: string): GeneratedFile;
|
|
20
29
|
staticSpecFile(path: string, content: string | Buffer): StaticAuxiliaryFile;
|
|
@@ -44,7 +53,16 @@ export declare class GeneratedFile extends ProgramFile {
|
|
|
44
53
|
plainImport(from: string, options?: ImportOptions): void;
|
|
45
54
|
header(header: Header): void;
|
|
46
55
|
section(content: Content): void;
|
|
47
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @param options `scaffolding` defaults to true, so writing a file to disk
|
|
58
|
+
* needs no options. A caller rendering one construct for a reader — a diff
|
|
59
|
+
* of what a deploy would change, say — passes false: the generated-file
|
|
60
|
+
* header and the import list belong to the file, not to the construct, and
|
|
61
|
+
* an import path invented for an in-memory render would be noise.
|
|
62
|
+
*/
|
|
63
|
+
render(output: Output, options?: {
|
|
64
|
+
scaffolding?: boolean;
|
|
65
|
+
}): void;
|
|
48
66
|
}
|
|
49
67
|
export declare class StaticAuxiliaryFile extends ProgramFile {
|
|
50
68
|
readonly content: string | Buffer;
|
|
@@ -5,6 +5,7 @@ export class Program {
|
|
|
5
5
|
#options;
|
|
6
6
|
#ext;
|
|
7
7
|
#generatedFiles = new Map();
|
|
8
|
+
#generatedConstructFiles = new Set();
|
|
8
9
|
#staticAuxiliaryFiles = new Map();
|
|
9
10
|
constructor(options) {
|
|
10
11
|
this.#options = {
|
|
@@ -32,6 +33,17 @@ export class Program {
|
|
|
32
33
|
paths.sort();
|
|
33
34
|
return paths;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The files declaring constructs, in the order they were first asked for.
|
|
38
|
+
*
|
|
39
|
+
* Support and static auxiliary files are not included: a caller that wants
|
|
40
|
+
* the construct a single `gencode` call produced has no other way to tell
|
|
41
|
+
* that file apart from the script, snippet and stylesheet files the same
|
|
42
|
+
* call may register beside it.
|
|
43
|
+
*/
|
|
44
|
+
get generatedConstructFiles() {
|
|
45
|
+
return Array.from(this.#generatedConstructFiles);
|
|
46
|
+
}
|
|
35
47
|
generatedConstructFile(path) {
|
|
36
48
|
if (this.#shouldModifyPath(path)) {
|
|
37
49
|
path += this.#options.constructFileSuffix;
|
|
@@ -45,6 +57,9 @@ export class Program {
|
|
|
45
57
|
}
|
|
46
58
|
this.#generatedFiles.set(path, file);
|
|
47
59
|
}
|
|
60
|
+
// Unconditional, and a set: being asked for as a construct file is what
|
|
61
|
+
// makes a file one, even if a support file at the same path came first.
|
|
62
|
+
this.#generatedConstructFiles.add(file);
|
|
48
63
|
return file;
|
|
49
64
|
}
|
|
50
65
|
generatedSupportFile(path) {
|
|
@@ -194,13 +209,23 @@ export class GeneratedFile extends ProgramFile {
|
|
|
194
209
|
section(content) {
|
|
195
210
|
this.#sections.push(content);
|
|
196
211
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
212
|
+
/**
|
|
213
|
+
* @param options `scaffolding` defaults to true, so writing a file to disk
|
|
214
|
+
* needs no options. A caller rendering one construct for a reader — a diff
|
|
215
|
+
* of what a deploy would change, say — passes false: the generated-file
|
|
216
|
+
* header and the import list belong to the file, not to the construct, and
|
|
217
|
+
* an import path invented for an in-memory render would be noise.
|
|
218
|
+
*/
|
|
219
|
+
render(output, options = {}) {
|
|
220
|
+
const { scaffolding = true } = options;
|
|
221
|
+
if (scaffolding) {
|
|
222
|
+
for (const header of this.#headers) {
|
|
223
|
+
header.render(output);
|
|
224
|
+
output.endLine();
|
|
225
|
+
output.endLine();
|
|
226
|
+
}
|
|
202
227
|
}
|
|
203
|
-
if (this.#namedImports.size > 0) {
|
|
228
|
+
if (scaffolding && this.#namedImports.size > 0) {
|
|
204
229
|
for (const [pkg, imports] of this.#namedImports.entries()) {
|
|
205
230
|
output.append('import');
|
|
206
231
|
output.cosmeticWhitespace();
|
|
@@ -229,7 +254,7 @@ export class GeneratedFile extends ProgramFile {
|
|
|
229
254
|
output.endLine();
|
|
230
255
|
}
|
|
231
256
|
}
|
|
232
|
-
if (this.#plainImports.size > 0) {
|
|
257
|
+
if (scaffolding && this.#plainImports.size > 0) {
|
|
233
258
|
for (const pkg of this.#plainImports.values()) {
|
|
234
259
|
output.append('import');
|
|
235
260
|
output.significantWhitespace();
|