@ahrefs/bs-atdgen-codec-runtime

中文文档
2.2.0发布于 2021/12/03MITCommonJS近 30 天下载 3259

atdgen 的标定运行时间

中文使用文档
文档目录4 节
  1. 安装
  2. 使用量
  3. 简单示例
  4. 完整实例

bs-atdgen-codec-runtime 时间

bs-atdgen-codec-runtime 是一个带扣的运行时间 选项。它基于 json 类型 由下列文件提供: @glennsl/bs-json (英语)。 。 。 .

安装

yarn add @ahrefs/bs-atdgen-codec-runtime

此软件包不考虑运行调试器以获取代码 类型定义。 这个步骤要求 atdgen 可以是二进制 使用 缩写 或者说 爱思。 。 。 .

或者,如果您的项目只使用 BuckleScript(即在后端不使用本地的OCaml 或理由), 您可以考虑使用 bs-atdgen-generator 结合 这个运行时库,以生成 .ml 财务报告和审定财务报表 .mli 来自 .atd 来源,无需使用本地 软件包管理器喜欢 esy 或者说 opam。 。 。 .

使用量

添加 @ahrefs/bs-atdgen-codec-runtime 页:1 bs-dependencies 联 合 国 bsconfig.json。 。 。 .

要写入已填表类型定义, 请查看 不错 文档。 。 。 .

简单示例

查询和解析 REST API 答复的理由代码。 这个 需求 bs-fetch。 。 。 .

let get = (url, decode) =>
  Js.Promise.(
    Fetch.fetchWithInit(
      url,
      Fetch.RequestInit.make(~method_=Get, ()),
    )
    |> then_(Fetch.Response.json)
    |> then_(json => json |> decode |> resolve)
  );

let v: Meetup_t.events =
  get(
    "http://localhost:8000/events",
    Atdgen_codec_runtime.Decode.decode(Meetup_bs.read_events),
  );

完整实例

这个 实例 目录包含一个简单的完整示例 cli 读取和写入 JSON 文件的数据 .

从Atdgen安装到json的完整介绍 请参考 开始使用 attgen 和 扣上安全带。 。 。 .

版本与发布记录

@ahrefs/bs-atdgen-codec-runtime 共发布 18 个版本,首次发布于 2018/08/28;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.2.0latest2021/12/034 年前
2.0.12020/05/016 年前
2.0.02019/11/047 年前
1.4.42019/10/177 年前
1.4.32019/09/247 年前
1.4.22019/09/167 年前

关于 @ahrefs/bs-atdgen-codec-runtime 的常见问题

@ahrefs/bs-atdgen-codec-runtime 是什么?

atdgen 的标定运行时间

如何安装 @ahrefs/bs-atdgen-codec-runtime?

在项目目录运行 npm install @ahrefs/bs-atdgen-codec-runtime,或使用 pnpm add / yarn add / bun add。

@ahrefs/bs-atdgen-codec-runtime 支持 TypeScript 吗?

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

@ahrefs/bs-atdgen-codec-runtime 支持 ESM 还是 CommonJS?

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

@ahrefs/bs-atdgen-codec-runtime 可以商用吗?

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

@ahrefs/bs-atdgen-codec-runtime 的下载量有多少?

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

@ahrefs/bs-atdgen-codec-runtime 还在维护吗?

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