@agentshouse/mdmodel 0.1.0-c669bdbad8a03 → 0.1.0-c679f403bf3fb
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/API.md +71 -61
- package/dist/condition.d.ts +19 -7
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +189 -85
- package/dist/definition.d.ts +1 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +29 -3
- package/dist/divide.js +9 -9
- package/dist/document.d.ts +4 -4
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +28 -30
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/links.d.ts +1 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +43 -28
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +3 -5
- package/dist/types.d.ts +8 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +25 -4
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +135 -65
- package/fixtures/README.md +5 -4
- package/fixtures/division.json +26 -26
- package/package.json +1 -1
package/dist/document.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { ARRAY_INDEX, pointerSegments } from './definition.js';
|
|
2
|
-
import { hrefOccurrences } from './links.js';
|
|
2
|
+
import { destinations, hrefOccurrences, linkInventory, } from './links.js';
|
|
3
3
|
import { destinationPath, relative, retarget, roomPath, roomTarget, SHELL_ROOMS, shellTarget, target, } from './paths.js';
|
|
4
4
|
import { references } from './references.js';
|
|
5
5
|
import { headingSpans, sectionsRecord } from './sections.js';
|
|
6
6
|
import { refusal } from './refuse.js';
|
|
7
7
|
import { bodyStartAfterYaml, bodyStartOf, equalValue, extractFrontmatter, frontmatterValue, jsValue, lineEnding, mapEntry, parseYamlMapping, serializeJs, serializeKey, YamlError, } from './yaml.js';
|
|
8
8
|
const internals = new WeakMap();
|
|
9
|
+
const inventories = new WeakMap();
|
|
10
|
+
export function inventoryOf(document) {
|
|
11
|
+
const held = inventories.get(document);
|
|
12
|
+
if (held !== undefined)
|
|
13
|
+
return held;
|
|
14
|
+
const inventory = linkInventory(document.content.slice(bodyStartOf(document.content)));
|
|
15
|
+
inventories.set(document, inventory);
|
|
16
|
+
return inventory;
|
|
17
|
+
}
|
|
9
18
|
function refuse(file, rule, location) {
|
|
10
19
|
return location === undefined ? refusal(file, rule) : refusal(file, rule, { location });
|
|
11
20
|
}
|
|
@@ -141,12 +150,16 @@ function scalarText(source, value) {
|
|
|
141
150
|
return JSON.stringify(value);
|
|
142
151
|
return serializeJs(value);
|
|
143
152
|
}
|
|
144
|
-
export function relativize(document, file, handle, definition) {
|
|
153
|
+
export function relativize(document, file, handle, definition, kept = new Set()) {
|
|
154
|
+
const relativized = (href) => {
|
|
155
|
+
const path = shellTarget(href, handle);
|
|
156
|
+
return path === null || kept.has(`${SHELL_ROOMS}${handle}/${path}`) ? null : path;
|
|
157
|
+
};
|
|
145
158
|
const changes = [];
|
|
146
159
|
for (const { pointer, value } of definition === undefined
|
|
147
160
|
? []
|
|
148
161
|
: references(document, definition)) {
|
|
149
|
-
const path =
|
|
162
|
+
const path = relativized(value);
|
|
150
163
|
if (path !== null)
|
|
151
164
|
changes.push({
|
|
152
165
|
kind: 'reference',
|
|
@@ -155,9 +168,8 @@ export function relativize(document, file, handle, definition) {
|
|
|
155
168
|
prior: value,
|
|
156
169
|
});
|
|
157
170
|
}
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const path = shellTarget(href, handle);
|
|
171
|
+
for (const href of new Set(destinations(inventoryOf(document)).map(({ href }) => href))) {
|
|
172
|
+
const path = relativized(href);
|
|
161
173
|
if (path !== null)
|
|
162
174
|
changes.push({ kind: 'link', href, to: relative(file, path) });
|
|
163
175
|
}
|
|
@@ -180,7 +192,7 @@ export function relinkBody(body, file, moves) {
|
|
|
180
192
|
const to = from === null ? undefined : moves.get(from);
|
|
181
193
|
if (to === undefined)
|
|
182
194
|
continue;
|
|
183
|
-
const written = retarget(match.href, from.startsWith(SHELL_ROOMS) ? to : relative(file, to));
|
|
195
|
+
const written = retarget(match.href, from.startsWith(SHELL_ROOMS) || to.startsWith(SHELL_ROOMS) ? to : relative(file, to));
|
|
184
196
|
const text = destinationText(written, match.bracketed);
|
|
185
197
|
if (text === null)
|
|
186
198
|
return { outcome: 'refuse', refusal: refuse(file, 'unwritable-link', written) };
|
|
@@ -189,35 +201,25 @@ export function relinkBody(body, file, moves) {
|
|
|
189
201
|
}
|
|
190
202
|
return { outcome: 'applied', body: rewritten + body.slice(cursor) };
|
|
191
203
|
}
|
|
192
|
-
function
|
|
193
|
-
const found = [];
|
|
194
|
-
for (const occurrence of hrefOccurrences(text)) {
|
|
195
|
-
const resolved = target(file, occurrence.href);
|
|
196
|
-
if (resolved !== null)
|
|
197
|
-
found.push({ href: occurrence.href, target: resolved, start: offset + occurrence.start });
|
|
198
|
-
}
|
|
199
|
-
return found;
|
|
200
|
-
}
|
|
201
|
-
function linksIn(text, file) {
|
|
204
|
+
function linksIn(occurrences, file) {
|
|
202
205
|
const found = [];
|
|
203
206
|
const seen = new Set();
|
|
204
|
-
for (const occurrence of
|
|
207
|
+
for (const occurrence of occurrences) {
|
|
205
208
|
if (seen.has(occurrence.href))
|
|
206
209
|
continue;
|
|
210
|
+
const resolved = target(file, occurrence.href);
|
|
211
|
+
if (resolved === null)
|
|
212
|
+
continue;
|
|
207
213
|
seen.add(occurrence.href);
|
|
208
|
-
found.push({ href: occurrence.href, target:
|
|
214
|
+
found.push({ href: occurrence.href, target: resolved });
|
|
209
215
|
}
|
|
210
216
|
return found;
|
|
211
217
|
}
|
|
212
218
|
export function links(document, file) {
|
|
213
|
-
return linksIn(
|
|
214
|
-
}
|
|
215
|
-
export function linkOccurrences(document, file) {
|
|
216
|
-
const bodyStart = bodyStartOf(document.content);
|
|
217
|
-
return occurrencesIn(document.content.slice(bodyStart), file, bodyStart);
|
|
219
|
+
return linksIn(destinations(inventoryOf(document)), file);
|
|
218
220
|
}
|
|
219
221
|
export function bodyLinks(body, file) {
|
|
220
|
-
return linksIn(body, file);
|
|
222
|
+
return linksIn(hrefOccurrences(body), file);
|
|
221
223
|
}
|
|
222
224
|
function internalOf(document) {
|
|
223
225
|
const held = internals.get(document);
|
|
@@ -303,7 +305,7 @@ function planner(document, internal) {
|
|
|
303
305
|
const link = (href, to, at) => {
|
|
304
306
|
if (occurrences === undefined) {
|
|
305
307
|
occurrences = new Map();
|
|
306
|
-
for (const occurrence of
|
|
308
|
+
for (const occurrence of destinations(inventoryOf(document))) {
|
|
307
309
|
const same = occurrences.get(occurrence.href);
|
|
308
310
|
if (same === undefined)
|
|
309
311
|
occurrences.set(occurrence.href, [occurrence]);
|
|
@@ -458,10 +460,6 @@ export function apply(document, changes) {
|
|
|
458
460
|
export function serialize(document) {
|
|
459
461
|
return document.content;
|
|
460
462
|
}
|
|
461
|
-
export function fieldStart(document, pointer) {
|
|
462
|
-
const root = internals.get(document)?.root;
|
|
463
|
-
return root === null || root === undefined ? undefined : nodeAt(root, pointer)?.start;
|
|
464
|
-
}
|
|
465
463
|
export function frontmatter(document) {
|
|
466
464
|
return internals.get(document)?.root ?? null;
|
|
467
465
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { dated, datePointers, factKind, facts, fires, holds, instant, itemFires, members, pointed, prosePaths, WRITE_DOORS, } from './condition.js';
|
|
2
|
-
export type { Actor, Condition, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
|
|
1
|
+
export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, valuedChange, WRITE_DOORS, } from './condition.js';
|
|
2
|
+
export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
|
|
3
3
|
export { headingLines } from './blocks.js';
|
|
4
4
|
export type { HeadingLine } from './blocks.js';
|
|
5
5
|
export { divide } from './divide.js';
|
|
6
|
-
export { apply, bodyLinks,
|
|
6
|
+
export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
7
7
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
8
8
|
export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
|
|
9
9
|
export type { RoomTarget } from './paths.js';
|
|
@@ -12,8 +12,9 @@ export { project } from './project.js';
|
|
|
12
12
|
export { references } from './references.js';
|
|
13
13
|
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
14
14
|
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
|
|
15
|
-
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link,
|
|
16
|
-
export { bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verify, } from './validate.js';
|
|
15
|
+
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
16
|
+
export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
17
|
+
export type { Assessment, Verdicts } from './validate.js';
|
|
17
18
|
export { VERSION } from './version.js';
|
|
18
19
|
export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
|
|
19
20
|
export type { FrontmatterValue } from './yaml.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,KAAK,EACL,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,QAAQ,EACR,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,KAAK,EACL,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,KAAK,EACL,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,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,EACR,eAAe,EACf,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { dated, datePointers, factKind, facts, fires, holds, instant, itemFires, members, pointed, prosePaths, WRITE_DOORS, } from './condition.js';
|
|
1
|
+
export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, valuedChange, WRITE_DOORS, } from './condition.js';
|
|
2
2
|
export { headingLines } from './blocks.js';
|
|
3
3
|
export { divide } from './divide.js';
|
|
4
|
-
export { apply, bodyLinks,
|
|
4
|
+
export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
5
5
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
6
6
|
export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
|
|
7
7
|
export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
|
|
8
8
|
export { project } from './project.js';
|
|
9
9
|
export { references } from './references.js';
|
|
10
10
|
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
11
|
-
export { bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verify, } from './validate.js';
|
|
11
|
+
export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
12
12
|
export { VERSION } from './version.js';
|
|
13
13
|
export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
|
package/dist/links.d.ts
CHANGED
|
@@ -24,5 +24,6 @@ export type LinkInventory = {
|
|
|
24
24
|
};
|
|
25
25
|
export declare function fenceSpans(text: string): readonly (readonly [number, number])[];
|
|
26
26
|
export declare function linkInventory(body: string): LinkInventory;
|
|
27
|
+
export declare function destinations(inventory: LinkInventory): readonly HrefOccurrence[];
|
|
27
28
|
export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
|
|
28
29
|
//# sourceMappingURL=links.d.ts.map
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AA2hBA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5D;AAyLD,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,GAC5C,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAOvC;AAED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-z0-9+.-]{1,31}:[^\\x00-\\x20<>]*>',
|
|
28
28
|
"<[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*>",
|
|
29
29
|
].join('|'), 'y');
|
|
30
|
+
const BACKSLASH = 0x5c;
|
|
31
|
+
const BACKTICK = 0x60;
|
|
32
|
+
const LINE_FEED = 0x0a;
|
|
33
|
+
const CARRIAGE_RETURN = 0x0d;
|
|
34
|
+
const LESS_THAN = 0x3c;
|
|
35
|
+
const OPEN_BRACKET = 0x5b;
|
|
36
|
+
const CLOSE_BRACKET = 0x5d;
|
|
37
|
+
const EXCLAMATION = 0x21;
|
|
38
|
+
const OPEN_PAREN = 0x28;
|
|
30
39
|
const DELIMITER_ROW = /^\|?[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)*\|?[ \t]*$/;
|
|
31
40
|
const GAP = /^[ \t\v\f]+/;
|
|
32
41
|
function endOfLine(text, from) {
|
|
@@ -164,10 +173,10 @@ function skipInlineCode(text, index, joins, unclosed) {
|
|
|
164
173
|
const runs = new Map();
|
|
165
174
|
let i = index + ticks;
|
|
166
175
|
while (i < text.length) {
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
176
|
+
const code = text.charCodeAt(i);
|
|
177
|
+
if (code === BACKTICK) {
|
|
169
178
|
let run = 0;
|
|
170
|
-
while (text
|
|
179
|
+
while (text.charCodeAt(i + run) === BACKTICK)
|
|
171
180
|
run += 1;
|
|
172
181
|
if (run === ticks)
|
|
173
182
|
return i + run;
|
|
@@ -175,9 +184,9 @@ function skipInlineCode(text, index, joins, unclosed) {
|
|
|
175
184
|
i += run;
|
|
176
185
|
continue;
|
|
177
186
|
}
|
|
178
|
-
if (
|
|
187
|
+
if (code === CARRIAGE_RETURN && text.charCodeAt(i + 1) !== LINE_FEED)
|
|
179
188
|
break;
|
|
180
|
-
if (
|
|
189
|
+
if (code === LINE_FEED && !joins.has(i))
|
|
181
190
|
break;
|
|
182
191
|
i += 1;
|
|
183
192
|
}
|
|
@@ -200,21 +209,21 @@ function skipInlineSpace(text, start, joins) {
|
|
|
200
209
|
return afterIndent(text, readLine(text, i + 1, endOfLine(text, i + 1)));
|
|
201
210
|
}
|
|
202
211
|
function closeEnd(text, start, open, joins) {
|
|
203
|
-
const close = open === '(' ? ')' : open;
|
|
212
|
+
const close = (open === '(' ? ')' : open).charCodeAt(0);
|
|
204
213
|
let i = start;
|
|
205
214
|
while (i < text.length) {
|
|
206
|
-
const
|
|
215
|
+
const code = text.charCodeAt(i);
|
|
207
216
|
if (escapes(text, i)) {
|
|
208
217
|
i += 2;
|
|
209
218
|
continue;
|
|
210
219
|
}
|
|
211
|
-
if (
|
|
220
|
+
if (code === close)
|
|
212
221
|
return i + 1;
|
|
213
|
-
if (open === '(' &&
|
|
222
|
+
if (open === '(' && code === OPEN_PAREN)
|
|
214
223
|
return null;
|
|
215
|
-
if (
|
|
224
|
+
if (code === CARRIAGE_RETURN && text.charCodeAt(i + 1) !== LINE_FEED)
|
|
216
225
|
return null;
|
|
217
|
-
if (
|
|
226
|
+
if (code === LINE_FEED && !joins.has(i))
|
|
218
227
|
return null;
|
|
219
228
|
i += 1;
|
|
220
229
|
}
|
|
@@ -511,23 +520,23 @@ function structure(text) {
|
|
|
511
520
|
return { joins, raw };
|
|
512
521
|
}
|
|
513
522
|
export function escapes(text, index) {
|
|
514
|
-
return text
|
|
523
|
+
return text.charCodeAt(index) === BACKSLASH && PUNCTUATION.test(text[index + 1] ?? '');
|
|
515
524
|
}
|
|
516
525
|
function referenceEnd(text, start, joins) {
|
|
517
526
|
let i = start;
|
|
518
527
|
while (i < text.length) {
|
|
519
|
-
const
|
|
528
|
+
const code = text.charCodeAt(i);
|
|
520
529
|
if (escapes(text, i)) {
|
|
521
530
|
i += 2;
|
|
522
531
|
continue;
|
|
523
532
|
}
|
|
524
|
-
if (
|
|
533
|
+
if (code === CLOSE_BRACKET)
|
|
525
534
|
return i + 1;
|
|
526
|
-
if (
|
|
535
|
+
if (code === OPEN_BRACKET)
|
|
527
536
|
return -1;
|
|
528
|
-
if (
|
|
537
|
+
if (code === CARRIAGE_RETURN && text.charCodeAt(i + 1) !== LINE_FEED)
|
|
529
538
|
return -1;
|
|
530
|
-
if (
|
|
539
|
+
if (code === LINE_FEED && !joins.has(i))
|
|
531
540
|
return -1;
|
|
532
541
|
i += 1;
|
|
533
542
|
}
|
|
@@ -702,9 +711,10 @@ export function fenceSpans(text) {
|
|
|
702
711
|
function paragraphEnd(text, from, joins) {
|
|
703
712
|
let i = from;
|
|
704
713
|
while (i < text.length) {
|
|
705
|
-
|
|
714
|
+
const code = text.charCodeAt(i);
|
|
715
|
+
if (code === LINE_FEED && !joins.has(i))
|
|
706
716
|
return i;
|
|
707
|
-
if (
|
|
717
|
+
if (code === CARRIAGE_RETURN && text.charCodeAt(i + 1) !== LINE_FEED)
|
|
708
718
|
return i;
|
|
709
719
|
i += 1;
|
|
710
720
|
}
|
|
@@ -726,16 +736,16 @@ export function linkInventory(body) {
|
|
|
726
736
|
i = skipEnd;
|
|
727
737
|
continue;
|
|
728
738
|
}
|
|
729
|
-
const
|
|
739
|
+
const code = body.charCodeAt(i);
|
|
730
740
|
if (escapes(body, i)) {
|
|
731
741
|
i += 2;
|
|
732
742
|
continue;
|
|
733
743
|
}
|
|
734
|
-
if (
|
|
744
|
+
if (code === BACKTICK) {
|
|
735
745
|
i = skipInlineCode(body, i, joins, unclosed);
|
|
736
746
|
continue;
|
|
737
747
|
}
|
|
738
|
-
if (
|
|
748
|
+
if (code === LESS_THAN) {
|
|
739
749
|
if (i >= paragraph.end) {
|
|
740
750
|
const end = paragraphEnd(body, i, joins);
|
|
741
751
|
paragraph = { start: i, end, text: body.slice(i, end) };
|
|
@@ -747,18 +757,20 @@ export function linkInventory(body) {
|
|
|
747
757
|
continue;
|
|
748
758
|
}
|
|
749
759
|
}
|
|
750
|
-
if ((
|
|
760
|
+
if ((code === LINE_FEED && !joins.has(i)) ||
|
|
761
|
+
(code === CARRIAGE_RETURN && body.charCodeAt(i + 1) !== LINE_FEED))
|
|
751
762
|
openers.length = 0;
|
|
752
|
-
if (
|
|
763
|
+
if (code === OPEN_BRACKET ||
|
|
764
|
+
(code === EXCLAMATION && body.charCodeAt(i + 1) === OPEN_BRACKET)) {
|
|
753
765
|
const previous = openers.at(-1);
|
|
754
766
|
if (previous !== undefined)
|
|
755
767
|
previous.bracketAfter = true;
|
|
756
|
-
const image =
|
|
768
|
+
const image = code === EXCLAMATION;
|
|
757
769
|
openers.push({ at: image ? i + 1 : i, start: i, image, active: true, bracketAfter: false });
|
|
758
770
|
i += image ? 2 : 1;
|
|
759
771
|
continue;
|
|
760
772
|
}
|
|
761
|
-
if (
|
|
773
|
+
if (code === CLOSE_BRACKET) {
|
|
762
774
|
const opener = openers.pop();
|
|
763
775
|
const use = opener?.active ? closeLink(body, opener, i, definitions, joins) : null;
|
|
764
776
|
if (opener === undefined || use === null) {
|
|
@@ -777,9 +789,12 @@ export function linkInventory(body) {
|
|
|
777
789
|
}
|
|
778
790
|
return { uses, blocks };
|
|
779
791
|
}
|
|
780
|
-
export function
|
|
792
|
+
export function destinations(inventory) {
|
|
781
793
|
const byStart = new Map();
|
|
782
|
-
for (const use of
|
|
794
|
+
for (const use of inventory.uses)
|
|
783
795
|
byStart.set(use.destination.start, use.destination);
|
|
784
796
|
return [...byStart.values()].sort((left, right) => left.start - right.start);
|
|
785
797
|
}
|
|
798
|
+
export function hrefOccurrences(body) {
|
|
799
|
+
return destinations(linkInventory(body));
|
|
800
|
+
}
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAi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;AAEvD,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC;AAEzB,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AA0CtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAWxF;AA4BD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,WAAW,CA+Bb;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAA2C,GACnD,UAAU,CAMZ"}
|
package/dist/project.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { memberFacts } from './definition.js';
|
|
2
|
-
import { frontmatter } from './document.js';
|
|
3
|
-
import { linkInventory } from './links.js';
|
|
2
|
+
import { frontmatter, inventoryOf } from './document.js';
|
|
4
3
|
import { roomTarget, target } from './paths.js';
|
|
5
4
|
import { refusal } from './refuse.js';
|
|
6
5
|
import { headingSpans } from './sections.js';
|
|
7
6
|
import { bodyStartOf } from './yaml.js';
|
|
8
|
-
function internalEdits(content, bodyStart, file, documentTargets) {
|
|
9
|
-
const inventory = linkInventory(content.slice(bodyStart));
|
|
7
|
+
function internalEdits(content, inventory, bodyStart, file, documentTargets) {
|
|
10
8
|
const internal = new Set();
|
|
11
9
|
const uses = inventory.uses
|
|
12
10
|
.filter((use) => {
|
|
@@ -98,7 +96,7 @@ function freeTextValues(definition, document) {
|
|
|
98
96
|
export function projectionInput(document, file, context) {
|
|
99
97
|
const content = document.content;
|
|
100
98
|
const bodyStart = bodyStartOf(content);
|
|
101
|
-
const edits = internalEdits(content, bodyStart, file, new Set(context.documentTargets));
|
|
99
|
+
const edits = internalEdits(content, inventoryOf(document), bodyStart, file, new Set(context.documentTargets));
|
|
102
100
|
const declared = document.type;
|
|
103
101
|
if (declared === undefined || declared === 'any') {
|
|
104
102
|
return {
|
package/dist/types.d.ts
CHANGED
|
@@ -13,13 +13,14 @@ export type ModelVerification = {
|
|
|
13
13
|
};
|
|
14
14
|
export type ValidationContext = {
|
|
15
15
|
readonly binaryTargets: readonly string[];
|
|
16
|
+
readonly anyRoom?: true;
|
|
16
17
|
};
|
|
17
18
|
export type ProjectionContext = {
|
|
18
19
|
readonly documentTargets: readonly string[];
|
|
19
20
|
readonly definition?: Definition;
|
|
20
21
|
};
|
|
21
22
|
export type DivisionContext = ProjectionContext & {
|
|
22
|
-
readonly
|
|
23
|
+
readonly bound: number;
|
|
23
24
|
};
|
|
24
25
|
export type Extent = {
|
|
25
26
|
readonly start: number;
|
|
@@ -60,6 +61,10 @@ export type Validation = {
|
|
|
60
61
|
} | ({
|
|
61
62
|
readonly verdict: 'refuse';
|
|
62
63
|
} & Refusal);
|
|
64
|
+
export type ValidationStep = {
|
|
65
|
+
readonly path: string;
|
|
66
|
+
readonly resolved: number;
|
|
67
|
+
};
|
|
63
68
|
export type Projection = {
|
|
64
69
|
readonly ok: true;
|
|
65
70
|
readonly text: string;
|
|
@@ -92,9 +97,6 @@ export type Link = {
|
|
|
92
97
|
readonly href: string;
|
|
93
98
|
readonly target: string;
|
|
94
99
|
};
|
|
95
|
-
export type LinkOccurrence = Link & {
|
|
96
|
-
readonly start: number;
|
|
97
|
-
};
|
|
98
100
|
export type Reference = {
|
|
99
101
|
readonly pointer: string;
|
|
100
102
|
readonly value: string;
|
|
@@ -112,11 +114,13 @@ export type RoomReference = {
|
|
|
112
114
|
readonly pointer: string;
|
|
113
115
|
readonly value: string;
|
|
114
116
|
readonly to: readonly string[];
|
|
117
|
+
readonly crossRoom?: true;
|
|
115
118
|
} | {
|
|
116
119
|
readonly kind: 'item';
|
|
117
120
|
readonly section: string;
|
|
118
121
|
readonly href: string;
|
|
119
122
|
readonly to: readonly string[];
|
|
123
|
+
readonly crossRoom?: true;
|
|
120
124
|
});
|
|
121
125
|
export type Change = {
|
|
122
126
|
readonly kind: 'field';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEN,MAAM,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E,GACtD;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, VerifiedModel } from './types.js';
|
|
2
|
+
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
3
|
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
|
-
export declare function verify(schema: string): ModelVerification;
|
|
5
|
-
export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
|
|
4
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
|
|
6
6
|
export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
|
|
7
7
|
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
8
8
|
export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
|
|
9
|
-
|
|
9
|
+
type Placed = {
|
|
10
|
+
readonly reference: Reached;
|
|
11
|
+
readonly location: string;
|
|
12
|
+
};
|
|
13
|
+
export type Assessment = {
|
|
14
|
+
readonly file: string;
|
|
15
|
+
readonly type: string | undefined;
|
|
16
|
+
readonly targets: readonly string[];
|
|
17
|
+
readonly read: Validation | null;
|
|
18
|
+
readonly structured: Validation | null;
|
|
19
|
+
readonly fields: readonly Placed[];
|
|
20
|
+
readonly linked: boolean;
|
|
21
|
+
readonly sections: readonly Placed[];
|
|
22
|
+
};
|
|
23
|
+
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
|
|
24
|
+
export type Verdicts = {
|
|
25
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
26
|
+
verdict(): Validation;
|
|
27
|
+
};
|
|
28
|
+
export declare function verdicts(): Verdicts;
|
|
29
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
10
30
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
31
|
+
export {};
|
|
11
32
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQzF,OAAO,KAAK,EAEV,aAAa,EAEb,OAAO,EACP,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AA8CpB,wBAAgB,QAAQ,CACtB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,OAAO,CAET;AA8BD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQzF,OAAO,KAAK,EAEV,aAAa,EAEb,OAAO,EACP,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AA8CpB,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