@agoric/make-hardener

中文文档
0.1.3发布于 2021/03/02Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 1.3万

Create a 'hardener' which freezes the API surface of a set of objects

此软件包已被标记为弃用

The `ses` package provides `harden` after `lockdown`. Do not use `@agoric/make-hardener` directly.

原始使用文档
文档目录3 节
  1. How to use
  2. Why do we need to "harden" objects?
  3. Creating a custom harden() Function

MakeHardener

Build Status dependency status dev dependency status License

Build a defensible API surface around an object by freezing all reachable properties.

How to use

Note: If you're writing an application, you probably don't want to use this package directly. You'll want to use the harden() function provided in SES to perform an all-encompassing "deep freeze" on your objects. Alternatively, if you want to test your code before using it in SES, you can import the @agoric/harden package. Note that without SES, harden() is insecure, and should be used for testing purposes only.

Why do we need to "harden" objects?

Please see the harden() package for more documentation.

Creating a custom harden() Function

This package (@agoric/make-hardener) provides a makeHardener() which can be used to build your own harden() function. When you call makeHardener(), you give it an iterable of stopping points (the "fringe"), and the recursive property walk will stop its search when it runs into the fringe. The resulting harden() will throw an exception if anything it freezes has a prototype that is not already in the fringe, or was frozen during the same call (and thus added to the fringe).

版本与发布记录

@agoric/make-hardener 共发布 13 个版本,首次发布于 2019/02/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.3latest2021/03/025 年前
0.1.22021/01/225 年前
0.1.12020/08/096 年前
0.1.02020/07/146 年前
0.0.92020/04/156 年前
0.0.82020/03/186 年前

关于 @agoric/make-hardener 的常见问题

@agoric/make-hardener 是什么?

Create a 'hardener' which freezes the API surface of a set of objects注意:该包已被作者标记为弃用——The `ses` package provides `harden` after `lockdown`. Do not use `@agoric/make-hardener` directly.

如何安装 @agoric/make-hardener?

在项目目录运行 npm install @agoric/make-hardener,或使用 pnpm add / yarn add / bun add。

@agoric/make-hardener 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agoric/make-hardener 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@agoric/make-hardener 可以商用吗?

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

@agoric/make-hardener 的下载量有多少?

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

@agoric/make-hardener 还在维护吗?

最新版本 0.1.3 发布于 2021/03/02(5 年前);至今共发布 13 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/02/15。作者已将其标记为弃用,新项目建议寻找替代方案。