@dependents/detective-less

中文文档
6.0.1发布于 2026/05/26MITES Module近 30 天下载 2018.7万

Find the dependencies of a less file

原始使用文档
文档目录5 节
  1. Usage
  2. ESM
  3. CommonJS
  4. Options
  5. License

@dependents/detective-less

CI npm version npm downloads

Find the dependencies of a less file

npm install @dependents/detective-less

Note: This is specific to the .less style syntax.

It's the LESS counterpart to detective, detective-amd, and detective-es6.

Usage

ESM

import fs from 'node:fs';
import detective from '@dependents/detective-less';

const content = fs.readFileSync('styles.less', 'utf8');

// list of imported file names (ex: 'foo.less', 'foo', etc)
const dependencies = detective(content);

// or to also detect any url() references to images, fonts, etc.
const allDependencies = detective(content, { url: true });

CommonJS

const { default: detective } = require('@dependents/detective-less');

Options

  • url (optional): (Boolean) also detect any url() references to images, fonts, etc.

License

MIT

版本与发布记录

@dependents/detective-less 共发布 11 个版本,首次发布于 2023/03/19;过去 12 个月发布了 4 个版本。

版本发布日期距今
6.0.1latest2026/05/265 个月前
6.0.02026/05/195 个月前
5.0.32026/04/266 个月前
5.0.22026/04/206 个月前
5.0.12025/02/011.8 年前
5.0.02024/04/142 年前

关于 @dependents/detective-less 的常见问题

@dependents/detective-less 是什么?

Find the dependencies of a less file

如何安装 @dependents/detective-less?

在项目目录运行 npm install @dependents/detective-less,或使用 pnpm add / yarn add / bun add。

@dependents/detective-less 支持 TypeScript 吗?

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

@dependents/detective-less 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dependents/detective-less 需要什么版本的 Node.js?

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

@dependents/detective-less 可以商用吗?

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

@dependents/detective-less 的下载量有多少?

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

@dependents/detective-less 还在维护吗?

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