Registry / devops / wgslink

wgslink

JSON →
library0.1.0jsnpmunverified

A WGSL bundler and minifier for WebGPU shaders. Current stable version 0.1.0. Early-stage package with TypeScript support. Designed to bundle and minify WGSL code for WebGPU applications. Differentiators include native performance via Rust-based build (napi-rs) and simple API. Ships type definitions. Requires Node >=12.

npm install wgslink
INSTALL
IMPORT
SIG · WGSLINK
W
wgslink
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bundle
import { bundle } from 'wgslink'
import wgslink from 'wgslink'
Named export only; no default export.
minify
import { minify } from 'wgslink'
const minify = require('wgslink').minify
CJS require works but ESM is preferred.
BundleOptions
import { BundleOptions } from 'wgslink'
import { BundleOptions } from 'wgslink/dist'
Types are included in main export; no separate path needed.

Shows how to bundle and minify WGSL shader code using async functions.

import { bundle, minify } from 'wgslink'; const wgslCode = ` @vertex fn main(@location(0) pos: vec2<f32>) -> @builtin(position) vec4<f32> { return vec4<f32>(pos, 0.0, 1.0); } `; const bundled = await bundle({ code: wgslCode, entryPoint: 'vertex', }); const minified = await minify(bundled.code); console.log(bundled.code); console.log(minified);
Debug
Known issues
gotchaBundle and minify are async functions and must be awaited.
fix
Use await or .then() to handle Promises.
affects: >=0.1.0
gotchawgslink depends on napi-rs native bindings, which may require additional platform support.
fix
Ensure your platform is supported and has the necessary build tools for native modules.
affects: >=0.1.0
deprecatedThe package is very early (v0.1.0) and API may change without semver guarantees.
fix
Pin version to prevent unexpected breaking changes.
affects: >=0.1.0 <1.0.0
Errors
Common errors & fixes
Cannot find module 'wgslink'
Package not installed or ESM import used in CJS context
fix
Install package: npm install wgslink. Ensure project is configured for ESM (type: module in package.json) or use require().
wgslink is not a function
Default import used instead of named import
fix
Use import { bundle } from 'wgslink' or const { bundle } = require('wgslink').
Error: Module did not self-register
Native napi-rs module not built for current platform
fix
Reinstall package or rebuild native module: npm rebuild wgslink.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
napi-rsrequiredUsed for native bindings to Rust-based bundler
Agent activity
4 hits · last 30 days
node
4
Resources
wgslink — npm install wgslink · libregistry