ts-runtime-comparison
dnt
Our great sponsors
ts-runtime-comparison | dnt | |
---|---|---|
3 | 10 | |
370 | 1,142 | |
- | 1.8% | |
0.0 | 7.4 | |
5 months ago | 20 days ago | |
TypeScript | Rust | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ts-runtime-comparison
dnt
-
Creating an NPM Package in 2024 (Deno, dnt)
We are going to use dnt - Deno to Node Transform tool to build the npm package.
-
Build package for NPM & Deno
As already mentioned dnt might help you if you are willing to have deno as your primary development environment. I work in a project like this and the deno tooling is great. I don't even need a package.json since dnt will generate it for me.
-
Write once, run anywhere with Deno and Dnt
Specifically, make my codebase be for Deno, use Deno built-in formatter, linter and testing, and use dnt (Deno to Node Transform) to generate an npm package containing ESM code and to test generated code. For testing in the browser, deploy the test content linked to the generated ESM code to Github Pages and use playwright/test. For Cloudflare Workers, use wrangler to set up a worker locally for testing. A schematic diagram is shown below.
- Fresh is a new full stack web framework for Deno
-
tsx: Node.js enhanced with esbuild to run TypeScript & ESM
I ended up building the library with Deno and compiling to Node.js CJS and ESM using https://github.com/denoland/dnt
-
Deno 1.20
Yes, TS code is compiled to run in browsers. You can compile and bundle using `deno bundle` if your project is developed in Deno. Since I'm using Deno for library development, I use the `dnt`[1] tool to compile them into ESM modules later consumed by esbuild in my Node-based projects/toolchains.
-
How to compule/bundle code for nodejs?
Maybe this could help? https://github.com/denoland/dnt
What are some alternatives?
tsx - ⚡️ TypeScript Execute: Node.js enhanced to run TypeScript & ESM
klaro-js - Klaro Privacy Manager. An open-source, privacy-friendly & compliant consent manager for your website.
undici - An HTTP/1.1 client, written from scratch for Node.js
is-bun - Return true if you are running in Bun.
deno - A modern runtime for JavaScript and TypeScript.
SvelteKit - web development, streamlined
isomorphic-webcrypto - :game_die: webcrypto library for Node, React Native and IE11+
denoify - 🦕For NPM module authors that would like to support Deno but do not want to write and maintain a port.
oak - A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
hydrogen - Hydrogen lets you build faster headless storefronts in less time, on Shopify.
astro - The web framework for content-driven websites. ⭐️ Star to support our work!