@agentshouse/mdmodel 0.1.0-cdbd463e01dc2 → 0.1.0-ce4af152f38d8

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.
Files changed (49) hide show
  1. package/API.md +29 -18
  2. package/README.md +1 -1
  3. package/dist/blocks.d.ts.map +1 -1
  4. package/dist/blocks.js +0 -4
  5. package/dist/definition.js +4 -3
  6. package/dist/document.d.ts +2 -1
  7. package/dist/document.d.ts.map +1 -1
  8. package/dist/document.js +24 -5
  9. package/dist/event.d.ts +2 -2
  10. package/dist/event.d.ts.map +1 -1
  11. package/dist/event.js +15 -44
  12. package/dist/facts.d.ts +2 -2
  13. package/dist/facts.d.ts.map +1 -1
  14. package/dist/facts.js +1 -2
  15. package/dist/index.d.ts +8 -8
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +5 -5
  18. package/dist/kinds.d.ts +1 -2
  19. package/dist/kinds.d.ts.map +1 -1
  20. package/dist/kinds.js +0 -11
  21. package/dist/links.d.ts.map +1 -1
  22. package/dist/links.js +5 -15
  23. package/dist/pattern.d.ts.map +1 -1
  24. package/dist/pattern.js +4 -3
  25. package/dist/project.js +5 -7
  26. package/dist/query/language.d.ts +35 -4
  27. package/dist/query/language.d.ts.map +1 -1
  28. package/dist/query/language.js +80 -25
  29. package/dist/query/match.d.ts.map +1 -1
  30. package/dist/query/match.js +37 -8
  31. package/dist/query/sql.d.ts.map +1 -1
  32. package/dist/query/sql.js +7 -1
  33. package/dist/reserved.d.ts +1 -0
  34. package/dist/reserved.d.ts.map +1 -1
  35. package/dist/reserved.js +2 -1
  36. package/dist/types.d.ts +4 -0
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/validate.d.ts +4 -3
  39. package/dist/validate.d.ts.map +1 -1
  40. package/dist/validate.js +91 -43
  41. package/dist/yaml.d.ts.map +1 -1
  42. package/dist/yaml.js +4 -11
  43. package/fixtures/division.json +1 -2
  44. package/fixtures/projection.json +1 -2
  45. package/fixtures/queries.json +51 -0
  46. package/package.json +1 -1
  47. package/dist/profile.d.ts +0 -6
  48. package/dist/profile.d.ts.map +0 -1
  49. package/dist/profile.js +0 -5
package/API.md CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  apply,
6
6
  divide,
7
7
  links,
8
- MARKDOWN_SYNTAX_PROFILE,
9
8
  parse,
10
9
  project,
11
10
  retarget,
@@ -36,8 +35,7 @@ if (parsed.ok) {
36
35
  }
37
36
  ```
38
37
 
39
- `MARKDOWN_SYNTAX_PROFILE` is the Markdown every reader here applies, GitHub Flavored Markdown
40
- 0.29, and `VERSION` is the MD model version.
38
+ Every reader here applies GitHub Flavored Markdown 0.29, and `VERSION` is the MD model version.
41
39
 
42
40
  `verify(schema)` reads one schema text, the MD Types of one Room or App: one JSON Schema document
43
41
  (draft 2020-12) in the YAML subset. Every top-level key but `$defs` names an MD Type holding the
@@ -94,7 +92,7 @@ a path neither holds is not refused: it dangles. One written `/rooms/<handle>/<p
94
92
  another Room, which the caller checks; any other absolute path, or one that leaves the collection, is
95
93
  `unresolved-link`. A binary target supplies no Document or MD Type. `model` types the Library. A typed
96
94
  Document, `any` included, at an `isDocumentPath` (no `isReservedName` of `RESERVED_NAMES` first) linking
97
- into a reserved name is `unresolved-link`; a typed `ROOM_DESCRIPTION` is `room-md-type`. The context's `typedPaths` bind each `path`, a name's one `*` standing for any nonempty part, to a `type` of `model`: a Document there naming another, or naming any unless `named`, is `unknown-type` at `/type`, one not `named` is checked as it and stays `any`, and one whose body is empty is `required-body` if `body`.
95
+ into a reserved name is `unresolved-link`; a typed `ROOM_DESCRIPTION` is `room-md-type`. `CAPTURE_HOME`, one of `RESERVED_NAMES`, names the Capture home at a Room's root. The context's `typedPaths` bind each `path`, a name's one `*` standing for any nonempty part, to a `type` of `model`: a Document there naming another, or naming any unless `named`, is `unknown-type` at `/type`, one not `named` is checked as it and stays `any`, and one whose body is empty is `required-body` if `body`.
98
96
 
99
97
  A typed Document's frontmatter satisfies its type's schema, every keyword with its JSON Schema
100
98
  meaning, formats asserted and defaults never filled, except that an object schema declaring neither
@@ -109,8 +107,13 @@ Room without `cross_room` or the context's `anyRoom: true`, a Document of a type
109
107
  from an `isDocumentPath`, a reserved name is `unresolved-reference`, and a frontmatter one reaching no member is `referenced-missing-file`
110
108
  naming its `referrers`; `attachment` admits any path, and no body link is a referrer. `validating` is
111
109
  `validate` over a `ReadonlyMap` Library, yielding each path read with the references it `resolved`;
112
- `assess(file, content, binary, model?, context?)` reads one member, naming its `type` and `targets`,
113
- and `verdicts()` `add`s assessments in any order, its `verdict()` the one `validate` gives.
110
+ `assess(file, parsed, binary, model?, context?)` reads one member from its `parse` result, naming its
111
+ `type` and `targets`; `assessReferences(file, parsed, changed, model?, context?)` reads, unchecked
112
+ otherwise, only its references and links to the `changed` Paths, as `validate` reads them; and
113
+ `verdicts()` `add`s assessments in any order, its `verdict()` the one `validate` gives. One `validate`
114
+ bounds the pattern work of all its members together, a value whose match would pass that bound
115
+ refused as `pattern`; `openPatternBudget()` opens one such bound over the assessments made until the
116
+ function it returns is called, and an inner one shares the outer.
114
117
 
115
118
  Validation returns acceptance or one refusal naming the file, the field or section, and the violated
116
119
  rule. `parse`, `apply`, and `serialize` operate on a single text Document; they do not validate
@@ -187,14 +190,14 @@ percent-encodes in `to` what `target` would decode, so it resolves to `to` again
187
190
  `checkDocument(file, content, model, context?)` reads one Document as `validate` does in that
188
191
  context: `ok: false` where it refuses, else its `type`, whether it is `typed`, and each reference's
189
192
  `target` and `to`, which `resolves(reference, typeOf, binary)` says reaches a member `validate`
190
- accepts. It names no other Room's, which `roomReferences(file, content, definition?)` lists by `kind`.
193
+ accepts. It names no other Room's, which `roomReferences(document, definition?)` lists by `kind`.
191
194
  `parseFrontmatter(content, file?)` is `parse` without the body: `content`, `type`, `fields`.
192
195
 
193
196
  `references(document, definition)` lists each frontmatter `reference` string at any depth as
194
197
  `pointer`, `value` and `to`; a `{ kind: 'reference', pointer, value, prior }` change rewrites one in
195
198
  place, keeping its quotes, or is stale. `referenceTarget(file, value)` is the Path a value names
196
199
  read as a link destination, else `null`; `referenceTargets(document, file, model)` lists each
197
- reference's `location`, `to` and `target`. `documentFacts(file, content, model)`, `null` where the
200
+ reference's `location`, `to` and `target`. `documentFacts(file, parsed, model)`, `null` where the
198
201
  text does not parse, is the `type` (`any` if none), `fields` and sorted distinct link and reference
199
202
  `links` a save stores, no links under `settings/`. `relativize(document, file, handle, definition?, kept?)`
200
203
  rewrites, in one `apply`, each link destination and reference written `/rooms/<handle>/<path>` and
@@ -204,6 +207,8 @@ so, refusing a `/rooms/` one naming no Room's file as `unresolved-link`; `bodyLi
204
207
  is its `links` and `bodyRoomLinks(body)` its other Rooms'. `relinkBody(body, file, moves)` writes,
205
208
  in the `link` change's form, each destination whose Path keys `moves` as that value relative to
206
209
  `file`, or as that value when it is a `/rooms/` path, and one whose `roomPath` does as that value.
210
+ `unlinkBody(body, hrefs)` cuts every link and reference definition whose written destination is
211
+ in `hrefs`, and answers the rest as `body` with `links`, each such destination written as one link.
207
212
 
208
213
  ```ts
209
214
  target('items/six.md', ' ../projects/atlas.md#overview '); // 'projects/atlas.md'
@@ -322,13 +327,18 @@ keys and indexes into the query, which `placeText` writes as its message does, a
322
327
  fields the Rooms declare, a field's `kindWords`, or the parts and operators a query knows. A query
323
328
  is data: `types`, `where`
324
329
  field predicates by JSON Pointer (`$eq`, `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`,
325
- `$all`, `$size`, `$exists`, `$prefix`, `$and`, `$or`), `pathPrefix`, `folder`, `paths`,
326
- `fileIds`, `hop`, `backlinks`, `text`, then `select` or `groupBy`, `orderBy`, `limit`, `after`
327
- and `total`. `queryKey` and `identityOf` are a query's and a plan's canonical text, `bodied`
330
+ `$all`, `$size`, `$exists`, `$prefix`, `$and`, `$or`), `pathPrefix`, `outside` (directories
331
+ left out), `folder`, `paths`, `fileIds`, `hop`, `backlinks`, `text`, then `select` or `groupBy`,
332
+ `orderBy`, `limit`, `after` and `total`. A Document query selects and orders by a row's `size`,
333
+ `created` and its change's time `updated` beside `room`, `path`, `type`, `folder` and a field.
334
+ A group query groups by `room`, `type`, `folder`, `subfolder` (the child folder of `pathPrefix`
335
+ holding a row) or a field, selects each group's `size`, its documents and files apart, its
336
+ latest `updated` and the `greatest` value of a field, and orders by `count`, those or its keys.
337
+ `queryKey` and `identityOf` are a query's and a plan's canonical text, `bodied`
328
338
  says a shape reads text, `cursorOf` and `decodedCursor` write and read the `after` a window
329
339
  continues from, and `invalid`, `known` and `plain` are the check's refusal and tests.
330
340
 
331
- `KINDS` is the one table of kinds a value compares as, `kindOf(facts)` a declared value's kind,
341
+ `Kind` is a kind a value compares as, `kindOf(facts)` a declared value's kind,
332
342
  `kindWords(facts)` the values it takes in words, and `fitsKind(kind, facts, value)` whether a value
333
343
  fits it: a `date`, `date-time` or `time` is
334
344
  exactly what document validation admits as that format, a `date` is `dated`, a `date-time`
@@ -340,7 +350,8 @@ then lists item by item.
340
350
  Two evaluators answer a plan's tests on one Document alike, a test on a missing value false and
341
351
  its negation (`$ne`, `$nin`, `$exists: false`) true. `matches(plan, candidate)` answers in
342
352
  memory over one `Candidate`: its `path`, `type`, `fileId`, `fields`, `definition` and the
343
- `text` held. The `sql` namespace compiles them to SQL over a collection: `indexed(path, fields,
353
+ `text` held, and refuses a plan that orders by `size`, `created`, `updated` or `greatest`, or
354
+ selects a group's totals, which one Document cannot answer. The `sql` namespace compiles them to SQL over a collection: `indexed(path, fields,
344
355
  definition)` derives a Document's values and field links, its date-times with their instants,
345
356
  `sql.VALUE_TABLE` holds those values and `sql.insertedValues` writes them, and `sql.tests(alias,
346
357
  plan)` tests a document row of `id`, `path`, `folder`, `type`, `file_id` and `content`, its
@@ -355,12 +366,12 @@ kind. `fixtures/queries.json` holds both evaluators to one table.
355
366
 
356
367
  `facts(document, { id, path }, model, resolve)` reads one Document as the `DocumentFacts` of a
357
368
  change: its `id`, its `path` with a leading `/`, its `type` or `null`, its `sections`, and a `Fact`
358
- for each frontmatter field it writes that its MD Type declares, held as its kind: `reference`,
359
- `enum`, `number`, `boolean`, `date`, `time` (a `date-time`) or `string`. A prose value, or one of
360
- no kind, is `prose`, a list or an object holds the facts of its members, and a value written
369
+ for each frontmatter field it writes that its MD Type declares, held as its kind in the one table
370
+ of kinds: `reference`, `enum`, `number`, `integer`, `boolean`, `date`, `date-time`, `time` or
371
+ `string`. A prose value, or one of no kind, is `prose`, a list or an object holds the facts of its members, and a value written
361
372
  `null` is `null`. A
362
- value that does not fit its kind, such as a string in a number field, a value outside its `enum` or
363
- a reference `resolve` maps to no `{ id, member? }`, is `unreadable`; a readable reference holds that
373
+ value that does not fit its kind, such as a string in a number field, a fraction in an integer
374
+ field, a value outside its `enum` or a reference `resolve` maps to no `{ id, member? }`, is `unreadable`; a readable reference holds that
364
375
  `id` and the `member` it binds, which `members(facts, path)` lists at a `/members/<pointer>`.
365
376
 
366
377
  `candidateOf(facts)` is that Document as the `Candidate` `matches` answers over, so a query tests
package/README.md CHANGED
@@ -47,7 +47,7 @@ if (parsed.ok) {
47
47
  | `project`, `divide` | Embedding projection input and its division into Spans |
48
48
  | `facts`, `candidateOf` | A Document as one change saw it, matched as one query candidate |
49
49
  | `planOf`, `matches`, `sql` | Check a query, answer it over one Document or compile it to SQL |
50
- | `MARKDOWN_SYNTAX_PROFILE`, `VERSION` | The pinned Markdown profile (GFM 0.29) and MD model version |
50
+ | `VERSION` | The MD model version |
51
51
  | `MEMBER_FIELD`, `SITE_FIELD`, `RECEIVED_FIELD` | The field names validation counts as declared beyond a type's own |
52
52
 
53
53
  The full reference is in [`API.md`](API.md). The conformance corpus and its
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAoDF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CA4BrF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAe/E"}
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAmDF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CA2BrF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAe/E"}
package/dist/blocks.js CHANGED
@@ -36,8 +36,6 @@ function scan(content, from, to, visit) {
36
36
  while (i < to) {
37
37
  const { text, next } = lineAt(content, i, to);
38
38
  visit({ text, start: i, next, fenced: fenced(i - from) !== undefined });
39
- if (next === i)
40
- break;
41
39
  i = next;
42
40
  }
43
41
  }
@@ -66,8 +64,6 @@ export function headingLines(content, from, to) {
66
64
  }
67
65
  }
68
66
  }
69
- if (next === i)
70
- break;
71
67
  i = next;
72
68
  }
73
69
  return found;
@@ -38,7 +38,7 @@ const HOUSE_KEYS = {
38
38
  [RECEIVED_FIELD]: { prose: false },
39
39
  };
40
40
  function refuse(rule, location) {
41
- return location === undefined ? { rule } : { rule, location };
41
+ return { rule, location };
42
42
  }
43
43
  export function escapePointer(key) {
44
44
  return key.replaceAll('~', '~0').replaceAll('/', '~1');
@@ -634,8 +634,9 @@ function composites(node, defs, seen) {
634
634
  const target = typeof node.$ref === 'string' ? refTarget(node.$ref, defs)?.node : undefined;
635
635
  const conditioned = () => {
636
636
  const met = composites(node.then ?? true, defs, seen);
637
- return COMPOSITES.filter((kind) => (composites(node.if, defs, seen).includes(kind) && met.includes(kind)) ||
638
- composites(node.else ?? true, defs, seen).includes(kind));
637
+ const condition = composites(node.if, defs, seen);
638
+ const otherwise = composites(node.else ?? true, defs, seen);
639
+ return COMPOSITES.filter((kind) => (condition.includes(kind) && met.includes(kind)) || otherwise.includes(kind));
639
640
  };
640
641
  const bounds = [
641
642
  typed(node.type),
@@ -1,6 +1,6 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult } from './types.js';
3
+ import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult, UnlinkedBody } from './types.js';
4
4
  import { type YamlMap } from './yaml.js';
5
5
  export declare function inventoryOf(document: Document): LinkInventory;
6
6
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
@@ -8,6 +8,7 @@ export declare function parse(content: string, file?: string): ParseResult;
8
8
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
9
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
10
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
11
+ export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
11
12
  export declare function links(document: Document, file: string): readonly Link[];
12
13
  export declare function bodyLinks(body: string, file: string): readonly Link[];
13
14
  export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAcL,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;AAgBnB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAM7D;AAgED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,iBAAiB,CAW9E;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,WAAW,CAgB7D;AAmED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,EACvB,IAAI,GAAE,WAAW,CAAC,MAAM,CAAa,GACpC,WAAW,CAuBb;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUrF;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,UAA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ACpC,WAAW,CAuBb;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUrF;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,UAAU,CAkBZ;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,YAAY,CAqBjF;AAeD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,CAEvE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,CAErE;AA4LD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CA4CjF;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAEpD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAE9D"}
package/dist/document.js CHANGED
@@ -33,8 +33,6 @@ function freezeDocument(content, type, fields, preamble, sections, internal) {
33
33
  }
34
34
  function declaredType(fields) {
35
35
  const value = fields.type;
36
- if (value === undefined || value === null)
37
- return undefined;
38
36
  if (typeof value !== 'string' || value === '')
39
37
  return undefined;
40
38
  return value;
@@ -48,9 +46,6 @@ function opened(content, file) {
48
46
  try {
49
47
  const root = parseYamlMapping(content, fence.yamlStart, fence.yamlEnd);
50
48
  const fields = jsValue(root);
51
- if (fields === null || typeof fields !== 'object' || Array.isArray(fields)) {
52
- return { ok: false, refusal: refuse(file, 'frontmatter-fence') };
53
- }
54
49
  return { ok: true, root, fields: fields, yamlEnd: fence.yamlEnd };
55
50
  }
56
51
  catch (error) {
@@ -203,6 +198,30 @@ export function relinkBody(body, file, moves) {
203
198
  }
204
199
  return { outcome: 'applied', body: rewritten + body.slice(cursor) };
205
200
  }
201
+ export function unlinkBody(body, hrefs) {
202
+ const { uses, blocks } = linkInventory(body);
203
+ const links = new Map();
204
+ for (const use of uses) {
205
+ const { href, bracketed } = use.destination;
206
+ if (!hrefs.has(href) || links.has(href))
207
+ continue;
208
+ const label = body.slice(use.labelStart, use.labelEnd);
209
+ const image = body[use.start] === '!' ? '!' : '';
210
+ links.set(href, `${image}[${label}](${destinationText(href, bracketed) ?? href})`);
211
+ }
212
+ const cut = [...uses, ...blocks]
213
+ .filter((span) => hrefs.has(span.destination.href))
214
+ .sort((left, right) => left.start - right.start);
215
+ let kept = '';
216
+ let cursor = 0;
217
+ for (const span of cut) {
218
+ if (span.start < cursor)
219
+ continue;
220
+ kept += body.slice(cursor, span.start);
221
+ cursor = span.end;
222
+ }
223
+ return { body: kept + body.slice(cursor), links };
224
+ }
206
225
  function linksIn(occurrences, file) {
207
226
  const found = [];
208
227
  const seen = new Set();
package/dist/event.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { type Definition } from './definition.js';
2
+ import { type Kind } from './kinds.js';
2
3
  import type { Candidate } from './query/match.js';
3
4
  import type { Document, VerifiedModel } from './types.js';
4
- export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
5
5
  type Scalar = string | number | boolean;
6
6
  export type Fact = {
7
- readonly kind: FactKind;
7
+ readonly kind: Kind;
8
8
  readonly value: Scalar;
9
9
  readonly member?: string;
10
10
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;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BD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,CAiB9D"}
package/dist/event.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ARRAY_INDEX, escapePointer, fieldFacts, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
2
- import { dated, instant, kindOf } from './kinds.js';
2
+ import { fitsKind, kindOf } from './kinds.js';
3
3
  import { roomPath, target } from './paths.js';
4
4
  import { plain } from './yaml.js';
5
5
  export const TEXT_FIELD = '/text';
@@ -7,37 +7,16 @@ export const WRITE_DOORS = ['browser', 'agent', 'client', 'function'];
7
7
  const PROSE = { kind: 'prose' };
8
8
  const NULL = { kind: 'null' };
9
9
  const UNREADABLE = { kind: 'unreadable' };
10
- function factKind(facts) {
11
- const kind = kindOf(facts);
12
- if (kind === 'integer')
13
- return 'number';
14
- if (kind === 'date-time')
15
- return 'time';
16
- if (kind === 'time')
17
- return 'string';
18
- return kind;
19
- }
20
- function scalar(value) {
21
- return (typeof value === 'string' ||
22
- typeof value === 'boolean' ||
23
- (typeof value === 'number' && Number.isFinite(value)));
24
- }
25
- function fits(kind, facts, value) {
26
- if (!scalar(value))
27
- return false;
28
- if (kind === 'enum')
29
- return (facts.values ?? []).includes(value);
30
- if (kind === 'number')
31
- return typeof value === 'number';
32
- if (kind === 'boolean')
33
- return typeof value === 'boolean';
10
+ function referenceFact(value, place) {
34
11
  if (typeof value !== 'string')
35
- return false;
36
- if (kind === 'date')
37
- return dated(value);
38
- if (kind === 'time')
39
- return instant(value) !== undefined;
40
- return true;
12
+ return UNREADABLE;
13
+ const reached = target(place.path, value) ?? roomPath(value);
14
+ const resolved = reached === null ? undefined : place.resolve(reached);
15
+ if (resolved === undefined)
16
+ return UNREADABLE;
17
+ return resolved.member === undefined
18
+ ? { kind: 'reference', value: resolved.id }
19
+ : { kind: 'reference', value: resolved.id, member: resolved.member };
41
20
  }
42
21
  function factOf(value, declared, place) {
43
22
  if (value === null)
@@ -60,20 +39,12 @@ function factOf(value, declared, place) {
60
39
  }
61
40
  if (declared?.type === 'array' || declared?.type === 'object')
62
41
  return UNREADABLE;
63
- const kind = declared === undefined || declared.prose ? null : factKind(declared);
42
+ const kind = declared === undefined || declared.prose ? null : kindOf(declared);
64
43
  if (kind === null)
65
44
  return PROSE;
66
- if (!fits(kind, declared, value))
67
- return UNREADABLE;
68
- if (kind !== 'reference')
69
- return { kind, value };
70
- const reached = target(place.path, value) ?? roomPath(value);
71
- const resolved = reached === null ? undefined : place.resolve(reached);
72
- if (resolved === undefined)
73
- return UNREADABLE;
74
- return resolved.member === undefined
75
- ? { kind, value: resolved.id }
76
- : { kind, value: resolved.id, member: resolved.member };
45
+ if (kind === 'reference')
46
+ return referenceFact(value, place);
47
+ return fitsKind(kind, declared, value) ? { kind, value: value } : UNREADABLE;
77
48
  }
78
49
  export function facts(document, at, model, resolve) {
79
50
  const type = document.type ?? null;
@@ -205,7 +176,7 @@ function shapeOf(fact) {
205
176
  prose: false,
206
177
  properties: Object.fromEntries(Object.entries(fact.fields).map(([key, held]) => [key, shapeOf(held)])),
207
178
  };
208
- if (fact.kind === 'time')
179
+ if (fact.kind === 'date-time')
209
180
  return { type: 'string', format: 'date-time', prose: false };
210
181
  return { prose: false };
211
182
  }
package/dist/facts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Document, VerifiedModel } from './types.js';
1
+ import type { Document, ParseResult, VerifiedModel } from './types.js';
2
2
  export type SavedFacts = {
3
3
  readonly type: string;
4
4
  readonly fields: Readonly<Record<string, unknown>>;
@@ -11,5 +11,5 @@ export type ReferenceTarget = {
11
11
  };
12
12
  export declare function referenceTarget(file: string, value: string): string | null;
13
13
  export declare function referenceTargets(document: Document, file: string, model: VerifiedModel): readonly ReferenceTarget[];
14
- export declare function documentFacts(file: string, content: string, model: VerifiedModel): SavedFacts | null;
14
+ export declare function documentFacts(file: string, parsed: ParseResult, model: VerifiedModel): SavedFacts | null;
15
15
  //# sourceMappingURL=facts.d.ts.map
@@ -1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C;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAIF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,GACnB,SAAS,eAAe,EAAE,CAO5B;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,aAAa,GACnB,UAAU,GAAG,IAAI,CAenB"}
package/dist/facts.js CHANGED
@@ -19,8 +19,7 @@ export function referenceTargets(document, file, model) {
19
19
  return target === null ? [] : [{ location: pointer, to, target }];
20
20
  });
21
21
  }
22
- export function documentFacts(file, content, model) {
23
- const parsed = parse(content, file);
22
+ export function documentFacts(file, parsed, model) {
24
23
  if (!parsed.ok)
25
24
  return null;
26
25
  const { document } = parsed;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
- export type { Actor, DocumentEvent, DocumentFacts, Fact, FactKind, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
- export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
2
+ export type { Actor, DocumentEvent, DocumentFacts, Fact, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
+ export { byCodePoint, compared, dated, fitsKind, instant, instantKey, kindOf, kindWords, } from './kinds.js';
4
4
  export type { Kind, Ordering } from './kinds.js';
5
5
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
6
- export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
6
+ export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
7
7
  export { heldAt, matches } from './query/match.js';
8
8
  export type { Candidate } from './query/match.js';
9
9
  export { heldKind, indexed } from './query/rows.js';
@@ -12,20 +12,20 @@ export * as sql from './query/sql.js';
12
12
  export { headingLines } from './blocks.js';
13
13
  export type { HeadingLine } from './blocks.js';
14
14
  export { divide } from './divide.js';
15
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
15
+ export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
16
16
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
17
17
  export type { ReferenceTarget, SavedFacts } from './facts.js';
18
18
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
19
19
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
20
+ export { openPatternBudget } from './pattern.js';
20
21
  export type { RoomTarget } from './paths.js';
21
- export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
22
22
  export { project } from './project.js';
23
23
  export { references } from './references.js';
24
- export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
24
+ export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
25
25
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
26
26
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
27
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
- export { assess, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
27
+ export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
+ export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
29
29
  export type { Assessment, Verdicts } from './validate.js';
30
30
  export { VERSION } from './version.js';
31
31
  export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,IAAI,EACJ,QAAQ,E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b,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,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,KAAK,EAAE,MAAM,WAAW,CAAC;AACtF,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,UAAU,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,MAAM,EACN,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb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,KAAK,EAAE,MAAM,WAAW,CAAC;AACtF,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
- export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
2
+ export { byCodePoint, compared, dated, fitsKind, instant, instantKey, kindOf, kindWords, } from './kinds.js';
3
3
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
4
4
  export { heldAt, matches } from './query/match.js';
5
5
  export { heldKind, indexed } from './query/rows.js';
6
6
  export * as sql from './query/sql.js';
7
7
  export { headingLines } from './blocks.js';
8
8
  export { divide } from './divide.js';
9
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
9
+ export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
10
10
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
11
11
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
12
12
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
13
- export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
13
+ export { openPatternBudget } from './pattern.js';
14
14
  export { project } from './project.js';
15
15
  export { references } from './references.js';
16
- export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
16
+ export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
17
17
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
18
- export { assess, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
18
+ export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
19
19
  export { VERSION } from './version.js';
20
20
  export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
package/dist/kinds.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { ValueFacts } from './definition.js';
2
- export declare const KINDS: readonly ['string', 'number', 'integer', 'boolean', 'date', 'date-time', 'time', 'enum', 'reference'];
3
- export type Kind = (typeof KINDS)[number];
2
+ export type Kind = 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'date-time' | 'time' | 'enum' | 'reference';
4
3
  export type Ordering = {
5
4
  readonly direction: 'asc' | 'desc';
6
5
  readonly nulls: 'first' | 'last';
@@ -1 +1 @@
1
- {"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../src/kinds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,eAAO,MAAM,KAAK,YAChB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,MAAM,EACN,WAAW,EACX,MAAM,EACN,MAAM,EACN,WAAW,CACH,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;CAC1D,CAAC;AASF,wBAA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,EAAE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;CAC1D,CAAC;AASF,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAWrD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAW/E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAe1E;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAqB1D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAGxD;AAaD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/D;AA4BD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAMlF"}
package/dist/kinds.js CHANGED
@@ -1,16 +1,5 @@
1
1
  import { format } from '@cfworker/json-schema';
2
2
  import { normalize } from './paths.js';
3
- export const KINDS = [
4
- 'string',
5
- 'number',
6
- 'integer',
7
- 'boolean',
8
- 'date',
9
- 'date-time',
10
- 'time',
11
- 'enum',
12
- 'reference',
13
- ];
14
3
  const DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt\s](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:[Zz]|([+-])(\d{2})(?::?(\d{2}))?)$/u;
15
4
  const BEFORE_YEAR_ZERO = 62200000000000000000n;
16
5
  const INSTANT_DIGITS = 21;
@@ -1 +1 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names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AClC,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAe/E;AA+CD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAmEzD;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,cAAc,EAAE,CAIhF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAEvE"}
package/dist/links.js CHANGED
@@ -74,19 +74,19 @@ function readLine(text, start, end) {
74
74
  let inner = start;
75
75
  for (;;) {
76
76
  let spaces = 0;
77
- while (spaces < 3 && i < end && text[i] === ' ') {
77
+ while (spaces < 3 && text[i] === ' ') {
78
78
  i += 1;
79
79
  spaces += 1;
80
80
  }
81
- if (i < end && text[i] === '>') {
81
+ if (text[i] === '>') {
82
82
  depth += 1;
83
83
  i += 1;
84
- if (i < end && text[i] === ' ')
84
+ if (text[i] === ' ')
85
85
  i += 1;
86
86
  inner = i;
87
87
  continue;
88
88
  }
89
- const after = i < end ? itemMarker(text, i, end) : null;
89
+ const after = itemMarker(text, i, end);
90
90
  if (after === null)
91
91
  break;
92
92
  item = true;
@@ -319,7 +319,7 @@ function markerEnd(text, at, end) {
319
319
  const after = itemMarker(text, at, end);
320
320
  if (after === null)
321
321
  return null;
322
- return after > at && (text[after - 1] === ' ' || text[after - 1] === '\t') ? after - 1 : after;
322
+ return text[after - 1] === ' ' || text[after - 1] === '\t' ? after - 1 : after;
323
323
  }
324
324
  function itemContent(text, line) {
325
325
  let marker = markerEnd(text, afterIndent(text, line), line.end);
@@ -414,8 +414,6 @@ function htmlEnd(text, line, item) {
414
414
  if (closed !== undefined && closed[1].test(body))
415
415
  return afterLine(text, end);
416
416
  cursor = afterLine(text, end);
417
- if (cursor === end)
418
- break;
419
417
  }
420
418
  return text.length;
421
419
  }
@@ -433,8 +431,6 @@ function codeEnd(text, line, base) {
433
431
  cursor = afterLine(text, end);
434
432
  if (!blank)
435
433
  stop = cursor;
436
- if (cursor === end)
437
- break;
438
434
  }
439
435
  return stop;
440
436
  }
@@ -455,8 +451,6 @@ function structure(text) {
455
451
  table = null;
456
452
  if (table !== null) {
457
453
  cursor = afterLine(text, end);
458
- if (cursor === end)
459
- break;
460
454
  continue;
461
455
  }
462
456
  if (paragraph !== null && joinsParagraph(text, line, paragraph, items.at(-1))) {
@@ -467,8 +461,6 @@ function structure(text) {
467
461
  else
468
462
  joins.add(cursor - 1);
469
463
  cursor = afterLine(text, end);
470
- if (cursor === end)
471
- break;
472
464
  continue;
473
465
  }
474
466
  paragraph = null;
@@ -516,8 +508,6 @@ function structure(text) {
516
508
  paragraph = line.depth;
517
509
  }
518
510
  cursor = afterLine(text, end);
519
- if (cursor === end)
520
- break;
521
511
  }
522
512
  return { joins, raw };
523
513
  }