bugsnag / bugsnag-js-performance

Monitor the performance of your JavaScript (web and React Native) and see the results in your BugSnag dashboard.
https://docs.bugsnag.com/performance/integration-guides
MIT License
5 stars 3 forks source link

feat(vue-router): use vue router to resolve routes #476

Closed yousif-bugsnag closed 4 months ago

yousif-bugsnag commented 4 months ago

Goal

Replace the usage of path-to-regexp and use Vue's router.resolve to resolve routes in VueRoutingProvider.

Fixes an issue where routes with parantheses (generated by nuxt) were failing to resolve (see #460)

Design

v4 of vue-router (which we depend on) no longer uses path-to-regexp internally to parse routes, and now uses its own parsing system that supports dynamic routing.

The router object has a resolve method that seems to do what we need (find a corresponding route from a given URL) - and also removes the need to flatten routes when resolving.

Changeset

Testing

Updated the e2e tests to include a nested route and a route with parentheses

github-actions[bot] commented 4 months ago

Browser bundle size

NPM build

Package
Before 190.24 kB
After 190.24 kB
± No change

CDN build

Unminified Minfied Minified + gzipped
Before 95.65 kB 35.92 kB 10.87 kB
After 95.65 kB 35.92 kB 10.87 kB
± No change No change No change

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/vue-router/lib/vue-router-routing-provider.ts 92.85%
(-1.59%)
80%
(-5%)
80%
(-8.88%)
92.85%
(-1.88%)

Total:

Lines Branches Functions Statements
87.09%(-0.03%) 78.37%(-0.15%) 87.96%(-0.1%) 83.88%(-0.04%)

Generated against 7247e51554db5c37faaf7b618825f54a11722d9f on 25 July 2024 at 15:11:12 UTC

gingerbenw commented 4 months ago

Don't forget the changelog entry! 👍🏻