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

string-replace-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-replace-webpack-plugin - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

5

CHANGELOG.md

@@ -1,2 +0,5 @@

## v0.1.1
## v0.1.3
* Preserve source map after replacement (@rnons)
## v0.1.2
* Don't save options on the compiler for Webpack 2.2 compatibility (@CntChen)

@@ -3,0 +6,0 @@

9

loader.js

@@ -8,3 +8,4 @@ /*

module.exports = function(source) {
module.exports = function(source, map) {
var callback = this.async();
var id = loaderUtils.parseQuery(this.query).id;

@@ -27,4 +28,4 @@

this.cacheable && this.cacheable();
return source;
};
this.cacheable && this.cacheable();
callback(null, source, map);
};
{
"name": "string-replace-webpack-plugin",
"version": "0.1.2",
"version": "0.1.3",
"author": "James Andersen @jandersen78",

@@ -5,0 +5,0 @@ "description": "Replace string tokens in the contents of a file.",

@@ -6,3 +6,2 @@ /**

var StringReplacePlugin = require("./index.js");
var mockConfig = { options: {}, emitWarning: console.log };

@@ -66,4 +65,16 @@ describe('StringReplacePlugin', function(){

id = null,
query = null;
query = null,
replaced = null;
var callback = function() {
return function(_, source) {
replaced = source;
};
};
var mockConfig = {
options: {},
emitWarning: console.log,
async: callback
};
beforeEach(function(){

@@ -89,6 +100,6 @@ // runs before each test in this block

mockConfig.query = query;
var replaced = loader.call(mockConfig, "some string");
loader.call(mockConfig, "some string");
assert(replaced === "some string", "doesn't modify when there are no matches");
replaced = loader.call(mockConfig, "some <!-- @secret stuff --> string");
loader.call(mockConfig, "some <!-- @secret stuff --> string");
assert.equal(replaced, "some replaced ==>stuff<== string", "replaces matches");

@@ -117,9 +128,9 @@ });

var replaced = loader.call(mockConfig, "some string");
loader.call(mockConfig, "some string");
assert(replaced === "some string", "doesn't modify when there are no matches");
replaced = loader.call(mockConfig, "some <!-- @secret stuff --> string");
loader.call(mockConfig, "some <!-- @secret stuff --> string");
assert.equal(replaced, "some replaced ==>stuff<== string", "replaces matches");
});
})
});
});
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