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

@click-to-source-3d/core

v0.1.3

Published

Core provenance engine for Click-to-Source 3D

Downloads

608

Readme

@click-to-source-3d/core

Provenance resolution for Three.js objects: given a rendered object, find the source location and arguments that produced it.

Browser-pure, no framework dependency. Part of Click-to-Source 3D.

Most users do not install this directly — it arrives with @click-to-source-3d/overlay. Install it alone if you are on plain Three.js, or building your own UI.

Install

npm install @click-to-source-3d/core

three is a peer dependency (>=0.170.0).

Use

import { resolveSourceRef } from "@click-to-source-3d/core";

const resolved = resolveSourceRef(object, instanceId);
// -> { object, sourceRef: { file, function, line, args }, readonly }

Provenance comes from either source: userData.sourceRef, written by hand, or userData.__ctsSource, stamped automatically by @click-to-source-3d/vite-plugin. A manual ref wins over a stamp, field by field, so you can correct one value without giving up automatic location.

Per-instance capture

InstancedMesh instances have no objects of their own. Install the probe before any scene mounts and it records each write:

import "@click-to-source-3d/core/probe";

The Vite plugin injects this for you under captureInstances: true, ahead of your entry module, because a probe that arrives after the first scene commits captures nothing — and does so silently.

Limits

Instanced provenance is read-only. A transform placed by a seeded RNG has no corresponding literal in source.

Variant-class values cannot be recovered. The probe reads a Matrix4, so it recovers x, y, z, scale and yaw. Anything not in the transform — colour group, species, material variant — is not recoverable by capture. Write userData.instanceSourceRefs by hand if you need it.

Stale instance slots are dropped, not guessed. If a mesh's instance count shrinks, the abandoned slots still render and their records are indistinguishable from live ones by index alone. They are discarded, because confident wrong provenance is worse than none.

Subpaths

@click-to-source-3d/core         the public API
@click-to-source-3d/core/probe   installs the instance capture probe
@click-to-source-3d/core/bridge  answer bridge queries over your own transport

The bridge subpath is only needed if the SSE channel the Vite plugin serves does not fit your setup. Attach a scene with setBridgeScene(), then pass each incoming query to answerBridgeQuery — the same function the built-in channel calls, so a custom transport answers identically.

License

MIT