@altano/astro-opengraph 0.0.1-alpha.2 → 0.1.0-alpha.3

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 CHANGED
@@ -86,7 +86,7 @@ In order serve the component from the prior step as an image, you need a js/ts [
86
86
 
87
87
  ```ts
88
88
  import opengraphTemplate from "../components/opengraph.astro";
89
- import { makeOpengraphEndpoint } from "@altano/astro-opengraph";
89
+ import { makeOpengraphEndpoint } from "@altano/astro-opengraph/endpoint";
90
90
 
91
91
  export const GET = makeOpengraphEndpoint({
92
92
  template: opengraphTemplate,
@@ -142,6 +142,8 @@ import OpenGraphMeta from "@altano/astro-opengraph/components/meta.astro";
142
142
  </html>
143
143
  ```
144
144
 
145
+ You can also provide an `alt` prop which would set the `og:image:alt` meta tag, but my understanding is that it isn't well supported, so feel free to omit this.
146
+
145
147
  If you want the `OpenGraphMeta` component to use a different set of defaults for your whole site, you can provide the `componentMetaTagFallbacks` integration config, e.g. to provide a default title:
146
148
 
147
149
  ```ts
@@ -274,7 +276,7 @@ It doesn't matter where you put your Open Graph component or endpoints, as long
274
276
  ```ts
275
277
  // import your component, wherever it is
276
278
  import opengraphTemplate from "../components/my-custom-component.astro";
277
- import { makeOpengraphEndpoint } from "@altano/astro-opengraph";
279
+ import { makeOpengraphEndpoint } from "@altano/astro-opengraph/endpoint";
278
280
 
279
281
  export const GET = makeOpengraphEndpoint({
280
282
  template: opengraphTemplate,
@@ -21,6 +21,10 @@ export type Props = {
21
21
  * something else, provide the path to the resulting image here.
22
22
  */
23
23
  image?: string;
24
+ /**
25
+ * The specification says "A description of what is in the image (not a caption). If the page specifies an og:image it should specify og:image:alt." but people have found this to be poorly supported. Use if you want.
26
+ */
27
+ alt?: string;
24
28
  /**
25
29
  * Override the width, which otherwise defaults to:
26
30
  *
@@ -42,9 +46,9 @@ export type Props = {
42
46
  */
43
47
  height?: number;
44
48
  /**
45
- * Override the mimetype, which defaults to "image/png"
49
+ * Override `og:image:type` MIME type, which defaults to "image/png"
46
50
  */
47
- mimeType?: string;
51
+ type?: string;
48
52
  };
49
53
 
50
54
  const { imageOptions, componentMetaTagFallbacks } = await getResolvedConfig();
@@ -56,12 +60,13 @@ const {
56
60
  } = componentMetaTagFallbacks;
57
61
 
58
62
  const {
63
+ alt,
59
64
  title = titleFallback,
60
65
  description = descriptionFallback,
61
66
  image = imageUrlFallback,
62
67
  width = imageOptions.width,
63
68
  height = imageOptions.height,
64
- mimeType = "image/png",
69
+ type = "image/png",
65
70
  } = Astro.props;
66
71
 
67
72
  const urlStr = Astro.url.toString();
@@ -72,6 +77,7 @@ const opengraphImageUrl = new URL(image, urlWithTrailingSlash);
72
77
  {title && <meta property="og:title" content={title} />}
73
78
  {description && <meta property="og:description" content={description} />}
74
79
  <meta property="og:image" content={opengraphImageUrl.toString()} />
75
- <meta property="og:image:type" content={mimeType} />
80
+ {alt && <meta property="og:image:alt" content={alt} />}
81
+ <meta property="og:image:type" content={type} />
76
82
  <meta property="og:image:width" content={width.toString()} />
77
83
  <meta property="og:image:height" content={height.toString()} />
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default } from "./integration.js";
2
+ export type { OpengraphImageConfig, ImageOptionsWithFontPaths, ComponentMetaTagFallbacks, } from "./types.js";
2
3
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altano/astro-opengraph",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Open Graph Tools for Astro",
5
5
  "keywords": [
6
6
  "astro",
@@ -40,6 +40,7 @@
40
40
  "satori-html": "^0.3.2"
41
41
  },
42
42
  "devDependencies": {
43
+ "@astrojs/check": "^0.9.4",
43
44
  "@inox-tools/astro-tests": "0.5.1",
44
45
  "@playwright/test": "1.47.0",
45
46
  "@types/he": "^1.2.3",
@@ -58,11 +59,13 @@
58
59
  "typescript": "^5.8.2",
59
60
  "vite": "^6.2.5",
60
61
  "vitest": "^3.1.1",
62
+ "zx": "^8.5.2",
61
63
  "@altano/assets": "0.0.0",
62
- "@altano/testing": "0.0.0",
63
- "@altano/vitest-plugins": "1.1.0",
64
64
  "@altano/build-config": "0.0.0",
65
- "@altano/tsconfig": "0.0.0"
65
+ "@altano/testing": "0.0.0",
66
+ "@altano/tsconfig": "0.0.0",
67
+ "@altano/tiny-async-pool": "3.0.2",
68
+ "@altano/vitest-plugins": "1.1.0"
66
69
  },
67
70
  "peerDependencies": {
68
71
  "@types/react": ">=18",
@@ -77,6 +80,7 @@
77
80
  "scripts": {
78
81
  "build": "tsup --config ./tsup.config.ts",
79
82
  "build:types": "tsc --project tsconfig.declarations.json",
83
+ "check:types:astro-fixtures": "node --experimental-strip-types ./scripts/check-fixtures.ts",
80
84
  "check:types:src": "tsc --noEmit",
81
85
  "check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
82
86
  "check:unused-dependencies": "depcheck",