[]previous and next page

@shadow-js/compiler

The 42 exports of @shadow-js/compiler: 4 functions, 1 class, 33 interfaces and 4 types.

Everything @shadow-js/compiler exports, from the TSDoc of its entry point.

Functions#

  • compile: Compiles the JSX in a module into calls to the ShadowJS runtime, with the fastest implementation this machine has: the Rust addon (about ten times faster on large apps), else the same code as WebAssembly, else the TypeScript implementation.
  • compileAsync: Compiles a module without blocking the event loop: the Rust implementation runs on a worker thread of the process and the promise settles with what compile would have returned or thrown.
  • getBackend: Tells which implementation compile uses on this machine, loading it if it was not loaded yet.
  • validatePlugins: Checks a list of compiler plugins and returns it as a frozen copy.

Classes#

  • CompileError: Thrown by compile for source the compiler cannot or refuses to transform.

Interfaces#

Types#

  • PluginStage: When a plugin runs: "pre" on the tree of the source, before every compiler pass, "post" on the tree of the generated code.
  • Target: Which kind of output compile produces: "dom" for browser rendering (also used to hydrate server markup) and "ssr" for server rendering to strings.
  • Visit: A visitor function: called with the node and its parent (null for the node the walk started at).
  • Visitor: What PluginContext.walk takes: a function or an enter/leave pair for the node types of NodeMap, and an untyped enter and leave for every node.