@gitlab/noop

中文文档
1.0.1发布于 2025/01/16MITCommonJS零依赖近 30 天下载 41.5万

This is a noop dependency to be able to prune parts of a dependency graph.

原始使用文档
文档目录6 节
  1. Usage
  2. npm@v10
  3. yarn@v1
  4. yarn@v4
  5. pnpm@v9
  6. bun@v1

@gitlab/noop

The idea behind this package is to be able to prune subtrees of dependencies which you might not need.

Reasons for why you might want to do this:

  1. Some dependencies (e.g. treesitter) ship a node/server and a browser component. You might not be interested in the server component, so you could prune the node/server subtree of dependencies.
  2. A particular part of dependencies might not be problematic and leading to oddities. One particular example is the glob package which ships a CLI interface which has some ESM-dependencies. One can reduce the dependency graph by quite a bit

Usage

The different package managers have different resolution features.

npm@v10

overrides is the native npm feature to override the version of a package. You can target sub-dependencies:

Example:

{
  "overrides": {
    "glob": {
      "jackspeak": "npm:@gitlab/[email protected]"
    }
  }
}

yarn@v1

Use Selective dependency resolutions and add a resolutions field to the package.json. The resoltions field allows pretty accurate sub-selection of dependencies.

Example:

{
  "resolutions": {
    "glob/jackspeak": "npm:@gitlab/[email protected]"
  }
}

yarn@v4

You can set the resolution manually with e.g.

yarn set resolution 'jackspeak@npm:^2.3.5' 'npm:@gitlab/[email protected]'

which will only update yarn.lock. Alternatively, you can update the package.json as well, which is a little more verbose:

Example:

{
  "resolutions": {
    "jackspeak@npm:^2.3.5": "npm:@gitlab/[email protected]"
  }
}

pnpm@v9

pnpm.overrides is the canonical way to define a resolution for pnpm:

NOTE: With [email protected], you don't need this package. You can simply use - as an override!

For older versions you can use this example:

{
  "pnpm": {
    "overrides": {
      "glob>jackspeak": "npm:@gitlab/[email protected]"
    }
  }
}

bun@v1

Bun supports both npm style overrides and yarn@1 style resolutions.

Example:

{
  "resolutions": {
    "jackspeak": "npm:@gitlab/[email protected]"
  }
}

版本与发布记录

@gitlab/noop 共发布 3 个版本,首次发布于 2024/11/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2025/01/161.8 年前
1.0.02024/11/132 年前
0.1.02024/11/132 年前

关于 @gitlab/noop 的常见问题

@gitlab/noop 是什么?

This is a noop dependency to be able to prune parts of a dependency graph.

如何安装 @gitlab/noop?

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

@gitlab/noop 支持 TypeScript 吗?

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

@gitlab/noop 支持 ESM 还是 CommonJS?

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

@gitlab/noop 可以商用吗?

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

@gitlab/noop 的下载量有多少?

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

@gitlab/noop 还在维护吗?

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