Socket
Socket
Sign inDemoInstall

webpack-sources

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-sources - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

0

lib/CachedSource.js

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

3

lib/PrefixSource.js

@@ -39,6 +39,5 @@ /*

var map = this._source.listMap(options);
map.mapGeneratedCode(function(code) {
return map.mapGeneratedCode(function(code) {
return prefix + code.replace(REPLACE_REGEX, "\n" + prefix);
});
return map;
};

@@ -45,0 +44,0 @@

@@ -0,0 +0,0 @@ /*

@@ -95,23 +95,50 @@ /*

ReplaceSource.prototype.listMap = function(options) {
this._sortReplacements();
var map = this._source.listMap(options);
if(map.children.length !== 1) {
var code = map.toString();
code = this._replaceString(code).split("\n");
var currentIndex = 0;
map.mapGeneratedCode(function(str) {
var idx = -1;
var count = -1;
do {
count++;
idx = str.indexOf("\n", idx + 1);
} while (idx >= 0);
if(!count) return "";
var result = code.slice(currentIndex, currentIndex + count).join("\n") + "\n";
currentIndex += count;
return result;
});
map.add(code.slice(currentIndex).join("\n"));
} else {
map.mapGeneratedCode(this._replaceString.bind(this));
var currentIndex = 0;
var replacements = this.replacements;
var idxReplacement = replacements.length - 1;
var removeChars = 0;
map = map.mapGeneratedCode(function(str) {
var newCurrentIndex = currentIndex + str.length;
if(removeChars > str.length) {
removeChars -= str.length;
str = "";
} else {
if(removeChars > 0) {
str = str.substr(removeChars);
currentIndex += removeChars;
removeChars = 0;
}
var finalStr = "";
while(idxReplacement >= 0 && replacements[idxReplacement][0] < newCurrentIndex) {
var repl = replacements[idxReplacement];
var start = Math.floor(repl[0]);
var end = Math.floor(repl[1] + 1);
var before = str.substr(0, Math.max(0, start - currentIndex));
if(end <= newCurrentIndex) {
var after = str.substr(Math.max(0, end - currentIndex));
finalStr += before + repl[2];
str = after;
currentIndex = Math.max(currentIndex, end);
} else {
finalStr = before + repl[2];
str = "";
removeChars = end - newCurrentIndex;
}
idxReplacement--;
}
str = finalStr + str;
}
currentIndex = newCurrentIndex;
return str;
});
var extraCode = "";
while(idxReplacement >= 0) {
extraCode += replacements[idxReplacement][2];
idxReplacement--;
}
if(extraCode) {
map.add(extraCode);
}
return map;

@@ -118,0 +145,0 @@ };

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

{
"name": "webpack-sources",
"version": "0.1.5",
"version": "0.2.0",
"description": "Source code handling classes for webpack",

@@ -19,3 +19,3 @@ "main": "./lib/index.js",

"source-map": "~0.5.3",
"source-list-map": "~0.1.7"
"source-list-map": "^1.0.1"
},

@@ -22,0 +22,0 @@ "devDependencies": {

@@ -0,0 +0,0 @@ # webpack-sources

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