This repository contains a TypeScript Vite plugin that converts Open Graph options into <meta> descriptors.
src/index.tsexposes the plugin and public types.src/transform.tsbuilds Vite HTML tag descriptors;src/utils.tshandles key conversion and nested attributes.src/types/defines the public Open Graph, Twitter, and Facebook option shapes.test/contains Vitest tests, fixtures, and snapshots undertest/__snapshots__/.playground/is a small workspace package for manual browser checks.tsdown.config.ts,tsconfig.json, andeslint.config.jscontrol building, type checking, and linting.
Keep public API changes in src/types/ aligned with transformation behavior and README examples.
Use the pinned pnpm version from package.json (currently pnpm 10).
pnpm installinstalls all workspace dependencies.pnpm buildproduces ESM, CommonJS, and declaration output indist/.pnpm devrebuilds the plugin in watch mode.pnpm playstarts the Vite playground for manual verification.pnpm test --runruns the Vitest suite once;pnpm teststarts watch mode locally.pnpm typecheckruns strict TypeScript checks without emitting files.pnpm lintapplies ESLint fixes. Review its changes before committing.
Before opening a PR, run pnpm build && pnpm typecheck && pnpm test --run && pnpm lint.
Follow the Antfu ESLint configuration and existing TypeScript style: two-space indentation, single quotes, semicolons, braces for control flow, and 1TBS brace placement. Use camelCase for variables/functions, PascalCase for exported types, and uppercase snake case for constants such as EXCEPTION_FIELD. Preserve explicit .ts extensions in local imports. Prefer small pure helpers and strict, exported types over untyped objects.
Tests use Vitest. Place tests in test/*.test.ts, group behavior with describe, and use focused it descriptions. Cover ordinary values, nested metadata, numeric values, arrays, and edge cases. Snapshot changes must be intentional; update them with pnpm test --run -u and inspect the diff.
History follows Conventional Commit-style prefixes such as fix:, test:, build:, ci:, and chore:. Keep subjects imperative and scoped to one change. PRs should explain the user-visible behavior, link relevant issues, and list verification performed. Include updated tests/snapshots for output changes and playground screenshots only when visual behavior is relevant.