@jini-ai/devops 0.7.3-next.2 → 0.7.4
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/CHANGELOG.md +7 -0
- package/README.md +16 -0
- package/dist/backup/site/archive-extensions.d.ts +73 -0
- package/dist/backup/site/archive-extensions.js +129 -0
- package/dist/backup/site/archive-manifest.d.ts +85 -0
- package/dist/backup/site/archive-manifest.js +176 -0
- package/dist/backup/site/archive-media.d.ts +121 -0
- package/dist/backup/site/archive-media.js +93 -0
- package/dist/backup/site/backup-service.credentials.d.ts +31 -0
- package/dist/backup/site/backup-service.credentials.js +158 -0
- package/dist/backup/site/backup-service.d.ts +336 -0
- package/dist/backup/site/backup-service.js +127 -0
- package/dist/backup/site/backup-service.plan.d.ts +64 -0
- package/dist/backup/site/backup-service.plan.js +207 -0
- package/dist/backup/site/backup-service.push.d.ts +29 -0
- package/dist/backup/site/backup-service.push.js +94 -0
- package/dist/backup/site/backup-service.shared.d.ts +40 -0
- package/dist/backup/site/backup-service.shared.js +37 -0
- package/dist/backup/site/bundled-export-file-policy.d.ts +38 -0
- package/dist/backup/site/bundled-export-file-policy.js +39 -0
- package/dist/backup/site/credential-warnings.d.ts +41 -0
- package/dist/backup/site/credential-warnings.js +50 -0
- package/dist/backup/site/import-backend-steps.d.ts +167 -0
- package/dist/backup/site/import-backend-steps.js +170 -0
- package/dist/backup/site/import-backend.d.ts +167 -0
- package/dist/backup/site/import-backend.js +298 -0
- package/dist/backup/site/import-database.d.ts +118 -0
- package/dist/backup/site/import-database.js +167 -0
- package/dist/backup/site/import-index/admission.d.ts +54 -0
- package/dist/backup/site/import-index/admission.js +46 -0
- package/dist/backup/site/import-index/backfill.d.ts +106 -0
- package/dist/backup/site/import-index/backfill.js +137 -0
- package/dist/backup/site/import-index/errors.d.ts +28 -0
- package/dist/backup/site/import-index/errors.js +38 -0
- package/dist/backup/site/import-index/migrations/checksums.d.ts +4 -0
- package/dist/backup/site/import-index/migrations/checksums.js +4 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.d.ts +2 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.js +10 -0
- package/dist/backup/site/import-index/mode.d.ts +191 -0
- package/dist/backup/site/import-index/mode.js +272 -0
- package/dist/backup/site/import-index/open.d.ts +40 -0
- package/dist/backup/site/import-index/open.js +87 -0
- package/dist/backup/site/import-index/paging.d.ts +28 -0
- package/dist/backup/site/import-index/paging.js +66 -0
- package/dist/backup/site/import-index/payload-namespace.d.ts +80 -0
- package/dist/backup/site/import-index/payload-namespace.js +156 -0
- package/dist/backup/site/import-index/rows.d.ts +32 -0
- package/dist/backup/site/import-index/rows.js +61 -0
- package/dist/backup/site/import-index/schema.d.ts +8 -0
- package/dist/backup/site/import-index/schema.js +31 -0
- package/dist/backup/site/import-index/store.d.ts +27 -0
- package/dist/backup/site/import-index/store.js +33 -0
- package/dist/backup/site/import-index/sweep.d.ts +10 -0
- package/dist/backup/site/import-index/sweep.js +26 -0
- package/dist/backup/site/import-keep-off.d.ts +128 -0
- package/dist/backup/site/import-keep-off.js +204 -0
- package/dist/backup/site/import-plugin-state.d.ts +74 -0
- package/dist/backup/site/import-plugin-state.js +67 -0
- package/dist/backup/site/import-registry.d.ts +110 -0
- package/dist/backup/site/import-registry.js +205 -0
- package/dist/backup/site/import-restore-placement.d.ts +94 -0
- package/dist/backup/site/import-restore-placement.js +158 -0
- package/dist/backup/site/import-restore.d.ts +111 -0
- package/dist/backup/site/import-restore.js +120 -0
- package/dist/backup/site/import-verifier-inventory.d.ts +137 -0
- package/dist/backup/site/import-verifier-inventory.js +236 -0
- package/dist/backup/site/import-verifier-projection.d.ts +78 -0
- package/dist/backup/site/import-verifier-projection.js +100 -0
- package/dist/backup/site/import-verifier.d.ts +126 -0
- package/dist/backup/site/import-verifier.js +53 -0
- package/dist/backup/site/owned-temp-root.d.ts +12 -0
- package/dist/backup/site/owned-temp-root.js +2 -0
- package/dist/backup/site/package-file-inventory.d.ts +63 -0
- package/dist/backup/site/package-file-inventory.js +56 -0
- package/dist/backup/site/push-content.d.ts +70 -0
- package/dist/backup/site/push-content.js +56 -0
- package/dist/backup/site/react/ShowMoreImports.d.ts +21 -0
- package/dist/backup/site/react/ShowMoreImports.js +8 -0
- package/dist/backup/site/saved-keys-port.d.ts +47 -0
- package/dist/backup/site/saved-keys-port.js +3 -0
- package/dist/backup/site/saved-keys.d.ts +25 -0
- package/dist/backup/site/saved-keys.js +38 -0
- package/dist/backup/site/share-backend.d.ts +243 -0
- package/dist/backup/site/share-backend.js +284 -0
- package/dist/backup/site/share-database/projection.d.ts +197 -0
- package/dist/backup/site/share-database/projection.js +90 -0
- package/dist/backup/site/share-database/projection.media.d.ts +38 -0
- package/dist/backup/site/share-database/projection.media.js +179 -0
- package/dist/backup/site/share-database/projection.tables.d.ts +46 -0
- package/dist/backup/site/share-database/projection.tables.js +210 -0
- package/dist/backup/site/share-expiry.d.ts +75 -0
- package/dist/backup/site/share-expiry.js +49 -0
- package/dist/backup/site/share-export-failure.d.ts +17 -0
- package/dist/backup/site/share-export-failure.js +16 -0
- package/dist/backup/site/share-file-policy.d.ts +60 -0
- package/dist/backup/site/share-file-policy.js +146 -0
- package/dist/backup/site/share-hosting.d.ts +107 -0
- package/dist/backup/site/share-hosting.js +148 -0
- package/dist/backup/site/share-preparation-steps.d.ts +180 -0
- package/dist/backup/site/share-preparation-steps.js +107 -0
- package/dist/backup/site/share-preparation.d.ts +122 -0
- package/dist/backup/site/share-preparation.js +43 -0
- package/dist/backup/site/share-refusal.d.ts +21 -0
- package/dist/backup/site/share-refusal.js +20 -0
- package/dist/backup/site/share-registry.d.ts +124 -0
- package/dist/backup/site/share-registry.js +219 -0
- package/dist/backup/site/share-retention.d.ts +62 -0
- package/dist/backup/site/share-retention.js +126 -0
- package/dist/backup/site/share-service.d.ts +128 -0
- package/dist/backup/site/share-service.js +194 -0
- package/dist/backup/site/share-zip.d.ts +115 -0
- package/dist/backup/site/share-zip.js +144 -0
- package/dist/backup/site/sources.d.ts +344 -0
- package/dist/backup/site/sources.js +595 -0
- package/dist/backup/site/static-copy.d.ts +122 -0
- package/dist/backup/site/static-copy.js +165 -0
- package/dist/backup/site/static-download-html.d.ts +76 -0
- package/dist/backup/site/static-download-html.js +149 -0
- package/dist/backup/site/static-download-landing.d.ts +52 -0
- package/dist/backup/site/static-download-landing.js +95 -0
- package/dist/backup/site/static-download-layout.d.ts +96 -0
- package/dist/backup/site/static-download-layout.js +325 -0
- package/dist/backup/site/static-export-selection.d.ts +50 -0
- package/dist/backup/site/static-export-selection.js +75 -0
- package/dist/backup/site/static-site-packager.d.ts +42 -0
- package/dist/backup/site/static-site-packager.js +32 -0
- package/dist/backup/site/tool-registrations.d.ts +74 -0
- package/dist/backup/site/tool-registrations.js +204 -0
- package/dist/checks/complexity-debt.d.ts +100 -0
- package/dist/checks/complexity-debt.js +131 -0
- package/dist/checks/coverage/diff.js +5 -1
- package/dist/checks/coverage/lcov.js +1 -1
- package/dist/checks/env-access.d.ts +14 -1
- package/dist/checks/env-access.js +92 -6
- package/dist/checks/live-verify-checks.d.ts +29 -0
- package/dist/checks/live-verify-checks.js +30 -0
- package/dist/checks/quality-gates.d.ts +137 -0
- package/dist/checks/quality-gates.js +209 -0
- package/dist/core/deploy-types.d.ts +2 -0
- package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
- package/dist/deploy/admin-http/site-update-status.js +15 -0
- package/dist/deploy/host-kit.d.ts +3 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/index.js +6 -0
- package/dist/deploy/ops-runner.js +7 -0
- package/dist/deploy/ops-tool-contracts.d.ts +10 -1
- package/dist/deploy/react/Deployment.d.ts +37 -0
- package/dist/deploy/react/Deployment.js +94 -0
- package/dist/deploy/react/DockerfileTab.d.ts +72 -0
- package/dist/deploy/react/DockerfileTab.js +131 -0
- package/dist/deploy/react/HistoryTab.d.ts +43 -0
- package/dist/deploy/react/HistoryTab.js +12 -0
- package/dist/deploy/react/OverviewTab.d.ts +60 -0
- package/dist/deploy/react/OverviewTab.js +75 -0
- package/dist/deploy/react/PublishRunResult.d.ts +5 -1
- package/dist/deploy/react/PublishRunResult.js +4 -4
- package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
- package/dist/deploy/react/SiteUpdateNotice.js +25 -0
- package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
- package/dist/deploy/react/StaticCredentialFields.js +63 -0
- package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
- package/dist/deploy/react/StaticCredentialSteps.js +152 -0
- package/dist/deploy/react/StaticExportCard.d.ts +11 -0
- package/dist/deploy/react/StaticExportCard.js +97 -0
- package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
- package/dist/deploy/react/StaticPublishCredentials.js +77 -0
- package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
- package/dist/deploy/react/StaticPublishForm.js +91 -0
- package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
- package/dist/deploy/react/StaticSiteTab.js +117 -0
- package/dist/deploy/react/deployment-visuals.d.ts +207 -0
- package/dist/deploy/react/deployment-visuals.js +101 -0
- package/dist/deploy/react/download-dockerfile.d.ts +14 -0
- package/dist/deploy/react/download-dockerfile.js +15 -0
- package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
- package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
- package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
- package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
- package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
- package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
- package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
- package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
- package/dist/deploy/react/index.d.ts +4 -0
- package/dist/deploy/react/index.js +2 -0
- package/dist/deploy/react/rules.d.ts +363 -0
- package/dist/deploy/react/rules.js +314 -0
- package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
- package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
- package/dist/deploy/site/agent-tools.d.ts +42 -0
- package/dist/deploy/site/agent-tools.js +119 -0
- package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
- package/dist/deploy/site/deploy-config-registry.js +124 -0
- package/dist/deploy/site/deploy-config.d.ts +97 -0
- package/dist/deploy/site/deploy-config.js +115 -0
- package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
- package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
- package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
- package/dist/deploy/site/deploy-ops/registry.js +106 -0
- package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
- package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
- package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
- package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
- package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
- package/dist/deploy/site/deploy-targets/registry.js +130 -0
- package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
- package/dist/deploy/site/deploy-targets/types.js +2 -0
- package/dist/deploy/site/dockerfile.d.ts +137 -0
- package/dist/deploy/site/dockerfile.js +101 -0
- package/dist/deploy/site/export-run.d.ts +137 -0
- package/dist/deploy/site/export-run.js +152 -0
- package/dist/deploy/site/ports.d.ts +115 -0
- package/dist/deploy/site/ports.js +2 -0
- package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
- package/dist/deploy/site/publish-agent-tools.js +120 -0
- package/dist/deploy/site/publish-candidate.d.ts +26 -0
- package/dist/deploy/site/publish-candidate.js +37 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
- package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
- package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
- package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
- package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
- package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
- package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
- package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
- package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
- package/dist/deploy/site/publish-credentials/store.d.ts +321 -0
- package/dist/deploy/site/publish-credentials/store.js +367 -0
- package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
- package/dist/deploy/site/publish-credentials/types.js +2 -0
- package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
- package/dist/deploy/site/publish-tool-capabilities.js +175 -0
- package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
- package/dist/deploy/site/publish-tool-credential.js +284 -0
- package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
- package/dist/deploy/site/publish-tool-deps.js +15 -0
- package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
- package/dist/deploy/site/publish-tool-execution.js +313 -0
- package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
- package/dist/deploy/site/publish-tool-schema.js +38 -0
- package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
- package/dist/deploy/site/static-publish/adapter-export.js +89 -0
- package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
- package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
- package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
- package/dist/deploy/site/static-publish/adapter.js +321 -0
- package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
- package/dist/deploy/site/static-publish/admin-publish-read.js +118 -0
- package/dist/deploy/site/static-publish/credentials.d.ts +114 -0
- package/dist/deploy/site/static-publish/credentials.js +298 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
- package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
- package/dist/deploy/site/static-publish/inspection.js +69 -0
- package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
- package/dist/deploy/site/static-publish/publish-history.js +153 -0
- package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
- package/dist/deploy/site/static-publish/publish-run.js +186 -0
- package/dist/deploy/site/static-publish/types.d.ts +168 -0
- package/dist/deploy/site/static-publish/types.js +2 -0
- package/dist/deploy/site/static-publish/verify.d.ts +237 -0
- package/dist/deploy/site/static-publish/verify.js +284 -0
- package/dist/deploy/site/tool-registrations.d.ts +97 -0
- package/dist/deploy/site/tool-registrations.js +130 -0
- package/dist/deploy/site/types.d.ts +51 -0
- package/dist/deploy/site/types.js +2 -0
- package/dist/deploy/site-update/check-for-update.d.ts +19 -0
- package/dist/deploy/site-update/check-for-update.js +19 -0
- package/dist/deploy/site-update/contracts.d.ts +161 -0
- package/dist/deploy/site-update/contracts.js +94 -0
- package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
- package/dist/deploy/site-update/desktop-site-update.js +43 -0
- package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
- package/dist/deploy/site-update/fake-site-update.js +52 -0
- package/dist/deploy/site-update/run-site-update.d.ts +121 -0
- package/dist/deploy/site-update/run-site-update.js +219 -0
- package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
- package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
- package/dist/deploy/target-contracts.d.ts +3 -0
- package/dist/deploy/tool.d.ts +5 -8
- package/dist/deploy/tool.js +6 -9
- package/dist/dns/binding-sweeper.d.ts +72 -0
- package/dist/dns/binding-sweeper.js +53 -0
- package/dist/dns/index.d.ts +1 -0
- package/dist/dns/index.js +1 -0
- package/dist/dns/site/binding.repo.d.ts +71 -0
- package/dist/dns/site/binding.repo.js +45 -0
- package/dist/dns/site/dns-changes.d.ts +90 -0
- package/dist/dns/site/dns-changes.js +271 -0
- package/dist/dns/site/dns-tools.d.ts +46 -0
- package/dist/dns/site/dns-tools.js +204 -0
- package/dist/dns/site/mail-dns-status.d.ts +111 -0
- package/dist/dns/site/mail-dns-status.js +190 -0
- package/dist/dns/site/mail-dns-tools.d.ts +33 -0
- package/dist/dns/site/mail-dns-tools.js +62 -0
- package/dist/dns/site/mail-requirements.d.ts +30 -0
- package/dist/dns/site/mail-requirements.js +78 -0
- package/dist/dns/site/tool-deps.d.ts +21 -0
- package/dist/dns/site/tool-deps.js +2 -0
- package/dist/dns/site/tools.d.ts +74 -0
- package/dist/dns/site/tools.js +124 -0
- package/dist/local-dev/bind-host.d.ts +80 -0
- package/dist/local-dev/bind-host.js +90 -0
- package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
- package/dist/local-dev/dev-proxy-upstream.js +63 -0
- package/dist/local-dev/index.d.ts +28 -0
- package/dist/local-dev/index.js +25 -0
- package/dist/packaging/electron/archive.d.ts +2 -9
- package/dist/packaging/electron/asar-adapter.d.ts +2 -1
- package/dist/packaging/electron/entry.d.ts +2 -0
- package/dist/packaging/electron/move-to-applications.d.ts +165 -0
- package/dist/packaging/electron/move-to-applications.js +162 -0
- package/dist/packaging/electron/policies.d.ts +33 -4
- package/dist/packaging/electron/policies.js +29 -10
- package/dist/packaging/electron/ports.d.ts +1 -6
- package/dist/packaging/electron/staging.d.ts +11 -2
- package/dist/packaging/electron/staging.js +15 -5
- package/dist/packaging/electron/update-manifest-merge.js +0 -2
- package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
- package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
- package/dist/react/site-share-expiry/index.d.ts +2 -0
- package/dist/react/site-share-expiry/index.js +2 -0
- package/dist/source-control/react/ProvidersTab.d.ts +98 -0
- package/dist/source-control/react/ProvidersTab.js +195 -0
- package/dist/source-control/react/SourceControl.d.ts +51 -0
- package/dist/source-control/react/SourceControl.js +61 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
- package/dist/source-control/react/rules.d.ts +167 -0
- package/dist/source-control/react/rules.js +125 -0
- package/dist/source-control/react/source-control-visuals.d.ts +75 -0
- package/dist/source-control/react/source-control-visuals.js +48 -0
- package/dist/source-control/site/agent-tools.d.ts +5 -0
- package/dist/source-control/site/agent-tools.js +30 -0
- package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
- package/dist/source-control/site/bundled-provider-registry.js +37 -0
- package/dist/source-control/site/commit-schema.d.ts +40 -0
- package/dist/source-control/site/commit-schema.js +29 -0
- package/dist/source-control/site/commit-target.d.ts +26 -0
- package/dist/source-control/site/commit-target.js +58 -0
- package/dist/source-control/site/credential-form.d.ts +36 -0
- package/dist/source-control/site/credential-form.js +102 -0
- package/dist/source-control/site/credential-setup.d.ts +107 -0
- package/dist/source-control/site/credential-setup.js +216 -0
- package/dist/source-control/site/provider-kit.d.ts +37 -0
- package/dist/source-control/site/provider-kit.js +35 -0
- package/dist/source-control/site/provider-module.d.ts +251 -0
- package/dist/source-control/site/provider-module.js +2 -0
- package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
- package/dist/source-control/site/saved-key-bindings.js +4 -0
- package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
- package/dist/source-control/site/static-site-packager-port.js +2 -0
- package/dist/source-control/site/store.d.ts +209 -0
- package/dist/source-control/site/store.js +374 -0
- package/dist/source-control/site/store.validation.d.ts +72 -0
- package/dist/source-control/site/store.validation.js +168 -0
- package/dist/source-control/site/tool-registrations.d.ts +190 -0
- package/dist/source-control/site/tool-registrations.js +379 -0
- package/dist/static-export/asset-crawl.d.ts +30 -0
- package/dist/static-export/asset-crawl.js +71 -0
- package/dist/static-export/dynamic-asset-locations.d.ts +23 -0
- package/dist/static-export/dynamic-asset-locations.js +34 -0
- package/dist/static-export/html-url-locations.d.ts +3 -1
- package/dist/static-export/html-url-locations.js +43 -9
- package/dist/static-export/runner.js +26 -27
- package/dist/static-export/site/export-preflight.d.ts +48 -0
- package/dist/static-export/site/export-preflight.js +82 -0
- package/dist/static-export/site/media-original-urls.d.ts +57 -0
- package/dist/static-export/site/media-original-urls.js +109 -0
- package/dist/static-export/site/ports.d.ts +82 -0
- package/dist/static-export/site/ports.js +29 -0
- package/dist/static-export/site/public-origin-policy.d.ts +32 -0
- package/dist/static-export/site/public-origin-policy.js +68 -0
- package/dist/static-export/site/route-manifest.d.ts +65 -0
- package/dist/static-export/site/route-manifest.js +139 -0
- package/dist/static-export/site/site-exporter.d.ts +158 -0
- package/dist/static-export/site/site-exporter.js +112 -0
- package/dist/static-export/site/static-security-headers.d.ts +39 -0
- package/dist/static-export/site/static-security-headers.js +43 -0
- package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
- package/dist/static-export/site/theme-preview-manifest.js +28 -0
- package/dist/static-export/transforms.d.ts +1 -1
- package/dist/static-export/transforms.js +3 -3
- package/package.json +911 -7
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const MAX_ASSETS = 2000;
|
|
2
|
+
const MAX_DEPENDENCY_DEPTH = 8;
|
|
3
|
+
const MAX_JSON_BYTES = 1024 * 1024;
|
|
4
|
+
const MAX_TOTAL_JSON_BYTES = 8 * MAX_JSON_BYTES;
|
|
5
|
+
const TOTAL_JSON_LIMIT_REASON = `JSON asset discovery exceeds the ${MAX_TOTAL_JSON_BYTES} byte total limit.`;
|
|
6
|
+
export function createAssetCrawl(_required, _optional = {}) {
|
|
7
|
+
return { queue: [], queued: new Set(), failed: [], countRefused: false, depthRefused: false, jsonBytes: 0 };
|
|
8
|
+
}
|
|
9
|
+
/** Bound queue memory as well as requests. Report a limit once instead of silently making an
|
|
10
|
+
* incomplete artifact look successful, or retaining an unbounded list of refused references. */
|
|
11
|
+
export function enqueueAssets({ state, urls, depth, crawlCss }, _optional = {}) {
|
|
12
|
+
for (const url of urls) {
|
|
13
|
+
if (state.queued.has(url))
|
|
14
|
+
continue;
|
|
15
|
+
if (depth > MAX_DEPENDENCY_DEPTH) {
|
|
16
|
+
if (!state.depthRefused)
|
|
17
|
+
state.failed.push({ url, reason: `Asset discovery stopped after ${MAX_DEPENDENCY_DEPTH} dependency levels.` });
|
|
18
|
+
state.depthRefused = true;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (state.queue.length >= MAX_ASSETS) {
|
|
22
|
+
if (!state.countRefused)
|
|
23
|
+
state.failed.push({ url, reason: `Asset discovery stopped after ${MAX_ASSETS} assets.` });
|
|
24
|
+
state.countRefused = true;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
state.queued.add(url);
|
|
28
|
+
state.queue.push({ url, depth, crawlCss });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Charge actual streamed bytes, including failed attempts; Content-Length is untrusted. */
|
|
32
|
+
function chargeJsonBytes({ state, bytes, chunkBytes }, _optional = {}) {
|
|
33
|
+
state.jsonBytes += chunkBytes;
|
|
34
|
+
if (bytes > MAX_JSON_BYTES)
|
|
35
|
+
throw new Error(`JSON asset exceeds the ${MAX_JSON_BYTES} byte limit.`);
|
|
36
|
+
if (state.jsonBytes > MAX_TOTAL_JSON_BYTES)
|
|
37
|
+
throw new Error(TOTAL_JSON_LIMIT_REASON);
|
|
38
|
+
}
|
|
39
|
+
/** Bound JSON before allocating/parsing it. Other asset types retain their existing byte policy,
|
|
40
|
+
* so introducing recursive manifests does not impose a new size limit on public videos. */
|
|
41
|
+
export async function readAssetData({ response, state }, _optional = {}) {
|
|
42
|
+
if (!/\bjson\b/i.test(response.headers.get('content-type') ?? ''))
|
|
43
|
+
return Buffer.from(await response.arrayBuffer());
|
|
44
|
+
const reader = response.body?.getReader();
|
|
45
|
+
if (!reader)
|
|
46
|
+
return Buffer.alloc(0);
|
|
47
|
+
const chunks = [];
|
|
48
|
+
let bytes = 0;
|
|
49
|
+
try {
|
|
50
|
+
if (state.jsonBytes >= MAX_TOTAL_JSON_BYTES)
|
|
51
|
+
throw new Error(TOTAL_JSON_LIMIT_REASON);
|
|
52
|
+
for (;;) {
|
|
53
|
+
const chunk = await reader.read();
|
|
54
|
+
if (chunk.done)
|
|
55
|
+
break;
|
|
56
|
+
bytes += chunk.value.byteLength;
|
|
57
|
+
chargeJsonBytes({ state, bytes, chunkBytes: chunk.value.byteLength });
|
|
58
|
+
chunks.push(chunk.value);
|
|
59
|
+
}
|
|
60
|
+
return Buffer.concat(chunks, bytes);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// A cancellation failure must not replace the useful bounded-read refusal.
|
|
64
|
+
await reader.cancel().catch(() => { });
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
reader.releaseLock();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=asset-crawl.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HtmlUrlLocation } from './html-url-locations.js';
|
|
2
|
+
/** Per HTML document. A UTF-16 code unit needs at most three UTF-8 bytes, so this
|
|
3
|
+
* character budget also keeps scanned inline source below one MiB of UTF-8. */
|
|
4
|
+
export interface DynamicAssetBudget {
|
|
5
|
+
characters: number;
|
|
6
|
+
references: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function dynamicAssetBudget(_required: Record<string, never>, _optional?: {}): DynamicAssetBudget;
|
|
9
|
+
/** Whole root-relative paths only: markup, JSON blobs and executable expressions are not URLs.
|
|
10
|
+
* Prefix admission and path containment are still enforced by the existing crawl/write boundary. */
|
|
11
|
+
export declare function takeDynamicUrl({ value, budget }: {
|
|
12
|
+
value: string;
|
|
13
|
+
budget: DynamicAssetBudget;
|
|
14
|
+
}, _optional?: {}): boolean;
|
|
15
|
+
/** Tokenize comments and whole quoted strings, never execute JavaScript. Consuming whole
|
|
16
|
+
* strings keeps HTML examples inside a JS string from becoming references. Templates are
|
|
17
|
+
* deliberately opaque: interpolation may produce a completely different runtime URL. */
|
|
18
|
+
export declare function scriptAssetLocations({ script, start, budget }: {
|
|
19
|
+
script: string;
|
|
20
|
+
start: number;
|
|
21
|
+
budget: DynamicAssetBudget;
|
|
22
|
+
}, _optional?: {}): HtmlUrlLocation[];
|
|
23
|
+
//# sourceMappingURL=dynamic-asset-locations.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function dynamicAssetBudget(_required, _optional = {}) {
|
|
2
|
+
return { characters: 262144, references: 256 };
|
|
3
|
+
}
|
|
4
|
+
/** Whole root-relative paths only: markup, JSON blobs and executable expressions are not URLs.
|
|
5
|
+
* Prefix admission and path containment are still enforced by the existing crawl/write boundary. */
|
|
6
|
+
export function takeDynamicUrl({ value, budget }, _optional = {}) {
|
|
7
|
+
if (budget.references === 0 || value.length > 2048)
|
|
8
|
+
return false;
|
|
9
|
+
if (!/^\/(?!\/)[^\s\\'"<>`\x00-\x1f\x7f]*$/.test(value))
|
|
10
|
+
return false;
|
|
11
|
+
budget.references--;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/** Tokenize comments and whole quoted strings, never execute JavaScript. Consuming whole
|
|
15
|
+
* strings keeps HTML examples inside a JS string from becoming references. Templates are
|
|
16
|
+
* deliberately opaque: interpolation may produce a completely different runtime URL. */
|
|
17
|
+
export function scriptAssetLocations({ script, start, budget }, _optional = {}) {
|
|
18
|
+
const source = script.slice(0, budget.characters);
|
|
19
|
+
budget.characters -= source.length;
|
|
20
|
+
const tokens = /\/\/[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$)|`(?:\\[\s\S]|[^`\\])*`|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/g;
|
|
21
|
+
const locations = [];
|
|
22
|
+
for (const token of source.matchAll(tokens)) {
|
|
23
|
+
if (budget.references === 0)
|
|
24
|
+
break;
|
|
25
|
+
const text = token[0];
|
|
26
|
+
if (text[0] !== '"' && text[0] !== "'")
|
|
27
|
+
continue;
|
|
28
|
+
if (!takeDynamicUrl({ value: text.slice(1, -1), budget }))
|
|
29
|
+
continue;
|
|
30
|
+
locations.push({ start: start + token.index + 1, end: start + token.index + text.length - 1, kind: 'url' });
|
|
31
|
+
}
|
|
32
|
+
return locations;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=dynamic-asset-locations.js.map
|
|
@@ -9,7 +9,9 @@ export interface HtmlUrlLocation {
|
|
|
9
9
|
* @complexity O(n + a log a) in HTML bytes and source attributes; iterative traversal avoids recursion limits. */
|
|
10
10
|
export declare function htmlUrlLocations({ html }: {
|
|
11
11
|
html: string;
|
|
12
|
-
},
|
|
12
|
+
}, optional?: {
|
|
13
|
+
scriptAssets?: boolean;
|
|
14
|
+
}): HtmlUrlLocation[];
|
|
13
15
|
/** CSS, Markdown indexes, sitemap and manifest positions use their response format, never an HTML text scan. */
|
|
14
16
|
export declare function exportUrlLocations({ body, contentType }: {
|
|
15
17
|
body: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parse } from 'parse5';
|
|
2
2
|
import { cssUrlTokens } from './css-urls.js';
|
|
3
|
+
import { dynamicAssetBudget, scriptAssetLocations, takeDynamicUrl } from './dynamic-asset-locations.js';
|
|
3
4
|
const URL_ATTRIBUTES = new Set(['src', 'href', 'poster']);
|
|
4
5
|
/** The exact attribute value range, preserving quotes, spacing and all surrounding source bytes. */
|
|
5
6
|
function attributeLocation({ html, start, end, kind }, _optional = {}) {
|
|
@@ -39,8 +40,10 @@ function normalizedUrlAttribute(name) {
|
|
|
39
40
|
function styleLocations({ element }, _optional = {}) {
|
|
40
41
|
if (element.tagName !== 'style')
|
|
41
42
|
return [];
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// parse5 emits style's raw text children with locations when sourceCodeLocationInfo is on.
|
|
44
|
+
return element.childNodes.map(child => ({
|
|
45
|
+
start: child.sourceCodeLocation.startOffset, end: child.sourceCodeLocation.endOffset, kind: 'css',
|
|
46
|
+
}));
|
|
44
47
|
}
|
|
45
48
|
/** Canonical identity and feed discovery must remain absolute when a download relocates files. */
|
|
46
49
|
function isIdentityLink({ element }, _optional = {}) {
|
|
@@ -50,11 +53,25 @@ function isIdentityLink({ element }, _optional = {}) {
|
|
|
50
53
|
const type = element.attrs.find(attr => attr.name === 'type')?.value.toLowerCase();
|
|
51
54
|
return rel.includes('canonical') || (rel.includes('alternate') && (type === 'application/rss+xml' || type === 'application/atom+xml'));
|
|
52
55
|
}
|
|
53
|
-
/**
|
|
54
|
-
function
|
|
56
|
+
/** Only inline JavaScript and JSON scripts supply literal assets, never external-script fallback text. */
|
|
57
|
+
function inlineLocations({ element, html, budget }, _optional = {}) {
|
|
58
|
+
if (element.tagName !== 'script' || element.attrs.some(attr => attr.name === 'src'))
|
|
59
|
+
return [];
|
|
60
|
+
const type = element.attrs.find(attr => attr.name === 'type')?.value.trim().toLowerCase() ?? '';
|
|
61
|
+
if (!/^(?:|module|(?:text|application)\/(?:javascript|ecmascript)|application\/(?:ld\+)?json)$/.test(type))
|
|
62
|
+
return [];
|
|
63
|
+
const source = element.sourceCodeLocation;
|
|
64
|
+
if (!source?.startTag)
|
|
65
|
+
return [];
|
|
66
|
+
const start = source.startTag.endOffset;
|
|
67
|
+
return scriptAssetLocations({ script: html.slice(start, source.endTag?.startOffset ?? source.endOffset), start, budget });
|
|
68
|
+
}
|
|
69
|
+
/** Collect real URL/style positions and bounded whole-URL data attributes. Inline literals
|
|
70
|
+
* are discovery-only so relocating output never changes authored JavaScript semantics. */
|
|
71
|
+
function elementLocations({ element, html, budget }, _optional = {}) {
|
|
55
72
|
const locations = [];
|
|
56
73
|
for (const attr of element.attrs) {
|
|
57
|
-
const kind =
|
|
74
|
+
const kind = assetAttributeKind({ element, attr, budget });
|
|
58
75
|
const source = element.sourceCodeLocation?.attrs?.[attr.name];
|
|
59
76
|
if (!kind || !source)
|
|
60
77
|
continue;
|
|
@@ -65,21 +82,38 @@ function elementLocations({ element, html }, _optional = {}) {
|
|
|
65
82
|
locations.push(...styleLocations({ element }));
|
|
66
83
|
return locations;
|
|
67
84
|
}
|
|
85
|
+
function assetAttributeKind({ element, attr, budget }, _optional = {}) {
|
|
86
|
+
const kind = attributeKind({ element, name: attr.name });
|
|
87
|
+
if (kind)
|
|
88
|
+
return kind;
|
|
89
|
+
if (!attr.name.startsWith('data-'))
|
|
90
|
+
return undefined;
|
|
91
|
+
return takeDynamicUrl({ value: attr.value, budget }) ? 'url' : undefined;
|
|
92
|
+
}
|
|
68
93
|
/** Source ranges from the workspace's HTML parser; no serialization can alter article content.
|
|
69
94
|
* @complexity O(n + a log a) in HTML bytes and source attributes; iterative traversal avoids recursion limits. */
|
|
70
|
-
export function htmlUrlLocations({ html },
|
|
95
|
+
export function htmlUrlLocations({ html }, optional = {}) {
|
|
71
96
|
const pending = [parse(html, { sourceCodeLocationInfo: true })];
|
|
72
97
|
const locations = [];
|
|
98
|
+
const budget = dynamicAssetBudget({});
|
|
99
|
+
const scripts = [];
|
|
73
100
|
while (pending.length) {
|
|
74
101
|
const node = pending.pop();
|
|
75
102
|
if ('childNodes' in node)
|
|
76
|
-
for (const child of node.childNodes)
|
|
103
|
+
for (const child of [...node.childNodes].reverse())
|
|
77
104
|
pending.push(child);
|
|
78
|
-
if ('tagName' in node)
|
|
79
|
-
locations.push(...elementLocations({ element: node, html }));
|
|
105
|
+
if ('tagName' in node) {
|
|
106
|
+
locations.push(...elementLocations({ element: node, html, budget }));
|
|
107
|
+
if (node.tagName === 'script')
|
|
108
|
+
scripts.push(node);
|
|
109
|
+
}
|
|
80
110
|
if ('content' in node)
|
|
81
111
|
pending.push(node.content);
|
|
82
112
|
}
|
|
113
|
+
// Attributes have priority so crawl admission matches base-path rewriting, which never scans JS.
|
|
114
|
+
if (optional.scriptAssets)
|
|
115
|
+
for (const element of scripts)
|
|
116
|
+
locations.push(...inlineLocations({ element, html, budget }));
|
|
83
117
|
return locations.sort((a, b) => a.start - b.start);
|
|
84
118
|
}
|
|
85
119
|
/** Generated llms indexes use one Markdown list link per line; prose stays untouched.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExportPathError } from "./contracts.js";
|
|
2
2
|
import { extractAssetUrls, extractHtmlReferences, extractCssUrls, normalizeBasePath, outputFileForUrl, redirectOutcomeFor, renderRedirectStub, rewriteRouteBodyForBasePath, rewriteAssetBodyForBasePath, safeRelativeOutputFile } from './transforms.js';
|
|
3
3
|
import { trimCharsEnd } from '@jini-ai/core/primitives';
|
|
4
|
+
import { createAssetCrawl, enqueueAssets, readAssetData } from './asset-crawl.js';
|
|
4
5
|
const BASE_PATH_REWRITE_WARNING = "base-path rewriting is a best-effort TEXT rewrite over already-rendered responses — it cannot rewrite a path a theme's own JavaScript constructs at runtime from a string (same category of gap as the unreferenced-theme-file warning, just invisible to this rewrite instead of to the asset crawl).";
|
|
5
6
|
async function request(ctx, url) {
|
|
6
7
|
// Redirects are observed, never followed off the caller's app, for routes and assets alike.
|
|
@@ -111,32 +112,32 @@ async function writeAndScanRoute({ ctx, route, state }, out) {
|
|
|
111
112
|
out.assets.add(url);
|
|
112
113
|
enqueueDiscovered({ state, routes: ctx.args.discoverRoutes?.({ path: route.path, html }) ?? [] });
|
|
113
114
|
}
|
|
114
|
-
async function fetchAsset(
|
|
115
|
-
const {
|
|
115
|
+
async function fetchAsset({ ctx, item, state }, _optional = {}) {
|
|
116
|
+
const { url } = item;
|
|
116
117
|
const outputFile = outputFileForUrl({ url });
|
|
117
118
|
const response = await request(ctx, url);
|
|
118
119
|
if (!response.ok) {
|
|
119
120
|
await response.body?.cancel();
|
|
120
121
|
return { reason: `GET ${url} -> ${response.status}` };
|
|
121
122
|
}
|
|
122
|
-
let data =
|
|
123
|
+
let data = await readAssetData({ response, state });
|
|
123
124
|
const contentType = response.headers.get('content-type');
|
|
124
|
-
const children =
|
|
125
|
+
const children = assetChildren({ ctx, asset: { url, outputFile, data, contentType }, crawlCss: item.crawlCss });
|
|
125
126
|
if (/^(?:text\/css|application\/(?:[\w.+-]*\+)?json)\b/.test(contentType ?? '')) {
|
|
126
127
|
data = Buffer.from(rewriteAssetBodyForBasePath({ body: data.toString('utf8'), contentType: contentType, basePath: ctx.basePath }));
|
|
127
128
|
}
|
|
128
129
|
await ctx.args.writer.write({ outputDir: ctx.args.outputDir, outputFile, data });
|
|
129
130
|
return { asset: { url, outputFile, data, contentType }, children };
|
|
130
131
|
}
|
|
131
|
-
/**
|
|
132
|
-
function
|
|
132
|
+
/** JSON dependencies are recursive within the crawl budget. CSS retains its single-hop policy. */
|
|
133
|
+
function assetChildren(required, _optional = {}) {
|
|
133
134
|
const { ctx, asset } = required;
|
|
135
|
+
if (/\bjson\b/i.test(asset.contentType ?? ''))
|
|
136
|
+
return extractAssetUrls({ html: asset.data.toString('utf8'), prefixes: ctx.args.assetUrlPrefixes }, { format: 'json' });
|
|
134
137
|
if (!required.crawlCss)
|
|
135
138
|
return [];
|
|
136
139
|
if (asset.url.split('?')[0].endsWith('.css'))
|
|
137
140
|
return extractCssUrls({ css: asset.data.toString('utf8'), cssUrl: asset.url, prefixes: ctx.args.assetUrlPrefixes });
|
|
138
|
-
if (/\bjson\b/.test(asset.contentType ?? ''))
|
|
139
|
-
return extractAssetUrls({ html: asset.data.toString('utf8'), prefixes: ctx.args.assetUrlPrefixes }, { format: 'json' });
|
|
140
141
|
return [];
|
|
141
142
|
}
|
|
142
143
|
function assetFailureReason(required) {
|
|
@@ -145,39 +146,37 @@ function assetFailureReason(required) {
|
|
|
145
146
|
}
|
|
146
147
|
/** Fetch one asset and queue its children, returning its physical output claim on success.
|
|
147
148
|
* Failed variants leave the destination available for another URL's retry. */
|
|
148
|
-
async function fetchAndQueueAsset({ ctx,
|
|
149
|
-
const outcome = await fetchAsset({ ctx,
|
|
149
|
+
async function fetchAndQueueAsset({ ctx, item, state, succeeded }, _optional = {}) {
|
|
150
|
+
const outcome = await fetchAsset({ ctx, item, state });
|
|
150
151
|
if ('reason' in outcome) {
|
|
151
|
-
|
|
152
|
+
state.failed.push({ url: item.url, reason: outcome.reason });
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
queue.push({ url: child, crawlCss: false });
|
|
155
|
+
succeeded.push(outcome.asset);
|
|
156
|
+
enqueueAssets({ state, urls: outcome.children, depth: item.depth + 1, crawlCss: false });
|
|
157
157
|
return outcome.asset.outputFile;
|
|
158
158
|
}
|
|
159
|
-
async function writeAssets(ctx, initial) {
|
|
160
|
-
const succeeded = []
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
seen.add(url);
|
|
159
|
+
async function writeAssets({ ctx, initial }, _optional = {}) {
|
|
160
|
+
const succeeded = [];
|
|
161
|
+
const state = createAssetCrawl({});
|
|
162
|
+
const written = new Set();
|
|
163
|
+
enqueueAssets({ state, urls: initial, depth: 0, crawlCss: true });
|
|
164
|
+
for (let index = 0; index < state.queue.length; index++) {
|
|
165
|
+
const item = state.queue[index];
|
|
166
|
+
const { url } = item;
|
|
168
167
|
try {
|
|
169
168
|
// Query/cache variants share one static filename; report exactly the file the writer owns.
|
|
170
169
|
if (written.has(outputFileForUrl({ url })))
|
|
171
170
|
continue;
|
|
172
|
-
const outputFile = await fetchAndQueueAsset({ ctx,
|
|
171
|
+
const outputFile = await fetchAndQueueAsset({ ctx, item, state, succeeded });
|
|
173
172
|
if (outputFile !== undefined)
|
|
174
173
|
written.add(outputFile);
|
|
175
174
|
}
|
|
176
175
|
catch (error) {
|
|
177
|
-
failed.push({ url, reason: assetFailureReason({ ctx, url, error }) });
|
|
176
|
+
state.failed.push({ url, reason: assetFailureReason({ ctx, url, error }) });
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
|
-
return { succeeded, failed };
|
|
179
|
+
return { succeeded, failed: state.failed };
|
|
181
180
|
}
|
|
182
181
|
async function unreferenced(ctx, manifest, assets) {
|
|
183
182
|
if (!manifest.activeTheme)
|
|
@@ -312,7 +311,7 @@ export async function exportSite(required, optional = {}) {
|
|
|
312
311
|
const ctx = { args: required, baseUrl: sessionOrigin({ baseUrl: session.baseUrl }), basePath, timeoutMs };
|
|
313
312
|
const routes = await writeRoutes(ctx, manifest.routes);
|
|
314
313
|
const explicitAssets = typeof required.assetUrls === 'function' ? await required.assetUrls() : required.assetUrls ?? [];
|
|
315
|
-
const assets = await writeAssets(ctx, [...routes.assets, ...explicitAssets]);
|
|
314
|
+
const assets = await writeAssets({ ctx, initial: [...routes.assets, ...explicitAssets] });
|
|
316
315
|
return { outputDir: required.outputDir, routes: { succeeded: routes.succeeded, failed: routes.failed }, assets, skippedManifestEntries: [...manifest.skipped, ...routes.skipped],
|
|
317
316
|
droppedReferences: droppedReferences({ routes: routes.succeeded, assets: assets.succeeded, basePath, baseUrl: ctx.baseUrl }),
|
|
318
317
|
unreferencedThemeFiles: await unreferenced(ctx, manifest, assets.succeeded), ...(basePath ? { basePath, basePathRewriteWarning: BASE_PATH_REWRITE_WARNING } : {}) };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Export/publish pre-flight checks over the rendered page HTML (A421, A400). Pure detectors
|
|
3
|
+
* plus a per-export collector; the exporter feeds it every page it writes and folds the result into
|
|
4
|
+
* the report's existing `consentWarning` field, the only warning channel that already reaches the
|
|
5
|
+
* publish outcome (admin card and assistant message). Warnings never block: the owner decides.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExportPreflightCopy {
|
|
8
|
+
readonly contactEmailPlaceholder: string;
|
|
9
|
+
readonly placeholderWarning: (required: {
|
|
10
|
+
pages: number;
|
|
11
|
+
}, optional?: Record<string, never>) => string | undefined;
|
|
12
|
+
readonly thirdPartyWarning: (required: {
|
|
13
|
+
pages: number;
|
|
14
|
+
hosts: readonly string[];
|
|
15
|
+
}, optional?: Record<string, never>) => string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** Whether the page still carries the privacy template's contact placeholder. @complexity O(n) in page bytes. */
|
|
18
|
+
export declare function findContactEmailPlaceholder({ html, placeholder }: {
|
|
19
|
+
html: string;
|
|
20
|
+
placeholder: string;
|
|
21
|
+
}, _optional?: {}): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Hosts of external scripts written straight into a page. Relative and same-site sources are
|
|
24
|
+
* first-party; templates are inert authored content and are not entered.
|
|
25
|
+
* @complexity O(sample bytes), at most 1 MB per page.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findThirdPartyScriptHosts({ html, ownHosts }: {
|
|
28
|
+
html: string;
|
|
29
|
+
ownHosts: ReadonlySet<string>;
|
|
30
|
+
}, _optional?: {}): string[];
|
|
31
|
+
/** One export's collector. State lives in this closure, created per export, never at module level. */
|
|
32
|
+
export declare function createExportPreflight({ ownOrigins, copy }: {
|
|
33
|
+
ownOrigins: readonly unknown[];
|
|
34
|
+
copy: ExportPreflightCopy;
|
|
35
|
+
}, _optional?: {}): {
|
|
36
|
+
observePage({ html }: {
|
|
37
|
+
html: string;
|
|
38
|
+
}, _optional?: {}): void;
|
|
39
|
+
/** Third-party scripts only matter once a cookie banner is promising to manage consent. */
|
|
40
|
+
setConsentConfigured({ configured }: {
|
|
41
|
+
configured: boolean;
|
|
42
|
+
}, _optional?: {}): void;
|
|
43
|
+
/** The existing warning with this export's pre-flight warnings appended; undefined when there are none. */
|
|
44
|
+
joinWarnings({ existing }: {
|
|
45
|
+
existing: string | undefined;
|
|
46
|
+
}, _optional?: {}): string | undefined;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=export-preflight.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { parse } from "parse5";
|
|
2
|
+
const MAX_SAMPLE_BYTES = 1_000_000;
|
|
3
|
+
/** Whether the page still carries the privacy template's contact placeholder. @complexity O(n) in page bytes. */
|
|
4
|
+
export function findContactEmailPlaceholder({ html, placeholder }, _optional = {}) {
|
|
5
|
+
return html.includes(placeholder);
|
|
6
|
+
}
|
|
7
|
+
function hostOf({ value }, _optional = {}) {
|
|
8
|
+
if (typeof value !== "string")
|
|
9
|
+
return undefined;
|
|
10
|
+
try {
|
|
11
|
+
return new URL(value, "https://site.invalid").host.toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** The other-origin host a hand-written `<script src>` loads from; declared (consent-managed) scripts are skipped. */
|
|
18
|
+
function authoredScriptHost({ node, ownHosts }, _optional = {}) {
|
|
19
|
+
if (node.tagName !== "script")
|
|
20
|
+
return undefined;
|
|
21
|
+
const attrs = new Map(node.attrs.map(attr => [attr.name, attr.value]));
|
|
22
|
+
const src = attrs.get("src");
|
|
23
|
+
if (!src || attrs.has("data-jini-declared-script"))
|
|
24
|
+
return undefined;
|
|
25
|
+
try {
|
|
26
|
+
const url = new URL(src, "https://site.invalid");
|
|
27
|
+
const host = url.host.toLowerCase();
|
|
28
|
+
return (url.protocol === "https:" || url.protocol === "http:") && host !== "site.invalid" && !ownHosts.has(host) ? host : undefined;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Hosts of external scripts written straight into a page. Relative and same-site sources are
|
|
36
|
+
* first-party; templates are inert authored content and are not entered.
|
|
37
|
+
* @complexity O(sample bytes), at most 1 MB per page.
|
|
38
|
+
*/
|
|
39
|
+
export function findThirdPartyScriptHosts({ html, ownHosts }, _optional = {}) {
|
|
40
|
+
if (!html.toLowerCase().includes("<script"))
|
|
41
|
+
return []; // HTML tag names are case-insensitive; the parser sorts the rest.
|
|
42
|
+
const hosts = new Set();
|
|
43
|
+
const nodes = [...parse(html.slice(0, MAX_SAMPLE_BYTES)).childNodes];
|
|
44
|
+
while (nodes.length) {
|
|
45
|
+
const node = nodes.pop();
|
|
46
|
+
if (node === undefined || !("tagName" in node))
|
|
47
|
+
continue;
|
|
48
|
+
const host = authoredScriptHost({ node, ownHosts });
|
|
49
|
+
if (host !== undefined)
|
|
50
|
+
hosts.add(host);
|
|
51
|
+
if (node.tagName !== "template")
|
|
52
|
+
nodes.push(...node.childNodes);
|
|
53
|
+
}
|
|
54
|
+
return [...hosts].sort();
|
|
55
|
+
}
|
|
56
|
+
/** One export's collector. State lives in this closure, created per export, never at module level. */
|
|
57
|
+
export function createExportPreflight({ ownOrigins, copy }, _optional = {}) {
|
|
58
|
+
const ownHosts = new Set(ownOrigins.flatMap(value => hostOf({ value }) ?? []));
|
|
59
|
+
const found = { placeholderPages: 0, thirdPartyPages: 0, hosts: new Set(), consentConfigured: false };
|
|
60
|
+
return {
|
|
61
|
+
observePage({ html }, _optional = {}) {
|
|
62
|
+
if (findContactEmailPlaceholder({ html, placeholder: copy.contactEmailPlaceholder }))
|
|
63
|
+
found.placeholderPages += 1;
|
|
64
|
+
const hosts = findThirdPartyScriptHosts({ html, ownHosts });
|
|
65
|
+
if (hosts.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
found.thirdPartyPages += 1;
|
|
68
|
+
for (const host of hosts)
|
|
69
|
+
found.hosts.add(host);
|
|
70
|
+
},
|
|
71
|
+
/** Third-party scripts only matter once a cookie banner is promising to manage consent. */
|
|
72
|
+
setConsentConfigured({ configured }, _optional = {}) { found.consentConfigured = configured; },
|
|
73
|
+
/** The existing warning with this export's pre-flight warnings appended; undefined when there are none. */
|
|
74
|
+
joinWarnings({ existing }, _optional = {}) {
|
|
75
|
+
const warnings = [existing, copy.placeholderWarning({ pages: found.placeholderPages }),
|
|
76
|
+
found.consentConfigured ? copy.thirdPartyWarning({ pages: found.thirdPartyPages, hosts: [...found.hosts].sort() }) : undefined]
|
|
77
|
+
.filter((warning) => warning !== undefined && warning !== "");
|
|
78
|
+
return warnings.length === 0 ? undefined : warnings.join(" ");
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=export-preflight.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { OriginRegistryPort } from "@jini-ai/core/contracts/server/verified-origin";
|
|
2
|
+
export interface ExportMediaUrlDeps<R extends {
|
|
3
|
+
status: string;
|
|
4
|
+
kind?: string | undefined;
|
|
5
|
+
source: {
|
|
6
|
+
sha256: string;
|
|
7
|
+
};
|
|
8
|
+
}> {
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
originRegistry: Pick<OriginRegistryPort, "canonicalOrigin">;
|
|
11
|
+
findMedia(required: {
|
|
12
|
+
workspaceId: string;
|
|
13
|
+
idOrSlug: string;
|
|
14
|
+
}, optional?: Record<string, never>): Promise<R | null>;
|
|
15
|
+
resolveContentTypes(required: {
|
|
16
|
+
media: readonly R[];
|
|
17
|
+
}, optional?: Record<string, never>): Promise<ReadonlyMap<string, string>>;
|
|
18
|
+
mediaPublicPath(required: {
|
|
19
|
+
key: string;
|
|
20
|
+
sha256: string;
|
|
21
|
+
variant: {
|
|
22
|
+
kind: "original";
|
|
23
|
+
contentType: string;
|
|
24
|
+
};
|
|
25
|
+
}, optional?: Record<string, never>): string;
|
|
26
|
+
}
|
|
27
|
+
/** Upgrade stored URLs using the same lookup and read-path type backfill as the media library.
|
|
28
|
+
* O(text length + URL positions log URL positions + distinct media keys) work, one batched type lookup; legacy bytes read only
|
|
29
|
+
* when their type was never recorded. Missing/private documents retain their existing URLs.
|
|
30
|
+
*/
|
|
31
|
+
export declare function rewriteMediaOriginalUrls<R extends {
|
|
32
|
+
status: string;
|
|
33
|
+
kind?: string | undefined;
|
|
34
|
+
source: {
|
|
35
|
+
sha256: string;
|
|
36
|
+
};
|
|
37
|
+
}>({ body, deps }: {
|
|
38
|
+
body: string;
|
|
39
|
+
deps: ExportMediaUrlDeps<R>;
|
|
40
|
+
}, { contentType }?: {
|
|
41
|
+
contentType?: string;
|
|
42
|
+
}): Promise<string>;
|
|
43
|
+
/** Rewrite textual responses before the existing exporter writes AND crawls them. Binary responses
|
|
44
|
+
* stay streaming and untouched. Response headers remain authoritative except for the byte length,
|
|
45
|
+
* which must be recalculated after a text rewrite. No extra HTTP requests or renderer are used.
|
|
46
|
+
*/
|
|
47
|
+
export declare function rewriteExportMediaResponse<R extends {
|
|
48
|
+
status: string;
|
|
49
|
+
kind?: string | undefined;
|
|
50
|
+
source: {
|
|
51
|
+
sha256: string;
|
|
52
|
+
};
|
|
53
|
+
}>({ response, deps }: {
|
|
54
|
+
response: Response;
|
|
55
|
+
deps: ExportMediaUrlDeps<R>;
|
|
56
|
+
}, _optional?: Record<string, never>): Promise<Response>;
|
|
57
|
+
//# sourceMappingURL=media-original-urls.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { exportUrlLocations } from "../html-url-locations.js";
|
|
2
|
+
// Match complete local media paths in HTML, CSS, XML and JSON, retaining query/fragment tails.
|
|
3
|
+
// Check absolute URLs against the configured origin: another site's /m/ namespace is not ours.
|
|
4
|
+
const ORIGINAL_URL = /(?<![\w/.:%-])((?:https?:)?\/\/[^/\s"'<>\\()]+)?\/m\/([^/\s"'<>\\()?#]+)\/original(?![^\s"'<>\\()?#,;])(?:\?[^\s"'<>\\()#]*)?/g;
|
|
5
|
+
/** Same origin as the configured site; an unparsable URL is never ours. */
|
|
6
|
+
function sameOrigin({ url, origin }) {
|
|
7
|
+
// Both sides go through URL so an explicit default port (`:443`) compares equal to none.
|
|
8
|
+
try {
|
|
9
|
+
return new URL(url, origin).origin === new URL(origin).origin;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** The configured origin as text, keeping a verified non-default port (as site-exporter does). */
|
|
16
|
+
function originText({ scheme, host, port }, _optional = {}) {
|
|
17
|
+
const suffix = port === undefined ? "" : `:${port}`;
|
|
18
|
+
return `${scheme}://${host}${suffix}`;
|
|
19
|
+
}
|
|
20
|
+
function decodeOriginalMediaKey(raw) {
|
|
21
|
+
if (raw === undefined)
|
|
22
|
+
return undefined;
|
|
23
|
+
try {
|
|
24
|
+
return decodeURIComponent(raw);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Local paths need no origin lookup; absolute references must belong to the configured site.
|
|
31
|
+
* With no verified origin, absolute references stay as written: a link must never fail the export. */
|
|
32
|
+
async function localOriginalPaths({ body, deps, locations }, _optional = {}) {
|
|
33
|
+
const matches = locations.flatMap(({ start, end }) => [...body.slice(start, end).matchAll(ORIGINAL_URL)]);
|
|
34
|
+
const paths = new Map();
|
|
35
|
+
let origin;
|
|
36
|
+
for (const match of matches) {
|
|
37
|
+
if (match[1]) {
|
|
38
|
+
origin ??= await deps.originRegistry.canonicalOrigin({ workspaceId: deps.workspaceId })
|
|
39
|
+
.then(configured => originText(configured), () => null);
|
|
40
|
+
if (!origin || !sameOrigin({ url: match[0], origin }))
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const key = decodeOriginalMediaKey(match[2]);
|
|
44
|
+
// Absolute URLs stay absolute (sitemaps and og:image require them); only the path is upgraded.
|
|
45
|
+
if (key !== undefined)
|
|
46
|
+
paths.set(match[0], { prefix: match[1] ?? "", key });
|
|
47
|
+
}
|
|
48
|
+
return paths;
|
|
49
|
+
}
|
|
50
|
+
/** Upgrade stored URLs using the same lookup and read-path type backfill as the media library.
|
|
51
|
+
* O(text length + URL positions log URL positions + distinct media keys) work, one batched type lookup; legacy bytes read only
|
|
52
|
+
* when their type was never recorded. Missing/private documents retain their existing URLs.
|
|
53
|
+
*/
|
|
54
|
+
export async function rewriteMediaOriginalUrls({ body, deps }, { contentType = "text/html" } = {}) {
|
|
55
|
+
// Parsed once: the same URL positions are scanned for keys and then rewritten.
|
|
56
|
+
const locations = exportUrlLocations({ body, contentType });
|
|
57
|
+
const paths = await localOriginalPaths({ body, deps, locations });
|
|
58
|
+
if (paths.size === 0)
|
|
59
|
+
return body;
|
|
60
|
+
const records = await exportableMediaRecords({ paths, deps });
|
|
61
|
+
const contentTypes = await deps.resolveContentTypes({ media: [...records.values()] });
|
|
62
|
+
const replacements = new Map();
|
|
63
|
+
for (const [url, record] of records) {
|
|
64
|
+
const type = contentTypes.get(record.source.sha256);
|
|
65
|
+
const path = paths.get(url);
|
|
66
|
+
if (path === undefined)
|
|
67
|
+
throw new Error("Export media record has no matching URL path");
|
|
68
|
+
const { prefix, key } = path;
|
|
69
|
+
const query = new URL(url, "https://export.invalid").searchParams;
|
|
70
|
+
query.delete("v");
|
|
71
|
+
if (type)
|
|
72
|
+
replacements.set(url, prefix + deps.mediaPublicPath({ key, sha256: record.source.sha256, variant: { kind: "original", contentType: type } }) + (query.size ? `&${query}` : ""));
|
|
73
|
+
}
|
|
74
|
+
const output = [];
|
|
75
|
+
let offset = 0;
|
|
76
|
+
for (const { start, end } of locations) {
|
|
77
|
+
const value = body.slice(start, end).replace(ORIGINAL_URL, url => replacements.get(url) ?? url);
|
|
78
|
+
output.push(body.slice(offset, start), value);
|
|
79
|
+
offset = end;
|
|
80
|
+
}
|
|
81
|
+
output.push(body.slice(offset));
|
|
82
|
+
return output.join('');
|
|
83
|
+
}
|
|
84
|
+
/** Missing, inactive and document records keep their original URL; lookups remain sequential. */
|
|
85
|
+
async function exportableMediaRecords({ paths, deps }, _optional = {}) {
|
|
86
|
+
const records = new Map();
|
|
87
|
+
for (const [url, { key }] of paths) {
|
|
88
|
+
const record = await deps.findMedia({ workspaceId: deps.workspaceId, idOrSlug: key });
|
|
89
|
+
if (record && record.status === "active" && record.kind !== "document")
|
|
90
|
+
records.set(url, record);
|
|
91
|
+
}
|
|
92
|
+
return records;
|
|
93
|
+
}
|
|
94
|
+
/** Rewrite textual responses before the existing exporter writes AND crawls them. Binary responses
|
|
95
|
+
* stay streaming and untouched. Response headers remain authoritative except for the byte length,
|
|
96
|
+
* which must be recalculated after a text rewrite. No extra HTTP requests or renderer are used.
|
|
97
|
+
*/
|
|
98
|
+
export async function rewriteExportMediaResponse({ response, deps }, _optional = {}) {
|
|
99
|
+
if (response.body === null)
|
|
100
|
+
return response;
|
|
101
|
+
if (!/^(?:text\/(?:html|css)|application\/(?:[\w.+-]*\+)?(?:json|xml))\b/i.test(response.headers.get("content-type") ?? ""))
|
|
102
|
+
return response;
|
|
103
|
+
const body = await rewriteMediaOriginalUrls({ body: await response.text(), deps }, { contentType: response.headers.get("content-type") ?? "" });
|
|
104
|
+
const headers = new Headers(response.headers);
|
|
105
|
+
headers.delete("content-length");
|
|
106
|
+
headers.delete("content-encoding");
|
|
107
|
+
return new Response(body, { status: response.status, statusText: response.statusText, headers });
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=media-original-urls.js.map
|