ontrackd 0.0.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +126 -2
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.js +172 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cloud.d.ts +20 -0
- package/dist/cli/cloud.js +395 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/feedback.d.ts +4 -0
- package/dist/cli/feedback.js +90 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/hugo.d.ts +1 -0
- package/dist/cli/hugo.js +396 -0
- package/dist/cli/hugo.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +346 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/invite.d.ts +2 -0
- package/dist/cli/invite.js +65 -0
- package/dist/cli/invite.js.map +1 -0
- package/dist/cli/link.d.ts +20 -0
- package/dist/cli/link.js +287 -0
- package/dist/cli/link.js.map +1 -0
- package/dist/cli/pull.d.ts +31 -0
- package/dist/cli/pull.js +273 -0
- package/dist/cli/pull.js.map +1 -0
- package/dist/cli/push.d.ts +9 -0
- package/dist/cli/push.js +57 -0
- package/dist/cli/push.js.map +1 -0
- package/dist/cli/remote.d.ts +1 -0
- package/dist/cli/remote.js +114 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/cli/serve.d.ts +1 -0
- package/dist/cli/serve.js +178 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/sidecar.d.ts +9 -0
- package/dist/cli/sidecar.js +23 -0
- package/dist/cli/sidecar.js.map +1 -0
- package/dist/core/anchorId.d.ts +42 -0
- package/dist/core/anchorId.js +50 -0
- package/dist/core/anchorId.js.map +1 -0
- package/dist/core/apiKind.d.ts +42 -0
- package/dist/core/apiKind.js +83 -0
- package/dist/core/apiKind.js.map +1 -0
- package/dist/core/astroAnchors.d.ts +39 -0
- package/dist/core/astroAnchors.js +217 -0
- package/dist/core/astroAnchors.js.map +1 -0
- package/dist/core/attachmentTypes.d.ts +74 -0
- package/dist/core/attachmentTypes.js +199 -0
- package/dist/core/attachmentTypes.js.map +1 -0
- package/dist/core/elementHints.d.ts +40 -0
- package/dist/core/elementHints.js +116 -0
- package/dist/core/elementHints.js.map +1 -0
- package/dist/core/exportTaskDoc.d.ts +81 -0
- package/dist/core/exportTaskDoc.js +828 -0
- package/dist/core/exportTaskDoc.js.map +1 -0
- package/dist/core/feedbackTypes.d.ts +241 -0
- package/dist/core/feedbackTypes.js +2 -0
- package/dist/core/feedbackTypes.js.map +1 -0
- package/dist/core/fingerprint.d.ts +12 -0
- package/dist/core/fingerprint.js +24 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/htmlAnchors.d.ts +18 -0
- package/dist/core/htmlAnchors.js +157 -0
- package/dist/core/htmlAnchors.js.map +1 -0
- package/dist/core/imageSniff.d.ts +7 -0
- package/dist/core/imageSniff.js +12 -0
- package/dist/core/imageSniff.js.map +1 -0
- package/dist/core/ordering.d.ts +16 -0
- package/dist/core/ordering.js +10 -0
- package/dist/core/ordering.js.map +1 -0
- package/dist/core/oxcAst.d.ts +39 -0
- package/dist/core/oxcAst.js +147 -0
- package/dist/core/oxcAst.js.map +1 -0
- package/dist/core/pageUrl.d.ts +10 -0
- package/dist/core/pageUrl.js +27 -0
- package/dist/core/pageUrl.js.map +1 -0
- package/dist/core/participants.d.ts +14 -0
- package/dist/core/participants.js +38 -0
- package/dist/core/participants.js.map +1 -0
- package/dist/core/ports.d.ts +86 -0
- package/dist/core/ports.js +2 -0
- package/dist/core/ports.js.map +1 -0
- package/dist/core/projectSecret.d.ts +9 -0
- package/dist/core/projectSecret.js +57 -0
- package/dist/core/projectSecret.js.map +1 -0
- package/dist/core/recipe.d.ts +117 -0
- package/dist/core/recipe.js +181 -0
- package/dist/core/recipe.js.map +1 -0
- package/dist/core/recordingSummary.d.ts +12 -0
- package/dist/core/recordingSummary.js +150 -0
- package/dist/core/recordingSummary.js.map +1 -0
- package/dist/core/resolveAnchors.d.ts +70 -0
- package/dist/core/resolveAnchors.js +101 -0
- package/dist/core/resolveAnchors.js.map +1 -0
- package/dist/core/scriptImport.d.ts +10 -0
- package/dist/core/scriptImport.js +18 -0
- package/dist/core/scriptImport.js.map +1 -0
- package/dist/core/sourceAnchors.d.ts +62 -0
- package/dist/core/sourceAnchors.js +82 -0
- package/dist/core/sourceAnchors.js.map +1 -0
- package/dist/core/sourceContext.d.ts +62 -0
- package/dist/core/sourceContext.js +182 -0
- package/dist/core/sourceContext.js.map +1 -0
- package/dist/core/sourcePath.d.ts +2 -0
- package/dist/core/sourcePath.js +11 -0
- package/dist/core/sourcePath.js.map +1 -0
- package/dist/core/staleness.d.ts +118 -0
- package/dist/core/staleness.js +155 -0
- package/dist/core/staleness.js.map +1 -0
- package/dist/core/styleOrigin.d.ts +98 -0
- package/dist/core/styleOrigin.js +142 -0
- package/dist/core/styleOrigin.js.map +1 -0
- package/dist/core/svelteAnchors.d.ts +18 -0
- package/dist/core/svelteAnchors.js +125 -0
- package/dist/core/svelteAnchors.js.map +1 -0
- package/dist/core/taskFiles.d.ts +31 -0
- package/dist/core/taskFiles.js +55 -0
- package/dist/core/taskFiles.js.map +1 -0
- package/dist/core/untrusted.d.ts +57 -0
- package/dist/core/untrusted.js +268 -0
- package/dist/core/untrusted.js.map +1 -0
- package/dist/core/vueAnchors.d.ts +21 -0
- package/dist/core/vueAnchors.js +130 -0
- package/dist/core/vueAnchors.js.map +1 -0
- package/dist/expo/app/Avatar.d.ts +6 -0
- package/dist/expo/app/Avatar.js +12 -0
- package/dist/expo/app/Avatar.js.map +1 -0
- package/dist/expo/app/Bars.d.ts +9 -0
- package/dist/expo/app/Bars.js +38 -0
- package/dist/expo/app/Bars.js.map +1 -0
- package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
- package/dist/expo/app/CommentThreadSheet.js +200 -0
- package/dist/expo/app/CommentThreadSheet.js.map +1 -0
- package/dist/expo/app/CommentsSheet.d.ts +22 -0
- package/dist/expo/app/CommentsSheet.js +76 -0
- package/dist/expo/app/CommentsSheet.js.map +1 -0
- package/dist/expo/app/Files.d.ts +16 -0
- package/dist/expo/app/Files.js +62 -0
- package/dist/expo/app/Files.js.map +1 -0
- package/dist/expo/app/Highlight.d.ts +5 -0
- package/dist/expo/app/Highlight.js +12 -0
- package/dist/expo/app/Highlight.js.map +1 -0
- package/dist/expo/app/Icon.d.ts +9 -0
- package/dist/expo/app/Icon.js +22 -0
- package/dist/expo/app/Icon.js.map +1 -0
- package/dist/expo/app/MarkerPins.d.ts +10 -0
- package/dist/expo/app/MarkerPins.js +70 -0
- package/dist/expo/app/MarkerPins.js.map +1 -0
- package/dist/expo/app/Provider.d.ts +13 -0
- package/dist/expo/app/Provider.js +597 -0
- package/dist/expo/app/Provider.js.map +1 -0
- package/dist/expo/app/Sheet.d.ts +53 -0
- package/dist/expo/app/Sheet.js +106 -0
- package/dist/expo/app/Sheet.js.map +1 -0
- package/dist/expo/app/Toolbar.d.ts +26 -0
- package/dist/expo/app/Toolbar.js +71 -0
- package/dist/expo/app/Toolbar.js.map +1 -0
- package/dist/expo/app/adapter.d.ts +55 -0
- package/dist/expo/app/adapter.js +145 -0
- package/dist/expo/app/adapter.js.map +1 -0
- package/dist/expo/app/api.d.ts +68 -0
- package/dist/expo/app/api.js +86 -0
- package/dist/expo/app/api.js.map +1 -0
- package/dist/expo/app/assets/attach.png +0 -0
- package/dist/expo/app/assets/close.png +0 -0
- package/dist/expo/app/assets/comment.png +0 -0
- package/dist/expo/app/assets/edit.png +0 -0
- package/dist/expo/app/assets/file.png +0 -0
- package/dist/expo/app/assets/narrow.png +0 -0
- package/dist/expo/app/assets/panel.png +0 -0
- package/dist/expo/app/assets/pins.png +0 -0
- package/dist/expo/app/assets/pinsOff.png +0 -0
- package/dist/expo/app/assets/remove.png +0 -0
- package/dist/expo/app/assets/reopen.png +0 -0
- package/dist/expo/app/assets/resolve.png +0 -0
- package/dist/expo/app/assets/send.png +0 -0
- package/dist/expo/app/assets/widen.png +0 -0
- package/dist/expo/app/attachments.d.ts +93 -0
- package/dist/expo/app/attachments.js +181 -0
- package/dist/expo/app/attachments.js.map +1 -0
- package/dist/expo/app/cloudApi.d.ts +63 -0
- package/dist/expo/app/cloudApi.js +330 -0
- package/dist/expo/app/cloudApi.js.map +1 -0
- package/dist/expo/app/cloudAuth.d.ts +20 -0
- package/dist/expo/app/cloudAuth.js +71 -0
- package/dist/expo/app/cloudAuth.js.map +1 -0
- package/dist/expo/app/cloudHttp.d.ts +20 -0
- package/dist/expo/app/cloudHttp.js +46 -0
- package/dist/expo/app/cloudHttp.js.map +1 -0
- package/dist/expo/app/cloudSession.d.ts +30 -0
- package/dist/expo/app/cloudSession.js +72 -0
- package/dist/expo/app/cloudSession.js.map +1 -0
- package/dist/expo/app/comments.d.ts +20 -0
- package/dist/expo/app/comments.js +131 -0
- package/dist/expo/app/comments.js.map +1 -0
- package/dist/expo/app/devMenuNone.d.ts +5 -0
- package/dist/expo/app/devMenuNone.js +3 -0
- package/dist/expo/app/devMenuNone.js.map +1 -0
- package/dist/expo/app/devServerNone.d.ts +4 -0
- package/dist/expo/app/devServerNone.js +4 -0
- package/dist/expo/app/devServerNone.js.map +1 -0
- package/dist/expo/app/embeddedConfig.d.ts +1 -0
- package/dist/expo/app/embeddedConfig.js +12 -0
- package/dist/expo/app/embeddedConfig.js.map +1 -0
- package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
- package/dist/expo/app/embeddedConfigCloud.js +8 -0
- package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
- package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
- package/dist/expo/app/embeddedConfigNone.js +3 -0
- package/dist/expo/app/embeddedConfigNone.js.map +1 -0
- package/dist/expo/app/expo.d.ts +4 -0
- package/dist/expo/app/expo.js +35 -0
- package/dist/expo/app/expo.js.map +1 -0
- package/dist/expo/app/expoGo.d.ts +4 -0
- package/dist/expo/app/expoGo.js +33 -0
- package/dist/expo/app/expoGo.js.map +1 -0
- package/dist/expo/app/expoPickers.d.ts +11 -0
- package/dist/expo/app/expoPickers.js +91 -0
- package/dist/expo/app/expoPickers.js.map +1 -0
- package/dist/expo/app/expoRandom.d.ts +6 -0
- package/dist/expo/app/expoRandom.js +21 -0
- package/dist/expo/app/expoRandom.js.map +1 -0
- package/dist/expo/app/idle.d.ts +4 -0
- package/dist/expo/app/idle.js +7 -0
- package/dist/expo/app/idle.js.map +1 -0
- package/dist/expo/app/index.d.ts +3 -0
- package/dist/expo/app/index.js +3 -0
- package/dist/expo/app/index.js.map +1 -0
- package/dist/expo/app/interactions.d.ts +38 -0
- package/dist/expo/app/interactions.js +40 -0
- package/dist/expo/app/interactions.js.map +1 -0
- package/dist/expo/app/markers.d.ts +28 -0
- package/dist/expo/app/markers.js +187 -0
- package/dist/expo/app/markers.js.map +1 -0
- package/dist/expo/app/movedAnchors.d.ts +46 -0
- package/dist/expo/app/movedAnchors.js +39 -0
- package/dist/expo/app/movedAnchors.js.map +1 -0
- package/dist/expo/app/native.d.ts +12 -0
- package/dist/expo/app/native.js +78 -0
- package/dist/expo/app/native.js.map +1 -0
- package/dist/expo/app/panel.d.ts +27 -0
- package/dist/expo/app/panel.js +37 -0
- package/dist/expo/app/panel.js.map +1 -0
- package/dist/expo/app/payload.d.ts +43 -0
- package/dist/expo/app/payload.js +22 -0
- package/dist/expo/app/payload.js.map +1 -0
- package/dist/expo/app/pick.d.ts +14 -0
- package/dist/expo/app/pick.js +124 -0
- package/dist/expo/app/pick.js.map +1 -0
- package/dist/expo/app/pickerNone.d.ts +1 -0
- package/dist/expo/app/pickerNone.js +2 -0
- package/dist/expo/app/pickerNone.js.map +1 -0
- package/dist/expo/app/placement.d.ts +53 -0
- package/dist/expo/app/placement.js +100 -0
- package/dist/expo/app/placement.js.map +1 -0
- package/dist/expo/app/random.d.ts +13 -0
- package/dist/expo/app/random.js +56 -0
- package/dist/expo/app/random.js.map +1 -0
- package/dist/expo/app/reactNative.d.ts +2 -0
- package/dist/expo/app/reactNative.js +3 -0
- package/dist/expo/app/reactNative.js.map +1 -0
- package/dist/expo/app/runtimeConfig.d.ts +30 -0
- package/dist/expo/app/runtimeConfig.js +104 -0
- package/dist/expo/app/runtimeConfig.js.map +1 -0
- package/dist/expo/app/sheetMotion.d.ts +22 -0
- package/dist/expo/app/sheetMotion.js +39 -0
- package/dist/expo/app/sheetMotion.js.map +1 -0
- package/dist/expo/app/signIn.d.ts +32 -0
- package/dist/expo/app/signIn.js +28 -0
- package/dist/expo/app/signIn.js.map +1 -0
- package/dist/expo/app/state.d.ts +45 -0
- package/dist/expo/app/state.js +32 -0
- package/dist/expo/app/state.js.map +1 -0
- package/dist/expo/app/theme.d.ts +15 -0
- package/dist/expo/app/theme.js +9 -0
- package/dist/expo/app/theme.js.map +1 -0
- package/dist/expo/app/types.d.ts +87 -0
- package/dist/expo/app/types.js +2 -0
- package/dist/expo/app/types.js.map +1 -0
- package/dist/expo/app/useCloudReviewer.d.ts +75 -0
- package/dist/expo/app/useCloudReviewer.js +211 -0
- package/dist/expo/app/useCloudReviewer.js.map +1 -0
- package/dist/expo/app/useComments.d.ts +64 -0
- package/dist/expo/app/useComments.js +156 -0
- package/dist/expo/app/useComments.js.map +1 -0
- package/dist/expo/app/useUploads.d.ts +32 -0
- package/dist/expo/app/useUploads.js +106 -0
- package/dist/expo/app/useUploads.js.map +1 -0
- package/dist/expo/expoGoMetro.cjs +83 -0
- package/dist/expo/expoMetro.cjs +86 -0
- package/dist/expo/metro.cjs +304 -0
- package/dist/expo/metroBuild.d.ts +22 -0
- package/dist/expo/metroBuild.js +169 -0
- package/dist/expo/metroBuild.js.map +1 -0
- package/dist/expo/middleware.d.ts +11 -0
- package/dist/expo/middleware.js +26 -0
- package/dist/expo/middleware.js.map +1 -0
- package/dist/expo/mode.d.ts +20 -0
- package/dist/expo/mode.js +37 -0
- package/dist/expo/mode.js.map +1 -0
- package/dist/expo/publicConfig.d.ts +37 -0
- package/dist/expo/publicConfig.js +87 -0
- package/dist/expo/publicConfig.js.map +1 -0
- package/dist/expo/transform.d.ts +22 -0
- package/dist/expo/transform.js +38 -0
- package/dist/expo/transform.js.map +1 -0
- package/dist/expo/transformer.cjs +73 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/apiRoutes.d.ts +2 -0
- package/dist/integration/apiRoutes.js +3 -0
- package/dist/integration/apiRoutes.js.map +1 -0
- package/dist/integration/buildCredentials.d.ts +12 -0
- package/dist/integration/buildCredentials.js +97 -0
- package/dist/integration/buildCredentials.js.map +1 -0
- package/dist/integration/buildSession.d.ts +8 -0
- package/dist/integration/buildSession.js +96 -0
- package/dist/integration/buildSession.js.map +1 -0
- package/dist/integration/bundleCheck.d.ts +43 -0
- package/dist/integration/bundleCheck.js +111 -0
- package/dist/integration/bundleCheck.js.map +1 -0
- package/dist/integration/commentPull.d.ts +134 -0
- package/dist/integration/commentPull.js +260 -0
- package/dist/integration/commentPull.js.map +1 -0
- package/dist/integration/configuredApi.d.ts +7 -0
- package/dist/integration/configuredApi.js +24 -0
- package/dist/integration/configuredApi.js.map +1 -0
- package/dist/integration/devCloud.d.ts +27 -0
- package/dist/integration/devCloud.js +56 -0
- package/dist/integration/devCloud.js.map +1 -0
- package/dist/integration/devReviewLinks.d.ts +2 -0
- package/dist/integration/devReviewLinks.js +10 -0
- package/dist/integration/devReviewLinks.js.map +1 -0
- package/dist/integration/gitBranch.d.ts +19 -0
- package/dist/integration/gitBranch.js +56 -0
- package/dist/integration/gitBranch.js.map +1 -0
- package/dist/integration/importPlan.d.ts +19 -0
- package/dist/integration/importPlan.js +90 -0
- package/dist/integration/importPlan.js.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.js +13 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/manifest.d.ts +120 -0
- package/dist/integration/manifest.js +147 -0
- package/dist/integration/manifest.js.map +1 -0
- package/dist/integration/manifestParts.d.ts +29 -0
- package/dist/integration/manifestParts.js +65 -0
- package/dist/integration/manifestParts.js.map +1 -0
- package/dist/integration/manifestSink.d.ts +75 -0
- package/dist/integration/manifestSink.js +157 -0
- package/dist/integration/manifestSink.js.map +1 -0
- package/dist/integration/manifestUpload.d.ts +64 -0
- package/dist/integration/manifestUpload.js +177 -0
- package/dist/integration/manifestUpload.js.map +1 -0
- package/dist/integration/middleware.d.ts +55 -0
- package/dist/integration/middleware.js +379 -0
- package/dist/integration/middleware.js.map +1 -0
- package/dist/integration/nextStyles.d.ts +4 -0
- package/dist/integration/nextStyles.js +121 -0
- package/dist/integration/nextStyles.js.map +1 -0
- package/dist/integration/requestGuards.d.ts +71 -0
- package/dist/integration/requestGuards.js +255 -0
- package/dist/integration/requestGuards.js.map +1 -0
- package/dist/integration/sharedBuild.d.ts +71 -0
- package/dist/integration/sharedBuild.js +105 -0
- package/dist/integration/sharedBuild.js.map +1 -0
- package/dist/integration/sharedInject.d.ts +88 -0
- package/dist/integration/sharedInject.js +164 -0
- package/dist/integration/sharedInject.js.map +1 -0
- package/dist/integration/sidecarProcess.d.ts +26 -0
- package/dist/integration/sidecarProcess.js +137 -0
- package/dist/integration/sidecarProcess.js.map +1 -0
- package/dist/integration/styleCollector.d.ts +49 -0
- package/dist/integration/styleCollector.js +220 -0
- package/dist/integration/styleCollector.js.map +1 -0
- package/dist/integration/transform.d.ts +24 -0
- package/dist/integration/transform.js +36 -0
- package/dist/integration/transform.js.map +1 -0
- package/dist/integration/tunnelClient.d.ts +44 -0
- package/dist/integration/tunnelClient.js +148 -0
- package/dist/integration/tunnelClient.js.map +1 -0
- package/dist/integration/tunnelProtocol.d.ts +152 -0
- package/dist/integration/tunnelProtocol.js +110 -0
- package/dist/integration/tunnelProtocol.js.map +1 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +327 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/cloudRefresh.d.ts +36 -0
- package/dist/mcp/cloudRefresh.js +52 -0
- package/dist/mcp/cloudRefresh.js.map +1 -0
- package/dist/mcp/context.d.ts +7 -0
- package/dist/mcp/context.js +18 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/files.d.ts +66 -0
- package/dist/mcp/files.js +157 -0
- package/dist/mcp/files.js.map +1 -0
- package/dist/mcp/search.d.ts +3 -0
- package/dist/mcp/search.js +9 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.js +555 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/overlay/anchors.d.ts +130 -0
- package/dist/overlay/anchors.js +365 -0
- package/dist/overlay/anchors.js.map +1 -0
- package/dist/overlay/api.d.ts +150 -0
- package/dist/overlay/api.js +259 -0
- package/dist/overlay/api.js.map +1 -0
- package/dist/overlay/attachments.d.ts +60 -0
- package/dist/overlay/attachments.js +163 -0
- package/dist/overlay/attachments.js.map +1 -0
- package/dist/overlay/browser.d.ts +1 -0
- package/dist/overlay/browser.js +203 -0
- package/dist/overlay/browser.js.map +1 -0
- package/dist/overlay/chip.d.ts +27 -0
- package/dist/overlay/chip.js +31 -0
- package/dist/overlay/chip.js.map +1 -0
- package/dist/overlay/compact.d.ts +11 -0
- package/dist/overlay/compact.js +21 -0
- package/dist/overlay/compact.js.map +1 -0
- package/dist/overlay/cssScope.d.ts +46 -0
- package/dist/overlay/cssScope.js +180 -0
- package/dist/overlay/cssScope.js.map +1 -0
- package/dist/overlay/cursor.d.ts +2 -0
- package/dist/overlay/cursor.js +68 -0
- package/dist/overlay/cursor.js.map +1 -0
- package/dist/overlay/devBrowser.d.ts +1 -0
- package/dist/overlay/devBrowser.js +18 -0
- package/dist/overlay/devBrowser.js.map +1 -0
- package/dist/overlay/devReview.d.ts +4 -0
- package/dist/overlay/devReview.js +18 -0
- package/dist/overlay/devReview.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +149 -0
- package/dist/overlay/directReviewer.js +448 -0
- package/dist/overlay/directReviewer.js.map +1 -0
- package/dist/overlay/elementDescription.d.ts +10 -0
- package/dist/overlay/elementDescription.js +251 -0
- package/dist/overlay/elementDescription.js.map +1 -0
- package/dist/overlay/icons.d.ts +8 -0
- package/dist/overlay/icons.js +36 -0
- package/dist/overlay/icons.js.map +1 -0
- package/dist/overlay/identity.d.ts +48 -0
- package/dist/overlay/identity.js +125 -0
- package/dist/overlay/identity.js.map +1 -0
- package/dist/overlay/localMachine.d.ts +23 -0
- package/dist/overlay/localMachine.js +40 -0
- package/dist/overlay/localMachine.js.map +1 -0
- package/dist/overlay/magicLink.d.ts +10 -0
- package/dist/overlay/magicLink.js +87 -0
- package/dist/overlay/magicLink.js.map +1 -0
- package/dist/overlay/modern-screenshot.js +1676 -0
- package/dist/overlay/movedAnchors.d.ts +30 -0
- package/dist/overlay/movedAnchors.js +128 -0
- package/dist/overlay/movedAnchors.js.map +1 -0
- package/dist/overlay/notificationGroups.d.ts +2 -0
- package/dist/overlay/notificationGroups.js +41 -0
- package/dist/overlay/notificationGroups.js.map +1 -0
- package/dist/overlay/permissions.d.ts +10 -0
- package/dist/overlay/permissions.js +9 -0
- package/dist/overlay/permissions.js.map +1 -0
- package/dist/overlay/pinGroups.d.ts +16 -0
- package/dist/overlay/pinGroups.js +17 -0
- package/dist/overlay/pinGroups.js.map +1 -0
- package/dist/overlay/presence.d.ts +50 -0
- package/dist/overlay/presence.js +258 -0
- package/dist/overlay/presence.js.map +1 -0
- package/dist/overlay/projectChannel.d.ts +11 -0
- package/dist/overlay/projectChannel.js +111 -0
- package/dist/overlay/projectChannel.js.map +1 -0
- package/dist/overlay/recorder.d.ts +56 -0
- package/dist/overlay/recorder.js +130 -0
- package/dist/overlay/recorder.js.map +1 -0
- package/dist/overlay/reviewMode.d.ts +21 -0
- package/dist/overlay/reviewMode.js +59 -0
- package/dist/overlay/reviewMode.js.map +1 -0
- package/dist/overlay/reviewerAuth.d.ts +131 -0
- package/dist/overlay/reviewerAuth.js +279 -0
- package/dist/overlay/reviewerAuth.js.map +1 -0
- package/dist/overlay/route.d.ts +18 -0
- package/dist/overlay/route.js +56 -0
- package/dist/overlay/route.js.map +1 -0
- package/dist/overlay/rrweb-record.js +63 -0
- package/dist/overlay/runtime.d.ts +1 -0
- package/dist/overlay/runtime.js +4857 -0
- package/dist/overlay/runtime.js.map +1 -0
- package/dist/overlay/session.d.ts +32 -0
- package/dist/overlay/session.js +76 -0
- package/dist/overlay/session.js.map +1 -0
- package/dist/overlay/sharedMode.d.ts +38 -0
- package/dist/overlay/sharedMode.js +37 -0
- package/dist/overlay/sharedMode.js.map +1 -0
- package/dist/overlay/sheet.d.ts +73 -0
- package/dist/overlay/sheet.js +278 -0
- package/dist/overlay/sheet.js.map +1 -0
- package/dist/overlay/snapshot.d.ts +26 -0
- package/dist/overlay/snapshot.js +185 -0
- package/dist/overlay/snapshot.js.map +1 -0
- package/dist/overlay/state.d.ts +63 -0
- package/dist/overlay/state.js +241 -0
- package/dist/overlay/state.js.map +1 -0
- package/dist/overlay/steps.d.ts +22 -0
- package/dist/overlay/steps.js +34 -0
- package/dist/overlay/steps.js.map +1 -0
- package/dist/overlay/styles.d.ts +7 -0
- package/dist/overlay/styles.js +1449 -0
- package/dist/overlay/styles.js.map +1 -0
- package/dist/overlay/trace.d.ts +19 -0
- package/dist/overlay/trace.js +29 -0
- package/dist/overlay/trace.js.map +1 -0
- package/dist/overlay/upload.d.ts +35 -0
- package/dist/overlay/upload.js +99 -0
- package/dist/overlay/upload.js.map +1 -0
- package/dist/plugin/astro.d.ts +31 -0
- package/dist/plugin/astro.js +22 -0
- package/dist/plugin/astro.js.map +1 -0
- package/dist/plugin/eleventy.d.ts +44 -0
- package/dist/plugin/eleventy.js +186 -0
- package/dist/plugin/eleventy.js.map +1 -0
- package/dist/plugin/next-loader.cjs +11 -0
- package/dist/plugin/next.d.ts +29 -0
- package/dist/plugin/next.js +176 -0
- package/dist/plugin/next.js.map +1 -0
- package/dist/plugin/nextOverlay.d.ts +2 -0
- package/dist/plugin/nextOverlay.js +22 -0
- package/dist/plugin/nextOverlay.js.map +1 -0
- package/dist/plugin/nextTransform.d.ts +19 -0
- package/dist/plugin/nextTransform.js +29 -0
- package/dist/plugin/nextTransform.js.map +1 -0
- package/dist/plugin/rsbuild.d.ts +25 -0
- package/dist/plugin/rsbuild.js +56 -0
- package/dist/plugin/rsbuild.js.map +1 -0
- package/dist/plugin/vite.d.ts +39 -0
- package/dist/plugin/vite.js +582 -0
- package/dist/plugin/vite.js.map +1 -0
- package/dist/plugin/webpack.d.ts +69 -0
- package/dist/plugin/webpack.js +192 -0
- package/dist/plugin/webpack.js.map +1 -0
- package/dist/remote/account.d.ts +41 -0
- package/dist/remote/account.js +177 -0
- package/dist/remote/account.js.map +1 -0
- package/dist/remote/base64url.d.ts +14 -0
- package/dist/remote/base64url.js +71 -0
- package/dist/remote/base64url.js.map +1 -0
- package/dist/remote/branchLabel.d.ts +12 -0
- package/dist/remote/branchLabel.js +20 -0
- package/dist/remote/branchLabel.js.map +1 -0
- package/dist/remote/client.d.ts +340 -0
- package/dist/remote/client.js +424 -0
- package/dist/remote/client.js.map +1 -0
- package/dist/remote/cloudApi.d.ts +72 -0
- package/dist/remote/cloudApi.js +72 -0
- package/dist/remote/cloudApi.js.map +1 -0
- package/dist/remote/codec.d.ts +54 -0
- package/dist/remote/codec.js +62 -0
- package/dist/remote/codec.js.map +1 -0
- package/dist/remote/config.d.ts +30 -0
- package/dist/remote/config.js +112 -0
- package/dist/remote/config.js.map +1 -0
- package/dist/remote/content-schema.d.ts +428 -0
- package/dist/remote/content-schema.js +209 -0
- package/dist/remote/content-schema.js.map +1 -0
- package/dist/remote/content.d.ts +44 -0
- package/dist/remote/content.js +75 -0
- package/dist/remote/content.js.map +1 -0
- package/dist/remote/envelope.d.ts +76 -0
- package/dist/remote/envelope.js +109 -0
- package/dist/remote/envelope.js.map +1 -0
- package/dist/remote/errors.d.ts +55 -0
- package/dist/remote/errors.js +63 -0
- package/dist/remote/errors.js.map +1 -0
- package/dist/remote/ids.d.ts +8 -0
- package/dist/remote/ids.js +25 -0
- package/dist/remote/ids.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.js +8 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/keys.d.ts +62 -0
- package/dist/remote/keys.js +162 -0
- package/dist/remote/keys.js.map +1 -0
- package/dist/remote/localAnchors.d.ts +4 -0
- package/dist/remote/localAnchors.js +23 -0
- package/dist/remote/localAnchors.js.map +1 -0
- package/dist/remote/mapping.d.ts +11 -0
- package/dist/remote/mapping.js +22 -0
- package/dist/remote/mapping.js.map +1 -0
- package/dist/remote/presence.d.ts +63 -0
- package/dist/remote/presence.js +143 -0
- package/dist/remote/presence.js.map +1 -0
- package/dist/remote/realtime.d.ts +142 -0
- package/dist/remote/realtime.js +326 -0
- package/dist/remote/realtime.js.map +1 -0
- package/dist/remote/store.d.ts +183 -0
- package/dist/remote/store.js +907 -0
- package/dist/remote/store.js.map +1 -0
- package/dist/remote/sync.d.ts +113 -0
- package/dist/remote/sync.js +370 -0
- package/dist/remote/sync.js.map +1 -0
- package/dist/remote/types.d.ts +99 -0
- package/dist/remote/types.js +6 -0
- package/dist/remote/types.js.map +1 -0
- package/dist/setup/agents.d.ts +23 -0
- package/dist/setup/agents.js +80 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/configure.d.ts +27 -0
- package/dist/setup/configure.js +201 -0
- package/dist/setup/configure.js.map +1 -0
- package/dist/setup/connect.d.ts +60 -0
- package/dist/setup/connect.js +244 -0
- package/dist/setup/connect.js.map +1 -0
- package/dist/setup/detect.d.ts +67 -0
- package/dist/setup/detect.js +168 -0
- package/dist/setup/detect.js.map +1 -0
- package/dist/setup/frameworks.d.ts +41 -0
- package/dist/setup/frameworks.js +81 -0
- package/dist/setup/frameworks.js.map +1 -0
- package/dist/sidecar/cli.d.ts +1 -0
- package/dist/sidecar/cli.js +70 -0
- package/dist/sidecar/cli.js.map +1 -0
- package/dist/sidecar/cloudSync.d.ts +33 -0
- package/dist/sidecar/cloudSync.js +139 -0
- package/dist/sidecar/cloudSync.js.map +1 -0
- package/dist/sidecar/commentFiles.d.ts +59 -0
- package/dist/sidecar/commentFiles.js +217 -0
- package/dist/sidecar/commentFiles.js.map +1 -0
- package/dist/sidecar/cssAttribution.d.ts +26 -0
- package/dist/sidecar/cssAttribution.js +114 -0
- package/dist/sidecar/cssAttribution.js.map +1 -0
- package/dist/sidecar/exportTasks.d.ts +38 -0
- package/dist/sidecar/exportTasks.js +249 -0
- package/dist/sidecar/exportTasks.js.map +1 -0
- package/dist/sidecar/http.d.ts +20 -0
- package/dist/sidecar/http.js +904 -0
- package/dist/sidecar/http.js.map +1 -0
- package/dist/sidecar/inviteTarget.d.ts +4 -0
- package/dist/sidecar/inviteTarget.js +32 -0
- package/dist/sidecar/inviteTarget.js.map +1 -0
- package/dist/sidecar/presence.d.ts +4 -0
- package/dist/sidecar/presence.js +92 -0
- package/dist/sidecar/presence.js.map +1 -0
- package/dist/storage/cliSession.d.ts +8 -0
- package/dist/storage/cliSession.js +41 -0
- package/dist/storage/cliSession.js.map +1 -0
- package/dist/storage/devStyleMap.d.ts +12 -0
- package/dist/storage/devStyleMap.js +31 -0
- package/dist/storage/devStyleMap.js.map +1 -0
- package/dist/storage/fileCache.d.ts +34 -0
- package/dist/storage/fileCache.js +122 -0
- package/dist/storage/fileCache.js.map +1 -0
- package/dist/storage/localAttachments.d.ts +82 -0
- package/dist/storage/localAttachments.js +276 -0
- package/dist/storage/localAttachments.js.map +1 -0
- package/dist/storage/localComments.d.ts +31 -0
- package/dist/storage/localComments.js +159 -0
- package/dist/storage/localComments.js.map +1 -0
- package/dist/storage/localCredentials.d.ts +74 -0
- package/dist/storage/localCredentials.js +210 -0
- package/dist/storage/localCredentials.js.map +1 -0
- package/dist/storage/localParticipants.d.ts +33 -0
- package/dist/storage/localParticipants.js +110 -0
- package/dist/storage/localParticipants.js.map +1 -0
- package/dist/storage/localRecipe.d.ts +22 -0
- package/dist/storage/localRecipe.js +46 -0
- package/dist/storage/localRecipe.js.map +1 -0
- package/dist/storage/localScreenshots.d.ts +23 -0
- package/dist/storage/localScreenshots.js +55 -0
- package/dist/storage/localScreenshots.js.map +1 -0
- package/dist/storage/localSource.d.ts +31 -0
- package/dist/storage/localSource.js +175 -0
- package/dist/storage/localSource.js.map +1 -0
- package/dist/storage/pulledComments.d.ts +81 -0
- package/dist/storage/pulledComments.js +107 -0
- package/dist/storage/pulledComments.js.map +1 -0
- package/dist/storage/remoteRecipe.d.ts +7 -0
- package/dist/storage/remoteRecipe.js +85 -0
- package/dist/storage/remoteRecipe.js.map +1 -0
- package/dist/storage/savedRemote.d.ts +2 -0
- package/dist/storage/savedRemote.js +22 -0
- package/dist/storage/savedRemote.js.map +1 -0
- package/dist/storage/sidecarAccess.d.ts +7 -0
- package/dist/storage/sidecarAccess.js +68 -0
- package/dist/storage/sidecarAccess.js.map +1 -0
- package/package.json +306 -4
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { lstat, realpath } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { safeSourcePath } from '../core/untrusted.js';
|
|
4
|
+
/**
|
|
5
|
+
* Checks shared by the dev-server proxy and the sidecar for what may reach local feedback data.
|
|
6
|
+
*
|
|
7
|
+
* The sidecar binds loopback only, but the dev server often does not (`vite --host`, Next's
|
|
8
|
+
* default, a tunnel), and its proxy rewrites Host before forwarding. So the proxy decides who
|
|
9
|
+
* the caller really is, and the sidecar refuses what a browser could only send from another
|
|
10
|
+
* site.
|
|
11
|
+
*/
|
|
12
|
+
/** JSON bodies are small; anything larger is refused before it is buffered. */
|
|
13
|
+
export const maxJsonBodyBytes = 1024 * 1024;
|
|
14
|
+
export class BodyTooLarge extends Error {
|
|
15
|
+
constructor() { super('Request body too large'); this.name = 'BodyTooLarge'; }
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The whole body, or BodyTooLarge as soon as it passes `limit`.
|
|
19
|
+
*
|
|
20
|
+
* Stops buffering at the limit and pauses the stream rather than destroying it, so the caller
|
|
21
|
+
* can still answer 413 (with `Connection: close`) instead of resetting the connection.
|
|
22
|
+
*/
|
|
23
|
+
export function readLimitedBody(request, limit) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const chunks = [];
|
|
26
|
+
let size = 0;
|
|
27
|
+
const onData = (chunk) => {
|
|
28
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
29
|
+
size += buffer.length;
|
|
30
|
+
if (size > limit) {
|
|
31
|
+
request.off('data', onData);
|
|
32
|
+
request.pause();
|
|
33
|
+
reject(new BodyTooLarge());
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
chunks.push(buffer);
|
|
37
|
+
};
|
|
38
|
+
request.on('data', onData);
|
|
39
|
+
request.once('end', () => resolve(Buffer.concat(chunks)));
|
|
40
|
+
request.once('error', reject);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const loopbackNames = new Set(['127.0.0.1', 'localhost', '[::1]']);
|
|
44
|
+
export function isLoopbackHostname(hostname) {
|
|
45
|
+
return loopbackNames.has(hostname.toLowerCase());
|
|
46
|
+
}
|
|
47
|
+
/** A Host header naming this machine. Client-supplied, so never sufficient on its own. */
|
|
48
|
+
export function isLoopbackHost(host) {
|
|
49
|
+
if (!host)
|
|
50
|
+
return false;
|
|
51
|
+
try {
|
|
52
|
+
return isLoopbackHostname(new URL(`http://${host}`).hostname);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** The connection itself came from this machine. */
|
|
59
|
+
export function isLoopbackAddress(address) {
|
|
60
|
+
if (!address)
|
|
61
|
+
return false;
|
|
62
|
+
const v4 = address.startsWith('::ffff:') ? address.slice(7) : address;
|
|
63
|
+
return v4 === '::1' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v4);
|
|
64
|
+
}
|
|
65
|
+
const clientAddressHeaders = ['x-forwarded-for', 'x-real-ip', 'cf-connecting-ip', 'true-client-ip', 'x-client-ip', 'fly-client-ip'];
|
|
66
|
+
/** One client address as a header carries it, without quotes, brackets or a port: `"[::1]:52000"` is `::1`. */
|
|
67
|
+
function headerAddress(value) {
|
|
68
|
+
const unquoted = value.trim().replace(/^"(.*)"$/, '$1').trim();
|
|
69
|
+
const bracketed = /^\[([^\]]+)\](?::\d+)?$/.exec(unquoted);
|
|
70
|
+
if (bracketed)
|
|
71
|
+
return bracketed[1];
|
|
72
|
+
return /^(\d{1,3}(?:\.\d{1,3}){3}):\d+$/.exec(unquoted)?.[1] ?? unquoted;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Relayed from somewhere else, whatever the connection says: a tunnel or reverse proxy that
|
|
76
|
+
* rewrites Host to loopback (ngrok `--host-header=rewrite`, cloudflared `httpHostHeader`) still
|
|
77
|
+
* names the real client in these headers. Every client-address header is judged by its value: a
|
|
78
|
+
* local TLS proxy (nginx sending `X-Real-IP` and `X-Forwarded-For` for `127.0.0.1`) names
|
|
79
|
+
* loopback, anything else - another address, `unknown`, an obfuscated node, a `Forwarded`
|
|
80
|
+
* element without `for=`, an empty value - is relayed.
|
|
81
|
+
*/
|
|
82
|
+
export function relayedFromElsewhere(headers) {
|
|
83
|
+
const values = (name) => { const value = headers[name]; return value === undefined ? [] : Array.isArray(value) ? value : [value]; };
|
|
84
|
+
const addresses = clientAddressHeaders.flatMap((name) => values(name).flatMap((value) => value.split(',')));
|
|
85
|
+
for (const element of values('forwarded').flatMap((value) => value.split(','))) {
|
|
86
|
+
const clients = element.split(';').map((pair) => pair.trim()).filter((pair) => /^for=/i.test(pair));
|
|
87
|
+
addresses.push(...(clients.length > 0 ? clients.map((pair) => pair.slice(4)) : ['']));
|
|
88
|
+
}
|
|
89
|
+
return addresses.some((address) => !isLoopbackAddress(headerAddress(address)));
|
|
90
|
+
}
|
|
91
|
+
/** An http(s) origin on this machine, with nothing after it. */
|
|
92
|
+
export function isLoopbackAppOrigin(value) {
|
|
93
|
+
try {
|
|
94
|
+
const url = new URL(value);
|
|
95
|
+
return (url.protocol === 'http:' || url.protocol === 'https:') && isLoopbackHostname(url.hostname) && url.origin === value;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** `host[:port]` of an Origin header, or null for `null` and anything unparsable. */
|
|
102
|
+
export function originHost(origin) {
|
|
103
|
+
try {
|
|
104
|
+
const url = new URL(origin);
|
|
105
|
+
return url.protocol === 'http:' || url.protocol === 'https:' ? url.host : null;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function mediaType(header) {
|
|
112
|
+
return (header ?? '').split(';')[0].trim().toLowerCase();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Why the sidecar refuses this request, or null.
|
|
116
|
+
*
|
|
117
|
+
* A web page can send a "simple" cross-site POST (`text/plain`, no-cors) without asking first.
|
|
118
|
+
* Requiring a JSON (an image for screenshots, raw bytes for uploads) content type forces a preflight the sidecar never
|
|
119
|
+
* answers, and an Origin or Fetch Metadata naming another site is refused outright. PATCH and
|
|
120
|
+
* DELETE already need a preflight, so only their origin is checked.
|
|
121
|
+
*
|
|
122
|
+
* An Origin is accepted when it is this listener's own loopback origin, or the dev origin a
|
|
123
|
+
* proxy in front of it vouches for: both our middleware and Next's rewrites overwrite
|
|
124
|
+
* `x-forwarded-host` with the Host the browser actually used, and a page cannot set that header
|
|
125
|
+
* on a request to the sidecar without a preflight.
|
|
126
|
+
*/
|
|
127
|
+
export function crossSiteRefusal(request, pathname, listenerPort) {
|
|
128
|
+
if (request.headers['sec-fetch-site'] === 'cross-site')
|
|
129
|
+
return { status: 403, error: 'Cross-site sidecar request refused' };
|
|
130
|
+
const origin = request.headers.origin;
|
|
131
|
+
if (origin !== undefined) {
|
|
132
|
+
const host = originHost(origin)?.toLowerCase();
|
|
133
|
+
const forwardedHost = request.headers['x-forwarded-host'];
|
|
134
|
+
const vouched = typeof forwardedHost === 'string' ? forwardedHost.split(',')[0].trim().toLowerCase() : null;
|
|
135
|
+
const own = [`127.0.0.1:${listenerPort}`, `localhost:${listenerPort}`, `[::1]:${listenerPort}`];
|
|
136
|
+
if (!host || !(own.includes(host) || host === vouched)) {
|
|
137
|
+
return { status: 403, error: 'Sidecar requests must come from the app or this machine' };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const method = request.method ?? 'GET';
|
|
141
|
+
if (method === 'POST' || method === 'PUT' || method === 'PATCH') {
|
|
142
|
+
const type = mediaType(request.headers['content-type']);
|
|
143
|
+
const accepted = pathname.endsWith('/screenshot') ? type.startsWith('image/')
|
|
144
|
+
// An attachment upload is the raw file, whatever it is: the sidecar types it by its bytes.
|
|
145
|
+
: pathname === '/__fb/uploads' ? type === 'application/octet-stream'
|
|
146
|
+
: type === 'application/json';
|
|
147
|
+
if (!accepted)
|
|
148
|
+
return { status: 415, error: 'Expected Content-Type: application/json' };
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Files `/__fb/source` may show, and comments may name: `safeSourcePath`, the one name-level rule
|
|
154
|
+
* (source extensions only; nothing under `.feedback`, `.git`, `.env*`, `node_modules` and similar).
|
|
155
|
+
*
|
|
156
|
+
* The route is reachable from the page, so anything it returns is readable by whoever can reach
|
|
157
|
+
* the dev server. Relative paths computed here use the platform separator; the rule is POSIX.
|
|
158
|
+
*/
|
|
159
|
+
function servablePath(file) {
|
|
160
|
+
return safeSourcePath(path.sep === '/' ? file : file.split(path.sep).join('/'));
|
|
161
|
+
}
|
|
162
|
+
/** Inside the (real) project root, and allowed by name there. */
|
|
163
|
+
function servableRelative(root, real) {
|
|
164
|
+
const relative = path.relative(root, real);
|
|
165
|
+
return relative !== '' && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative) && servablePath(relative);
|
|
166
|
+
}
|
|
167
|
+
/** Checked by name and again by real path, so a link inside the app cannot point at a secret. */
|
|
168
|
+
export async function servableSource(projectRoot, file) {
|
|
169
|
+
if (!servablePath(file))
|
|
170
|
+
return false;
|
|
171
|
+
try {
|
|
172
|
+
const [root, real] = await Promise.all([realpath(projectRoot), realpath(path.resolve(projectRoot, file))]);
|
|
173
|
+
return servableRelative(root, real);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Whether a comment may name and quote this file. As `servableSource`, except that a file which
|
|
181
|
+
* does not exist is still named - a stale anchor names where it pointed - once the real path of
|
|
182
|
+
* its nearest existing ancestor puts it somewhere allowed: `src/link/missing.ts`, with `src/link`
|
|
183
|
+
* a link to `.feedback`, is not named, or an agent told to create it would write into `.feedback`.
|
|
184
|
+
*/
|
|
185
|
+
async function nameableSource(projectRoot, file) {
|
|
186
|
+
if (!servablePath(file))
|
|
187
|
+
return false;
|
|
188
|
+
const target = path.resolve(projectRoot, file);
|
|
189
|
+
try {
|
|
190
|
+
await lstat(target);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return missingTargetNameable(projectRoot, target);
|
|
194
|
+
}
|
|
195
|
+
return servableSource(projectRoot, file);
|
|
196
|
+
}
|
|
197
|
+
async function missingTargetNameable(projectRoot, target) {
|
|
198
|
+
let root;
|
|
199
|
+
try {
|
|
200
|
+
root = await realpath(projectRoot);
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
const rest = [path.basename(target)];
|
|
206
|
+
for (let ancestor = path.dirname(target);; ancestor = path.dirname(ancestor)) {
|
|
207
|
+
try {
|
|
208
|
+
return servableRelative(root, path.join(await realpath(ancestor), ...rest));
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
if (ancestor === path.dirname(ancestor))
|
|
212
|
+
return false;
|
|
213
|
+
rest.unshift(path.basename(ancestor));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* `nameableSource` with one answer per path for a whole operation: the real-path check touches
|
|
219
|
+
* the disk. Shared by export, the MCP list/search tools and the remote store's sealed excerpt.
|
|
220
|
+
*/
|
|
221
|
+
export function sourceGate(projectRoot) {
|
|
222
|
+
const answers = new Map();
|
|
223
|
+
return (file) => {
|
|
224
|
+
let answer = answers.get(file);
|
|
225
|
+
if (!answer) {
|
|
226
|
+
answer = nameableSource(projectRoot, file);
|
|
227
|
+
answers.set(file, answer);
|
|
228
|
+
}
|
|
229
|
+
return answer;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Anchors on refused files become unlocated, so they are neither quoted nor named as a place to
|
|
234
|
+
* change; refused `insideSelection` files are dropped. Expects a well-formed comment
|
|
235
|
+
* (`untrustedComment`/`commentShape`).
|
|
236
|
+
*/
|
|
237
|
+
export async function confineAnchors(comment, servable) {
|
|
238
|
+
const confine = async (anchor) => anchor && anchor.file && !(await servable(anchor.file)) ? { ...anchor, file: '', line: 0, column: 0 } : anchor;
|
|
239
|
+
const confined = {
|
|
240
|
+
...comment,
|
|
241
|
+
anchor: await confine(comment.anchor),
|
|
242
|
+
replies: await Promise.all(comment.replies.map(async (reply) => ({ ...reply, anchor: await confine(reply.anchor) }))),
|
|
243
|
+
};
|
|
244
|
+
if (comment.leafAnchor)
|
|
245
|
+
confined.leafAnchor = await confine(comment.leafAnchor);
|
|
246
|
+
if (comment.anchorChain)
|
|
247
|
+
confined.anchorChain = await Promise.all(comment.anchorChain.map(confine));
|
|
248
|
+
if (comment.insideSelection) {
|
|
249
|
+
const kept = await Promise.all(comment.insideSelection.map(async (file) => (await servable(file)) ? file : null));
|
|
250
|
+
confined.insideSelection = kept.filter((file) => file !== null);
|
|
251
|
+
}
|
|
252
|
+
return confined;
|
|
253
|
+
}
|
|
254
|
+
export const maxSourceRadius = 200;
|
|
255
|
+
//# sourceMappingURL=requestGuards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestGuards.js","sourceRoot":"","sources":["../../src/integration/requestGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;;;GAOG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,gBAAgB,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC;CAC/E;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAwB,EAAE,KAAa;IACrE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAE,EAAE;YACxC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnE,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC;YACtB,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC5B,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,MAAM,CAAC,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O,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a build publishes opaque anchors, and what it refuses to do if it cannot.
|
|
3
|
+
*
|
|
4
|
+
* Every rule here exists because the failure it prevents is silent. A shared preview is
|
|
5
|
+
* reachable by anyone holding the link; if this module gets a decision wrong, the result is
|
|
6
|
+
* a published file tree that nobody notices until someone reads the bundle.
|
|
7
|
+
*/
|
|
8
|
+
export type SharedBuildOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Explicit opt-in. Nothing else turns shared mode on.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately not inferred from the environment. Gating on "are the variables present"
|
|
13
|
+
* means a CI runner that happens to carry `FEEDBACK_SECRET` for an unrelated reason
|
|
14
|
+
* silently changes what a build emits, and the developer who set that variable never made
|
|
15
|
+
* this decision. Environment supplies values; the config makes the choice.
|
|
16
|
+
*/
|
|
17
|
+
shared?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type SharedBuildEnvironment = {
|
|
20
|
+
projectId?: string | undefined;
|
|
21
|
+
secret?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type SharedBuildPlan =
|
|
24
|
+
/** `notice` is set when shared mode was asked for and could not be honoured: say it in the log. */
|
|
25
|
+
{
|
|
26
|
+
mode: 'off';
|
|
27
|
+
notice?: string;
|
|
28
|
+
} | {
|
|
29
|
+
mode: 'shared';
|
|
30
|
+
projectId: string;
|
|
31
|
+
secret: string;
|
|
32
|
+
};
|
|
33
|
+
/** Thrown to stop a build rather than let it emit something it should not. */
|
|
34
|
+
export declare class SharedBuildError extends Error {
|
|
35
|
+
constructor(message: string);
|
|
36
|
+
}
|
|
37
|
+
export declare const projectIdVar = "FEEDBACK_PROJECT_ID";
|
|
38
|
+
export declare const secretVar = "FEEDBACK_SECRET";
|
|
39
|
+
/**
|
|
40
|
+
* What a preview built without its secret says in the browser console - the only trace of us in
|
|
41
|
+
* it. A build log is read when a deploy fails, not when it succeeds, so a site that works and
|
|
42
|
+
* simply has no widget needs the explanation where someone looking for the widget will look.
|
|
43
|
+
* One `console.warn`: no paths, no ids, nothing else of ours.
|
|
44
|
+
*/
|
|
45
|
+
export declare function disabledNoticeScript(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Decides what a build emits.
|
|
48
|
+
*
|
|
49
|
+
* A build asking for shared mode without a secret builds **without the plugin** - no anchors, no
|
|
50
|
+
* overlay, no manifest - and says so in the log. It never falls back to plain paths: that would
|
|
51
|
+
* publish the file tree to anyone holding the preview link.
|
|
52
|
+
*
|
|
53
|
+
* It used to stop the build instead. Safe, but it took the deploy down for a missing variable
|
|
54
|
+
* that only matters to reviewers, and the first preview of every new project failed until
|
|
55
|
+
* someone found the setting. Off is just as safe - nothing of ours is in the output - and the
|
|
56
|
+
* warning is in the one place the developer looks when reviews do not appear.
|
|
57
|
+
*/
|
|
58
|
+
export declare function planSharedBuild(options: SharedBuildOptions, env: SharedBuildEnvironment, command: 'serve' | 'build'): SharedBuildPlan;
|
|
59
|
+
/**
|
|
60
|
+
* Refuses a shared build that would also emit source maps.
|
|
61
|
+
*
|
|
62
|
+
* Opaque ids are pointless beside a source map: the map carries the original paths and the
|
|
63
|
+
* original source, so the bundle would hide the file tree while the file next to it hands
|
|
64
|
+
* over the code.
|
|
65
|
+
*
|
|
66
|
+
* This fails rather than quietly setting `sourcemap: false`. Overriding is worse than
|
|
67
|
+
* stopping - the developer asked for maps, presumably to debug something, and silently not
|
|
68
|
+
* producing them turns this into a mystery about the bundler. Saying why, and letting them
|
|
69
|
+
* choose, keeps the decision theirs.
|
|
70
|
+
*/
|
|
71
|
+
export declare function refuseSourcemaps(sourcemap: unknown): void;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a build publishes opaque anchors, and what it refuses to do if it cannot.
|
|
3
|
+
*
|
|
4
|
+
* Every rule here exists because the failure it prevents is silent. A shared preview is
|
|
5
|
+
* reachable by anyone holding the link; if this module gets a decision wrong, the result is
|
|
6
|
+
* a published file tree that nobody notices until someone reads the bundle.
|
|
7
|
+
*/
|
|
8
|
+
/** Thrown to stop a build rather than let it emit something it should not. */
|
|
9
|
+
export class SharedBuildError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'SharedBuildError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export const projectIdVar = 'FEEDBACK_PROJECT_ID';
|
|
16
|
+
export const secretVar = 'FEEDBACK_SECRET';
|
|
17
|
+
/**
|
|
18
|
+
* What a preview built without its secret says in the browser console - the only trace of us in
|
|
19
|
+
* it. A build log is read when a deploy fails, not when it succeeds, so a site that works and
|
|
20
|
+
* simply has no widget needs the explanation where someone looking for the widget will look.
|
|
21
|
+
* One `console.warn`: no paths, no ids, nothing else of ours.
|
|
22
|
+
*/
|
|
23
|
+
export function disabledNoticeScript() {
|
|
24
|
+
const message = '[Ontrackd feedback] The review widget is off on this deployment: it was built with '
|
|
25
|
+
+ `shared mode on but without ${secretVar}. Set ${secretVar} for this environment, from the `
|
|
26
|
+
+ 'project\'s Setup tab on your configured feedback service, and redeploy.';
|
|
27
|
+
return `console.warn(${JSON.stringify(message)});`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decides what a build emits.
|
|
31
|
+
*
|
|
32
|
+
* A build asking for shared mode without a secret builds **without the plugin** - no anchors, no
|
|
33
|
+
* overlay, no manifest - and says so in the log. It never falls back to plain paths: that would
|
|
34
|
+
* publish the file tree to anyone holding the preview link.
|
|
35
|
+
*
|
|
36
|
+
* It used to stop the build instead. Safe, but it took the deploy down for a missing variable
|
|
37
|
+
* that only matters to reviewers, and the first preview of every new project failed until
|
|
38
|
+
* someone found the setting. Off is just as safe - nothing of ours is in the output - and the
|
|
39
|
+
* warning is in the one place the developer looks when reviews do not appear.
|
|
40
|
+
*/
|
|
41
|
+
export function planSharedBuild(options, env, command) {
|
|
42
|
+
if (!options.shared) {
|
|
43
|
+
return { mode: 'off' };
|
|
44
|
+
}
|
|
45
|
+
if (command !== 'build') {
|
|
46
|
+
// Asking for it in a dev server is not an error worth stopping for: local mode already
|
|
47
|
+
// serves plain paths to a server only this machine can reach.
|
|
48
|
+
return { mode: 'off' };
|
|
49
|
+
}
|
|
50
|
+
const projectId = env.projectId?.trim();
|
|
51
|
+
const secret = env.secret?.trim();
|
|
52
|
+
/**
|
|
53
|
+
* The secret is the one value to ask for.
|
|
54
|
+
*
|
|
55
|
+
* It carries the project id, and `resolveSecret` reads it back out - so naming both
|
|
56
|
+
* variables here sent someone looking for a second value that does not need to exist. The
|
|
57
|
+
* dashboard shows one line; this message has to agree with it, or the error is a wild goose
|
|
58
|
+
* chase dressed as instructions.
|
|
59
|
+
*
|
|
60
|
+
* `FEEDBACK_PROJECT_ID` is still honoured and still named in the one case it is genuinely
|
|
61
|
+
* needed: a secret minted before the id travelled inside it.
|
|
62
|
+
*/
|
|
63
|
+
if (!secret) {
|
|
64
|
+
return {
|
|
65
|
+
mode: 'off',
|
|
66
|
+
notice: `feedback: shared mode is on but ${secretVar} is not set, so this build has no feedback layer.\n` +
|
|
67
|
+
' Nothing of ours is in it: no anchors, no overlay, no manifest. Reviewers will not see the widget.\n' +
|
|
68
|
+
` To turn it on, set ${secretVar} for this environment. Copy it from the project's Setup tab.`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (!projectId) {
|
|
72
|
+
return {
|
|
73
|
+
mode: 'off',
|
|
74
|
+
notice: `feedback: ${secretVar} is set but no project id could be read from it, so this build has no feedback layer.\n` +
|
|
75
|
+
` Copy ${secretVar} again from the project's Setup tab.`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return { mode: 'shared', projectId: projectId, secret: secret };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Refuses a shared build that would also emit source maps.
|
|
82
|
+
*
|
|
83
|
+
* Opaque ids are pointless beside a source map: the map carries the original paths and the
|
|
84
|
+
* original source, so the bundle would hide the file tree while the file next to it hands
|
|
85
|
+
* over the code.
|
|
86
|
+
*
|
|
87
|
+
* This fails rather than quietly setting `sourcemap: false`. Overriding is worse than
|
|
88
|
+
* stopping - the developer asked for maps, presumably to debug something, and silently not
|
|
89
|
+
* producing them turns this into a mystery about the bundler. Saying why, and letting them
|
|
90
|
+
* choose, keeps the decision theirs.
|
|
91
|
+
*/
|
|
92
|
+
export function refuseSourcemaps(sourcemap) {
|
|
93
|
+
if (sourcemap === false || sourcemap === undefined || sourcemap === null) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
throw new SharedBuildError(`feedback: shared mode is on and this build is configured to emit source maps (build.sourcemap: ${JSON.stringify(sourcemap)}).\n` +
|
|
97
|
+
' Shared builds stamp opaque ids so a published preview does not reveal your file ' +
|
|
98
|
+
'tree. A source map beside that bundle reveals the paths and the source itself, which ' +
|
|
99
|
+
'undoes it entirely.\n' +
|
|
100
|
+
' This build is stopped rather than overriding the setting, because you chose it and ' +
|
|
101
|
+
'a bundler that silently ignores your config is worse than one that refuses.\n' +
|
|
102
|
+
' Set `build.sourcemap: false` for shared builds, or set `shared: false` on the ' +
|
|
103
|
+
'feedback plugin.');
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=sharedBuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedBuild.js","sourceRoot":"","sources":["../../src/integration/sharedBuild.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,8EAA8E;AAC9E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,iB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,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACzE,OAAO;IACT,CAAC;IAED,MAAM,IAAI,gBAAgB,CACxB,kGAAkG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM;QAC/H,oFAAoF;QACpF,uFAAuF;QACvF,uBAAuB;QACvB,uFAAuF;QACvF,+EAA+E;QAC/E,kFAAkF;QAClF,kBAAkB,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a shared build injects into the page, and why each part is shaped as it is.
|
|
3
|
+
*
|
|
4
|
+
* Two tags: a configuration object the overlay reads, and the overlay itself loaded from the
|
|
5
|
+
* API origin. Neither carries a secret - the project id is public and ships in the bundle by
|
|
6
|
+
* design, and the overlay learns nothing from this that a reviewer could not read anyway.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The overlay version this build is pinned to.
|
|
10
|
+
*
|
|
11
|
+
* Pinned, and not a default that can be omitted. A floating version means the customer's
|
|
12
|
+
* preview changes under a reviewer mid-session, which is exactly what a page under review must
|
|
13
|
+
* not do: they are describing what they see, and what they see must not move.
|
|
14
|
+
*
|
|
15
|
+
* Bumping this is a deliberate act that produces a new build. If a pinned version stops being
|
|
16
|
+
* supported the load fails with a message telling the developer to rebuild - never a silent
|
|
17
|
+
* upgrade, which is the same failure as a floating version arriving later and harder to explain.
|
|
18
|
+
*/
|
|
19
|
+
export declare const overlayVersion = "v1";
|
|
20
|
+
export type InjectedConfig = {
|
|
21
|
+
projectId: string;
|
|
22
|
+
apiBase: string;
|
|
23
|
+
buildId: string;
|
|
24
|
+
overlayVersion: string;
|
|
25
|
+
sessionId?: string;
|
|
26
|
+
plan?: 'cloud' | 'standalone';
|
|
27
|
+
presence?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The branch the build was made from (`buildIdentity`), or null. Reviewers' Cloud comments are
|
|
30
|
+
* labelled with it. Public, like the project id: it is the build's own name.
|
|
31
|
+
*/
|
|
32
|
+
branch?: string | null;
|
|
33
|
+
};
|
|
34
|
+
export declare function overlayUrl(apiBase: string, version?: string, config?: InjectedConfig): string;
|
|
35
|
+
/**
|
|
36
|
+
* Where the service lives.
|
|
37
|
+
*
|
|
38
|
+
* **A constant of the product, not a setting.** This is our address; a customer installing the
|
|
39
|
+
* package has no way of knowing it and no reason to be asked. Making them supply it turned an
|
|
40
|
+
* install into a scavenger hunt and turned a forgotten variable into a failed build - and the
|
|
41
|
+
* value they were being asked for was the same for every one of them.
|
|
42
|
+
*
|
|
43
|
+
* It stays overridable because *we* need that: the cloud runs on localhost during development,
|
|
44
|
+
* on a preview deployment when a branch is being checked, and one day on a customer's own
|
|
45
|
+
* infrastructure. Those are our cases, so the override is an escape hatch rather than a step.
|
|
46
|
+
*/
|
|
47
|
+
export { defaultApiBase } from '../core/apiKind.js';
|
|
48
|
+
/**
|
|
49
|
+
* The API base for a shared build: the override if there is one, otherwise ours.
|
|
50
|
+
*
|
|
51
|
+
* Still validated. An override is typed by a human, and an http URL is worth catching here
|
|
52
|
+
* rather than as a mixed-content error in a reviewer's console that never reaches anyone's log.
|
|
53
|
+
*/
|
|
54
|
+
export declare function apiBaseFor(env: NodeJS.ProcessEnv, options?: {
|
|
55
|
+
machine?: boolean;
|
|
56
|
+
}): string;
|
|
57
|
+
/**
|
|
58
|
+
* The tag to inject: one script, from our origin, with the configuration in its address.
|
|
59
|
+
*
|
|
60
|
+
* It used to be two - an inline script setting `window.__feedback`, then the overlay. A page with
|
|
61
|
+
* a Content-Security-Policy that does not allow inline scripts (`script-src 'self'
|
|
62
|
+
* https://api.ontrackd.com`, a sensible policy) blocked the first and loaded the second: the
|
|
63
|
+
* overlay started with no configuration, took itself for a local dev server, and showed a
|
|
64
|
+
* deployed preview's reviewers the local "pick a name" screen. A query string on the script's own
|
|
65
|
+
* URL cannot be blocked separately from the script, and needs no `'unsafe-inline'`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function injectionFor(config: InjectedConfig): {
|
|
68
|
+
tag: string;
|
|
69
|
+
attrs: {
|
|
70
|
+
type: string;
|
|
71
|
+
src: string;
|
|
72
|
+
async: boolean;
|
|
73
|
+
};
|
|
74
|
+
injectTo: "head";
|
|
75
|
+
}[];
|
|
76
|
+
/**
|
|
77
|
+
* The overlay loader as a module, for builders that generate their own HTML.
|
|
78
|
+
*
|
|
79
|
+
* Vite's `transformIndexHtml` takes tags; Astro never calls it, because it builds pages
|
|
80
|
+
* through its own pipeline rather than from an `index.html`. This is the same two tags
|
|
81
|
+
* expressed as script, so both adapters load the same overlay the same way.
|
|
82
|
+
*
|
|
83
|
+
* The overlay element is created rather than imported. A bare `import` of a remote URL is
|
|
84
|
+
* rewritten by the bundler and would either be inlined into the customer's bundle or fail to
|
|
85
|
+
* resolve at build time; appending a tag keeps it a runtime fetch from our origin, which is
|
|
86
|
+
* what the pinned version is for.
|
|
87
|
+
*/
|
|
88
|
+
export declare function overlayBootstrapSource(src: string, config?: InjectedConfig): string;
|