- Category
- Developer Tools
- Rank
- No. 724Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- denoland
- GitHub
- 1.3k stars
- Latest release
- 0.43.2
- Date
About
Build tool that converts Deno modules into clean npm packages with TypeScript, CJS+ESM, and tests.
What it does
dnt runs a publishing pipeline around a Deno codebase. It rewrites imports and runtime globals for Node.js, resolves remote dependencies, checks the transformed output, creates package metadata and declarations, then exercises the emitted variants under Node.
Why it's ranked here
Its strongest argument is scope: transformation, dependency translation, compatibility shims, package metadata, type checking, and runtime testing live in one configurable pipeline. That reduces hand-built publishing glue. The defaults favor broad compatibility, though full checking requires an explicit slower setting.
What's good
Specifier mappings let maintainers replace remote modules with npm dependencies or Node-specific implementations. Built-in and custom shims cover common runtime gaps, with test-only variants available. Tests run against emitted module formats, and process isolation can prevent state leaking between test files.
Tradeoffs
CommonJS output cannot contain top-level await, so maintainers must restructure code or publish only ESM. Default type checking covers one emitted format, not both. Test files share a process unless isolation is enabled, while isolation adds process startup cost. Some shims add package dependencies.
How to use it well
Use it when a Deno-first library needs a repeatable npm publishing step and Node validation. Keep the generated directory disposable, map known npm equivalents, and check both module formats before release. It does not replace npm publishing or redesign incompatible runtime behavior automatically.
Technical notes+
mod.ts exposes the library API and BuildOptions, defaulting to ESM plus CommonJS, inline declarations, tests, and single-format type checking. lib/package_json.ts constructs exports, binaries, dependency groups, test scripts, and the _generatedBy marker. lib/shims.ts separates distribution and test shims, including package-backed globals and custom modules. lib/polyfills.ts validates named overrides and requires the importMeta polyfill for script-module output. lib/npm_ignore.ts excludes emitted tests and conditionally preserves sources referenced by maps. Cargo.toml defines Rust workspace members rs-lib and wasm, while the presented public implementation and tests are TypeScript.
Observed
- License
- MIT, stated in source-file copyright headers.
- Primary language
- TypeScript public API, implementation modules, and tests, with a Rust workspace also present.
- Installation surface
- Available through JSR as @deno/dnt using deno add.
- Interface
- Programmatic library intended for use from a Deno build script.
- Output platform
- Produces packages for Node.js and runs generated output under Node.js.
- Test structure
- TypeScript tests are colocated with implementation modules using .test.ts files.
Read from README.md, Cargo.toml, mod.ts, lib/shims.ts, lib/types.ts, lib/utils.ts, lib/compiler.ts, lib/polyfills.ts, lib/npm_ignore.ts, lib/shims.test.ts, lib/test_utils.ts, lib/utils.test.ts, lib/package_json.ts, lib/compiler.test.ts, lib/polyfills.test.ts.
What it can do
Convert Deno modules to npm packages
Deno module source code → npm package
Generate TypeScript declarations
Deno module code → TypeScript declaration files (.d.ts)
Generate CommonJS module format
Deno module code → CommonJS (.cjs) files
Generate ES module format
Deno module code → ES module (.mjs) files
Convert and migrate tests
Deno test files → npm-compatible test files
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
