@appthreat/atom-parsetools

中文文档
1.10.6发布于 2026/10/30MITES Module构建来源已验证近 30 天下载 120万

解析工具, 补充 @ appreason/ atom 项目 .

中文使用文档
文档目录9 节
  1. 文档
  2. 运行时间支持
  3. 命令用途
  4. 晶体
  5. ph基
  6. rbastgen (俄语)
  7. 缩略语
  8. 测试
  9. 许可证

原子分隔工具

此软件包主机为辅助 @appthreat/atom 项目。 这些工具提供解析和分析相关功能,例如以JSON格式生成AST和语义信息. 此套件所暴露的工具和bin命令的完整列表如下:

  • astgen - 用 JSON 格式生成 JavaScript 、 TypeScript 、 Vue 和 Svelte 项目的 AST
  • phpastgen - 使用 PHP 项目生成 AST php-parse 命令从 nikic/php-parser
  • rbastgen - 用 Apphreat 生成 Ruby 项目的 AST ruby_ast_gen 宝石(2.0.1)
  • scalasem - 从编译器自己的输出中产生出一个 Scala 语义报告:定义,调用站点和有文件和行的引用,加上从它们得到的加密,端点,服务和调用堆栈证据.

文档

完整的文献资料生活在 https://appreatub.github.io/atom-parsetools/ 互联网档案馆的存檔,存档日期2014-12-21:每个工具的向导,输出格式规格,环境可变参考,包装笔记,以及十个亲身辅导. 这些页面来自: docs 此仓库的目录 .

运行时间支持

这些工具都运行在 节点.js ( @babel/parser (单位:千美元) 阿宝。所有命令和相伴随的回归测试套件都在 CI 的运行时间中执行,因此以下命令可以与其中任一命令一起引用 node 或者说 bun 互换(例如 bun astgen.js -i .) (中文(简体) ).

命令用途

晶体

node astgen.js -h
Options:
  -i, --src      Source directory                                 [default: "."]
  -o, --output   Output directory for generated AST JSON files
                                                            [default: "ast_out"]
  -t, --type     Project type. Default auto-detect
  -r, --recurse  Recurse mode suitable for mono-repos  [boolean] [default: true]
      --tsTypes  Generate type mappings using the TypeScript Compiler API
                                                       [boolean] [default: true]
      --version  Show version number                                   [boolean]
  -h             Show help                                             [boolean]

每个源文件成为 AST JSON 文件外加 a .typemap 由节点抵消的推断类型。 测试文件和 node_modules 默认排除 向导 覆盖每个选项和嵌入变量( e)ASTGEN_TYPE_WORKERS, (中文(简体) ), ASTGEN_INCLUDE_TEST_FILES,还有朋友).

.vue 财务报告和审定财务报表 .svelte 单文件组件被平整成与其他文件相同的 Babel 形状: 脚本语句在顶端 Program,模板则作为标准JSX节点. Svelte 组件与 svelte/compiler 而每个偏移都是一个绝对字节位置 进入组件源, 所以消费者切除原始文件 code 字段获取正文。 其JSX对应的控制流图—— {#if} 改为 ConditionalExpression, (中文(简体) ), {#each} 改为 .map() 结出一箭来, {#await} 改为 .then() - 这意味着没有排放特定框架的节点类型。 见 向导 完整地图和已接受损失清单.

ph基

node phpastgen.js --help

Usage: phpastgen [options] [-- <legacy php-parse args>]

Options:
  -i, --input <path>          input file or directory (batch mode)
  -o, --output <dir>          output directory (default: '.ast')
  -e, --exclude <regex>       exclusion regex (default: '^(tests?|vendor|Tests?)')
  -l, --log <level>           debug | info | warn | error (default: info)
  -d, --debug                 same as --log debug
      --target-version <x.y>  pin PHP grammar (alias: --parser-target)
      --max-depth <n>         depth cap before truncation (default: 250)
      --threads <n>           worker processes for directory runs (default: 10)
      --files-per-process <n> files one PHP interpreter parses in a directory run (max 100; default: sized to the tree, 1 = one php-parse per file)
      --include-vendor        also parse vendor/ and node_modules/ (skipped by default)
      --fail-on-error         exit non-zero if any file failed
      --parser-info           print parser/runtime capability report and exit 0
      --version               print generator version and exit 0
      --help                  print usage

PHP parser(Nikic/php-parser 5.8.0,语法8.0至8.5)的销售商 plugins/,因此只需要在机器上使用 PHP 运行时间。 批量运行每个文件写一个 JSON + phpastgen_manifest.jsonl 和,失败, phpastgen_diagnostics.jsonl详细情况 phpastgen 引导。 。 。 .

rbastgen (俄语)

要求 Ruby 3.4.x 或 4.0.x 上 PATH,或 ATOM_RUBY_HOME 指向一个安装。 宝石及其纯鲁比的依赖被捆绑在下面 plugins/rubyastgen,所以不需要安装宝石,这个包的一个构件运行在每一个支持的Ruby下面: 捆绑被打开给解释器通过 GEM_PATH 而不是通过捆绑者的独立装载器, 它解决了它的路径 从建造它的Ruby的ABI.

node rbastgen.js --help
Usage:
  -i, --input <path>       The input file or directory (required)
  -o, --output <dir>       The output directory (default: '.ast')
  -e, --exclude <regex>    The exclusion regex (default: '^(tests?|vendor|spec)')
  -l, --log <level>        The logging level: debug, info, warn or error (default: info)
  -d, --debug              Enable debug logging (same as --log debug)
      --parser-target <x.y>
                           Parse with a specific Ruby grammar (e.g. 3.4, 4.0) instead
                           of the newest available
      --max-depth <n>      Maximum AST depth before truncation (default: 250)
      --threads <n>        Worker threads for a directory run (default: 10)
      --fail-on-error      Exit non-zero when any input file failed to parse
      --parser-info        Print parser/runtime capability information
      --version            Print the version
      --help               Print usage

个别文件的问题被报告和跳过,永远不会致命;只有使用错误(缺失) -i,无法使用 --exclude regex,无效 --parser-target)退出非为零. 请注意: rbastgen 不宣传生成器的退出状态,所以 --fail-on-error 在日志中报告,但包装仍然退出 0; 如果一个 CI 任务在解析出错时需要失败, 请直接拨打宝石 。 发现覆盖了Ruby DSL文件(Gemfile, (中文(简体) ), Rakefile, (中文(简体) ), .gemspec, (中文(简体) ), .rake和更多),每个运行写 ruby_ast_gen_manifest.jsonl 和,失败, ruby_ast_gen_diagnostics.jsonl详细情况 rbastgen 向导。 。 。 .

缩略语

scalasem <directory> <slices_file>

示例

scalasem $(pwd) slices.json

发现构建(sbt, mill, maven, scala-cli, 或前作所剩的输出),通过编写它和Scala 2 SemanticDB的编译器来读取Scala 3 TASTy,并报告定义,调用站点和引用文件与行,加上Play路径,端点配置值和所衍生的密码,端点,服务和调用堆栈证据. --no-build 分析而不启动构建工具。 这个 缩略图向导 包括管道和报告计划.

测试

npm test 覆盖了JavaScript/TypeScript的一面,只需要节点. Ruby和PHP工作流程需要运行时间和已建插件捆绑

bash build.sh --ruby-only
npm run test:ruby

ci/verify-packed-tarball.sh 即放出检查:它将柏油球打包,安装到刮取工程中,并用已安装的拷贝来解析固定图,沿途断言鲁比捆绑存在,没有编译的扩展. CI运行它, 它运行的方式一样的地方.

他们断言消费者所依赖的不是命令,而是命令:发现哪些文件(包括: Gemfile 财务报告和审定财务报表 Rakefile,与基名相匹配),该 has_sig, (中文(简体) ), magic_comments, (中文(简体) ), percent_array 和正则说明 options , 清单的计数调节, 一个失败的文件在诊断记录中降落, 而运行仍然退出 0, 干净的运行没有留下任何 stale 记录, 捆绑没有编译扩展 。 CI在Ruby 3.4和Ruby 4.0下运行它们,对着一个用3.4制成的捆绑,并单独安装被包装的柏油球并用它来分解,这是只捕捉能用在所建造的Ruby上捆绑的支票. 这个 测试指南 地图的套房.

许可证

麻省理工学院

版本与发布记录

@appthreat/atom-parsetools 共发布 38 个版本,首次发布于 2025/05/13;过去 12 个月发布了 26 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.10.6latest2026/10/307 天前
1.10.52026/10/288 天前
1.10.32026/10/2314 天前
1.10.22026/10/1224 天前
1.10.12026/10/1225 天前
1.10.02026/10/0829 天前

关于 @appthreat/atom-parsetools 的常见问题

@appthreat/atom-parsetools 是什么?

解析工具, 补充 @ appreason/ atom 项目 .

如何安装 @appthreat/atom-parsetools?

在项目目录运行 npm install @appthreat/atom-parsetools,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 astgen、rbastgen、scalasem、phpastgen,可以用 npx astgen 直接运行。

@appthreat/atom-parsetools 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/appthreat__atom-parsetools 是否存在。

@appthreat/atom-parsetools 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@appthreat/atom-parsetools 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@appthreat/atom-parsetools 可以商用吗?

@appthreat/atom-parsetools 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@appthreat/atom-parsetools 的下载量有多少?

根据 npm 官方下载统计,@appthreat/atom-parsetools 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,200,290 次,日均约 40,010 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appthreat/atom-parsetools 还在维护吗?

最新版本 1.10.6 发布于 2026/10/30(7 天前);至今共发布 38 个版本,其中过去 12 个月发布了 26 个;首次发布于 2025/05/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。