Giter VIP home page Giter VIP logo

routing's People

Contributors

achneoder avatar bobbiegoede avatar kazupon avatar renovate[bot] avatar tmlmt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

routing's Issues

Generate og:url

Clear and concise description of the problem

Other Open Graph tags, like og:title, og:description, etc. can and should be added separately from i18n, but given the logic included in this package of turning localized routes into linkand meta tags, it would be great to generate the og:url metadata in additional to the already generated og:locale ones, so that systems relying on Open Graph (e.g. Facebook scrapers) are satisfied.

Suggested solution

In /src/compatibles/head.ts, rewrite addCanonicalLinks into addCanonicalLinksAndOgUrl

Alternative

  • Write a separate addOgUrl function, but most of the logic / intermediate steps would be the same as addCanonicalLinks
  • Add a new config parameter addOgUrl: boolean to maximize flexibility: thought it wasn't necessary

Additional context

image
See https://developers.facebook.com/docs/sharing/webmasters/#basic

Validations

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): replace dependency npm-run-all with npm-run-all2 ^5.0.0
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency globby to v14
  • chore(deps): update dependency happy-dom to v14
  • chore(deps): update dependency vite to v5
  • chore(deps): update dependency vitest to v1
  • chore(deps): update dependency vue-i18n-legacy to v9
  • chore(deps): update dependency vue-router3 to v4
  • chore(deps): update dependency vue-tsc to v2
  • chore(deps): update stefanzweifel/git-auto-commit-action action to v5
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • fix(deps): update dependency @vueuse/head to v2
  • fix(deps): update dependency vue-i18n to v9.13.1
  • fix(deps): update dependency vue-i18n-routing to v1
  • fix(deps): update dependency vue-router to v4.3.2
  • fix(deps): update vue monorepo to v3 (major) (vue, vue2)
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/github-label-sync.yml
  • r7kamura/github-label-sync-action v0
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-node v4
  • jungwinter/split v2
  • stefanzweifel/git-auto-commit-action v4
npm
package.json
  • @intlify/eslint-plugin-vue-i18n ^2.0.0
  • @types/js-yaml ^4.0.5
  • @types/node ^18.17.4
  • @typescript-eslint/eslint-plugin ^6.3.0
  • @typescript-eslint/parser ^6.3.0
  • bumpp ^9.1.1
  • cross-env ^7.0.3
  • eslint ^8.47.0
  • eslint-config-prettier ^9.0.0
  • eslint-import-resolver-alias ^1.1.2
  • eslint-import-resolver-typescript ^3.6.0
  • eslint-plugin-import ^2.28.0
  • eslint-plugin-prettier ^5.0.0
  • eslint-plugin-tsdoc ^0.2.17
  • eslint-plugin-vue ^9.17.0
  • globby ^13.0.0
  • happy-dom ^6.0.4
  • jiti ^1.19.1
  • js-yaml ^4.1.0
  • lint-staged ^15.0.0
  • npm-run-all ^4.1.5
  • pathe ^1.1.1
  • pkg-types ^1.0.3
  • prettier ^3.0.1
  • rimraf ^3.0.2
  • typescript ^5.1.6
  • vue-eslint-parser ^9.3.1
  • node >= 14.6
packages/vue-i18n-routing/package.json
  • @intlify/shared ^9.4.1
  • @intlify/vue-i18n-bridge ^1.1.0
  • @intlify/vue-router-bridge ^1.1.0
  • ufo ^1.2.0
  • vue-demi >=0.13.5 < 1.0.0
  • @microsoft/api-extractor ^7.31.1
  • api-docs-gen ^0.4.0
  • typescript ^5.1.6
  • vite ^4.4.9
  • vite-plugin-dts ^3.5.1
  • vitest ^0.34.1
  • vue ^3.2.27
  • vue-i18n 9.4.0
  • vue-i18n-legacy 8
  • vue-router ^4.1.5
  • vue-router3 3.6.5
  • vue-template-compiler ^2.6.14
  • vue2 2.6.14
  • @vue/composition-api ^1.0.0-rc.1
  • vue ^2.6.14 || ^2.7.0 || ^3.2.0
  • vue-i18n ^8.26.1 || >=9.2.0
  • vue-i18n-bridge >=9.2.0
  • vue-router ^3.5.3 || ^3.6.0 || ^4.0.0
  • node >= 14.6
playground/vue2-options/package.json
  • @vue/composition-api ^1.7.0
  • vue 2.6.14
  • vue-router 3.5.3
  • vue-i18n ^8
  • vue-i18n-bridge ^9.3.0
  • vue-i18n-routing 0.13.4
  • @types/node ^18.0.4
  • @vitejs/plugin-legacy 1.8.2
  • @vue/runtime-dom 3.2.31
  • typescript ^4.7.4
  • unplugin-vue2-script-setup 0.11.4
  • vite 2.9.18
  • playwright 1.25.2
  • vite-test-utils 0.6.0
  • vitest ^0.34.0
  • vite-plugin-vue2 2.0.3
  • vue-template-compiler 2.6.14
  • vue-tsc 0.40.13
playground/vue2/package.json
  • @vue/composition-api ^1.7.0
  • vue 2.6.14
  • vue-router 3.5.3
  • vue-i18n ^8
  • vue-i18n-bridge ^9.3.0
  • vue-i18n-routing 0.13.4
  • @types/node ^18.0.4
  • @vitejs/plugin-legacy 1.8.2
  • @vue/runtime-dom 3.2.31
  • typescript ^4.7.4
  • unplugin-vue2-script-setup 0.11.4
  • vite 2.9.18
  • playwright 1.25.2
  • vite-test-utils 0.6.0
  • vitest ^0.34.0
  • vite-plugin-vue2 2.0.3
  • vue-template-compiler 2.6.14
  • vue-tsc 0.40.13
playground/vue3-options/package.json
  • vue 3.2.31
  • vue-router 4.1.2
  • vue-i18n ^9.3.0
  • @vueuse/head 0.9.8
  • vue-i18n-routing 0.13.4
  • @types/node ^18.0.4
  • @vitejs/plugin-vue 3.2.0
  • @vitejs/plugin-vue-jsx 2.1.1
  • @vue/tsconfig 0.1.3
  • typescript ^4.8.3
  • vite 3.2.10
  • playwright 1.25.2
  • vite-test-utils 0.6.0
  • vitest ^0.34.0
  • vue-tsc 0.40.13
playground/vue3/package.json
  • vue 3.2.31
  • vue-router 4.1.2
  • vue-i18n ^9.3.0
  • @vueuse/head 0.9.8
  • vue-i18n-routing 0.13.4
  • @types/node ^18.0.4
  • @vitejs/plugin-vue 3.2.0
  • @vitejs/plugin-vue-jsx 2.1.1
  • @vue/tsconfig 0.1.3
  • typescript ^4.8.3
  • vite 3.2.10
  • playwright 1.25.2
  • vite-test-utils 0.6.0
  • vitest ^0.34.0
  • vue-tsc 0.40.13

  • Check this box to trigger a request for Renovate to run again on this repository

How to use params with vue-i18n-routing?

Hi! I need to pass props to a route, but to do it I need to use the name of the route, and the library modifies it.

I tried to use localeLocation, and when running it inside a template it works correctly.
My problem is that I need it to work inside the script block (I'm using vue3 with composition api, and the script setup syntax).

When using the function localeLocation inside the script, it tells me that it does not exist, when importing it (which I do not need to do when using it inside the template) and running the function it returns me that it cant find 'router', but I can not pass it to the function.
What can I do to be able to use parameters with this library?

My project is configured like the playground vue3 project

<script setup lang="ts">
// Does not work
console.log(localeLocation({ name: 'about', params: { test: 'hola' } } ))
</script>

<template>
  <!-- Does work -->
  <pre>{{ localeLocation({ name: 'about', params: { test: 'hola' } }) }}</pre>
</template>

Router and Route are not available in tests when using vue-i18n-routing and vue-test-utils

Describe the bug

When mounting a component that uses useRoute() or useRouter() with vue-test-utils and a vue-i18n-router, the useRoute and useRouter composables do not return any values. Instead the following error will be printed:

[Vue warn]: injection "Symbol(route location)" not found. 
  at <HelloWorld ref="VTU_COMPONENT" > 
  at <VTUROOT>

When using a vue-router instead of the vue-i18n-router everything is working as expected.

Reproduction

https://stackblitz.com/edit/vitejs-vite-vckr8m?file=tests%2FSample.spec.js

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm

Used Package Manager

npm

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

@vue/composition-api is always installed

Describe the bug

I'm on Vue 3, and require vue-i18n-routing 0.7.0 in my package.json.

When I run pnpm i --no-optional, I get the following error message:

image

Reproduction

Cannot reproduce on stackblitz, please advice.

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 46.74 GB / 62.74 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 18.11.0 - ~/.nvm/versions/node/v18.11.0/bin/node
    npm: 8.19.2 - ~/.nvm/versions/node/v18.11.0/bin/npm
  Browsers:
    Firefox: 106.0

Used Package Manager

[email protected]

Additional context

.npmrc

audit=false
engine-strict=true
loglevel=error
fund=false
node-linker=hoisted
prefer-offline=true
progress=false
shamefully-hoist=true
store-dir=.pnpm-store
strict-peer-dependencies=true
update-notifier=false

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

expose `defaultLocale`

Clear and concise description of the problem

I'm using a modified version of nuxt-seo-kit and I'm using it's breadcrumbs
I have modified it to include or omit language codes in the breadcrumb it creates

the problem is, on main page, I have to have a way to detect and omit the default locale's language code for the main page, since default language does not include language code in it's url

currently there's no way to get the defaultLocale set in the config that I'm aware of, cleanly (without using some env variable)

Suggested solution

expose it using a composable ? I'm not sure what's the best way to expose it.

Alternative

the alternative is to simply use runtime config

it won't be clean and it can't be included in a PR for nuxt-seo-kit

Additional context

No response

Validations

Query parameters removed when using localePath with string routes containing query parameters

Description

When utilizing the localePath function by passing a string with a route containing query parameters, such as /some-route?foo=bar, the query parameters are unexpectedly removed. This behavior occurs only when the route exists.

Steps to Reproduce

  1. Use the localePath function with a route containing query parameters as a string argument.
  2. Observe that the resulting route does not include the query parameters.

Code illustration

const path = '/some-route?foo=bar';
const route = localePath(path);
// The expected output should include the query parameters, but they are omitted.
// Result: "/en/some-route"

Reason

Upon investigation, the query parameters removal occurs in the vue-i18n-routing/src/compatibles/routing.ts file, specifically in the following code snippet:

// vue-i18n-routing/src/compatibles/routing.ts line 232
const resolvedRoute = router.resolve(localizedRoute) as any

At this point, the localizedRoute is in the format:

{
  path: "/en/some-route?foo=bar",
}

image
As a result, the query parameters are inadvertently removed from the route.

A possible solution

An observation has been made that the behavior of the router.resolve() function differs when a string is passed versus when an object with a path property is passed. The former retains the query parameters, while the latter removes them.

const router = useRouter()
const path = '/en/some-route?foo=bar'
const routeResolvedFromString = router.resolve(path)
// returns {
//  "fullPath": "/en/some-route?foo=bar",
//  "path": "/en/some-route",
//  "query": { "foo": "bar" },
//  ...
// }

const routeResolvedFromObject = router.resolve({ path })
{
  "fullPath": "/en/some-route",
  "path": "/en/some-route",
  "query": {},
  ...
}

It's unclear whether this behavior is rooted in the vue-router library, but this information could potentially offer a workaround to mitigate the issue.

Reproduction

https://stackblitz.com/edit/nuxt-starter-vbbhvz?file=pages%2Findex.vue

System Info

System:
    OS: macOS 13.5
    CPU: (8) arm64 Apple M1
    Memory: 101.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.6.7 - /opt/homebrew/bin/npm
    pnpm: 7.30.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 113.0.5672.126
    Safari: 16.6
    Safari Technology Preview: 17.0

Used Package Manager

yarn

Additional context

Problem first noticed in Nuxt 3.5.3 with @nuxtjs/i18n 8.0.0-rc.2 with this configuration:

  i18n: {
    locales: [
      {
        code: 'fr',
        name: 'Français',
        iso: 'fr-BE',
      },
      {
        code: 'en',
        name: 'English',
        iso: 'en-US',
      },
    ],
    defaultLocale: 'fr',
    strategy: 'prefix',
    dynamicRouteParams: true,
  },

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.