[Pkg-javascript-commits] [node-source-map-support] 01/03: New upstream version 0.4.11+ds

Julien Puydt julien.puydt at laposte.net
Mon Jan 23 08:55:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-source-map-support.

commit 8188578d02cb47bad0f3e96d2b4ed96f749e5f42
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Mon Jan 23 09:49:21 2017 +0100

    New upstream version 0.4.11+ds
---
 package.json          |  2 +-
 source-map-support.js | 30 +++++++++++++++++++-----------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/package.json b/package.json
index 6056e13..dcad9aa 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "source-map-support",
   "description": "Fixes stack traces for files with source maps",
-  "version": "0.4.9",
+  "version": "0.4.11",
   "main": "./source-map-support.js",
   "scripts": {
     "build": "node build.js",
diff --git a/source-map-support.js b/source-map-support.js
index 5af4780..5499b97 100644
--- a/source-map-support.js
+++ b/source-map-support.js
@@ -4,6 +4,10 @@ var path = require('path');
 var fs;
 try {
   fs = require('fs');
+  if (!fs.existsSync || !fs.readFileSync) {
+    // fs doesn't have all methods we need
+    fs = null;
+  }
 } catch (err) {
   /* nop */
 }
@@ -96,17 +100,21 @@ function retrieveSourceMapURL(source) {
   var fileData;
 
   if (isInBrowser()) {
-    var xhr = new XMLHttpRequest();
-    xhr.open('GET', source, false);
-    xhr.send(null);
-    fileData = xhr.readyState === 4 ? xhr.responseText : null;
-
-    // Support providing a sourceMappingURL via the SourceMap header
-    var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
-                          xhr.getResponseHeader("X-SourceMap");
-    if (sourceMapHeader) {
-      return sourceMapHeader;
-    }
+     try {
+       var xhr = new XMLHttpRequest();
+       xhr.open('GET', source, false);
+       xhr.send(null);
+       fileData = xhr.readyState === 4 ? xhr.responseText : null;
+
+       // Support providing a sourceMappingURL via the SourceMap header
+       var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
+                             xhr.getResponseHeader("X-SourceMap");
+       if (sourceMapHeader) {
+         return sourceMapHeader;
+       }
+     } catch (e) {
+       return null;
+     }
   }
 
   // Get the URL of the source map

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-source-map-support.git



More information about the Pkg-javascript-commits mailing list