npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-pocket-router

v2.3.0

Published

Tiny replacement for vue-router that fully reloads the view component after navigation.

Downloads

22

Readme

vue-pocket-router

License CI npm

A tiny router implementation for Vue.js 3.2+, which will reload the current view when an already active link is clicked and will always recreate your components after navigation.

Why?

Despite a considerable interest of the community and strong arguments to support this behaviour, vue-router ignores active links and has no configuration option for refreshing the view after clicking the same link again. See https://github.com/vuejs/vue-router/issues/974 and related issues.

Also, vue-router does not recreate the view when new URL leads to the same component, which results in lifecycle hooks not firing when they are expected. See https://forum.vuejs.org/t/rerendering-component-on-route-param-change-recalling-created-hooks/9536.

This library can replace vue-router in simple cases to avoid hacking it.

Note that in vue-router@4 there is an undocumented force parameter that can be used to change behaviour of a specific link, but it's not supported by the developers.

Installation

npm install vue-pocket-router
import { createRouter } from 'vue-pocket-router';

app.use(createRouter({
    // options
}));

Usage

The basic API is very similar to vue-router's, so pretty much everything from https://router.vuejs.org/guide/ and https://router.vuejs.org/guide/essentials/dynamic-matching.html applies.

Available options:

  • routes (required) – array of objects with the following fields:
    • path (required)
    • component (required)
    • name (optional) – for reverse URL resolving
    • props (optional) – object with values of props to pass to the component
    • meta (optional) – any additional data to store with the route (empty object by default)
  • base (optional) – base URL the application is hosted under, e.g. '/app' (note the lack of a trailing slash; empty string by default)

Some differences to vue-router:

  • vue-pocket-router operates in HTML5 history mode only.
  • Matched URL parameters will be automatically passed to components as props, so there is no need to add props: true in your routes. Parameters are still accessible as $route.params.
  • Values of the to prop in router-link component and the argument of $router.push(url)/$router.replace(url) methods must be valid URL strings, not objects. Use $router.resolve(name, params) method, or its shorthand $url(name, params), to obtain URL for a named route with given parameters. If params object contains additional keys other than the route's named segments, they will be appended as a query string.
  • To access current query string values, use $route.query (for single values) or $route.queries (for arrays).
  • vue-pocket-router uses url-pattern as the path matching library. See its documentation for how to build your route patterns.
  • Navigation guards (among other features) are not implemented. You can use a $route watcher instead.

Examples

See test/components/Main.vue and test/index.js.