[]previous and next page

PluginNode

A syntax tree node: ESTree plus the JSX nodes of the parser.

A syntax tree node: ESTree plus the JSX nodes of the parser. start and end are UTF-16 offsets into PluginContext.source. Other properties are reached by name; the node interfaces of NodeMap describe the common ones. The tree is read-only in practice: changing a node has no effect, because the compiler never reads it back. Use the edits of PluginContext.

Import#

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

Signature#

ts
interface PluginNode {
  /** The node type, such as `"Identifier"` or `"JSXElement"`. */
  readonly type: string;
  /** Offset of the first code unit of the node. */
  readonly start: number;
  /** Offset just after the last code unit of the node. */
  readonly end: number;
  /** Any other property of the node. */
  readonly [key: string]: unknown;
}

Members#

Name Type Description
type readonly type: string The node type, such as "Identifier" or "JSXElement".
start readonly start: number Offset of the first code unit of the node.
end readonly end: number Offset just after the last code unit of the node.