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

@haiyue/shader-language

v0.1.0

Published

Build-time typed shader IR, Material Graph compiler, and deterministic WGSL tooling for HaiyueStudio.

Readme

Haiyue Shader Language

阶段 14 的 Typed IR → GLSL ES 3.00 可行性闭环见 stage14.md。同一 IR 已在真实浏览器分别通过 WebGPU/WGSL 与 WebGL2/GLSL 的编译、绑定和像素一致性验证;这不代表 WebGL2 renderer 已交付。

本目录是 Haiyue shader 组合系统的独立规范与 private workspace。阶段 0 冻结架构契约,阶段 1–5 建立 Composer、Typed IR 与三个 Pilot,阶段 6–8 建立 Artifact runtime 并迁移 Motion Blur/内置后处理,阶段 9 批量迁移 2D/UI 与 simple-3D,阶段 10–13 原子迁移 deformation、material-lighting、specialized-rendering 与 compute family,阶段 14 验证 GLSL ES 3.00 codegen;尚未提供稳定公共 API,compiler 也不进入 engine runtime。

系统的核心不是另一套 WGSL 文本语法,而是一个带类型、stage、坐标空间、资源和 capability 信息的 Typed Shader IR。TypeScript DSL、编辑器节点图和未来可能出现的文本语法都必须编译到同一份 IR;后端已可从同一 IR 生成 WGSL 与受限的 GLSL ES 300。

Shader Language Lab

examples/shader-language-lab/ 提供可交互 showcase,浏览器只加载构建期 artifact,不携带 compiler。页面包含三条证据链:同一 Typed IR 的 WebGPU/WGSL 与 WebGL2/GLSL ES 3.00 像素一致性;真实 Material Graph 的 albedo、法线贴图、UV noise、高度渐变、metallic/roughness 与 Fog 组合;真实 19-joint glTF/Animation3D 角色在 forward、depth、shadow、motion、outline 五个 Pass 中共享 morph → skinning → displacement 和 history ABI。Inspector 可以在 Composition、IR、WGSL/GLSL 与 reflection 间追踪 provenance。GLSL 仍只覆盖阶段 14 明确支持的可移植子集,不改变引擎 WebGPU-only 的产品契约。

npm run shader-language:generate:showcase
npm run verify:shader-language-lab

当前状态

建议阅读顺序

  1. architecture.md:系统边界、编译流水线和迁移原则。
  2. type-system-and-stages.md:类型、stage、坐标空间和 varying 规则。
  3. material-surface.md:材质语义槽位与多 pass 一致性。
  4. resource-abi.md:符号资源、绑定空间和 reflection。
  5. variants-and-capabilities.md:静态变体、动态参数和目标 profile。
  6. graph-format.md:节点图 v1、规范化和迁移。
  7. escape-hatches.md:受信任扩展与原始 shader 边界。
  8. pilots.md:三个迁移试点及 go/no-go 门禁。
  9. stage1.md:当前可执行实现、限制和验证。
  10. stage2.md:Typed IR、TypeScript builder、WGSL backend 和真实 WebGPU smoke。
  11. stage3.md:Graph v1、MaterialSurface、PBR/Fog lowering 和手写参考像素/gzip gate。
  12. stage4.md:Typed IR deformation region、自动 vertex/varying、五 pass 与真实 glTF gate。
  13. stage5.md:Postprocess Typed IR、外部 pass plan、稳定 motion blur reconstruction 与像素 gate。
  14. stage6.md:构建期 artifact、runtime reflection adapter 与 Motion Blur 生产迁移。
  15. stage7.md:Artifact V2、多 group/layout owner、生成注册表和迁移清单。
  16. stage8.md:builtin postprocess module-family、九 pass 生产迁移和真实 WebGPU gate。
  17. stage9.md:2D/UI 与 simple-3D module-family、17 pass 生产迁移和 bundle/WebGPU gate。
  18. stage10.md:production deformation family、morph/skinning/history ABI 与角色辅助 pass 闭环。
  19. stage11.md:production material-lighting family、PBR 变体、Blinn/Toon 与 Fog/light ABI 闭环。
  20. stage12.md:production specialized-rendering family、固定纹理 utility 与 renderer/artifact layout ownership。
  21. stage13.md:Typed Compute IR、副作用/调度 ABI 与五个生产 compute pass 原子迁移。
  22. stage14.md:同一 Typed IR 的 GLSL ES 3.00 codegen、std140 reflection 与双后端浏览器证据。

机器可读契约

运行:

npm run shader-language:check

该门禁先检查阶段 0 文件、固定枚举、逻辑资源空间、Artifact/module-family schema、迁移清单和仓库索引,再执行阶段 1–14 typecheck、构建、契约测试、private compiler/runtime 边界与统一 production artifact stale check。真实 Chrome 验证使用阶段 2–14 的独立命令;阶段 14 运行 npm run verify:shader-language-stage14。后续编译器实现不能通过修改统计口径绕过这些契约;需要改变决策时应新增 ADR并提升对应格式版本。

阶段 14 仍未包含

  • 不实现 arbitrary deformation node plugin、text parser、完整优化器或 shader graph UI。
  • 不由 shader compiler 创建纹理、调度 RenderGraph 或管理 GPU resource lifecycle。
  • 不替换现有 WgslFeatureComposer
  • 不增加 stable/experimental export。
  • 不承诺 WebGL2 renderer fallback。
  • 不把现有 production family 自动宣称为 WebGL2-compatible;cross-stage varying/MRT 与 renderer feature degradation 尚未完成。
  • 不允许场景或 graph JSON 携带任意 WGSL、GLSL、JavaScript 源码。