Skip to content

Commit

Permalink
Update @types/hast, unified, utilities, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 1, 2023
1 parent 01fd577 commit c53228f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
40 changes: 18 additions & 22 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function ogType(data, root) {
: undefined

if (value) {
const node = ensure(data, root, 'meta[property=og:type]')
const node = ensure(data, root, 'meta[property="og:type"]')
node.properties.content = value
}
}
Expand All @@ -287,7 +287,7 @@ function ogSiteName(data, root) {
const value = data.og ? data.name : undefined

if (value) {
const node = ensure(data, root, 'meta[property=og:site_name]')
const node = ensure(data, root, 'meta[property="og:site_name"]')
node.properties.content = value
}
}
Expand All @@ -300,7 +300,7 @@ function ogUrl(data, root) {
const value = data.og ? url(data) : undefined

if (value) {
const node = ensure(data, root, 'meta[property=og:url]')
const node = ensure(data, root, 'meta[property="og:url"]')
node.properties.content = value
}
}
Expand All @@ -316,7 +316,7 @@ function ogTitle(data, root) {
: data.title

if (value) {
const node = ensure(data, root, 'meta[property=og:title]')
const node = ensure(data, root, 'meta[property="og:title"]')
node.properties.content = value
}
}
Expand All @@ -330,7 +330,7 @@ function ogDescription(data, root) {
const value = data.og ? data.description : undefined

if (value) {
const node = ensure(data, root, 'meta[property=og:description]')
const node = ensure(data, root, 'meta[property="og:description"]')
node.properties.content = value
}
}
Expand Down Expand Up @@ -376,7 +376,7 @@ function ogArticlePublishedTime(data, root) {
data.og && data.type === 'article' ? toDate(data.published) : undefined

if (value) {
const node = ensure(data, root, 'meta[property=article:published_time]')
const node = ensure(data, root, 'meta[property="article:published_time"]')
node.properties.content = value.toISOString()
}
}
Expand All @@ -390,7 +390,7 @@ function ogArticleModifiedTime(data, root) {
data.og && data.type === 'article' ? toDate(data.modified) : undefined

if (value) {
const node = ensure(data, root, 'meta[property=article:modified_time]')
const node = ensure(data, root, 'meta[property="article:modified_time"]')
node.properties.content = value.toISOString()
}
}
Expand All @@ -404,7 +404,7 @@ function ogArticleAuthor(data, root) {
data.og && data.type === 'article' ? data.authorFacebook : undefined

if (value) {
const node = ensure(data, root, 'meta[property=article:author]')
const node = ensure(data, root, 'meta[property="article:author"]')
node.properties.content = fbBase + value
}
}
Expand All @@ -417,7 +417,7 @@ function ogArticleSection(data, root) {
const value = data.og && data.type === 'article' ? data.section : undefined

if (value) {
const node = ensure(data, root, 'meta[property=article:section]')
const node = ensure(data, root, 'meta[property="article:section"]')
node.properties.content = value
}
}
Expand Down Expand Up @@ -459,7 +459,7 @@ function twitterCard(data, root) {
}

if (value) {
const node = ensure(data, root, 'meta[name=twitter:card]')
const node = ensure(data, root, 'meta[name="twitter:card"]')
node.properties.content = value
}
}
Expand Down Expand Up @@ -501,7 +501,7 @@ function twitterSite(data, root) {
const value = data.twitter ? data.siteTwitter : undefined

if (value) {
const node = ensure(data, root, 'meta[name=twitter:site]')
const node = ensure(data, root, 'meta[name="twitter:site"]')
node.properties.content = prefix(value, '@')
}
}
Expand All @@ -514,7 +514,7 @@ function twitterCreator(data, root) {
const value = data.twitter ? data.authorTwitter : undefined

if (value) {
const node = ensure(data, root, 'meta[name=twitter:creator]')
const node = ensure(data, root, 'meta[name="twitter:creator"]')
node.properties.content = prefix(value, '@')
}
}
Expand Down Expand Up @@ -555,10 +555,13 @@ function twitterData(data, root) {
ensure(
data,
root,
'meta[name=twitter:label' + no + ']'
'meta[name="twitter:label' + no + '"]'
).properties.content = items[index].label
ensure(data, root, 'meta[name=twitter:data' + no + ']').properties.content =
items[index].data
ensure(
data,
root,
'meta[name="twitter:data' + no + '"]'
).properties.content = items[index].data
}
}

Expand All @@ -576,13 +579,6 @@ function ensure(data, root, selector) {
append(data, root, node)
}

// Always available.
/* c8 ignore next 3 */
if (!node.properties) {
node.properties = {}
}

// @ts-expect-error: hush.
return node
}

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
"index.js"
],
"dependencies": {
"@types/hast": "^2.0.0",
"hast-util-from-selector": "^2.0.0",
"hast-util-select": "^5.0.0",
"hastscript": "^7.0.0",
"unified": "^10.0.0"
"@types/hast": "^3.0.0",
"hast-util-from-selector": "^3.0.0",
"hast-util-select": "^6.0.0",
"hastscript": "^8.0.0",
"unified": "^11.0.0"
},
"devDependencies": {
"@types/tape": "^5.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"rehype": "^12.0.0",
"rehype-document": "^6.0.0",
"rehype": "^13.0.0",
"rehype-document": "^7.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,8 @@ test('rehypeMeta', (t) => {
'<html lang="en">',
'<head>',
'<meta charset="utf-8">',
'<meta name="viewport" content="width=device-width, initial-scale=1">',
'<link rel="stylesheet" href="index.css">',
'<meta content="width=device-width, initial-scale=1" name="viewport">',
'<link href="index.css" rel="stylesheet">',
'',
'<title>Crispy Sea Salt and Vinegar Roasted Potatoes - Host The Toast</title>',
'<link rel="canonical" href="https://hostthetoast.com/crispy-sea-salt-vinegar-roasted-potatoes/">',
Expand Down

0 comments on commit c53228f

Please sign in to comment.