This makes it impossible to use in a Vite plugin, since we cannot statically extract the value of what is passed to the shell: tgpu.fn(...). To fix this, transpileFn has to construct a data structure that encodes the WGSL AST, along with placeholders for external values.
Currently, the
transpileFn
function exported by@typegpu/tgsl-tools
receives a context with the argTypes, returnType and an externalMap.This makes it impossible to use in a Vite plugin, since we cannot statically extract the value of what is passed to the shell:
tgpu.fn(...)
. To fix this,transpileFn
has to construct a data structure that encodes the WGSL AST, along with placeholders for external values.