Commit 032c4892 authored by mattdesl's avatar mattdesl

fix case where uglify turns strings into identifiers

parent 383bfe6e
......@@ -60,7 +60,10 @@ module.exports = function (src) {
var depProps = file.value.elements[1].properties;
var deps = depProps.reduce(function (acc, dep) {
acc[dep.key.value] = dep.value.value;
var key = dep.key.type === 'Literal'
? dep.key.value
: dep.key.name;
acc[key] = dep.value.value;
return acc;
}, {});
var row = {
......
......@@ -8,10 +8,19 @@ var fs = require('fs');
var src = fs.readFileSync(__dirname + '/files/uglified.js', 'utf8');
test('uglified', function (t) {
t.plan(2);
t.plan(3);
t.doesNotThrow(function() {
var p = pack({ raw: true });
var rows = unpack(src);
t.equal(rows.length, 3, 'should unpack 3 rows');
}, 'should not throw');
t.deepEquals(deps(src), ['./foo.js', 'gamma']);
function deps(src) {
var rows = unpack(src);
return rows.reduce(function(prev, row) {
return prev.concat(Object.keys(row.deps));
}, []);
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment