npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

glslang-wasm

v1.1.1

Published

glslang in WebAssembly - validate your shaders and compile to SPIR-V or WebGL with JavaScript

Readme

glslang but in WebAssembly.

Checks your GLSL shaders for errors and compiles them via SPIR-V from JavaScript. Errors match glslangValidator.

  • Nothing else to install and no unnecessary deps
  • Handles OpenGL, Vulkan, ES, #include
  • Runs in Node (used in glsl-vscode), browsers and web workers 🔗

[!NOTE] Built clean from Khronos glslang 16.6.0 and SPIRV-Cross, see compile.sh.

Usage

npm install glslang-wasm
// @ts-check
import { createGlslang } from 'glslang-wasm';

const glslang = await createGlslang();
const { diagnostics } = await glslang.check(source, { stage: 'fragment' });
const { spirv } = await glslang.compile(source, { stage: 'fragment' }); // Uint32Array
const { source: webgl, uniforms } = await glslang.crossCompile(spirv, { version: 300, es: true });
createGlslang(options?: {
  // glslang.wasm bytes - default reads glslang.wasm from next to glslang.js
  wasmBinary?: Uint8Array;
});

check(source: string, options: {
  stage: 'vertex' | 'tesscontrol' | 'tesseval' | 'geometry' | 'fragment' | 'compute'
    | 'raygen' | 'intersect' | 'anyhit' | 'closesthit' | 'miss' | 'callable' | 'task' | 'mesh';
  // File name shown in diagnostics, e.g. 'sky.frag' - default '0'
  name?: string;
  // Default none, vulkan for compile()
  client?: 'none' | 'opengl' | 'vulkan';
  // Version for source without #version line, e.g. 450 - default 100
  defaultVersion?: number;
  // Profile for source without #version line, e.g. 'core' - default none
  defaultProfile?: 'none' | 'core' | 'compatibility' | 'es';
  // Default 1.4
  vulkanVersion?: '1.0' | '1.1' | '1.2' | '1.3' | '1.4';
  // Default 1.6, 1.0 for opengl
  spirvVersion?: '1.0' | '1.1' | '1.2' | '1.3' | '1.4' | '1.5' | '1.6';
  // Code inserted after #version, e.g. '#define LIGHTS 4' - doesn't shift source line numbers
  preamble?: string;
  // Called for each #include, e.g. #include "common.glsl" in sky.frag calls:
  //   include('common.glsl', { includer: 'sky.frag', system: false, depth: 1 })
  //   returns { name: 'resolved/path/common.glsl', source: '...' } or undefined
  // system: true for #include <lib.glsl>, false for #include "lib.glsl"
  // Without it #include is an error
  include?: (header: string, context: { includer: string; system: boolean; depth: number })
    => { name: string; source: string } | undefined;
  // Also check shader as a whole, e.g. missing main() or function declared but never defined
  // Default false, compile() always links
  link?: boolean;
});

compile(source: string, options: {
  // Same as check() without link, plus:
  // Assign missing locations and bindings, e.g. loose `uniform float x;` with client opengl
  autoMap?: boolean;
});

crossCompile(spirv: Uint32Array, options: {
  // Output GLSL version, e.g. 300 for WebGL2
  version: number;
  es: boolean;
});
// Returns { source, uniforms, error }
// Uniform blocks and push constants become plain struct uniforms
// uniforms: [{ name: 'material.color', label: 'color', type: 'vec3', size: 1 }, ...]
// error: e.g. a feature the output version lacks

License