Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flatten-source-map

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flatten-source-map - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

README.md

15

lib/flatten.js
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/)",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc