@adobe/htlengine

中文文档
6.4.50发布于 2026/10/23Apache-2.0CommonJS构建来源已验证近 30 天下载 1.1万

Javascript Based HTL (Sightly) parser

原始使用文档
文档目录9 节
  1. Status
  2. Install
  3. Build
  4. run
  5. Webpack
  6. API
  7. examples
  8. test
  9. rebuild generated nearley grammar

HTL Engine for Javascript

This engine can parse HTL scripts and builds a command stream. The command stream can either be intepreted or used to generate code. This project provides a Javascript (ES6) generator and runtime which allows to execute the scripts and use-classes.

Status

codecov CircleCI GitHub license GitHub issues

LGTM Code Quality Grade: JavaScript

Install

npm install @adobe/htlengine

Build

npm install

run

currently not very cool. just passes the given file into the HTML parser and outputs the tree again.

node src/cli.js test/simple2.html

Webpack

Compile the HTL templates wth webpack using the htl-loader

API

You can also use the API directly:

const { Compiler } = require('@adobe/htlengine');

const compiler = new Compiler()
      .withDirectory('')
      .includeRuntime(true)
      .withRuntimeGlobalName('it');

const js = await compiler.compileToString(code);
// the result can be saved as a file or eval'd

examples

test

The tests are more comprehensive. They validate if the the HTL expressions are parsed and re-created using the generated parse tree.

npm test

rebuild generated nearley grammar

npm run build

版本与发布记录

@adobe/htlengine 共发布 234 个版本,首次发布于 2018/06/08;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.4.50latest2026/10/2315 天前
6.4.492026/10/1919 天前
6.4.482026/10/021 个月前
6.4.472026/10/011 个月前
6.4.462026/08/132 个月前
6.4.452026/08/092 个月前

其他发布通道:next → 2.1.2-pre.2。

关于 @adobe/htlengine 的常见问题

@adobe/htlengine 是什么?

Javascript Based HTL (Sightly) parser

如何安装 @adobe/htlengine?

在项目目录运行 npm install @adobe/htlengine,或使用 pnpm add / yarn add / bun add。

@adobe/htlengine 支持 TypeScript 吗?

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

@adobe/htlengine 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/htlengine 需要什么版本的 Node.js?

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

@adobe/htlengine 可以商用吗?

@adobe/htlengine 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/htlengine 的下载量有多少?

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

@adobe/htlengine 还在维护吗?

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