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

@doki-land/live2d-core

v0.1.0

Published

Shared TypeScript contracts for live2d.ts — ModelSource, Live2dStage/Actor, ModelAsset, events (no DOM/GPU).

Readme

@doki-land/live2d-core

Framework-independent contracts and data structures for the live2d.ts runtime.

This is an implementation package. Application developers should normally install @doki-land/live2d instead.

🧭 Package Role

The core package defines the shared language used by loaders, model runtimes, renderers, and the public facade:

  • model sources and normalized settings;
  • session phases and state;
  • runtime events and progress payloads;
  • model programs and instances;
  • frame snapshots and drawable data;
  • asset resolver contracts;
  • format detection shared across packages.

It does not fetch network resources, decode MOC binaries, create a canvas, or issue GPU commands.

📦 Installation

pnpm add @doki-land/live2d-core

Install this package directly only when implementing a compatible loader, renderer, diagnostic tool, or host integration.

🧱 Design Principles

  • Contracts remain independent of game engines, blog engines, and UI frameworks.
  • Graphics API types do not leak into model and session contracts.
  • Model-format parsing does not belong in core.
  • Public data uses explicit typed structures rather than hidden runtime globals.
  • Events remain small enough for browsers and lightweight hosts.

🧩 Core Contracts

The package exposes types such as:

import type {
    AssetResolver,
    FrameSnapshot,
    Live2dSession,
    ModelSettings,
    ModelSource,
} from "@doki-land/live2d-core";

An asset resolver provides model-related resources without prescribing HTTP, file-system, CDN, or package-registry behavior:

const resolver: AssetResolver = {
    async fetchJson(url) {
        const response = await fetch(url);
        return response.json();
    },
    async fetchBytes(url) {
        const response = await fetch(url);
        return response.arrayBuffer();
    },
};

Use the exact exported interface as the source of truth; the example illustrates the ownership boundary rather than guaranteeing every method name across versions.

🔄 Session Lifecycle

A runtime session moves through explicit phases rather than relying on DOM state:

idle -> mounting -> ready -> loading -> live
                               \-> error

Consumers should listen to phase and error events instead of inferring readiness from a non-null canvas or model reference.

📸 Frame Data

FrameSnapshot represents evaluated CPU-side model output. It is useful for:

  • renderer input;
  • deterministic fixtures;
  • diagnostic capture;
  • regression fingerprints;
  • model inspection tools.

Frame data must not contain host-specific UI state or require a renderer to reload source assets.

🧪 Development

pnpm --filter @doki-land/live2d-core typecheck
pnpm --filter @doki-land/live2d-core test

Contract changes should include compatibility notes in the change itself and update all workspace consumers in the same change set.

🤝 Contributing

Avoid adding convenience APIs that belong to the facade. A core abstraction should be shared by at least two implementation layers and remain meaningful without a browser UI framework.

📄 License

Source code is dedicated to the public domain under CC0 1.0 Universal — see License.md.