flatten-source-map
Advanced tools
Comparing version 0.0.1 to 0.0.2
WebInspector = require('./inspector'); | ||
SourceMap = require('source-map'); | ||
module.exports = function(map){ | ||
originalMap = new WebInspector.SourceMap(map.file, map); | ||
generatedMap = new SourceMap.SourceMapGenerator(); | ||
function FlattenSourceMap(map) { | ||
var originalMap = new WebInspector.SourceMap(map.file, map); | ||
var generatedMap = new SourceMap.SourceMapGenerator(); | ||
generatedMap._file = map.file; | ||
@@ -17,2 +17,5 @@ | ||
originalMap._mappings.forEach(function(m){ | ||
if (m.length < 5) { | ||
return; | ||
} | ||
var mapping = { | ||
@@ -33,2 +36,4 @@ source: m[2], | ||
return generatedMap.toJSON(); | ||
}; | ||
} | ||
module.exports = FlattenSourceMap; |
@@ -53,4 +53,27 @@ var originalMap = { | ||
var expectedMap = { | ||
version: 3, | ||
sources: [ | ||
"/main/main.coffee", | ||
"/main/nav/service.js", | ||
"/main/controller.coffee", | ||
"/main/nav/directive.coffee" | ||
], | ||
names: [], | ||
mappings: "AAAA;AAAA,EAAA,OAAO,CAAC,MAAR,CAAe,eAAf,EAAgC,CAC5B,0BAD4B,EAE5B,eAF4B,CAAhC,CAAA,CAAA;AAAA;;;;;ACAA,OAAO,CAAC,MAAM,CAAC,2BAA2B,EAAE;AAC5C,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;;;;ACHF;AAAA,MAAA,QAAA;;AAAA,EAAM;AACW,IAAA,kBAAA,GAAA,CAAb;;oBAAA;;MADJ,CAAA;;AAAA,EAGA,OAAO,CAAC,MAAR,CAAe,0BAAf,EAA2C,EAA3C,CACA,CAAC,UADD,CACY,UADZ,EACwB,QADxB,CAHA,CAAA;AAAA;;;ACAA;AAAA,EAAA,OAAO,CAAC,MAAR,CAAe,6BAAf,EAA8C,CAC1C,mBAD0C,EAE1C,kBAF0C,CAA9C,CAGE,CAAC,SAHH,CAGa,YAHb,EAG2B,SAAA,GAAA;WACvB;AAAA,MAAA,QAAA,EAAU,IAAV;AAAA,MACA,WAAA,EAAa,UADb;MADuB;EAAA,CAH3B,CAAA,CAAA;AAAA", | ||
file: "/app.js", | ||
sourcesContent: [ | ||
"angular.module('stassets.main', [\n 'stassets.main.controller'\n 'main.template'\n])\n", | ||
"angular.module('stassets.main.nav.service', [\n]).service('NavSvc', function NavSvc(){\n this.started = new Date();\n});\n", | ||
"class MainCtrl\n constructor: ->\n\nangular.module('stassets.main.controller', [])\n.controller 'MainCtrl', MainCtrl\n", | ||
"angular.module('stassets.main.nav.directive', [\n 'main.nav.template'\n 'main.nav.service'\n]).directive 'stassetNav', ->\n restrict: 'AE'\n templateUrl: 'main/nav'\n" | ||
] | ||
}; | ||
var flatten = require('./flatten'); | ||
var flat = flatten(originalMap); | ||
console.log(JSON.stringify(flat, null, ' ')); | ||
var generatedMap = flatten(originalMap); | ||
if (JSON.stringify(expectedMap) === JSON.stringify(generatedMap)) | ||
console.log("\x1B[32m Tests passing!"); | ||
else | ||
console.error('\033[31m Tests failing!'); |
{ | ||
"name": "flatten-source-map", | ||
"version": "0.0.1", | ||
"description": "", | ||
"version": "0.0.2", | ||
"description": "Flatten sections from a source map into a single mappings string.", | ||
"main": "lib/flatten.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node ./lib/test.js" | ||
}, | ||
@@ -9,0 +9,0 @@ "author": "David Souther <davidsouther@gmail.com> (https://davidsouther.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
26349
6
723
2
1
8