aleclarsoniv

Joined 13 years ago

Karma
71
Submissions
49
Member since
Mar 5
Just a guy trying to build a startup while doing too much OSS. Building with typescript, node.js, postgresql, and cursor (the IDE).

Currently developing:

* radashi <https://github.com/radashi-org/radashi>

* pg-nano <https://github.com/pg-nano/pg-nano>

* alien-rpc <https://github.com/alloc/alien-rpc>

Currently maintaining:

* jumpgen <https://github.com/alloc/jumpgen>

* alien-dom <https://github.com/alloc/alien-dom>

Previously maintained:

* vite (core team from v0 til v4)

* immer (co-author)

* react-spring (co-author)

View on Hacker News

Recent submissions

Comment · 1 year ago
Comment · 1 year ago
I think it'd be worth looking at what's already out there before you put a lot of effort into this, unless of course this is merely for fun/learning.
Comment · 2 years ago
Comment · 2 years ago
Comment · 2 years ago
The most common case is probably complex search queries. It's really nice not having to flatten your data just to get network level caching.

In my case, building an RPC library with REST semantics, it's important to me to not place any restrictions on how developers pass their data to the backend. So removing that arbitrary flattening requirement is a big win. The json-qs specification does it in a way that balances readability and compactness.

Comment · 2 years ago
The home feed is a poor experience, IMO. Adding a tagline to each product would help me know if I want to learn more, without having to decide to click based on a logo and name alone. I think categories would also help me find what I'm interested in.
Comment · 2 years ago
I'd love to get everyone's feedback on this library I made.

I've found it helps a lot when writing a library that takes advantage of compile-time code generation. In the future, I think it could be cool to try and integrate jumpgen with bundlers, like Vite or Rollup, so your file generator can be used as a bundler plugin. Currently, jumpgen “generators” only have a programmatic API, but jumpgen will have a CLI as well, if you think that could be useful. Mostly though, jumpgen is intended as a “white label” library that is contained by your own CLI, if you have one.

# Motivation

Code generation can be useful for many tasks. I'm using code generation in my own libraries, pg-nano[1] and alien-rpc (in development). In pg-nano, I'm generating TypeScript functions that mirror Postgres functions (aka UDFs). In alien-rpc, I'm generating runtime metadata for RPC-style API routing.

I could not find a library that simplifies the task of writing a code generator, so I made jumpgen.

# What It Does

It's designed to handle the burdens of implementing a “watch mode” for your generators. It also returns an event emitter, especially useful for logging. Your generator is free to work in relative paths, since jumpgen handles path resolution according to a user-provided root directory.

It tracks which files your generator has read into memory and which directories your generator has listed. When those files/directories are changed or have files added/removed, your generator will rerun automatically (if watch mode is enabled). This even works with globs!

I've also included a "dedent" helper function so you can indent any template literal without that excess indentation carrying over into the emitted files.

# Feedback Wanted

If this sounds interesting to you, I'd love to hear any comments or criticisms about the API, the readme, or whatever else. Thanks!

[1]: https://github.com/pg-nano/pg-nano

Comment · 2 years ago
That's not entirely true. Tree-shaking algorithms could have a “noDynamicAccess” option that errors on such use (only viable for applications, not libraries). Alternatively, the algorithm could be integrated with the TypeScript compiler API to allow dynamic access in some cases (e.g. where the `anything` function in your example only returns a “string literal” constant type or a union thereof, instead of the `string` type).
Comment · 2 years ago
* Not the creator of Terser, but the lead maintainer

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton