{"_id":"@a1local/adpages-browser-capture","name":"@a1local/adpages-browser-capture","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@a1local/adpages-browser-capture","version":"0.1.0","description":"Dependency-free capture adapters that turn saved HTML and future rendered URLs into AdPages audit snapshots.","type":"module","license":"MIT","author":{"name":"A1 Local","url":"https://a1local.com.au/"},"homepage":"https://github.com/a1local/adpages-browser-capture#readme","repository":{"type":"git","url":"git+https://github.com/a1local/adpages-browser-capture.git"},"bugs":{"url":"https://github.com/a1local/adpages-browser-capture/issues"},"funding":{"type":"custom","url":"https://a1local.com.au/extensions/"},"publishConfig":{"access":"public"},"sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","lint":"tsc --noEmit -p tsconfig.json","prepublishOnly":"npm run build"},"keywords":["adpages","landing-pages","browser-capture","google-ads","audits"],"devDependencies":{"typescript":"^5.9.3"},"gitHead":"0051b08e303680b1f851a3980ab4207b2b954405","_id":"@a1local/adpages-browser-capture@0.1.0","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-uDwgMimTqSo8ZqZd0dnWiSucZdjX3W1rQOLuOaEKOIFKshk1FJAhHek4uUKvQGb0x2SwOUSFPDxRvrfTrnGLqg==","shasum":"2b0f34db4ce29b242d9cd2b41d42bc338a78a3be","tarball":"https://registry.npmjs.org/@a1local/adpages-browser-capture/-/adpages-browser-capture-0.1.0.tgz","fileCount":9,"unpackedSize":34999,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCVkX7Ffv9bnokFBF66yNN3FyKGRrHjEKdAcQL/23BRnAIgDNtHgvu4NRy4gvQXvDFDb8sh+6aQWDgEUIPJ4jcnWPc="}]},"_npmUser":{"name":"a1local","email":"extensions@a1local.com.au"},"directories":{},"maintainers":[{"name":"a1local","email":"extensions@a1local.com.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adpages-browser-capture_0.1.0_1779689286582_0.662389232450616"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T06:08:06.478Z","0.1.0":"2026-05-25T06:08:06.707Z","modified":"2026-05-25T06:08:06.864Z"},"maintainers":[{"name":"a1local","email":"extensions@a1local.com.au"}],"description":"Dependency-free capture adapters that turn saved HTML and future rendered URLs into AdPages audit snapshots.","homepage":"https://github.com/a1local/adpages-browser-capture#readme","keywords":["adpages","landing-pages","browser-capture","google-ads","audits"],"repository":{"type":"git","url":"git+https://github.com/a1local/adpages-browser-capture.git"},"author":{"name":"A1 Local","url":"https://a1local.com.au/"},"bugs":{"url":"https://github.com/a1local/adpages-browser-capture/issues"},"license":"MIT","readme":"# @a1local/adpages-browser-capture\n\nAdapter layer for turning saved HTML now, and rendered URLs later, into `@a1local/adpages-audit-core` snapshots.\n\nThis package is intentionally small:\n\n- no runtime dependencies\n- no Playwright import yet\n- no remote crawling in the package itself\n- no storage, analytics, or licensing logic\n\n## Static HTML Capture\n\nUse `captureStaticHtmlSnapshot` when a CLI, GitHub Action, local script, or Docker job already has HTML available from disk or stdin.\n\n```ts\nimport { auditLandingPageSnapshot } from \"@a1local/adpages-audit-core\";\nimport { captureStaticHtmlSnapshot } from \"@a1local/adpages-browser-capture\";\n\nconst snapshot = captureStaticHtmlSnapshot(html, {\n  url: \"https://example.com/landing?utm_source=google&utm_medium=cpc&utm_campaign=brand\",\n  sourceLabel: \"saved preview HTML\"\n});\n\nconst audit = auditLandingPageSnapshot(snapshot);\n```\n\nThe helper returns the `PageAuditSnapshot` shape used by audit core. It does not depend on `document`, `window`, JSDOM, or browser APIs, so it is safe for Node-only workflows.\n\nStatic capture is best for pre-rendered HTML, build artifacts, and existing saved-page audits. It will not see client-rendered content, redirects, cookies, layout, computed accessibility state, network requests, or browser console errors.\n\n## CLI Path\n\nThe first CLI integration should keep fetching and file I/O outside this package:\n\n1. Read HTML from `--html-file`, stdin, or a wrapper-owned URL fetch.\n2. Call `captureStaticHtmlSnapshot(html, { url, sourceLabel })`.\n3. Pass the snapshot to `auditLandingPageSnapshot`.\n4. Render text, Markdown, JSON, or CI-friendly output in the CLI wrapper.\n\nWhen URL capture is added, the CLI can accept a rendered-browser adapter that implements `BrowserCaptureAdapter` without making this package depend on Playwright.\n\n## GitHub Action Path\n\nFor the existing saved-HTML Action, this package can replace duplicated extraction logic:\n\n1. Checkout the site or receive a preview artifact.\n2. Read the saved HTML file.\n3. Build a snapshot with `captureStaticHtmlSnapshot`.\n4. Run audit core and publish the report.\n\nFor future preview URL audits, the Action should own browser installation, cache settings, secrets, timeouts, and failure policy. The rendered capture implementation can live beside the Action and satisfy the adapter type exported here.\n\n## Docker Path\n\nA Docker image can provide the heavier runtime without pushing those dependencies into this package:\n\n1. Install the browser runtime in the image.\n2. Run the adapter against one or more URLs.\n3. Emit audit-core-compatible snapshots.\n4. Run audit core and write reports to mounted output paths.\n\nThis keeps local package installs fast while still allowing reproducible URL audits in CI.\n\n## Future Remote Capture\n\nRemote capture should be explicit, user-initiated, and monetisation-safe:\n\n- require a supplied URL or preview URL; do not crawl arbitrary sites by default\n- keep request timeouts, max pages, and concurrency bounded\n- avoid collecting form inputs, cookies, local storage, or authenticated data unless a wrapper explicitly owns that flow\n- keep paid-gating, account state, and license checks outside this package\n- return deterministic snapshot data that audit core can evaluate locally\n\nThe intended future shape is:\n\n```ts\nimport type { BrowserCaptureAdapter } from \"@a1local/adpages-browser-capture\";\n\nexport const captureWithPlaywright: BrowserCaptureAdapter = async (request) => {\n  // Wrapper-owned Playwright code goes here later.\n  // Return a PageAuditSnapshot compatible with @a1local/adpages-audit-core.\n};\n```\n","readmeFilename":"README.md","_rev":"1-602a04cea490bf7bc00854b61688f08a"}