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/engine

v0.1.0

Published

A WebGPU-first 2D/3D game engine with PBR rendering, ECS, assets, animation, physics, and browser tooling.

Readme

@haiyue/engine

海月是面向现代浏览器的 WebGPU-first 2D/3D 游戏引擎。稳定入口提供 ECS、场景、PBR 渲染、资产生命周期、输入、后处理和常用几何能力;高级渲染与诊断协议通过明确的 experimental 子路径隔离。

要求

  • Node.js 22 或更高版本(构建、测试和发布工具)
  • TypeScript 5.2+,module: "ESNext"moduleResolution: "Bundler"skipLibCheck: false
  • 支持 WebGPU、ES modules、Workers、AbortController 和现代 TypedArray 的浏览器
  • 应用需要为不支持 WebGPU 的设备提供产品级不支持页面;当前没有 WebGL renderer fallback

安装

npm install @haiyue/engine

最小 3D 场景

import {
  CartesianTransform3D,
  Entity,
  HaiyueEngine,
  Mesh3D,
  PbrMaterial,
  createBox3D,
} from '@haiyue/engine';

const engine = new HaiyueEngine({
  canvas: '#canvas',
  renderProfile: 'batched',
});

await engine.init();

const scene = engine.createScene({ name: 'hello', render3D: true });
const cube = new Entity('Cube');
cube.addComponent(new CartesianTransform3D());
cube.addComponent(new Mesh3D(
  createBox3D(),
  new PbrMaterial({ metallic: 0.2, roughness: 0.6 }),
));
scene.add(cube);

engine.switchScene(scene);
engine.run();

canvas 可以是 HTMLCanvasElement、裸元素 ID 或 CSS selector。renderProfile: 'batched' 是普通产品默认路径;可选能力会经过协商并产生明确的降级报告。

初始化失败时用 HaiyueEngine.webGpuCompatibility.classifyError(error) 区分 unsupported、adapter unavailable 与 context unavailable,再用 renderPage() 显示统一阻塞页面。其他 EngineError 保留稳定的 codepathhintdocsPathcontext;不要只匹配 message。

稳定入口

  • @haiyue/engine:普通游戏黄金路径
  • @haiyue/engine/assets:资产加载与生命周期
  • @haiyue/engine/diagnostics:只读 frame/GPU resource 聚合快照
  • @haiyue/engine/extension-authoring:独立渲染扩展使用的窄稳定 SPI
  • @haiyue/engine/geometry:几何生成和处理
  • @haiyue/engine/material:材质和来源无关的材质描述
  • @haiyue/engine/postprocess:后处理
  • @haiyue/engine/physics:可替换物理后端
  • @haiyue/engine/scene/systems/serialization:场景装配、系统和显式序列化

完整入口以 package.json#exports 和构建后的 .d.ts 为准;API Reference 只提供索引,不复制 declaration。

@haiyue/engine/experimental 及其细分入口不提供与 stable API 相同的兼容承诺。包内未由 package.json#exports 声明的文件属于私有实现。

生命周期

场景切换使用 engine.switchScene(next, { destroyPrevious: true })。应用退出时调用 engine.destroy(),使 active scene、资产 owner、GPU 资源和监听器按所有权一起释放。

完整指南、浏览器支持矩阵、示例和 API 稳定性规则位于项目仓库的 docs/engine-guidedocs/apidocs/for-ai/api-stability.md

从安装到资产加载、动画和释放的可运行路径见 consumer walkthrough。支持上限和故障信息见 known limitationstroubleshooting

Repository:HypnosNova/HaiYue

License

MIT