{"_id":"@adspyglass/interop","name":"@adspyglass/interop","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@adspyglass/interop","version":"1.0.0","description":"Drop-in browser interop helpers.","license":"MIT","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","default":"./dist/index.js"}},"unpkg":"./dist/interop.global.js","jsdelivr":"./dist/interop.global.js","sideEffects":true,"publishConfig":{"access":"public"},"scripts":{"build":"npm run build:esm && npm run build:cjs && npm run build:iife","build:esm":"esbuild src/index.js --bundle --format=esm --platform=browser --outfile=dist/index.js","build:cjs":"esbuild src/index.js --bundle --format=cjs --platform=browser --outfile=dist/index.cjs","build:iife":"esbuild src/global.js --bundle --format=iife --platform=browser --outfile=dist/interop.global.js","prepack":"npm run build","test":"npm run build && vitest run"},"keywords":["browser","cdn","interop","script-tag","side-effect"],"devDependencies":{"esbuild":"^0.28.0","vitest":"^4.1.4"},"_id":"@adspyglass/interop@1.0.0","gitHead":"8350d06bc8182ce250662108f28fcb1c9032cff1","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-XBfBLvX9Rf/wTZbcfc09zQ9BHPk8cBqorJloKvjsMP2bzRzHga/sn16yqpoD9aFKicea5Ng0wF+qWE0p+8PWvQ==","shasum":"e2d39e237e09a5cea385c2e3317c1ad531cf787d","tarball":"https://registry.npmjs.org/@adspyglass/interop/-/interop-1.0.0.tgz","fileCount":6,"unpackedSize":6207,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDAqf3EiCyR8wXxC/T0g4bL2s9GtiLJHBEyNLCk2PavMAiEA0shrT8cRfTTP5Q9f8LpTtxLLQG8qYxfp5N3WE0z95fU="}]},"_npmUser":{"name":"soundrussian","email":"soundrussian@gmail.com"},"directories":{},"maintainers":[{"name":"soundrussian","email":"soundrussian@gmail.com"},{"name":"zozo30","email":"zozo30@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/interop_1.0.0_1777014064513_0.5817552573104876"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-24T07:01:04.369Z","1.0.0":"2026-04-24T07:01:04.652Z","modified":"2026-04-24T07:01:04.990Z"},"maintainers":[{"name":"soundrussian","email":"soundrussian@gmail.com"},{"name":"zozo30","email":"zozo30@gmail.com"}],"description":"Drop-in browser interop helpers.","keywords":["browser","cdn","interop","script-tag","side-effect"],"license":"MIT","readme":"# `@adspyglass/interop`\n\nDrop-in browser interop helpers for pages that need a global `window.AsgInterop`.\n\n## Install\n\n```bash\nnpm install @adspyglass/interop\n```\n\n## CDN usage\n\nLoad the browser bundle from a CDN and it will initialize `window.AsgInterop` on page load.\n\n```html\n<script src=\"https://unpkg.com/@adspyglass/interop\"></script>\n```\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@adspyglass/interop\"></script>\n```\n\nAfter the script loads:\n\n```js\nwindow.AsgInterop.getCurrentUrl();\nwindow.AsgInterop.getReferrer();\n```\n\n## Bundler usage\n\nImport the package for its side effect. Your final browser bundle will initialize the same global at runtime.\n\n```js\nimport \"@adspyglass/interop\";\n\nwindow.AsgInterop.getCurrentUrl();\nwindow.AsgInterop.getReferrer();\n```\n\n## Behavior\n\n- `window.AsgInterop.getCurrentUrl()` returns the value of `window.location.href` captured when the package initializes\n- `window.AsgInterop.getReferrer()` returns the value of `document.referrer` captured when the package initializes\n- Importing or loading the package more than once is safe\n- This package is browser-only and may throw if evaluated outside a browser environment\n\n## Notes\n\nSome sites use Content Security Policy rules that block third-party scripts. In those environments, prefer bundling the package into your own assets instead of loading it from a CDN.\n\n## Development\n\n- `npm test` builds the package and runs the test suite\n- `dist/` is generated during build and publish, not committed as source\n- Release steps are documented in [`RELEASING.md`](./RELEASING.md)\n","readmeFilename":"README.md","_rev":"1-8c8e2b842f5715c1a909b9745d968b92"}