So it API option lets you identify the functional index to use to the create

So it API option lets you identify the functional index to use to the create

It typically non-payments to the current working range of the method you’re having fun with to name esbuild’s API. The working index can be used because of the esbuild for most different anything as well as fixing cousin pathways considering because the API options to natural pathways and you can fairly-printing sheer paths given that relative routes in the log texts. Here is how so you’re able to bypass they:

#JS-particular facts

The node-centered JS API will come in both synchronous and you can asynchronous styles, for each with various tradeoffs. It is critical to understand the distinctions to pick the newest right one to suit your problem:

#Connect API

  • To stop guarantees can cause vacuum code
  • Work into the factors that have to be parallel eg within this require .extensions
  • You simply can’t use plugins to your parallel API as the plugins are asynchronous
  • They stops the modern bond so that you can not would almost every other works at the same time
  • With the parallel API suppresses esbuild out of parallelizing esbuild API calls

#Async API

  • You can use plugins for the asynchronous API
  • The current bond is not prohibited so you can perform most other are employed in the brand new meantime
  • You could work at of a lot multiple esbuild API phone calls concurrently which are following bequeath around the all readily available CPUs for maximum results
  • Having fun with claims can cause messier code, especially in CommonJS where better-top loose time waiting for is not offered
  • Doesn’t work inside the issues that must definitely be parallel such as within this require .extensions

#Powering about web browser

The fresh esbuild API may run in brand new web browser using WebAssembly into the a web site Staff. For taking advantageous asset of it just be sure to setup this new esbuild-wasm bundle rather than the esbuild plan:

New API towards internet browser is a lot like this new API to possess node other than you should telephone call initialize() very first, and you should solution the newest Url of your own WebAssembly digital. The fresh synchronous types of your API are not available. Of course you are playing with a great bundler, that would search something like this:

While you are currently running which password away from a member of staff and do not need initialize to make several other worker, you might citation staff member: not the case so you’re able to they. It will generate a good WebAssembly component in the same thread because the thread one calls initialize .

This new API shall be reached in one of three straight ways: towards the order range, inside JavaScript, along with Go. The fresh principles and variables is actually largely the same involving the about three dialects so they will be presented with her here rather than having independent paperwork for each and every words.

There are two API contacts esbuild’s API: transform and create. It is critical to discover what type just be playing with due to the fact they work in another way.

If you are using JavaScript be sure to read the JS-certain details section lower than. You could discover the TypeScript particular significance to possess esbuild beneficial once the a resource. If you utilize Go be sure to investigate automatically generated Go files.

When you use the fresh command-range API, it could be useful to be aware that the fresh new flags can be found in certainly one of about three versions: –foo , –foo=pub , or –foo:bar . The design –foo is utilized to have enabling boolean flags eg –minify , the form –foo=bar is utilized for flags having a single really worth and you will are merely specified immediately following eg –platform= , and setting –foo:club can be used getting flags which have several values and will become lso are-given several times eg –external: .

#Alter API

The newest transform API phone call works on one sequence in the place of accessibility in order to a document system. This makes it good for use in environments in place of a file program (for example a web browser) or as an element of various other product chain. Here is what a straightforward transform ends up:

Geplaatst in xmeeting-recenze recenzГ­.

Geef een reactie