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

@yanqirenshi/d3.terraform

v0.1.0

Published

Terraform repository visualizer — directory tree with Input / Process / Output 3-column module layout

Readme

@yanqirenshi/d3.terraform

Terraform リポジトリを SVG で可視化する TypeScript ライブラリです。 ディレクトリツリーを再帰的に描画し、.tf ファイルを持つディレクトリ(モジュール)は Input / Process / Output の3カラムでブロック(variable / resource / data / module / provider / locals / output)を一覧表示します。

hayabusa リポジトリの src/features/terraform/ から移植したものです。

構成(データ/描画の2系統)

  • データクラス
    • TerraformDirectory / TerraformFile / TfItem — パース済みの構成
    • parseTerraformFile / extractBlockContent / buildTerraformDirectory — HCL ブロックの簡易パーサ(ブラウザ安全)
    • TerraformDrawing — レイアウト計算(3カラム配置 + 再帰縦並び。テキスト計測関数を注入可能)
    • BoxNode / BranchBoxNode — 描画ノード(icon / subtitle / strokeWidth)
  • 描画クラス
    • D3Terraform — エントリ React コンポーネント(SVG 100%、ホイールズーム/パン、背景グリッド、Canvas テキスト計測)
    • TerraformGroup / BaseBoxNode — 再帰 SVG レンダラ

使い方

import D3Terraform, { buildTerraformDirectory } from '@yanqirenshi/d3.terraform';

const data = buildTerraformDirectory({
  name: 'infra',
  children: [
    {
      name: 'network',
      path: 'modules/network',
      files: [
        { name: 'main.tf',      content: mainTfSource },
        { name: 'variables.tf', content: variablesTfSource },
        { name: 'outputs.tf',   content: outputsTfSource },
      ],
    },
  ],
});

<D3Terraform
  data={data}
  onNodeClick={(node) => console.log(node.data)}  // TfItem(content 含む)
/>

ファイルシステムの走査(.tf 収集)は Node 専用のためパッケージには含めていません。 利用側でディレクトリを走査して { name, content } を集め、buildTerraformDirectory に渡してください。

コマンド

npm run build     -w @yanqirenshi/d3.terraform   # tsc で dist/ へビルド(d.ts 含む)
npm run typecheck -w @yanqirenshi/d3.terraform
npm test          -w @yanqirenshi/d3.terraform   # vitest(パーサ + レイアウト)

既知の制限(原典からの継承)

  • パーサは正規表現ベースの簡易実装です。locals ブロックは入れ子の波括弧 (locals { tags = { ... } } など)に対応していません。