loading...

Looking for a lightweight nodejs project

github logo Updated on ・1 min read

JavaScript Desktop Environment Project (JSDE) (3 Part Series)

1) What would a JavaScript Wasm desktop be like? 2) Looking for a lightweight nodejs project 3) Desktop in JavaScript: the UI.

Basically what the title says, looking for a fork of node js that takes less memory per process, basic io and es6 support are both nice to haves. What are my options?

twitter logo DISCUSS (18)
markdown guide
 

I think for certain workloads deno may be appropriate, but low memory footprint isn't necessarily a primary goal.

 

Ahh yes, been there, Deno is great in terms of goals but it's not ready, it doesn't have compatibility with node modules (yet?) Understandable really. I'm rather stupidly working on a Linux desktop environment in js and would have loved to use it but developers from all over JavaScript land should be able to extend this thing. I am trying to spawn node processes and embed that into an electron like environment (lighter) but the node processes weigh in at 8mb with nothing but runtime.

I am looking at ms edge chacracore on node which is supposed to be better, we shall see.

 

IL let you know when I have a repo, the plan is to use rust WASM to do heavy lifting, even run on the Kernal because apparently that's a thing haha

100% hip and cool, I just want to do some rust in Wasm which sounds really appealing. An entire desktop that is super portable, powered by the future and unicorns.

 

Saying that, I could just use it and wait for said compatibility.

Also I am a little unsure how safe it is the way Deno imports over Https and does that get cached.

 

Imports over HTTPS in Deno are not that different than in Node. In Node you trust NPM, I Deno you trust anyone from whom you import (most of Deno compatible modules are hosted on GitHub and thus imported from there). To ensure you get the module you expect you can use lockfiles that Deno recently added support for (deno.land/std/manual.md#lock-file).

As for caching, Deno transparently downloads and caches modules on first usage and they won't be downloaded again unless you pass --reload flag to force fetch/compilation step again.

Okay your points are valid I must say it puts my mind at rest somewhat, so how could I go about using libraries from the JavaScript ecosystem that have not been authored for Deno but may have typescript support. Deno's lack of developer ecosystem (as far as I can tell) means it's not ready for me just yet.

Okay your points are valid I must say it puts my mind at rest somewhat, so how could I go about using libraries from the JavaScript ecosystem that have not been authored for Deno but may have typescript support.

Well there are currently following options:

  • There's std/node module that started the effort to provide compatibility with Node land modules. It's still in early stages, but I've already seen people use with some success
  • Libraries that are available as ES modules and do not depend on Node native APIs should generally work with Deno, as long as imports are relative/full URLs instead of "bare" specifiers

Deno's lack of developer ecosystem (as far as I can tell) means it's not ready for me just yet.

What do you have in mind?

That said, if you need bare bones ES Modules support with low memory footprint you may consider to build your custom runtime with Deno. There's deno crate that provides low level API upon which deno binary is built. That would mean stripping all the fancy APIs that you don't need, there are available on Deno namespace as well as in global scope.

Hmmm you have peeked my interest again, I will try it out again tonight. I'm going to need to create some sort of webview for my deaktop environment project. I was using the electron like runtime nw.js but perhaps Deno comunity has an equivalent?

Hmmm you have peeked my interest again, I will try it out again tonight.

Sure, feel free to reach out on Gitter if you have any troubles

I'm going to need to create some sort of webview for my deaktop environment project. I was using the electron like runtime nw.js but perhaps Deno comunity has an equivalent?

Nope, there's a tracking issue for that, but no progress so far (AFAIK) github.com/denoland/deno/issues/3234

 

The answer was not ChakraCore which weighed 7mb over v8 at 8m.

Iot.js weighs 512kb!
iotjs.net/

Now I can spawn inexpensive node.js (ish) processes that can act as TCP clients. In other words, killing this process kills the window in my is desktop environment.

Limitations so far, es5 so I will have to keep that in mind and the API reference is similar but not nodes.

Either way I can provide very simple io and process management, this is one step closer to a real js desktop for Linux.

 
 

It's certainly a good list for inspiration.

 

I am looking more for a node.js that somebody forked and is maintaing, its probably a fork of node designed for iot devices. However as Ben in the comments puts it Rust is the answer perhaps.

Classic DEV Post from Apr 1 '19

Tell me about a time you messed up

So I brought down the site for a little while this morning. Now I'm interested ...

Adam Crockett profile image
I work at ForgeRock as a Front End Engineer, I play with all sorts really. Lately WASM is my toy of interest.

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️