{"id":42315,"library":"wgslmin-wasm","title":"wgslmin-wasm","description":"A WGSL shader minifier built as a WebAssembly module for WebGPU applications. Version 0.1.1, released as an alpha/pre-release. It runs in both browsers and Node.js, providing whitespace removal, identifier renaming, syntax optimization, and optional external binding mangling. The package ships TypeScript types and requires manual initialization of the WASM module before use. Unlike other WGSL tools, it offers fine-grained control over minification passes and supports browser bundlers like Vite and Webpack.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","wgsl","webgpu","minifier","shader","wasm","webassembly","gpu","typescript"],"install":[{"cmd":"npm install wgslmin-wasm","lang":"bash","label":"npm"},{"cmd":"yarn add wgslmin-wasm","lang":"bash","label":"yarn"},{"cmd":"pnpm add wgslmin-wasm","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports named exports, not a default export.","wrong":"import initialize from 'wgslmin-wasm'","symbol":"initialize","correct":"import { initialize } from 'wgslmin-wasm'"},{"note":"CommonJS require works but is less common; ESM is the preferred pattern for new code.","wrong":"const minify = require('wgslmin-wasm').minify","symbol":"minify","correct":"import { minify } from 'wgslmin-wasm'"},{"note":"Check if WASM is initialized before calling minify.","wrong":null,"symbol":"isInitialized","correct":"import { isInitialized } from 'wgslmin-wasm'"}],"quickstart":{"code":"import { initialize, minify } from 'wgslmin-wasm';\n\nawait initialize(); // Auto-finds WASM in Node.js\n\nconst source = `\n  @vertex fn main() -> @builtin(position) vec4f {\n    return vec4f(0.0, 0.0, 0.0, 1.0);\n  }\n`;\n\nconst result = minify(source, {\n  minifyWhitespace: true,\n  minifyIdentifiers: true,\n  minifySyntax: true,\n});\n\nconsole.log('Original:', source.length, 'bytes');\nconsole.log('Minified:', result.code);","lang":"typescript","description":"Initializes the WASM module, minifies a WGSL shader, and logs original vs minified output."},"warnings":[{"fix":"Call await initialize() at startup, before any minify() call.","message":"initialize() must be called before minify().","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Keep mangleExternalBindings: false (default) if you rely on binding names for reflection.","message":"mangleExternalBindings: true breaks WebGPU reflection APIs like getBindGroupLayout.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Provide wasmURL option pointing to the .wasm file location.","message":"WASM file must be served/specified correctly in browser; auto-detection only works in Node.js.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use keepNames array to preserve critical identifiers.","message":"minifyIdentifiers: true renames internal identifiers but preserves entry points; unexpected renaming may occur if not using keepNames.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"N/A","message":"No known deprecations at version 0.1.1.","severity":"deprecated","affected_versions":">=0.1.1"}],"env_vars":null,"search_vec":"'0.1.1':17 'alpha/pre-release':21 'applic':15 'bind':39 'browser':26,71 'built':8 'bundler':72 'control':65 'extern':38 'fine':63 'fine-grain':62 'gpu':84 'grain':64 'identifi':32 'initi':49 'javascript':77 'like':73 'mangl':40 'manual':48 'minif':67 'minifi':7,80 'modul':12,53 'node.js':28 'offer':61 'optim':35 'option':37 'packag':42 'pass':68 'provid':29 'releas':18 'remov':31 'renam':33 'requir':47 'run':23 'shader':6,81 'ship':43 'support':70 'syntax':34 'tool':59 'type':45 'typescript':44,85 'unlik':56 'use':55 'version':16 'vite':74 'wasm':3,52,82 'webassembl':11,83 'webgpu':14,79 'webpack':76 'wgsl':5,58,78 'wgslmin':2 'wgslmin-wasm':1 'whitespac':30","created_at":"2026-06-04T18:56:39.740204+00:00","updated_at":"2026-06-04T18:56:39.740204+00:00","problems":[{"fix":"Ensure await initialize() completes before any minify() call.","cause":"minify() called before initialize() resolves.","error":"Error: WASM module not initialized. Call initialize() first."},{"fix":"Reinstall package: npm install wgslmin-wasm@latest","cause":"Invalid or corrupted .wasm file, or mismatch between JS and WASM versions.","error":"RuntimeError: memory access out of bounds"},{"fix":"Use named import: import { minify } from 'wgslmin-wasm'","cause":"Import path mistake or the library wasn't correctly imported.","error":"TypeError: Cannot read properties of undefined (reading 'minify')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://codeberg.org/saruga/wgsl-minifier","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"wgslmin-wasm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}