@autorest/extension-base

中文文档
3.6.1发布于 2025/05/21MITTypeScriptCommonJS近 30 天下载 5万

Library for creating AutoRest extensions

原始使用文档

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

AutoRest Extension Base

Allows to easily create an AutoRest extension. See https://github.com/azure/autorest-extension-helloworld for an example of how to reference and use this package. We recommend using that as a starting point.

Usage

import { AutoRestExtension } from "@autorest/extension-base";

const extension = new AutoRestExtension();

extension.Add("plugin-name", async autoRestApi => {
  // plugin implementation
  // Available functions:
  // * Information retrieval:
  //       autoRestApi.ListInputs
  //       autoRestApi.ReadFile
  //       autoRestApi.GetValue
  // * Information submission:
  //       autoRestApi.WriteFile
  //       autoRestApi.Message
});

extension.Run();

版本与发布记录

@autorest/extension-base 共发布 26 个版本,首次发布于 2021/01/30;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.6.1latest2025/05/211.5 年前
3.6.1-dev.1next2025/05/201.5 年前
3.6.02023/11/172 年前
3.6.0-dev.12023/11/162 年前
3.5.22023/05/263 年前
3.5.2-dev.12023/05/023 年前

关于 @autorest/extension-base 的常见问题

@autorest/extension-base 是什么?

Library for creating AutoRest extensions

如何安装 @autorest/extension-base?

在项目目录运行 npm install @autorest/extension-base,或使用 pnpm add / yarn add / bun add。

@autorest/extension-base 支持 TypeScript 吗?

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

@autorest/extension-base 支持 ESM 还是 CommonJS?

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

@autorest/extension-base 需要什么版本的 Node.js?

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

@autorest/extension-base 可以商用吗?

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

@autorest/extension-base 的下载量有多少?

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

@autorest/extension-base 还在维护吗?

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