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

@defold-typescript/library-types

v0.55.0

Published

Vendored TypeScript types for popular Defold Lua libraries, core-type-renamed against @defold-typescript/types.

Readme

@defold-typescript/library-types

Vendored TypeScript type declarations for a curated set of popular Defold Lua libraries, core-type-renamed against @defold-typescript/types.

This is a support package for the @defold-typescript toolchain. You normally do not install it directly — it ships as a dependency of @defold-typescript/cli, which reads it at runtime.

Why it exists

Many popular Defold libraries are plain Lua, installed through the editor's Fetch Libraries and carrying no .script_api, so there is nothing for the CLI's resolve command to extract types from. For a curated set of those, this package ships hand-vetted, ready-to-use TypeScript declarations.

When resolve encounters a declared dependency with no .script_api, it matches it against this corpus by source identity, verifies the match against the downloaded archive's Lua require paths, and prints the corresponding declarations into the project's .defold-types/libraries/ from the archive the project depends on, or from the sources pinned here. The import specifier is the Lua require path — e.g. import * as dicebag from 'dicebag.dicebag' — so it matches what Fetch Libraries installs at runtime.

What's inside

This package holds the inputs the CLI prints declarations from, and no printed declarations.

  • data/<version>/ — library data, in folders named by the first CLI version that reads them. A CLI reads the highest folder at or below its own version. Each folder holds one folder per library, named for its repository (the URL's last path segment, lowercased, without .git):

    • library.json — the upstream repository and license, the hand-written declaration forks, the native extension, and the base each of the library's index slots counts from.
    • reviewed.json — the upstream ref the library data was reviewed at.
    • recipe.json — the modules generated from the library's LuaLS annotations or .script_api, when it has any.
    • fork/ — the hand-written declarations: forked modules, and the @globalTable declaration of a native extension that ships no .script_api, which resolve installs as written.
    • source/ — the pinned upstream sources each generated module prints from; source/upstream/ holds the upstream files the parity checks measure against.

    Beside the library folders, index-slot-classifications.json holds the base each index slot counts from for the extension pages no library folder holds.

  • library-classification.json, library-targets.json — the ts-defold/library registries the classification tooling keeps.

  • api-doc/<module>.json — ref-doc JSON extracted from each declaration, consumed by the documentation site to render per-library API pages.

  • NOTICE — upstream attribution for every vendored library.

Provenance

The CLI prints each module through the lane its target file names: LuaLS annotations, a .script_api, or a hand-written declaration fork. Many forks descend from ts-defold/library (MIT) at the commit pinned in library-targets.json. ts-defold's hand-written declare module files already model these libraries faithfully; the only surface that differs is core-type naming. A codemod (packages/cli/src/library/sync-library-types.ts) walks the TypeScript AST and rewrites type references only — property names, JSDoc, declare module, and passthrough extensions (LuaMultiReturn, LuaMap) stay byte-identical:

| ts-defold | @defold-typescript/types | | --------- | -------------------------- | | hash, url | Hash, Url | | vmath.vector3 / vmath.vector4 / vmath.matrix4 / vmath.quat | Vector3 / Vector4 / Matrix4 / Quaternion | | node, texture, … (engine handles) | Opaque<"node">, Opaque<"texture">, … |

The renamed names resolve against the ambient globals in @defold-typescript/types, so no import injection is needed. Any vmath.* reference with no mapping is a hard error, so a missing rename fails loud rather than degrading to any.

Check every target's printed declarations after changing a lane or re-pinning a source:

bun test packages/cli/src/library

Direct use

This package exposes no declarations of its own: the CLI prints them from the inputs here. Let @defold-typescript/cli resolve write them into your project; see the toolchain docs.

License

MIT. Vendored declarations retain their upstream authors' licenses, credited in NOTICE.