Compiling

What runs before a reader sees anything: an attribute refined from the text it was written as, the semantic pass over the result, the manifest a plugin declares, and the service that compiles a document.

@internote/canvas-sdk@internote/canvas-sdk/compile36 exports
On this page

Compiling turns Chalk source into the document a host mounts. dotchalkService does the whole job: it compiles the source, refines the values the compiler left as text, and runs the semantic pass. It runs on the server only.

import { dotchalkService } from '@internote/canvas-sdk/compile';

const result = dotchalkService.compile(source);
if (!result.ok) throw new Error(result.error);

Register every environment the document uses before compiling. A compile with none registered throws.

An environment that invents a value type of its own parses it here. The compiler accepts the value as a string, and a refiner you register reads it afterwards. These helpers are the ones the built-in environments' refiners use:

runCanvasSemanticPass checks the rules that span a document, and returns SemanticDiagnostics: an error fails the compile, and a warning comes back with a successful one.

#Functions

#Classes

#Constants

#Interfaces

#Types

Last updated