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

@407dev/cms-astro

v1.0.2

Published

- Astro SDK & integration providing declarative field helpers (`f.text`, `f.img`, `f.richText`, `f.scope`, `f.entryScope`, `f.group`, `f.entries`), ProseMirror `<RichText>` rendering, build-time bundle hydration, preview bridge protocol injection, token-g

Readme

@407dev/cms-astro

Purpose

  • Astro SDK & integration providing declarative field helpers (f.text, f.img, f.richText, f.scope, f.entryScope, f.group, f.entries), ProseMirror <RichText> rendering, build-time bundle hydration, preview bridge protocol injection, token-gated draft preview overlays, and an in-browser dev toolbar app for live editing during local development with zero drift.

Surface

Patterns

  • Usage is the Schema: Reading f.text('home.hero.heading') or <f.text k="home.hero.heading" /> simultaneously marks the DOM editable region and defines the manifest entry for static extraction.
  • Dual-Callable Helpers: Helpers work synchronously as functions (f.text('key', { defaultValue: '...' })) returning typed primitives or as Astro JSX components (<f.text k="key" />) emitting DOM marker attributes (data-cms-field, data-cms-entry-field).
  • Entry Scoping & Collection Listings: f.entryScope('blog', entry.slug) creates bound helpers emitting data-cms-entry-field and provides .attrs() emitting data-cms-collection + data-cms-entry. f.collectionAttrs('blog') emits data-cms-collection on listing containers for visual canvas collection editing.
  • Group Multiplication: f.group defines reusable multi-field shapes instantiated at different prefixes (Hero('home.hero'), Hero('about.hero')), passing bound helpers to prop-drilled components.
  • Preview Bridge Injection: In preview requests (/_preview/*?preview_token=...) and Astro dev mode, the bridge IIFE is injected before </body> to handle handshake, capabilities (capabilities: ['comments', 'collection-click']), click capturing (field -> group -> entry -> collection priority), collection outlines with dashed borders and label chips, comment mode click suppression, anchor chain derivation, live anchor-rects streaming, outlines, and DOM patching.
  • Dev-Server Middleware API: In dev mode (command === 'dev'), Vite middleware mounts /_cms/dev/* for status, bundle, and draft field writes without polluting production bundles.
  • Single Bundle Fetch: Published bundle is fetched once per build and hydrated across all static pages synchronously via store singleton and .cms/bundle.json.
  • Zero-Config Integration: cmsAstro() accepts no arguments, automatically falling back to environment variables CMS_SITE_ID and CMS_CONTENT_URL populated by cms link (preview secrets are never stored on site hosts; preview tokens are verified directly by content-worker).
  • AsyncLocalStorage Draft Overlay: runWithDraftBundle overlays draft field values and entries inside SSR preview requests without mutating the global store.

Integrations

  • Consumes @407dev/blocks (packages/blocks) for deterministic schema hashing and schema parsing.
  • Consumes @407dev/field-types (packages/field-types) for field registry, validation, and link whitelisting.
  • Consumes @407dev/config (packages/config) for dev tokens and path normalization.
  • Optionally consumes @407dev/cli (packages/cli) in dev mode for real-time template AST extraction diagnostics.
  • Consumed by consumer Astro applications (e.g. examples/demo-site (examples/demo-site)).

Constraints

  • Published to public npm with ESM output and .d.ts declaration maps via tsup.
  • Any export change or signature alteration requires a changeset (pnpm changeset).
  • Zero direct database queries — communicates exclusively via edge content and draft HTTP endpoints.
  • Separate preview build topology: preview deployment sets CMS_PREVIEW_BUILD=1 -> output: 'server' + Cloudflare adapter, whereas production builds default to output: 'static'. A site may still carry the Cloudflare adapter in a static production build to run other on-demand routes (e.g. @407dev/site-services's injected /_api/[...path]) via per-route prerender: false — the adapter alone does not make the whole site server-rendered.
  • Dev routes and toolbar code are strictly excluded from production build outputs (astro build).

Gotchas

  • CMS_DEV_TOKEN is never exposed to the client or injected into vite.define; it is used exclusively by dev-server middleware for write-plane authorization.
  • In Astro preview middleware, context.rewrite(targetPath) must be returned directly to render the rewritten route; discarding its return value results in rendering nonexistent /_preview/* routes.
  • When rendering group fields in prop-drilled components, use bound accessors (content.heading) and spread {...content.attrs()} — do not call f.text('literal') internally inside shared components.
  • Invalid or expired preview tokens return 404 Not Found (never exposing error details or unauthenticated drafts).
  • Preview responses must always be served with Cache-Control: no-store and X-Robots-Tag: noindex.
  • When mutating the DOM during in-place toolbar saves, MutationObservers are paused to avoid triggering re-entrant rescan loops.
  • Preview bridge and dev status editor origins are configured via CMS_EDITOR_ORIGINS (comma-separated) or explicit editorOrigins integration options; defaults to allowing both https://web.localhost and http://localhost:5173.
  • The injected preview bridge automatically suppresses the Astro dev toolbar (astro-dev-toolbar { display: none !important; }) when loaded inside an <iframe> (editor preview).
  • Comment mode cursor and click interception takes precedence over visual edit mode and link navigation whenever data-cms-comment-mode is set on document.documentElement.