motion
Version:
motion - moving development forward
82 lines (81 loc) • 10.7 kB
JSON
{
"_args": [
[
"gulp-sourcemaps@https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "gulp-sourcemaps@1.6.0",
"_id": "gulp-sourcemaps@1.6.0",
"_inCache": true,
"_location": "/gulp-sourcemaps",
"_phantomChildren": {},
"_requested": {
"name": "gulp-sourcemaps",
"raw": "gulp-sourcemaps@https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"rawSpec": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"type": "remote"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"_shasum": "b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c",
"_shrinkwrap": null,
"_spec": "gulp-sourcemaps@https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"email": "me@florianreiterer.com",
"name": "Florian Reiterer"
},
"bugs": {
"url": "https://github.com/floridoo/gulp-sourcemaps/issues"
},
"dependencies": {
"convert-source-map": "^1.1.1",
"graceful-fs": "^4.1.2",
"strip-bom": "^2.0.0",
"through2": "^2.0.0",
"vinyl": "^1.0.0"
},
"description": "Source map support for Gulp.js",
"devDependencies": {
"coveralls": "^2.11.4",
"faucet": "0.0.1",
"istanbul": "^0.3.21",
"jshint": "^2.8.0",
"tape": "^4.2.0"
},
"files": [
"LICENSE.md",
"README.md",
"index.js",
"package.json"
],
"homepage": "http://github.com/floridoo/gulp-sourcemaps",
"keywords": [
"gulp",
"gulpplugin",
"source maps",
"sourcemaps"
],
"license": "ISC",
"main": "index.js",
"name": "gulp-sourcemaps",
"optionalDependencies": {},
"readme": "## gulp-sourcemaps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url]\n\n### Usage\n\n#### Write inline source maps\nInline source maps are embedded in the source file.\n\nExample:\n```javascript\nvar gulp = require('gulp');\nvar plugin1 = require('gulp-plugin1');\nvar plugin2 = require('gulp-plugin2');\nvar sourcemaps = require('gulp-sourcemaps');\n\ngulp.task('javascript', function() {\n gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write())\n .pipe(gulp.dest('dist'));\n});\n```\n\nAll plugins between `sourcemaps.init()` and `sourcemaps.write()` need to have support for `gulp-sourcemaps`. You can find a list of such plugins in the [wiki](https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support).\n\n\n#### Write external source map files\n\nTo write external source map files, pass a path relative to the destination to `sourcemaps.write()`.\n\nExample:\n```javascript\nvar gulp = require('gulp');\nvar plugin1 = require('gulp-plugin1');\nvar plugin2 = require('gulp-plugin2');\nvar sourcemaps = require('gulp-sourcemaps');\n\ngulp.task('javascript', function() {\n gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write('../maps'))\n .pipe(gulp.dest('dist'));\n});\n```\n\n#### Load existing source maps\n\nTo load existing source maps, pass the option `loadMaps: true` to `sourcemaps.init()`.\n\nExample:\n```javascript\nvar gulp = require('gulp');\nvar plugin1 = require('gulp-plugin1');\nvar plugin2 = require('gulp-plugin2');\nvar sourcemaps = require('gulp-sourcemaps');\n\ngulp.task('javascript', function() {\n gulp.src('src/**/*.js')\n .pipe(sourcemaps.init({loadMaps: true}))\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write())\n .pipe(gulp.dest('dist'));\n});\n```\n\n#### Handle source files from different directories\n\nUse the `base` option on `gulp.src` to make sure all files are relative to a common base directory.\n\nExample:\n```javascript\nvar gulp = require('gulp');\nvar plugin1 = require('gulp-plugin1');\nvar plugin2 = require('gulp-plugin2');\nvar sourcemaps = require('gulp-sourcemaps');\n\ngulp.task('javascript', function() {\ngulp.src(['src/test.js', 'src/testdir/test2.js'], { base: 'src' })\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write('../maps'))\n .pipe(gulp.dest('dist'));\n});\n```\n\n\n\n### Init Options\n\n- `loadMaps`\n Set to true to load existing maps for source files. Supports the following:\n - inline source maps\n - source map files referenced by a `sourceMappingURL=` comment\n - source map files with the same name (plus .map) in the same directory\n\n- `debug`\n Set this to `true` to output debug messages (e.g. about missing source content).\n\n### Write Options\n\n- `addComment`\n\n By default a comment containing / referencing the source map is added. Set this to `false` to disable the comment (e.g. if you want to load the source maps by header).\n\n Example:\n ```javascript\n gulp.task('javascript', function() {\n var stream = gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write('../maps', {addComment: false}))\n .pipe(gulp.dest('dist'));\n });\n ```\n\n- `includeContent`\n\n By default the source maps include the source code. Pass `false` to use the original files.\n\n Including the content is the recommended way, because it \"just works\". When setting this to `false` you have to host the source files and set the correct `sourceRoot`.\n\n- `sourceRoot`\n\n Set the path where the source files are hosted (use this when `includeContent` is set to `false`). This is an URL (or subpath) relative to the source map, not a local file system path. If you have sources in different subpaths, an absolute path (from the domain root) pointing to the source file root is recommended, or define it with a function.\n\n Example:\n ```javascript\n gulp.task('javascript', function() {\n var stream = gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write({includeContent: false, sourceRoot: '/src'}))\n .pipe(gulp.dest('dist'));\n });\n ```\n\n Example (using a function):\n ```javascript\n gulp.task('javascript', function() {\n var stream = gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write({\n includeContent: false,\n sourceRoot: function(file) {\n return '/src';\n }\n }))\n .pipe(gulp.dest('dist'));\n });\n ```\n\n- `sourceMappingURLPrefix`\n\n Specify a prefix to be prepended onto the source map URL when writing external source maps. Relative paths will have their leading dots stripped.\n\n Example:\n ```javascript\n gulp.task('javascript', function() {\n var stream = gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write('../maps', {\n sourceMappingURLPrefix: 'https://asset-host.example.com/assets'\n }))\n .pipe(gulp.dest('public/scripts'));\n });\n ```\n\n This will result in a source mapping URL comment like `sourceMappingURL=https://asset-host.example.com/assets/maps/helloworld.js.map`.\n\n- `sourceMappingURL`\n\n If you need full control over the source map URL you can pass a function to this option. The output of the function must be the full URL to the source map (in function of the output file).\n\n Example:\n ```javascript\n gulp.task('javascript', function() {\n var stream = gulp.src('src/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(plugin1())\n .pipe(plugin2())\n .pipe(sourcemaps.write('../maps', {\n sourceMappingURL: function(file) {\n return 'https://asset-host.example.com/' + file.relative + '.map';\n }\n }))\n .pipe(gulp.dest('public/scripts'));\n });\n ```\n\n This will result in a source mapping URL comment like `sourceMappingURL=https://asset-host.example.com/helloworld.js.map`.\n\n- `debug`\n\n Set this to `true` to output debug messages (e.g. about missing source content).\n\n### Plugin developers only: How to add source map support to plugins\n\n- Generate a source map for the transformation the plugin is applying\n- **Important**: Make sure the paths in the generated source map (`file` and `sources`) are relative to `file.base` (e.g. use `file.relative`).\n- Apply this source map to the vinyl `file`. E.g. by using [vinyl-sourcemaps-apply](https://github.com/floridoo/vinyl-sourcemaps-apply).\n This combines the source map of this plugin with the source maps coming from plugins further up the chain.\n- Add your plugin to the [wiki page](https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support)\n\n#### Example:\n\n```javascript\nvar through = require('through2');\nvar applySourceMap = require('vinyl-sourcemaps-apply');\nvar myTransform = require('myTransform');\n\nmodule.exports = function(options) {\n\n function transform(file, encoding, callback) {\n // generate source maps if plugin source-map present\n if (file.sourceMap) {\n options.makeSourceMaps = true;\n }\n\n // do normal plugin logic\n var result = myTransform(file.contents, options);\n file.contents = new Buffer(result.code);\n\n // apply source map to the chain\n if (file.sourceMap) {\n applySourceMap(file, result.map);\n }\n\n this.push(file);\n callback();\n }\n\n return through.obj(transform);\n};\n```\n\n[npm-image]: https://img.shields.io/npm/v/gulp-sourcemaps.svg\n[npm-url]: https://www.npmjs.com/package/gulp-sourcemaps\n[travis-image]: https://img.shields.io/travis/floridoo/gulp-sourcemaps.svg\n[travis-url]: https://travis-ci.org/floridoo/gulp-sourcemaps\n[coveralls-image]: https://img.shields.io/coveralls/floridoo/gulp-sourcemaps.svg\n[coveralls-url]: https://coveralls.io/r/floridoo/gulp-sourcemaps?branch=master\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/floridoo/gulp-sourcemaps.git"
},
"scripts": {
"cover": "istanbul cover --dir reports/coverage tape \"test/*.js\"",
"coveralls": "istanbul cover tape \"test/*.js\" --report lcovonly && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
"tap": "tape test/*.js",
"test": "jshint *.js test/*.js && faucet test/*.js"
},
"version": "1.6.0"
}