@gulp-sourcemaps/map-sources

中文文档
1.0.0发布于 2017/03/24MITCommonJS近 30 天下载 206.3万

Gulp plugin for mapping sources of a sourcemap.

原始使用文档
文档目录4 节
  1. Example
  2. API
  3. mapSources(mapFn)
  4. License

@gulp-sourcemaps/map-sources

NPM version Downloads Build Status AppVeyor Build Status Coveralls Status

Gulp plugin for mapping sources of a sourcemap.

Example

var mapSources = require('@gulp-sourcemaps/map-sources');

gulp.src(...)
  .pipe(sourcemaps.init())
  .pipe(mapSources(function(sourcePath, file) {
    return '../' + sourcePath;
  }))
  .pipe(sourcemaps.write())
  .pipe(gulp.dest(...))

API

mapSources(mapFn)

Takes a map function as the only argument. Returns an objectMode Transform stream.

mapFn(sourcePath, file)

The map function is called once per value of the sources array of a sourceMap attached to each Vinyl object passed through the stream. The map function is called with the sourcePath string from the sources array and the file object it originated from. The return value replaces the original value in the array.

If a Vinyl object doesn't have a sourceMap or sourceMap.sources property, the file is passed through the stream without having the mapFn called.

All sources are normalized to use / instead of \\ as path separators.

License

MIT

版本与发布记录

@gulp-sourcemaps/map-sources 共发布 1 个版本,首次发布于 2017/03/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0latest2017/03/249 年前

关于 @gulp-sourcemaps/map-sources 的常见问题

@gulp-sourcemaps/map-sources 是什么?

Gulp plugin for mapping sources of a sourcemap.

如何安装 @gulp-sourcemaps/map-sources?

在项目目录运行 npm install @gulp-sourcemaps/map-sources,或使用 pnpm add / yarn add / bun add。

@gulp-sourcemaps/map-sources 支持 TypeScript 吗?

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

@gulp-sourcemaps/map-sources 支持 ESM 还是 CommonJS?

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

@gulp-sourcemaps/map-sources 需要什么版本的 Node.js?

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

@gulp-sourcemaps/map-sources 可以商用吗?

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

@gulp-sourcemaps/map-sources 的下载量有多少?

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

@gulp-sourcemaps/map-sources 还在维护吗?

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