From 6125abd44785da5396c52ef5733c0ec1f0cd36da Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 25 Aug 2019 14:30:35 +0300 Subject: [PATCH 1/2] Replace lodash._last with a native way. --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 248b0cf..0f26f97 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ const postcss = require('postcss'); const debug = require('debug')('image-inliner'); -const last = require('lodash/last'); const escapeRegExp = require('lodash/escapeRegExp'); const {getDataUriMapping} = require('./lib/image'); @@ -18,7 +17,7 @@ const loop = cb => { return decl => { let match; while ((match = matcher.exec(decl.value)) !== null) { - cb({decl, url: last(match)}); + cb({decl, url: match[match.length - 1]}); } }; }; From 1278da13bda721fab31fd9295612e39b55fbc167 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 25 Aug 2019 14:31:48 +0300 Subject: [PATCH 2/2] Replace `_.escapeRegExp` with `escape-string-regexp`. --- index.js | 2 +- package-lock.json | 25 ++++++++++++++++++++++--- package.json | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 0f26f97..092b50e 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const postcss = require('postcss'); const debug = require('debug')('image-inliner'); -const escapeRegExp = require('lodash/escapeRegExp'); +const escapeRegExp = require('escape-string-regexp'); const {getDataUriMapping} = require('./lib/image'); const DEFAULTS = { diff --git a/package-lock.json b/package-lock.json index 70d3a66..bb0ddf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -465,6 +465,11 @@ "supports-color": "^5.3.0" }, "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -962,9 +967,9 @@ "dev": true }, "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" }, "eslint": { "version": "6.2.2", @@ -1315,6 +1320,14 @@ "dev": true, "requires": { "escape-string-regexp": "^1.0.5" + }, + "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + } } }, "file-entry-cache": { @@ -2347,6 +2360,12 @@ "ms": "^2.1.1" } }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", diff --git a/package.json b/package.json index 8bfe549..7fd15c9 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "dependencies": { "asset-resolver": "^2.0.2", "debug": "^4.1.1", + "escape-string-regexp": "^2.0.0", "filesize": "^4.1.2", - "lodash": "^4.17.15", "postcss": "^7.0.17", "svgo": "^1.3.0" },