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

@dignetwork/next-plugin-dig

v0.1.0

Published

A Next.js static-export adapter that makes DIG a first-class deploy target: a window.chia dev shim for `next dev`, plus a publish step that ships the static export (out/) to a DIG capsule via `digstore deploy`, honoring dig.toml. Deploy to a network no ho

Downloads

166

Readme

@dignetwork/next-plugin-dig

A Next.js static-export adapter that makes DIG a first-class deploy target. Build with Next, deploy the static export to a DIG capsule — a network no host can read, change, or take down — on Chia.

It does two things:

  1. Dev wallet, for free. Helpers inject the @dignetwork/dig-sdk window.chia dev shim into your app <head> during next dev — the same injected-provider contract the SDK's ChiaProvider detects in production — so you can develop the wallet path without the DIG Browser or an extension. The shim guards on a real wallet (the DIG Browser always wins) and never fakes a signature.
  2. Publish to a capsule. digDeploy() ships your static export (out/) to a DIG capsule via digstore deploy, printing the chia:// / DIGHUb URL. Publishing spends $DIG, so it is a deliberate publish step — never part of next build.
npm i -D @dignetwork/next-plugin-dig

Static export only. DIG hosts a static, content-addressed capsule (no server runtime), so your Next app must use output: "export". Server components/handlers, ISR, and image optimization that need a server aren't available on a static capsule.

Quickstart

1. Configure static export in next.config.mjs:

/** @type {import('next').NextConfig} */
export default {
  output: "export", // writes the static site to out/
};

2. Inject the dev wallet in your root layout, gated on dev so it never ships to production:

// app/layout.tsx
import Script from "next/script";
import { digNextDevShimScript } from "@dignetwork/next-plugin-dig";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        {process.env.NODE_ENV !== "production" && (
          <Script id="dig-dev-wallet" dangerouslySetInnerHTML={{ __html: digNextDevShimScript() }} />
        )}
      </head>
      <body>{children}</body>
    </html>
  );
}

Run next dev and your app now has a window.chia to develop against (a clearly-fake mock address that refuses to sign — so you always know it's the dev stub).

3. Add your store config to dig.toml:

store-id   = "<your 64-hex store id>"
output-dir = "out"            # Next's static-export dir (the adapter's default)
message    = "deploy from next"

4. Add a publish script that builds, then deploys:

// package.json
{
  "scripts": {
    "deploy": "next build && node -e \"import('@dignetwork/next-plugin-dig').then(m=>m.digDeploy())\""
  }
}
export DIGSTORE_DEPLOY_KEY=<from `digstore deploy-key export`>
npm run deploy

digDeploy() defaults outputDir to out, reads dig.toml + DIGSTORE_* env, then runs digstore deploy --json to advance the on-chain root, stage out/, and push the new capsule. It returns { capsule, storeId, root, chiaUrl, digUrl, hubUrl, pushed }chiaUrl is the chia://<storeId>:<rootHash>/ address a user clicks to open the app (digUrl is a deprecated alias of the same chia:// value); hubUrl is the DIGHUb view page.

Prereq: digstore must be installed and on PATH (the canonical deployer — the adapter never hand-rolls a deploy or a spend). See the install docs.

API

Dev shim

| Helper | Returns | Use | |---|---|---| | digNextDevShimScript(options?) | the eval-free script body (no <script> tags) | Next's <Script dangerouslySetInnerHTML> or a custom _document. | | digNextDevShimTag(options?) | a ready <script>…</script> string | raw HTML injection. |

options.address sets the mock receive address the shim returns. Always gate on process.env.NODE_ENV !== "production".

digDeploy(options?, deps?): Promise<DeployResult>

Deploy the static export. Call from a publish script after next build. Defaults outputDir to out; an explicit outputDir (or DIGSTORE_OUTPUT_DIR / dig.toml's output-dir) overrides it. Other options: storeId, message, network, remote, waitTimeout, cwd, digstoreBin. Precedence is options > DIGSTORE_* env > dig.toml > default. On failure it throws a coded DigAdapterError.

version() / capabilities()

import { version, capabilities } from "@dignetwork/next-plugin-dig";
version();        // "0.1.0"
capabilities();   // { name, version, framework: "next", exportDir: "out", features, errorCodes, docs }

Error codes

The publish path always throws a DigAdapterError with a stable .code:

| Code | When | |---|---| | DIGSTORE_NOT_FOUND | digstore is not installed / not on PATH. | | DEPLOY_FAILED | digstore deploy exited non-zero. | | DEPLOY_OUTPUT_UNPARSEABLE | digstore deploy --json output couldn't be parsed into a capsule. | | INVALID_ARGUMENT | A malformed argument. |

import { digDeploy, isDigAdapterError } from "@dignetwork/next-plugin-dig";
try {
  await digDeploy();
} catch (e) {
  if (isDigAdapterError(e, "DIGSTORE_NOT_FOUND")) console.error("Install digstore first.");
  else throw e;
}

The full catalogue is exported as DIG_ADAPTER_ERROR_CODES.

License

MIT.