@hlang-org/compiler
Ahead-of-time compiler for hlang: compiles an IGraph program into a standalone ES module. Version 2.0.1, 9 exports.
Classes
CompileError
Defined in: packages/compiler/src/errors.ts:8
Thrown by compile for problems specific to code generation. Problems with
the graph itself surface as GraphError from @hlang-org/ir.
Extends
Error
Constructors
Constructor
new CompileError(code, message): CompileError;Defined in: packages/compiler/src/errors.ts:11
Parameters
| Parameter | Type |
|---|---|
code | CompileErrorCode |
message | string |
Returns
Overrides
Error.constructor
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
code | readonly | CompileErrorCode | packages/compiler/src/errors.ts:9 |
GraphError
Defined in: packages/ir/lib/index.d.ts:136
Thrown by planGraph when a graph violates hlang's rules.
Extends
Error
Constructors
Constructor
new GraphError(code, message): GraphError;Defined in: packages/ir/lib/index.d.ts:138
Parameters
| Parameter | Type |
|---|---|
code | GraphErrorCode |
message | string |
Returns
Overrides
Error.constructor
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
code | readonly | GraphErrorCode | packages/ir/lib/index.d.ts:137 |
Interfaces
CompileOptions
Defined in: packages/compiler/src/compile.ts:47
Options for compile.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
nodes | readonly | Readonly<Record<string, NodeImport>> | The import for every node code used by the graph. | packages/compiler/src/compile.ts:49 |
runtime? | readonly | string | Module that exports the runtime Flow. Defaults to @hlang-org/runtime. | packages/compiler/src/compile.ts:51 |
rxjs? | readonly | string | Module that exports RxJS Subject, used for the stop signal. Defaults to rxjs. | packages/compiler/src/compile.ts:53 |
CompileResult
Defined in: packages/compiler/src/compile.ts:57
The compiled program.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
code | readonly | string | ES module source. Exports run(options?). | packages/compiler/src/compile.ts:59 |
imports | readonly | readonly string[] | Every module specifier the program imports, in import order. | packages/compiler/src/compile.ts:61 |
IGraph
Defined in: packages/ir/lib/index.d.ts:88
The complete serialized graph.
Properties
NodeImport
Defined in: packages/compiler/src/compile.ts:39
Where a node class comes from: an ES module and one of its exports.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
from | readonly | string | Module specifier written into the generated import (package name, path, or URL). | packages/compiler/src/compile.ts:41 |
name? | readonly | string | Export name. Defaults to the module's default export. | packages/compiler/src/compile.ts:43 |
Type Aliases
CompileErrorCode
type CompileErrorCode = "unresolved-node" | "invalid-import" | "unserializable-config";Defined in: packages/compiler/src/errors.ts:2
Machine-readable reasons compile rejects its input.
GraphErrorCode
type GraphErrorCode =
| "duplicate-node-id"
| "invalid-node-kind"
| "unknown-node"
| "invalid-connection"
| "no-readable-root";Defined in: packages/ir/lib/index.d.ts:134
Machine-readable reasons a graph cannot be planned.
Functions
compile()
function compile(graph, options): CompileResult;Defined in: packages/compiler/src/compile.ts:70
Compile graph to an ES module. Throws GraphError or CompileError.
Parameters
| Parameter | Type |
|---|---|
graph | IGraph |
options | CompileOptions |
Returns
Generated by TypeDoc from packages/compiler/src at build time.