Socket
Socket
Sign inDemoInstall

lodash-webpack-plugin

Package Overview
Dependencies
1
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

43

lib/index.js

@@ -23,14 +23,18 @@ 'use strict';

var reLodash = RegExp('/lodash(?:-amd|-es)?/');
var reLodash = RegExp('/lodash(?:/(?!fp/)|-es/|-amd/)');
var LodashModuleReplacementPlugin = function () {
function LodashModuleReplacementPlugin(options) {
var _this = this;
_classCallCheck(this, LodashModuleReplacementPlugin);
options || (options = {});
var replacements = this.replacements = [];
this.matches = [];
this.patterns = [];
_lodash2.default.forOwn(_mapping.features, function (pairs, key) {
if (!options[key]) {
_lodash2.default.each(pairs, function (pair) {
replacements.push(['/' + pair[0] + '.js', './' + pair[1] + '.js']);
_this.patterns.push(['/' + pair[0] + '.js', './' + pair[1] + '.js']);
});

@@ -44,3 +48,20 @@ }

value: function apply(compiler) {
var replacements = this.replacements;
var _this2 = this;
var resolvePath = _lodash2.default.memoize(function (resource) {
if (reLodash.test(resource)) {
var length = _this2.patterns.length;
while (length--) {
var pair = _this2.patterns[length];
if (_lodash2.default.endsWith(resource, pair[0])) {
var result = _path2.default.resolve(_path2.default.dirname(resource), pair[1]);
_this2.matches.push([resource, result]);
return result;
}
}
}
return resource;
});
compiler.plugin('normal-module-factory', function (nmf) {

@@ -51,15 +72,3 @@ nmf.plugin('after-resolve', function (result, callback) {

}
var resource = result.resource;
if (reLodash.test(resource)) {
var length = replacements.length;
while (length--) {
var pair = replacements[length];
if (_lodash2.default.endsWith(resource, pair[0])) {
result.resource = _path2.default.resolve(_path2.default.dirname(resource), pair[1]);
break;
}
}
}
result.resource = resolvePath(result.resource);
return callback(null, result);

@@ -66,0 +75,0 @@ });

{
"name": "lodash-webpack-plugin",
"version": "0.1.1",
"version": "0.2.0",
"description": "Smaller modular Lodash builds.",

@@ -5,0 +5,0 @@ "keywords": "webpack-plugin, lodash, modules",

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

# lodash-webpack-plugin v0.1.1
# lodash-webpack-plugin v0.2.0

@@ -60,6 +60,6 @@ Create smaller Lodash builds by replacing [feature sets](#feature-sets) of modules

| Feature | Description |
| Feature | Description |
|:---|:---|
| `shorthands` | Iteratee shorthands for `_.property`, `_.matches`, & `_.matchesProperty`. |
| `collections` | Support for objects in “Collection” methods like `_.each`, `_.filter`, & `_.map`. |
| `collections` | Support objects in “Collection” methods like `_.each`, `_.filter`, & `_.map`. |
| `currying` | Support for `_.curry` & `_.curryRight`. |

@@ -66,0 +66,0 @@ | `caching` | Caches using `Map` & `Set` for methods like `_.cloneDeep`, `_.isEqual`, & `_.uniq`. |

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc