{"_id":"@amazinglynormal/prefetch","_rev":"5-054b0db503f1975b9807fa31616d0d97","name":"@amazinglynormal/prefetch","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@amazinglynormal/prefetch","version":"0.1.0","keywords":["prefetch","prerender","navigation","performance"],"author":{"name":"Stephen Brady"},"license":"MIT","_id":"@amazinglynormal/prefetch@0.1.0","maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"homepage":"https://github.com/amazinglynormal/prefetch","bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"dist":{"shasum":"8ba9c6cb082bb33840644609201bba1a2ac28c0a","tarball":"https://registry.npmjs.org/@amazinglynormal/prefetch/-/prefetch-0.1.0.tgz","fileCount":11,"integrity":"sha512-sB4FBxyFmhylPpjSda6pb9h70ifFvAk/SS9+HnAxj1uRtrrmtnO4BqNjRK/HDYoic0E5uPtFX3lKPi3JacrEUg==","signatures":[{"sig":"MEUCIQDQoGb/rAEvTeYlFfpzfzb343CHwDWW/55/LLuu+rtdvwIgU725zGNdgQLy2O8TEZ8BuYXrQY/aFu17vf6Ezv0iDbM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14353},"main":"./dist/prefetch.umd.js","type":"module","types":"./dist/prefetch.d.ts","module":"./dist/prefetch.js","exports":{".":{"import":"./dist/prefetch.js","require":"./dist/prefetch.umd.js"}},"gitHead":"e3a8385adf484d5d718a04264b8f4681449af8cd","scripts":{"dev":"vite","lint":"eslint lib/**/*.{js,ts,json}","test":"playwright test","build":"vite build","format":"prettier --write lib/**/*.{html,js,ts,json,md,css}","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md","first-changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"_npmUser":{"name":"amazinglynormal","actor":{"name":"amazinglynormal","type":"user","email":"stephenbrady365@gmail.com"},"email":"stephenbrady365@gmail.com"},"_npmVersion":"11.4.2","description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","directories":{},"_nodeVersion":"22.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","eslint":"^9.29.0","prettier":"^3.5.3","@eslint/js":"^9.29.0","typescript":"^5.8.3","@types/node":"^24.0.3","vite-plugin-dts":"^4.5.4","@playwright/test":"^1.53.0","typescript-eslint":"^8.34.1","eslint-config-prettier":"^10.1.5","conventional-changelog-cli":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prefetch_0.1.0_1751568870140_0.23787266566116316","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@amazinglynormal/prefetch","version":"0.1.1","keywords":["prefetch","prerender","navigation","performance"],"author":{"name":"Stephen Brady"},"license":"MIT","_id":"@amazinglynormal/prefetch@0.1.1","maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"homepage":"https://github.com/amazinglynormal/prefetch","bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"dist":{"shasum":"24fd0e99ccf0472d3d729a6b577dda5d39e61ffe","tarball":"https://registry.npmjs.org/@amazinglynormal/prefetch/-/prefetch-0.1.1.tgz","fileCount":11,"integrity":"sha512-ReCU99EmqKobl2TD3y1PX2+DKqzf+4qRxjbYMbbHH3XtBh6UbZkWDBxsPW8Fdi0Ye5Yy5W0M+agqsKDNy5hxTQ==","signatures":[{"sig":"MEUCIGjnFYXZuQUbPi4g9U/Xlw4i7fdjapq8k5Wt+CRAgsJKAiEAjE9cCR2gkSSCIdGISp3TXoduc2qZuQgiTaJ/XiwDf+w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14350},"main":"./dist/prefetch.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/prefetch.js","exports":{".":{"import":"./dist/prefetch.js","require":"./dist/prefetch.umd.js"}},"gitHead":"fd61b1a97877247c1b86ef7c44798e07c9409f72","scripts":{"dev":"vite","lint":"eslint lib/**/*.{js,ts,json}","test":"playwright test","build":"vite build","format":"prettier --write lib/**/*.{html,js,ts,json,md,css}","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md","first-changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"_npmUser":{"name":"amazinglynormal","actor":{"name":"amazinglynormal","type":"user","email":"stephenbrady365@gmail.com"},"email":"stephenbrady365@gmail.com"},"_npmVersion":"10.9.2","description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","eslint":"^9.29.0","prettier":"^3.5.3","@eslint/js":"^9.29.0","typescript":"^5.8.3","@types/node":"^24.0.3","vite-plugin-dts":"^4.5.4","@playwright/test":"^1.53.0","typescript-eslint":"^8.34.1","eslint-config-prettier":"^10.1.5","conventional-changelog-cli":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prefetch_0.1.1_1751644137648_0.2102595199311197","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@amazinglynormal/prefetch","version":"0.1.2","keywords":["prefetch","prerender","navigation","performance"],"author":{"name":"Stephen Brady"},"license":"MIT","_id":"@amazinglynormal/prefetch@0.1.2","maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"homepage":"https://github.com/amazinglynormal/prefetch","bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"dist":{"shasum":"462c307f03b5bf7a9d61845340e7c3218e95659c","tarball":"https://registry.npmjs.org/@amazinglynormal/prefetch/-/prefetch-0.1.2.tgz","fileCount":6,"integrity":"sha512-srPllr5bIP888JkjpHyXM/ZCNkPxZnBRQ/gFZDi399uFkPLepnbHIMVbj9SjXHuac29fG3MB/vzD8I59CKM4UQ==","signatures":[{"sig":"MEYCIQDeBDulhpWMwWtrGF1Y2Ca3WmcKE0p/a9bSiJT1xAS8wAIhAO79N2gns4/O/zT/grqxaGxpE2YO5erVLKjZUFuPshOA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13261},"main":"./dist/prefetch.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/prefetch.js","exports":{".":{"import":"./dist/prefetch.js","require":"./dist/prefetch.umd.js"}},"gitHead":"326a70b6da2babd24f265e7223d8862c8415263f","scripts":{"dev":"vite","lint":"eslint lib/**/*.{js,ts,json}","test":"playwright test","build":"vite build","format":"prettier --write lib/**/*.{html,js,ts,json,md,css}","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md","first-changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"_npmUser":{"name":"amazinglynormal","actor":{"name":"amazinglynormal","type":"user","email":"stephenbrady365@gmail.com"},"email":"stephenbrady365@gmail.com"},"_npmVersion":"10.9.2","description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","eslint":"^9.29.0","prettier":"^3.5.3","@eslint/js":"^9.29.0","typescript":"^5.8.3","@types/node":"^24.0.3","vite-plugin-dts":"^4.5.4","@playwright/test":"^1.53.0","typescript-eslint":"^8.34.1","eslint-config-prettier":"^10.1.5","conventional-changelog-cli":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prefetch_0.1.2_1751645302161_0.7545373714854737","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@amazinglynormal/prefetch","version":"0.1.3","keywords":["prefetch","prerender","navigation","performance"],"author":{"name":"Stephen Brady"},"license":"MIT","_id":"@amazinglynormal/prefetch@0.1.3","maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"homepage":"https://github.com/amazinglynormal/prefetch","bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"dist":{"shasum":"5270ddb34375e5180a153cb875300a84bc97ea31","tarball":"https://registry.npmjs.org/@amazinglynormal/prefetch/-/prefetch-0.1.3.tgz","fileCount":6,"integrity":"sha512-JPMJEF1HN55J7jlU8ZxIURZOxvTE1/xpBT7wX9x7GgWL1Oew6EMYH27F39yd9K+jilxiQIaPYXaPxwbBp9DtvA==","signatures":[{"sig":"MEUCIHL3kCyilkJ6vffp2CRR+GJ8wh/lccylFS3cdxROmEVhAiEA9yHCzN6a64Pnck6e8qx539cRY7tXgkfTcFAkULYDOiA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13249},"main":"./dist/index.umd.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":"./dist/index.js","require":"./dist/index.umd.js"}},"gitHead":"da875f4c03fb5f2d629ec917bf7b8a45eb5bfa52","scripts":{"dev":"vite","lint":"eslint lib/**/*.{js,ts,json}","test":"playwright test","build":"vite build","format":"prettier --write lib/**/*.{html,js,ts,json,md,css}","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md","first-changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"_npmUser":{"name":"amazinglynormal","actor":{"name":"amazinglynormal","type":"user","email":"stephenbrady365@gmail.com"},"email":"stephenbrady365@gmail.com"},"_npmVersion":"10.9.2","description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","eslint":"^9.29.0","prettier":"^3.5.3","@eslint/js":"^9.29.0","typescript":"^5.8.3","@types/node":"^24.0.3","vite-plugin-dts":"^4.5.4","@playwright/test":"^1.53.0","typescript-eslint":"^8.34.1","eslint-config-prettier":"^10.1.5","conventional-changelog-cli":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prefetch_0.1.3_1751647277586_0.4602902225514056","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@amazinglynormal/prefetch","version":"0.1.4","description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","type":"module","main":"./dist/index.umd.js","module":"./dist/index.js","exports":{".":{"import":"./dist/index.js","require":"./dist/index.umd.js"}},"types":"./dist/index.d.ts","scripts":{"dev":"vite","build":"vite build","test":"playwright test","lint":"eslint lib/**/*.{js,ts,json}","format":"prettier --write lib/**/*.{html,js,ts,json,md,css}","first-changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"},"keywords":["prefetch","prerender","navigation","performance"],"homepage":"https://github.com/amazinglynormal/prefetch","bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"author":{"name":"Stephen Brady"},"license":"MIT","publishConfig":{"access":"public"},"devDependencies":{"@eslint/js":"^9.29.0","@playwright/test":"^1.53.0","@types/node":"^24.0.3","conventional-changelog-cli":"^5.0.0","eslint":"^9.29.0","eslint-config-prettier":"^10.1.5","prettier":"^3.5.3","typescript":"^5.8.3","typescript-eslint":"^8.34.1","vite":"^6.3.5","vite-plugin-dts":"^4.5.4"},"_id":"@amazinglynormal/prefetch@0.1.4","gitHead":"04b08a46b43cc77c2d3665d8e50aa61133d02ac6","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-rtUuXmAMtAZ/v+d14Fjso9e8ozJKQn/iWAit3tjzGzMEC1Ga1cZLdgzb0pGxkdFgavCY2oOXZUOldI0Kiqw1og==","shasum":"dcd4fb0b247a9db11b1c4c3abe57146159d76111","tarball":"https://registry.npmjs.org/@amazinglynormal/prefetch/-/prefetch-0.1.4.tgz","fileCount":6,"unpackedSize":13953,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD94exe0VtxtxUaNqO5knnE7MaNjC5vMqj9HsBflLYS0gIhAMKHuSu7yml6vHRLc5YA2Z0ZGJMxpwmPL3tAyD9A+tOj"}]},"_npmUser":{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"},"directories":{},"maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prefetch_0.1.4_1753203436058_0.6629274378746277"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-03T18:54:30.028Z","modified":"2025-07-22T16:57:16.426Z","0.1.0":"2025-07-03T18:54:30.311Z","0.1.1":"2025-07-04T15:48:57.797Z","0.1.2":"2025-07-04T16:08:22.367Z","0.1.3":"2025-07-04T16:41:17.784Z","0.1.4":"2025-07-22T16:57:16.251Z"},"bugs":{"url":"https://github.com/amazinglynormal/prefetch/issues"},"author":{"name":"Stephen Brady"},"license":"MIT","homepage":"https://github.com/amazinglynormal/prefetch","keywords":["prefetch","prerender","navigation","performance"],"description":"Prefetch is a zero-dependency library for dynamically prefetching or prerendering web pages.","maintainers":[{"name":"amazinglynormal","email":"stephenbrady365@gmail.com"}],"readme":"# Prefetch\n\nPrefetch is a zero-dependency library for dynamically prefetching web pages.\n\n## Quick start\n\nWith [npm](https://npmjs.org) installed, run:\n\n```sh\nnpm install @amazinglynormal/prefetch\n```\n\n```js\n// index.js\nimport { watch } from \"@amazinglynormal/prefetch\";\n\nwindow.addEventListener(\"DOMContentLoaded\", () => {\n    watch();\n});\n```\n\nThis basic usage will use all default options:\n\nWatch all anchor tags `<a>` that link to same-site resources.\nPrefetch any link that come into the viewport.\nIf more than one anchor links to the same resource, it will only\nbe requested _once_.\n\n**_Note:_**\nIf your user has save-data enabled or a slow connection is detected,\nno prefetch request will be sent.\n\n## API\n\n### watch([options])\n\n`watch` can be confgured by passing an _optional_ options object.\n\n### options.triggerEvent: \"inView\" | \"onHoverOrFocus\" | \"onPointerOrKeyDown\"\n\n_Default:_ \"inView\"\n\nThe UI event that triggers a prefetch request.\n\n- `\"inView\"`: prefetch is triggered when element comes into viewport.\n- `\"onHoverOrFocus\"`: prefetch is triggered when user hovers over the element with a mouse or when the element has received focus.\n\n**Note:** Most Mobile devices do not have a \"hover\" state because there's no mouse pointer and focus can also be handled a bit differently on mobile browsers. Therefore, `\"onHoverOrFocus\"` may only be an appropriate option if you're primarily targeting desktop users.\n\n- `onPointerOrKeyDown`: prefetch is triggered when pointerdown or \"Enter\" keydown event is on a element.\n\n**Note:** Least aggressive prefetching strategy. It is more so used to give the request a head start as you can be almost certain user intends to go to linked page.\n\n### options.elements: HTMLAnchorElement | NodeList\n\n**Note:** If neither options.elements or options.selectors are passed in the options object, default selector of \"a\" is used.\n\n_Default:_ null\n\nThe anchor element `<a>` or NodeList of anchor elements you wish to watch.\n\n### options.selectors: string[]\n\n**Note:** If neither options.elements or options.selectors are passed in the options object, default selector of \"a\" is used.\n\n_Default:_ null\n\nAn array of CSS selectors to query in the document and watch.\n\n### options.delayMilliseconds: number\n\n_Default:_ 0\n\nThe number of milliseconds anchor element `<a>` must be in the viewport before prefetch request is triggered.\n\n### options.ignore: string[]\n\n_Default:_ []\n\nAn array of [hrefs](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#href) you want ignored. This option overrides both options.elements and options.selectors.\n\n### options.inViewThreshold: number (0 - 1)\n\n_Default:_ 0\n\nThe percentage of the element visible in the viewport before prefetch request is triggered. An inViewThreshold of 1 means 100% of element must be in viewport for the prefetch request to trigger.\n\n### options.prerenderWhenPossible: boolean\n\n_Default: false_\n\n[Please carefully consider which pages you would like to prerender](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API#unsafe_prerendering)\n\nWill append make prerender rather than prefetch request.\n\n**Note:** If Speculation Rules API is not supported by users browser, prefetch will be used as a fallback.\n\n## Other Resources\n\n- [Web.dev's guide to prefetching](https://web.dev/articles/link-prefetch)\n- [Google's quicklink project](https://github.com/GoogleChromeLabs/quicklink)\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"README.md"}