Skip to content
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

Break out esbuild.CLI public Go CLI API #153

Closed
wants to merge 1 commit into from
Closed

Break out esbuild.CLI public Go CLI API #153

wants to merge 1 commit into from

Conversation

earthboundkid
Copy link

Refs #152

@@ -0,0 +1,64 @@
package exitcode
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copypasta from my own github.com/carlmjohnson/exitcode

@earthboundkid
Copy link
Author

Make cmd/esbuild a one liner call into pkg/esbuild, which has a single public function: esbuild.CLI(osargs []string) error. This allows esbuild to be embedded into other Go application without interprocess calls or introducing a new public API beyond the CLI.

@evanw
Copy link
Owner

evanw commented May 27, 2020

I see why you would like to do this. However, I don't think this is a good way to integrate esbuild into other Go apps. There would be no way to programmatically list out build errors, for example. This approach also has other issues such as causing GC to be disabled because esbuild disables GC to improve performance when invoked in batch mode.

Instead of doing this, I'd rather have an API more like the current JavaScript API. That API is future proof like this approach but also more usable. It'd be a much bigger change though, so perhaps not appropriate for a PR.

@evanw evanw closed this in 411fcca Jun 11, 2020
@evanw
Copy link
Owner

evanw commented Jun 11, 2020

After a major refactor, the Go CLI is now available in version 0.5.0. I have also added build and transform APIs which are more flexible than the CLI API. The new Go APIs are documented here.

@earthboundkid
Copy link
Author

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants