@altano/astro-opengraph 0.1.0-alpha.3 → 0.1.0
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 +9 -0
- package/components/meta.astro +1 -1
- package/dist/config-CzK0JuaO.js +45 -0
- package/dist/config.d.ts +8 -3
- package/dist/config.js +3 -0
- package/dist/endpoint.d.ts +25 -11
- package/dist/endpoint.js +62 -126
- package/dist/index.d.ts +8 -2
- package/dist/index.js +41 -58
- package/dist/toolbar/index.d.ts +7 -2
- package/dist/toolbar/index.js +364 -396
- package/dist/types-Lk5HqHkQ.d.ts +71 -0
- package/package.json +28 -26
- package/dist/image.d.ts +0 -7
- package/dist/integration.d.ts +0 -5
- package/dist/toolbar/components/CopyImageUrlButton.d.ts +0 -3
- package/dist/toolbar/components/ExternalLinkicon.d.ts +0 -7
- package/dist/toolbar/components/Image.d.ts +0 -5
- package/dist/toolbar/components/ImageSection.d.ts +0 -4
- package/dist/toolbar/components/ImageZoomToolbar.d.ts +0 -7
- package/dist/toolbar/components/LinkOrText.d.ts +0 -7
- package/dist/toolbar/components/MetaTags.d.ts +0 -3
- package/dist/toolbar/components/Summary.d.ts +0 -5
- package/dist/toolbar/components/ToolbarApp.d.ts +0 -3
- package/dist/toolbar/components/ToolbarAppWindow.d.ts +0 -3
- package/dist/toolbar/components/ToolbarSection.d.ts +0 -6
- package/dist/toolbar/components/ZoomButton.d.ts +0 -7
- package/dist/toolbar/components/ZoomLabel.d.ts +0 -4
- package/dist/toolbar/hooks/useHoverState.d.ts +0 -3
- package/dist/toolbar/hooks/useImageURL.d.ts +0 -3
- package/dist/toolbar/hooks/useMetaTagInfo.d.ts +0 -3
- package/dist/toolbar/styles.d.ts +0 -2
- package/dist/types.d.ts +0 -67
- package/dist/virtual-user-config.d.ts +0 -8
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { SatoriOptions } from "satori";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type ImageOptions = SatoriOptions;
|
|
5
|
+
type FontWithBuffer = ImageOptions["fonts"][0];
|
|
6
|
+
type FontWithPath = Omit<FontWithBuffer, "data"> & {
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
type ImageOptionsBase = {
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type ImageOptionsBaseResolved = {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type ImageOptionsWithFontPaths = ImageOptionsBase & {
|
|
20
|
+
fonts: FontWithPath[];
|
|
21
|
+
};
|
|
22
|
+
type ImageOptionsWithFontBuffers = ImageOptionsBase & {
|
|
23
|
+
fonts: FontWithBuffer[];
|
|
24
|
+
};
|
|
25
|
+
type ImageOptionsWithFontBuffersResolved = ImageOptionsBaseResolved & {
|
|
26
|
+
fonts: FontWithBuffer[];
|
|
27
|
+
};
|
|
28
|
+
type ComponentMetaTagFallbacks = {
|
|
29
|
+
"og:title"?: string;
|
|
30
|
+
"og:description"?: string;
|
|
31
|
+
"og:image"?: string;
|
|
32
|
+
};
|
|
33
|
+
type MetaTagDefaults = {
|
|
34
|
+
"og:image": string;
|
|
35
|
+
};
|
|
36
|
+
type OpengraphImageConfig = {
|
|
37
|
+
/**
|
|
38
|
+
* Options to use for the image file that is generated. Most importantly, fonts
|
|
39
|
+
* must be provided.
|
|
40
|
+
*/
|
|
41
|
+
getImageOptions(): Promise<ImageOptionsWithFontPaths>;
|
|
42
|
+
/**
|
|
43
|
+
* Defaults to use in the component for tags you don't manually set.
|
|
44
|
+
*/
|
|
45
|
+
componentMetaTagFallbacks?: ComponentMetaTagFallbacks;
|
|
46
|
+
};
|
|
47
|
+
type AstroConfigSetupHookOptions = Parameters<Astro.IntegrationHooks["astro:config:setup"]>[0];
|
|
48
|
+
type Command = AstroConfigSetupHookOptions["command"];
|
|
49
|
+
/**
|
|
50
|
+
* This must remain JSON-serializable!
|
|
51
|
+
*/
|
|
52
|
+
type OpengraphImageConfigSerializable = {
|
|
53
|
+
imageOptions: ImageOptionsWithFontPaths;
|
|
54
|
+
componentMetaTagFallbacks?: ComponentMetaTagFallbacks;
|
|
55
|
+
command: Command;
|
|
56
|
+
};
|
|
57
|
+
type OpengraphImageConfigSerializableMaybeMocked = OpengraphImageConfigSerializable | (() => OpengraphImageConfigSerializable);
|
|
58
|
+
type OpengraphImageConfigDeserialized = {
|
|
59
|
+
imageOptions: ImageOptionsWithFontBuffers;
|
|
60
|
+
componentMetaTagFallbacks?: ComponentMetaTagFallbacks | undefined;
|
|
61
|
+
command: Command;
|
|
62
|
+
};
|
|
63
|
+
type OpengraphImageConfigResolved = {
|
|
64
|
+
imageOptions: ImageOptionsWithFontBuffersResolved;
|
|
65
|
+
componentMetaTagFallbacks: ComponentMetaTagFallbacks & MetaTagDefaults;
|
|
66
|
+
command: Command;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ComponentMetaTagFallbacks, ImageOptions, ImageOptionsWithFontPaths, OpengraphImageConfig, OpengraphImageConfigDeserialized, OpengraphImageConfigResolved, OpengraphImageConfigSerializableMaybeMocked };
|
|
71
|
+
//# sourceMappingURL=types-Lk5HqHkQ.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/astro-opengraph",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Open Graph Tools for Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
7
7
|
"astro-integration",
|
|
8
|
+
"astro-component",
|
|
9
|
+
"devtools",
|
|
10
|
+
"image",
|
|
8
11
|
"opengraph",
|
|
9
|
-
"
|
|
12
|
+
"withastro"
|
|
10
13
|
],
|
|
11
14
|
"homepage": "https://github.com/altano/npm-packages/tree/main/packages/astro-opengraph",
|
|
12
15
|
"repository": {
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
"exports": {
|
|
26
29
|
".": "./dist/index.js",
|
|
27
30
|
"./components/meta.astro": "./components/meta.astro",
|
|
31
|
+
"./config": "./dist/config.js",
|
|
28
32
|
"./endpoint": "./dist/endpoint.js",
|
|
29
33
|
"./toolbar": "./dist/toolbar/index.js"
|
|
30
34
|
},
|
|
@@ -41,57 +45,55 @@
|
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@astrojs/check": "^0.9.4",
|
|
48
|
+
"@astrojs/preact": "^4.0.8",
|
|
49
|
+
"@astrojs/svelte": "^7.0.9",
|
|
50
|
+
"@astrojs/vue": "^5.0.9",
|
|
44
51
|
"@inox-tools/astro-tests": "0.5.1",
|
|
45
|
-
"@playwright/test": "1.
|
|
52
|
+
"@playwright/test": "1.51.1",
|
|
46
53
|
"@types/he": "^1.2.3",
|
|
47
54
|
"@types/jest-image-snapshot": "^6.4.0",
|
|
48
55
|
"@types/node": "^22.13.10",
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"@vitest/coverage-v8": "^3.1.1",
|
|
52
|
-
"astro": "^5.5.6",
|
|
56
|
+
"@vitest/coverage-v8": "^3.1.4",
|
|
57
|
+
"astro": "^5.8.0",
|
|
53
58
|
"depcheck": "^1.4.7",
|
|
54
59
|
"jest-image-snapshot": "^6.4.0",
|
|
55
|
-
"
|
|
56
|
-
"react-dom": "^19.1.0",
|
|
60
|
+
"preact": "^10.26.5",
|
|
57
61
|
"sharp": "^0.33.1",
|
|
58
|
-
"
|
|
62
|
+
"svelte": "^5.25.12",
|
|
63
|
+
"tsdown": "^0.12.3",
|
|
59
64
|
"typescript": "^5.8.2",
|
|
60
|
-
"vite": "^6.2.
|
|
61
|
-
"vitest": "^3.1.
|
|
65
|
+
"vite": "^6.2.6",
|
|
66
|
+
"vitest": "^3.1.4",
|
|
67
|
+
"vue": "^3.5.13",
|
|
62
68
|
"zx": "^8.5.2",
|
|
63
|
-
"@altano/assets": "0.0.
|
|
64
|
-
"@altano/build-config": "0.0.
|
|
65
|
-
"@altano/testing": "0.0.
|
|
66
|
-
"@altano/
|
|
67
|
-
"@altano/
|
|
69
|
+
"@altano/assets": "0.0.1",
|
|
70
|
+
"@altano/build-config": "0.0.1",
|
|
71
|
+
"@altano/testing": "0.0.1",
|
|
72
|
+
"@altano/tiny-async-pool": "4.0.0",
|
|
73
|
+
"@altano/tsconfig": "0.0.1",
|
|
68
74
|
"@altano/vitest-plugins": "1.1.0"
|
|
69
75
|
},
|
|
70
76
|
"peerDependencies": {
|
|
71
|
-
"@types/react": ">=18",
|
|
72
|
-
"@types/react-dom": ">=18",
|
|
73
77
|
"astro": "5.x.x",
|
|
74
|
-
"
|
|
75
|
-
"react-dom": ">=18"
|
|
78
|
+
"preact": ">=10"
|
|
76
79
|
},
|
|
77
80
|
"publishConfig": {
|
|
78
81
|
"access": "public"
|
|
79
82
|
},
|
|
80
83
|
"scripts": {
|
|
81
|
-
"build": "
|
|
82
|
-
"
|
|
83
|
-
"check:types:astro-fixtures": "node --experimental-strip-types ./scripts/check-fixtures.ts",
|
|
84
|
+
"build": "tsdown",
|
|
85
|
+
"check:types:astro": "node --experimental-strip-types ./scripts/check-fixtures.ts",
|
|
84
86
|
"check:types:src": "tsc --noEmit",
|
|
85
87
|
"check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
|
|
86
88
|
"check:unused-dependencies": "depcheck",
|
|
87
89
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
88
|
-
"dev": "
|
|
90
|
+
"dev": "tsdown --watch",
|
|
89
91
|
"format": "prettier --write src",
|
|
90
92
|
"lint": "eslint",
|
|
91
93
|
"lint:fix": "TIMING=1 eslint src/**/*.ts* --fix",
|
|
92
94
|
"lint:timing": "TIMING=1 eslint src/**/*.ts*",
|
|
93
95
|
"test:e2e": "playwright test",
|
|
94
|
-
"test:e2e:server": "astro --root tests/fixtures/
|
|
96
|
+
"test:e2e:server": "astro --root tests/fixtures/ui-frameworks --port 3913 dev",
|
|
95
97
|
"test:e2e:ui": "playwright test --ui",
|
|
96
98
|
"test:unit": "vitest --run",
|
|
97
99
|
"test:unit:watch": "vitest"
|
package/dist/image.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type SatoriOptions } from "satori";
|
|
2
|
-
import type { LocalImageService } from "astro";
|
|
3
|
-
/**
|
|
4
|
-
* Convert an html string to an image
|
|
5
|
-
*/
|
|
6
|
-
export declare function htmlToPNG(html: string, satoriOptions: SatoriOptions): Promise<ReturnType<LocalImageService["transform"]>>;
|
|
7
|
-
//# sourceMappingURL=image.d.ts.map
|
package/dist/integration.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
export declare function ImageZoomToolbar({ isHovered, imageSize, setImageSize, }: {
|
|
3
|
-
isHovered: boolean;
|
|
4
|
-
imageSize: number;
|
|
5
|
-
setImageSize: React.Dispatch<React.SetStateAction<number>>;
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
//# sourceMappingURL=ImageZoomToolbar.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
export declare function ZoomButton({ value, imageSize, setImageSize, }: {
|
|
3
|
-
value: number;
|
|
4
|
-
imageSize: number;
|
|
5
|
-
setImageSize: React.Dispatch<React.SetStateAction<number>>;
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
//# sourceMappingURL=ZoomButton.d.ts.map
|
package/dist/toolbar/styles.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const styles = "\n :host astro-dev-toolbar-window {\n max-height: calc(100vh - 80px);\n overflow-y: auto;\n }\n\n button {\n background: none;\n color: inherit;\n border: none;\n font: inherit;\n cursor: pointer;\n outline: inherit;\n }\n\n details {\n margin-block-end: 10px;\n }\n details:last-of-type {\n margin-block-end: 0;\n }\n\n details[open] summary, .image {\n margin-block-end: 7px;\n }\n\n .image img {\n transition: max-width 0.1s;\n }\n";
|
|
2
|
-
//# sourceMappingURL=styles.d.ts.map
|
package/dist/types.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { SatoriOptions } from "satori";
|
|
2
|
-
export type ImageOptions = SatoriOptions;
|
|
3
|
-
export type FontWithBuffer = ImageOptions["fonts"][0];
|
|
4
|
-
export type FontWithPath = Omit<FontWithBuffer, "data"> & {
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
type ImageOptionsBase = {
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
debug?: boolean;
|
|
11
|
-
};
|
|
12
|
-
type ImageOptionsBaseResolved = {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
debug?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type ImageOptionsWithFontPaths = ImageOptionsBase & {
|
|
18
|
-
fonts: FontWithPath[];
|
|
19
|
-
};
|
|
20
|
-
export type ImageOptionsWithFontBuffers = ImageOptionsBase & {
|
|
21
|
-
fonts: FontWithBuffer[];
|
|
22
|
-
};
|
|
23
|
-
export type ImageOptionsWithFontBuffersResolved = ImageOptionsBaseResolved & {
|
|
24
|
-
fonts: FontWithBuffer[];
|
|
25
|
-
};
|
|
26
|
-
export type ComponentMetaTagFallbacks = {
|
|
27
|
-
"og:title"?: string;
|
|
28
|
-
"og:description"?: string;
|
|
29
|
-
"og:image"?: string;
|
|
30
|
-
};
|
|
31
|
-
export type MetaTagDefaults = {
|
|
32
|
-
"og:image": string;
|
|
33
|
-
};
|
|
34
|
-
export type OpengraphImageConfig = {
|
|
35
|
-
/**
|
|
36
|
-
* Options to use for the image file that is generated. Most importantly, fonts
|
|
37
|
-
* must be provided.
|
|
38
|
-
*/
|
|
39
|
-
getImageOptions(): Promise<ImageOptionsWithFontPaths>;
|
|
40
|
-
/**
|
|
41
|
-
* Defaults to use in the component for tags you don't manually set.
|
|
42
|
-
*/
|
|
43
|
-
componentMetaTagFallbacks?: ComponentMetaTagFallbacks;
|
|
44
|
-
};
|
|
45
|
-
type AstroConfigSetupHookOptions = Parameters<Astro.IntegrationHooks["astro:config:setup"]>[0];
|
|
46
|
-
type Command = AstroConfigSetupHookOptions["command"];
|
|
47
|
-
/**
|
|
48
|
-
* This must remain JSON-serializable!
|
|
49
|
-
*/
|
|
50
|
-
export type OpengraphImageConfigSerializable = {
|
|
51
|
-
imageOptions: ImageOptionsWithFontPaths;
|
|
52
|
-
componentMetaTagFallbacks?: ComponentMetaTagFallbacks;
|
|
53
|
-
command: Command;
|
|
54
|
-
};
|
|
55
|
-
export type OpengraphImageConfigSerializableMaybeMocked = OpengraphImageConfigSerializable | (() => OpengraphImageConfigSerializable);
|
|
56
|
-
export type OpengraphImageConfigDeserialized = {
|
|
57
|
-
imageOptions: ImageOptionsWithFontBuffers;
|
|
58
|
-
componentMetaTagFallbacks?: ComponentMetaTagFallbacks | undefined;
|
|
59
|
-
command: Command;
|
|
60
|
-
};
|
|
61
|
-
export type OpengraphImageConfigResolved = {
|
|
62
|
-
imageOptions: ImageOptionsWithFontBuffersResolved;
|
|
63
|
-
componentMetaTagFallbacks: ComponentMetaTagFallbacks & MetaTagDefaults;
|
|
64
|
-
command: Command;
|
|
65
|
-
};
|
|
66
|
-
export {};
|
|
67
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ViteUserConfig } from "astro";
|
|
2
|
-
import type { OpengraphImageConfigSerializable } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Vite plugin that exposes OpengraphImage user config and project context via
|
|
5
|
-
* virtual modules.
|
|
6
|
-
*/
|
|
7
|
-
export declare function vitePluginOpengraphImageUserConfig(config: OpengraphImageConfigSerializable): NonNullable<ViteUserConfig["plugins"]>[number];
|
|
8
|
-
//# sourceMappingURL=virtual-user-config.d.ts.map
|