doc-model.js 2.5.2 → 2.5.3
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 +17 -0
- package/dist/layout.d.cts +8 -8
- package/dist/layout.d.ts +8 -8
- package/dist/package.d.cts +2 -2
- package/dist/package.d.ts +2 -2
- package/dist/schema-io.cjs +1 -1
- package/dist/schema-io.js +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.ts +2 -2
- package/package.json +1 -1
- package/schemas/content-document.schema.json +3 -3
- package/schemas/document-package.schema.json +3 -3
- package/schemas/layout-document.schema.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,23 @@ try {
|
|
|
173
173
|
|
|
174
174
|
None of these five packages depend on each other for this vocabulary — each depends on `document-schema.js` directly, which is the whole point: one schema, not five independently-maintained, drift-prone copies.
|
|
175
175
|
|
|
176
|
+
## Build, test, and lint
|
|
177
|
+
|
|
178
|
+
Requires Node.js `>=20` and pnpm `11.6.0` (pinned via `packageManager` in `package.json`).
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
pnpm install
|
|
182
|
+
pnpm build # turbo run _build -> tsdown && node scripts/generate-json-schemas.mjs (ESM + CJS + .d.ts in dist/, plus the three published .schema.json files in schemas/)
|
|
183
|
+
pnpm typecheck # turbo run _typecheck _typecheck:node -> tsc -p tsconfig.json && tsc -p tsconfig.node.json
|
|
184
|
+
pnpm lint # turbo run _lint -> eslint . --fix --cache --max-warnings 0
|
|
185
|
+
pnpm test # turbo run _test -> vitest run --project unit
|
|
186
|
+
pnpm test:workers # turbo run _test:workers -> vitest run --config vitest.workers.config.ts (runs the test/workers suite under the real Cloudflare Workers runtime via @cloudflare/vitest-pool-workers, turning "pure Zod, no Node-API usage" into a runtime-checked fact rather than an assertion)
|
|
187
|
+
pnpm test:watch # vitest --project unit
|
|
188
|
+
pnpm test:smoke # turbo run _test:smoke -> rebuilds dist/ and schemas/ first, then verifies the built ESM/CJS output loads and exposes the public surface, and that the three generated JSON Schema files exist and are correctly version-pinned
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
To run a single test file: `pnpm vitest run src/path/to/file.test.ts`.
|
|
192
|
+
|
|
176
193
|
## npm aliases
|
|
177
194
|
|
|
178
195
|
This package also publishes under the following alternate npm names — the identical build, same version, republished by CI alongside the primary `document-schema.js` package:
|
package/dist/layout.d.cts
CHANGED
|
@@ -9,12 +9,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
9
9
|
font: z.ZodObject<{
|
|
10
10
|
family: z.ZodString;
|
|
11
11
|
weight: z.ZodEnum<{
|
|
12
|
-
normal: "normal";
|
|
13
12
|
bold: "bold";
|
|
13
|
+
normal: "normal";
|
|
14
14
|
}>;
|
|
15
15
|
style: z.ZodEnum<{
|
|
16
|
-
normal: "normal";
|
|
17
16
|
italic: "italic";
|
|
17
|
+
normal: "normal";
|
|
18
18
|
}>;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
sizePt: z.ZodNumber;
|
|
@@ -202,12 +202,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
202
202
|
font: z.ZodObject<{
|
|
203
203
|
family: z.ZodString;
|
|
204
204
|
weight: z.ZodEnum<{
|
|
205
|
-
normal: "normal";
|
|
206
205
|
bold: "bold";
|
|
206
|
+
normal: "normal";
|
|
207
207
|
}>;
|
|
208
208
|
style: z.ZodEnum<{
|
|
209
|
-
normal: "normal";
|
|
210
209
|
italic: "italic";
|
|
210
|
+
normal: "normal";
|
|
211
211
|
}>;
|
|
212
212
|
}, z.core.$strip>;
|
|
213
213
|
sizePt: z.ZodNumber;
|
|
@@ -353,12 +353,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
353
353
|
font: z.ZodObject<{
|
|
354
354
|
family: z.ZodString;
|
|
355
355
|
weight: z.ZodEnum<{
|
|
356
|
-
normal: "normal";
|
|
357
356
|
bold: "bold";
|
|
357
|
+
normal: "normal";
|
|
358
358
|
}>;
|
|
359
359
|
style: z.ZodEnum<{
|
|
360
|
-
normal: "normal";
|
|
361
360
|
italic: "italic";
|
|
361
|
+
normal: "normal";
|
|
362
362
|
}>;
|
|
363
363
|
}, z.core.$strip>;
|
|
364
364
|
sizePt: z.ZodNumber;
|
|
@@ -528,12 +528,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
528
528
|
font: z.ZodObject<{
|
|
529
529
|
family: z.ZodString;
|
|
530
530
|
weight: z.ZodEnum<{
|
|
531
|
-
normal: "normal";
|
|
532
531
|
bold: "bold";
|
|
532
|
+
normal: "normal";
|
|
533
533
|
}>;
|
|
534
534
|
style: z.ZodEnum<{
|
|
535
|
-
normal: "normal";
|
|
536
535
|
italic: "italic";
|
|
536
|
+
normal: "normal";
|
|
537
537
|
}>;
|
|
538
538
|
}, z.core.$strip>;
|
|
539
539
|
sizePt: z.ZodNumber;
|
package/dist/layout.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
9
9
|
font: z.ZodObject<{
|
|
10
10
|
family: z.ZodString;
|
|
11
11
|
weight: z.ZodEnum<{
|
|
12
|
-
normal: "normal";
|
|
13
12
|
bold: "bold";
|
|
13
|
+
normal: "normal";
|
|
14
14
|
}>;
|
|
15
15
|
style: z.ZodEnum<{
|
|
16
|
-
normal: "normal";
|
|
17
16
|
italic: "italic";
|
|
17
|
+
normal: "normal";
|
|
18
18
|
}>;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
sizePt: z.ZodNumber;
|
|
@@ -202,12 +202,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
202
202
|
font: z.ZodObject<{
|
|
203
203
|
family: z.ZodString;
|
|
204
204
|
weight: z.ZodEnum<{
|
|
205
|
-
normal: "normal";
|
|
206
205
|
bold: "bold";
|
|
206
|
+
normal: "normal";
|
|
207
207
|
}>;
|
|
208
208
|
style: z.ZodEnum<{
|
|
209
|
-
normal: "normal";
|
|
210
209
|
italic: "italic";
|
|
210
|
+
normal: "normal";
|
|
211
211
|
}>;
|
|
212
212
|
}, z.core.$strip>;
|
|
213
213
|
sizePt: z.ZodNumber;
|
|
@@ -353,12 +353,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
353
353
|
font: z.ZodObject<{
|
|
354
354
|
family: z.ZodString;
|
|
355
355
|
weight: z.ZodEnum<{
|
|
356
|
-
normal: "normal";
|
|
357
356
|
bold: "bold";
|
|
357
|
+
normal: "normal";
|
|
358
358
|
}>;
|
|
359
359
|
style: z.ZodEnum<{
|
|
360
|
-
normal: "normal";
|
|
361
360
|
italic: "italic";
|
|
361
|
+
normal: "normal";
|
|
362
362
|
}>;
|
|
363
363
|
}, z.core.$strip>;
|
|
364
364
|
sizePt: z.ZodNumber;
|
|
@@ -528,12 +528,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
528
528
|
font: z.ZodObject<{
|
|
529
529
|
family: z.ZodString;
|
|
530
530
|
weight: z.ZodEnum<{
|
|
531
|
-
normal: "normal";
|
|
532
531
|
bold: "bold";
|
|
532
|
+
normal: "normal";
|
|
533
533
|
}>;
|
|
534
534
|
style: z.ZodEnum<{
|
|
535
|
-
normal: "normal";
|
|
536
535
|
italic: "italic";
|
|
536
|
+
normal: "normal";
|
|
537
537
|
}>;
|
|
538
538
|
}, z.core.$strip>;
|
|
539
539
|
sizePt: z.ZodNumber;
|
package/dist/package.d.cts
CHANGED
|
@@ -515,12 +515,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
|
|
|
515
515
|
font: z.ZodObject<{
|
|
516
516
|
family: z.ZodString;
|
|
517
517
|
weight: z.ZodEnum<{
|
|
518
|
-
normal: "normal";
|
|
519
518
|
bold: "bold";
|
|
519
|
+
normal: "normal";
|
|
520
520
|
}>;
|
|
521
521
|
style: z.ZodEnum<{
|
|
522
|
-
normal: "normal";
|
|
523
522
|
italic: "italic";
|
|
523
|
+
normal: "normal";
|
|
524
524
|
}>;
|
|
525
525
|
}, z.core.$strip>;
|
|
526
526
|
sizePt: z.ZodNumber;
|
package/dist/package.d.ts
CHANGED
|
@@ -515,12 +515,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
|
|
|
515
515
|
font: z.ZodObject<{
|
|
516
516
|
family: z.ZodString;
|
|
517
517
|
weight: z.ZodEnum<{
|
|
518
|
-
normal: "normal";
|
|
519
518
|
bold: "bold";
|
|
519
|
+
normal: "normal";
|
|
520
520
|
}>;
|
|
521
521
|
style: z.ZodEnum<{
|
|
522
|
-
normal: "normal";
|
|
523
522
|
italic: "italic";
|
|
523
|
+
normal: "normal";
|
|
524
524
|
}>;
|
|
525
525
|
}, z.core.$strip>;
|
|
526
526
|
sizePt: z.ZodNumber;
|
package/dist/schema-io.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
9
9
|
LayoutDocument: "layout-document.schema.json"
|
|
10
10
|
};
|
|
11
11
|
function schemaUriFor(kind) {
|
|
12
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
12
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
13
13
|
}
|
|
14
14
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
|
|
15
15
|
function kindForFileStem(stem) {
|
package/dist/schema-io.js
CHANGED
|
@@ -8,7 +8,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
8
8
|
LayoutDocument: "layout-document.schema.json"
|
|
9
9
|
};
|
|
10
10
|
function schemaUriFor(kind) {
|
|
11
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
11
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
12
12
|
}
|
|
13
13
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
|
|
14
14
|
function kindForFileStem(stem) {
|
package/dist/style.d.cts
CHANGED
|
@@ -10,12 +10,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
|
|
|
10
10
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
11
11
|
family: z.ZodString;
|
|
12
12
|
weight: z.ZodEnum<{
|
|
13
|
-
normal: "normal";
|
|
14
13
|
bold: "bold";
|
|
14
|
+
normal: "normal";
|
|
15
15
|
}>;
|
|
16
16
|
style: z.ZodEnum<{
|
|
17
|
-
normal: "normal";
|
|
18
17
|
italic: "italic";
|
|
18
|
+
normal: "normal";
|
|
19
19
|
}>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
package/dist/style.d.ts
CHANGED
|
@@ -10,12 +10,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
|
|
|
10
10
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
11
11
|
family: z.ZodString;
|
|
12
12
|
weight: z.ZodEnum<{
|
|
13
|
-
normal: "normal";
|
|
14
13
|
bold: "bold";
|
|
14
|
+
normal: "normal";
|
|
15
15
|
}>;
|
|
16
16
|
style: z.ZodEnum<{
|
|
17
|
-
normal: "normal";
|
|
18
17
|
italic: "italic";
|
|
18
|
+
normal: "normal";
|
|
19
19
|
}>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/content-document.schema.json",
|
|
4
4
|
"oneOf": [
|
|
5
5
|
{
|
|
6
6
|
"type": "object",
|
|
@@ -1208,7 +1208,7 @@
|
|
|
1208
1208
|
]
|
|
1209
1209
|
},
|
|
1210
1210
|
"document": {
|
|
1211
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
1211
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/content-document.schema.json"
|
|
1212
1212
|
},
|
|
1213
1213
|
"frame": {
|
|
1214
1214
|
"$ref": "#/$defs/Box"
|
|
@@ -2499,7 +2499,7 @@
|
|
|
2499
2499
|
]
|
|
2500
2500
|
},
|
|
2501
2501
|
"document": {
|
|
2502
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
2502
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/content-document.schema.json"
|
|
2503
2503
|
},
|
|
2504
2504
|
"frame": {
|
|
2505
2505
|
"$ref": "#/$defs/Box"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/document-package.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"formatVersion": {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"const": 1
|
|
9
9
|
},
|
|
10
10
|
"content": {
|
|
11
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
11
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/content-document.schema.json"
|
|
12
12
|
},
|
|
13
13
|
"layout": {
|
|
14
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
14
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/layout-document.schema.json"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"required": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.3/schemas/layout-document.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"formatVersion": {
|