From 7116879bb9949104bba1c352497dedffe0afcd26 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Wed, 1 Jul 2020 23:27:26 +0300 Subject: [PATCH] Replace deep-extend with nested Object.assign deep-extend is only used to handle one nested options object. In this diff I replaced dependency with native Object.assign and handled "webResources" as special case similar to special case in cli options definitions. --- bin/juice | 9 +++++++-- package-lock.json | 5 ----- package.json | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/juice b/bin/juice index 2f1bf89..c8145b2 100755 --- a/bin/juice +++ b/bin/juice @@ -2,7 +2,6 @@ var juice = require('..'); var cli = require('../lib/cli'); -var xtend = require('deep-extend'); var fs = require('fs'); var path = require('path'); @@ -17,7 +16,13 @@ var queue = []; if (options.optionsFile) { var optionsFromFile = require(path.resolve(process.cwd(),options.optionsFile)); - options = xtend({}, optionsFromFile, options); + options = Object.assign({}, optionsFromFile, options, { + webResources: Object.assign( + {}, + optionsFromFile && optionsFromFile.webResources, + options && options.webResources + ) + }); } if (options.cssFile) { diff --git a/package-lock.json b/package-lock.json index c2d39f8..728d64a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -714,11 +714,6 @@ "ms": "2.0.0" } }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" - }, "defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", diff --git a/package.json b/package.json index f8f5bf6..9166119 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "dependencies": { "cheerio": "^0.22.0", "commander": "^2.15.1", - "deep-extend": "^0.6.0", "mensch": "^0.3.4", "slick": "^1.12.2", "web-resource-inliner": "^4.3.3"