Better HN
topnewbestaskshowjobs
Log inSign up

sbjs

962 karma · joined Jul 3, 2018 (8y ago) · 325 submissions

Submissions

comment 1y ago · link · parent

It's a highly optimized and extremely simple yet robust implementation of it, sure. Is that reason to dismiss it?

Consider Vite's node-side HMR implementation. It creates its own module system on top of Node's native module system, using `node:vm`. So its modules are really second class citizens that have to be glued to the native module system.

This library used to do that, but moved to using Node's native module hooks, so that there's nothing magical going on, and you can still use the `import` expression to import your HMR modules, they just auto-update when saving.

comment 1y ago · link · parent

That's orthogonal, and in fact you probably would use TypeScript to translate JSX to JS when using this library. What this does is (a) provide a Node.js module hook to call your transpile function when it encounters TSX/JSX files, and (b) provide a Node.js module that lets you remap imports, including "react/jsx-runtime" if you want a different JSX implementation.

comment 1y ago · link · parent

It's English, it just looks like regex. In English, the ? belongs inside the parens in this case.

comment 1y ago · link · parent

Just updated the text to be hopefully much clearer.

comment 1y ago · link · parent

Oh no, I must have mis-explained it.

The file `site/myfile.js` does exist. All FileTree does is recursively load all files in a dir into memory.

The `useTree` module hook does two things:

* Pulls the file from memory when loading it instead of from disk

* Adds a cache busting query string when resolving it for invalidation

Combined with tree.watch(), this essentially allows you to add a very lightweight but extremely accurate hot module replacement system into Node.js

    const tree = new FileTree('src', import.meta.url)
    registerHooks(useTree(tree))
    tree.watch().on('filesUpdated', () => import(tree.root + '/myfile.js'))
    import(tree.root + '/myfile.js')
Now save src/myfile.js and see it re-executed

comment 1y ago · link · parent

Just added some code samples, thanks for the suggestion.

7.

Show HN: Mid-level Node.js helpers for building a front-end website(immaculata.dev ↗)

1 points · by sbjs · 1y ago · discuss

8.

Comparing Immaculata to Vite(immaculata.dev ↗)

1 points · by sbjs · 1y ago · discuss

9.

(ab?)using Node module hooks to speed up development(immaculata.dev ↗)

38 points · by sbjs · 1y ago · 16 comments

comment 1y ago · link · parent

Can't remember, was like 10 years ago. But basically after I finished mastering the last feature I needed to, probably macros.

comment 1y ago · link · parent

To clarify, I don't mean that Rich didn't also have extremely good reasons to make Clojure, given he was using Java (and maybe C++) in 2007. They're not the best languages now, but they were so broken back then that they practically caused the language revolution that caused Clojure and Go and Node etc to flourish.

comment 1y ago · link · parent

I thought it was self explanatory. It had new idioms I had not yet learned and internalized, so I fully absorbed it. When that was finished, I needed something else to do the same thing with. It's like listening to a song on repeat 10-100 times (depending on the song) when you first hear it. You get everything you can out of it and move on when it's empty.

comment 1y ago · link · parent

I guess that confirms my theory.

14.

Why I ever wrote Clojure(thesoftwarephilosopher.com ↗)

89 points · by sbjs · 1y ago · 50 comments

15.

Build.js.dev.build(thesoftwarephilosopher.com ↗)

1 points · by sbjs · 1y ago · 1 comment

16.

Build.js.dev.build(thesoftwarephilosopher.com ↗)

1 points · by sbjs · 1y ago · discuss

17.

A New Way to Vendor(immaculata.dev ↗)

1 points · by sbjs · 1y ago · discuss

comment 1y ago · link · parent

Thanks, yeah it sounds like we have similar goals. Where's your project so I can take a look?

19.

Immaculata(immaculata.dev ↗)

4 points · by sbjs · 1y ago · 3 comments

20.

Show HN: Immaculata.dev, TypeScript DX Primitives(immaculata.dev ↗)

1 points · by sbjs · 1y ago · discuss

21.

Show HN: Immaculata.dev, web build tool for engineers(immaculata.dev ↗)

1 points · by sbjs · 1y ago · discuss

22.

Show HN: Immaculata, simple front-end build tool(github.com ↗)

1 points · by sbjs · 1y ago · discuss

comment 1y ago · link · parent

Your patience with Michael Saboff is incredible.

24.

Standardize JSX while there's time(thesoftwarephilosopher.com ↗)

1 points · by sbjs · 1y ago · discuss

comment 1y ago · link · parent

Infeasible not because it's difficult but because you have more awareness of your limited time that you have to prioritize, and maintaining software falls lower and lower on the list of things you should do.

26.

I can't delete my framework(thesoftwarephilosopher.com ↗)

2 points · by sbjs · 1y ago · 2 comments

27.

Show HN: A new way to create universal/ssr TypeScript apps with JSX(github.com ↗)

1 points · by sbjs · 3y ago · discuss

comment 3y ago · link · parent

Yes.

comment 3y ago · link · parent

I posted an example in the thread.
12345
11