UNPKG

tinyest-for-wgsl

Version:

Transforms JavaScript into its 'tinyest' form, to be used in generating equivalent (or close to) WGSL code.

19 lines (18 loc) 639 B
import * as babel from "@babel/types"; import * as acorn from "acorn"; import * as tinyest from "tinyest"; //#region src/parsers.d.ts type JsNode = babel.Node | acorn.AnyNode; type TranspilationResult = { params: tinyest.FuncParameter[]; body: tinyest.Block; /** * All identifiers found in the function code that are not declared in the * function itself, or in the block that is accessing that identifier. */ externalNames: string[]; }; declare function transpileFn(rootNode: JsNode): TranspilationResult; declare function transpileNode(node: JsNode): tinyest.AnyNode; //#endregion export { transpileFn, transpileNode };