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

@shader-core/engine

v1.2.0

Published

WebGL2 renderer and layer compositor for Shader Core. Zero runtime dependencies.

Readme

@shader-core/engine

The renderer and layer compositor behind Shader Core. WebGL2 and GLSL ES 3.0. Zero runtime dependencies.

import { compose, createRenderer } from '@shader-core/engine';
import { primitives } from '@shader-core/layers/primitives';
import { definition as gradient } from '@shader-core/layers/gradient';
import { definition as grain } from '@shader-core/layers/grain';

const renderer = createRenderer({
  canvas: document.querySelector('canvas')!,
  stack: [{ layer: gradient }, { layer: grain, blend: 'multiply' }],
  prelude: primitives,
  values: [{ colors: { colorA: '#05070d', colorB: '#4338ca' } }, { params: { intensity: 0.3 } }],
});

renderer.setValues([{}, { params: { intensity: 0.6 } }]); // a uniform; no recompile
renderer.dispose(); // releases the GL context, not just its objects

renderer.ready resolves once the first frame has been drawn — await it before fading out a poster or placeholder held over the canvas, and the fade can never uncover an empty one:

renderer.ready.then(() => poster.classList.add('faded'));

compile: 'parallel' moves shader compilation off the main thread (KHR_parallel_shader_compile). The call returns at once, the canvas holds its last frame until the new program is ready, and compile errors arrive through onError instead of throwing — so pair it with ready. On a cold cache a large stack is over 100 ms of main-thread stall on a fast laptop under the default sync, and none under parallel.

const renderer = createRenderer({ canvas, stack, prelude: primitives, compile: 'parallel', onError });
await renderer.ready; // compiled in the background, first frame drawn

A stack of layers becomes one program in one pass — no framebuffers. The program cache is keyed on the stack's shape, so changing a value never recompiles and returning to a shape you have used is free.

What it does for you

It runs inside other people's products, so most of the work is not drawing:

  • Pauses off-screen and while the tab is hidden.
  • prefers-reduced-motion renders exactly one frame and never animates.
  • Honours Save-Data; caps device pixel ratio and total pixels on modest hardware.
  • Trades resolution for frame rate on a device that cannot keep pace — 2×, 1.5×, 1×, 0.75× the CSS size — and holds a still frame only if even the smallest is below 30fps.
  • dispose() releases the GL context itself via WEBGL_lose_context, not only its objects — browsers cap live contexts at roughly 8–16.
  • Compile errors are reported against the layer file and line you wrote, not against the generated program.

Colours are converted to linear space on the way in, so blending is correct by construction. #808080 uploads as 0.216, not 0.502.

Licence

Free to use, including commercially. The credit comment stays in shader source you copy. See LICENSE.md.