@chrisburnell/eleventy-cache-webmentions 2.1.9 → 2.1.11
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
|
-
{"cachedAt":
|
|
1
|
+
{"cachedAt":1757351055738,"type":"json","metadata":{}}
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> Cache webmentions using eleventy-fetch and make them available to use in collections, layouts, pages, etc. in Eleventy.
|
|
4
4
|
|
|
5
|
+
[](https://github.com/chrisburnell/eleventy-cache-webmentions/actions/workflows/npm-publish.yml) [](https://www.npmjs.com/package/@chrisburnell/eleventy-cache-webmentions)
|
|
6
|
+
|
|
5
7
|
## Breaking change for v2.0.0
|
|
6
8
|
|
|
7
9
|
Version 2.0.0 introduces a breaking change for those migrating from earlier versions of the plugin. This affects usage of the plugin from JavaScript files; specifically, you will need to make a small change to the way that you `require()` the plugin by removing an extra set of parentheses:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const sanitizeHTML = require("sanitize-html");
|
|
2
2
|
const { AssetCache } = require("@11ty/eleventy-fetch");
|
|
3
|
-
const
|
|
3
|
+
const { styleText } = require("node:util");
|
|
4
4
|
|
|
5
5
|
const defaults = {
|
|
6
6
|
refresh: false,
|
|
@@ -24,9 +24,11 @@ const absoluteURL = (url, domain) => {
|
|
|
24
24
|
return new URL(url, domain).toString();
|
|
25
25
|
} catch (e) {
|
|
26
26
|
console.error(
|
|
27
|
-
`Trying to convert ${
|
|
27
|
+
`Trying to convert ${styleText(
|
|
28
|
+
"bold",
|
|
28
29
|
url,
|
|
29
|
-
)} to be an absolute url with base ${
|
|
30
|
+
)} to be an absolute url with base ${styleText(
|
|
31
|
+
"bold",
|
|
30
32
|
domain,
|
|
31
33
|
)} and failed.`,
|
|
32
34
|
);
|
|
@@ -193,9 +195,10 @@ const performFetch = async (options, webmentions, url) => {
|
|
|
193
195
|
|
|
194
196
|
if (!options.key in feed) {
|
|
195
197
|
console.log(
|
|
196
|
-
`${
|
|
198
|
+
`${styleText("grey", `[${hostname(options.domain)}]`)} ${
|
|
197
199
|
options.key
|
|
198
|
-
} was not found as a key in the response from ${
|
|
200
|
+
} was not found as a key in the response from ${styleText(
|
|
201
|
+
"bold",
|
|
199
202
|
hostname(options.feed),
|
|
200
203
|
)}!`,
|
|
201
204
|
);
|
|
@@ -225,14 +228,21 @@ const performFetch = async (options, webmentions, url) => {
|
|
|
225
228
|
};
|
|
226
229
|
})
|
|
227
230
|
.catch((error) => {
|
|
228
|
-
console.
|
|
229
|
-
`${
|
|
231
|
+
console.warn(
|
|
232
|
+
`${styleText(
|
|
233
|
+
"grey",
|
|
230
234
|
`[${hostname(options.domain)}]`,
|
|
231
|
-
)} Something went wrong with your request to ${
|
|
235
|
+
)} Something went wrong with your Webmention request to ${styleText(
|
|
236
|
+
"bold",
|
|
232
237
|
hostname(options.feed),
|
|
233
238
|
)}!`,
|
|
234
|
-
error,
|
|
235
239
|
);
|
|
240
|
+
console.warn(error instanceof Error ? error.message : error);
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
found: 0,
|
|
244
|
+
filtered: webmentions,
|
|
245
|
+
};
|
|
236
246
|
});
|
|
237
247
|
};
|
|
238
248
|
|
|
@@ -348,9 +358,14 @@ const fetchWebmentions = async (options) => {
|
|
|
348
358
|
// Add a console message with the number of fetched and processed Webmentions, if any
|
|
349
359
|
if (webmentionsCachedLength < webmentions.length) {
|
|
350
360
|
console.log(
|
|
351
|
-
`${
|
|
352
|
-
|
|
353
|
-
|
|
361
|
+
`${styleText(
|
|
362
|
+
"grey",
|
|
363
|
+
`[${hostname(options.domain)}]`,
|
|
364
|
+
)} ${styleText(
|
|
365
|
+
"bold",
|
|
366
|
+
String(webmentions.length - webmentionsCachedLength),
|
|
367
|
+
)} new Webmentions fetched into cache in ${styleText(
|
|
368
|
+
"bold",
|
|
354
369
|
(performance[0] + performance[1] / 1e9).toFixed(3) +
|
|
355
370
|
" seconds",
|
|
356
371
|
)}.`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrisburnell/eleventy-cache-webmentions",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
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": {
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@11ty/eleventy-fetch": "^5.1.0",
|
|
58
|
-
"chalk": "4.1.2",
|
|
59
58
|
"sanitize-html": "^2.17.0"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|