@agentshouse/mdmodel 0.1.0-alpha.9 → 0.1.0-c04c0d681d2d4
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 +368 -0
- package/README.md +36 -194
- package/dist/blocks.d.ts +11 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +69 -0
- package/dist/condition.d.ts +162 -0
- package/dist/condition.d.ts.map +1 -0
- package/dist/condition.js +616 -0
- package/dist/definition.d.ts +70 -27
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +728 -146
- package/dist/divide.d.ts +3 -0
- package/dist/divide.d.ts.map +1 -0
- package/dist/divide.js +320 -0
- package/dist/document.d.ts +12 -2
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +400 -177
- package/dist/fields.d.ts +6 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +10 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/links.d.ts +4 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +633 -225
- package/dist/paths.d.ts +15 -4
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +149 -36
- package/dist/profile.js +1 -3
- package/dist/project.d.ts +20 -1
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +101 -95
- package/dist/references.d.ts +4 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +30 -0
- package/dist/refuse.d.ts.map +1 -1
- package/dist/refuse.js +2 -10
- package/dist/schema.d.ts +7 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +156 -41
- package/dist/sections.d.ts +2 -1
- package/dist/sections.d.ts.map +1 -1
- package/dist/sections.js +44 -66
- package/dist/types.d.ts +95 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -3
- package/dist/validate.d.ts +10 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +283 -159
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -3
- package/dist/yaml.d.ts +9 -3
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +300 -201
- package/fixtures/README.md +91 -56
- package/fixtures/cases/absent-link-dangles/library/item.md +8 -0
- package/fixtures/cases/absent-link-dangles/schema.yaml +6 -0
- package/fixtures/cases/absent-optional-field/context.json +1 -0
- package/fixtures/cases/absent-optional-field/expected.json +1 -0
- package/fixtures/cases/absent-optional-field/library/companies/acme.md +4 -0
- package/fixtures/cases/absent-optional-field/library/deals/lead.md +6 -0
- package/fixtures/cases/absent-optional-field/schema.yaml +56 -0
- package/fixtures/cases/absolute-link/context.json +1 -0
- package/fixtures/cases/absolute-link/expected.json +5 -0
- package/fixtures/cases/absolute-link/library/item.md +8 -0
- package/fixtures/cases/absolute-link/schema.yaml +6 -0
- package/fixtures/cases/attachment-reference-any-file/context.json +1 -0
- package/fixtures/cases/attachment-reference-any-file/expected.json +1 -0
- package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/schema.yaml +32 -0
- package/fixtures/cases/attachment-reference-dangles/context.json +1 -0
- package/fixtures/cases/attachment-reference-dangles/expected.json +1 -0
- package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/schema.yaml +32 -0
- package/fixtures/cases/attachment-reference-outside/context.json +1 -0
- package/fixtures/cases/attachment-reference-outside/expected.json +6 -0
- package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-outside/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-outside/schema.yaml +32 -0
- package/fixtures/cases/binary-any-reference/expected.json +1 -2
- package/fixtures/cases/binary-any-reference/schema.yaml +4 -0
- package/fixtures/cases/binary-document-collision/expected.json +1 -2
- package/fixtures/cases/binary-document-collision/schema.yaml +1 -0
- package/fixtures/cases/binary-image-dangles/expected.json +1 -0
- package/fixtures/cases/binary-image-dangles/schema.yaml +1 -0
- package/fixtures/cases/binary-link-dangles/expected.json +1 -0
- package/fixtures/cases/binary-link-dangles/schema.yaml +1 -0
- package/fixtures/cases/binary-link-outside-collection/expected.json +1 -2
- package/fixtures/cases/binary-link-outside-collection/schema.yaml +1 -0
- package/fixtures/cases/binary-prototype-reference/expected.json +1 -2
- package/fixtures/cases/binary-prototype-reference/schema.yaml +4 -0
- package/fixtures/cases/binary-typed-reference/expected.json +1 -2
- package/fixtures/cases/binary-typed-reference/schema.yaml +5 -0
- package/fixtures/cases/boolean-field/context.json +1 -0
- package/fixtures/cases/boolean-field/expected.json +6 -0
- package/fixtures/cases/boolean-field/library/companies/acme.md +4 -0
- package/fixtures/cases/boolean-field/library/deals/renewal.md +31 -0
- package/fixtures/cases/boolean-field/schema.yaml +56 -0
- package/fixtures/cases/bracketed-link-definition/schema.yaml +6 -0
- package/fixtures/cases/closed-nested-object/context.json +1 -0
- package/fixtures/cases/closed-nested-object/expected.json +6 -0
- package/fixtures/cases/closed-nested-object/library/companies/acme.md +4 -0
- package/fixtures/cases/closed-nested-object/library/deals/renewal.md +32 -0
- package/fixtures/cases/closed-nested-object/schema.yaml +56 -0
- package/fixtures/cases/composed-root-reference/context.json +1 -0
- package/fixtures/cases/composed-root-reference/expected.json +6 -0
- package/fixtures/cases/composed-root-reference/library/a.md +5 -0
- package/fixtures/cases/composed-root-reference/schema.yaml +13 -0
- package/fixtures/cases/cross-room-link/context.json +1 -0
- package/fixtures/cases/cross-room-link/expected.json +1 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
- package/fixtures/cases/cross-room-link/schema.yaml +3 -0
- package/fixtures/cases/cross-room-reference/context.json +1 -0
- package/fixtures/cases/cross-room-reference/expected.json +1 -0
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
- package/fixtures/cases/cross-room-reference/schema.yaml +9 -0
- package/fixtures/cases/date-time-format/context.json +1 -0
- package/fixtures/cases/date-time-format/expected.json +6 -0
- package/fixtures/cases/date-time-format/library/companies/acme.md +4 -0
- package/fixtures/cases/date-time-format/library/deals/renewal.md +31 -0
- package/fixtures/cases/date-time-format/schema.yaml +56 -0
- package/fixtures/cases/declared-binary-links/schema.yaml +1 -0
- package/fixtures/cases/default-unfilled/context.json +1 -0
- package/fixtures/cases/default-unfilled/expected.json +6 -0
- package/fixtures/cases/default-unfilled/library/companies/acme.md +4 -0
- package/fixtures/cases/default-unfilled/library/deals/renewal.md +29 -0
- package/fixtures/cases/default-unfilled/schema.yaml +56 -0
- package/fixtures/cases/defs-pattern/context.json +1 -0
- package/fixtures/cases/defs-pattern/expected.json +6 -0
- package/fixtures/cases/defs-pattern/library/companies/acme.md +4 -0
- package/fixtures/cases/defs-pattern/library/deals/renewal.md +31 -0
- package/fixtures/cases/defs-pattern/schema.yaml +56 -0
- package/fixtures/cases/dependent-rule/context.json +1 -0
- package/fixtures/cases/dependent-rule/expected.json +6 -0
- package/fixtures/cases/dependent-rule/library/companies/acme.md +4 -0
- package/fixtures/cases/dependent-rule/library/deals/renewal.md +30 -0
- package/fixtures/cases/dependent-rule/schema.yaml +56 -0
- package/fixtures/cases/duplicate-link-definition/schema.yaml +6 -0
- package/fixtures/cases/email-format/context.json +1 -0
- package/fixtures/cases/email-format/expected.json +6 -0
- package/fixtures/cases/email-format/library/companies/acme.md +4 -0
- package/fixtures/cases/email-format/library/deals/renewal.md +31 -0
- package/fixtures/cases/email-format/schema.yaml +56 -0
- package/fixtures/cases/fenced-link-definition/schema.yaml +6 -0
- package/fixtures/cases/field-enum/expected.json +2 -3
- package/fixtures/cases/field-enum/schema.yaml +7 -0
- package/fixtures/cases/frontmatter-schema/context.json +1 -0
- package/fixtures/cases/frontmatter-schema/expected.json +5 -0
- package/fixtures/cases/frontmatter-schema/schema.yaml +5 -0
- package/fixtures/cases/integer-field/context.json +1 -0
- package/fixtures/cases/integer-field/expected.json +6 -0
- package/fixtures/cases/integer-field/library/companies/acme.md +4 -0
- package/fixtures/cases/integer-field/library/deals/renewal.md +31 -0
- package/fixtures/cases/integer-field/schema.yaml +56 -0
- package/fixtures/cases/interrupted-link-definition/schema.yaml +1 -0
- package/fixtures/cases/json-schema-constructs/context.json +1 -0
- package/fixtures/cases/json-schema-constructs/expected.json +1 -0
- package/fixtures/cases/json-schema-constructs/library/companies/acme.md +4 -0
- package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +31 -0
- package/fixtures/cases/json-schema-constructs/schema.yaml +56 -0
- package/fixtures/cases/list-of-objects-closed/context.json +1 -0
- package/fixtures/cases/list-of-objects-closed/expected.json +6 -0
- package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +32 -0
- package/fixtures/cases/list-of-objects-closed/schema.yaml +56 -0
- package/fixtures/cases/list-of-objects-item/context.json +1 -0
- package/fixtures/cases/list-of-objects-item/expected.json +6 -0
- package/fixtures/cases/list-of-objects-item/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +31 -0
- package/fixtures/cases/list-of-objects-item/schema.yaml +56 -0
- package/fixtures/cases/list-of-objects-reference/context.json +1 -0
- package/fixtures/cases/list-of-objects-reference/expected.json +6 -0
- package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/list-of-objects-reference/library/places/depot.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/products/seats.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/products/support.md +4 -0
- package/fixtures/cases/list-of-objects-reference/schema.yaml +32 -0
- package/fixtures/cases/list-size/context.json +1 -0
- package/fixtures/cases/list-size/expected.json +6 -0
- package/fixtures/cases/list-size/library/companies/acme.md +4 -0
- package/fixtures/cases/list-size/library/deals/renewal.md +31 -0
- package/fixtures/cases/list-size/schema.yaml +56 -0
- package/fixtures/cases/long-fence-link-definition/schema.yaml +1 -0
- package/fixtures/cases/malformed-definition/expected.json +2 -4
- package/fixtures/cases/malformed-definition/schema.yaml +3 -0
- package/fixtures/cases/member-document/context.json +1 -0
- package/fixtures/cases/member-document/expected.json +1 -0
- package/fixtures/cases/member-document/library/people/ana.md +5 -0
- package/fixtures/cases/member-document/schema.yaml +5 -0
- package/fixtures/cases/missing-required-field/expected.json +2 -3
- package/fixtures/cases/missing-required-field/schema.yaml +7 -0
- package/fixtures/cases/missing-section-item-kind/expected.json +2 -4
- package/fixtures/cases/missing-section-item-kind/schema.yaml +6 -0
- package/fixtures/cases/misspelled-key/context.json +1 -0
- package/fixtures/cases/misspelled-key/expected.json +6 -0
- package/fixtures/cases/misspelled-key/library/companies/acme.md +4 -0
- package/fixtures/cases/misspelled-key/library/deals/renewal.md +32 -0
- package/fixtures/cases/misspelled-key/schema.yaml +56 -0
- package/fixtures/cases/nested-defs/context.json +1 -0
- package/fixtures/cases/nested-defs/expected.json +6 -0
- package/fixtures/cases/nested-defs/library/deal.md +6 -0
- package/fixtures/cases/nested-defs/schema.yaml +11 -0
- package/fixtures/cases/nested-object-reference/context.json +1 -0
- package/fixtures/cases/nested-object-reference/expected.json +6 -0
- package/fixtures/cases/nested-object-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-object-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/nested-object-reference/library/places/depot.md +4 -0
- package/fixtures/cases/nested-object-reference/library/products/seats.md +4 -0
- package/fixtures/cases/nested-object-reference/library/products/support.md +4 -0
- package/fixtures/cases/nested-object-reference/schema.yaml +32 -0
- package/fixtures/cases/nested-reference/context.json +1 -0
- package/fixtures/cases/nested-reference/expected.json +1 -0
- package/fixtures/cases/nested-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-reference/library/deals/renewal.md +15 -0
- package/fixtures/cases/nested-reference/library/places/depot.md +4 -0
- package/fixtures/cases/nested-reference/library/products/seats.md +4 -0
- package/fixtures/cases/nested-reference/library/products/support.md +4 -0
- package/fixtures/cases/nested-reference/schema.yaml +32 -0
- package/fixtures/cases/nested-required-field/context.json +1 -0
- package/fixtures/cases/nested-required-field/expected.json +6 -0
- package/fixtures/cases/nested-required-field/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-required-field/library/deals/renewal.md +30 -0
- package/fixtures/cases/nested-required-field/schema.yaml +56 -0
- package/fixtures/cases/null-refused/context.json +1 -0
- package/fixtures/cases/null-refused/expected.json +6 -0
- package/fixtures/cases/null-refused/library/companies/acme.md +4 -0
- package/fixtures/cases/null-refused/library/deals/renewal.md +31 -0
- package/fixtures/cases/null-refused/schema.yaml +56 -0
- package/fixtures/cases/numeric-range/context.json +1 -0
- package/fixtures/cases/numeric-range/expected.json +6 -0
- package/fixtures/cases/numeric-range/library/companies/acme.md +4 -0
- package/fixtures/cases/numeric-range/library/deals/renewal.md +31 -0
- package/fixtures/cases/numeric-range/schema.yaml +56 -0
- package/fixtures/cases/one-of-variant/context.json +1 -0
- package/fixtures/cases/one-of-variant/expected.json +6 -0
- package/fixtures/cases/one-of-variant/library/companies/acme.md +4 -0
- package/fixtures/cases/one-of-variant/library/deals/renewal.md +31 -0
- package/fixtures/cases/one-of-variant/schema.yaml +56 -0
- package/fixtures/cases/open-map-value/context.json +1 -0
- package/fixtures/cases/open-map-value/expected.json +6 -0
- package/fixtures/cases/open-map-value/library/companies/acme.md +4 -0
- package/fixtures/cases/open-map-value/library/deals/renewal.md +31 -0
- package/fixtures/cases/open-map-value/schema.yaml +56 -0
- package/fixtures/cases/other-room-reference/context.json +1 -0
- package/fixtures/cases/other-room-reference/expected.json +6 -0
- package/fixtures/cases/other-room-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/other-room-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/other-room-reference/library/places/depot.md +4 -0
- package/fixtures/cases/other-room-reference/library/products/seats.md +4 -0
- package/fixtures/cases/other-room-reference/library/products/support.md +4 -0
- package/fixtures/cases/other-room-reference/schema.yaml +32 -0
- package/fixtures/cases/paragraph-link-definition/schema.yaml +1 -0
- package/fixtures/cases/prototype-field/expected.json +2 -3
- package/fixtures/cases/prototype-field/schema.yaml +6 -0
- package/fixtures/cases/quoted-link-definition/expected.json +1 -2
- package/fixtures/cases/quoted-link-definition/library/notes/draft.md +1 -1
- package/fixtures/cases/quoted-link-definition/schema.yaml +1 -0
- package/fixtures/cases/referenced-missing-file/expected.json +0 -1
- package/fixtures/cases/referenced-missing-file/schema.yaml +11 -0
- package/fixtures/cases/remote-ref/context.json +1 -0
- package/fixtures/cases/remote-ref/expected.json +5 -0
- package/fixtures/cases/remote-ref/schema.yaml +3 -0
- package/fixtures/cases/second-member-document/context.json +1 -0
- package/fixtures/cases/second-member-document/expected.json +5 -0
- package/fixtures/cases/second-member-document/schema.yaml +4 -0
- package/fixtures/cases/section-item-enum/context.json +1 -0
- package/fixtures/cases/section-item-enum/expected.json +6 -0
- package/fixtures/cases/section-item-enum/library/task.md +8 -0
- package/fixtures/cases/section-item-enum/schema.yaml +3 -0
- package/fixtures/cases/section-item-kind/context.json +1 -0
- package/fixtures/cases/section-item-kind/expected.json +6 -0
- package/fixtures/cases/section-item-kind/library/task.md +8 -0
- package/fixtures/cases/section-item-kind/schema.yaml +3 -0
- package/fixtures/cases/section-items/context.json +1 -0
- package/fixtures/cases/section-items/expected.json +1 -0
- package/fixtures/cases/section-items/library/other.md +3 -0
- package/fixtures/cases/section-items/library/page.md +42 -0
- package/fixtures/cases/section-items/schema.yaml +10 -0
- package/fixtures/cases/section-reference-path/context.json +1 -0
- package/fixtures/cases/section-reference-path/expected.json +6 -0
- package/fixtures/cases/section-reference-path/library/other.md +3 -0
- package/fixtures/cases/section-reference-path/library/page.md +7 -0
- package/fixtures/cases/section-reference-path/schema.yaml +3 -0
- package/fixtures/cases/section-reference-type/context.json +1 -0
- package/fixtures/cases/section-reference-type/expected.json +6 -0
- package/fixtures/cases/section-reference-type/library/note.md +1 -0
- package/fixtures/cases/section-reference-type/library/page.md +7 -0
- package/fixtures/cases/section-reference-type/schema.yaml +3 -0
- package/fixtures/cases/shortcut-reference-link/context.json +1 -0
- package/fixtures/cases/shortcut-reference-link/expected.json +5 -0
- package/fixtures/cases/shortcut-reference-link/library/item.md +10 -0
- package/fixtures/cases/shortcut-reference-link/schema.yaml +6 -0
- package/fixtures/cases/string-length/context.json +1 -0
- package/fixtures/cases/string-length/expected.json +6 -0
- package/fixtures/cases/string-length/library/companies/acme.md +4 -0
- package/fixtures/cases/string-length/library/deals/renewal.md +31 -0
- package/fixtures/cases/string-length/schema.yaml +56 -0
- package/fixtures/cases/structured-section/expected.json +1 -2
- package/fixtures/cases/structured-section/schema.yaml +7 -0
- package/fixtures/cases/submission-keys/context.json +1 -0
- package/fixtures/cases/submission-keys/expected.json +1 -0
- package/fixtures/cases/submission-keys/library/notes/visitor.md +8 -0
- package/fixtures/cases/submission-keys/schema.yaml +4 -0
- package/fixtures/cases/text-field-kind/context.json +1 -0
- package/fixtures/cases/text-field-kind/expected.json +6 -0
- package/fixtures/cases/text-field-kind/library/page.md +4 -0
- package/fixtures/cases/text-field-kind/schema.yaml +4 -0
- package/fixtures/cases/truncated-link-definition/expected.json +1 -2
- package/fixtures/cases/truncated-link-definition/library/notes/draft.md +1 -1
- package/fixtures/cases/truncated-link-definition/schema.yaml +1 -0
- package/fixtures/cases/types-folder-content/context.json +1 -0
- package/fixtures/cases/types-folder-content/expected.json +1 -0
- package/fixtures/cases/types-folder-content/library/types/task.md +4 -0
- package/fixtures/cases/types-folder-content/schema.yaml +4 -0
- package/fixtures/cases/unclosed-frontmatter/expected.json +1 -2
- package/fixtures/cases/undeclared-field/expected.json +2 -3
- package/fixtures/cases/undeclared-field/schema.yaml +6 -0
- package/fixtures/cases/unevaluated-items-closed/context.json +1 -0
- package/fixtures/cases/unevaluated-items-closed/expected.json +6 -0
- package/fixtures/cases/unevaluated-items-closed/library/trip.md +6 -0
- package/fixtures/cases/unevaluated-items-closed/schema.yaml +10 -0
- package/fixtures/cases/unknown-type/context.json +1 -0
- package/fixtures/cases/unknown-type/expected.json +6 -0
- package/fixtures/cases/unknown-type/library/item.md +3 -0
- package/fixtures/cases/unknown-type/schema.yaml +3 -0
- package/fixtures/cases/unlisted-reference-type/context.json +1 -0
- package/fixtures/cases/unlisted-reference-type/expected.json +5 -0
- package/fixtures/cases/unlisted-reference-type/schema.yaml +3 -0
- package/fixtures/cases/unresolved-link/expected.json +1 -2
- package/fixtures/cases/unresolved-link/library/item.md +1 -1
- package/fixtures/cases/unresolved-link/schema.yaml +6 -0
- package/fixtures/cases/valid-typed-document/schema.yaml +16 -0
- package/fixtures/cases/wide-item-fence-link/schema.yaml +1 -0
- package/fixtures/division.json +409 -0
- package/fixtures/projection.json +90 -21
- package/package.json +6 -13
- package/dist/definition.js.map +0 -1
- package/dist/document.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/links.js.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/profile.js.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/refuse.js.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/sections.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validate.js.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/yaml.js.map +0 -1
- package/fixtures/cases/binary-any-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-document-collision/library/types/note.md +0 -3
- package/fixtures/cases/binary-link-outside-collection/library/types/note.md +0 -3
- package/fixtures/cases/binary-prototype-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-typed-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-typed-reference/library/types/person.md +0 -3
- package/fixtures/cases/bracketed-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/declared-binary-links/library/types/note.md +0 -3
- package/fixtures/cases/duplicate-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/fenced-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/field-enum/library/types/task.md +0 -8
- package/fixtures/cases/interrupted-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/long-fence-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/malformed-definition/library/types/task.md +0 -5
- package/fixtures/cases/missing-binary-image/expected.json +0 -6
- package/fixtures/cases/missing-binary-image/library/types/note.md +0 -3
- package/fixtures/cases/missing-binary-link/expected.json +0 -6
- package/fixtures/cases/missing-binary-link/library/types/note.md +0 -3
- package/fixtures/cases/missing-required-field/library/types/task.md +0 -8
- package/fixtures/cases/missing-section-item-kind/library/types/task.md +0 -7
- package/fixtures/cases/paragraph-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/prd-definition/library/types/task.md +0 -16
- package/fixtures/cases/prototype-field/library/types/task.md +0 -7
- package/fixtures/cases/quoted-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/referenced-missing-file/library/types/person.md +0 -5
- package/fixtures/cases/referenced-missing-file/library/types/task.md +0 -8
- package/fixtures/cases/structured-section/library/types/task.md +0 -8
- package/fixtures/cases/truncated-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/undeclared-field/library/types/task.md +0 -7
- package/fixtures/cases/unresolved-link/library/types/task.md +0 -7
- package/fixtures/cases/valid-typed-document/library/types/person.md +0 -5
- package/fixtures/cases/valid-typed-document/library/types/task.md +0 -13
- package/fixtures/cases/wide-item-fence-link/library/types/note.md +0 -3
- package/markdown-syntax-profile.md +0 -9
- /package/fixtures/cases/{prd-definition → absent-link-dangles}/context.json +0 -0
- /package/fixtures/cases/{prd-definition → absent-link-dangles}/expected.json +0 -0
- /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/context.json +0 -0
- /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/library/notes/draft.md +0 -0
- /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/context.json +0 -0
- /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/library/notes/draft.md +0 -0
package/dist/paths.d.ts
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
export declare function dirname(path: string): string;
|
|
2
2
|
export declare function join(base: string, relative: string): string;
|
|
3
3
|
export declare function normalize(path: string): string | null;
|
|
4
|
-
export declare function
|
|
5
|
-
export
|
|
6
|
-
|
|
4
|
+
export declare function destinationPath(href: string): string | null;
|
|
5
|
+
export type RoomTarget = {
|
|
6
|
+
readonly handle: string;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
};
|
|
7
9
|
export declare function classifyHref(from: string, href: string): {
|
|
8
10
|
kind: 'skip';
|
|
9
11
|
} | {
|
|
10
12
|
kind: 'path';
|
|
11
13
|
path: string;
|
|
12
|
-
} | {
|
|
14
|
+
} | ({
|
|
15
|
+
kind: 'room';
|
|
16
|
+
} & RoomTarget) | {
|
|
13
17
|
kind: 'invalid';
|
|
14
18
|
};
|
|
19
|
+
export declare function roomTarget(href: string): RoomTarget | null;
|
|
20
|
+
export declare function roomPath(href: string): string | null;
|
|
21
|
+
export declare function target(from: string, href: string): string | null;
|
|
22
|
+
export declare function retarget(href: string, to: string): string;
|
|
23
|
+
export declare function relative(from: string, target: string): string;
|
|
24
|
+
export declare const SHELL_ROOMS = "/rooms/";
|
|
25
|
+
export declare function shellTarget(href: string, handle: string): string | null;
|
|
15
26
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAoDD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW3D;AAgBD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAY5E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAEV;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAC/B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAatB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAG1D;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGpD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvE"}
|
package/dist/paths.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { decodeNamedCharacterReference } from 'decode-named-character-reference';
|
|
2
|
+
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
|
|
3
|
+
import { escapes } from './links.js';
|
|
1
4
|
export function dirname(path) {
|
|
2
5
|
const index = path.lastIndexOf('/');
|
|
3
6
|
return index === -1 ? '' : path.slice(0, index);
|
|
4
7
|
}
|
|
5
8
|
export function join(base, relative) {
|
|
6
|
-
if (base === '')
|
|
9
|
+
if (base === '')
|
|
10
|
+
return relative;
|
|
7
11
|
return `${base}/${relative}`;
|
|
8
12
|
}
|
|
9
13
|
export function normalize(path) {
|
|
10
14
|
const parts = [];
|
|
11
|
-
for (const part of path.split('/')){
|
|
12
|
-
if (part === '' || part === '.')
|
|
15
|
+
for (const part of path.split('/')) {
|
|
16
|
+
if (part === '' || part === '.')
|
|
17
|
+
continue;
|
|
13
18
|
if (part === '..') {
|
|
14
|
-
if (parts.length === 0)
|
|
19
|
+
if (parts.length === 0)
|
|
20
|
+
return null;
|
|
15
21
|
parts.pop();
|
|
16
22
|
continue;
|
|
17
23
|
}
|
|
@@ -19,41 +25,148 @@ export function normalize(path) {
|
|
|
19
25
|
}
|
|
20
26
|
return parts.join('/');
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
const REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([A-Za-z][A-Za-z0-9]{0,31}));/y;
|
|
29
|
+
const PERCENT = /^%[0-9a-fA-F]{2}/;
|
|
30
|
+
function referenceAt(text, at) {
|
|
31
|
+
REFERENCE.lastIndex = at;
|
|
32
|
+
const match = REFERENCE.exec(text);
|
|
33
|
+
if (match === null)
|
|
34
|
+
return null;
|
|
35
|
+
const [whole, hex, decimal, name] = match;
|
|
36
|
+
const end = at + whole.length;
|
|
37
|
+
if (name !== undefined) {
|
|
38
|
+
const decoded = decodeNamedCharacterReference(name);
|
|
39
|
+
return decoded === false ? null : { text: decoded, end };
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
text: decodeNumericCharacterReference(hex ?? decimal, hex === undefined ? 10 : 16),
|
|
43
|
+
end,
|
|
44
|
+
};
|
|
24
45
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
function unescaped(written) {
|
|
47
|
+
let base = '';
|
|
48
|
+
let i = 0;
|
|
49
|
+
while (i < written.length) {
|
|
50
|
+
const escaped = escapes(written, i);
|
|
51
|
+
const reference = escaped || written[i] !== '&' ? null : referenceAt(written, i);
|
|
52
|
+
const text = escaped ? written[i + 1] : (reference?.text ?? written[i]);
|
|
53
|
+
if (text.startsWith('?') || text.startsWith('#'))
|
|
54
|
+
return { base, suffix: i };
|
|
55
|
+
base += text;
|
|
56
|
+
i = escaped ? i + 2 : (reference?.end ?? i + 1);
|
|
57
|
+
}
|
|
58
|
+
return { base, suffix: written.length };
|
|
28
59
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
60
|
+
function located(href) {
|
|
61
|
+
const written = href.trim();
|
|
62
|
+
const { base, suffix } = unescaped(written);
|
|
63
|
+
const url = base.replace(/[\t\n\r]/g, '').replace(/^[\u0000-\u0020]+/, '');
|
|
64
|
+
return { base: suffix === written.length ? url.replace(/[\u0000-\u0020]+$/, '') : url, suffix };
|
|
65
|
+
}
|
|
66
|
+
const ENCODED = /(?:%[0-9a-fA-F]{2})+/g;
|
|
67
|
+
function decodedRun(run) {
|
|
68
|
+
try {
|
|
69
|
+
return decodeURIComponent(run);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export function destinationPath(href) {
|
|
76
|
+
const base = located(href).base;
|
|
77
|
+
let path = '';
|
|
78
|
+
let cursor = 0;
|
|
79
|
+
for (const match of base.matchAll(ENCODED)) {
|
|
80
|
+
const decoded = decodedRun(match[0]);
|
|
81
|
+
if (decoded === null)
|
|
82
|
+
return null;
|
|
83
|
+
path += base.slice(cursor, match.index) + decoded;
|
|
84
|
+
cursor = match.index + match[0].length;
|
|
85
|
+
}
|
|
86
|
+
return path + base.slice(cursor);
|
|
87
|
+
}
|
|
88
|
+
function written(path) {
|
|
89
|
+
let text = '';
|
|
90
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
91
|
+
const char = path[i];
|
|
92
|
+
if (char === '?' || char === '#' || char < ' ')
|
|
93
|
+
text += encodeURIComponent(char);
|
|
94
|
+
else if (char === ' ' && (i === 0 || i === path.length - 1))
|
|
95
|
+
text += '%20';
|
|
96
|
+
else if (char === '%' && PERCENT.test(path.slice(i)))
|
|
97
|
+
text += '%25';
|
|
98
|
+
else if (escapes(path, i))
|
|
99
|
+
text += '%5C';
|
|
100
|
+
else if (char === '&' && referenceAt(path, i) !== null)
|
|
101
|
+
text += '%26';
|
|
102
|
+
else
|
|
103
|
+
text += char;
|
|
104
|
+
}
|
|
105
|
+
return text;
|
|
106
|
+
}
|
|
107
|
+
function roomTargetOf(path) {
|
|
108
|
+
if (!path.startsWith(SHELL_ROOMS))
|
|
109
|
+
return null;
|
|
110
|
+
const rest = path.slice(SHELL_ROOMS.length);
|
|
111
|
+
const slash = rest.indexOf('/');
|
|
112
|
+
const handle = rest.slice(0, slash);
|
|
113
|
+
if (slash <= 0 || handle === '.' || handle === '..')
|
|
114
|
+
return null;
|
|
115
|
+
const within = normalize(rest.slice(slash + 1));
|
|
116
|
+
return within === null || within === '' ? null : { handle, path: within };
|
|
33
117
|
}
|
|
34
118
|
export function classifyHref(from, href) {
|
|
119
|
+
const base = located(href).base;
|
|
120
|
+
if (base === '')
|
|
121
|
+
return { kind: 'skip' };
|
|
122
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(base))
|
|
123
|
+
return { kind: 'skip' };
|
|
124
|
+
const path = destinationPath(href);
|
|
125
|
+
if (path === null)
|
|
126
|
+
return { kind: 'invalid' };
|
|
127
|
+
if (path.startsWith('/')) {
|
|
128
|
+
const room = roomTargetOf(path);
|
|
129
|
+
return room === null ? { kind: 'invalid' } : { kind: 'room', ...room };
|
|
130
|
+
}
|
|
131
|
+
const resolved = normalize(join(dirname(from), path));
|
|
132
|
+
if (resolved === null || resolved === '')
|
|
133
|
+
return { kind: 'invalid' };
|
|
134
|
+
return { kind: 'path', path: resolved };
|
|
135
|
+
}
|
|
136
|
+
export function roomTarget(href) {
|
|
137
|
+
const path = destinationPath(href);
|
|
138
|
+
return path === null ? null : roomTargetOf(path);
|
|
139
|
+
}
|
|
140
|
+
export function roomPath(href) {
|
|
141
|
+
const room = roomTarget(href);
|
|
142
|
+
return room === null ? null : `${SHELL_ROOMS}${room.handle}/${room.path}`;
|
|
143
|
+
}
|
|
144
|
+
export function target(from, href) {
|
|
145
|
+
const resolved = classifyHref(from, href);
|
|
146
|
+
return resolved.kind === 'path' ? resolved.path : null;
|
|
147
|
+
}
|
|
148
|
+
export function retarget(href, to) {
|
|
35
149
|
const trimmed = href.trim();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
150
|
+
return written(to) + trimmed.slice(unescaped(trimmed).suffix);
|
|
151
|
+
}
|
|
152
|
+
export function relative(from, target) {
|
|
153
|
+
const base = dirname(from)
|
|
154
|
+
.split('/')
|
|
155
|
+
.filter((part) => part !== '');
|
|
156
|
+
const parts = target.split('/');
|
|
157
|
+
let shared = 0;
|
|
158
|
+
while (shared < base.length && shared + 1 < parts.length && base[shared] === parts[shared]) {
|
|
159
|
+
shared += 1;
|
|
160
|
+
}
|
|
161
|
+
const up = Array.from({ length: base.length - shared }, () => '..');
|
|
162
|
+
return [...up, ...parts.slice(shared)].join('/');
|
|
163
|
+
}
|
|
164
|
+
export const SHELL_ROOMS = '/rooms/';
|
|
165
|
+
export function shellTarget(href, handle) {
|
|
166
|
+
const prefix = `${SHELL_ROOMS}${handle}/`;
|
|
167
|
+
const decoded = destinationPath(href);
|
|
168
|
+
if (decoded === null || !decoded.startsWith(prefix))
|
|
169
|
+
return null;
|
|
170
|
+
const path = normalize(decoded.slice(prefix.length));
|
|
171
|
+
return path === null || path === '' ? null : path;
|
|
57
172
|
}
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=paths.js.map
|
package/dist/profile.js
CHANGED
package/dist/project.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import type { Document, Projection, ProjectionContext } from './types.js';
|
|
1
|
+
import type { Document, Extent, Projection, ProjectionContext, Refusal } from './types.js';
|
|
2
|
+
export type Piece = Extent & {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
};
|
|
5
|
+
export type Edit = Piece;
|
|
6
|
+
export type Input = {
|
|
7
|
+
readonly values: readonly Piece[];
|
|
8
|
+
readonly ranges: readonly Extent[];
|
|
9
|
+
readonly edits: readonly Edit[];
|
|
10
|
+
};
|
|
11
|
+
export type InputResult = {
|
|
12
|
+
readonly ok: true;
|
|
13
|
+
readonly input: Input;
|
|
14
|
+
} | {
|
|
15
|
+
readonly ok: false;
|
|
16
|
+
readonly refusal: Refusal;
|
|
17
|
+
};
|
|
18
|
+
export declare function firstEditFrom(edits: readonly Edit[], start: number): number;
|
|
19
|
+
export declare function rangeText(content: string, range: Extent, edits: readonly Edit[]): string;
|
|
20
|
+
export declare function projectionInput(document: Document, file: string, context: ProjectionContext): InputResult;
|
|
2
21
|
export declare function project(document: Document, file: string, context?: ProjectionContext): Projection;
|
|
3
22
|
//# sourceMappingURL=project.d.ts.map
|
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,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;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,122 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { classifyHref } from './paths.js';
|
|
1
|
+
import { memberFacts } from './definition.js';
|
|
2
|
+
import { frontmatter, inventoryOf } from './document.js';
|
|
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(
|
|
9
|
-
const inventory = linkInventory(body);
|
|
7
|
+
function internalEdits(content, inventory, bodyStart, file, documentTargets) {
|
|
10
8
|
const internal = new Set();
|
|
9
|
+
const uses = inventory.uses
|
|
10
|
+
.filter((use) => {
|
|
11
|
+
const resolved = target(file, use.destination.href);
|
|
12
|
+
return resolved === null
|
|
13
|
+
? roomTarget(use.destination.href) !== null
|
|
14
|
+
: documentTargets.has(resolved);
|
|
15
|
+
})
|
|
16
|
+
.sort((left, right) => left.start - right.start);
|
|
11
17
|
const edits = [];
|
|
12
|
-
for (
|
|
13
|
-
const
|
|
14
|
-
if (resolved.kind !== 'path' || !documentTargets.has(resolved.path)) continue;
|
|
18
|
+
for (let index = uses.length - 1; index >= 0; index -= 1) {
|
|
19
|
+
const use = uses[index];
|
|
15
20
|
internal.add(use.destination.start);
|
|
21
|
+
const label = { start: bodyStart + use.labelStart, end: bodyStart + use.labelEnd };
|
|
22
|
+
const inner = [];
|
|
23
|
+
for (let nested = index + 1; nested < uses.length; nested += 1) {
|
|
24
|
+
const edit = edits[uses.length - 1 - nested];
|
|
25
|
+
if (edit.start >= label.end)
|
|
26
|
+
break;
|
|
27
|
+
if (edit.start >= label.start && edit.end <= label.end)
|
|
28
|
+
inner.push(edit);
|
|
29
|
+
}
|
|
16
30
|
edits.push({
|
|
17
|
-
start: use.start,
|
|
18
|
-
end: use.end,
|
|
19
|
-
text:
|
|
31
|
+
start: bodyStart + use.start,
|
|
32
|
+
end: bodyStart + use.end,
|
|
33
|
+
text: rangeText(content, label, inner),
|
|
20
34
|
});
|
|
21
35
|
}
|
|
22
|
-
for (const block of inventory.blocks){
|
|
23
|
-
if (!internal.has(block.destination.start))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end: block.end,
|
|
27
|
-
text: ''
|
|
28
|
-
});
|
|
36
|
+
for (const block of inventory.blocks) {
|
|
37
|
+
if (!internal.has(block.destination.start))
|
|
38
|
+
continue;
|
|
39
|
+
edits.push({ start: bodyStart + block.start, end: bodyStart + block.end, text: '' });
|
|
29
40
|
}
|
|
30
|
-
return edits.sort((left, right)=>left.start - right.start);
|
|
41
|
+
return edits.sort((left, right) => left.start - right.start);
|
|
31
42
|
}
|
|
32
|
-
function
|
|
43
|
+
export function firstEditFrom(edits, start) {
|
|
44
|
+
let low = 0;
|
|
45
|
+
let high = edits.length;
|
|
46
|
+
while (low < high) {
|
|
47
|
+
const middle = (low + high) >>> 1;
|
|
48
|
+
if (edits[middle].start < start)
|
|
49
|
+
low = middle + 1;
|
|
50
|
+
else
|
|
51
|
+
high = middle;
|
|
52
|
+
}
|
|
53
|
+
return low;
|
|
54
|
+
}
|
|
55
|
+
export function rangeText(content, range, edits) {
|
|
33
56
|
let text = '';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
text +=
|
|
57
|
+
let cursor = range.start;
|
|
58
|
+
for (let index = firstEditFrom(edits, range.start); index < edits.length; index += 1) {
|
|
59
|
+
const edit = edits[index];
|
|
60
|
+
if (edit.start > range.end)
|
|
61
|
+
break;
|
|
62
|
+
if (edit.start < cursor || edit.end > range.end)
|
|
63
|
+
continue;
|
|
64
|
+
text += content.slice(cursor, edit.start) + edit.text;
|
|
65
|
+
cursor = edit.end;
|
|
42
66
|
}
|
|
43
|
-
return text;
|
|
67
|
+
return text + content.slice(cursor, range.end);
|
|
44
68
|
}
|
|
45
69
|
function structural(spec) {
|
|
46
|
-
return spec.kind === 'list' && spec.
|
|
70
|
+
return spec.kind === 'list' && !spec.items.prose;
|
|
47
71
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
if (spec.kind !== 'list' || spec.of.kind !== 'text' || !Array.isArray(value)) continue;
|
|
57
|
-
for (const item of value)if (typeof item === 'string') text += `${item}\n\n`;
|
|
72
|
+
function proseValues(node, facts, values) {
|
|
73
|
+
if (facts === undefined)
|
|
74
|
+
return;
|
|
75
|
+
if (node.kind === 'scalar') {
|
|
76
|
+
if (facts.prose && typeof node.value === 'string')
|
|
77
|
+
values.push({ start: node.start, end: node.end, text: `${node.value}\n\n` });
|
|
78
|
+
return;
|
|
58
79
|
}
|
|
59
|
-
|
|
80
|
+
if (node.kind === 'seq') {
|
|
81
|
+
for (const item of node.items)
|
|
82
|
+
proseValues(item, facts.items, values);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
for (const entry of node.entries)
|
|
86
|
+
proseValues(entry.value, memberFacts(facts, entry.key), values);
|
|
87
|
+
}
|
|
88
|
+
function freeTextValues(definition, document) {
|
|
89
|
+
const root = frontmatter(document);
|
|
90
|
+
if (root === null)
|
|
91
|
+
return [];
|
|
92
|
+
const values = [];
|
|
93
|
+
proseValues(root, definition.frontmatter, values);
|
|
94
|
+
return values;
|
|
60
95
|
}
|
|
61
|
-
export function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const body = document.content.slice(bodyStart);
|
|
66
|
-
const edits = internalEdits(body, file, new Set(context.documentTargets));
|
|
96
|
+
export function projectionInput(document, file, context) {
|
|
97
|
+
const content = document.content;
|
|
98
|
+
const bodyStart = bodyStartOf(content);
|
|
99
|
+
const edits = internalEdits(content, inventoryOf(document), bodyStart, file, new Set(context.documentTargets));
|
|
67
100
|
const declared = document.type;
|
|
68
101
|
if (declared === undefined || declared === 'any') {
|
|
69
102
|
return {
|
|
70
103
|
ok: true,
|
|
71
|
-
|
|
72
|
-
[
|
|
73
|
-
0,
|
|
74
|
-
body.length
|
|
75
|
-
]
|
|
76
|
-
], edits)
|
|
104
|
+
input: { values: [], ranges: [{ start: bodyStart, end: content.length }], edits },
|
|
77
105
|
};
|
|
78
106
|
}
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return {
|
|
82
|
-
ok: false,
|
|
83
|
-
refusal: refusal(file, 'unknown-type', {
|
|
84
|
-
location: 'type'
|
|
85
|
-
})
|
|
86
|
-
};
|
|
107
|
+
const definition = context.definition;
|
|
108
|
+
if (definition === undefined) {
|
|
109
|
+
return { ok: false, refusal: refusal(file, 'unknown-type', { location: 'type' }) };
|
|
87
110
|
}
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if ('rule' in definition) return {
|
|
96
|
-
ok: false,
|
|
97
|
-
refusal: definition
|
|
98
|
-
};
|
|
99
|
-
const structure = new Set(Object.entries(definition.sections).flatMap(([name, spec])=>structural(spec) ? [
|
|
100
|
-
name
|
|
101
|
-
] : []));
|
|
102
|
-
const headings = headingSpans(document.content, bodyStart);
|
|
103
|
-
const spans = [
|
|
104
|
-
[
|
|
105
|
-
0,
|
|
106
|
-
(headings[0]?.headingStart ?? document.content.length) - bodyStart
|
|
107
|
-
]
|
|
108
|
-
];
|
|
109
|
-
for (const heading of headings){
|
|
110
|
-
if (structure.has(heading.name)) continue;
|
|
111
|
-
spans.push([
|
|
112
|
-
heading.headingStart - bodyStart,
|
|
113
|
-
heading.bodyEnd - bodyStart
|
|
114
|
-
]);
|
|
111
|
+
const structure = new Set(Object.entries(definition.sections).flatMap(([name, spec]) => (structural(spec) ? [name] : [])));
|
|
112
|
+
const headings = headingSpans(content, bodyStart);
|
|
113
|
+
const ranges = [{ start: bodyStart, end: headings[0]?.headingStart ?? content.length }];
|
|
114
|
+
for (const heading of headings) {
|
|
115
|
+
if (structure.has(heading.name))
|
|
116
|
+
continue;
|
|
117
|
+
ranges.push({ start: heading.headingStart, end: heading.bodyEnd });
|
|
115
118
|
}
|
|
116
|
-
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
return { ok: true, input: { values: freeTextValues(definition, document), ranges, edits } };
|
|
120
|
+
}
|
|
121
|
+
export function project(document, file, context = { documentTargets: [] }) {
|
|
122
|
+
const result = projectionInput(document, file, context);
|
|
123
|
+
if (!result.ok)
|
|
124
|
+
return { ok: false, refusal: result.refusal };
|
|
125
|
+
const { values, ranges, edits } = result.input;
|
|
126
|
+
const prose = ranges.map((range) => rangeText(document.content, range, edits)).join('');
|
|
127
|
+
return { ok: true, text: values.map((value) => value.text).join('') + prose };
|
|
120
128
|
}
|
|
121
|
-
|
|
122
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { Frontmatter, Reference } from './types.js';
|
|
3
|
+
export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
|
|
4
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA8BzD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EACrC,UAAU,EAAE,UAAU,GACrB,SAAS,SAAS,EAAE,CAItB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { escapePointer, itemFacts, memberFacts, } from './definition.js';
|
|
2
|
+
import { isRecord } from './yaml.js';
|
|
3
|
+
function collect(value, facts, pointer, found) {
|
|
4
|
+
if (facts === undefined)
|
|
5
|
+
return;
|
|
6
|
+
if (typeof value === 'string') {
|
|
7
|
+
if (facts.reference !== undefined)
|
|
8
|
+
found.push({
|
|
9
|
+
pointer,
|
|
10
|
+
value,
|
|
11
|
+
to: facts.reference,
|
|
12
|
+
...(facts.crossRoom === true ? { crossRoom: true } : {}),
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
for (const [index, item] of value.entries())
|
|
18
|
+
collect(item, itemFacts(facts, index), `${pointer}/${index}`, found);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!isRecord(value))
|
|
22
|
+
return;
|
|
23
|
+
for (const [key, held] of Object.entries(value))
|
|
24
|
+
collect(held, memberFacts(facts, key), `${pointer}/${escapePointer(key)}`, found);
|
|
25
|
+
}
|
|
26
|
+
export function references(document, definition) {
|
|
27
|
+
const found = [];
|
|
28
|
+
collect(document.fields, definition.frontmatter, '', found);
|
|
29
|
+
return found;
|
|
30
|
+
}
|
package/dist/refuse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3D,OAAO,CAOT"}
|
package/dist/refuse.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { VERSION } from './version.js';
|
|
2
1
|
export function refusal(file, rule, extra) {
|
|
3
2
|
return {
|
|
4
3
|
file,
|
|
5
4
|
rule,
|
|
6
|
-
|
|
7
|
-
...extra?.
|
|
8
|
-
location: extra.location
|
|
9
|
-
},
|
|
10
|
-
...extra?.referrers === undefined ? {} : {
|
|
11
|
-
referrers: extra.referrers
|
|
12
|
-
}
|
|
5
|
+
...(extra?.location === undefined ? {} : { location: extra.location }),
|
|
6
|
+
...(extra?.referrers === undefined ? {} : { referrers: extra.referrers }),
|
|
13
7
|
};
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=refuse.js.map
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
export type SchemaRefusal = {
|
|
3
|
+
readonly rule: string;
|
|
4
|
+
readonly location: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function frontmatterRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
|
|
7
|
+
export declare function fitsItem(definition: Definition, section: string, text: string): boolean;
|
|
6
8
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA2KjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAG3B;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvF"}
|