Skip to content

Commit f8d8f48

Browse files
authored
feat: add standalone Open Graph viewer (#115)
1 parent 57f3ef2 commit f8d8f48

62 files changed

Lines changed: 1963 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎alias.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ export const alias = {
7979
'@devframes/plugin-inspect/cli': p('inspect/src/cli.ts'),
8080
'@devframes/plugin-inspect/vite': p('inspect/src/vite.ts'),
8181
'@devframes/plugin-inspect': p('inspect/src/index.ts'),
82+
'@devframes/plugin-og/client': p('og/src/client/index.ts'),
83+
'@devframes/plugin-og/node': p('og/src/node/index.ts'),
84+
'@devframes/plugin-og/rpc': p('og/src/rpc/index.ts'),
85+
'@devframes/plugin-og/cli': p('og/src/cli.ts'),
86+
'@devframes/plugin-og/vite': p('og/src/vite.ts'),
87+
'@devframes/plugin-og': p('og/src/index.ts'),
8288
'@devframes/plugin-a11y/client': p('a11y/src/client/index.ts'),
8389
'@devframes/plugin-a11y/node': p('a11y/src/node/index.ts'),
8490
'@devframes/plugin-a11y/cli': p('a11y/src/cli.ts'),

‎docs/.vitepress/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function pluginsItems(prefix: string) {
6464
{ text: 'Overview', link: `${prefix}/plugins/` },
6565
{ text: 'Data Inspector', link: `${prefix}/plugins/data-inspector` },
6666
{ text: 'Devframe Inspector', link: `${prefix}/plugins/inspect` },
67+
{ text: 'Open Graph Viewer', link: `${prefix}/plugins/og` },
6768
{ text: 'Accessibility Inspector', link: `${prefix}/plugins/a11y` },
6869
{ text: 'Git', link: `${prefix}/plugins/git` },
6970
{ text: 'Terminals', link: `${prefix}/plugins/terminals` },

‎docs/plugins/index.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Each plugin is built with a **different UI framework**. That is deliberate: devf
1212
|--------|--------------|--------------|
1313
| [Data Inspector](./data-inspector) | Vue | Query live server-side objects with jora — sources contributed by plugins, hosts, data files, or attached processes. |
1414
| [Devframe Inspector](./inspect) | Vue | Browse the RPC registry, invoke read-only queries, watch shared state update live, and explore the agent surface. |
15+
| [Open Graph Viewer](./og) | Vue | Inspect Open Graph and Twitter metadata and compare social-card previews. |
1516
| [Accessibility Inspector](./a11y) | Solid | Run axe-core against a host app, list WCAG violations, and highlight the offending element in the page on hover. |
1617
| [Git](./git) | React (Next.js) | A repository dashboard — status, a commit graph, branches, and diffs, with optional staging and committing. |
1718
| [Terminals](./terminals) | Svelte | Stream read-only command output and run fully interactive PTY shells in the browser. |
@@ -29,6 +30,7 @@ Most plugins publish a `bin`, so the quickest path is `npx`:
2930

3031
```sh
3132
npx @devframes/plugin-inspect # the Devframe Inspector, standalone
33+
npx @devframes/plugin-og # inspect Open Graph metadata and social cards
3234
npx @devframes/plugin-git # the Git dashboard against the current repo
3335
```
3436

‎docs/plugins/og.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Open Graph Viewer
6+
7+
Inspect a page's resolved Open Graph and Twitter metadata and compare its social cards across common platforms.
8+
9+
## Run Standalone
10+
11+
```sh
12+
npx @devframes/plugin-og
13+
```
14+
15+
Enter any HTTP or HTTPS page reachable from the devframe process. The viewer resolves relative image and icon URLs against the fetched document and identifies missing metadata with a ready-to-use Nuxt `useSeoMeta()` snippet.
16+
17+
## Create A Definition
18+
19+
```ts
20+
import { createOgDevframe } from '@devframes/plugin-og'
21+
22+
export default createOgDevframe({
23+
defaultUrl: 'http://localhost:3000/about',
24+
})
25+
```
26+
27+
`defaultUrl` supplies the initial target and makes `devframe build` bake that page into the static RPC dump. The resulting report keeps its assets relative and runs from any deployment path.
28+
29+
The standalone server requires devframe's trust handshake by default because it can request developer-supplied URLs. Set `auth: false` only for an isolated local environment.

‎examples/minimal-vite-devframe-hub/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@devframes/plugin-git": "workspace:*",
2020
"@devframes/plugin-inspect": "workspace:*",
2121
"@devframes/plugin-messages": "workspace:*",
22+
"@devframes/plugin-og": "workspace:*",
2223
"@devframes/plugin-terminals": "workspace:*",
2324
"colorjs.io": "catalog:frontend",
2425
"devframe": "workspace:*"

‎examples/minimal-vite-devframe-hub/vite.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { registerDataSource } from '@devframes/plugin-data-inspector/registry'
55
import gitDevframe from '@devframes/plugin-git'
66
import inspectDevframe from '@devframes/plugin-inspect'
77
import messagesDevframe from '@devframes/plugin-messages'
8+
import ogDevframe from '@devframes/plugin-og'
89
import terminalsDevframe from '@devframes/plugin-terminals'
910
import UnoCSS from 'unocss/vite'
1011
import { defineConfig } from 'vite'
@@ -61,6 +62,7 @@ export default defineConfig({
6162
dataInspectorDevframe,
6263
a11yDevframe,
6364
messagesDevframe,
65+
ogDevframe,
6466
],
6567
// Attach the a11y inspector's in-page agent as its dock's client script.
6668
// The hub client runtime (booted in src/client/main.ts) imports it into

‎plugins/og/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nuxt
2+
src/spa/.nuxt

‎plugins/og/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `@devframes/plugin-og`
2+
3+
Inspect Open Graph and Twitter metadata for any reachable page, then compare its social preview across Twitter, Facebook, LinkedIn, and Telegram.
4+
5+
```sh
6+
npx @devframes/plugin-og
7+
```
8+
9+
The package exports `createOgDevframe()` for custom definitions and `ogVitePlugin()` from `@devframes/plugin-og/vite` for Vite hosts. Pass `defaultUrl` to bake a shareable report with the devframe build adapter.

‎plugins/og/bin.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env node
2+
import process from 'node:process'
3+
import { createOgCli } from './dist/cli.mjs'
4+
5+
async function main() {
6+
await createOgCli().parse()
7+
}
8+
9+
main().catch((error) => {
10+
console.error(error)
11+
process.exit(1)
12+
})

‎plugins/og/package.json‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"name": "@devframes/plugin-og",
3+
"type": "module",
4+
"version": "0.7.5",
5+
"description": "Devframe plugin for inspecting Open Graph metadata and previewing social cards for any URL.",
6+
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
7+
"license": "MIT",
8+
"homepage": "https://github.com/devframes/devframe#readme",
9+
"repository": {
10+
"directory": "plugins/og",
11+
"type": "git",
12+
"url": "git+https://github.com/devframes/devframe.git"
13+
},
14+
"bugs": "https://github.com/devframes/devframe/issues",
15+
"keywords": [
16+
"devframe",
17+
"devframe-plugin",
18+
"devtools",
19+
"open-graph",
20+
"social-preview"
21+
],
22+
"sideEffects": false,
23+
"exports": {
24+
".": "./dist/index.mjs",
25+
"./client": "./dist/client/index.mjs",
26+
"./cli": "./dist/cli.mjs",
27+
"./node": "./dist/node/index.mjs",
28+
"./rpc": "./dist/rpc/index.mjs",
29+
"./vite": "./dist/vite.mjs",
30+
"./package.json": "./package.json"
31+
},
32+
"types": "./dist/index.d.mts",
33+
"bin": {
34+
"devframe-og": "./bin.mjs"
35+
},
36+
"files": [
37+
"bin.mjs",
38+
"dist"
39+
],
40+
"scripts": {
41+
"build": "tsdown && vite build --config src/spa/vite.config.ts",
42+
"dev": "vite --config src/spa/vite.config.ts --host 0.0.0.0",
43+
"watch": "tsdown --watch",
44+
"cli:build": "node bin.mjs build --out-dir dist/static",
45+
"prepack": "pnpm build",
46+
"test": "vitest run",
47+
"typecheck": "tsc --noEmit"
48+
},
49+
"peerDependencies": {
50+
"devframe": "workspace:*",
51+
"vite": "^7.0.0 || ^8.0.0"
52+
},
53+
"peerDependenciesMeta": {
54+
"vite": {
55+
"optional": true
56+
}
57+
},
58+
"dependencies": {
59+
"cac": "catalog:deps",
60+
"nostics": "catalog:deps",
61+
"parse5": "catalog:deps",
62+
"valibot": "catalog:deps"
63+
},
64+
"devDependencies": {
65+
"@antfu/design": "catalog:frontend",
66+
"@iconify-json/ph": "catalog:frontend",
67+
"@types/node": "catalog:types",
68+
"@vitejs/plugin-vue": "catalog:build",
69+
"devframe": "workspace:*",
70+
"get-port-please": "catalog:deps",
71+
"h3": "catalog:deps",
72+
"tsdown": "catalog:build",
73+
"unocss": "catalog:frontend",
74+
"vite": "catalog:build",
75+
"vitest": "catalog:testing",
76+
"vue": "catalog:frontend",
77+
"ws": "catalog:deps"
78+
}
79+
}

0 commit comments

Comments
 (0)