{"_id":"@blankeos/vike-routegen","_rev":"3-765b3beb24c567bbb43f43e150f62b72","name":"@blankeos/vike-routegen","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@blankeos/vike-routegen","version":"0.0.1","keywords":["vike","routegen","typesafe","routing","tanstack router","vite"],"author":{"name":"Carlo Taleon"},"license":"MIT","_id":"@blankeos/vike-routegen@0.0.1","maintainers":[{"name":"blankeos","email":"carloantonioct@gmail.com"}],"dist":{"shasum":"752ba48f163a5f6df245c40c7a4defe070a4b966","tarball":"https://registry.npmjs.org/@blankeos/vike-routegen/-/vike-routegen-0.0.1.tgz","fileCount":9,"integrity":"sha512-3jWg+sa6IcumAwLeq00ZcTDoj3YYjM1MhcuKVRl2tqcUsFAtGYVj0uRAj33fCs7zvnSzAH5FGrvut1mWpgTc4Q==","signatures":[{"sig":"MEYCIQC0t32QcQi6XpZqcIFoII3vp18O/J2SmBw4mpQrWJye7gIhAPQT7r5Nx1Swd6KfRhWVqerkW60hO847JgMRvIfVVZ8a","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54087},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"4515cabe5ac1f4ec5446a60f3658871859768e84","private":false,"scripts":{"ci":"bun run lint && bun run build","dev":"bunx --bun vite serve dev","lint":"tsc","test":"bun test; bunx playwright test;","build":"tsup","format":"prettier --write .","update":"bunx npm-check-updates --interactive --format group","build:site":"vite build dev","publish-pkg":"bun run lint && bun run build && changeset publish"},"_npmUser":{"name":"blankeos","email":"carloantonioct@gmail.com"},"_npmVersion":"10.8.2","description":"Typesafe routes in Vike just like in TanStack Router. Just a vite extension.","directories":{},"_nodeVersion":"20.18.3","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vike":"^0.4.206","vite":"^5.4.11","eslint":"^9.16.0","prettier":"^3.4.2","solid-js":"^1.9.3","@types/bun":"^1.1.14","typescript":"^5.7.2","vike-solid":"^0.7.6","autoprefixer":"^10.4.20","@changesets/cli":"^2.27.10","@playwright/test":"^1.49.1","eslint-plugin-solid":"^0.14.4","vike-metadata-solid":"^1.0.4","@testing-library/dom":"^10.4.0","@hono/vite-dev-server":"^0.17.0","@typescript-eslint/parser":"^8.17.0","@changesets/changelog-github":"^0.5.0","@happy-dom/global-registrator":"^15.11.7","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/vike-routegen_0.0.1_1741636740225_0.6362077723297783","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@blankeos/vike-routegen","version":"0.0.2","keywords":["vike","routegen","typesafe","routing","tanstack router","vite"],"author":{"name":"Carlo Taleon"},"license":"MIT","_id":"@blankeos/vike-routegen@0.0.2","maintainers":[{"name":"blankeos","email":"carloantonioct@gmail.com"}],"dist":{"shasum":"79ac78f0f4cd0210ae5de1aef11fdcf59a3c7f8f","tarball":"https://registry.npmjs.org/@blankeos/vike-routegen/-/vike-routegen-0.0.2.tgz","fileCount":9,"integrity":"sha512-sUhg+eQL9lqBDbbJl/WQbuvmWkFmZauHx9Xnu7hJZsB0zwKd2Mrm3X9cFyGzyR/cciMV6YxD5x0rHrwFWGX1aw==","signatures":[{"sig":"MEUCIQCKEkRcKaA1PFTdrHd6AnFhMFVp6imlZ11ai11JK4gipgIgAe9AuLSHq4p6xQtjgvv6LGULVkUpb741D+8PZkj1xAU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47311},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"6d8997aadc7c63dfc6e70d4b96d672d59f305fdc","private":false,"scripts":{"ci":"bun run lint && bun run build","dev":"vite serve dev","lint":"tsc","test":"bun test; bunx playwright test;","build":"tsup","format":"prettier --write .","update":"bunx npm-check-updates --interactive --format group","build:site":"vite build dev","publish-pkg":"bun run lint && bun run build && changeset publish"},"_npmUser":{"name":"blankeos","email":"carloantonioct@gmail.com"},"_npmVersion":"10.8.2","description":"Typesafe routes in Vike just like in TanStack Router. Just a vite extension.","directories":{},"_nodeVersion":"20.18.3","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vike":"^0.4.206","vite":"^5.4.11","eslint":"^9.16.0","prettier":"^3.4.2","solid-js":"^1.9.3","@types/bun":"^1.1.14","typescript":"^5.7.2","vike-solid":"^0.7.6","autoprefixer":"^10.4.20","@changesets/cli":"^2.27.10","@playwright/test":"^1.49.1","eslint-plugin-solid":"^0.14.4","vike-metadata-solid":"^1.0.4","@testing-library/dom":"^10.4.0","@hono/vite-dev-server":"^0.17.0","@typescript-eslint/parser":"^8.17.0","@changesets/changelog-github":"^0.5.0","@happy-dom/global-registrator":"^15.11.7","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/vike-routegen_0.0.2_1741698957339_0.16045788530611071","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@blankeos/vike-routegen","private":false,"description":"Typesafe routes in Vike just like in TanStack Router. Just a vite extension.","version":"0.0.3","author":{"name":"Carlo Taleon"},"main":"./dist/index.js","module":"./dist/index.js","devDependencies":{"@changesets/changelog-github":"^0.5.0","@changesets/cli":"^2.27.10","@happy-dom/global-registrator":"^15.11.7","@hono/vite-dev-server":"^0.17.0","@playwright/test":"^1.49.1","@testing-library/dom":"^10.4.0","@types/bun":"^1.1.14","@typescript-eslint/eslint-plugin":"^8.17.0","@typescript-eslint/parser":"^8.17.0","autoprefixer":"^10.4.20","eslint":"^9.16.0","eslint-plugin-solid":"^0.14.4","prettier":"^3.4.2","solid-js":"^1.9.3","tsup":"^8.3.5","typescript":"^5.7.2","vike":"^0.4.206","vike-metadata-solid":"^1.0.4","vike-solid":"^0.7.6","vite":"^5.4.11"},"keywords":["vike","routegen","typesafe","routing","tanstack router","vite"],"license":"MIT","scripts":{"dev":"vite serve dev","test":"bun test; bunx playwright test;","build":"tsup","build:site":"vite build dev","ci":"bun run lint && bun run build","publish-pkg":"bun run lint && bun run build && changeset publish","lint":"tsc","format":"prettier --write .","update":"bunx npm-check-updates --interactive --format group"},"type":"module","types":"./dist/index.d.ts","_id":"@blankeos/vike-routegen@0.0.3","gitHead":"10238dcca48aa194aa564e1ad103b7d73bfc2a7b","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-oQ9PqHLeaU8agOYvbGBKAzdKjCEBlVCECHxva9MNJ8Md/DC+3B3cEPjvo5eMFfFtysaBXdta5Adz76KGpc1qLQ==","shasum":"5a7ea5d665db492a5816eec3d541e049149d6247","tarball":"https://registry.npmjs.org/@blankeos/vike-routegen/-/vike-routegen-0.0.3.tgz","fileCount":9,"unpackedSize":50410,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHpUWdzc9aW9VN9GT5tyuj/6yiuMhQM1JPjVc8pZYy4RAiEA9Jmcq7FHpadiqp4ZKRAb56N/jCANMmjnE1yikEHepcU="}]},"_npmUser":{"name":"blankeos","email":"carloantonioct@gmail.com"},"directories":{},"maintainers":[{"name":"blankeos","email":"carloantonioct@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vike-routegen_0.0.3_1753969680397_0.8480671176422332"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-10T19:59:00.166Z","modified":"2025-07-31T13:48:00.809Z","0.0.1":"2025-03-10T19:59:00.397Z","0.0.2":"2025-03-11T13:15:57.573Z","0.0.3":"2025-07-31T13:48:00.643Z"},"author":{"name":"Carlo Taleon"},"license":"MIT","keywords":["vike","routegen","typesafe","routing","tanstack router","vite"],"description":"Typesafe routes in Vike just like in TanStack Router. Just a vite extension.","maintainers":[{"name":"blankeos","email":"carloantonioct@gmail.com"}],"readme":"# Vike Routegen\n\n![banner](_docs/banner.png)\n\nA typesafe routing utility for [Vike](https://vike.dev) applications. Inspired by TanStack Start.\n\nForewarned, this is more like a temporary. For me, it's currently a feature-complete solution and I'll be using it for my projects. That's why it's published under a scoped package name.\n\nBut this also serves as an experiment for adding this into Vike's core.\n[Vike is planning to make this a built-in feature](https://github.com/vikejs/vike/issues/698).\n\n## Installation\n\n```bash\nnpm install -D @blankeos/vike-routegen\n```\n\nAdd the plugin to your Vite config:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from \"vite\";\nimport vikeRoutegen from \"@blankeos/vike-routegen\";\n\nexport default defineConfig({\n  plugins: [\n    // ...\n    vike(),\n    vikeRoutegen(), // Has sensible defaults + automatic detection (solid/react/vue), so it can be zero-config.\n  ],\n});\n```\n\n## Usage\n\nOnce installed, Vike Routegen will automatically generate a route tree file that provides typesafe routing utilities for your application.\n\n### API\n\n#### `getRoute()`\n\nGenerates typesafe route URLs based on your Vike pages:\n\n```tsx\nimport { getRoute } from \"./route-tree.gen\";\n\n// Regular route\nconst homeUrl = getRoute(\"/\");\n// 👉 Result: \"/\"\n\n// Route with params\nconst postUrl = getRoute(\"/blog/@slug\", {\n  params: { slug: \"my-awesome-post\" },\n});\n// 👉 Result: \"/blog/my-awesome-post\"\n\n// Route with search params\nconst searchUrl = getRoute(\"/search\", {\n  search: { query: \"vike\", category: \"framework\" },\n});\n// 👉 Result: \"/search?query=vike&category=framework\"\n\n// Catch-all route\nconst docsUrl = getRoute(\"/docs/@\", {\n  params: { \"@\": [\"guide\", \"getting-started\"] },\n});\n// 👉 Result: \"/docs/guide/getting-started\"\n```\n\n#### `useParams()`\n\nAccess route parameters with full type safety:\n\n```tsx\nimport { useParams } from './route-tree.gen'\n\nfunction BlogPost() {\n  // For routes like /blog/@slug\n  const { slug } = useParams({ from: '/blog/@slug' }) // 📝 Quick tip: Avoid destructuring like this in SolidJS.\n\n  // For catch-all routes like /docs/@\n  const { '@': segments, '_@': fullPath } = useParams({ from: '/docs/@' }) // 📝 Quick tip: Avoid destructuring like this in SolidJS.\n\n  return (\n    // Your component using the params\n  )\n}\n```\n\n> ![NOTE]\n> There are gotchas with SolidJS for reactivity to work with useParams.\n> Make sure to not \"destructure\" the result. Also write the code like:\n>\n> ```tsx\n> const routeParams = useParams({ from: \"/docs/@\" });\n> routeParams().id; // It's an accessor.\n> ```\n\n## Optional Configuration\n\nThis is designed to work out-of-the-box with Vike and the\nstandard vike extensions, but you can also do the following.\n\n```ts\nvikeRoutegen({\n  // Import source for usePageContext (used to generate useParams)\n  // This is actually auto-detected from your vite.config.ts, but in cases\n  // where it doesn't detect it correctly, just explicitly write it here like so:\n  usePageContextImportSource?: \"vike-react/usePageContext\",\n\n  // Output path for the generated file\n  // Defaults to 'src/route-tree.gen.ts' if 'src' exists, otherwise 'route-tree.gen.ts'\n  outputPath?: \"src/routes.generated.ts\",\n});\n```\n\nSet `usePageContextImportSource` to `false` to disable the `useParams` utility. If you're not using\none of the standard vike extensions (vike-react, vike-solid, vike-vue).\n\nBUGS I NOTICED:\n\n- Catch all when it's on pages/@ (so something like pages/all/+route.ts = export default '\\*'), it doesn't work.\n- The `from` in useParams should be completely independent from what is being generated.\n","readmeFilename":"README.md"}