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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@onderwijsin/nuxt-device

v1.0.7

Published

Nuxt module for request-aware device and browser detection.

Readme

@onderwijsin/nuxt-device

Nuxt 4 module that exposes SSR-aware device, operating-system, browser, and crawler flags through the auto-imported useDevice composable.

The logic in this module is inspired by @nuxtjs/device, but our implementation takes a different approach:

  • we do not install a global plugin, making the core bundle smaller
  • device flags are reactive and recalculated client side, making the module usable in prerendered routes

Do not use this module concurrently with @nuxtjs/device, because conflicts will occur.

Install and register

pnpm add @onderwijsin/nuxt-device
export default defineNuxtConfig({
  modules: ["@onderwijsin/nuxt-device"]
});

Configuration

Options are configured under device:

| Option | Type | Default | Description | | ------------------ | --------- | --------------- | --------------------------------------------------------------------------------- | | enabled | boolean | true | Disables module setup when false. | | defaultUserAgent | string | Chrome on macOS | User agent used when no request header is available, such as during prerendering. |

Use device flags

useDevice() is auto-imported by the module and returns a stable reactive object:

<script setup lang="ts">
const device = useDevice();
</script>

<template>
  <MobileNavigation v-if="device.isMobile" />
  <p v-else-if="device.isCrawler">Crawler request</p>
  <DesktopNavigation v-else />
</template>

The object includes userAgent, isMobile, isMobileOrTablet, isTablet, isDesktop, isDesktopOrTablet, isIos, isAndroid, isWindows, isLinux, isMacOS, isApple, isSafari, isFirefox, isEdge, isChrome, isSamsung, and isCrawler.

On the server, CloudFront and Cloudflare device headers take precedence for device class. Browser flags come from the user agent; operating-system flags also come from it, except CloudFront iOS and Android headers override those two flags when supplied. On the client, the browser's navigator.userAgent is used after hydration.

Compatibility and boundaries

  • Requires Node.js 22 or newer and Nuxt 4.
  • useDevice is the public runtime API; internal regexes and generated templates are not public imports.
  • Detection is heuristic. Treat flags as presentation hints, not as an authorization or security boundary.

Development

pnpm --filter device-playground dev
pnpm --filter device-playground typecheck

Developed and tested against Node.js 24 and Nuxt 4.5.x. The package declares Node.js >=22 and may work with other Nuxt versions permitted by its package metadata, but versions outside the current CI matrix are not continuously tested. Nuxt 3 is not guaranteed.