Show HN: PineCone – PineScript 分割打包工具

2作者: claudianadalin6 个月前
我为 PineScript(TradingView 的脚本语言)构建了一个模块打包器。 问题:TradingView 不支持多文件项目。当指标变得复杂时,你最终会得到 1000 多行的文件,这很难维护。 Pinecone 允许你使用 import/export 指令将代码拆分到多个 .pine 文件中,然后将所有内容打包成一个与 TradingView 兼容的脚本。 它处理自动命名空间,以防止模块之间的变量冲突,对外部库导入进行去重,并包含用于开发的 watch 模式。 使用 Python 构建。使用 pynescript 库进行 AST 解析和操作。我不得不通过通用类型语法来解决一些上游解析器错误,这是一个有趣的挑战。 GitHub: <a href="https://github.com/claudianadalin/pinecone" rel="nofollow">https://github.com/claudianadalin/pinecone</a> 包含更多技术细节的博文:<a href="https://www.claudianadalin.com/blog/building-pinecone" rel="nofollow">https://www.claudianadalin.com/blog/building-pinecone</a> 这是一个小众工具,但如果你曾经构建过复杂的 TradingView 指标,你就会知道这种痛苦。 欢迎对这种方法提出反馈意见。
查看原文
I built a module bundler for PineScript (TradingView&#x27;s scripting language).<p>The problem: TradingView doesn&#x27;t support multi-file projects. As indicators grow complex, you end up with 1000+ line files that are painful to maintain.<p>Pinecone lets you split code across multiple .pine files using import&#x2F;export directives, then bundles everything into a single TradingView-compatible script.<p>It handles automatic namespacing to prevent variable collisions between modules, deduplicates external library imports, and includes watch mode for development.<p>Built with Python. Uses the pynescript library for AST parsing and manipulation. I had to work around some upstream parser bugs with generic type syntax, which was an interesting challenge.<p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;claudianadalin&#x2F;pinecone" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;claudianadalin&#x2F;pinecone</a><p>Blog post with more technical details: <a href="https:&#x2F;&#x2F;www.claudianadalin.com&#x2F;blog&#x2F;building-pinecone" rel="nofollow">https:&#x2F;&#x2F;www.claudianadalin.com&#x2F;blog&#x2F;building-pinecone</a><p>This is a niche tool, but if you&#x27;ve ever built complex TradingView indicators, you know the pain. Would love feedback on the approach.