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.5.4 to 0.5.5

dist/sorcery.js.map

4

CHANGELOG.md
# changelog
## 0.5.5
* sourceRoot is respected
## 0.5.4

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

73

dist/sorcery.js

@@ -10,3 +10,2 @@ 'use strict';

var utils_decodeMappings = decodeMappings;
var cache = {};

@@ -97,4 +96,4 @@

*/
var utils_atob = atob;
function atob(base64) {

@@ -114,3 +113,3 @@ return new Buffer(base64, 'base64').toString('utf8');

*/
var utils_getMapFromUrl = getMapFromUrl;
function getMapFromUrl(url, base, sync) {

@@ -124,3 +123,3 @@ if (/^data/.test(url)) {

var json = utils_atob(match[1]);
var json = atob(match[1]);
var map = JSON.parse(json);

@@ -139,4 +138,2 @@ return sync ? map : sander__default.Promise.resolve(map);

var utils_getSourceMappingUrl = getSourceMappingUrl;
function getSourceMappingUrl(str) {

@@ -166,3 +163,2 @@ var index, substring, url, match;

var utils_getMap = getMap;
function getMap(node, sourceMapByPath, sync) {

@@ -173,3 +169,3 @@ if (node.file in sourceMapByPath) {

} else {
var url = utils_getSourceMappingUrl(node.content);
var url = getSourceMappingUrl(node.content);

@@ -181,9 +177,9 @@ if (!url) {

return utils_getMapFromUrl(url, node.file, sync);
return getMapFromUrl(url, node.file, sync);
}
}
var _Node___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var Node___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _Node__Promise = sander__default.Promise;
var Node__Promise = sander__default.Promise;

@@ -195,3 +191,3 @@ var Node = (function () {

_Node___classCallCheck(this, Node);
Node___classCallCheck(this, Node);

@@ -226,3 +222,3 @@ this.file = file ? path__default.resolve(file) : null;

return utils_getMap(_this, sourceMapByPath).then(function (map) {
return getMap(_this, sourceMapByPath).then(function (map) {
if (!map) return null;

@@ -233,3 +229,3 @@

var decodingStart = process.hrtime();
_this.mappings = utils_decodeMappings(map.mappings);
_this.mappings = decodeMappings(map.mappings);
var decodingTime = process.hrtime(decodingStart);

@@ -242,3 +238,3 @@ _this._stats.decodingTime = 1000000000 * decodingTime[0] + decodingTime[1];

return new Node({
file: source ? resolveSourcePath(_this, source) : null,
file: source ? resolveSourcePath(_this, map.sourceRoot, source) : null,
content: sourcesContent[i]

@@ -251,3 +247,3 @@ });

});
return _Node__Promise.all(promises);
return Node__Promise.all(promises);
});

@@ -264,3 +260,3 @@ });

var map = utils_getMap(this, sourceMapByPath, true);
var map = getMap(this, sourceMapByPath, true);
var sourcesContent = undefined;

@@ -272,3 +268,3 @@

this.map = map;
this.mappings = utils_decodeMappings(map.mappings);
this.mappings = decodeMappings(map.mappings);

@@ -279,3 +275,3 @@ sourcesContent = map.sourcesContent || [];

var node = new Node({
file: resolveSourcePath(_this2, source),
file: resolveSourcePath(_this2, map.sourceRoot, source),
content: sourcesContent[i]

@@ -361,4 +357,4 @@ });

var _Node = Node;
function getContent(node, sourcesContentByPath) {

@@ -373,8 +369,7 @@ if (node.file in sourcesContentByPath) {

return _Node__Promise.resolve(node.content);
return Node__Promise.resolve(node.content);
}
function resolveSourcePath(node, source) {
// TODO handle sourceRoot
return path__default.resolve(path__default.dirname(node.file), source);
function resolveSourcePath(node, sourceRoot, source) {
return path__default.resolve(path__default.dirname(node.file), sourceRoot || '', source);
}

@@ -387,4 +382,4 @@

*/
var utils_btoa = btoa;
function btoa(str) {

@@ -394,7 +389,7 @@ return new Buffer(str).toString('base64');

var _SourceMap___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var SourceMap___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var SourceMap = (function () {
function SourceMap(properties) {
_SourceMap___classCallCheck(this, SourceMap);
SourceMap___classCallCheck(this, SourceMap);

@@ -415,3 +410,3 @@ this.version = 3;

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

@@ -422,5 +417,2 @@

var _SourceMap = SourceMap;
var utils_encodeMappings = encodeMappings;
function encodeMappings(decoded) {

@@ -472,3 +464,3 @@ var offsets = {

var _Chain___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var Chain___classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };

@@ -484,3 +476,3 @@ var SOURCEMAPPING_URL = 'sourceMa';

function Chain(node, sourcesContentByPath) {
_Chain___classCallCheck(this, Chain);
Chain___classCallCheck(this, Chain);

@@ -570,3 +562,3 @@ this.node = node;

var encodingStart = process.hrtime();
var mappings = utils_encodeMappings(resolved);
var mappings = encodeMappings(resolved);
var encodingTime = process.hrtime(encodingStart);

@@ -577,3 +569,3 @@ this._stats.encodingTime = 1000000000 * encodingTime[0] + encodingTime[1];

return new _SourceMap({
return new SourceMap({
file: path.basename(this.node.file),

@@ -625,4 +617,4 @@ sources: allSources.map(function (source) {

var _Chain = Chain;
function tally(nodes, stat) {

@@ -653,3 +645,3 @@ return nodes.reduce(function (total, node) {

return node.load(sourcesContentByPath, sourceMapByPath).then(function () {
return node.isOriginalSource ? null : new _Chain(node, sourcesContentByPath);
return node.isOriginalSource ? null : new Chain(node, sourcesContentByPath);
});

@@ -668,3 +660,3 @@ }

node.loadSync(sourcesContentByPath, sourceMapByPath);
return node.isOriginalSource ? null : new _Chain(node, sourcesContentByPath);
return node.isOriginalSource ? null : new Chain(node, sourcesContentByPath);
}

@@ -675,3 +667,3 @@

var node = new _Node({ file: file });
var node = new Node({ file: file });

@@ -697,2 +689,3 @@ var sourcesContentByPath = {};

exports.load = load;
exports.loadSync = loadSync;
exports.loadSync = loadSync;
//# sourceMappingURL=/www/sorcery/.gobble-build/02-esperantoBundle/1/sorcery.js.map
{
"name": "sorcery",
"description": "Resolve a chain of sourcemaps back to the original source",
"version": "0.5.4",
"version": "0.5.5",
"author": "Rich Harris",

@@ -21,4 +21,5 @@ "repository": "https://github.com/Rich-Harris/sorcery",

"esperanto": "^0.6.29",
"gobble": "^0.7.12",
"gobble": "^0.10.1",
"gobble-babel": "^5.0.0",
"gobble-cli": "^0.4.2",
"gobble-esperanto-bundle": "^0.1.7",

@@ -29,2 +30,3 @@ "less": "^2.5.0",

"source-map": "^0.1.40",
"source-map-support": "^0.2.10",
"uglify-js": "^2.4.20"

@@ -36,3 +38,4 @@ },

"scripts": {
"build": "sh ./scripts/build.sh",
"build": "gobble build -f dist",
"pretest": "npm run build",
"test": "mocha",

@@ -39,0 +42,0 @@ "prepublish": "npm run build"

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

return new Node({
file: source ? resolveSourcePath( this, source ) : null,
file: source ? resolveSourcePath( this, map.sourceRoot, source ) : null,
content: sourcesContent[i]

@@ -80,3 +80,3 @@ });

const node = new Node({
file: resolveSourcePath( this, source ),
file: resolveSourcePath( this, map.sourceRoot, source ),
content: sourcesContent[i]

@@ -171,5 +171,4 @@ });

function resolveSourcePath ( node, source ) {
// TODO handle sourceRoot
return path.resolve( path.dirname( node.file ), source );
function resolveSourcePath ( node, sourceRoot, source ) {
return path.resolve( path.dirname( node.file ), sourceRoot || '', source );
}
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