Which API alternative allows you to indicate the working list to make use of towards generate

Which API alternative allows you to indicate the working list to make use of towards generate

They generally speaking defaults to the current working listing of the procedure you’re playing with to call esbuild’s API. The functional index is used by the esbuild for most additional things as well as fixing cousin routes considering as the API options to pure pathways and you will pretty-print sheer pathways due to the fact cousin paths for the journal messages. Information on how so you can override they:

#JS-specific facts

The fresh new node-established JS API is available in one another parallel and you may asynchronous flavors, for each with assorted tradeoffs. It is important to know the distinctions to select the best one for the problem:

#Connect API

  • To stop claims can lead to vacuum password
  • Performs from inside the facts that must definitely be synchronous such as for example contained in this need .extensions
  • You simply can’t explore plugins on the synchronous API as the plugins is asynchronous
  • They prevents the present day thread and that means you can’t create most other work for the time being
  • With the synchronous API suppresses esbuild of parallelizing esbuild API calls

#Async API

  • You should use plugins towards asynchronous API
  • The present day thread isn’t banned in order to carry out other are employed in the brand new meantime
  • You might focus on of numerous multiple esbuild API calls additionally which are after that give around the all of the available CPUs for optimum results
  • Having fun with claims may cause messier password, particularly in CommonJS where greatest-top loose time waiting for isn’t readily available
  • Does not work into the circumstances that must be parallel such as in this require .extensions

#Running regarding the internet browser

The new esbuild API may run in the new web browser having fun with WebAssembly into the a web Worker. To take benefit of which make an effort to establish brand new esbuild-wasm bundle instead of the esbuild package:

The newest API to your internet browser is like brand new API to have node except that you need to telephone call initialize() earliest, and you need to ticket the fresh Hyperlink of your WebAssembly digital. This new synchronous models of API are also unavailable. Of course, if you’re using an excellent bundler, who search something like this:

When you’re currently running so it password from a member of staff plus don’t need initialize to manufacture some other worker, you could potentially solution worker: not true so you’re able to it. It will generate a WebAssembly component in the same thread given that thread you to definitely phone woosa login calls initialize .

The brand new API can be reached in just one of 3 ways: towards the command line, within the JavaScript, plus in Wade. Brand new axioms and you may details is mainly identical between the three languages so they really will be presented together with her right here unlike which have independent records for each and every code.

There’s two API contacts esbuild’s API: alter and create. It is very important discover which one just be using once the they work in another way.

If you use JavaScript be sure to have a look at JS-certain info point lower than. You’ll be able to discover TypeScript sort of significance to own esbuild beneficial because the a reference. If you are using Go make sure you look at the immediately generated Wade paperwork.

If you use this new order-range API, it could be beneficial to know that the fresh flags are located in one of three variations: –foo , –foo=club , otherwise –foo:pub . The proper execution –foo is utilized for helping boolean flags such –minify , the shape –foo=bar is employed for flags which have one worthy of and you may are only specified immediately after for example –platform= , and the form –foo:club is used getting flags which have several opinions and can be lso are-specified many times such as for example –external: .

#Transform API

The fresh transform API call operates on a single sequence in the place of supply so you’re able to a document program. This makes it perfect for use in surroundings instead of a document program (like a browser) otherwise within various other unit chain. This is what an easy transform works out:

0 پاسخ

دیدگاه خود را ثبت کنید

Want to join the discussion?
Feel free to contribute!

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *