[]previous and next page

CompileResult

What compile returns.

What compile returns.

Import#

ts
import type { CompileResult } from "@shadow-js/compiler";

Signature#

ts
interface CompileResult {
  /** The module text. Code outside JSX and `useStore` calls keeps its exact text. */
  code: string;
  /**
   * Source map from `code` back to the input, with the sources embedded. `null` when
   * `sourceMap` is `false` and when nothing was rewritten as JSX (so `transformed` can be `true`
   * with a `null` map when only `useStore` calls were rewritten).
   */
  map: ReturnType<MagicString["generateMap"]> | null;
  /**
   * Non-fatal findings: the `"warning"` and `"info"` diagnostics that compiler plugins reported, in
   * report order. Empty without plugins: the compiler itself reports problems by throwing a
   * {@link CompileError}.
   */
  diagnostics: Diagnostic[];
  /** False when nothing was rewritten: no JSX to compile and no `useStore` call to specialize. */
  transformed: boolean;
}

Members#

Name Type Description
code code: string The module text. Code outside JSX and useStore calls keeps its exact text.
map map: ReturnType<MagicString["generateMap"]> | null Source map from code back to the input, with the sources embedded. null when sourceMap is false and when nothing was rewritten as JSX (so transformed can be true with a null map when only useStore calls were rewritten).
diagnostics diagnostics: Diagnostic[] Non-fatal findings: the "warning" and "info" diagnostics that compiler plugins reported, in report order. Empty without plugins: the compiler itself reports problems by throwing a CompileError.
transformed transformed: boolean False when nothing was rewritten: no JSX to compile and no useStore call to specialize.