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

@shabaraba/pinecone

v1.0.0

Published

PineScript bundler — inlines imported modules into a single file.

Readme

pinecone 🌲

PineScript bundler — inlines imported modules into a single file.

TradingView の PineScript はネイティブの import でローカルファイルを読み込めません。 pinecone は独自の // @import コメント構文を使って複数ファイルを1つに結合します。

How it works

// @import ./my_module as mod

pinecone build を実行すると、モジュールの内容が インライン展開 され、識別子に mod_ プレフィックスが付与されます。

| 変換前 | 変換後 | |---|---| | type KZ | type mod_KZ | | method plot(KZ _id, ...) | method mod_plot(mod_KZ _id, ...) | | mod.plot(...) (メインファイル) | mod_plot(...) |

Installation

git clone https://github.com/shabaraba/pinecone
cd pinecone
pnpm install && pnpm build
pnpm link --global

Usage

pinecone build <input> [-o <output>]   # インライン展開して出力
pinecone lint  <input>                 # ドライラン:リネーム内容と警告を表示
pinecone docs                          # LLM向け開発ガイドを表示

Import syntax

メインファイルに以下のコメントを書きます(PineScript 本体のパーサには無視されます)。

//@version=5
// @import ./path/to/module as mymod
indicator("My Script", overlay = true)
  • 拡張子は省略可能。 .pine.pinescript の順で自動検索します。
  • 拡張子を明示した場合(./module.pine)はそのまま使用します。

Example

killzones.pine (モジュール)

//@version=5
indicator("KZ Lib")

type KZ
    line lnT
    line lnB

method plot(KZ _id, bool _active, float _h, float _l, int _t, color _c) =>
    if _active and not _active[1]
        _id.lnT := line.new(_t, _h, _t, _h, xloc.bar_time, color = _c)
        _id.lnB := line.new(_t, _l, _t, _l, xloc.bar_time, color = _c)

main.pine (メイン)

//@version=5
// @import ./killzones as kz
indicator("My Strategy", overlay = true)

kz.plot(...)

ビルド実行

pinecone build main.pine -o output.pine

output.pine (出力)

//@version=5
indicator("My Strategy", overlay = true)

// --- inlined from ./killzones.pine ---
type kz_KZ
    line lnT
    line lnB

method kz_plot(kz_KZ _id, bool _active, float _h, float _l, int _t, color _c) =>
    ...
// --- end inline ---

kz_plot(...)

Project Structure

src/
├── types.ts      # 共有型定義
├── parser.ts     # import 解析・識別子収集
├── renamer.ts    # リネームマップ構築・適用
├── inliner.ts    # インライン展開ブロック生成
├── resolver.ts   # モジュールパス解決(拡張子自動検索)
├── builder.ts    # ビルドオーケストレーター
├── linter.ts     # ビルド可否チェック・リネームプレビュー
└── cli.ts        # CLI エントリポイント

License

MIT