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

webpack-merge

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-merge - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

0.14.1 / 2016-07-25
===================
* Docs: Improve package description. #23.
* Bug fix - Let `merge.smart` merge loaders based on their full name instead of first letter. Thanks to @choffmeister. #26.
0.14.0 / 2016-06-05

@@ -2,0 +8,0 @@ ===================

2

lib/index.js

@@ -11,3 +11,3 @@ 'use strict';

var loaderNameRe = new RegExp(/[a-z\-]/ig);
var loaderNameRe = /^([^\?]+)/ig;

@@ -14,0 +14,0 @@ function mergeLoaders(currentLoaders, newLoaders) {

@@ -5,3 +5,3 @@ {

"author": "Juho Vepsalainen <bebraw@gmail.com>",
"version": "0.14.0",
"version": "0.14.1",
"scripts": {

@@ -11,5 +11,5 @@ "build": "babel src -d lib",

"test": "mocha ./test",
"lint": "eslint .",
"test:lint": "eslint . ---cache",
"watch:test": "mocha ./test --watch",
"preversion": "npm run lint && npm run build && npm test && git commit --allow-empty -am \"Update lib\""
"preversion": "npm run test:lint && npm run build && npm test && git commit --allow-empty -am \"Update lib\""
},

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

"eslint-config-airbnb": "^2.1.1",
"git-prepush-hook": "^1.0.1",
"mocha": "^2.2.5"

@@ -43,3 +44,8 @@ },

],
"license": "MIT"
"license": "MIT",
"pre-push": [
"test:lint",
"build",
"test"
]
}
[![build status](https://secure.travis-ci.org/survivejs/webpack-merge.png)](http://travis-ci.org/survivejs/webpack-merge)
# webpack-merge - Merge designed for Webpack
Normal merge function isn't that useful with webpack configuration as it will override object keys and arrays by default. It is more beneficial to concatenate arrays instead. This little helper achieves just that.
**webpack-merge** provides a `merge` function that concatenates arrays and merges objects. This behavior is particularly useful in configuring webpack. There's also a webpack specific merge variant known as `merge.smart` that's able to take webpack specifics into account (i.e., it can flatten loader definitions).

@@ -224,2 +224,4 @@ ## API

* [Matt Shwery](https://github.com/mshwery) - If `exclude` is the same while using `merge.smart`, merge `loaders`.
* [Lucretiel](https://github.com/Lucretiel) - Added a more generic test to describe merge behavior better.
* [Christian Hoffmeister](https://github.com/choffmeister) - Fix `merge.smart` behavior so that it checks against full loader names instead of just the first letter.

@@ -226,0 +228,0 @@ ## License

@@ -7,3 +7,3 @@ const isArray = Array.isArray;

const loaderNameRe = new RegExp(/[a-z\-]/ig);
const loaderNameRe = /^([^\?]+)/ig;

@@ -10,0 +10,0 @@ function mergeLoaders(currentLoaders, newLoaders) {

@@ -242,2 +242,50 @@ /* eslint-env mocha */

it('should compare loaders by their whole name ' + loadersKey, function () {
const a = {};
a[loadersKey] = [{
test: /\.js$/,
loaders: ['aa']
}];
const b = {};
b[loadersKey] = [{
test: /\.js$/,
loaders: ['ab']
}];
const result = {};
result[loadersKey] = [{
test: /\.js$/,
// loaders are evaluated from right to left so it makes sense to
// prepend here!!! this is an exception given normally we want to
// append instead. without this the loader order doesn't make
// any sense in this case
loaders: ['ab', 'aa']
}];
assert.deepEqual(merge(a, b), result);
});
it('should be able to merge loaders referenced by path with ' + loadersKey, function () {
const a = {};
a[loadersKey] = [{
test: /\.js$/,
loaders: ['/foo/bar-a.js?a=b']
}];
const b = {};
b[loadersKey] = [{
test: /\.js$/,
loaders: ['/foo/bar-b.js?c=d']
}];
const result = {};
result[loadersKey] = [{
test: /\.js$/,
// loaders are evaluated from right to left so it makes sense to
// prepend here!!! this is an exception given normally we want to
// append instead. without this the loader order doesn't make
// any sense in this case
loaders: ['/foo/bar-b.js?c=d', '/foo/bar-a.js?a=b']
}];
assert.deepEqual(merge(a, b), result);
});
it('should prepend loader and loaders with ' + loadersKey, function () {

@@ -776,2 +824,19 @@ const a = {};

it('should deeply merge objects', function () {
const a = {
foo: { bar: 'a' }
};
const b = {
foo: { baz: 'b' }
};
const result = {
foo: {
bar: 'a',
baz: 'b'
}
};
assert.deepEqual(merge(a, b), result);
});
it('should not error when there are no matching loaders', function () {

@@ -778,0 +843,0 @@ const a = {

Sorry, the diff of this file is not supported yet

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