> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# compiler: compile and ready

> compile and ready: the declaration and description of each of the 2 exports of @eco-incorp/sauce, @eco-incorp/sauce/compiler.

`@eco-incorp/sauce/compiler` exports the compiler's `compile` behind a readiness check, `ready()` for a browser, and `resolveSdkModule`/`resolveSdkPackage`, which serve the SDK's SauceScript libraries (`@sauce/token`, `@sauce/router`) and ABIs to a compile. It re-exports the compiler's option, result and account manifest types. The compiler's own options and results are documented under [@eco-incorp/sauce-compiler](https://docs.eco.com/sauce-sdk/compiler/api.md).

```typescript theme={null}
import { compile, ready, resolveSdkModule, resolveSdkPackage } from "@eco-incorp/sauce/compiler";
```

Also re-exported from dependencies, documented by those packages:

* `@eco-incorp/sauce/compiler`: `AccountEntry`, `AccountManifest`, `AccountRole`, `CompileOptions`, `CompileResult`, `ResolveModule`, `ResolvePackage`, `SauceTarget`, `WasmSource`

Generated from the type declarations of `@eco-incorp/sauce`.

### `compile`

*Function* · `@eco-incorp/sauce/compiler`

Compile a SauceScript program to Sauce bytecode - the compiler's own `compile`, after a check
that its wasm is initialized. Synchronous in every environment once `ready()` has resolved, and
in Node without it. A failure is the compiler's own error, its `message` (and a string `stack`)
plain text, its `diagnostics` as the compiler gave them.

```typescript theme={null}
export declare function compile(options: CompileOptions): CompileResult;
```

### `ready`

*Function* · `@eco-incorp/sauce/compiler`, `@eco-incorp/sauce`

Initialize the compiler's WebAssembly where the environment needs it, once.

In a browser, with no `source`, the wasm is fetched from beside the compiler's own module - the `new URL("sauce_wasm_bg.wasm", import.meta.url)` a bundler rewrites to an asset URL. Pass the
bytes (an `ArrayBuffer` or typed array) or a URL where that does not apply. In Node this resolves
at once and ignores `source`. Safe to call repeatedly and concurrently; a failed attempt is not
remembered, so calling again retries.

```typescript theme={null}
export declare function ready(source?: WasmSource): Promise<void>;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.