| Name | Modified | Size | Downloads / 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/todist/ - Replaced
nwbbuild toolchain withtsup(esbuild-based, faster builds) - Replaced Karma/Mocha test setup with Vitest + jsdom
- Replaced Travis CI with GitHub Actions
- Removed legacy
window.attachEventfallback (IE-only)
Added
- Full TypeScript type definitions exported from source
- Exported types:
Device,DeviceType,DeviceOs,DeviceOrientation,OrientationChangeCallback - Proper
package.jsonexportsfield for dual CJS/ESM support - GitHub Actions CI workflow
Removed
nwbbuild 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.