Repository navigation
Modernizes the package to a dual ESM + CommonJS, zero-runtime-dependency build that runs natively in modern Node (>=20) and in the browser, keeping the generator-agnostic design (bring your own generator via addGenerator).
Both module systems work, resolved via conditional exports:
import mocker from 'mocker-data-generator' // ESM / TypeScript
const mocker = require('mocker-data-generator').default // CommonJSThis is a major (v4) because of the dependency majors (faker 10, TS 6, ava 8) and the raised
enginesfloor (node >=20), not because of a module-format break —require()keeps working.
Distribution
"type": "module"+ conditionalexports(import→ ESM,require→ CJS), each with its own type declarations. Validated with@arethetypeswrong/cli(no problems across node10 / node16 CJS+ESM / bundler).unpkg/jsdelivr→ minified, self-contained ESM browser bundle (~7.5 kB, esbuild).sideEffects: false.
Dependencies → latest
faker 8 → 10, TypeScript 4.9 → 6, ava 5 → 8, typedoc 0.23 → 0.28, chance, … tslib removed.
Toolchain (replaced dead/deprecated tools)
- tslint + prettier → Biome
- standard-version + conventional-github-releaser → changesets
- nyc → c8 (native ESM coverage); tests run on TS via tsx
- removed the deprecated
codecovpackage
Fixes
- Removed the now-unnecessary
Array.prototype.includespolyfill. Generator.customnow honors the documentedadapteroption (previously declared in the type but never invoked).
Full changeset: see CHANGELOG.md.