{"id":28858317,"url":"https://github.com/aidalinfo/v-proximity-prefetch","last_synced_at":"2026-02-06T11:45:53.222Z","repository":{"id":286451948,"uuid":"961446400","full_name":"aidalinfo/v-proximity-prefetch","owner":"aidalinfo","description":"v-proxmity-prefetch is a Vite plugin that improves perceived navigation speed by preloading route components when the user’s cursor gets near a link.","archived":false,"fork":false,"pushed_at":"2025-04-07T07:36:48.000Z","size":152,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T09:41:29.616Z","etag":null,"topics":["prefetch","prerender","router","vue"],"latest_commit_sha":null,"homepage":"https://aidalinfo.github.io/v-proximity-prefetch/","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aidalinfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-06T14:42:29.000Z","updated_at":"2025-04-07T07:36:51.000Z","dependencies_parsed_at":"2025-04-06T16:28:10.369Z","dependency_job_id":"8b308254-b9b5-40fb-9f55-42dd462acb85","html_url":"https://github.com/aidalinfo/v-proximity-prefetch","commit_stats":null,"previous_names":["aidalinfo/ppf-vue","aidalinfo/v-proxmity-prefetch"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aidalinfo/v-proximity-prefetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidalinfo%2Fv-proximity-prefetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidalinfo%2Fv-proximity-prefetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidalinfo%2Fv-proximity-prefetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidalinfo%2Fv-proximity-prefetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidalinfo","download_url":"https://codeload.github.com/aidalinfo/v-proximity-prefetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidalinfo%2Fv-proximity-prefetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29159822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["prefetch","prerender","router","vue"],"created_at":"2025-06-20T02:39:02.557Z","updated_at":"2026-02-06T11:45:53.190Z","avatar_url":"https://github.com/aidalinfo.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue Proximity Prefetch\n\n[![npm version](https://img.shields.io/npm/v/v-proximity-prefetch.svg?style=flat-square)](https://www.npmjs.com/package/v-proximity-prefetch)\n[![GitHub license](https://img.shields.io/github/license/aidalinfo/ppf-vue?style=flat-square)](https://github.com/aidalinfo/ppf-vue/blob/main/LICENSE)\n[![npm downloads](https://img.shields.io/npm/dm/v-proximity-prefetch.svg?style=flat-square)](https://www.npmjs.com/package/v-proximity-prefetch)\n[![GitHub stars](https://img.shields.io/github/stars/aidalinfo/ppf-vue.svg?style=flat-square\u0026label=★)](https://github.com/aidalinfo/ppf-vue)\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003cp\u003e\u003cstrong\u003eBoost your Vue app's perceived performance by prefetching routes when the mouse approaches links\u003c/strong\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n## Features\n\n- 🔍 **Smart Detection**: Detects when the user's mouse approaches navigation links\n- ⚡ **Automatic Prefetching**: Preloads route components before the user clicks\n- 📈 **Enhanced UX**: Reduces perceived loading times for smoother navigation\n- 🔌 **Simple Integration**: Two easy ways to integrate - Vue component or Vite plugin\n- 🔧 **Highly Configurable**: Customize threshold distance, prediction intervals, and more\n- 🪶 **Lightweight**: Minimal overhead with intelligent throttling\n\n## Installation\n\n```bash\n# npm\nnpm install v-proximity-prefetch\n\n# yarn\nyarn add v-proximity-prefetch\n\n# pnpm\npnpm add v-proximity-prefetch\n```\n\n## Getting Started\n\nThere are two ways to use Vue Proximity Prefetch:\n\n### Method 1: Using the Vue Component and Plugin\n\nThis method gives you fine-grained control over which parts of your app use proximity prefetching.\n\n#### 1. Register the Plugin in your Vue app:\n\n```js\n// main.ts or main.js\nimport { createApp } from 'vue'\nimport { createRouter, createWebHistory } from 'vue-router'\nimport App from './App.vue'\nimport { ProximityPrefetchPlugin } from 'v-proximity-prefetch'\n\nconst app = createApp(App)\nconst router = createRouter({\n  history: createWebHistory(),\n  routes: [\n    // your routes...\n  ]\n})\n\napp.use(router)\napp.use(ProximityPrefetchPlugin) // register the plugin\n\napp.mount('#app')\n```\n\n#### 2. Use the Component in your template:\n\n```vue\n\u003c!-- App.vue or any layout component --\u003e\n\u003ctemplate\u003e\n  \u003cheader\u003e\n    \u003cnav\u003e\n      \u003crouter-link to=\"/\"\u003eHome\u003c/router-link\u003e\n      \u003crouter-link to=\"/about\"\u003eAbout\u003c/router-link\u003e\n      \u003crouter-link to=\"/contact\"\u003eContact\u003c/router-link\u003e\n    \u003c/nav\u003e\n  \u003c/header\u003e\n\n  \u003cmain\u003e\n    \u003c!-- Wrap your router-view with ProximityPrefetch --\u003e\n    \u003cProximityPrefetch :threshold=\"200\" :prediction-interval=\"0\"\u003e\n      \u003crouter-view /\u003e\n    \u003c/ProximityPrefetch\u003e\n  \u003c/main\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nimport { ProximityPrefetch } from 'v-proximity-prefetch'\n\u003c/script\u003e\n```\n\n### Method 2: Using the Vite Plugin Only\n\nThis method is simpler and doesn't require adding components to your app. Perfect for quick implementation.\n\n```js\n// vite.config.js or vite.config.ts\nimport { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport { viteProximityPrefetch } from 'v-proximity-prefetch'\n\nexport default defineConfig({\n  plugins: [\n    vue(),\n    viteProximityPrefetch({\n      threshold: 200,\n      predictionInterval: 0,\n      maxPrefetch: 3,\n      automaticPrefetch: true // This enables automatic prefetching!\n    })\n  ]\n})\n```\n\n## Configuration Options\n\n### Component Props\n\n| Prop | Type | Default | Description |\n|------|------|---------|-------------|\n| `threshold` | `number` | `200` | Distance in pixels at which prefetching triggers |\n| `predictionInterval` | `number` | `0` | Interval in ms for checking link proximity (0 means checks only happen when the mouse moves) |\n| `debug` | `boolean` | `false` | Enable debug logging |\n\n### Vite Plugin Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `threshold` | `number` | `200` | Distance in pixels at which prefetching triggers |\n| `predictionInterval` | `number` | `0` | Interval in ms for checking link proximity (0 means checks only happen when the mouse moves) |\n| `maxPrefetch` | `number` | `3` | Maximum number of routes to prefetch at once |\n| `debug` | `boolean` | `false` | Enable debug logging |\n| `automaticPrefetch` | `boolean` | `false` | Enable automatic prefetching without the Vue component |\n\n### Debug Mode\n\nYou can enable debug mode by setting the `PPF_DEBUG` environment variable:\n\n```bash\nPPF_DEBUG=true npm run build\n```\n\nOr in the browser console:\n\n```js\nwindow.PPF_DEBUG = true\n```\n\n## When to Use Each Method\n\n- **Component Method**: More control, prefetches both Vue Router components and routes\n- **Vite Plugin Method**: Simpler implementation, uses browser's standard prefetching\n\n## Demo\n\nCheck out the [live demo](https://vue-proximity-prefetch-demo.netlify.app/) to see the performance difference!\n\n## Browser Support\n\nVue Proximity Prefetch works in all modern browsers that support `\u003clink rel=\"prefetch\"\u003e`.\n\n## Contributing\n\nContributions are welcome! Please see our [Contributing Guide](https://github.com/aidalinfo/ppf-vue/blob/main/packages/vue-proximity-prefetch/CONTRIBUTING.md) for details.\n\n## License\n\n[MIT](https://github.com/aidalinfo/ppf-vue/blob/main/LICENSE)\n\n---\n\nIf you find this plugin useful, please ⭐ the [GitHub repository](https://github.com/aidalinfo/ppf-vue) and share it with other Vue developers!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidalinfo%2Fv-proximity-prefetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faidalinfo%2Fv-proximity-prefetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidalinfo%2Fv-proximity-prefetch/lists"}