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.3.4 to 0.3.5

4

CHANGELOG.md
# changelog
## 0.3.5
* Better handling of inline data URIs
## 0.3.4

@@ -4,0 +8,0 @@

60

dist/sorcery.js

@@ -7,4 +7,4 @@ 'use strict';

sander = ('default' in sander ? sander['default'] : sander);
var vlq = require('vlq');
var buffer_crc32 = require('buffer-crc32');
var vlq = require('vlq');

@@ -19,3 +19,3 @@ /**

function btoa(str) {
return new Buffer(str).toString("base64");
return new Buffer(str).toString('base64');
}

@@ -39,3 +39,3 @@

toUrl: function () {
return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
}

@@ -60,6 +60,6 @@ };

i = fromParts.length;
while (i--) fromParts[i] = "..";
while (i--) fromParts[i] = '..';
}
return fromParts.concat(toParts).join("/");
return fromParts.concat(toParts).join('/');
}

@@ -78,4 +78,4 @@

offsets.generatedCodeColumn = 0; // first field - reset each time
return line.map(encodeSegment).join(",");
}).join(";");
return line.map(encodeSegment).join(',');
}).join(';');

@@ -135,3 +135,3 @@ function encodeSegment(segment) {

var lines = mappings.split(";");
var lines = mappings.split(';');
var numLines = lines.length;

@@ -155,3 +155,3 @@ var decoded = new Array(numLines);

segments = decodeSegments(line.split(","));
segments = decodeSegments(line.split(','));

@@ -200,3 +200,3 @@ for (j = 0; j < segments.length; j += 1) {

// assume we want the last occurence
index = str.lastIndexOf("sourceMappingURL");
index = str.lastIndexOf('sourceMappingURL');

@@ -222,3 +222,3 @@ if (index === -1) {

function atob(base64) {
return new Buffer(base64, "base64").toString("utf8");
return new Buffer(base64, 'base64').toString('utf8');
}

@@ -244,3 +244,3 @@

if (!match) {
throw new Error("sourceMappingURL is not base64-encoded");
throw new Error('sourceMappingURL is not base64-encoded');
}

@@ -337,3 +337,3 @@

var Node = function (file, content) {
this.file = path.resolve(file);
this.file = file ? path.resolve(file) : null;
this.content = content || null; // sometimes exists in sourcesContent, sometimes doesn't

@@ -367,3 +367,3 @@

_this.content = content;
_this.lines = content.split("\n");
_this.lines = content.split('\n');

@@ -390,3 +390,3 @@ url = getSourceMappingUrl(content);

_this.sources = map.sources.map(function (source, i) {
return new Node(resolveSourcePath(_this, source), sourcesContent[i]);
return new Node(source ? resolveSourcePath(_this, source) : null, sourcesContent[i]);
});

@@ -405,3 +405,3 @@

_loadSync: function () {
var _this = this;
var _this2 = this;

@@ -414,3 +414,3 @@ var url, map, sourcesContent;

this.lines = this.content.split("\n");
this.lines = this.content.split('\n');

@@ -427,3 +427,3 @@ url = getSourceMappingUrl(this.content);

this.sources = map.sources.map(function (source, i) {
var node = new Node(resolveSourcePath(_this, source), sourcesContent[i]);
var node = new Node(resolveSourcePath(_this2, source), sourcesContent[i]);
node._loadSync();

@@ -441,3 +441,3 @@

apply: function () {
var _this = this;
var _this3 = this;

@@ -450,9 +450,9 @@ var options = arguments[0] === undefined ? {} : arguments[0];

var applySegment = function (segment, result) {
var traced = traceMapping(_this.sources[segment[1]], // source
var traced = traceMapping(_this3.sources[segment[1]], // source
segment[2], // source code line
segment[3], // source code column
_this.map.names[segment[4]]);
_this3.map.names[segment[4]]);
if (!traced) {
_this._stats.untraceable += 1;
_this3._stats.untraceable += 1;
return;

@@ -518,6 +518,6 @@ }

sources: allSources.map(function (source) {
return getRelativePath(options.base || _this.file, source);
return getRelativePath(options.base || _this3.file, source);
}),
sourcesContent: allSources.map(function (source) {
return includeContent ? _this.sourcesContentByPath[source] : null;
return includeContent ? _this3.sourcesContentByPath[source] : null;
}),

@@ -532,3 +532,3 @@ names: allNames,

selfDecodingTime: this._stats.decodingTime / 1000000,
totalDecodingTime: (this._stats.decodingTime + tally(this.sources, "decodingTime")) / 1000000,
totalDecodingTime: (this._stats.decodingTime + tally(this.sources, 'decodingTime')) / 1000000,

@@ -549,3 +549,3 @@ encodingTime: this._stats.encodingTime / 1000000,

if (typeof dest !== "string") {
if (typeof dest !== 'string') {
dest = this.file;

@@ -563,6 +563,6 @@ options = dest;

url = options.inline ? map.toUrl() : (options.absolutePath ? dest : path.basename(dest)) + ".map";
url = options.inline ? map.toUrl() : (options.absolutePath ? dest : path.basename(dest)) + '.map';
index = this.content.lastIndexOf("sourceMappingURL=") + 17;
content = this.content.substr(0, index) + this.content.substring(index).replace(/^\S+/, url) + "\n";
index = this.content.lastIndexOf('sourceMappingURL=') + 17;
content = this.content.substr(0, index) + this.content.substring(index).replace(/^\S+/, url) + '\n';

@@ -572,3 +572,3 @@ promises = [sander.writeFile(dest, content)];

if (!options.inline) {
promises.push(sander.writeFile(dest + ".map", map.toString()));
promises.push(sander.writeFile(dest + '.map', map.toString()));
}

@@ -575,0 +575,0 @@

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

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

"coffee-script": "^1.8.0",
"gobble": "^0.7.9",
"gobble-babel": "^4.0.1",
"gobble": "^0.7.12",
"gobble-babel": "^5.0.0",
"gobble-browserify": "^0.2.0",
"gobble-coffee": "^0.2.1",
"gobble-esperanto": "^0.2.4",
"gobble-esperanto-bundle": "^0.1.7",

@@ -24,0 +25,0 @@ "gobble-uglifyjs": "^0.2.0",

@@ -97,3 +97,3 @@ # sorcery.js

# (will delete existing .map file, if applicable)
sorcery -i -d some/generated/code.min.js
sorcery -d -i some/generated/code.min.js

@@ -100,0 +100,0 @@ # write to a new file (will create newfile.js and

@@ -14,3 +14,3 @@ import path from 'path';

var Node = function ( file, content ) {
this.file = path.resolve( file );
this.file = file ? path.resolve( file ) : null;
this.content = content || null; // sometimes exists in sourcesContent, sometimes doesn't

@@ -64,3 +64,3 @@

this.sources = map.sources.map( ( source, i ) => {
return new Node( resolveSourcePath( this, source ), sourcesContent[i] );
return new Node( source ? resolveSourcePath( this, source ) : null, sourcesContent[i] );
});

@@ -67,0 +67,0 @@

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