@intlify/vue-router-bridge
Advanced tools
Comparing version 0.0.0-18527c9 to 0.0.0-6c9d585
{ | ||
"name": "@intlify/vue-router-bridge", | ||
"version": "0.0.0-18527c9", | ||
"version": "0.0.0-6c9d585", | ||
"description": "Vue Router bridging for Vue 2 & Vue 3", | ||
@@ -67,4 +67,3 @@ "peerDependencies": { | ||
"postinstall": "node ./scripts/postinstall.js" | ||
}, | ||
"readme": "# @intlify/vue-router-bridge\n\nVue Router bridging for Vue 2 & Vue 3\n\n> This library is inspired by [vue-demi](https://github.com/vueuse/vue-demi)\n\n## đ Features\n- Vue Router composable APIs available on Vue 2 & Vue 3\n - `useRouter`\n - `useRoute`\n- Auto detect Vue Router version on bundling\n- Manual switch versions\n## đŋ Installation\n\n```sh\n# npm\nnpm install @intlify/vue-router-bridge\n\n# yarn\nyarn add @intlify/vue-router-bridge\n\n# pnpm\npnpm add @intlify/vue-router-bridge\n```\n\n## âī¸ Dependencies\n\nYou need to add `vue-router` and `@vue/composition-api` to your plugin's peer dependencies to specify what versions you support.\n\n```js\n{\n \"dependencies\": {\n \"@intlify/vue-router-bridge\": \"latest\"\n },\n \"peerDependencies\": {\n \"@vue/composition-api\": \"^1.0.0-rc.1\",\n \"vue-router\": \"^3.0.0\" // or \"^4.0.0\" base on your preferred working environment\n },\n \"peerDependenciesMeta\": {\n \"@vue/composition-api\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"vue-router\": \"^3.0.0\" // or \"^4.0.0\" base on your preferred working environment\n },\n}\n```\n\nImport everything related to Vue Router from it, it will redirect to `vue-router@3` + `@vue/composition-api` or `vue-router@4` based on users' environments.\n\n```js\nimport { useRouter, useRoute } from '@intlify/vue-router-bridge'\n```\n\nWhen using with [Vite](https://vitejs.dev), you will need to opt-out the pre-bundling to get `@intlify/vue-router-bridge` work properly by\n\n```js\n// vite.config.js\nexport default defineConfig({\n optimizeDeps: {\n exclude: ['@intlify/vue-router-bridge']\n }\n})\n```\n\n## đ¤ Extra APIs\n\n`@intlify/vue-router-bridge` provides extra APIs to help distinguish users' environments and to do some version-specific logic.\n\n### `isVueRouter3` / `isVueRouter4`\n\n```js\nimport { isVueRouter3, isVueRouter4 } from '@intlify/vue-router-bridge'\n\nif (isVueRouter3) {\n // Vue Router 3 only\n} else {\n // Vue Router 4 only\n}\n```\n\n## đē CLI\n\nTo explicitly switch the redirecting version, you can use these commands in your project's root:\n### đ¤ Manually Switch Versions\n\n```sh\nnpx vue-router-switch 2\n# or\nnpx vue-router-switch 3\n```\n\n### đĻ Package Aliasing\n\nIf you would like to import `vue-router` under an alias, you can use the following command:\n\n```sh\nnpx vue-router-switch 2 vue2\n# or\nnpx vue-router-switch 3 vue3\n```\n### 𩹠Auto Fix\n\nIf the postinstall hook doesn't get triggered or you have updated the Vue Router version, try to run the following command to resolve the redirecting:\n\n```sh\nnpx vue-router-fix\n```\n### âŗī¸ Isomorphic Testings\n\nYou can support testing for both versions by adding npm alias in your dev dependencies. For example:\n\n```js\n{\n \"scripts\": {\n \"test:3\": \"vue-router-switch 2 vue-router3 && jest\",\n \"test:4\": \"vue-router-switch 3 && jest\",\n },\n \"devDependencies\": {\n \"vue-router\": \"^4.0.0\",\n \"vue-router3\": \"npm:vue-router@3\"\n },\n}\n```\n\nor\n\n```js\n{\n \"scripts\": {\n \"test:3\": \"vue-router-switch 4 && jest\",\n \"test:4\": \"vue-router-switch 4 vue-router4 && jest\",\n },\n \"devDependencies\": {\n \"vue-router\": \"^3.0.0\",\n \"vue-router4\": \"npm:vue-router@43\"\n },\n}\n```\n\n## đ Thanks\nThis package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)s great work!\n\n## Šī¸ License\n\n[MIT](http://opensource.org/licenses/MIT)\n" | ||
} | ||
} |
@@ -143,3 +143,3 @@ # @intlify/vue-router-bridge | ||
## đ Thanks | ||
This package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)s great work! | ||
This package idea was inspired from [vue-demi](https://github.com/vueuse/vue-demi), [@antfu](https://github.com/antfu)'s great work! | ||
@@ -146,0 +146,0 @@ ## Šī¸ License |
11609