UNPKG

tinyest-for-wgsl

Version:

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

19 lines (16 loc) 615 B
import * as babel from '@babel/types'; import * as acorn from 'acorn'; import * as tinyest from 'tinyest'; 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; export { transpileFn, transpileNode };