@bazel/worker

中文文档
5.8.1发布于 2023/02/17Apache-2.0近 30 天下载 12.9万

Adapt Node programs to run as a Bazel worker

原始使用文档

Bazel Worker support

Bazel workers allow actions to be executed by a program that stays running.

Learn more about Bazel workers from Mike Morearty's medium article

Typical usage

Read index.d.ts for the worker API. Essentially you call runWorkerLoop passing it a function to call back when each build request arrives.

See the worker example for a full example with comments.

Restrictions on programs that run as a worker

Accept arguments as a params file

stdin and stdout of the process are reserved for the worker protocol with Bazel. That means anything that does a console.log can cause an error. Bazel prints a snippet of whatever was printed to stdout to help you track it down. Writing to stderr is fine, for example with console.error. In the future, we might improve this worker library to patch out the nodejs console.log function so that it doesn't interfere with the worker protocol.

版本与发布记录

@bazel/worker 共发布 107 个版本,首次发布于 2019/08/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.8.1latest2023/02/173 年前
5.7.32022/12/093 年前
5.7.22022/11/273 年前
5.7.12022/10/274 年前
5.7.02022/10/074 年前
5.6.02022/09/274 年前

其他发布通道:next → 5.0.0-rc.2,lts → 2.3.3。

关于 @bazel/worker 的常见问题

@bazel/worker 是什么?

Adapt Node programs to run as a Bazel worker

如何安装 @bazel/worker?

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

@bazel/worker 支持 TypeScript 吗?

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

@bazel/worker 可以商用吗?

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

@bazel/worker 的下载量有多少?

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

@bazel/worker 还在维护吗?

最新版本 5.8.1 发布于 2023/02/17(3 年前);至今共发布 107 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/08/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。