@codemod/utils

中文文档
1.1.0发布于 2023/02/19Apache-2.0TypeScriptCommonJS近 30 天下载 7.8万

codemod rewrites JavaScript and TypeScript

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. Contributing
  4. License

@codemod/utils

This package contains utilities for writing codemods. Mostly it exists to enable codemods to avoid depending on @babel/types, @babel/core, and others as well as @codemod/cli. It's easy to depend on incompatible versions of these packages, so this package wraps them and exports a single version of each.

Install

Install from npm:

$ npm install @codemod/core

Usage

You can use this library directly, but typically it's provided by @codemod/cli when defining a codemod with defineCodemod. Here's an example of using it directly:

// `m` is `@codemod/matchers`, a library of useful matchers
// `t` is `@babel/types`, babel AST type predicates and builders
import { t, m } from '@codemod/utils'

Contributing

See CONTRIBUTING.md for information on setting up the project for development and on contributing to the project.

License

Copyright 2023 Brian Donovan

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

版本与发布记录

@codemod/utils 共发布 2 个版本,首次发布于 2023/02/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2023/02/193 年前
1.0.02023/02/183 年前

关于 @codemod/utils 的常见问题

@codemod/utils 是什么?

codemod rewrites JavaScript and TypeScript

如何安装 @codemod/utils?

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

@codemod/utils 支持 TypeScript 吗?

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

@codemod/utils 支持 ESM 还是 CommonJS?

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

@codemod/utils 可以商用吗?

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

@codemod/utils 的下载量有多少?

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

@codemod/utils 还在维护吗?

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