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

@notion-headless-cms/notion-source

v0.1.5

Published

Notion data source adapter for @notion-headless-cms/core. Plug into createClient via sources: { notion: notionSource(...) }.

Downloads

290

Readme

@notion-headless-cms/notion-source

Notion 用データソースアダプター。@notion-headless-cms/corecreateClient({ sources: { notion: notionSource(...) } }) に渡して使う。

CLI 生成の nhc.schema.ts に書かれた schema 定数と Notion API トークンから、CMSAdapter を組み立てる薄いラッパー。

インストール

pnpm add @notion-headless-cms/core @notion-headless-cms/notion-source \
  @notionhq/client zod \
  unified remark-parse remark-gfm remark-rehype rehype-stringify
pnpm add -D @notion-headless-cms/cli

@notion-headless-cms/notion-orm / @notion-headless-cms/renderer は本パッケージの dependencies に含まれるため明示インストールは不要。

使い方

import { createClient } from "@notion-headless-cms/core";
import { notionSource } from "@notion-headless-cms/notion-source";
import { schema } from "./generated/nhc.schema";

const cms = createClient({
  sources: {
    notion: notionSource({
      schema,
      token: process.env.NOTION_TOKEN!,
      publishOptions: {
        posts: {
          publishedStatuses: ["公開済み"],
          accessibleStatuses: ["下書き", "公開済み"],
        },
      },
    }),
  },
});

@notion-headless-cms/notion-sourceimport するだけで、createClientsourcesnotion キーが補完候補として現れる(Fastify プラグイン型拡張と同じ module augmentation パターン)。

API

notionSource<S extends SchemaMap>(opts: NotionSourceConfig<S>): CMSAdapter

| オプション | 必須 | 説明 | |---|---|---| | schema | ✓ | CLI 生成の nhc.schema.ts から import する SchemaMap | | token | ✓ | Notion API トークン | | blocks | – | カスタムブロックハンドラーのマップ(@notion-headless-cms/notion-embedembed.blocks 等) | | enrichers | – | BlockEnricher のリスト(@notion-headless-cms/notion-katex 等) | | ogp | – | bookmark / embed / link_preview ブロックの OGP 取得設定 | | publishOptions | – | コレクション別の publishedStatuses / accessibleStatuses |

SchemaMap

CLI が nhc generate で出力する schema の型。1 コレクションあたり以下を持つ:

interface CollectionSchemaEntry {
  dataSourceId: string;
  properties: PropertyMap;
  slugField: string;
  statusField?: string;
}

拡張ポイント — 別ソースの追加

@notion-headless-cms/coreCMSSources インターフェースを宣言マージすれば、sources.<key> を補完候補に追加できる。

// my-source/index.ts
import type { CMSAdapter } from "@notion-headless-cms/core";

declare module "@notion-headless-cms/core" {
  interface CMSSources {
    contentful?: CMSAdapter;
  }
}

export function contentfulSource(opts: { ... }): CMSAdapter {
  return { collections: { ... } };
}

複数ソースを createClient({ sources: { notion: ..., contentful: ... } }) に渡すと、各ソースの collections がマージされて 1 つの cms.posts / cms.products などとしてアクセスできる。

関連パッケージ