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

@needle-tools/addressing

v0.3.3

Published

Persistent addressing for Needle assets: deterministic needle-id computation, #needle anchors, and address resolution over glTF JSON and live scene graphs.

Readme

@needle-tools/addressing

Persistent addressing for glTF assets and three.js scene graphs: deterministic needle-id computation, the #needle name-anchor scheme, and address resolution.

Zero runtime dependencies, no three.js import (scene graphs are accessed structurally), usable in browsers, node, and workers.

Ids

Every glTF root-collection element (nodes, scenes, animations, cameras, materials, meshes, skins, textures, images, samplers) can carry a UUID in extras["needle-id"]:

  • Anchored — the element name ends with #needle (case-insensitive): the id derives only from the text before the marker → it survives any content change as long as the name stays. Spaces and underscores in the value are treated as equal (loaders sanitize node names), so Door Frame #needle and Door_Frame_#needle share one id.
  • Unanchored: the id derives from the element's type, name, and its occurrence among same-named elements → uniquely named elements keep their ids across reorders and content updates; duplicates disambiguate by position within their name group; unnamed elements are positional.

ensureIds(gltfJson) stamps a parsed glTF idempotently — existing ids are never overwritten, and any tool stamping the same element mints the same id.

ensureIds(gltfJson, { baseHash }) optionally salts unanchored ids with a caller-supplied identity (e.g. a stable asset id), scoping them to that identity.

Addresses

An address captures every fallback at creation time, while the target is known — { id, anchor?, type?, name?, namePath? }. Resolution order is strict:

  1. id — exact match (extras in glTF JSON, userData in live scene graphs)
  2. anchor — survives asset updates
  3. namePath — best-effort structural match
  4. reconciliation — never automatic: reconcileInGraph returns ranked candidates with confidence + reasons; the caller decides thresholds and whether to re-anchor.

API

import {
    ensureIds, computeElementId, computeFileHash,         // write side
    createGltfElementAddress, createObjectAddress,        // address records
    resolveInGltf, resolveInGraph, reconcileInGraph,      // resolve side
    parseAnchorValue, randomUuid, NEEDLE_ID_KEY,
} from "@needle-tools/addressing";

// stamp a parsed glTF (idempotent, never overwrites existing ids)
const { fileHash, assigned } = ensureIds(gltfJson);

// capture an address while the target is known
const address = createObjectAddress(sceneRoot, targetObject);

// later / elsewhere: resolve — or reconcile when the asset changed
const hit = resolveInGraph(address, sceneRoot);
const candidates = hit ? [] : reconcileInGraph(address, sceneRoot);

Out of scope by design: GLB container parsing (this package takes parsed JSON), file I/O, and any composition/override semantics.

Development

npm install
npm test        # vitest — includes golden-fixture id tests
npm run build   # tsc → dist/