@adobe/reactor-validator

中文文档
3.1.0发布于 2026/08/20Apache-2.0CommonJS近 30 天下载 3520

Validates a Tags extension package.

原始使用文档
文档目录6 节
  1. Usage
  2. Running the Validator from the Command Line
  3. Incorporating the Validator into Other Tools
  4. Using the validator in a browser or bundled app
  5. Contributing
  6. Licensing

Adobe Experience Platform Tags Extension Validator

npm (scoped)

Adobe Experience Platform Tags is a next-generation tag management solution enabling simplified deployment of marketing technologies. For more information regarding Tags, please visit our product website.

The extension validator helps extension developers validate that an extension package is well-structured. Namely, it verifies that:

  1. The extension has a manifest (extension.json) matching the expected structure.
  2. All referenced directories and files exist at the specified locations within the extension directory. The manifest's viewBasePath must point to an existing directory (not a file, and not a missing path); at least one file must exist under that path.

For more information about developing an extension for Tags, please visit our extension development guide.

Usage

This tool is currently integrated and automatically executed within other tools that extension developers typically use, namely the Extension Sandbox Tool and Extension Packager Tool. This is likely sufficient for most extension developers.

Running the Validator from the Command Line

Before running the validator, you must first have Node.js installed on your computer.

Once Node.js is installed, run the validator by executing the following command from the command line within your extension's directory:

npx @adobe/reactor-validator

Incorporating the Validator into Other Tools

If you would like to incorporate the validator into your own extension development tools, you may do so by first installing the validator as a dependency inside your tool's project:

npm i @adobe/reactor-validator

Once it has been installed as a dependency, import the validator and pass it an extension manifest object (this is the object exported from an extension.json file). If the value returned from the validator is undefined, then the extension appears to be well-formed; otherwise, the value will contain a description of the issue that was encountered.

Supported import paths: Only the documented entry points are supported. Deep imports (e.g. @adobe/reactor-validator/lib/validate) are not supported and will fail with ERR_PACKAGE_PATH_NOT_EXPORTED. Use one of these:

  • Node: require('@adobe/reactor-validator') — scans the filesystem and validates
  • Browser or bundled: import validate from '@adobe/reactor-validator/validate' — validates against a provided file list
const validate = require('@adobe/reactor-validator');
const error = validate(require('./extension.json'));

// Will be undefined if no error was found.
console.log(error);

Using the validator in a browser or bundled app

Browser (or other non-Node) consumers should use the @adobe/reactor-validator/validate subpath so they do not pull in Node-only code. The default export (@adobe/reactor-validator) scans the filesystem and is for Node only.

The validate function has the signature (extensionDescriptor, fileList):

  • extensionDescriptor: The parsed extension manifest (e.g. from extension.json).
  • fileList: An array of relative path strings for every file in the extension package (e.g. from a folder picker or zip). The caller is responsible for gathering this list; the validator only checks that required paths are present.
  • Returns: undefined if valid, or an error string on the first problem found.
import validate from '@adobe/reactor-validator/validate';

const error = validate(manifestJson, Array.from(filesMap.keys()));
if (error) {
  console.error(error);
}

Webpack alias for ajv: The validate module depends on ajv-draft-04, which in turn requires ajv and resolves internal paths (e.g. ajv/dist/core). If your app does not list ajv as a direct dependency, add a resolve alias so the bundler uses the validator's ajv:

  • Resolve via an exported path (e.g. @adobe/reactor-validator/validate), not package.json, to avoid ERR_PACKAGE_PATH_NOT_EXPORTED.
  • Alias to the package directory of ajv, not to ajv.js, so subpaths resolve and Watchpack ENOTDIR errors are avoided.

In your webpack config:

const path = require('path');

// Inside module.exports or your config object:
resolve: {
  alias: {
    'ajv': path.join(
      path.dirname(path.dirname(require.resolve('@adobe/reactor-validator/validate'))),
      'node_modules',
      'ajv'
    )
  }
}

Alternatively, add ajv as a direct dependency in your project with the current version used here so the alias is unnecessary. However, this is very brittle. This project reserves the right to use a different version of ajv at any time.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

To get started:

  1. Install node.js.
  2. Clone the repository.
  3. After navigating into the project directory, install project dependencies by running npm install.

To manually test your changes, first run the following command from the sandbox tool directory:

npm link

Then, in a directory containing an extension (any extension you would like to use for testing), run the following command:

npx @adobe/reactor-validator

Npx will execute the sandbox tool using your locally linked code rather than the code published on the public npm repository.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

版本与发布记录

@adobe/reactor-validator 共发布 40 个版本,首次发布于 2017/02/18;过去 12 个月发布了 8 个版本。

版本发布日期距今
3.1.0latest2026/08/202 个月前
3.1.0-beta.1next2026/06/124 个月前
3.0.02026/03/207 个月前
3.0.0-beta.62026/03/197 个月前
3.0.0-beta.42026/03/068 个月前
3.0.0-beta.32026/03/068 个月前

关于 @adobe/reactor-validator 的常见问题

@adobe/reactor-validator 是什么?

Validates a Tags extension package.

如何安装 @adobe/reactor-validator?

在项目目录运行 npm install @adobe/reactor-validator,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 reactor-validator,可以用 npx reactor-validator 直接运行。

@adobe/reactor-validator 支持 TypeScript 吗?

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

@adobe/reactor-validator 支持 ESM 还是 CommonJS?

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

@adobe/reactor-validator 需要什么版本的 Node.js?

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

@adobe/reactor-validator 可以商用吗?

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

@adobe/reactor-validator 的下载量有多少?

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

@adobe/reactor-validator 还在维护吗?

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