-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Golang dll (for others platforms) #194
Comments
The main problem of typescript that the parsing code not made it on top of binary executable ! I have some thoughts about creating some kind tooling when we could drop webpack to trash! js ecosystem created a chaos inside her self, because deno was created after all ! But deno not solved the js main problem. Binary executable tooling could solve it. And standartization. |
I've heard loading Go code as a DLL has a lot of drawbacks. Go has its own runtime that works very differently than traditional C-style code. The runtime includes the garbage collector and the goroutine scheduler. I'm not planning to support directly loading esbuild's Go code as a DLL in another host language. The current way of invoking esbuild from another host language is to run esbuild as a child process and speak to it over stdin and stdout. It's a form of IPC and using stdin/stdout means it's completely portable and cross-platform. This is how the node API works, and is currently implemented here. It should be possible to port this to C and then compile that to a DLL. Keep in mind that it wouldn't be completely self-contained because you'd need to ship both the DLL and the esbuild executable as two separate files. For optimal speed, you'd want to allow multiple requests to be processed in parallel. But that would require your C API to be asynchronous and the details of that depend on what host language you're trying to integrate with. The interchange format isn't documented because it's an internal implementation detail, but it's essentially a binary request/response format that takes an array of strings and returns a map of strings to bytes. The request consists of the operation, a request identifier, and command-line flags and the response contains the request identifier and relevant output buffers. Since it sounds like you're interested in C# bindings, it's worth mentioning that it'd be a lot simpler to skip creating a DLL in the first place and just use C# to run esbuild as a child process. You could use the same stdin/stdout IPC format directly from C# code and even have a nice C# API with |
Ok. I understand. |
Hey @evanw what are your thoughts about using sockets as https://github.com/pulumi/pulumi project does instead of pipes? Also, maybe figure out some of the toolkits from their repo for generating SDKs https://github.com/pulumi/pulumi/tree/master/sdk if that is possible. |
I don't have a need to communicate with a native-compiled esbuild directly from the browser at the moment. Currently the only scenario that esbuild's browser API is designed to operate in is one where both esbuild and the browser API are running in the browser (esbuild via WebAssembly). In that case sockets don't apply because you can't listen for connections from a browser tab. While sockets could potentially be used to implement esbuild's non-browser APIs instead of stdin/stdout, it comes with many disadvantages. Sockets can be blocked by firewalls. They could also cause antivirus programs to incorrectly flag esbuild as a virus. Using sockets with a stable port number also runs into problems when multiple users on the same machine try to use that port at the same time. I believe using stdin/stdout is the most appropriate way to do this. |
I guesse we need some kind dll release for another platforms!
Its possible to load esbuild as dll binary file ? Seems to be yes?
In esbuild have some function that reads a buffer and resulting a result buffer ?
In esbuild could be possible to make batch file and esbuild will build minified file ?
Is could possible some profit if call dll in nodejs without using cli executable ?
If theese things are possible we could make a mature binary dll ! And all platforms that could use dll files could gain a profit! Because we dont need use cli executable.
C++, c# could load dll files !
Ewan what do u think about that ?
The text was updated successfully, but these errors were encountered: