email-builder-online 4.1.5 → 4.1.7
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 +37 -3
- package/dist/index.cjs +164 -164
- package/dist/index.d.ts +65 -2
- package/dist/index.mjs +50 -11
- package/dist/standalone.js +1 -1
- package/dist/standalone.mjs +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -777,15 +777,49 @@ interface AIFeatureRequest {
|
|
|
777
777
|
|
|
778
778
|
## Block Schemas & Validation (`@eb/document-core`)
|
|
779
779
|
|
|
780
|
-
All block schemas, the document-level schema, and the validation logic are exported from the `@eb/document-core` package.
|
|
780
|
+
All block schemas, the document-level schema, and the validation logic are exported from the `@eb/document-core` package. The package ships a **node-safe entry** with **zero browser dependencies** (only `zod` is required) — designed for MCP servers, backend scripts, and CLI tools that validate documents in a plain Node.js process.
|
|
781
|
+
|
|
782
|
+
### Two entry points
|
|
783
|
+
|
|
784
|
+
| Entry | Import specifier | Contents | Deps |
|
|
785
|
+
|---|---|---|---|
|
|
786
|
+
| Default (editor) | `@eb/document-core` | Everything, incl. React-coupled builders (`buildBlockComponent`) | React + Zod |
|
|
787
|
+
| **Node-safe** | `@eb/document-core/node` | Schemas, validation, theme schemas, resolvers — **no React** | Zod only |
|
|
788
|
+
|
|
789
|
+
> Server-side consumers (MCP, backend, CLI) must import from **`@eb/document-core/node`** so they never pull in React.
|
|
781
790
|
|
|
782
791
|
### Installation
|
|
783
792
|
|
|
793
|
+
**Inside this monorepo** (e.g. `@eb/backend`) — workspace protocol:
|
|
794
|
+
|
|
784
795
|
```bash
|
|
785
|
-
# Within the monorepo (workspace protocol)
|
|
786
796
|
pnpm add @eb/document-core
|
|
787
797
|
```
|
|
788
798
|
|
|
799
|
+
**From an external project** (e.g. the standalone MCP repo) — the package is not
|
|
800
|
+
published, so consume a **vendored** build. Generate it from the monorepo:
|
|
801
|
+
|
|
802
|
+
```bash
|
|
803
|
+
cd packages/document-core
|
|
804
|
+
pnpm vendor # bundles the node-safe entry → vendor/document-core + a .tgz tarball
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
Copy `vendor/document-core` (or the `eb-document-core-<version>.tgz` tarball) into
|
|
808
|
+
the consumer repo and reference it via `file:`:
|
|
809
|
+
|
|
810
|
+
```jsonc
|
|
811
|
+
// consumer package.json
|
|
812
|
+
{
|
|
813
|
+
"dependencies": {
|
|
814
|
+
"@eb/document-core": "file:./vendor/document-core",
|
|
815
|
+
"zod": "^3.22.4" // peer dep — provided by the consumer
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
The vendored bundle ships ESM + CJS + `.d.ts` and type-checks **without
|
|
821
|
+
`@types/react`**.
|
|
822
|
+
|
|
789
823
|
### Schemas
|
|
790
824
|
|
|
791
825
|
```ts
|
|
@@ -823,7 +857,7 @@ import {
|
|
|
823
857
|
### Validation
|
|
824
858
|
|
|
825
859
|
```ts
|
|
826
|
-
import { validateDocument, type ValidationResult } from '@eb/document-core';
|
|
860
|
+
import { validateDocument, type ValidationResult } from '@eb/document-core/node';
|
|
827
861
|
|
|
828
862
|
const result: ValidationResult = validateDocument(jsonDocument);
|
|
829
863
|
|