This repository was archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
canner compiler
Siou edited this page May 9, 2019
·
3 revisions
Canner Compiler compiles the data schema to a component tree that contains the Layout UI.
There are two parts of Canner Compiler: Parser
and Traverser
.
Parser initializes the component tree from the data schema.
interface
type Node = {
nodeType: string,
name?: string,
[string]: any
}
type ParentNode = Node & {
children: Array<Node>
}
type Tree = {
[key: string]: ParentNode
}
Traverser transforms the tree generated from Parser with the given visistors
.
The operation is same as the Traveral of bable plugin
interface
type Route = '';
type Path = {
node: Node,
parent: ParentNode,
tree: Tree,
route: Route
};
type Visitor = {
[nodeType: $PropertyType<Node, 'node'>]: {
enter?: (path: Path) => void;
exit?: (path: Path) => void;
}
}