Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
16
node_modules/convert-source-map/.npmignore
generated
vendored
Normal file
16
node_modules/convert-source-map/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
node_modules
|
||||
npm-debug.log
|
||||
tmp
|
5
node_modules/convert-source-map/.travis.yml
generated
vendored
Normal file
5
node_modules/convert-source-map/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.10
|
||||
- 0.11
|
23
node_modules/convert-source-map/LICENSE
generated
vendored
Normal file
23
node_modules/convert-source-map/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Copyright 2013 Thorsten Lorenz.
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
114
node_modules/convert-source-map/README.md
generated
vendored
Normal file
114
node_modules/convert-source-map/README.md
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
# convert-source-map [](http://travis-ci.org/thlorenz/convert-source-map)
|
||||
|
||||
[](https://nodei.co/npm/convert-source-map/)
|
||||
|
||||
Converts a source-map from/to different formats and allows adding/changing properties.
|
||||
|
||||
```js
|
||||
var convert = require('convert-source-map');
|
||||
|
||||
var json = convert
|
||||
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.toJSON();
|
||||
|
||||
var modified = convert
|
||||
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.setProperty('sources', [ 'CONSOLE.LOG("HI");' ])
|
||||
.toJSON();
|
||||
|
||||
console.log(json);
|
||||
console.log(modified);
|
||||
```
|
||||
|
||||
```json
|
||||
{"version":3,"file":"foo.js","sources":["console.log(\"hi\");"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
|
||||
{"version":3,"file":"foo.js","sources":["CONSOLE.LOG(\"HI\");"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### fromObject(obj)
|
||||
|
||||
Returns source map converter from given object.
|
||||
|
||||
### fromJSON(json)
|
||||
|
||||
Returns source map converter from given json string.
|
||||
|
||||
### fromBase64(base64)
|
||||
|
||||
Returns source map converter from given base64 encoded json string.
|
||||
|
||||
### fromComment(comment)
|
||||
|
||||
Returns source map converter from given base64 encoded json string prefixed with `//# sourceMappingURL=...`.
|
||||
|
||||
### fromMapFileComment(comment, mapFileDir)
|
||||
|
||||
Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`.
|
||||
|
||||
`filename` must point to a file that is found inside the `mapFileDir`. Most tools store this file right next to the
|
||||
generated file, i.e. the one containing the source map.
|
||||
|
||||
### fromSource(source)
|
||||
|
||||
Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was
|
||||
found.
|
||||
|
||||
### fromMapFileSource(source, mapFileDir)
|
||||
|
||||
Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was
|
||||
found.
|
||||
|
||||
The sourcemap will be read from the map file found by parsing `# sourceMappingURL=file` comment. For more info see
|
||||
fromMapFileComment.
|
||||
|
||||
### toObject()
|
||||
|
||||
Returns a copy of the underlying source map.
|
||||
|
||||
### toJSON([space])
|
||||
|
||||
Converts source map to json string. If `space` is given (optional), this will be passed to
|
||||
[JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the
|
||||
JSON string is generated.
|
||||
|
||||
### toBase64()
|
||||
|
||||
Converts source map to base64 encoded json string.
|
||||
|
||||
### toComment()
|
||||
|
||||
Converts source map to base64 encoded json string prefixed with `//# sourceMappingURL=...`.
|
||||
|
||||
### addProperty(key, value)
|
||||
|
||||
Adds given property to the source map. Throws an error if property already exists.
|
||||
|
||||
### setProperty(key, value)
|
||||
|
||||
Sets given property to the source map. If property doesn't exist it is added, otherwise its value is updated.
|
||||
|
||||
### getProperty(key)
|
||||
|
||||
Gets given property of the source map.
|
||||
|
||||
### removeComments(src)
|
||||
|
||||
Returns `src` with all source map comments removed
|
||||
|
||||
### removeMapFileComments(src)
|
||||
|
||||
Returns `src` with all source map comments pointing to map files removed.
|
||||
|
||||
### commentRegex
|
||||
|
||||
Returns the regex used to find source map comments.
|
||||
|
||||
### mapFileCommentRegex
|
||||
|
||||
Returns the regex used to find source map comments pointing to map files.
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
15
node_modules/convert-source-map/example/comment-to-json.js
generated
vendored
Normal file
15
node_modules/convert-source-map/example/comment-to-json.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
var convert = require('..');
|
||||
|
||||
var json = convert
|
||||
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.toJSON();
|
||||
|
||||
var modified = convert
|
||||
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.setProperty('sources', [ 'CONSOLE.LOG("HI");' ])
|
||||
.toJSON();
|
||||
|
||||
console.log(json);
|
||||
console.log(modified);
|
139
node_modules/convert-source-map/index.js
generated
vendored
Normal file
139
node_modules/convert-source-map/index.js
generated
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
'use strict';
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var commentRx = /^[ \t]*(?:\/\/|\/\*)[@#][ \t]+sourceMappingURL=data:(?:application|text)\/json;base64,(.+)(?:\*\/)?/mg;
|
||||
var mapFileCommentRx =
|
||||
// //# sourceMappingURL=foo.js.map /*# sourceMappingURL=foo.js.map */
|
||||
/(?:^[ \t]*\/\/[@|#][ \t]+sourceMappingURL=(.+?)[ \t]*$)|(?:^[ \t]*\/\*[@#][ \t]+sourceMappingURL=(.+?)[ \t]*\*\/[ \t]*$)/mg
|
||||
|
||||
function decodeBase64(base64) {
|
||||
return new Buffer(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function stripComment(sm) {
|
||||
return sm.split(',').pop();
|
||||
}
|
||||
|
||||
function readFromFileMap(sm, dir) {
|
||||
// NOTE: this will only work on the server since it attempts to read the map file
|
||||
|
||||
var r = mapFileCommentRx.exec(sm);
|
||||
mapFileCommentRx.lastIndex = 0;
|
||||
|
||||
// for some odd reason //# .. captures in 1 and /* .. */ in 2
|
||||
var filename = r[1] || r[2];
|
||||
var filepath = path.join(dir, filename);
|
||||
|
||||
try {
|
||||
return fs.readFileSync(filepath, 'utf8');
|
||||
} catch (e) {
|
||||
throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e);
|
||||
}
|
||||
}
|
||||
|
||||
function Converter (sm, opts) {
|
||||
opts = opts || {};
|
||||
try {
|
||||
if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir);
|
||||
if (opts.hasComment) sm = stripComment(sm);
|
||||
if (opts.isEncoded) sm = decodeBase64(sm);
|
||||
if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm);
|
||||
|
||||
this.sourcemap = sm;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Converter.prototype.toJSON = function (space) {
|
||||
return JSON.stringify(this.sourcemap, null, space);
|
||||
};
|
||||
|
||||
Converter.prototype.toBase64 = function () {
|
||||
var json = this.toJSON();
|
||||
return new Buffer(json).toString('base64');
|
||||
};
|
||||
|
||||
Converter.prototype.toComment = function () {
|
||||
var base64 = this.toBase64();
|
||||
return '//# sourceMappingURL=data:application/json;base64,' + base64;
|
||||
};
|
||||
|
||||
// returns copy instead of original
|
||||
Converter.prototype.toObject = function () {
|
||||
return JSON.parse(this.toJSON());
|
||||
};
|
||||
|
||||
Converter.prototype.addProperty = function (key, value) {
|
||||
if (this.sourcemap.hasOwnProperty(key)) throw new Error('property %s already exists on the sourcemap, use set property instead');
|
||||
return this.setProperty(key, value);
|
||||
};
|
||||
|
||||
Converter.prototype.setProperty = function (key, value) {
|
||||
this.sourcemap[key] = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
Converter.prototype.getProperty = function (key) {
|
||||
return this.sourcemap[key];
|
||||
};
|
||||
|
||||
exports.fromObject = function (obj) {
|
||||
return new Converter(obj);
|
||||
};
|
||||
|
||||
exports.fromJSON = function (json) {
|
||||
return new Converter(json, { isJSON: true });
|
||||
};
|
||||
|
||||
exports.fromBase64 = function (base64) {
|
||||
return new Converter(base64, { isEncoded: true });
|
||||
};
|
||||
|
||||
exports.fromComment = function (comment) {
|
||||
comment = comment
|
||||
.replace(/^\/\*/g, '//')
|
||||
.replace(/\*\/$/g, '');
|
||||
|
||||
return new Converter(comment, { isEncoded: true, hasComment: true });
|
||||
};
|
||||
|
||||
exports.fromMapFileComment = function (comment, dir) {
|
||||
return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true });
|
||||
};
|
||||
|
||||
// Finds last sourcemap comment in file or returns null if none was found
|
||||
exports.fromSource = function (content) {
|
||||
var m = content.match(commentRx);
|
||||
commentRx.lastIndex = 0;
|
||||
return m ? exports.fromComment(m.pop()) : null;
|
||||
};
|
||||
|
||||
// Finds last sourcemap comment in file or returns null if none was found
|
||||
exports.fromMapFileSource = function (content, dir) {
|
||||
var m = content.match(mapFileCommentRx);
|
||||
mapFileCommentRx.lastIndex = 0;
|
||||
return m ? exports.fromMapFileComment(m.pop(), dir) : null;
|
||||
};
|
||||
|
||||
exports.removeComments = function (src) {
|
||||
commentRx.lastIndex = 0;
|
||||
return src.replace(commentRx, '');
|
||||
};
|
||||
|
||||
exports.removeMapFileComments = function (src) {
|
||||
mapFileCommentRx.lastIndex = 0;
|
||||
return src.replace(mapFileCommentRx, '');
|
||||
};
|
||||
|
||||
exports.__defineGetter__('commentRegex', function () {
|
||||
commentRx.lastIndex = 0;
|
||||
return commentRx;
|
||||
});
|
||||
|
||||
exports.__defineGetter__('mapFileCommentRegex', function () {
|
||||
mapFileCommentRx.lastIndex = 0;
|
||||
return mapFileCommentRx;
|
||||
});
|
36
node_modules/convert-source-map/package.json
generated
vendored
Normal file
36
node_modules/convert-source-map/package.json
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "convert-source-map",
|
||||
"version": "0.3.5",
|
||||
"description": "Converts a source-map from/to different formats and allows adding/changing properties.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/thlorenz/convert-source-map.git"
|
||||
},
|
||||
"homepage": "https://github.com/thlorenz/convert-source-map",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"inline-source-map": "~0.3.0",
|
||||
"tap": "~0.4.3"
|
||||
},
|
||||
"keywords": [
|
||||
"convert",
|
||||
"sourcemap",
|
||||
"source",
|
||||
"map",
|
||||
"browser",
|
||||
"debug"
|
||||
],
|
||||
"author": {
|
||||
"name": "Thorsten Lorenz",
|
||||
"email": "thlorenz@gmx.de",
|
||||
"url": "http://thlorenz.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engine": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
}
|
100
node_modules/convert-source-map/test/comment-regex.js
generated
vendored
Normal file
100
node_modules/convert-source-map/test/comment-regex.js
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
/*jshint asi: true */
|
||||
|
||||
var test = require('tap').test
|
||||
, generator = require('inline-source-map')
|
||||
, rx = require('..').commentRegex
|
||||
, mapFileRx = require('..').mapFileCommentRegex
|
||||
|
||||
function comment(s) {
|
||||
rx.lastIndex = 0;
|
||||
return rx.test(s + 'sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9')
|
||||
}
|
||||
|
||||
test('comment regex old spec - @', function (t) {
|
||||
[ '//@ '
|
||||
, ' //@ '
|
||||
, '\t//@ '
|
||||
].forEach(function (x) { t.ok(comment(x), 'matches ' + x) });
|
||||
|
||||
[ '///@ '
|
||||
, '}}//@ '
|
||||
, ' @// @'
|
||||
].forEach(function (x) { t.ok(!comment(x), 'does not match ' + x) })
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('comment regex new spec - #', function (t) {
|
||||
[ '//# '
|
||||
, ' //# '
|
||||
, '\t//# '
|
||||
].forEach(function (x) { t.ok(comment(x), 'matches ' + x) });
|
||||
|
||||
[ '///# '
|
||||
, '}}//# '
|
||||
, ' #// #'
|
||||
].forEach(function (x) { t.ok(!comment(x), 'does not match ' + x) })
|
||||
t.end()
|
||||
})
|
||||
|
||||
function mapFileComment(s) {
|
||||
mapFileRx.lastIndex = 0;
|
||||
return mapFileRx.test(s + 'sourceMappingURL=foo.js.map')
|
||||
}
|
||||
|
||||
test('mapFileComment regex old spec - @', function (t) {
|
||||
[ '//@ '
|
||||
, ' //@ '
|
||||
, '\t//@ '
|
||||
].forEach(function (x) { t.ok(mapFileComment(x), 'matches ' + x) });
|
||||
|
||||
[ '///@ '
|
||||
, '}}//@ '
|
||||
, ' @// @'
|
||||
].forEach(function (x) { t.ok(!mapFileComment(x), 'does not match ' + x) })
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('mapFileComment regex new spec - #', function (t) {
|
||||
[ '//# '
|
||||
, ' //# '
|
||||
, '\t//# '
|
||||
].forEach(function (x) { t.ok(mapFileComment(x), 'matches ' + x) });
|
||||
|
||||
[ '///# '
|
||||
, '}}//# '
|
||||
, ' #// #'
|
||||
].forEach(function (x) { t.ok(!mapFileComment(x), 'does not match ' + x) })
|
||||
t.end()
|
||||
})
|
||||
|
||||
function mapFileCommentWrap(s1, s2) {
|
||||
mapFileRx.lastIndex = 0;
|
||||
return mapFileRx.test(s1 + 'sourceMappingURL=foo.js.map' + s2)
|
||||
}
|
||||
|
||||
test('mapFileComment regex /* */ old spec - @', function (t) {
|
||||
[ [ '/*@ ', '*/' ]
|
||||
, [' /*@ ', ' */ ' ]
|
||||
, [ '\t/*@ ', ' \t*/\t ']
|
||||
].forEach(function (x) { t.ok(mapFileCommentWrap(x[0], x[1]), 'matches ' + x.join(' :: ')) });
|
||||
|
||||
[ [ '/*/*@ ', '*/' ]
|
||||
, ['}}/*@ ', ' */ ' ]
|
||||
, [ ' @/*@ ', ' \t*/\t ']
|
||||
].forEach(function (x) { t.ok(!mapFileCommentWrap(x[0], x[1]), 'does not match ' + x.join(' :: ')) });
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('mapFileComment regex /* */ new spec - #', function (t) {
|
||||
[ [ '/*# ', '*/' ]
|
||||
, [' /*# ', ' */ ' ]
|
||||
, [ '\t/*# ', ' \t*/\t ']
|
||||
].forEach(function (x) { t.ok(mapFileCommentWrap(x[0], x[1]), 'matches ' + x.join(' :: ')) });
|
||||
|
||||
[ [ '/*/*# ', '*/' ]
|
||||
, ['}}/*# ', ' */ ' ]
|
||||
, [ ' #/*# ', ' \t*/\t ']
|
||||
].forEach(function (x) { t.ok(!mapFileCommentWrap(x[0], x[1]), 'does not match ' + x.join(' :: ')) });
|
||||
t.end()
|
||||
})
|
161
node_modules/convert-source-map/test/convert-source-map.js
generated
vendored
Normal file
161
node_modules/convert-source-map/test/convert-source-map.js
generated
vendored
Normal file
|
@ -0,0 +1,161 @@
|
|||
'use strict';
|
||||
/*jshint asi: true */
|
||||
|
||||
var test = require('tap').test
|
||||
, generator = require('inline-source-map')
|
||||
, convert = require('..')
|
||||
|
||||
var gen = generator()
|
||||
.addMappings('foo.js', [{ original: { line: 2, column: 3 } , generated: { line: 5, column: 10 } }], { line: 5 })
|
||||
.addGeneratedMappings('bar.js', 'var a = 2;\nconsole.log(a)', { line: 23, column: 22 })
|
||||
|
||||
, base64 = gen.base64Encode()
|
||||
, comment = gen.inlineMappingUrl()
|
||||
, json = gen.toString()
|
||||
, obj = JSON.parse(json)
|
||||
|
||||
test('different formats', function (t) {
|
||||
|
||||
t.equal(convert.fromComment(comment).toComment(), comment, 'comment -> comment')
|
||||
t.equal(convert.fromComment(comment).toBase64(), base64, 'comment -> base64')
|
||||
t.equal(convert.fromComment(comment).toJSON(), json, 'comment -> json')
|
||||
t.deepEqual(convert.fromComment(comment).toObject(), obj, 'comment -> object')
|
||||
|
||||
t.equal(convert.fromBase64(base64).toBase64(), base64, 'base64 -> base64')
|
||||
t.equal(convert.fromBase64(base64).toComment(), comment, 'base64 -> comment')
|
||||
t.equal(convert.fromBase64(base64).toJSON(), json, 'base64 -> json')
|
||||
t.deepEqual(convert.fromBase64(base64).toObject(), obj, 'base64 -> object')
|
||||
|
||||
t.equal(convert.fromJSON(json).toJSON(), json, 'json -> json')
|
||||
t.equal(convert.fromJSON(json).toBase64(), base64, 'json -> base64')
|
||||
t.equal(convert.fromJSON(json).toComment(), comment, 'json -> comment')
|
||||
t.deepEqual(convert.fromJSON(json).toObject(), obj, 'json -> object')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('to object returns a copy', function (t) {
|
||||
var c = convert.fromJSON(json)
|
||||
var o = c.toObject()
|
||||
o.version = '99';
|
||||
t.equal(c.toObject().version, 3, 'setting property on returned object does not affect original')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('from source', function (t) {
|
||||
var foo = [
|
||||
'function foo() {'
|
||||
, ' console.log("hello I am foo");'
|
||||
, ' console.log("who are you");'
|
||||
, '}'
|
||||
, ''
|
||||
, 'foo();'
|
||||
, ''
|
||||
].join('\n')
|
||||
, map = '//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9'
|
||||
, otherMap = '//# sourceMappingURL=data:application/json;base64,otherZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9'
|
||||
|
||||
function getComment(src) {
|
||||
var map = convert.fromSource(src);
|
||||
return map ? map.toComment() : null;
|
||||
}
|
||||
|
||||
t.equal(getComment(foo), null, 'no comment returns null')
|
||||
t.equal(getComment(foo + map), map, 'beginning of last line')
|
||||
t.equal(getComment(foo + ' ' + map), map, 'indented of last line')
|
||||
t.equal(getComment(foo + ' ' + map + '\n\n'), map, 'indented on last non empty line')
|
||||
t.equal(getComment(foo + map + '\nconsole.log("more code");\nfoo()\n'), map, 'in the middle of code')
|
||||
t.equal(getComment(foo + otherMap + '\n' + map), map, 'finds last map in source')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('remove comments', function (t) {
|
||||
var foo = [
|
||||
'function foo() {'
|
||||
, ' console.log("hello I am foo");'
|
||||
, ' console.log("who are you");'
|
||||
, '}'
|
||||
, ''
|
||||
, 'foo();'
|
||||
, ''
|
||||
].join('\n')
|
||||
// this one is old spec on purpose
|
||||
, map = '//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9'
|
||||
, otherMap = '//# sourceMappingURL=data:application/json;base64,otherZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9'
|
||||
, extraCode = '\nconsole.log("more code");\nfoo()\n'
|
||||
|
||||
t.equal(convert.removeComments(foo + map), foo, 'from last line')
|
||||
t.equal(convert.removeComments(foo + map + extraCode), foo + extraCode, 'from the middle of code')
|
||||
t.equal(convert.removeComments(foo + otherMap + extraCode + map + map), foo + extraCode, 'multiple comments from the middle of code')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('remove map file comments', function (t) {
|
||||
var foo = [
|
||||
'function foo() {'
|
||||
, ' console.log("hello I am foo");'
|
||||
, ' console.log("who are you");'
|
||||
, '}'
|
||||
, ''
|
||||
, 'foo();'
|
||||
, ''
|
||||
].join('\n')
|
||||
, fileMap1 = '//# sourceMappingURL=foo.js.map'
|
||||
, fileMap2 = '/*# sourceMappingURL=foo.js.map */';
|
||||
|
||||
t.equal(convert.removeMapFileComments(foo + fileMap1), foo, '// style filemap comment')
|
||||
t.equal(convert.removeMapFileComments(foo + fileMap2), foo, '/* */ style filemap comment')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('pretty json', function (t) {
|
||||
var mod = convert.fromJSON(json).toJSON(2)
|
||||
, expected = JSON.stringify(obj, null, 2);
|
||||
|
||||
t.equal(
|
||||
mod
|
||||
, expected
|
||||
, 'pretty prints json when space is given')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('adding properties', function (t) {
|
||||
var mod = convert
|
||||
.fromJSON(json)
|
||||
.addProperty('foo', 'bar')
|
||||
.toJSON()
|
||||
, expected = JSON.parse(json);
|
||||
expected.foo = 'bar';
|
||||
t.equal(
|
||||
mod
|
||||
, JSON.stringify(expected)
|
||||
, 'includes added property'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('setting properties', function (t) {
|
||||
var mod = convert
|
||||
.fromJSON(json)
|
||||
.setProperty('version', '2')
|
||||
.setProperty('mappings', ';;;UACG')
|
||||
.setProperty('should add', 'this')
|
||||
.toJSON()
|
||||
, expected = JSON.parse(json);
|
||||
expected.version = '2';
|
||||
expected.mappings = ';;;UACG';
|
||||
expected['should add'] = 'this';
|
||||
t.equal(
|
||||
mod
|
||||
, JSON.stringify(expected)
|
||||
, 'includes new property and changes existing properties'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('getting properties', function (t) {
|
||||
var sm = convert.fromJSON(json)
|
||||
|
||||
t.equal(sm.getProperty('version'), 3, 'gets version')
|
||||
t.deepEqual(sm.getProperty('sources'), ['foo.js', 'bar.js'], 'gets sources')
|
||||
t.end()
|
||||
})
|
14
node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css
generated
vendored
Normal file
14
node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
.header {
|
||||
background: #444;
|
||||
border: solid;
|
||||
padding: 10px;
|
||||
border-radius: 10px 5px 10px 5px;
|
||||
color: #b4b472; }
|
||||
|
||||
#main li {
|
||||
color: green;
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
font-size: 18px; }
|
||||
|
||||
//# sourceMappingURL=map-file-comment.css.map
|
14
node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css
generated
vendored
Normal file
14
node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
.header {
|
||||
background: #444;
|
||||
border: solid;
|
||||
padding: 10px;
|
||||
border-radius: 10px 5px 10px 5px;
|
||||
color: #b4b472; }
|
||||
|
||||
#main li {
|
||||
color: green;
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
font-size: 18px; }
|
||||
|
||||
/*# sourceMappingURL=data:application/json;base64,ewoidmVyc2lvbiI6ICIzIiwKIm1hcHBpbmdzIjogIkFBQUEsd0JBQXlCO0VBQ3ZCLFVBQVUsRUFBRSxJQUFJO0VBQ2hCLE1BQU0sRUFBRSxLQUFLO0VBQ2IsT0FBTyxFQUFFLElBQUk7RUFDYixhQUFhLEVBQUUsaUJBQWlCO0VBQ2hDLEtBQUssRUFBRSxPQUFrQjs7QUFHM0Isd0JBQXlCO0VBQ3ZCLE9BQU8sRUFBRSxJQUFJOztBQ1RmLGdCQUFpQjtFQUNmLFVBQVUsRUFBRSxJQUFJO0VBQ2hCLEtBQUssRUFBRSxNQUFNOztBQUdmLGtCQUFtQjtFQUNqQixNQUFNLEVBQUUsSUFBSTtFQUNaLE9BQU8sRUFBRSxJQUFJO0VBQ2IsVUFBVSxFQUFFLEtBQUs7RUFDakIsYUFBYSxFQUFFLEdBQUc7RUFDbEIsS0FBSyxFQUFFLEtBQUs7O0FBRWQsa0JBQW1CO0VBQ2pCLEtBQUssRUFBRSxLQUFLOztBQUdkLG1CQUFvQjtFQUNsQixLQUFLLEVBQUUsS0FBSztFQUNaLE1BQU0sRUFBRSxJQUFJO0VBQ1osT0FBTyxFQUFFLElBQUk7RUFDYixTQUFTLEVBQUUsSUFBSSIsCiJzb3VyY2VzIjogWyIuL2NsaWVudC9zYXNzL2NvcmUuc2NzcyIsIi4vY2xpZW50L3Nhc3MvbWFpbi5zY3NzIl0sCiJmaWxlIjogIm1hcC1maWxlLWNvbW1lbnQuY3NzIgp9 */
|
14
node_modules/convert-source-map/test/fixtures/map-file-comment.css
generated
vendored
Normal file
14
node_modules/convert-source-map/test/fixtures/map-file-comment.css
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
.header {
|
||||
background: #444;
|
||||
border: solid;
|
||||
padding: 10px;
|
||||
border-radius: 10px 5px 10px 5px;
|
||||
color: #b4b472; }
|
||||
|
||||
#main li {
|
||||
color: green;
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
font-size: 18px; }
|
||||
|
||||
/*# sourceMappingURL=map-file-comment.css.map */
|
6
node_modules/convert-source-map/test/fixtures/map-file-comment.css.map
generated
vendored
Normal file
6
node_modules/convert-source-map/test/fixtures/map-file-comment.css.map
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"version": "3",
|
||||
"mappings": "AAAA,wBAAyB;EACvB,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,iBAAiB;EAChC,KAAK,EAAE,OAAkB;;AAG3B,wBAAyB;EACvB,OAAO,EAAE,IAAI;;ACTf,gBAAiB;EACf,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,MAAM;;AAGf,kBAAmB;EACjB,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,KAAK;EACjB,aAAa,EAAE,GAAG;EAClB,KAAK,EAAE,KAAK;;AAEd,kBAAmB;EACjB,KAAK,EAAE,KAAK;;AAGd,mBAAoB;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,SAAS,EAAE,IAAI",
|
||||
"sources": ["./client/sass/core.scss","./client/sass/main.scss"],
|
||||
"file": "map-file-comment.css"
|
||||
}
|
70
node_modules/convert-source-map/test/map-file-comment.js
generated
vendored
Normal file
70
node_modules/convert-source-map/test/map-file-comment.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
/*jshint asi: true */
|
||||
|
||||
var test = require('tap').test
|
||||
, rx = require('..')
|
||||
, fs = require('fs')
|
||||
, convert = require('..')
|
||||
|
||||
test('\nresolving a "/*# sourceMappingURL=map-file-comment.css.map*/" style comment inside a given css content', function (t) {
|
||||
var css = fs.readFileSync(__dirname + '/fixtures/map-file-comment.css', 'utf8')
|
||||
var conv = convert.fromMapFileSource(css, __dirname + '/fixtures');
|
||||
var sm = conv.toObject();
|
||||
|
||||
t.deepEqual(
|
||||
sm.sources
|
||||
, [ './client/sass/core.scss',
|
||||
'./client/sass/main.scss' ]
|
||||
, 'resolves paths of original sources'
|
||||
)
|
||||
|
||||
t.equal(sm.file, 'map-file-comment.css', 'includes filename of generated file')
|
||||
t.equal(
|
||||
sm.mappings
|
||||
, 'AAAA,wBAAyB;EACvB,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,iBAAiB;EAChC,KAAK,EAAE,OAAkB;;AAG3B,wBAAyB;EACvB,OAAO,EAAE,IAAI;;ACTf,gBAAiB;EACf,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,MAAM;;AAGf,kBAAmB;EACjB,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,KAAK;EACjB,aAAa,EAAE,GAAG;EAClB,KAAK,EAAE,KAAK;;AAEd,kBAAmB;EACjB,KAAK,EAAE,KAAK;;AAGd,mBAAoB;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,SAAS,EAAE,IAAI'
|
||||
, 'includes mappings'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('\nresolving a "//# sourceMappingURL=map-file-comment.css.map" style comment inside a given css content', function (t) {
|
||||
var css = fs.readFileSync(__dirname + '/fixtures/map-file-comment-double-slash.css', 'utf8')
|
||||
var conv = convert.fromMapFileSource(css, __dirname + '/fixtures');
|
||||
var sm = conv.toObject();
|
||||
|
||||
t.deepEqual(
|
||||
sm.sources
|
||||
, [ './client/sass/core.scss',
|
||||
'./client/sass/main.scss' ]
|
||||
, 'resolves paths of original sources'
|
||||
)
|
||||
|
||||
t.equal(sm.file, 'map-file-comment.css', 'includes filename of generated file')
|
||||
t.equal(
|
||||
sm.mappings
|
||||
, 'AAAA,wBAAyB;EACvB,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,iBAAiB;EAChC,KAAK,EAAE,OAAkB;;AAG3B,wBAAyB;EACvB,OAAO,EAAE,IAAI;;ACTf,gBAAiB;EACf,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,MAAM;;AAGf,kBAAmB;EACjB,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,KAAK;EACjB,aAAa,EAAE,GAAG;EAClB,KAAK,EAAE,KAAK;;AAEd,kBAAmB;EACjB,KAAK,EAAE,KAAK;;AAGd,mBAAoB;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,SAAS,EAAE,IAAI'
|
||||
, 'includes mappings'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('\nresolving a /*# sourceMappingURL=data:application/json;base64,... */ style comment inside a given css content', function(t) {
|
||||
var css = fs.readFileSync(__dirname + '/fixtures/map-file-comment-inline.css', 'utf8')
|
||||
var conv = convert.fromSource(css, __dirname + '/fixtures')
|
||||
var sm = conv.toObject()
|
||||
|
||||
t.deepEqual(
|
||||
sm.sources
|
||||
, [ './client/sass/core.scss',
|
||||
'./client/sass/main.scss' ]
|
||||
, 'resolves paths of original sources'
|
||||
)
|
||||
|
||||
t.equal(sm.file, 'map-file-comment.css', 'includes filename of generated file')
|
||||
t.equal(
|
||||
sm.mappings
|
||||
, 'AAAA,wBAAyB;EACvB,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,iBAAiB;EAChC,KAAK,EAAE,OAAkB;;AAG3B,wBAAyB;EACvB,OAAO,EAAE,IAAI;;ACTf,gBAAiB;EACf,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,MAAM;;AAGf,kBAAmB;EACjB,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,KAAK;EACjB,aAAa,EAAE,GAAG;EAClB,KAAK,EAAE,KAAK;;AAEd,kBAAmB;EACjB,KAAK,EAAE,KAAK;;AAGd,mBAAoB;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,IAAI;EACZ,OAAO,EAAE,IAAI;EACb,SAAS,EAAE,IAAI'
|
||||
, 'includes mappings'
|
||||
)
|
||||
t.end()
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue