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

@rottencandy/esbuild-plugin-glslx

v0.0.3

Published

A plugin for esbuild that enables importing *.glslx files.

Downloads

2

Readme

Differences from https://github.com/evanw/esbuild-plugin-glslx :

  • Support glslx build options
  • Update glslx vertion to 0.2.13

esbuild-plugin-glslx

A plugin for esbuild that adds support for *.glslx file imports including shader type checking at build time. GLSLX is a language extension for GLSL that lets you write multiple WebGL 1.0 shaders in the same file using the export keyword. It comes with a GLSLX Visual Studio Code extension that enables standard IDE features for GLSLX including type checking, go-to-definition, symbol renaming, and format-on-save. GLSLX code looks something like this:

uniform sampler2D tex;
attribute vec3 pos;
varying vec2 coord;

export void yourVertexShader() {
  coord = pos.xy;
  gl_Position = vec4(pos, 1);
}

export void yourFragmentShader() {
  gl_FragColor = texture2D(tex, coord);
}

Basic Usage

  1. Install this plugin in your project:

    npm install --save-dev esbuild-plugin-glslx
  2. Add this plugin to your esbuild build script:

    +const glslxPlugin = require('esbuild-plugin-glslx')
     ...
     esbuild.build({
       ...
       plugins: [
    +    glslxPlugin(),
       ],
     })
  3. Import your *.glslx file from JavaScript:

    import { yourVertexShader, yourFragmentShader } from './shaders.glslx'
    
    // Each shader is a string that you can pass to your WebGL 1.0 rendering engine of choice
    const material = THREE.RawShaderMaterial({
      vertexShader: yourVertexShader,
      fragmentShader: yourFragmentShader,
    })

Usage with TypeScript

If you would like to use GLSLX with TypeScript, you'll have to tell the TypeScript compiler how to interpret imports from *.glslx files. You have two options:

  • One way to do this is to add a blanket type declaration for all *.glslx files such that every import is considered to be a string:

    // Save this as the file "glslx.d.ts" alongside your source code
    declare module "*.glslx" {
      var values: Record<string, string>;
      export = values;
    }

    This means you can't use named imports anymore, but you can still use namespace imports like this:

    import * as shaders from './shaders.glslx'
    console.log(shaders.yourVertexShader, shaders.yourFragmentShader)
  • Another way to do this is to generate a *.glslx.d.ts file for each *.glslx file with a type declaration for each exported shader. This plugin can do that for you if you enable the writeTypeDeclarations option:

     const glslxPlugin = require('esbuild-plugin-glslx')
    
     esbuild.build({
       ...
       plugins: [
         glslxPlugin({
    +      writeTypeDeclarations: true,
         }),
       ],
     })

    Then you can use any kind of imports in TypeScript including named imports.