Sign in

Hiroki Osame

@hirok.io
1.4K followers 98 following 69 posts

👤 hirok.io ⚡️ Creator of @tsx.is 📦 Creator of pkg-size.dev 💞 Open Source github.com/privatenumber 💼 SWE @ Square

PostsRepliesMedia
Hiroki Osame @hirok.io · 14/06/2026
If you work with images with text, or scanned documents, here's a small but powerful OCR CLI It leverages Apple's Vision Framework so it's completely local Tip: give it to your agent to save on vision tokens! → npx mac-ocr ./image.png github.com/privatenumbe...
0434
Hiroki Osame @hirok.io · 02/03/2026
Made a JS API & CLI for npm package settings Now you can easily update Trusted Publisher and Publishing Access settings from the CLI or in bulk with a script github.com/privatenumber/npm-pkg-settings
github.com
GitHub - privatenumber/npm-pkg-settings: Programmatic access to npm package publish settings
Programmatic access to npm package publish settings - privatenumber/npm-pkg-settings
000
Hiroki Osame @hirok.io · 02/03/2026
New package: doctor-json 👨🏻‍⚕️ An util to manipulate JSON/JSONC while preserving their formatting and comments The API is so simple—manipulate the parsed object just like you would any plain object, and stringify! github.com/privatenumber/doctor-json
github.com
GitHub - privatenumber/doctor-json: Surgically edit JSON & JSONC strings while preserving whitespace, comments, and formatting
Surgically edit JSON & JSONC strings while preserving whitespace, comments, and formatting - privatenumber/doctor-json
020
Hiroki Osame @hirok.io · 19/12/2025
Made a little tool because I've wasted too much time waiting for `rm -rf node_modules` in large repos Now I can just do `poof node_modules` 💨 github.com/privatenumber/poof
github.com
GitHub - privatenumber/poof: Fast, non-blocking rm -rf alternative. Deletes files instantly while cleanup runs in the background.
Fast, non-blocking rm -rf alternative. Deletes files instantly while cleanup runs in the background. - privatenumber/poof
021
Reposted by Hiroki Osame
VoidZero @voidzero.dev · 27/04/2025
`oxc-minify` is now the recommended minifier when using @rolldown.rs! While continuously tweaking the performance, the minifier is already outperforming `esbuild` in terms of speed and size. Check out the benchmark by @hirok.io for perf comparison. github.com/privatenumbe...
github.com
GitHub - privatenumber/minification-benchmarks: 🏃‍♂️🏃‍♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify, oxc-minify
🏃‍♂️🏃‍♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify, oxc-minify - privatenumber/minification-benchmarks
2122
Hiroki Osame @hirok.io · 15/03/2025
Yep! Limit depends on the model: docs.github.com/en/github-mo...
docs.github.com
Prototyping with AI models - GitHub Docs
Find and experiment with AI models for free.
020
Hiroki Osame @hirok.io · 15/03/2025
It's so crazy I can do this for free now If you're interested in how I do this, I'm querying GPT 4o on @github.com Models via GH Actions on every PR 🙏 Here's the system prompt: github.com/privatenumbe...
github.com
120
Hiroki Osame @hirok.io · 15/03/2025
🤖 Minification Benchmarks now includes an AI analysis with clear recommendations No more manual analysis—read which minifier is best for your needs It's also really entertaining to read: github.com/privatenumbe...
151
Hiroki Osame @hirok.io · 17/01/2025
Hmm yeah I think the conversation happened around there I think it was kind of a hidden exchange on a commit or something... The closest thing I could find was in the docs where imports is mentioned as a standard replacement for paths: www.typescriptlang.org/docs/handboo....
typescriptlang.org
Documentation - Modules - Reference
Module syntax and compiler options reference
010
Hiroki Osame @hirok.io · 17/01/2025
I vaguely remember a TypeScript discussion where they were considering deprecating tsconfig#paths in favor of package.json#imports (but concluded it was too early?) I searched around but couldn't find it... Does this ring a bell for anyone?
110
Hiroki Osame @hirok.io · 11/01/2025
dtsroll is a Type Script declaration file (.d.ts) bundler Use it to: - Tree-shake unused types - Bundle in private monorepo deps - Improve type-checking perf 👉 github.com/privatenumber/dtsroll
1566
Reposted by Hiroki Osame
tsx | TypeScript Execute @handle.invalid · 31/12/2024
Great end to 2024 🎉 🌟 10k GitHub stars ⬇️ 19.5M downloads a month Thank you everyone ❤️
091
Hiroki Osame @hirok.io · 30/12/2024
Very cool! Thanks for making this Kevin 🙌
010
Hiroki Osame @hirok.io · 30/12/2024
Good point! Hope that Issue gains more momentum soon Import Attributes have been supported and stable for a while now
010
Hiroki Osame @hirok.io · 25/12/2024
Thanks for sharing! I didn’t know it had better web support Yep, bundlers conventionally use query parameters for this: vite.dev/guide/assets But ImportAttributes has been around for a while now and can work seamlessly across platforms. I wonder why it hasn't caught on
vite.dev
Static Asset Handling
Next Generation Frontend Tooling
110
Hiroki Osame @hirok.io · 25/12/2024
In your TS project, enabling verbatimModuleSyntax is highly recommended for predictable compilation If you haven't yet because of the errors it produces, I made an auto-fixer: github.com/privatenumbe...
0537
Hiroki Osame @hirok.io · 24/12/2024
Why haven't Import Attributes taken off? Seems it stopped at JSON support It would be great to be able to import text files and create a run-time dependency on it: ```ts import fileContent from './file.txt' with { type: 'text' } ``` nodejs.org/api/esm.html...
nodejs.org
Modules: ECMAScript modules | Node.js v23.5.0 Documentation
4100
Hiroki Osame @hirok.io · 23/12/2024
You’re killing it 🔥
010
Hiroki Osame @hirok.io · 23/12/2024
Thank you and HNY!
010
Hiroki Osame @hirok.io · 22/12/2024
Good year 😊
1240
Hiroki Osame @hirok.io · 19/12/2024
vite-css-modules now supports Vite 6! 👉 github.com/privatenumber/vite-css-modules
github.com
GitHub - privatenumber/vite-css-modules: Vite plugin for correct CSS Modules behavior
Vite plugin for correct CSS Modules behavior. Contribute to privatenumber/vite-css-modules development by creating an account on GitHub.
1453
Hiroki Osame @hirok.io · 19/12/2024
Unsure what you mean by "tree-shake the external dependencies" Externalized deps are excluded from the bundle, so it's never tree-shaken
000
Hiroki Osame @hirok.io · 19/12/2024
Webpack relies heavily on Terser to handle dead code elimination: webpack.js.org/guides/tree-... SWC works as an alternative because it's the Rust port of Terser: github.com/swc-project/...
webpack.js.org
Tree Shaking | webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
010
Hiroki Osame @hirok.io · 16/12/2024
Are you using tsx to import source files across workspace packages? You may be making expensive trade-offs without realizing it Here's a breakdown of the risks and better alternatives: 👉 hirok.io/posts/importing-source-files-in-dev
hirok.io
Think twice before importing package source files
Importing source files from packages during development can cost you more than it saves
161
Reposted by Hiroki Osame
Theo-Steiner @theosteiner.de · 14/12/2024
Do yourself a favor and delete those hacks & brittle build steps you cobbled together, for your library to be consumable from both esm & cjs. Then simply make sure your package.json declares the entrypoints you want & let pkgroll by @hirok.io do the rest! What a delightful little tool ❤️
github.com
GitHub - privatenumber/pkgroll: 📦 Zero-config package bundler for Node.js + TypeScript
📦 Zero-config package bundler for Node.js + TypeScript - privatenumber/pkgroll
261
Reposted by Hiroki Osame
Nicholas C. Zakas @humanwhocodes.com · 11/12/2024
Hey PostCSS experts, folks have requested the ability to parse PostCSS-specific syntax in ESLint, but I really don't know how to accomplish that. Your comments on this issue would be appreciated: github.com/eslint/css/i...
github.com
Change Request: PostCSS syntax support · Issue #29 · eslint/css
Environment ESLint version: Latest (Possible to include the version on the Code Explorer?) @eslint/css version: Latest (Possible to include the version on the Code Explorer?) Node version: N/A npm ...
041
Hiroki Osame @hirok.io · 29/11/2024
Love the distinction between link and file:// hard linking I supported this in my ‘link’ package as “publish mode” Is there a Watch mode to keep file:// dependencies up to date during development? (e.g. new files)
010
Hiroki Osame @hirok.io · 24/11/2024
I think this makes my point A beginner shouldn't need to understand all that to wrap their head around useEffect(() => {}, []) === onMounted(() => {}) This is about empathizing with beginners, not trivializing concepts we already get
100
Hiroki Osame @hirok.io · 23/11/2024
That would trigger on server as well, which may be undesired And may even build up server memory via closure
100
Hiroki Osame @hirok.io · 23/11/2024
Yeah, things make sense once they click But I think theres room for improvement in how long it takes to get there With unsemantic conventions like this, there’s more to learn before a beginner can read code without pausing to check the docs
010
Hiroki Osame @hirok.io · 23/11/2024
What if you’re not dealing with a DOM element? In the case I saw, it was used to trigger i18n initialization Not sure why it had to be on mount—maybe to distinguish from server?
100
Hiroki Osame @hirok.io · 23/11/2024
Yes, but its not a good sign if “once you understand, its fine” is the first line of defense The semantics can be improved for beginners
000
Hiroki Osame @hirok.io · 23/11/2024
Difficulty understanding is the problem We should shorten the learning curve so there is no “once you understand…”
200
Hiroki Osame @hirok.io · 23/11/2024
TIL the way you do onMounted in React is useEffect() with no dependencies react.dev/learn/lifecy... I rarely use React, but this feels kind of hacky to me I feel like the framework beginners learn web dev with should set better examples of semantic & readable code
react.dev
Lifecycle of Reactive Effects – React
The library for web and native user interfaces
481
Hiroki Osame @hirok.io · 21/11/2024
Have you tried `npm prune --omit=dev` to achieve that? I think that could optimize your installation time and cache size Sounds cleaner with less steps + installation + cache and no hacks
100
Hiroki Osame @hirok.io · 21/11/2024
Is this using Docker Multi stage? bsky.app/profile/hiro... Does minimizing disk size via node_modules yield that much of a benefit? Is this about cost?
100
Hiroki Osame @hirok.io · 21/11/2024
Ah thanks for the reference Looks like they recommend running npm install twice for dev and prod respectively. Doesn’t that incur extra overhead? Wonder how it compares to doing one full npm install and then npm prune --omit=dev to minimize image size
100
Hiroki Osame @hirok.io · 21/11/2024
I get the benefits Asking for real life practical examples
100
Hiroki Osame @hirok.io · 21/11/2024
Are dependencies being reinstalled across multistage builds? If so, doesn't this incur extra overhead? Is it possible to keep the initial node_modules to avoid reinstallation, or is there a significant benefit to reinstalling in production mode?
100
Hiroki Osame @hirok.io · 21/11/2024
Right, or they set the env var on the build command rather than the entire CI env
100
Hiroki Osame @hirok.io · 21/11/2024
Maybe I'm just so used to projects nowadays requiring a build step It seems rare to only need dependencies on CI unless you’re only deploying (no lint, test, or build), and it's something extremely simple, like a plain JS server
110
Hiroki Osame @hirok.io · 21/11/2024
If it's during the build step, don't you need your build tools from `devDependencies`? Or are they placed in `dependencies`?
100
Hiroki Osame @hirok.io · 21/11/2024
I'm referring to this: docs.npmjs.com/cli/v10/comm... Where did you read that it's deprecated? And does this mean your Node service is pre-compiled and in your version control? Or is it just in plain JS?
docs.npmjs.com
npm-install | npm Docs
Install a package
100
Hiroki Osame @hirok.io · 21/11/2024
Does anyone use `npm install --production` in their project? I'm writing a blog post on package.json dependencies, and I can't find a practical use for this feature
740
Hiroki Osame @hirok.io · 19/11/2024
To be clear, I haven't tried this yet (I don't even own an iPad) I'm asking to see if anyone can share their experience
000
Hiroki Osame @hirok.io · 19/11/2024
I have to use a 16” MBP for work, and prefer not to manage two laptops Wondering if I could get away with a Mac mini to remote in via iPad iPad seems convenient (e.g., bus/train), but not sure about coding ergonomics
100
Hiroki Osame @hirok.io · 18/11/2024
Working now Ty for walking me through what you mean. Agreed that sticking with CJS with the named export constraint is a valid alternative to providing duplicate dts for each format This is an advanced trick and definitely not what I was referring to though 😂
010
Hiroki Osame @hirok.io · 18/11/2024
Didn't know there was a secret logging method! I've been using this trick I learned from @aduh95 github.com/privatenumbe...
github.com
010
Hiroki Osame @hirok.io · 17/11/2024
Your link is broken
100
Hiroki Osame @hirok.io · 17/11/2024
Not sure if that example proves your point: - xstate-helpers doesn't even use exports: unpkg.com/xstate-helpe... - AreTheTypesWrong results show it only resolves to CJS - Package contents show it only has CJS types (no ESM types): unpkg.com/browse/xstat...
unpkg.com
200