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

@cocoduro/import_button

v0.1.1

Published

Payload CMS helpers and a React import button for cocoduro recipe integrations.

Readme

@cocoduro/import_button

Reusable Cocoduro recipe-import integration for Payload CMS websites. The package provides:

  • a React import button for Next.js frontends;
  • a Payload Lexical helper that extracts the ingredient list following a Zutaten … heading;
  • backend-compatible items_b64 URL generation;
  • optional impression and click tracking;
  • standalone button CSS.

Install

npm install @cocoduro/import_button

Import the stylesheet once, typically from the root layout:

import "@cocoduro/import_button/styles.css";

Import using the recipe URL

To open Cocoduro with the recipe page as the import source, pass sourceUrl and omit ingredients:

import { CocoduroImportButton } from "@cocoduro/import_button/react";

<CocoduroImportButton
  sourceUrl="https://soundsvegan.com/2025/04/krautsalat-und-cole-slaw"
/>

The button opens https://cocoduro.de/import?url=<encoded sourceUrl> in a new tab. In the recipe template, set sourceUrl to each recipe's canonical URL. When ingredients are supplied, structured ingredient import takes priority and the generated link uses items_b64 instead of url.

Payload Lexical example

import { extractIngredientsFromPayloadLexical } from "@cocoduro/import_button";
import { CocoduroImportButton } from "@cocoduro/import_button/react";

export function Recipe({ post }: { post: RecipePost }) {
  const sourceUrl = `https://soundsvegan.com/${post.path}`;
  const ingredients = extractIngredientsFromPayloadLexical(post.content);

  return (
    <article>
      {/* Render the existing Payload rich-text content as usual. */}
      <RichText data={post.content} />

      <CocoduroImportButton
        ingredients={ingredients}
        sourceUrl={sourceUrl}
      />
    </article>
  );
}

Place the component wherever the button should appear in the recipe template. For a dedicated structured ingredients field, pass its values directly instead of using the Lexical extractor.

Structured ingredients

Strings are accepted and parsed by Cocoduro:

<CocoduroImportButton
  ingredients={["500 g Mehl", "2 Bananen", "1 Tasse Hafermilch"]}
  sourceUrl="https://example.com/my-recipe"
/>

Already structured values can be passed without losing their information:

<CocoduroImportButton
  ingredients={[
    { name: "Mehl", amount: 500, unit: "g" },
    { name: "Bananen", amount: 2 },
  ]}
  sourceUrl="https://example.com/my-recipe"
/>

When ingredients are available, the generated link uses items_b64. If no ingredients can be extracted, it falls back to ?url=<sourceUrl>.

Custom ingredient headings

The default extractor recognizes headings beginning with Zutaten. Supply a regular expression or predicate for other content conventions:

extractIngredientsFromPayloadLexical(post.content, {
  headingPattern: /^(ingredients|zutaten)\b/i,
});

Tracking

The React component sends the same minimal button.impression and button.click events as the WordPress integration. It does not set cookies or use local storage. Tracking can be disabled with trackImpressions={false} or trackClicks={false}.

License

GPL-2.0-or-later. See LICENSE for the full license text.

Development

npm test

Docker integration test

The repository contains a disposable Payload 3 + Next.js + SQLite application. It seeds a SoundsVegan-style Lexical recipe, reads it through Payload's Local API, extracts seven ingredients with this package, and renders the React import button.

From the repository root:

docker compose -f docker-compose.payload-test.yml up --build

Open:

http://localhost:3002

The seeded headless API is available at:

http://localhost:3002/api/recipes

Remove the disposable app and database with:

docker compose -f docker-compose.payload-test.yml down -v