This release removes support for old Node.js versions and converts the package to ESM-only. Projects using require() will need to migrate to ESM or use dynamic imports.
After this release CommonJS is no longer supported. See ESM Module FAQ.
Migration Guide
For consumers using CommonJS (require):
// ❌ No longer works
const getRelativeLuminance = require('get-relative-luminance')
// ✅ Option 1: Convert to ESM
import getRelativeLuminance from 'get-relative-luminance'
// ✅ Option 2: Use dynamic import
const { default: getRelativeLuminance } = await import('get-relative-luminance')For consumers already using ESM:
No changes needed - the package now properly exports ESM.
Special thanks to @LitoMore for the initiative and a lot of patience.
Summary
This release modernizes the package from the ground up:
- ESM-only module format (breaking change)
- TypeScript rewrite (migrated from Babel)
- ESLint 9 with flat config
- TypeScript 5.9.2
- tsx for test execution
- Node.js 20, 22, 24 support (old versions removed)
- CI migrated from Travis to GitHub Actions
Changes
Commit List
- BREAKING: remove old node versions from test matrix
0c46512 - build: Move from babel to typescript
db45d61 - build: add allowlist for npm
6ae8122 - build: remove unused entries from .gitignore
49a7636 - build(deps-dev): bump np from 5.2.1 to 7.6.2 (#431)
584e9e4 - ci: move from travis to github actions
bbc7abc - ci: run tests on newer ubuntu
3d614df - ci: run github action on more node versions
e8dad65 - ci: make the yarn install immutable
ca72256 - ci: remove travis config (#444)
7a0c5e6 - ci: remove outdated dependabot config options (#445)
9f9759e - Upgrade to GitHub-native Dependabot (#305)
9434395 - build(deps): [security] bump acorn from 7.1.0 to 7.1.1
9919391 - BREAKING: Convert to ESM-only and upgrade build tools by @misund in #552
- chore: Rename master to main by @misund in #560
TypeScript migration
- ✅ Remove Babel build toolchain
- ✅ Migrate source to TypeScript
- ✅ Add
tsconfig.jsonconfigured for ES2022 output - ✅ Add
@types/nodefor better type support
ESLint 9 with flat config
- ✅ Upgrade ESLint 8.20.0 → 9.32.0
- ✅ Create
eslint.config.mjswith modern flat config format - ✅ Remove old
.eslintrc.json - ✅ Upgrade @typescript-eslint/eslint-plugin 5.30.7 → 7.18.0
- ✅ Upgrade @typescript-eslint/parser 5.30.7 → 7.18.0
- ✅ Upgrade eslint-config-prettier 8.5.0 → 10.1.8
- ✅ Upgrade eslint-plugin-import 2.26.0 → 2.32.0
ESM conversion (⚠️ Breaking Change)
- ✅ Add
"type": "module"to package.json - ✅ Add
exportsfield for proper ESM support - ✅ Update tsconfig.json to output ES2022 modules
- ✅ Update test imports to use
.jsextension for ESM compatibility
Build system improvements
- ✅ Upgrade TypeScript 4.7.4 → 5.9.2
- ✅ Replace ts-node with tsx for running tests
- ✅ Update .mocharc.json to use tsx with --import flag
- ✅ Add skipLibCheck to tsconfig for better compatibility
- ✅ Upgrade mocha 10.0.0 → 11.7.1
- ✅ Upgrade np 7.6.2 → 10.2.0
- ✅ Update @types packages to latest
CI/CD improvements
- ✅ Migrate from Travis CI to GitHub Actions
- ✅ Test on Node.js 20, 22, 24 (current supported versions)
- ✅ Update to actions/checkout@v4 and actions/setup-node@v4
- ✅ Add explicit build verification step
- ✅ Upgrade to GitHub-native Dependabot
- ✅ Rename master to main
Testing improvements
- ✅ Tests now run against TypeScript source directly (faster iteration)
- ✅ Added test to verify built ESM output works correctly
Full Changelog: v1.0.0...v2.0.0