Skip to content

Commit

Permalink
Fixed dependencies and deprecated code to support newer node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dscafati committed Feb 20, 2020
1 parent 3956f02 commit 365750c
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 65 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ language: node_js
cache: yarn
node_js:
- '10'
- '9'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A webpack loader for responsive images",
"main": "lib/index.js",
"engines": {
"node": ">=4"
"node": ">=10"
},
"scripts": {
"clean-test": "rm -f test/**/build/*.jpg test/**/build/*.png test/**/build/**/*.jpg test/**/build/**/*.png test/**/build/test.js",
Expand Down Expand Up @@ -50,7 +50,7 @@
"flow-bin": "^0.85.0",
"jest": "^20.0.4",
"jimp": "^0.2.21",
"sharp": "^0.18.2",
"sharp": "^0.22.1",
"webpack": "^3.1.0"
},
"jest": {
Expand Down
6 changes: 4 additions & 2 deletions src/adapters/sharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ module.exports = (imagePath: string) => {
.resize(width, null);

if (options.background) {
resized = resized.background(options.background)
.flatten();
resized = resized
.flatten({
background: options.background
});
}

if (mime === 'image/jpeg') {
Expand Down
26 changes: 13 additions & 13 deletions test/sharp/build/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ Object {
"images": Array [
Object {
"height": 450,
"path": "foobar/2834d341ca548e5e4b3027b97a24aea4-500.webp",
"path": "foobar/796c6c77e78ac26b66092d44b13ffa86-500.webp",
"width": 500,
},
Object {
"height": 675,
"path": "foobar/19a583b994d3541ea136ba3b22303970-750.webp",
"path": "foobar/4c247abefc3dc5043f1fdc2fb82806fe-750.webp",
"width": 750,
},
Object {
"height": 900,
"path": "foobar/b2df84fb5c0602160f9419076f04e2c8-1000.webp",
"path": "foobar/44d0fa043fec9770982b7c8c6fef6e60-1000.webp",
"width": 1000,
},
],
"placeholder": undefined,
"src": "foobar/2834d341ca548e5e4b3027b97a24aea4-500.webp",
"srcSet": "foobar/2834d341ca548e5e4b3027b97a24aea4-500.webp 500w,foobar/19a583b994d3541ea136ba3b22303970-750.webp 750w,foobar/b2df84fb5c0602160f9419076f04e2c8-1000.webp 1000w",
"src": "foobar/796c6c77e78ac26b66092d44b13ffa86-500.webp",
"srcSet": "foobar/796c6c77e78ac26b66092d44b13ffa86-500.webp 500w,foobar/4c247abefc3dc5043f1fdc2fb82806fe-750.webp 750w,foobar/44d0fa043fec9770982b7c8c6fef6e60-1000.webp 1000w",
"toString": [Function],
"width": 500,
}
Expand Down Expand Up @@ -210,18 +210,18 @@ Object {
"images": Array [
Object {
"height": 580,
"path": "foobar/a6f2ce9264ee809a8e2cffb90844e572-500.jpg",
"path": "foobar/85387501a9e125398851987bd78c027f-500.jpg",
"width": 500,
},
Object {
"height": 595,
"path": "foobar/76542004cc6e46b02bd7565388332cca-513.jpg",
"path": "foobar/149a3d69bc16ee3b406a4958420dc6f8-513.jpg",
"width": 513,
},
],
"placeholder": undefined,
"src": "foobar/a6f2ce9264ee809a8e2cffb90844e572-500.jpg",
"srcSet": "foobar/a6f2ce9264ee809a8e2cffb90844e572-500.jpg 500w,foobar/76542004cc6e46b02bd7565388332cca-513.jpg 513w",
"src": "foobar/85387501a9e125398851987bd78c027f-500.jpg",
"srcSet": "foobar/85387501a9e125398851987bd78c027f-500.jpg 500w,foobar/149a3d69bc16ee3b406a4958420dc6f8-513.jpg 513w",
"toString": [Function],
"width": 500,
}
Expand All @@ -233,18 +233,18 @@ Object {
"images": Array [
Object {
"height": 580,
"path": "foobar/c270ec5e9e9911545aae89eb6d87c836-500.webp",
"path": "foobar/d4aa90cbd7c0429641fbef9eb5b6025a-500.webp",
"width": 500,
},
Object {
"height": 595,
"path": "foobar/0b7833d83d7a580423f70a882f7a5f6a-513.webp",
"path": "foobar/a6d8432e0a3d9d88d972481808061dfe-513.webp",
"width": 513,
},
],
"placeholder": undefined,
"src": "foobar/c270ec5e9e9911545aae89eb6d87c836-500.webp",
"srcSet": "foobar/c270ec5e9e9911545aae89eb6d87c836-500.webp 500w,foobar/0b7833d83d7a580423f70a882f7a5f6a-513.webp 513w",
"src": "foobar/d4aa90cbd7c0429641fbef9eb5b6025a-500.webp",
"srcSet": "foobar/d4aa90cbd7c0429641fbef9eb5b6025a-500.webp 500w,foobar/a6d8432e0a3d9d88d972481808061dfe-513.webp 513w",
"toString": [Function],
"width": 500,
}
Expand Down
96 changes: 49 additions & 47 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ chokidar@^1.4.3, chokidar@^1.6.1:
optionalDependencies:
fsevents "^1.0.0"

chownr@^1.1.1, chownr@^1.1.3:
chownr@^1.1.1:
version "1.1.4"
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"

Expand Down Expand Up @@ -1059,7 +1059,7 @@ color-string@^1.5.2:
color-name "^1.0.0"
simple-swizzle "^0.2.2"

color@^3.1.2:
color@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/color/-/color-3.1.2.tgz#68148e7f85d41ad7649c5fa8c8106f098d229e10"
dependencies:
Expand Down Expand Up @@ -1701,11 +1701,15 @@ fs-constants@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"

fs-minipass@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb"
fs-copy-file-sync@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz#11bf32c096c10d126e5f6b36d06eece776062918"

fs-minipass@^1.2.5:
version "1.2.7"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7"
dependencies:
minipass "^3.0.0"
minipass "^2.6.0"

fs-readdir-recursive@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -2731,29 +2735,25 @@ minimist@^1.1.1, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minipass@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.1.tgz#7607ce778472a185ad6d89082aa2070f79cedcd5"
minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6"
dependencies:
yallist "^4.0.0"
safe-buffer "^5.1.2"
yallist "^3.0.0"

minizlib@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.0.tgz#fd52c645301ef09a63a2c209697c294c6ce02cf3"
minizlib@^1.2.1:
version "1.3.3"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d"
dependencies:
minipass "^3.0.0"
yallist "^4.0.0"
minipass "^2.9.0"

[email protected], "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"

mkdirp@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.3.tgz#4cf2e30ad45959dddea53ad97d518b6c8205e1ea"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand All @@ -2762,7 +2762,7 @@ [email protected]:
version "0.0.5"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0"

nan@^2.14.0:
nan@^2.13.2:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"

Expand Down Expand Up @@ -3112,7 +3112,7 @@ pngjs@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.2.0.tgz#fc9fcea1a8a375da54a51148019d5abd41dbabde"

prebuild-install@^5.3.3:
prebuild-install@^5.3.0:
version "5.3.3"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.3.tgz#ef4052baac60d465f5ba6bf003c9c1de79b9da8e"
dependencies:
Expand Down Expand Up @@ -3456,7 +3456,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

safe-buffer@~5.2.0:
safe-buffer@^5.1.2, safe-buffer@~5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"

Expand Down Expand Up @@ -3484,9 +3484,9 @@ semver@^5.4.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"

semver@^7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6"
semver@^6.0.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"

set-blocking@^2.0.0, set-blocking@~2.0.0:
version "2.0.0"
Expand All @@ -3506,18 +3506,19 @@ sha.js@^2.4.0, sha.js@^2.4.8:
dependencies:
inherits "^2.0.1"

sharp@^0.24.1:
version "0.24.1"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.24.1.tgz#f853f9f495dfde05d452179b4f9f31dfc400f4ca"
sharp@^0.22.1:
version "0.22.1"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.22.1.tgz#a67c0e75567f03dd5a7861b901fec04072c5b0f4"
dependencies:
color "^3.1.2"
color "^3.1.1"
detect-libc "^1.0.3"
nan "^2.14.0"
fs-copy-file-sync "^1.1.1"
nan "^2.13.2"
npmlog "^4.1.2"
prebuild-install "^5.3.3"
semver "^7.1.3"
simple-get "^3.1.0"
tar "^6.0.1"
prebuild-install "^5.3.0"
semver "^6.0.0"
simple-get "^3.0.3"
tar "^4.4.8"
tunnel-agent "^0.6.0"

shelljs@^0.7.5:
Expand All @@ -3540,7 +3541,7 @@ simple-concat@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6"

simple-get@^3.0.3, simple-get@^3.1.0:
simple-get@^3.0.3:
version "3.1.0"
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
dependencies:
Expand Down Expand Up @@ -3783,16 +3784,17 @@ tar@^2.2.1:
fstream "^1.0.2"
inherits "2"

tar@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.0.1.tgz#7b3bd6c313cb6e0153770108f8d70ac298607efa"
tar@^4.4.8:
version "4.4.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
dependencies:
chownr "^1.1.3"
fs-minipass "^2.0.0"
minipass "^3.0.0"
minizlib "^2.1.0"
mkdirp "^1.0.3"
yallist "^4.0.0"
chownr "^1.1.1"
fs-minipass "^1.2.5"
minipass "^2.8.6"
minizlib "^1.2.1"
mkdirp "^0.5.0"
safe-buffer "^5.1.2"
yallist "^3.0.3"

test-exclude@^4.1.1:
version "4.1.1"
Expand Down Expand Up @@ -4138,9 +4140,9 @@ y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
yallist@^3.0.0, yallist@^3.0.3:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"

yargs-parser@^4.2.0:
version "4.2.1"
Expand Down

0 comments on commit 365750c

Please sign in to comment.