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

@hakoniwajs/cloudflare

v0.1.8

Published

箱庭諸島2 (TypeScript 版) の Cloudflare Workers アダプタ。Durable Objects (SQLite) 版の Worker エントリと DO クラスを提供する

Readme

@hakoniwajs/cloudflare

箱庭諸島2 (TypeScript 版) の Cloudflare Workers Adapter です。Durable Objects (SQLite) 版の Worker エントリと DO クラスを提供します。

テンプレートリポジトリ hakoniwajs/template-cloudflare を使うのが一番簡単です (Deploy to Cloudflare ボタン対応)。

使い方

$ npm install @hakoniwajs/cloudflare

src/worker.ts:

import { createWorker } from "@hakoniwajs/cloudflare";

// wrangler.jsonc の durable_objects.class_name で HakoniwaGame を、exports で CachedPages を
// 解決するため、このファイルから再エクスポートする必要がある
export { CachedPages, HakoniwaGame } from "@hakoniwajs/cloudflare";

export default createWorker();

wrangler.jsonc の最小構成 (完全な設定例はテンプレートを参照):

{
  "name": "hakoniwa",
  "main": "src/worker.ts",
  "compatibility_date": "2026-08-22",
  "compatibility_flags": ["nodejs_compat"],
  "assets": { "directory": "./node_modules/@hakoniwajs/core/public" },
  // Workers Cache。Gateway (default) は無効にし、CachedPages だけ有効にする (wrangler 4.107.0 以降)
  "cache": { "enabled": true },
  "exports": {
    "default": { "type": "worker", "cache": { "enabled": false } },
    "CachedPages": { "type": "worker", "cache": { "enabled": true } },
  },
  "durable_objects": {
    "bindings": [{ "name": "GAME", "class_name": "HakoniwaGame" }],
  },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["HakoniwaGame"] }],
  "triggers": { "crons": ["*/15 * * * *"] },
  "vars": { "HAKONIWA_DEV_LOGIN": "false" },
}

Workers Cache (cache.enabled: true) を有効にすると静的アセットへのリクエストも Workers のリクエストとして課金対象になります。

必須の secret はありません。HAKONIWA_AUTH_SECRET は未設定なら初回起動時に自動生成して Durable Object に保存します。管理者は、デプロイ後にログインして /admin/setup を開き、Workers のログに出力されるセットアップコードを入力すると登録できます (HAKONIWA_ADMIN_EMAILS で指定しておくこともできます)。X / Discord ログインや Resend などの秘密情報を使う場合は wrangler secret put <NAME> で登録してください。設定項目の一覧は 環境変数一覧 を参照してください。

API

  • createWorker(options?) — fetch/scheduled を持つ Worker オブジェクト (Gateway) を返します。options.doBinding で DO バインディング名を GAME 以外に変更できます。
  • HakoniwaGame — Durable Object クラス (上記の通り再エクスポート必須)。
  • CachedPages — Workers Cache を有効にする内側のエントリポイント (上記の通り再エクスポート必須)。Gateway が ctx.exports 経由で呼び、キャッシュしてよい応答だけをここで DO から取得します。サイト設定の変更などのときは、DO が RPC (purgeEverything) でこのエントリポイントのキャッシュを消します。再エクスポートしていない場合は、キャッシュを使わずに DO へ直接転送します。
  • createCachedPages(options?) — doBinding などを変えた場合に使います。createWorker と同じオプションを渡し、export const CachedPages = createCachedPages({ doBinding: "..." }) のように export してください。

License

オリジナルの利用条件に従います (LICENSE)。同梱画像の商用利用はできません。