vitepress-linkcard 1.2.6 → 1.2.8
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/README.md +2 -2
- package/dist/.cjs.min.js +1 -1
- package/dist/.esm.min.js +1 -1
- package/dist/assemble/html.js +2 -1
- package/dist/assemble/parser.js +3 -1
- package/dist/assemble/xhr.js +3 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ vitepress-linkcard
|
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
|
|
7
|
-
**A
|
|
7
|
+
**A VitePress plugin to generate a pretty linkcard with OGP.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A blog generated with this plugin is [here](https://asumoranda.com/posts/10-vitepress-linkcard.html).
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/vitepress-linkcard)
|
|
12
12
|
[](https://www.npmjs.com/package/vitepress-linkcard)
|
package/dist/.cjs.min.js
CHANGED
package/dist/.esm.min.js
CHANGED
package/dist/assemble/html.js
CHANGED
|
@@ -24,7 +24,8 @@ export const generateCardDomFragment = (data, options) => {
|
|
|
24
24
|
.replace(/'/g, "'");
|
|
25
25
|
const style = STYLE(options.borderColor || '#7d7d7dff', options.bgColor || '#7d7d7d00');
|
|
26
26
|
const url = options.href || '';
|
|
27
|
-
const domain = new URL(url).origin.replace(/^https?:\/\//, '').replace(/^www\./, '') ||
|
|
27
|
+
const domain = new URL(url).origin.replace(/^https?:\/\//, '').replace(/^www\./, '') ||
|
|
28
|
+
'Unknown domain';
|
|
28
29
|
let title = data.title;
|
|
29
30
|
let description = data.description;
|
|
30
31
|
// Special handling for gitub.com
|
package/dist/assemble/parser.js
CHANGED
|
@@ -84,7 +84,9 @@ export function parserMetadata(htmlString, url) {
|
|
|
84
84
|
function absolute(logo) {
|
|
85
85
|
if (!logo)
|
|
86
86
|
return DEFAULT_LOGO;
|
|
87
|
-
return extractUrl(logo)
|
|
87
|
+
return extractUrl(logo)
|
|
88
|
+
? logo
|
|
89
|
+
: `${extractUrl(url)?.origin}${cleanPath(`/${logo}`)}`; // TODO: no match "content='//img.xx.com/a.png'"
|
|
88
90
|
}
|
|
89
91
|
const metadata = {
|
|
90
92
|
title: matchTitleByMetaTag(htmlString),
|
package/dist/assemble/xhr.js
CHANGED
|
@@ -41,7 +41,9 @@ export function async(url) {
|
|
|
41
41
|
xhr.open('GET', url, false);
|
|
42
42
|
xhr.setRequestHeader('Content-Type', 'text/html');
|
|
43
43
|
xhr.onreadystatechange = function () {
|
|
44
|
-
if (xhr.readyState === 4 &&
|
|
44
|
+
if (xhr.readyState === 4 &&
|
|
45
|
+
xhr.status === 200 &&
|
|
46
|
+
isString(xhr.responseText)) {
|
|
45
47
|
cache.set(url, xhr.responseText);
|
|
46
48
|
resolve(xhr.responseText);
|
|
47
49
|
}
|
package/package.json
CHANGED
|
@@ -14,27 +14,27 @@
|
|
|
14
14
|
"@babel/core": "^7.28.5",
|
|
15
15
|
"@babel/preset-env": "^7.28.5",
|
|
16
16
|
"@babel/preset-typescript": "^7.28.5",
|
|
17
|
-
"@eslint/js": "^9.39.
|
|
17
|
+
"@eslint/js": "^9.39.2",
|
|
18
18
|
"@luckrya/utility": "^0.1.1",
|
|
19
19
|
"@rollup/plugin-babel": "^6.1.0",
|
|
20
20
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
21
21
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
22
22
|
"@types/babel__core": "^7",
|
|
23
23
|
"@types/markdown-it": "^13.0.2",
|
|
24
|
-
"@types/node": "^
|
|
25
|
-
"eslint": "^9.39.
|
|
26
|
-
"eslint-plugin-vue": "^10.
|
|
24
|
+
"@types/node": "^25.0.2",
|
|
25
|
+
"eslint": "^9.39.2",
|
|
26
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
27
27
|
"globals": "^16.5.0",
|
|
28
28
|
"jiti": "^2.6.1",
|
|
29
29
|
"markdown-it": "^13.0.2",
|
|
30
|
-
"npm-check-updates": "^19.
|
|
31
|
-
"prettier": "^3.
|
|
30
|
+
"npm-check-updates": "^19.2.0",
|
|
31
|
+
"prettier": "^3.7.4",
|
|
32
32
|
"rollup": "^2.79.2",
|
|
33
33
|
"rollup-plugin-terser": "^7.0.2",
|
|
34
|
-
"typedoc": "^0.28.
|
|
34
|
+
"typedoc": "^0.28.15",
|
|
35
35
|
"typedoc-theme-hierarchy": "^6.0.0",
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
|
-
"typescript-eslint": "^8.
|
|
37
|
+
"typescript-eslint": "^8.50.0",
|
|
38
38
|
"vue-eslint-parser": "^10.2.0",
|
|
39
39
|
"xmlhttprequest": "^1.8.0"
|
|
40
40
|
},
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"clean": "rm -rf dist types",
|
|
70
70
|
"dev": "rollup -c -w",
|
|
71
71
|
"docs": "yarn typedoc",
|
|
72
|
-
"format": "yarn prettier --config .vscode/.prettierrc.json --write .config/*.json .github .vscode src *.json && rm -rf node_modules",
|
|
72
|
+
"format": "yarn prettier --config .vscode/.prettierrc.json --write .config/*.json .github/workflows .vscode src *.json && rm -rf node_modules",
|
|
73
73
|
"lint": "yarn eslint --config .vscode/eslint.config.ts src/**/*",
|
|
74
74
|
"type:dts": "tsc --emitDeclarationOnly"
|
|
75
75
|
},
|
|
76
76
|
"type": "module",
|
|
77
77
|
"types": "./types/index.d.ts",
|
|
78
|
-
"version": "1.2.
|
|
78
|
+
"version": "1.2.8"
|
|
79
79
|
}
|