-
Notifications
You must be signed in to change notification settings - Fork 937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Node JS engine support #1021
Conversation
string Name { get; } | ||
string Version { get; } | ||
|
||
bool HasVariable(string uSER_SCRIPTS_LOADED_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that u
is lowercase? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, the Visual Studio code-generator couldn't decide how to handle the screaming snake case
Good idea! I wonder if we could add script debugging too, in the future. |
I think this closes #971 |
Hello, Dustin and Daniel! I started making the JavaScriptEngineSwitcher.Node module in last year. For many reasons, I couldn't finish it (one of reasons was adding support for the ClearScript 6.0). Today I decided to publish a draft version. In my version, I don't use In a couple of weeks, I plan to return to finalizing this module. |
Cool! I'll plan on continuing this experiment to see what's possible using a real Node environment. Aiming to get feature parity first with the current JS Engine solution (render functions don't work yet, nor does babel compilation) and then expand to things like lazy-loading, better debugging, etc. There may be some additional Node-specific functions that JSEngineSwitcher doesn't yet expose to take advantage of features like lazy-loading. Would love to discuss exposing those functions in JSEngineSwitcher as we run into new Node-specific use cases during this experiment. Using https://nodejs.org/api/vm.html#vm_script_runinnewcontext_contextobject_options |
This is very WIP
d33497a
to
bd814e6
Compare
cc @DaniilSokolyuk in case you're interested or have suggestions... |
@dustinsoftware Do you mean support of CommonJS modules and |
Yes; this is necessary to handle bundles webpack emits with |
ClearScript library already supports CommonJS modules. For other engines, need to implement it. Most likely, before this, will need to implement a full-fledged Intertop in all modules, and this is not an easy work. In addition, I have already tried to implement ES modules in ChakraCore. This task will also need to be returned to. Unfortunately, there is no time yet. In a week or two I plan to go back to working on the Javascript.NodeJS module. |
Yeah, achieving 100% parity with how Node’s require algorithm
currently works is definitely not an easy undertaking for
JsEngineSwitcher.
To keep the maintenance burden reasonable, I’m thinking there are two
efforts here.
1. This new React.NodeServices assembly can keep referencing the Node
engine directly, enabling new use cases only possible with Node’s native
module system.
2. Projects that want to use any non-module behavior, eg what’s already
possible with JsEngineSwitcher and React.NET, can opt to use Node as an
engine just like Clearscript or Chakra today without taking a reference on
React.NodeServices.
…On Sat, Feb 1, 2020 at 23:45, Andrey Taritsyn ***@***.***> wrote:
ClearScript library already supports CommonJS modules. For other engines,
need to implement it. Most likely, before this, will need to implement a
full-fledged Intertop in all modules, and this is not an easy work.
In addition, I have already tried to implement ES modules in ChakraCore.
This task will also need to be returned to.
Unfortunately, there is no time yet. In a week or two I plan to go back to
working on the Javascript.NodeJS module.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1021?email_source=notifications&email_token=AAHGCFWCIHLHVHLHBR5ALUTRAZ2YPA5CNFSM4KOQ2LZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRQCWI#issuecomment-581108057>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHGCFUAT5PW4SEFEJ2GCF3RAZ2YPANCNFSM4KOQ2LZA>
.
|
Sync over async can cause thread-pool starvation and results in service outages |
Engine pooling and file watching have landed directly in the library: I think by default we will only want to start with one instance running. Notably we would not want to defer to JsPool for this engine since it would conflict with the library's built in pooling. |
You're right, only 1 instance is required. Enabling pooling/concurrency: services.Configure<OutOfProcessNodeJSServiceOptions>(options => {
options.Concurrency = Concurrency.MultiProcess; // Concurrency.None by default
options.ConcurrencyDegree = 8; // Number of processes. Defaults to the number of logical processors on your machine.
); |
Using For instance, if |
Nice! After JeringTech/Javascript.NodeJS#75, I was planning to test Jering.Javascript.NodeJS on my pi. Cool to see that it works in your experiment 😃. Let me know if any issues pop up. |
Expose a separate package for opting in to a native Node JS engine
Some of this will probably end up getting backported from:
https://github.com/JeringTech/Javascript.NodeJS
https://github.com/DaniilSokolyuk/NodeReact.NET
Working:
Things to consider;
The underlying module parser lives here