[]previous and next page

wranglerToml

The wrangler.toml the adapter writes, as a string.

The wrangler.toml the adapter writes, as a string. TOML because every Wrangler version reads it (Wrangler 3 does not read main from a JSON config). The asset directory is relative to the config file. Exported for tests and for tools that generate Wrangler config themselves.

Import#

ts
import { wranglerToml } from "@shadow-js/dusk/cloudflare";

Signature#

ts
function wranglerToml(input: {
  readonly name: string;
  readonly compatibilityDate: string;
  readonly compatibilityFlags: readonly string[];
  readonly assetsDirectory: string;
  /**
   * Paths the Worker answers before the assets binding (B2): a prerendered page the app's rules apply to. Without this the
   * platform serves its file. Omitted when empty.
   */
  readonly workerFirst?: readonly string[];
  /**
   * Every request runs the Worker first (`run_worker_first = true`): the app lists its hosts, and the Worker answers a
   * Host the list refuses through the handler. Routes cannot test the Host, so this is the only way to reach the Worker
   * before the assets for every Host. It replaces `workerFirst`.
   */
  readonly allRequests?: boolean;
  /** Leave out the `[assets]` table (for runtimes that do not serve it, such as a local test run). */
  readonly withAssets?: boolean;
}): string