@chrisburnell/eleventy-cache-webmentions 2.1.8 → 2.1.9-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- [{"68a403136c61abd104ade94e69ba62":"1"},{"cachedAt":1723708494710,"type":"2"},"json"]
1
+ [["1"],{"key":"2","value":"3"},"68a403136c61abd104ade94e69ba62",{"cachedAt":1734732130609,"type":"4","metadata":"5"},"json",{}]
@@ -1,6 +1,5 @@
1
1
  const fetch = require("node-fetch");
2
2
  const sanitizeHTML = require("sanitize-html");
3
- const uniqBy = require("lodash.uniqby");
4
3
  const { AssetCache } = require("@11ty/eleventy-fetch");
5
4
  const chalk = require("chalk");
6
5
 
@@ -136,9 +135,20 @@ const getByTypes = (webmentions, allowedTypes) => {
136
135
  };
137
136
 
138
137
  const removeDuplicates = (webmentions) => {
139
- return uniqBy(webmentions, (webmention) => {
140
- return getSource(webmention);
141
- });
138
+ return [
139
+ ...webmentions
140
+ .reduce((map, webmention) => {
141
+ const key =
142
+ webmention === null || webmention === undefined
143
+ ? webmention
144
+ : getSource(webmention);
145
+ if (!map.has(key)) {
146
+ map.set(key, webmention);
147
+ }
148
+ return map;
149
+ }, new Map())
150
+ .values(),
151
+ ];
142
152
  };
143
153
 
144
154
  const processBlocklist = (webmentions, blocklist) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisburnell/eleventy-cache-webmentions",
3
- "version": "2.1.8",
3
+ "version": "2.1.9-beta.2",
4
4
  "description": "Cache webmentions using eleventy-fetch and make them available to use in collections, layouts, pages, etc. in Eleventy.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,14 +51,13 @@
51
51
  "webmention"
52
52
  ],
53
53
  "dependencies": {
54
- "@11ty/eleventy-fetch": "^4.0.1",
55
- "chalk": "^4.1.2",
56
- "lodash.uniqby": "^4.7.0",
54
+ "@11ty/eleventy-fetch": "^5.0.1",
55
+ "chalk": "4.1.2",
57
56
  "node-fetch": "2.6.7",
58
- "sanitize-html": "^2.13.0"
57
+ "sanitize-html": "^2.14.0"
59
58
  },
60
59
  "devDependencies": {
61
- "eslint": "^9.8.0",
62
- "nock": "^13.5.4"
60
+ "eslint": "^9.17.0",
61
+ "nock": "^13.5.6"
63
62
  }
64
63
  }