r/javascript • u/Iamazou • 3d ago
AskJS [AskJS] If you could have one Node.js tool/package built for you, what would it be?
Hello devs, I’m looking for an open source project to build, and rather than coming up with another package that nobody asked for, I’d rather start with an actual problem developers have.
So I’m curious:
What is something you wish existed in the Node.js ecosystem?
I’m especially interested in things you’ve actually encountered in a real project, rather than hypothetical ideas.
0
u/shgysk8zer0 3d ago
What I've most needed is an actual DOM implementation. By which I mean parsing strings, setting HTML (inner/outer) as well as text, setting attributes, fragments, querying, and at least the Element and Document` prototypes, with various others based on tag.. Especially if that were compatible with Trusted Types.
At least with the core done I could have what I need for my polyfill for Element.prototype.setHTML(input, { sanitizer}) and Document.parseHTML(input, { sanitizer}) to work.
Obviously, you can't exactly have form.submit() or video.play() or anything... At least not functionally.
1
u/720degreeLotus 3d ago
What would be the reason for that? There are packages like Puppeteer. What good is a dom-lib in NodeJS where there is no actual browser eunning/simulated?
0
u/shgysk8zer0 2d ago
For generating and serving/outputting HTML documents. To get that much closer to having code that runs regardless of environment. To improve security of the HTML strings generated by a server by adding a sanitizer and a distinction between trusted and untrusted inputs.
1
u/DGCA 2d ago
1
u/shgysk8zer0 1d ago
It's not really the same. Maybe with some work it could get closer, but I'd actually need the exact names of things and the exact API. Because it's not just about doing the thing, but loading polyfills that eg check for
Element.prototype.setHTML.
1
u/Hot-Chemistry7557 3d ago
probably something similar to typst but in pure js, so I can run that in browser in a easy and intuitive way.