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

source-map

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map - npm Package Compare versions

Comparing version 0.1.23 to 0.1.24

9

CHANGELOG.md
# Change Log
## 0.1.24
* Fix issue with absolute paths and `file://` URIs. See
https://bugzilla.mozilla.org/show_bug.cgi?id=885597
## 0.1.23
* Fix issue with absolute paths and sourcesContent, github issue 64.
## 0.1.22

@@ -4,0 +13,0 @@

25

lib/source-map/source-map-consumer.js

@@ -301,5 +301,5 @@ /* -*- Mode: js; js-indent-level: 2; -*- */

/**
* Returns the original source content. The only argument is
* the url of the original source file. Returns null if no
* original source content is availible.
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* availible.
*/

@@ -322,6 +322,17 @@ SourceMapConsumer.prototype.sourceContentFor =

if (this.sourceRoot
&& (url = util.urlParse(this.sourceRoot))
&& (!url.path || url.path == "/")
&& this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
&& (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
// behave like it would if they were running a local HTTP server. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
if (url.scheme == "file"
&& this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
}
if ((!url.path || url.path == "/")
&& this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
}
}

@@ -328,0 +339,0 @@

@@ -287,3 +287,3 @@ /* -*- Mode: js; js-indent-level: 2; -*- */

// The mappings must be guarenteed to be in sorted order before we start
// The mappings must be guaranteed to be in sorted order before we start
// serializing them or else the generated line numbers (which are defined

@@ -290,0 +290,0 @@ // via the ';' separators) will be all messed up. Note: it might be more

{
"name": "source-map",
"description": "Generates and consumes source maps",
"version": "0.1.23",
"version": "0.1.24",
"homepage": "https://github.com/mozilla/source-map",

@@ -6,0 +6,0 @@ "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",

@@ -306,2 +306,17 @@ /* -*- Mode: js; js-indent-level: 2; -*- */

exports['test bug 885597'] = function (assert, util) {
var map = new SourceMapConsumer({
"version": 3,
"file": "foo.js",
"sourceRoot": "file:///Users/AlGore/Invented/The/Internet/",
"sources": ["/a"],
"names": [],
"mappings": "AACA",
"sourcesContent": ["foo"]
});
var s = map.sources[0];
assert.equal(map.sourceContentFor(s), "foo");
};
});
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