rehype-og-card 1.0.1 → 1.0.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.
- package/dist/index.js +3 -4
- package/dist/util/cache.d.ts +1 -1
- package/dist/util/hast.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -60,7 +60,6 @@ const rehypeOGCard = (options) => {
|
|
|
60
60
|
const linkCardPromises = [];
|
|
61
61
|
// eslint-disable-next-line max-statements, max-lines-per-function
|
|
62
62
|
visitParents(tree, ["element", "text"], (node, ancestors) => {
|
|
63
|
-
var _a;
|
|
64
63
|
let anchorNode = null;
|
|
65
64
|
const isBareLink = node.type === "text" && isValidURL(node.value.trim());
|
|
66
65
|
const isValidAnchor = isAnchorElement(node) && isValidURL(node.properties.href);
|
|
@@ -91,7 +90,7 @@ const rehypeOGCard = (options) => {
|
|
|
91
90
|
if (!isTheOnlyChild)
|
|
92
91
|
return;
|
|
93
92
|
const targetURL = new URL(anchorNode.properties.href);
|
|
94
|
-
if (
|
|
93
|
+
if (mergedOptions.excludeDomains.includes(targetURL.hostname))
|
|
95
94
|
return;
|
|
96
95
|
// eslint-disable-next-line jsdoc/require-jsdoc, max-statements, max-lines-per-function
|
|
97
96
|
const linkCardPromise = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -112,7 +111,7 @@ const rehypeOGCard = (options) => {
|
|
|
112
111
|
url: OGData.OGImageURL,
|
|
113
112
|
userAgent: mergedOptions.crawlerUserAgent
|
|
114
113
|
});
|
|
115
|
-
if (filename
|
|
114
|
+
if (filename) {
|
|
116
115
|
OGData.OGImageURL = path.posix.join("/rehype-og-card", filename);
|
|
117
116
|
}
|
|
118
117
|
if (filename && mergedOptions.buildCache) {
|
|
@@ -127,7 +126,7 @@ const rehypeOGCard = (options) => {
|
|
|
127
126
|
url: OGData.faviconURL,
|
|
128
127
|
userAgent: mergedOptions.crawlerUserAgent
|
|
129
128
|
});
|
|
130
|
-
if (filename
|
|
129
|
+
if (filename) {
|
|
131
130
|
OGData.faviconURL = path.posix.join("/rehype-og-card", filename);
|
|
132
131
|
}
|
|
133
132
|
if (filename && mergedOptions.buildCache) {
|
package/dist/util/cache.d.ts
CHANGED
package/dist/util/hast.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rehype-og-card",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Rehype plugin to convert text links to link cards",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@changesets/changelog-github": "^0.5.0",
|
|
44
44
|
"@changesets/cli": "^2.27.7",
|
|
45
|
-
"@robot-inventor/eslint-config": "^0.
|
|
45
|
+
"@robot-inventor/eslint-config": "^2.0.0",
|
|
46
46
|
"@types/node": "^20.14.11",
|
|
47
47
|
"@types/sanitize-html": "^2.11.0",
|
|
48
48
|
"eslint": "^9.7.0",
|