@copypatch/core
v2.0.0
Published
Shared types, contracts, constants, and validation for CopyPatch
Maintainers
Readme
@copypatch/core
Shared ESM contracts and helpers for the CopyPatch package family. Use this package when you need the canonical request/response types, validation helpers, and API constants outside the ready-made React or Next.js integrations.
Install
pnpm add @copypatch/coreMinimal usage
import {
API_BASE_PATH,
isValidContentKey,
normalizeText,
type ContentSnapshot,
} from '@copypatch/core';
const key = 'home.hero.title';
const ok = isValidContentKey(key);
const text = normalizeText('Hello\nWorld');
const snapshot: ContentSnapshot = {
revision: 1,
content: {
[key]: ok ? text : 'Fallback',
},
};
console.log(API_BASE_PATH, snapshot);Exports
@copypatch/core: shared types such asContentSnapshot,EditorSnapshot, request/response contracts, API constants, and validation helpers.
Requirements
- ESM-only package
- Node.js
>=20
Links
- Docs: copypatch.vercel.app
- Source: github.com/Woffluon/CopyPatch
- Issues: github.com/Woffluon/CopyPatch/issues
License
MIT
