webpack-merge
Advanced tools
Comparing version 5.7.3 to 5.8.0
# Changelog | ||
## 5.8.0 / 2021-06-07 | ||
- Docs - Update `env` example to be webpack 5 compatible. #177, #180 | ||
- Feat - Support strings as rules for TypeScript, not just enums. #179, #185 | ||
## 5.7.3 / 2020-12-22 | ||
@@ -4,0 +9,0 @@ |
import unique from "./unique"; | ||
import { CustomizeRule, ICustomizeOptions, Key } from "./types"; | ||
import { CustomizeRule, CustomizeRuleString, ICustomizeOptions, Key } from "./types"; | ||
declare function merge<Configuration extends object>(firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]): Configuration; | ||
declare function mergeWithCustomize<Configuration extends object>(options: ICustomizeOptions): (firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]) => Configuration; | ||
declare function customizeArray(rules: { | ||
[s: string]: CustomizeRule; | ||
[s: string]: CustomizeRule | CustomizeRuleString; | ||
}): (a: any, b: any, key: Key) => any; | ||
declare type Rules = { | ||
[s: string]: CustomizeRule | Rules; | ||
[s: string]: CustomizeRule | CustomizeRuleString | Rules; | ||
}; | ||
declare function mergeWithRules(rules: Rules): (firstConfiguration: object | object[], ...configurations: object[]) => object; | ||
declare function customizeObject(rules: { | ||
[s: string]: CustomizeRule; | ||
[s: string]: CustomizeRule | CustomizeRuleString; | ||
}): (a: any, b: any, key: Key) => any; | ||
export { customizeArray, customizeObject, CustomizeRule, merge, merge as default, mergeWithCustomize, mergeWithRules, unique, }; |
@@ -29,5 +29,6 @@ "use strict"; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -52,3 +53,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
} | ||
return mergeWithCustomize({}).apply(void 0, __spread([firstConfiguration], configurations)); | ||
return mergeWithCustomize({}).apply(void 0, __spreadArray([firstConfiguration], __read(configurations))); | ||
} | ||
@@ -101,3 +102,3 @@ exports.merge = merge; | ||
case types_1.CustomizeRule.Prepend: | ||
return __spread(b, a); | ||
return __spreadArray(__spreadArray([], __read(b)), __read(a)); | ||
case types_1.CustomizeRule.Replace: | ||
@@ -107,3 +108,3 @@ return b; | ||
default: | ||
return __spread(a, b); | ||
return __spreadArray(__spreadArray([], __read(a)), __read(b)); | ||
} | ||
@@ -227,3 +228,3 @@ } | ||
.reduce(function (acc, val) { | ||
return isArray(acc) && isArray(val) ? __spread(acc, val) : acc; | ||
return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc)), __read(val)) : acc; | ||
}, []); | ||
@@ -230,0 +231,0 @@ ret[k] = mergeWithRule({ currentRule: currentRule_1, a: v, b: b_1 }); |
@@ -18,5 +18,6 @@ "use strict"; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -41,3 +42,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
} | ||
return _joinArrays(a.apply(void 0, __spread(args)), b.apply(void 0, __spread(args)), k); | ||
return _joinArrays(a.apply(void 0, __spreadArray([], __read(args))), b.apply(void 0, __spreadArray([], __read(args))), k); | ||
}; | ||
@@ -47,3 +48,3 @@ } | ||
var customResult = customizeArray && customizeArray(a, b, newKey); | ||
return customResult || __spread(a, b); | ||
return customResult || __spreadArray(__spreadArray([], __read(a)), __read(b)); | ||
} | ||
@@ -66,3 +67,3 @@ if (utils_1.isRegex(b)) { | ||
if (isArray(b)) { | ||
return __spread(b); | ||
return __spreadArray([], __read(b)); | ||
} | ||
@@ -69,0 +70,0 @@ return b; |
@@ -14,1 +14,2 @@ export declare type Key = string; | ||
} | ||
export declare type CustomizeRuleString = "match" | "merge" | "append" | "prepend" | "replace"; |
@@ -18,5 +18,6 @@ "use strict"; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -27,3 +28,3 @@ exports.__esModule = true; | ||
return function (a, b, k) { | ||
return (k === key) && Array.from(__spread(a, b).map(function (it) { return ({ key: getter(it), value: it }); }) | ||
return (k === key) && Array.from(__spreadArray(__spreadArray([], __read(a)), __read(b)).map(function (it) { return ({ key: getter(it), value: it }); }) | ||
.map(function (_a) { | ||
@@ -30,0 +31,0 @@ var key = _a.key, value = _a.value; |
declare function isRegex(o: any): boolean; | ||
declare function isFunction(functionToCheck: any): boolean; | ||
declare function isFunction(functionToCheck: any): any; | ||
declare function isPlainObject(a: any): boolean; | ||
declare function isUndefined(a: any): boolean; | ||
export { isRegex, isFunction, isPlainObject, isUndefined }; |
@@ -5,3 +5,3 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "5.7.3", | ||
"version": "5.8.0", | ||
"scripts": { | ||
@@ -24,9 +24,9 @@ "build": "tsc", | ||
"devDependencies": { | ||
"@types/estree": "0.0.45", | ||
"husky": "^4.3.0", | ||
"prettier": "^2.1.2", | ||
"@types/estree": "0.0.48", | ||
"husky": "^6.0.0", | ||
"prettier": "^2.3.1", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.5", | ||
"webpack": "^5.3.2" | ||
"tslib": "^2.2.0", | ||
"typescript": "^4.3.2", | ||
"webpack": "^5.38.1" | ||
}, | ||
@@ -33,0 +33,0 @@ "repository": { |
@@ -47,4 +47,4 @@ [![Financial Contributors on Open Collective](https://opencollective.com/webpack-merge/all/badge.svg?label=financial+contributors)](https://opencollective.com/webpack-merge) [![build status](https://secure.travis-ci.org/survivejs/webpack-merge.svg)](http://travis-ci.org/survivejs/webpack-merge) [![codecov](https://codecov.io/gh/survivejs/webpack-merge/branch/master/graph/badge.svg)](https://codecov.io/gh/survivejs/webpack-merge) | ||
module.exports = env => { | ||
switch(env) { | ||
module.exports = (env, args) => { | ||
switch(args.mode) { | ||
case 'development': | ||
@@ -60,3 +60,3 @@ return merge(commonConfig, developmentConfig); | ||
You can choose the configuration you want by using `webpack --env development` assuming you are using _webpack-cli_. | ||
You can choose the configuration you want by using `webpack --mode development` assuming you are using _webpack-cli_. | ||
@@ -63,0 +63,0 @@ ## **`mergeWithCustomize({ customizeArray, customizeObject })(...configuration | [...configuration])`** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57232
486