@stacksjs/image 0.70.250 → 0.70.251

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.
Files changed (2) hide show
  1. package/dist/social.js +3 -8
  2. package/package.json +2 -2
package/dist/social.js CHANGED
@@ -16,7 +16,7 @@ export function socialCardName(path) {
16
16
  export async function generateSocialCardSet(images, root = process.cwd()) {
17
17
  if (images.social?.enabled !== !0)
18
18
  return [];
19
- const social = themed(images, images.social), fonts = await loadFonts(images.fonts, root), outputDir = projectFile(social.outputDir ?? "public/social", root), publicPath = `/${(social.publicPath ?? "/social").replace(/^\/+|\/+$/g, "")}`, presets = social.presets?.length ? social.presets : ["og", "square", "portrait"], format = social.format ?? "jpeg";
19
+ const social = themed(images, images.social), fonts = await loadFonts(images.fonts, root), outputDir = projectFile(social.outputDir ?? "public/social", root), publicPath = `/${(social.publicPath ?? "/social").replace(/^\/+|\/+$/g, "")}`, presets = social.presets?.length ? social.presets : ["og"], format = social.format ?? "jpeg";
20
20
  await mkdir(outputDir, { recursive: !0 });
21
21
  const drawMark = await markPainter(social.mark, root), shared = {
22
22
  titleFont: fonts.title,
@@ -63,7 +63,8 @@ export async function generateSocialCardSet(images, root = process.cwd()) {
63
63
  return results;
64
64
  }
65
65
  export function socialMetaTags(card, siteUrl, format = "jpeg") {
66
- const base = siteUrl.replace(/\/+$/, ""), primary = `${base}${card.urls.og ?? Object.values(card.urls)[0]}`, mimeType = format === "jpeg" ? "image/jpeg" : `image/${format}`, tags = [
66
+ const primary = `${siteUrl.replace(/\/+$/, "")}${card.urls.og ?? Object.values(card.urls)[0]}`, mimeType = format === "jpeg" ? "image/jpeg" : `image/${format}`;
67
+ return [
67
68
  `<meta property="og:image" content="${primary}">`,
68
69
  `<meta property="og:image:type" content="${mimeType}">`,
69
70
  `<meta property="og:image:width" content="${card.width}">`,
@@ -73,12 +74,6 @@ export function socialMetaTags(card, siteUrl, format = "jpeg") {
73
74
  `<meta name="twitter:image" content="${primary}">`,
74
75
  `<meta name="twitter:image:alt" content="${escapeAttribute(card.title)}">`
75
76
  ];
76
- for (const [preset, url] of Object.entries(card.urls)) {
77
- if (preset === "og")
78
- continue;
79
- tags.push(`<meta property="og:image" content="${base}${url}">`);
80
- }
81
- return tags;
82
77
  }
83
78
  function escapeAttribute(value) {
84
79
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/image",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.250",
5
+ "version": "0.70.251",
6
6
  "description": "Native responsive image delivery for Stacks.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "bun run build"
32
32
  },
33
33
  "dependencies": {
34
- "@stacksjs/types": "0.70.250",
34
+ "@stacksjs/types": "0.70.251",
35
35
  "ts-images": "^0.2.7"
36
36
  },
37
37
  "devDependencies": {