# Consuming a component Each component builds a self-contained dist — `dist/.js` (pebble bundled in, minified, internal properties mangled), `dist/.d.ts`, and `dist/.css` when the component ships a sheet. A consumer needs no JSX compiler and no pebble build step; the bundle's import side effect is the element's registration. Two flows: vendor the dist (works today, works forever) or install from the forge's npm registry (once the library is published there). ## Vendoring the dist The precedent is toboggan's `packages/pebble`: copy the component's dist files into your repo and record where they came from. ``` vendor/pebble-library/ toaster.js # dist/toaster.js toaster.js.map # optional, for debugging toaster.d.ts # the types toaster.css # optional: the raw sheet, for zero-JS pages REVISION # the library commit this copy was taken from ``` `REVISION` is one line — the library's commit sha (`git -C library rev-parse HEAD` at vendor time). Re-vendoring is copying the files again and updating `REVISION`; the diff in your repo shows exactly what changed. Pin deliberately, bump deliberately. Then either a script tag: ```html ``` or an import from your own module graph (your bundler sees a plain ESM file): ```ts import "./vendor/pebble-library/toaster.js"; ``` Importing twice is safe: a second bundle carrying the component gets the first's constructor back from `define()`, and the registry is per-tag. ## The registry flow (once published) The library publishes to the forge's npm registry as `@pebble/library`. The scope is mapped in your committed `bunfig.toml` — public installs need no token: ```toml [install.scopes] "@pebble" = "https://toboggan.cloud/npm" ``` ```sh bun add @pebble/library ``` ```ts import "@pebble/toaster"; // the import IS the registration ``` (The per-component specifier is set when the published package face lands; the workspace names are `@pebble/toaster` / `@pebble/tablet`.) In this ecosystem dependency versions are **exact pins, never ranges**: `"@pebble/library": "0.0.1"`, and a bump is its own commit. Versions are immutable on the registry — no republish, no unpublish — so an install that resolved once resolves forever. **Status:** the registry publish is blocked on the forge deploying its npm registry. Until then, vendoring is the flow; the pin swap is a one-line change when the registry lands. ## What you never need - pebble itself: bundled into each component's dist. - A JSX compiler or a build plugin: the components were compiled at their build time, not yours. - `sideEffects` gymnastics: a component package deliberately does not set `sideEffects: false` — dropping the import would drop the registration. Keep the import for its side effect; tree-shakers must see it.