UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

20 lines (19 loc) 654 B
import { bannedTokens, builtins } from "../../nameUtils.js"; import { $internal } from "../../shared/symbols.js"; import { ShelllessRepository } from "../../tgsl/shellless.js"; class NamespaceImpl { [$internal]; constructor(strategy) { this[$internal] = { strategy, takenGlobalIdentifiers: new Set([...bannedTokens, ...builtins]), shelllessRepo: new ShelllessRepository(), memoizedResolves: new WeakMap(), memoizedLazy: new WeakMap(), }; } } export function namespace(options) { const { names = 'strict' } = options ?? {}; return new NamespaceImpl(names); }