Skip to content

Commit f452942

Browse files
Bump srcset from 3.0.1 to 5.0.0 (#477)
* Bump srcset from 3.0.1 to 5.0.0 Bumps [srcset](https://github.com/sindresorhus/srcset) from 3.0.1 to 5.0.0. - [Release notes](https://github.com/sindresorhus/srcset/releases) - [Commits](sindresorhus/srcset@v3.0.1...v5.0.0) --- updated-dependencies: - dependency-name: srcset dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Update srcset usage, replace _.filter Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sophia Antipenko <[email protected]>
1 parent 6376e4e commit f452942

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/resource-handler/path-containers/html-img-srcset-tag.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import srcset from 'srcset';
2-
import _ from 'lodash';
1+
import { parseSrcset, stringifySrcset } from 'srcset';
32

43
class HtmlImgSrcSetTag {
54
constructor (text) {
65
this.text = text || '';
7-
this.imgSrcsetParts = srcset.parse(this.text);
6+
this.imgSrcsetParts = parseSrcset(this.text);
87
this.paths = this.imgSrcsetParts.map(imgSrcset => imgSrcset.url);
98
}
109

@@ -14,13 +13,13 @@ class HtmlImgSrcSetTag {
1413

1514
updateText (pathsToUpdate) {
1615
const imgSrcsetParts = this.imgSrcsetParts;
17-
pathsToUpdate.forEach(function updatePath (path) {
18-
const srcsToUpdate = _.filter(imgSrcsetParts, {url: path.oldPath});
16+
pathsToUpdate.forEach((path) => {
17+
const srcsToUpdate = imgSrcsetParts.filter(imgSrcsetPart => imgSrcsetPart.url === path.oldPath);
1918
srcsToUpdate.forEach((srcToUpdate) => {
2019
srcToUpdate.url = path.newPath;
2120
});
2221
});
23-
return srcset.stringify(imgSrcsetParts);
22+
return stringifySrcset(imgSrcsetParts);
2423
}
2524
}
2625

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"normalize-url": "^7.0.2",
4848
"p-queue": "^7.1.0",
4949
"sanitize-filename": "^1.6.3",
50-
"srcset": "^3.0.0"
50+
"srcset": "^5.0.0"
5151
},
5252
"devDependencies": {
5353
"c8": "^7.7.2",

0 commit comments

Comments
 (0)