@openpresentation/opf 0.26.4 → 0.26.6
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 +2 -0
- package/dist/browser.js +13 -12
- package/dist/{chunk-GWJBZ4LC.js → chunk-3S2XVDPN.js} +5 -5
- package/dist/{chunk-6IXSHIAL.js → chunk-4K4G3JXR.js} +6 -6
- package/dist/{chunk-QH2W6HIM.js → chunk-77KL2PMM.js} +1 -1
- package/dist/{chunk-H5QC3X3K.js → chunk-A54NGT2K.js} +1 -1
- package/dist/{chunk-NZLW6FBQ.js → chunk-D25BNPTW.js} +1 -1
- package/dist/chunk-G5WJMJV3.js +452 -0
- package/dist/{chunk-EDCRBTJF.js → chunk-GIWNHRTX.js} +3 -3
- package/dist/{chunk-MN7DRK57.js → chunk-H7XMO36O.js} +11 -21
- package/dist/{chunk-XFOOKVRI.js → chunk-IVPA6NG6.js} +5145 -3508
- package/dist/{chunk-ZSZDVIDV.js → chunk-NVT2YDVC.js} +2 -2
- package/dist/{chunk-O6BY3AU2.js → chunk-PHP45MO7.js} +1 -1
- package/dist/{chunk-PIO73BQ6.js → chunk-VZBFQLCA.js} +11 -20
- package/dist/{chunk-6NBTZYYD.js → chunk-Y25DYRME.js} +1 -1
- package/dist/chunk-Y4TZCE7R.js +712 -0
- package/dist/{conversion-DSafOGzh.d.ts → conversion-16M7eOGP.d.ts} +2 -2
- package/dist/conversion-F3T2FUP3.js +21 -0
- package/dist/convert.js +5 -5
- package/dist/deck.js +8 -8
- package/dist/diff.js +2 -2
- package/dist/docs.js +3 -3
- package/dist/explain-JSuESV-Y.d.ts +71 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +17 -16
- package/dist/markdown.js +6 -6
- package/dist/node-engine.d.ts +2 -2
- package/dist/node-engine.js +17 -16
- package/dist/pagination.js +2 -2
- package/dist/patch.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/source.d.ts +83 -2
- package/dist/source.js +10 -9
- package/dist/validator.d.ts +8 -3
- package/dist/validator.js +1 -1
- package/dist/yaml.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-QAEBYDKY.js +0 -192
- package/dist/conversion-QIAJM6DQ.js +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OPFApiError } from './chunk-
|
|
2
|
-
import { CATALOG_SCHEMA } from './chunk-
|
|
1
|
+
import { OPFApiError } from './chunk-D25BNPTW.js';
|
|
2
|
+
import { CATALOG_SCHEMA } from './chunk-IVPA6NG6.js';
|
|
3
3
|
import { CATALOG_SCHEMA as CATALOG_SCHEMA$1, gallery } from '@openpresentation/gallery';
|
|
4
4
|
|
|
5
5
|
function galleryMismatch(declared, reads = CATALOG_SCHEMA) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
|
|
2
|
-
import { Ctx } from './chunk-
|
|
3
|
-
import { same } from './chunk-
|
|
4
|
-
import { validate } from './chunk-
|
|
2
|
+
import { Ctx, describeYamlErrors } from './chunk-Y4TZCE7R.js';
|
|
3
|
+
import { same } from './chunk-Y25DYRME.js';
|
|
4
|
+
import { validate } from './chunk-IVPA6NG6.js';
|
|
5
5
|
import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
|
|
6
6
|
import { sortPresentationKeys } from './chunk-EQ6S5SEZ.js';
|
|
7
7
|
import { presentation } from './chunk-F4HFDP6I.js';
|
|
8
|
-
import { Parser, parseDocument, isMap, Document, visit, isScalar, isAlias
|
|
8
|
+
import { Parser, parseDocument, isMap, isSeq, Document, visit, isScalar, isAlias } from 'yaml';
|
|
9
9
|
|
|
10
10
|
var MAX_ALIAS_COUNT = 100;
|
|
11
11
|
var CORE_TAGS = new Set(["map", "seq", "str", "int", "float", "bool", "null"].map((name) => `tag:yaml.org,2002:${name}`));
|
|
@@ -59,16 +59,6 @@ function describeError(error) {
|
|
|
59
59
|
return { rule: "syntax", message: `YAML: ${text}`, help: "Fix the YAML syntax at this position. An OPF file holds JSON-compatible YAML 1.2: mappings, sequences and scalars." };
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function keyRangeAt(doc, start) {
|
|
63
|
-
let found;
|
|
64
|
-
visit(doc, {
|
|
65
|
-
Pair(_key, pair) {
|
|
66
|
-
const key = pair.key;
|
|
67
|
-
if (!found && key?.range && key.range[0] === start) found = { start, end: key.range[1] };
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return found;
|
|
71
|
-
}
|
|
72
62
|
function readYamlDocument(source, aliases, rootKind = "mapping") {
|
|
73
63
|
const bom = source.startsWith("\uFEFF") ? 1 : 0;
|
|
74
64
|
const text = source.slice(bom);
|
|
@@ -91,20 +81,21 @@ function readYamlDocument(source, aliases, rootKind = "mapping") {
|
|
|
91
81
|
findings,
|
|
92
82
|
errors: findings.length
|
|
93
83
|
});
|
|
94
|
-
for (const
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
84
|
+
for (const problem of describeYamlErrors(text, doc, doc.errors)) add(problem.rule, problem.message, problem.help, { start: problem.start, end: problem.end });
|
|
85
|
+
for (const warning of doc.warnings.filter((entry) => entry.code === "TAG_RESOLVE_FAILED")) {
|
|
86
|
+
const described = describeError(warning);
|
|
87
|
+
const [start, end] = warning.pos;
|
|
88
|
+
add(described.rule, described.message, described.help, { start, end: Math.max(start, end) });
|
|
98
89
|
}
|
|
99
90
|
if (findings.length) return finish({});
|
|
100
91
|
const root = doc.contents;
|
|
101
92
|
if (root === null || !root.range) {
|
|
102
|
-
add("empty", "The
|
|
93
|
+
add("empty", "The document is empty (or everything in it is a comment).", "Write `slides:` and at least one `- title:` line.", { start: 0, end: Math.min(1, text.length) });
|
|
103
94
|
return finish({});
|
|
104
95
|
}
|
|
105
96
|
const rootRange = { start: root.range[0], end: root.range[1] };
|
|
106
97
|
if (rootKind === "mapping" && !isMap(root)) {
|
|
107
|
-
add("not-mapping",
|
|
98
|
+
add("not-mapping", `The top level must be \`key: value\` lines, but this is ${isSeq(root) ? "a list" : "plain text"}.`, isSeq(root) ? "Put the list under `slides:`." : "Start with `name:` and `slides:` lines.", rootRange);
|
|
108
99
|
return finish({});
|
|
109
100
|
}
|
|
110
101
|
checkTree({ doc, text, aliases, add }, root, [], []);
|