Fork me on GitHub
#clojurescript
<
2024-05-03
>
octahedrion14:05:31

please excuse the cross post, I posted in #C061V0G8Z but no replies: is http://npmjs.com like maven for javascript libraries ? i.e. are the packages there mostly prebuilt and ready to use in the browser (like maven hosts mostly prebuilt jars), or do they need to be built or is it a mixture ?

thomas14:05:54

I don't think JS libs need building as such... as they are distributed as code (as optimised code, so there is a build step involved)

thomas14:05:16

so you have to package them in your app.

thomas14:05:32

(if you are using JS/TS that is)

p-himik14:05:22

That's not quite correct. tl;dr: it's a bloody mess and is nothing like Maven. Some packages provide only the source JS that might or might not need additional postprocessing (e.g. because it requires CSS files in JS code or because it targets features that only one browser has). Some packages provide only minified JS that doesn't need anything else. Some provide both or different varieties of either or both, and specify in which context which variety should be used via package.json. TS packages might provide the resulting JS + .d.ts files. Or they might provide only TS files. JSX is also a thing. And TSX. Some packages will run executables on your machine during installation.

🙏 1
thomas14:05:33

ok.. I got it all wrong... take my advice... don't listen to me 😉

octahedrion14:05:34

@U2FRKM4TW thanks, I suspected as much but I was hopeful that it might provide what I needed to write an NPM-free tools.deps resolver tool

octahedrion14:05:29

is there no common registry in the JS world for minified browser-ready packages then ?

p-himik14:05:32

I would be surprised if it existed. It's common for JS libraries to have optional dependencies. Or to have code that becomes dead when some flag is set and is tree-shaken away only during compilation. Or to desire being compiled together with a bunch of other libraries to achieve better minification.

octahedrion14:05:12

good grief. Well, back to trying Nashorn then...

p-himik14:05:56

Hasn't Nashorn been abandoned? GraalVM has a thing for JS.

p-himik14:05:27

And what is the actual problem that you're trying to solve?

octahedrion14:05:28

it was, but it's since been extracted

octahedrion14:05:05

I want an NPM-free Clojure/Java only tools.deps extension for JS libs

octahedrion14:05:27

-- don't ask me why or try to convince me otherwise

p-himik14:05:23

Frankly, to me that sounds like "I want to turn lead into gold". Well, technically it is possible - we not only know the physics, we even have a few "tools" for that. But it's way beyond "not worth it". Good luck. :) Especially given that you'll have to keep up with the changes in the JS world.

octahedrion14:05:59

yes I've been told it's not worth it

thheller15:05:41

who do you expect to consume those JS files? I mean nobody is stopping you from putting .js files into .jar files and publishing them via clojars?

Mario G15:05:36

I want an NPM-free Clojure/Java only tools.deps extension for JS libsI've been hearing the I-wish-a-NPM-free-promised-land psalm in plain JS land for ages, it seems something maaany really wish to have for good and less good reasons, but probably is enough of a massive chunk of work to not being much likely to happen (more likely to materialise with some actual work rather than wishing somebody else does it)

m3tti19:05:48

But isn't that the case with javascript modules or esm. It's like an "NPM" free way to load javascript modules. Afaik a lot of js devs see that as a promised land no clue how it will play out. And regarding esm deno and bun js are the ones that use the esm approach which is not relient on npm.