コンテンツにスキップ

インストール

plasma は 5 つのパッケージとして提供されます。ほとんどのアプリはこれらすべてを利用しますが、不要なものは省略できます(例えば store を Solid や vanilla JS から利用する場合は @sh1n4ps/plasma-react を省略できます)。

  • Node.js 20+ — ビルドツール群
  • TypeScript 5.7+ — plasma の phantom types は最新の型推論を必要とします
  • Cloudflare Workers プロジェクト(server 側で使用します。ローカル開発は Miniflare 上で動作します)
Terminal window
pnpm add @sh1n4ps/plasma-core @sh1n4ps/plasma-client @sh1n4ps/plasma-server @sh1n4ps/plasma-react
パッケージ 追加するとき
@sh1n4ps/plasma-devtools ページ内 inspector や Chrome DevTools の postMessage bridge が欲しいとき
@sh1n4ps/plasma-client-sqlite client 側でデフォルトの IndexedDB engine の代わりに sql.js / OPFS SQLite engine を使いたいとき
Terminal window
pnpm add @sh1n4ps/plasma-devtools @sh1n4ps/plasma-client-sqlite
  • @sh1n4ps/plasma-core — 純粋な型 + schema DSL + query AST + wire protocol。標準ライブラリ以外に runtime 依存を一切持ちません。あなたの schema.ts ファイルが import するのはこれです。
  • @sh1n4ps/plasma-client — IndexedDB engine、IVM による live query、optimistic な mutate + push/pull + rebase、WebSocket subscription ヘルパー、file blob アップロード worker。
  • @sh1n4ps/plasma-server — SQL コンパイラ(SQLite / Postgres dialect)、sync ハンドラ、executor アダプタ(fromBetterSqlite3 / fromD1)、SyncCoordinator Durable Object、R2 Storage アダプタ、blob エンドポイント、GC ヘルパー、SequencerDO
  • @sh1n4ps/plasma-reactPlasmaProvideruseLiveQueryuseMutationusePlasmaFile。フレームワーク固有の hook はここに含まれ、それ以外はフレームワーク非依存です。
  • @sh1n4ps/plasma-devtools — ページ内 React パネル、Chrome DevTools 拡張向けの postMessage bridge、plasma の内部 store を読み取る reflection hook。
Terminal window
pnpm ls @sh1n4ps/plasma-core @sh1n4ps/plasma-client @sh1n4ps/plasma-server @sh1n4ps/plasma-react

4 つすべてが、インストールしたバージョンで表示されるはずです。