Download Latest Version v2.0.1 source code.tar.gz (89.8 kB)
Email in envelope

Get an email when there's a new version of CURRENT-DEVICE

Home / v2.0.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-02-25 1.4 kB
v2.0.0 source code.tar.gz 2026-02-25 89.8 kB
v2.0.0 source code.zip 2026-02-25 101.8 kB
Totals: 3 Items   192.9 kB 1

Major Changes

  • Migrated source code from JavaScript to TypeScript with strict type checking
  • Minimum Node.js version is now 22 (previously 10)
  • Package manager changed to pnpm (npm/yarn still work for consumers)
  • Build output moved from lib/, es/, umd/ to dist/
  • Replaced nwb build toolchain with tsup (esbuild-based, faster builds)
  • Replaced Karma/Mocha test setup with Vitest + jsdom
  • Replaced Travis CI with GitHub Actions
  • Removed legacy window.attachEvent fallback (IE-only)

Added

  • Full TypeScript type definitions exported from source
  • Exported types: Device, DeviceType, DeviceOs, DeviceOrientation, OrientationChangeCallback
  • Proper package.json exports field for dual CJS/ESM support
  • GitHub Actions CI workflow

Removed

  • nwb build dependency
  • UMD build output (use ESM or CJS instead)
  • Travis CI configuration

Migration Guide

For npm/yarn consumers: No changes needed to your import statements. The public API is identical:

:::ts
import device from "current-device";
device.mobile(); // still works exactly the same

If you were importing from internal paths (e.g., current-device/lib/... or current-device/umd/...), update to use the package entry point instead.

If you were using the UMD build via <script> tag, switch to an ESM-compatible CDN or bundler.

Source: README.md, updated 2026-02-25