Socket
Socket
Sign inDemoInstall

source-map

Package Overview
Dependencies
0
Maintainers
19
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.3 to 0.7.4

29

lib/read-wasm.js

@@ -1,18 +0,27 @@

if (typeof fetch === "function") {
/* Determine browser vs node environment by testing the default top level context. Solution courtesy of: https://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */
const isBrowserEnvironment = (function() {
// eslint-disable-next-line no-undef
return (typeof window !== "undefined") && (this === window);
}).call();
if (isBrowserEnvironment) {
// Web version of reading a wasm file into an array buffer.
let mappingsWasmUrl = null;
let mappingsWasm = null;
module.exports = function readWasm() {
if (typeof mappingsWasmUrl !== "string") {
throw new Error("You must provide the URL of lib/mappings.wasm by calling " +
"SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " +
"before using SourceMapConsumer");
if (typeof mappingsWasm === "string") {
return fetch(mappingsWasm)
.then(response => response.arrayBuffer());
}
return fetch(mappingsWasmUrl)
.then(response => response.arrayBuffer());
if (mappingsWasm instanceof ArrayBuffer) {
return Promise.resolve(mappingsWasm);
}
throw new Error("You must provide the string URL or ArrayBuffer contents " +
"of lib/mappings.wasm by calling " +
"SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " +
"before using SourceMapConsumer");
};
module.exports.initialize = url => mappingsWasmUrl = url;
module.exports.initialize = input => mappingsWasm = input;
} else {

@@ -19,0 +28,0 @@ // Node version of reading a wasm file into an array buffer.

@@ -67,26 +67,9 @@ /* -*- Mode: js; js-indent-level: 2; -*- */

*/
static with(rawSourceMap, sourceMapUrl, f) {
// Note: The `acorn` version that `webpack` currently depends on doesn't
// support `async` functions, and the nodes that we support don't all have
// `.finally`. Therefore, this is written a bit more convolutedly than it
// should really be.
let consumer = null;
const promise = new SourceMapConsumer(rawSourceMap, sourceMapUrl);
return promise
.then(c => {
consumer = c;
return f(c);
})
.then(x => {
if (consumer) {
consumer.destroy();
}
return x;
}, e => {
if (consumer) {
consumer.destroy();
}
throw e;
});
static async with(rawSourceMap, sourceMapUrl, f) {
const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl);
try {
return await f(consumer);
} finally {
consumer.destroy();
}
}

@@ -93,0 +76,0 @@

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

@@ -78,3 +78,3 @@ "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",

"devDependencies": {
"doctoc": "^0.15.0",
"doctoc": "^1.3.1",
"eslint": "^4.19.1",

@@ -85,3 +85,4 @@ "live-server": "^1.2.0",

"watch": "^1.0.2",
"webpack": "^3.10"
"webpack": "^4.9.1",
"webpack-cli": "^3.1"
},

@@ -88,0 +89,0 @@ "nyc": {

@@ -211,3 +211,3 @@ # Source Map

* `"lib/mappings.wasm"`: A `String` containing the URL of the
`lib/mappings.wasm` file.
`lib/mappings.wasm` file, or an `ArrayBuffer` with the contents of `lib/mappings.wasm`.

@@ -214,0 +214,0 @@ ```js

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc