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

glslx-loader

v0.0.4

Published

WebGL integration for Webpack and TypeScript

Readme

glslx-loader

WebGL integration for Webpack and TypeScript

GLSLX-loader demo

Table of contents

  • About
  • Usage
  • Known issues

About

This project parses and type check GLSL code, then it generates JavaScript boilerplate code and TypeScript definitions. This project uses GLSLX so you can conbine vertex and fragment shaders on the same file.

GLSL source :

uniform mat4 transform;
uniform vec3 color;

attribute vec4 position;

export void Vertex() {
  gl_Position = transform * vec4(position.xy, 0, 1);
}

export void Fragment() {
  gl_FragColor = vec4(color, 1);
}

export void ColorFragment() {
  gl_FragColor = vec4(0, .5, 0, 1);
}

Generated TypeScript definition:

import {Shader} from 'glslx-loader/runtime/shader'

export class Vertex extends Shader {
	enablePosition(): void
	disablePosition(): void
	setPositionPointer(size: number, type: number, normalized: boolean, stride: number, offset: number): void
	setPosition(x: number, y: number, z: number, w: number): void

	setTransform(value: Float32Array|number[], transpose?: boolean): void
}

export class Fragment extends Shader {
	setColor(x: number, y: number, z: number): void
}

export class ColorFragment extends Shader {}

Generated JavaScript :

import {Shader} from 'glslx-loader/runtime/shader'

export function Vertex(gl, type) {
    Shader.call(this, gl, type, Vertex.source)
}

Vertex.source = "precision mediump float;uniform mat4 c;attribute vec4 a;void main(){gl_Position=c*vec4(a.xy,0,1);}"
Vertex.attributes = [{
    name: "position",
    type: "vec4",
    symbol:"a"
}]
Vertex.uniforms = [{
    name: "transform",
    type:" mat4",
    symbol: "c"
}]

export function Fragment(gl, type) {
    Shader.call(this, gl, type, Fragment.source)
}

Fragment.source = "precision mediump float;uniform vec3 b;void main(){gl_FragColor=vec4(b.rgb,1);}"
Fragment.attributes = []
Fragment.uniforms = [{
    name: "color",
    type: "vec3",
    symbol: "b"
}]

export function ColorFragment(gl, type) {
    Shader.call(this, gl, type, ColorFragment.source)
}

ColorFragment.source = "precision mediump float;void main(){gl_FragColor=vec4(0,.5,0,1);}"
ColorFragment.attributes = []
ColorFragment.uniforms = []

Usage

Just add glslx-loader for your files webpack.config.js, if your files end with .gl:

{
    test: /\.gl$/,
    include: [
        path.resolve(__dirname, 'src')
    ],
    loader: 'glslx-loader'
}

Known issues

  • It does not work with ts-loader fork type checker plugin, it's not really an issue of glslx-loader