如何从扩展中获取当前 chrome 选项卡的 AST?

How to get the AST of the current chrome tab from an extension?

我正在尝试做一些 angular 代码分析。这样我就需要得到网页中所有已声明模块的列表。

我找不到如何使用 angular API(I believe that's not possible) but I stumbled on this. Using the AST to get modules looks interesting and promising. I could use Acorn or Esprima 但我想知道 chrome 是否有 API当前选项卡的 AST。(可以使用 firefox)

编辑:

这是来自维基百科的示例:

不,Chrome 的 V8 不公开任何内部结构作为 Extension APIs, or, for that reason, remote debugger protocol 的一部分。

你在 Dev Tools 中看到的是关于暴露的限制。

您需要自己重新解析它或使用公开您需要的信息的修改版 Chromium。