Socket
Socket
Sign inDemoInstall

sorcery

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sorcery - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

42

lib/Node.js

@@ -11,4 +11,6 @@ var path = require( 'path' ),

var Node = function ( file ) {
var Node = function ( file, content ) {
this.file = path.resolve( file );
this.content = content;
this.sourcesContentByPath = {};

@@ -21,3 +23,11 @@ };

return sander.readFile( this.file ).then( String ).then( function ( content ) {
function getContent () {
if ( !self.content ) {
return sander.readFile( self.file ).then( String );
}
return sander.Promise.resolve( self.content );
}
return getContent().then( function ( content ) {
var url;

@@ -35,9 +45,10 @@

return getMapFromUrl( url, self.file ).then( function ( map ) {
var promises;
var promises, sourcesContent;
self.map = map;
self.mappings = decodeMappings( map.mappings );
sourcesContent = map.sourcesContent || [];
self.sources = map.sources.map( function ( source ) {
return new Node( resolveSourcePath( self, source ) );
self.sources = map.sources.map( function ( source, i ) {
return new Node( resolveSourcePath( self, source ), sourcesContent[i] );
});

@@ -65,5 +76,8 @@

_loadSync: function () {
var self = this, url, map;
var self = this, url, map, sourcesContent;
this.content = sander.readFileSync( this.file ).toString();
if ( !this.content ) {
this.content = sander.readFileSync( this.file ).toString();
}
this.lines = this.content.split( '\n' );

@@ -76,7 +90,8 @@

} else {
self.map = getMapFromUrl( url, this.file, true );
self.mappings = decodeMappings( self.map.mappings );
self.map = map = getMapFromUrl( url, this.file, true );
self.mappings = decodeMappings( map.mappings );
sourcesContent = map.sourcesContent || [];
self.sources = self.map.sources.map( function ( source ) {
var node = new Node( resolveSourcePath( self, source ) );
self.sources = map.sources.map( function ( source, i) {
var node = new Node( resolveSourcePath( self, source ), sourcesContent[i] );
node._loadSync();

@@ -214,2 +229,7 @@

if ( typeof dest !== 'string' ) {
dest = this.file;
options = dest;
}
options = options || {};

@@ -216,0 +236,0 @@ dest = path.resolve( dest );

{
"name": "sorcery",
"description": "Resolve a chain of sourcemaps back to the original source",
"version": "0.2.1",
"version": "0.2.2",
"author": "Rich Harris",

@@ -6,0 +6,0 @@ "repository": "https://github.com/Rich-Harris/sorcery",

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