@bref.sh/layers

中文文档
3.0.12发布于 2026/10/26MITCommonJS零依赖构建来源已验证近 30 天下载 8475

Bref.sh AWS Lambda layers

原始使用文档
文档目录3 节
  1. Installation
  2. Version compatibility with Bref
  3. Usage

NPM package to use Bref runtimes on AWS Lambda.

This package is useful is you need to reference the Bref layers from a NodeJS application. For example if you use the AWS CDK, Pulumi, etc.

Note

If you are using the AWS CDK, you might be interested in the @bref.sh/constructs package instead.

Installation

npm install @bref.sh/layers

Version compatibility with Bref

This package is compatible with Bref 3.0 and above.

This NPM package and Bref are compatible as long as they have the same major version. For example:

  • v2.x.y of this package is compatible with v2.z.w of Bref
  • v3.x.y of this package is NOT compatible with v2.z.w of Bref
  • v2.x.y of this package is NOT compatible with v3.z.w of Bref
  • etc.

All minor and patch versions are not important. Only the major version matters. That means you can upgrade Bref separately from upgrading this package (though it's always good to stay on the latest versions).

Usage

Get a layer version:

import { layerVersions } from '@bref.sh/layers';

console.log(layerVersions['php-84']['us-east-1']);
console.log(layerVersions['arm-php-84']['eu-west-3']);

Helpers to get a full ARN:

import { layerArn } from '@bref.sh/layers';

console.log(layerArn(region, '8.4'));
console.log(layerArn(region, '8.4', 'arm'));

版本与发布记录

@bref.sh/layers 共发布 133 个版本,首次发布于 2022/10/21;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.12latest2026/10/2613 天前
3.0.112026/10/2118 天前
3.0.102026/09/261 个月前
3.0.92026/09/211 个月前
3.0.82026/07/313 个月前
3.0.72026/07/044 个月前

关于 @bref.sh/layers 的常见问题

@bref.sh/layers 是什么?

Bref.sh AWS Lambda layers

如何安装 @bref.sh/layers?

在项目目录运行 npm install @bref.sh/layers,或使用 pnpm add / yarn add / bun add。

@bref.sh/layers 支持 TypeScript 吗?

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

@bref.sh/layers 支持 ESM 还是 CommonJS?

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

@bref.sh/layers 需要什么版本的 Node.js?

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

@bref.sh/layers 可以商用吗?

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

@bref.sh/layers 的下载量有多少?

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

@bref.sh/layers 还在维护吗?

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