first commit
This commit is contained in:
15
build/node_modules/concat-with-sourcemaps/LICENSE.md
generated
vendored
Normal file
15
build/node_modules/concat-with-sourcemaps/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
## ISC License
|
||||
|
||||
Copyright (c) 2014, Florian Reiterer <me@florianreiterer.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
45
build/node_modules/concat-with-sourcemaps/README.md
generated
vendored
Normal file
45
build/node_modules/concat-with-sourcemaps/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
## Concat with source maps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
NPM module for concatenating files and generating source maps.
|
||||
|
||||
### Usage example
|
||||
```js
|
||||
var concat = new Concat(true, 'all.js', '\n');
|
||||
concat.add(null, "// (c) John Doe");
|
||||
concat.add('file1.js', file1Content);
|
||||
concat.add('file2.js', file2Content, file2SourceMap);
|
||||
|
||||
var concatenatedContent = concat.content;
|
||||
var sourceMapForContent = concat.sourceMap;
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
#### new Concat(generateSourceMap, outFileName, separator)
|
||||
Initialize a new concat object.
|
||||
|
||||
Parameters:
|
||||
- generateSourceMap: whether or not to generate a source map (default: false)
|
||||
- outFileName: the file name/path of the output file (for the source map)
|
||||
- separator: the string that should separate files (default: no separator)
|
||||
|
||||
#### concat.add(fileName, content, sourceMap)
|
||||
Add a file to the output file.
|
||||
|
||||
Parameters:
|
||||
- fileName: file name of the input file (can be null for content without a file reference, e.g. a license comment)
|
||||
- content: content (Buffer or string) of the input file
|
||||
- sourceMap: optional source map of the input file (string). Will be merged into the output source map.
|
||||
|
||||
#### concat.content
|
||||
The resulting concatenated file content (Buffer).
|
||||
|
||||
#### concat.sourceMap
|
||||
The resulting source map of the concatenated files (string).
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/concat-with-sourcemaps.svg
|
||||
[npm-url]: https://www.npmjs.com/package/concat-with-sourcemaps
|
||||
[travis-image]: https://img.shields.io/travis/floridoo/concat-with-sourcemaps.svg
|
||||
[travis-url]: https://travis-ci.org/floridoo/concat-with-sourcemaps
|
||||
[coveralls-image]: https://img.shields.io/coveralls/floridoo/concat-with-sourcemaps.svg
|
||||
[coveralls-url]: https://coveralls.io/r/floridoo/concat-with-sourcemaps?branch=master
|
||||
121
build/node_modules/concat-with-sourcemaps/index.js
generated
vendored
Normal file
121
build/node_modules/concat-with-sourcemaps/index.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
'use strict';
|
||||
var SourceMapGenerator = require('source-map').SourceMapGenerator;
|
||||
var SourceMapConsumer = require('source-map').SourceMapConsumer;
|
||||
|
||||
function unixStylePath(filePath) {
|
||||
return filePath.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
function Concat(generateSourceMap, fileName, separator) {
|
||||
this.lineOffset = 0;
|
||||
this.columnOffset = 0;
|
||||
this.sourceMapping = generateSourceMap;
|
||||
this.contentParts = [];
|
||||
|
||||
if (separator === undefined) {
|
||||
this.separator = new Buffer(0);
|
||||
} else {
|
||||
this.separator = new Buffer(separator);
|
||||
}
|
||||
|
||||
if (this.sourceMapping) {
|
||||
this._sourceMap = new SourceMapGenerator({file: unixStylePath(fileName)});
|
||||
this.separatorLineOffset = 0;
|
||||
this.separatorColumnOffset = 0;
|
||||
var separatorString = this.separator.toString();
|
||||
for (var i = 0; i < separatorString.length; i++) {
|
||||
this.separatorColumnOffset++;
|
||||
if (separatorString[i] === '\n') {
|
||||
this.separatorLineOffset++;
|
||||
this.separatorColumnOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Concat.prototype.add = function(filePath, content, sourceMap) {
|
||||
filePath = filePath && unixStylePath(filePath);
|
||||
|
||||
if (!Buffer.isBuffer(content)) {
|
||||
content = new Buffer(content);
|
||||
}
|
||||
|
||||
if (this.contentParts.length !== 0) {
|
||||
this.contentParts.push(this.separator);
|
||||
}
|
||||
this.contentParts.push(content);
|
||||
|
||||
if (this.sourceMapping) {
|
||||
var contentString = content.toString();
|
||||
var lines = contentString.split('\n').length;
|
||||
|
||||
if (Object.prototype.toString.call(sourceMap) === '[object String]')
|
||||
sourceMap = JSON.parse(sourceMap);
|
||||
|
||||
if (sourceMap && sourceMap.mappings && sourceMap.mappings.length > 0) {
|
||||
var upstreamSM = new SourceMapConsumer(sourceMap);
|
||||
var _this = this;
|
||||
upstreamSM.eachMapping(function(mapping) {
|
||||
if (mapping.source) {
|
||||
_this._sourceMap.addMapping({
|
||||
generated: {
|
||||
line: _this.lineOffset + mapping.generatedLine,
|
||||
column: (mapping.generatedLine === 1 ? _this.columnOffset : 0) + mapping.generatedColumn
|
||||
},
|
||||
original: mapping.originalLine == null ? null : {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
},
|
||||
source: mapping.originalLine != null ? mapping.source : null,
|
||||
name: mapping.name
|
||||
});
|
||||
}
|
||||
});
|
||||
if (upstreamSM.sourcesContent) {
|
||||
upstreamSM.sourcesContent.forEach(function(sourceContent, i) {
|
||||
_this._sourceMap.setSourceContent(upstreamSM.sources[i], sourceContent);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (sourceMap && sourceMap.sources && sourceMap.sources.length > 0)
|
||||
filePath = sourceMap.sources[0];
|
||||
if (filePath) {
|
||||
for (var i = 1; i <= lines; i++) {
|
||||
this._sourceMap.addMapping({
|
||||
generated: {
|
||||
line: this.lineOffset + i,
|
||||
column: (i === 1 ? this.columnOffset : 0)
|
||||
},
|
||||
original: {
|
||||
line: i,
|
||||
column: 0
|
||||
},
|
||||
source: filePath
|
||||
});
|
||||
}
|
||||
if (sourceMap && sourceMap.sourcesContent)
|
||||
this._sourceMap.setSourceContent(filePath, sourceMap.sourcesContent[0]);
|
||||
}
|
||||
}
|
||||
if (lines > 1)
|
||||
this.columnOffset = 0;
|
||||
if (this.separatorLineOffset === 0)
|
||||
this.columnOffset += contentString.length - Math.max(0, contentString.lastIndexOf('\n')+1);
|
||||
this.columnOffset += this.separatorColumnOffset;
|
||||
this.lineOffset += lines - 1 + this.separatorLineOffset;
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(Concat.prototype, 'content', {
|
||||
get: function content() {
|
||||
return Buffer.concat(this.contentParts);
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Concat.prototype, 'sourceMap', {
|
||||
get: function sourceMap() {
|
||||
return this._sourceMap ? this._sourceMap.toString() : undefined;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Concat;
|
||||
71
build/node_modules/concat-with-sourcemaps/package.json
generated
vendored
Normal file
71
build/node_modules/concat-with-sourcemaps/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "concat-with-sourcemaps",
|
||||
"_id": "concat-with-sourcemaps@1.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-YtnS0VEY+e2Khzsey/6mra9EoM6h/5gxaC0e3mcHpA5yfDxafhygytNmcJWodvUgyXzSiL5MSkPO6bQGgfliHw==",
|
||||
"_location": "/concat-with-sourcemaps",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "concat-with-sourcemaps",
|
||||
"name": "concat-with-sourcemaps",
|
||||
"escapedName": "concat-with-sourcemaps",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.5.tgz",
|
||||
"_shasum": "8964bc2347d05819b63798104d87d6e001bed8d0",
|
||||
"_spec": "concat-with-sourcemaps",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Florian Reiterer",
|
||||
"email": "me@florianreiterer.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/floridoo/concat-with-sourcemaps/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Concatenate file contents with a custom separator and generate a source map",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"faucet": "0.0.1",
|
||||
"istanbul": "^0.3.21",
|
||||
"jshint": "^2.8.0",
|
||||
"tape": "^4.2.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"LICENSE.md"
|
||||
],
|
||||
"homepage": "http://github.com/floridoo/concat-with-sourcemaps",
|
||||
"keywords": [
|
||||
"concat",
|
||||
"source map"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "concat-with-sourcemaps",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/floridoo/concat-with-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.0.5"
|
||||
}
|
||||
Reference in New Issue
Block a user