Hey yall, I finally made a website!
👉 hirok.io
I'm going to start blogging about my learnings and projects so stay tuned!
Why did I make this site? Here's an introductory post:
hiroki osame
@privatenumbr
hiroki osame’s Tweets
tsx - Node.js runner for TypeScript & ESM built on top of esbuild
github.com/esbuild-kit/tsx
A substantial improvement over `tsm` for me
by
1
4
#TypeScript
tsx (TypeScript Execute)っていうts-nodeの代替ツール、esbuildがバックエンドでコンパイルも爆速で、REPLもついてて、ESMなTypeScriptも動かせて、めちゃ便利。入れておいて損はない😌
1
24
175
By bundling with pkgroll, I'm able to update my packages without any build config changes 🔥
6
Show this thread
This is using the recommended export map from TypeScript:
github.com/microsoft/Type
1
3
Show this thread
Started updating my packages to use the following configuration in package.json:
- Explicit extensions: CommonJS → .cjs, ESM → .mjs
- Dts files via d.cts/d.mts for Node16 resolution
- Export map entries to have Dts for both require/import in Node16
3
3
21
Show this thread
My first use-case for resolve-pkg-maps is alias-imports—a Node.js loader for creating bare aliases:
Quote Tweet
Another release hot off the press
alias-imports lets you to create BARE aliases via imports map
You can override imports across your codebase (incl. dependencies) based on conditions
Powered by resolve-pkg-maps released earlier today!
github.com/privatenumber/
Show this thread
Another release hot off the press 🗞
alias-imports lets you to create BARE aliases via imports map
You can override imports across your codebase (incl. dependencies) based on conditions
Powered by resolve-pkg-maps released earlier today!
github.com/privatenumber/
1
7
First package release in a while 🎉
resolve-pkg-maps: a resolver for package.json exports/imports
Tested exhaustively against Node for 💯% accuracy
Excited for the tools this could power and the niche tsx resolution bugs this could fix
2
2
20
Show this thread
Always feels great replacing rollup configuration with pkgroll! Much cleaner 🧹
6
Argv mutation is used in tsx to filter out tsx-only flags from argv before passing it down to Node.js (because it errors on unknown flags)
github.com/esbuild-kit/ts
Might sound trivial to do at first but gets complicated when you consider flags can accept values in multiple ways
Show this thread
type-flag v3 released! 🚀
⭐️ `getFlag` function to get a single flag from argv
🧬 argv mutation to remove parsed tokens
🔍 `ignore` filter to skip tokens from being parsed
🐥 Only 1.4 kB
If you use minimist but want better TS support, give it a try!
github.com/privatenumber/
1
4
22
Show this thread
1/ I wanted a minimal setup for TS/ESM project: bundling via esbuild, unit tests via:
"scripts": {
"test": "mocha --loader=tsx --ui qunit",
"testall": "mocha --loader=tsx --ui qunit \"./src/**/*_test.ts\""
},
2
3
28
Show this thread
Google Maps Direction Finder is such an underrated feature in Google Sheets
We're apartment hunting in Tokyo so we're using it to automatically calculate the commute to key destinations
Super easy to filter out places that are too inconvenient
1
7
Exciting personal news—I'm moving to Tokyo! 🗼🎌
I moved to the US for college 11 years ago. During my time, I lived in Boston, San Francisco & NYC. The US has been incredible but it's time for a new adventure.
Tokyo is my favorite city so I'm beyond excited to live there!
1
26
⭐️ tsx just passed 2k stars & 1k users on GitHub and 50k npm downloads a week 🚀
Thanks for all the love ❤️ And thanks to everyone that contributed!
7
65
TIL Accessing an ESM import variable is 10x slower than CJS because of live bindings
3
13
84
clean-pkg-json removes any irrelevant data from package.json right before publish:
1
Show this thread
Felt nitpicky at first but I've been adopting github.com/privatenumber/ in a lot of my projects
It saves publishing bytes and also removes development concerns from inadvertently bleeding into consuming projects:
1
5
Show this thread
Introducing Bun - an incredibly fast all-in-one JavaScript runtime.
245
2,057
7,844
Show this thread
Just realized you can use Node import maps to set an alias to a TypeScript file for dev and toggle it with Node's `--conditions` flag and run it with tsx 🪄
Might be my new go-to dev setup!
github.com/privatenumber/
1
4
21
PS.
You may have noticed the esbuild-kit org:
github.com/esbuild-kit
We're planning to use that space to create & curate more high quality tools powered by esbuild
Keep an eye out for new projects!
15
Show this thread
We hope tsx (+ loaders) enhances your developer experience to seamlessly and reliably run TypeScript!
A big thank you to for building & maintaining esbuild — the magic that made all this possible! 🙌
Thanks for reading ✌️
1
10
Show this thread
⚙️ get-tsconfig
A tiny resolver & parser for tsconfig.json files, with a compilerOptions.paths matcher
Tested against tsc to achieve parity
1
1
7
Show this thread
📦🍣 pkgroll
zero-config bundler powered by Rollup & esbuild
Quote Tweet
Show this thread
2
1
7
Show this thread
In the process of developing tsx, a few interesting projects were built to support it:
💮 満点 (manten): lightweight async testing framework
This is how we run 1,356 tests in ~3min
Quote Tweet
Published
満点 (manten) over the weekend, an async-first JS testing library
Its less than 1kB and only does async flow management and test result logging. Its extremely fast with no overhead!
github.com/privatenumber/
1
10
Show this thread
We also added some bonus features:
✨ tsx: beautifully short name donated by . Just type "npx tsx" to get started
💻 TypeScript REPL: Run TS code snippets without saving to disk
👀 Watch mode: nodemon alternative
1
9
Show this thread
Under the hood, tsx is composed of two loaders you can use directly. This is how tsx is package-type agnostic!
cjs-loader: require hook to transform ESM/TypeScript → CommonJS
github.com/esbuild-kit/cj
esm-loader: import hook to transform TypeScript → ESM
github.com/esbuild-kit/es
1
6
Show this thread
To see how seamlessly it's all integrated, check out our transformation, resolution, and interoperability charts and how it compares to other runtimes like ts-node:
📊
2
1
13
Show this thread
To make sure it's reliable with max compatibility, tsx has 1,356 tests in CommonJS and Module package types, using Node.js v12~18, running on both Linux & Windows 💪💎
It's a single binary that adapts its output to leverage as much native Node.js functionality possible
1
13
Show this thread
It's been in development for months and public for weeks, and I finally feel its ready to be announced
Despite that, it's already used by 200+ projects 🤯 and has been growing organically super fast (500+ ⭐️)
Thank you to the early adopters for feedback and bug reports! ❤️
1
10
Show this thread
A few weeks ago, and I joined forces on a project called "tsx"
TypeScript Execute (tsx) is a Node.js runtime enhanced with esbuild to run TypeScript & ESM ⚡️
If you're familiar with esno/esmo, tsx is its successor 🙌
16
105
553
Show this thread
Growing the product design team is a top priority for us — wanted to share a few details about who we are and what we’re up to 🙂
8
25
378
Show this thread
9/ If you're interested in learning more about the footguns of `npm link`, checkout the blog post:
👉
1
1
Show this thread
8/ I also added a few enhancements like configuration file and deep linking to make linking an easier and smoother experience
Hopefully more features coming soon! ✌️
1
Show this thread
7/ `npx link` fixes these problems 💫
It doesn't globally install so different Node.js versions can be used. It doesn't uninstall previous links. And it has a clear fail-state and never falls back to the remote registry.
Try it out!
$ npx link ./package/path
1
Show this thread
6/ When these footguns come together, it's a recipe for trouble
It's very easy to accidentally install a remote package and its binaries while believing linking a local package succeeded
This can turn out really bad when a malicious or file-tampering package gets installed
1
Show this thread
5/ npm link unexpectedly removes previous links
When linking multiple packages, previously linked packages get removed
To link multiple packages, you need to link them in all at once:
$ npm link a b c
1
Show this thread
4/ BTW if you previously linked package "a", binary "a" was installed:
$ a
You'd think `npm unlink a` will uninstall it but it wont 🤯
Uninstall it with:
$ npm uninstall -g a
1
Show this thread






