@superbee/core 0.2.0-pre.9 → 0.4.10-pre.12
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/LICENSE +202 -0
- package/README.md +1339 -6
- package/dist/backend.d.ts +50 -2
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +311 -33
- package/dist/backend.js.map +1 -1
- package/dist/blob-contract.d.ts +82 -0
- package/dist/blob-contract.d.ts.map +1 -0
- package/dist/blob-contract.js +134 -0
- package/dist/blob-contract.js.map +1 -0
- package/dist/blob-journal.d.ts +303 -0
- package/dist/blob-journal.d.ts.map +1 -0
- package/dist/blob-journal.js +541 -0
- package/dist/blob-journal.js.map +1 -0
- package/dist/body-pages.d.ts +20 -0
- package/dist/body-pages.d.ts.map +1 -0
- package/dist/body-pages.js +56 -0
- package/dist/body-pages.js.map +1 -0
- package/dist/body-replace-guards.d.ts +81 -0
- package/dist/body-replace-guards.d.ts.map +1 -0
- package/dist/body-replace-guards.js +271 -0
- package/dist/body-replace-guards.js.map +1 -0
- package/dist/bounded-yaml.d.ts +28 -0
- package/dist/bounded-yaml.d.ts.map +1 -0
- package/dist/bounded-yaml.js +182 -0
- package/dist/bounded-yaml.js.map +1 -0
- package/dist/builtin-recipes/content.d.ts +93 -0
- package/dist/builtin-recipes/content.d.ts.map +1 -0
- package/dist/builtin-recipes/content.js +288 -0
- package/dist/builtin-recipes/content.js.map +1 -0
- package/dist/builtin-recipes/site.d.ts +5 -0
- package/dist/builtin-recipes/site.d.ts.map +1 -0
- package/dist/builtin-recipes/site.js +83 -0
- package/dist/builtin-recipes/site.js.map +1 -0
- package/dist/builtin-recipes.d.ts +13 -0
- package/dist/builtin-recipes.d.ts.map +1 -0
- package/dist/builtin-recipes.js +123 -0
- package/dist/builtin-recipes.js.map +1 -0
- package/dist/bundle-health/index.d.ts +14 -0
- package/dist/bundle-health/index.d.ts.map +1 -0
- package/dist/bundle-health/index.js +12 -0
- package/dist/bundle-health/index.js.map +1 -0
- package/dist/bundle-health/kind-findings.d.ts +45 -0
- package/dist/bundle-health/kind-findings.d.ts.map +1 -0
- package/dist/bundle-health/kind-findings.js +67 -0
- package/dist/bundle-health/kind-findings.js.map +1 -0
- package/dist/bundle-health/legacy-page.d.ts +21 -0
- package/dist/bundle-health/legacy-page.d.ts.map +1 -0
- package/dist/bundle-health/legacy-page.js +25 -0
- package/dist/bundle-health/legacy-page.js.map +1 -0
- package/dist/bundle-health/report.d.ts +191 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +419 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/bundle-ops.d.ts +10 -4
- package/dist/bundle-ops.d.ts.map +1 -1
- package/dist/bundle-ops.js +15 -8
- package/dist/bundle-ops.js.map +1 -1
- package/dist/bundle.d.ts +2 -4
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +3 -12
- package/dist/bundle.js.map +1 -1
- package/dist/code-point-order.d.ts +8 -0
- package/dist/code-point-order.d.ts.map +1 -0
- package/dist/code-point-order.js +20 -0
- package/dist/code-point-order.js.map +1 -0
- package/dist/code-unit-order.d.ts +15 -0
- package/dist/code-unit-order.d.ts.map +1 -0
- package/dist/code-unit-order.js +17 -0
- package/dist/code-unit-order.js.map +1 -0
- package/dist/connector-request.d.ts +112 -0
- package/dist/connector-request.d.ts.map +1 -0
- package/dist/connector-request.js +495 -0
- package/dist/connector-request.js.map +1 -0
- package/dist/connectors.d.ts +297 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +1233 -0
- package/dist/connectors.js.map +1 -0
- package/dist/convention-record.d.ts +9 -0
- package/dist/convention-record.d.ts.map +1 -0
- package/dist/convention-record.js +13 -0
- package/dist/convention-record.js.map +1 -0
- package/dist/cross-bundle.d.ts +135 -0
- package/dist/cross-bundle.d.ts.map +1 -0
- package/dist/cross-bundle.js +191 -0
- package/dist/cross-bundle.js.map +1 -0
- package/dist/dependencies.d.ts +208 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +367 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/document-codec.d.ts +4 -1
- package/dist/document-codec.d.ts.map +1 -1
- package/dist/document-codec.js +3 -1
- package/dist/document-codec.js.map +1 -1
- package/dist/document-field-actions.d.ts +21 -3
- package/dist/document-field-actions.d.ts.map +1 -1
- package/dist/document-field-actions.js +105 -40
- package/dist/document-field-actions.js.map +1 -1
- package/dist/document-mutation.d.ts +44 -18
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +192 -86
- package/dist/document-mutation.js.map +1 -1
- package/dist/document-persistence.d.ts +12 -0
- package/dist/document-persistence.d.ts.map +1 -0
- package/dist/document-persistence.js +44 -0
- package/dist/document-persistence.js.map +1 -0
- package/dist/document-replace-rules.d.ts +44 -0
- package/dist/document-replace-rules.d.ts.map +1 -0
- package/dist/document-replace-rules.js +41 -0
- package/dist/document-replace-rules.js.map +1 -0
- package/dist/document-scan.d.ts +26 -0
- package/dist/document-scan.d.ts.map +1 -0
- package/dist/document-scan.js +70 -0
- package/dist/document-scan.js.map +1 -0
- package/dist/document-transfer.d.ts +314 -0
- package/dist/document-transfer.d.ts.map +1 -0
- package/dist/document-transfer.js +1404 -0
- package/dist/document-transfer.js.map +1 -0
- package/dist/document-write-policy.d.ts +15 -4
- package/dist/document-write-policy.d.ts.map +1 -1
- package/dist/document-write-policy.js +41 -27
- package/dist/document-write-policy.js.map +1 -1
- package/dist/domain-model.d.ts +73 -0
- package/dist/domain-model.d.ts.map +1 -0
- package/dist/domain-model.js +169 -0
- package/dist/domain-model.js.map +1 -0
- package/dist/edge-harness/corpus.d.ts +9 -0
- package/dist/edge-harness/corpus.d.ts.map +1 -0
- package/dist/edge-harness/corpus.js +57 -0
- package/dist/edge-harness/corpus.js.map +1 -0
- package/dist/edge-harness/index.d.ts +21 -0
- package/dist/edge-harness/index.d.ts.map +1 -0
- package/dist/edge-harness/index.js +537 -0
- package/dist/edge-harness/index.js.map +1 -0
- package/dist/edges/find.d.ts +14 -0
- package/dist/edges/find.d.ts.map +1 -0
- package/dist/edges/find.js +46 -0
- package/dist/edges/find.js.map +1 -0
- package/dist/edges/index.d.ts +13 -0
- package/dist/edges/index.d.ts.map +1 -0
- package/dist/edges/index.js +5 -0
- package/dist/edges/index.js.map +1 -0
- package/dist/edges/memory-source.d.ts +8 -0
- package/dist/edges/memory-source.d.ts.map +1 -0
- package/dist/edges/memory-source.js +164 -0
- package/dist/edges/memory-source.js.map +1 -0
- package/dist/edges/read-bounds.d.ts +6 -0
- package/dist/edges/read-bounds.d.ts.map +1 -0
- package/dist/edges/read-bounds.js +13 -0
- package/dist/edges/read-bounds.js.map +1 -0
- package/dist/edges/source.d.ts +123 -0
- package/dist/edges/source.d.ts.map +1 -0
- package/dist/edges/source.js +2 -0
- package/dist/edges/source.js.map +1 -0
- package/dist/edges/walk.d.ts +7 -0
- package/dist/edges/walk.d.ts.map +1 -0
- package/dist/edges/walk.js +14 -0
- package/dist/edges/walk.js.map +1 -0
- package/dist/engine.d.ts +54 -18
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +137 -108
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +40 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +80 -4
- package/dist/errors.js.map +1 -1
- package/dist/file-journaled-backend-internal.d.ts +2 -0
- package/dist/file-journaled-backend-internal.d.ts.map +1 -1
- package/dist/file-journaled-backend-internal.js +2 -0
- package/dist/file-journaled-backend-internal.js.map +1 -1
- package/dist/file-journaled-backend.d.ts +38 -40
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +284 -52
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/filesystem-identity.d.ts +116 -17
- package/dist/filesystem-identity.d.ts.map +1 -1
- package/dist/filesystem-identity.js +532 -51
- package/dist/filesystem-identity.js.map +1 -1
- package/dist/filesystem-lock.d.ts +9 -2
- package/dist/filesystem-lock.d.ts.map +1 -1
- package/dist/filesystem-lock.js +134 -17
- package/dist/filesystem-lock.js.map +1 -1
- package/dist/filesystem-temp-name.d.ts +9 -0
- package/dist/filesystem-temp-name.d.ts.map +1 -0
- package/dist/filesystem-temp-name.js +20 -0
- package/dist/filesystem-temp-name.js.map +1 -0
- package/dist/filesystem.d.ts +6 -0
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +2 -1
- package/dist/filesystem.js.map +1 -1
- package/dist/freshness.d.ts +16 -1
- package/dist/freshness.d.ts.map +1 -1
- package/dist/freshness.js +47 -17
- package/dist/freshness.js.map +1 -1
- package/dist/frontmatter-contract.d.ts +14 -0
- package/dist/frontmatter-contract.d.ts.map +1 -1
- package/dist/frontmatter-contract.js +22 -0
- package/dist/frontmatter-contract.js.map +1 -1
- package/dist/frontmatter-splitter.d.ts +6 -0
- package/dist/frontmatter-splitter.d.ts.map +1 -1
- package/dist/frontmatter-splitter.js +8 -0
- package/dist/frontmatter-splitter.js.map +1 -1
- package/dist/frontmatter.d.ts +17 -7
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +52 -11
- package/dist/frontmatter.js.map +1 -1
- package/dist/governed-body-write.d.ts.map +1 -1
- package/dist/governed-body-write.js +13 -6
- package/dist/governed-body-write.js.map +1 -1
- package/dist/heads-digest.d.ts.map +1 -1
- package/dist/heads-digest.js +2 -1
- package/dist/heads-digest.js.map +1 -1
- package/dist/hosted-client/binding.d.ts +7 -0
- package/dist/hosted-client/binding.d.ts.map +1 -0
- package/dist/hosted-client/binding.js +10 -0
- package/dist/hosted-client/binding.js.map +1 -0
- package/dist/hosted-client/blob-delivery.d.ts +68 -0
- package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
- package/dist/hosted-client/blob-delivery.js +170 -0
- package/dist/hosted-client/blob-delivery.js.map +1 -0
- package/dist/hosted-client/blob-write.d.ts +387 -0
- package/dist/hosted-client/blob-write.d.ts.map +1 -0
- package/dist/hosted-client/blob-write.js +770 -0
- package/dist/hosted-client/blob-write.js.map +1 -0
- package/dist/hosted-client/bundle-listing.d.ts +46 -0
- package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
- package/dist/hosted-client/bundle-listing.js +36 -0
- package/dist/hosted-client/bundle-listing.js.map +1 -0
- package/dist/hosted-client/client.d.ts +249 -0
- package/dist/hosted-client/client.d.ts.map +1 -0
- package/dist/hosted-client/client.js +381 -0
- package/dist/hosted-client/client.js.map +1 -0
- package/dist/hosted-client/directory.d.ts +46 -0
- package/dist/hosted-client/directory.d.ts.map +1 -0
- package/dist/hosted-client/directory.js +74 -0
- package/dist/hosted-client/directory.js.map +1 -0
- package/dist/hosted-client/errors.d.ts +26 -0
- package/dist/hosted-client/errors.d.ts.map +1 -0
- package/dist/hosted-client/errors.js +35 -0
- package/dist/hosted-client/errors.js.map +1 -0
- package/dist/hosted-client/inbox.d.ts +320 -0
- package/dist/hosted-client/inbox.d.ts.map +1 -0
- package/dist/hosted-client/inbox.js +379 -0
- package/dist/hosted-client/inbox.js.map +1 -0
- package/dist/hosted-client/index.d.ts +31 -0
- package/dist/hosted-client/index.d.ts.map +1 -0
- package/dist/hosted-client/index.js +33 -0
- package/dist/hosted-client/index.js.map +1 -0
- package/dist/hosted-client/journal.d.ts +103 -0
- package/dist/hosted-client/journal.d.ts.map +1 -0
- package/dist/hosted-client/journal.js +464 -0
- package/dist/hosted-client/journal.js.map +1 -0
- package/dist/hosted-client/node.d.ts +74 -0
- package/dist/hosted-client/node.d.ts.map +1 -0
- package/dist/hosted-client/node.js +219 -0
- package/dist/hosted-client/node.js.map +1 -0
- package/dist/hosted-client/reference.d.ts +12 -0
- package/dist/hosted-client/reference.d.ts.map +1 -0
- package/dist/hosted-client/reference.js +29 -0
- package/dist/hosted-client/reference.js.map +1 -0
- package/dist/hosted-client/view-content.d.ts +184 -0
- package/dist/hosted-client/view-content.d.ts.map +1 -0
- package/dist/hosted-client/view-content.js +268 -0
- package/dist/hosted-client/view-content.js.map +1 -0
- package/dist/hosted-client/write.d.ts +219 -0
- package/dist/hosted-client/write.d.ts.map +1 -0
- package/dist/hosted-client/write.js +419 -0
- package/dist/hosted-client/write.js.map +1 -0
- package/dist/hosted-transport/answer-rows.d.ts +132 -4
- package/dist/hosted-transport/answer-rows.d.ts.map +1 -1
- package/dist/hosted-transport/answer-rows.js +211 -11
- package/dist/hosted-transport/answer-rows.js.map +1 -1
- package/dist/hosted-transport/attribution.d.ts +32 -0
- package/dist/hosted-transport/attribution.d.ts.map +1 -0
- package/dist/hosted-transport/attribution.js +38 -0
- package/dist/hosted-transport/attribution.js.map +1 -0
- package/dist/hosted-transport/blob-reads.d.ts +35 -0
- package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
- package/dist/hosted-transport/blob-reads.js +179 -0
- package/dist/hosted-transport/blob-reads.js.map +1 -0
- package/dist/hosted-transport/blob-write.d.ts +34 -0
- package/dist/hosted-transport/blob-write.d.ts.map +1 -0
- package/dist/hosted-transport/blob-write.js +115 -0
- package/dist/hosted-transport/blob-write.js.map +1 -0
- package/dist/hosted-transport/carrier.d.ts +35 -11
- package/dist/hosted-transport/carrier.d.ts.map +1 -1
- package/dist/hosted-transport/carrier.js +101 -57
- package/dist/hosted-transport/carrier.js.map +1 -1
- package/dist/hosted-transport/document-backend.d.ts +74 -0
- package/dist/hosted-transport/document-backend.d.ts.map +1 -0
- package/dist/hosted-transport/document-backend.js +160 -0
- package/dist/hosted-transport/document-backend.js.map +1 -0
- package/dist/hosted-transport/index.d.ts +7 -4
- package/dist/hosted-transport/index.d.ts.map +1 -1
- package/dist/hosted-transport/index.js +7 -4
- package/dist/hosted-transport/index.js.map +1 -1
- package/dist/hosted-transport/operations.d.ts +6 -0
- package/dist/hosted-transport/operations.d.ts.map +1 -1
- package/dist/hosted-transport/operations.js +2 -1
- package/dist/hosted-transport/operations.js.map +1 -1
- package/dist/hosted-transport/port-run.d.ts +41 -0
- package/dist/hosted-transport/port-run.d.ts.map +1 -0
- package/dist/hosted-transport/port-run.js +92 -0
- package/dist/hosted-transport/port-run.js.map +1 -0
- package/dist/hosted-transport/read-adapter.d.ts +19 -3
- package/dist/hosted-transport/read-adapter.d.ts.map +1 -1
- package/dist/hosted-transport/read-adapter.js +18 -5
- package/dist/hosted-transport/read-adapter.js.map +1 -1
- package/dist/hosted-transport/root-write.d.ts.map +1 -1
- package/dist/hosted-transport/root-write.js +5 -2
- package/dist/hosted-transport/root-write.js.map +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts +56 -7
- package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -1
- package/dist/hosted-transport/whole-document-transport.js +120 -31
- package/dist/hosted-transport/whole-document-transport.js.map +1 -1
- package/dist/identity-fold.d.ts +16 -0
- package/dist/identity-fold.d.ts.map +1 -0
- package/dist/identity-fold.js +24 -0
- package/dist/identity-fold.js.map +1 -0
- package/dist/index-projection.d.ts +2 -1
- package/dist/index-projection.d.ts.map +1 -1
- package/dist/index-projection.js +38 -28
- package/dist/index-projection.js.map +1 -1
- package/dist/index.d.ts +59 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -20
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts +0 -31
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +5 -2
- package/dist/indexeddb-backend.js.map +1 -1
- package/dist/inventory-guard.d.ts +58 -0
- package/dist/inventory-guard.d.ts.map +1 -0
- package/dist/inventory-guard.js +169 -0
- package/dist/inventory-guard.js.map +1 -0
- package/dist/journaled-backend.d.ts +14 -4
- package/dist/journaled-backend.d.ts.map +1 -1
- package/dist/journaled-backend.js +19 -78
- package/dist/journaled-backend.js.map +1 -1
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/json-data.js +19 -0
- package/dist/json-data.js.map +1 -0
- package/dist/kind-authoring.d.ts +188 -0
- package/dist/kind-authoring.d.ts.map +1 -0
- package/dist/kind-authoring.js +520 -0
- package/dist/kind-authoring.js.map +1 -0
- package/dist/kind-changes.d.ts +45 -0
- package/dist/kind-changes.d.ts.map +1 -0
- package/dist/kind-changes.js +96 -0
- package/dist/kind-changes.js.map +1 -0
- package/dist/kind-conformance-error.d.ts +16 -0
- package/dist/kind-conformance-error.d.ts.map +1 -0
- package/dist/kind-conformance-error.js +20 -0
- package/dist/kind-conformance-error.js.map +1 -0
- package/dist/kind-coverage.d.ts +100 -0
- package/dist/kind-coverage.d.ts.map +1 -0
- package/dist/kind-coverage.js +185 -0
- package/dist/kind-coverage.js.map +1 -0
- package/dist/kind-deprecation.d.ts +32 -0
- package/dist/kind-deprecation.d.ts.map +1 -0
- package/dist/kind-deprecation.js +141 -0
- package/dist/kind-deprecation.js.map +1 -0
- package/dist/kind-field-mutation.d.ts +7 -2
- package/dist/kind-field-mutation.d.ts.map +1 -1
- package/dist/kind-field-mutation.js +28 -3
- package/dist/kind-field-mutation.js.map +1 -1
- package/dist/kind-undeclared-fields.d.ts +72 -0
- package/dist/kind-undeclared-fields.d.ts.map +1 -0
- package/dist/kind-undeclared-fields.js +124 -0
- package/dist/kind-undeclared-fields.js.map +1 -0
- package/dist/kinds-load.d.ts.map +1 -1
- package/dist/kinds-load.js +8 -5
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts +105 -13
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +369 -30
- package/dist/kinds.js.map +1 -1
- package/dist/link-add.d.ts +81 -0
- package/dist/link-add.d.ts.map +1 -0
- package/dist/link-add.js +94 -0
- package/dist/link-add.js.map +1 -0
- package/dist/link-emit.d.ts +29 -0
- package/dist/link-emit.d.ts.map +1 -0
- package/dist/link-emit.js +39 -0
- package/dist/link-emit.js.map +1 -0
- package/dist/link-findings.d.ts +132 -0
- package/dist/link-findings.d.ts.map +1 -0
- package/dist/link-findings.js +263 -0
- package/dist/link-findings.js.map +1 -0
- package/dist/link-types.d.ts +34 -0
- package/dist/link-types.d.ts.map +1 -0
- package/dist/link-types.js +79 -0
- package/dist/link-types.js.map +1 -0
- package/dist/links.d.ts +68 -9
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +370 -57
- package/dist/links.js.map +1 -1
- package/dist/local-search-index.d.ts +86 -0
- package/dist/local-search-index.d.ts.map +1 -0
- package/dist/local-search-index.js +1055 -0
- package/dist/local-search-index.js.map +1 -0
- package/dist/managed-document-metadata.d.ts +5 -0
- package/dist/managed-document-metadata.d.ts.map +1 -0
- package/dist/managed-document-metadata.js +10 -0
- package/dist/managed-document-metadata.js.map +1 -0
- package/dist/markdown-syntax.d.ts +39 -0
- package/dist/markdown-syntax.d.ts.map +1 -0
- package/dist/markdown-syntax.js +10170 -0
- package/dist/markdown-syntax.js.map +1 -0
- package/dist/memory-backend.d.ts +3 -0
- package/dist/memory-backend.d.ts.map +1 -1
- package/dist/memory-backend.js +40 -2
- package/dist/memory-backend.js.map +1 -1
- package/dist/mutation-attribution.d.ts +2 -1
- package/dist/mutation-attribution.d.ts.map +1 -1
- package/dist/mutation-attribution.js.map +1 -1
- package/dist/okf-actor.d.ts +14 -3
- package/dist/okf-actor.d.ts.map +1 -1
- package/dist/okf-actor.js +25 -4
- package/dist/okf-actor.js.map +1 -1
- package/dist/okf-authored-values.d.ts +2 -0
- package/dist/okf-authored-values.d.ts.map +1 -1
- package/dist/okf-authored-values.js +4 -0
- package/dist/okf-authored-values.js.map +1 -1
- package/dist/okf-authoring.d.ts +7 -0
- package/dist/okf-authoring.d.ts.map +1 -0
- package/dist/okf-authoring.js +30 -0
- package/dist/okf-authoring.js.map +1 -0
- package/dist/okf-standard-fields.d.ts +4 -0
- package/dist/okf-standard-fields.d.ts.map +1 -1
- package/dist/okf-standard-fields.js +24 -14
- package/dist/okf-standard-fields.js.map +1 -1
- package/dist/okf-timestamps.d.ts +2 -2
- package/dist/okf-timestamps.d.ts.map +1 -1
- package/dist/okf-timestamps.js +25 -15
- package/dist/okf-timestamps.js.map +1 -1
- package/dist/page.d.ts +3 -7
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +3 -7
- package/dist/page.js.map +1 -1
- package/dist/path-fold.d.ts +67 -0
- package/dist/path-fold.d.ts.map +1 -0
- package/dist/path-fold.js +107 -0
- package/dist/path-fold.js.map +1 -0
- package/dist/paths.d.ts +46 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +114 -1
- package/dist/paths.js.map +1 -1
- package/dist/platform.d.ts +13 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +16 -0
- package/dist/platform.js.map +1 -1
- package/dist/portable-export-contract.d.ts +17 -0
- package/dist/portable-export-contract.d.ts.map +1 -0
- package/dist/portable-export-contract.js +59 -0
- package/dist/portable-export-contract.js.map +1 -0
- package/dist/portable-export.d.ts +115 -0
- package/dist/portable-export.d.ts.map +1 -0
- package/dist/portable-export.js +452 -0
- package/dist/portable-export.js.map +1 -0
- package/dist/portable-frontmatter.d.ts +17 -0
- package/dist/portable-frontmatter.d.ts.map +1 -1
- package/dist/portable-frontmatter.js +42 -5
- package/dist/portable-frontmatter.js.map +1 -1
- package/dist/publication-filesystem.d.ts +1 -1
- package/dist/publication-filesystem.d.ts.map +1 -1
- package/dist/publication-filesystem.js +1 -1
- package/dist/publication-filesystem.js.map +1 -1
- package/dist/qualified-links.d.ts +67 -0
- package/dist/qualified-links.d.ts.map +1 -0
- package/dist/qualified-links.js +121 -0
- package/dist/qualified-links.js.map +1 -0
- package/dist/query-filter.d.ts +11 -4
- package/dist/query-filter.d.ts.map +1 -1
- package/dist/query-filter.js +25 -6
- package/dist/query-filter.js.map +1 -1
- package/dist/query-order.d.ts.map +1 -1
- package/dist/query-order.js +2 -1
- package/dist/query-order.js.map +1 -1
- package/dist/recipe-lifecycle/errors.d.ts +96 -0
- package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
- package/dist/recipe-lifecycle/errors.js +122 -0
- package/dist/recipe-lifecycle/errors.js.map +1 -0
- package/dist/recipe-lifecycle/evolution.d.ts +134 -0
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
- package/dist/recipe-lifecycle/evolution.js +1047 -0
- package/dist/recipe-lifecycle/evolution.js.map +1 -0
- package/dist/recipe-lifecycle/index.d.ts +38 -0
- package/dist/recipe-lifecycle/index.d.ts.map +1 -0
- package/dist/recipe-lifecycle/index.js +31 -0
- package/dist/recipe-lifecycle/index.js.map +1 -0
- package/dist/recipe-lifecycle/install.d.ts +172 -0
- package/dist/recipe-lifecycle/install.d.ts.map +1 -0
- package/dist/recipe-lifecycle/install.js +652 -0
- package/dist/recipe-lifecycle/install.js.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts +4 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.js +22 -0
- package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
- package/dist/recipe-lifecycle/retirement-apply.d.ts +59 -0
- package/dist/recipe-lifecycle/retirement-apply.d.ts.map +1 -0
- package/dist/recipe-lifecycle/retirement-apply.js +165 -0
- package/dist/recipe-lifecycle/retirement-apply.js.map +1 -0
- package/dist/recipe-lifecycle/retirement.d.ts +89 -0
- package/dist/recipe-lifecycle/retirement.d.ts.map +1 -0
- package/dist/recipe-lifecycle/retirement.js +347 -0
- package/dist/recipe-lifecycle/retirement.js.map +1 -0
- package/dist/recipe-lifecycle/set-commit.d.ts +31 -0
- package/dist/recipe-lifecycle/set-commit.d.ts.map +1 -0
- package/dist/recipe-lifecycle/set-commit.js +37 -0
- package/dist/recipe-lifecycle/set-commit.js.map +1 -0
- package/dist/recipe-lifecycle/stamp.d.ts +146 -0
- package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
- package/dist/recipe-lifecycle/stamp.js +361 -0
- package/dist/recipe-lifecycle/stamp.js.map +1 -0
- package/dist/recipe-qualify.d.ts +80 -0
- package/dist/recipe-qualify.d.ts.map +1 -0
- package/dist/recipe-qualify.js +352 -0
- package/dist/recipe-qualify.js.map +1 -0
- package/dist/recipe-set-preflight.d.ts +139 -0
- package/dist/recipe-set-preflight.d.ts.map +1 -0
- package/dist/recipe-set-preflight.js +536 -0
- package/dist/recipe-set-preflight.js.map +1 -0
- package/dist/recipe-sources.d.ts +209 -0
- package/dist/recipe-sources.d.ts.map +1 -0
- package/dist/recipe-sources.js +607 -0
- package/dist/recipe-sources.js.map +1 -0
- package/dist/recipes.d.ts +45 -1
- package/dist/recipes.d.ts.map +1 -1
- package/dist/recipes.js +138 -1
- package/dist/recipes.js.map +1 -1
- package/dist/record-overlay/apply.d.ts +45 -0
- package/dist/record-overlay/apply.d.ts.map +1 -0
- package/dist/record-overlay/apply.js +535 -0
- package/dist/record-overlay/apply.js.map +1 -0
- package/dist/record-overlay/canonical.d.ts +22 -0
- package/dist/record-overlay/canonical.d.ts.map +1 -0
- package/dist/record-overlay/canonical.js +47 -0
- package/dist/record-overlay/canonical.js.map +1 -0
- package/dist/record-overlay/digest.d.ts +4 -0
- package/dist/record-overlay/digest.d.ts.map +1 -0
- package/dist/record-overlay/digest.js +11 -0
- package/dist/record-overlay/digest.js.map +1 -0
- package/dist/record-overlay/errors.d.ts +44 -0
- package/dist/record-overlay/errors.d.ts.map +1 -0
- package/dist/record-overlay/errors.js +55 -0
- package/dist/record-overlay/errors.js.map +1 -0
- package/dist/record-overlay/findings.d.ts +5 -0
- package/dist/record-overlay/findings.d.ts.map +1 -0
- package/dist/record-overlay/findings.js +86 -0
- package/dist/record-overlay/findings.js.map +1 -0
- package/dist/record-overlay/index.d.ts +23 -0
- package/dist/record-overlay/index.d.ts.map +1 -0
- package/dist/record-overlay/index.js +21 -0
- package/dist/record-overlay/index.js.map +1 -0
- package/dist/record-overlay/plan.d.ts +12 -0
- package/dist/record-overlay/plan.d.ts.map +1 -0
- package/dist/record-overlay/plan.js +285 -0
- package/dist/record-overlay/plan.js.map +1 -0
- package/dist/record-overlay/policy.d.ts +77 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +238 -0
- package/dist/record-overlay/policy.js.map +1 -0
- package/dist/record-overlay/redact.d.ts +3 -0
- package/dist/record-overlay/redact.d.ts.map +1 -0
- package/dist/record-overlay/redact.js +27 -0
- package/dist/record-overlay/redact.js.map +1 -0
- package/dist/record-overlay/signal-kind.d.ts +30 -0
- package/dist/record-overlay/signal-kind.d.ts.map +1 -0
- package/dist/record-overlay/signal-kind.js +38 -0
- package/dist/record-overlay/signal-kind.js.map +1 -0
- package/dist/record-overlay/signal-text.d.ts +52 -0
- package/dist/record-overlay/signal-text.d.ts.map +1 -0
- package/dist/record-overlay/signal-text.js +126 -0
- package/dist/record-overlay/signal-text.js.map +1 -0
- package/dist/record-overlay/source-index.d.ts +21 -0
- package/dist/record-overlay/source-index.d.ts.map +1 -0
- package/dist/record-overlay/source-index.js +109 -0
- package/dist/record-overlay/source-index.js.map +1 -0
- package/dist/record-overlay/types.d.ts +293 -0
- package/dist/record-overlay/types.d.ts.map +1 -0
- package/dist/record-overlay/types.js +2 -0
- package/dist/record-overlay/types.js.map +1 -0
- package/dist/relationships.d.ts +71 -0
- package/dist/relationships.d.ts.map +1 -0
- package/dist/relationships.js +87 -0
- package/dist/relationships.js.map +1 -0
- package/dist/remote-backend.d.ts +11 -21
- package/dist/remote-backend.d.ts.map +1 -1
- package/dist/remote-backend.js +20 -15
- package/dist/remote-backend.js.map +1 -1
- package/dist/remote-document-codec.d.ts +2 -1
- package/dist/remote-document-codec.d.ts.map +1 -1
- package/dist/remote-document-codec.js +3 -2
- package/dist/remote-document-codec.js.map +1 -1
- package/dist/remote-operations.d.ts +0 -41
- package/dist/remote-operations.d.ts.map +1 -1
- package/dist/remote-operations.js +14 -2
- package/dist/remote-operations.js.map +1 -1
- package/dist/remote-parsers.d.ts +19 -0
- package/dist/remote-parsers.d.ts.map +1 -1
- package/dist/remote-parsers.js.map +1 -1
- package/dist/remote.d.ts +2 -4
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -3
- package/dist/remote.js.map +1 -1
- package/dist/reserved-write.d.ts +9 -0
- package/dist/reserved-write.d.ts.map +1 -0
- package/dist/reserved-write.js +15 -0
- package/dist/reserved-write.js.map +1 -0
- package/dist/search/backend-source.d.ts +6 -0
- package/dist/search/backend-source.d.ts.map +1 -0
- package/dist/search/backend-source.js +57 -0
- package/dist/search/backend-source.js.map +1 -0
- package/dist/search/contract.d.ts +162 -0
- package/dist/search/contract.d.ts.map +1 -0
- package/dist/search/contract.js +82 -0
- package/dist/search/contract.js.map +1 -0
- package/dist/search/errors.d.ts +30 -0
- package/dist/search/errors.d.ts.map +1 -0
- package/dist/search/errors.js +50 -0
- package/dist/search/errors.js.map +1 -0
- package/dist/search/identity.d.ts +12 -0
- package/dist/search/identity.d.ts.map +1 -0
- package/dist/search/identity.js +90 -0
- package/dist/search/identity.js.map +1 -0
- package/dist/search/index.d.ts +16 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +15 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/memory-source.d.ts +36 -0
- package/dist/search/memory-source.d.ts.map +1 -0
- package/dist/search/memory-source.js +238 -0
- package/dist/search/memory-source.js.map +1 -0
- package/dist/search/rank.d.ts +29 -0
- package/dist/search/rank.d.ts.map +1 -0
- package/dist/search/rank.js +132 -0
- package/dist/search/rank.js.map +1 -0
- package/dist/search/row-text.d.ts +38 -0
- package/dist/search/row-text.d.ts.map +1 -0
- package/dist/search/row-text.js +88 -0
- package/dist/search/row-text.js.map +1 -0
- package/dist/search/search.d.ts +28 -0
- package/dist/search/search.d.ts.map +1 -0
- package/dist/search/search.js +265 -0
- package/dist/search/search.js.map +1 -0
- package/dist/search/source.d.ts +70 -0
- package/dist/search/source.d.ts.map +1 -0
- package/dist/search/source.js +2 -0
- package/dist/search/source.js.map +1 -0
- package/dist/search/text.d.ts +49 -0
- package/dist/search/text.d.ts.map +1 -0
- package/dist/search/text.js +165 -0
- package/dist/search/text.js.map +1 -0
- package/dist/search-index.d.ts +9 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +9 -0
- package/dist/search-index.js.map +1 -0
- package/dist/sha256.d.ts.map +1 -1
- package/dist/sha256.js +3 -2
- package/dist/sha256.js.map +1 -1
- package/dist/site-capabilities.d.ts +345 -0
- package/dist/site-capabilities.d.ts.map +1 -0
- package/dist/site-capabilities.js +724 -0
- package/dist/site-capabilities.js.map +1 -0
- package/dist/site-manifest.d.ts +51 -0
- package/dist/site-manifest.d.ts.map +1 -0
- package/dist/site-manifest.js +115 -0
- package/dist/site-manifest.js.map +1 -0
- package/dist/skip-reasons.d.ts +12 -0
- package/dist/skip-reasons.d.ts.map +1 -0
- package/dist/skip-reasons.js +15 -0
- package/dist/skip-reasons.js.map +1 -0
- package/dist/source-engine/driver.d.ts +40 -0
- package/dist/source-engine/driver.d.ts.map +1 -0
- package/dist/source-engine/driver.js +513 -0
- package/dist/source-engine/driver.js.map +1 -0
- package/dist/source-engine/evidence.d.ts +39 -0
- package/dist/source-engine/evidence.d.ts.map +1 -0
- package/dist/source-engine/evidence.js +54 -0
- package/dist/source-engine/evidence.js.map +1 -0
- package/dist/source-engine/guard.d.ts +87 -0
- package/dist/source-engine/guard.d.ts.map +1 -0
- package/dist/source-engine/guard.js +427 -0
- package/dist/source-engine/guard.js.map +1 -0
- package/dist/source-engine/index.d.ts +35 -0
- package/dist/source-engine/index.d.ts.map +1 -0
- package/dist/source-engine/index.js +27 -0
- package/dist/source-engine/index.js.map +1 -0
- package/dist/source-engine/machine-state.d.ts +87 -0
- package/dist/source-engine/machine-state.d.ts.map +1 -0
- package/dist/source-engine/machine-state.js +94 -0
- package/dist/source-engine/machine-state.js.map +1 -0
- package/dist/source-engine/observe.d.ts +10 -0
- package/dist/source-engine/observe.d.ts.map +1 -0
- package/dist/source-engine/observe.js +276 -0
- package/dist/source-engine/observe.js.map +1 -0
- package/dist/source-engine/overlay.d.ts +50 -0
- package/dist/source-engine/overlay.d.ts.map +1 -0
- package/dist/source-engine/overlay.js +114 -0
- package/dist/source-engine/overlay.js.map +1 -0
- package/dist/source-engine/robots.d.ts +53 -0
- package/dist/source-engine/robots.d.ts.map +1 -0
- package/dist/source-engine/robots.js +158 -0
- package/dist/source-engine/robots.js.map +1 -0
- package/dist/source-engine/snapshot.d.ts +105 -0
- package/dist/source-engine/snapshot.d.ts.map +1 -0
- package/dist/source-engine/snapshot.js +240 -0
- package/dist/source-engine/snapshot.js.map +1 -0
- package/dist/source-engine/target-consumer.d.ts +12 -0
- package/dist/source-engine/target-consumer.d.ts.map +1 -0
- package/dist/source-engine/target-consumer.js +15 -0
- package/dist/source-engine/target-consumer.js.map +1 -0
- package/dist/source-engine/target-descriptor.d.ts +3 -0
- package/dist/source-engine/target-descriptor.d.ts.map +1 -0
- package/dist/source-engine/target-descriptor.js +26 -0
- package/dist/source-engine/target-descriptor.js.map +1 -0
- package/dist/source-engine/target.d.ts +82 -0
- package/dist/source-engine/target.d.ts.map +1 -0
- package/dist/source-engine/target.js +213 -0
- package/dist/source-engine/target.js.map +1 -0
- package/dist/source-engine/types.d.ts +296 -0
- package/dist/source-engine/types.d.ts.map +1 -0
- package/dist/source-engine/types.js +2 -0
- package/dist/source-engine/types.js.map +1 -0
- package/dist/source-harness/conformance.d.ts +16 -0
- package/dist/source-harness/conformance.d.ts.map +1 -0
- package/dist/source-harness/conformance.js +266 -0
- package/dist/source-harness/conformance.js.map +1 -0
- package/dist/source-harness/fixture.d.ts +97 -0
- package/dist/source-harness/fixture.d.ts.map +1 -0
- package/dist/source-harness/fixture.js +276 -0
- package/dist/source-harness/fixture.js.map +1 -0
- package/dist/source-harness/index.d.ts +22 -0
- package/dist/source-harness/index.d.ts.map +1 -0
- package/dist/source-harness/index.js +19 -0
- package/dist/source-harness/index.js.map +1 -0
- package/dist/source-harness/peer.d.ts +74 -0
- package/dist/source-harness/peer.d.ts.map +1 -0
- package/dist/source-harness/peer.js +106 -0
- package/dist/source-harness/peer.js.map +1 -0
- package/dist/source-profiles/index.d.ts +31 -0
- package/dist/source-profiles/index.d.ts.map +1 -0
- package/dist/source-profiles/index.js +206 -0
- package/dist/source-profiles/index.js.map +1 -0
- package/dist/source-profiles/link-header.d.ts +6 -0
- package/dist/source-profiles/link-header.d.ts.map +1 -0
- package/dist/source-profiles/link-header.js +131 -0
- package/dist/source-profiles/link-header.js.map +1 -0
- package/dist/storage-harness/contract.d.ts +109 -0
- package/dist/storage-harness/contract.d.ts.map +1 -0
- package/dist/storage-harness/contract.js +853 -0
- package/dist/storage-harness/contract.js.map +1 -0
- package/dist/storage-harness/index.d.ts +39 -0
- package/dist/storage-harness/index.d.ts.map +1 -0
- package/dist/storage-harness/index.js +55 -0
- package/dist/storage-harness/index.js.map +1 -0
- package/dist/storage.d.ts +10 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +10 -2
- package/dist/storage.js.map +1 -1
- package/dist/string-identity-agreement.d.ts +35 -0
- package/dist/string-identity-agreement.d.ts.map +1 -0
- package/dist/string-identity-agreement.js +78 -0
- package/dist/string-identity-agreement.js.map +1 -0
- package/dist/system-documents.d.ts +82 -0
- package/dist/system-documents.d.ts.map +1 -0
- package/dist/system-documents.js +127 -0
- package/dist/system-documents.js.map +1 -0
- package/dist/types.d.ts +28 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +1 -1
- package/dist/uncertain-write.d.ts +119 -6
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +67 -32
- package/dist/uncertain-write.js.map +1 -1
- package/dist/validation.d.ts +5 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/verification.d.ts +22 -10
- package/dist/verification.d.ts.map +1 -1
- package/dist/verification.js +87 -39
- package/dist/verification.js.map +1 -1
- package/dist/view-launch-contract.d.ts +14 -0
- package/dist/view-launch-contract.d.ts.map +1 -0
- package/dist/view-launch-contract.js +23 -0
- package/dist/view-launch-contract.js.map +1 -0
- package/dist/write-identity.d.ts +5 -0
- package/dist/write-identity.d.ts.map +1 -0
- package/dist/write-identity.js +9 -0
- package/dist/write-identity.js.map +1 -0
- package/package.json +184 -10
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link findings: what a document's body links do, and which of them will not register.
|
|
3
|
+
*
|
|
4
|
+
* Core produces each finding once, as a {@link ValidationWarning} with a fixed `message` per code
|
|
5
|
+
* and the facts in `details`; every surface (CLI, MCP, apps) words its own next step from those.
|
|
6
|
+
* The edge rule itself is `links.ts` ({@link resolveConceptId}); this module only reports on it.
|
|
7
|
+
*
|
|
8
|
+
* Codes:
|
|
9
|
+
* - `LINK_NOT_RECOGNIZED`: written like a link to a document but not a graph edge
|
|
10
|
+
* (a `[[wikilink]]`, a target without `.md`, a reserved file, an invalid id).
|
|
11
|
+
* - `LINK_TARGET_ABSENT`: an edge whose target has no document yet (still legal).
|
|
12
|
+
* - `LINK_TYPE_VIOLATION`: an edge whose target does not conform to its exact source Kind's
|
|
13
|
+
* declaration.
|
|
14
|
+
* - `LINK_TYPE_CASE_VARIANT`: an edge whose text differs only in case from a label declared by
|
|
15
|
+
* its exact source Kind.
|
|
16
|
+
*
|
|
17
|
+
* Pure apart from the caller-supplied target reader, so it stays backend- and browser-neutral.
|
|
18
|
+
*/
|
|
19
|
+
import { collectLinkDeclarations, localEdgeQualifiedDeclaration, localEdgeViolation } from "./link-types.js";
|
|
20
|
+
import { extractMarkdownLinkSpans, isExternalHref, maskMarkdownCode, resolveConceptId } from "./links.js";
|
|
21
|
+
import { isReservedFile } from "./paths.js";
|
|
22
|
+
import { isQualifiedHref, parseQualifiedKindTarget } from "./qualified-links.js";
|
|
23
|
+
/** The link-type declarations and the cross-bundle check, for a writer that lints a link it added. */
|
|
24
|
+
export { collectLinkDeclarations, qualifiedEdgeViolation } from "./link-types.js";
|
|
25
|
+
export const LINK_NOT_RECOGNIZED = "LINK_NOT_RECOGNIZED";
|
|
26
|
+
export const LINK_TARGET_ABSENT = "LINK_TARGET_ABSENT";
|
|
27
|
+
export const LINK_TYPE_VIOLATION = "LINK_TYPE_VIOLATION";
|
|
28
|
+
export const LINK_TYPE_CASE_VARIANT = "LINK_TYPE_CASE_VARIANT";
|
|
29
|
+
const NOT_RECOGNIZED_MESSAGES = {
|
|
30
|
+
wikilink: "A [[wikilink]] is plain text, not a link; write a markdown link whose target ends in .md.",
|
|
31
|
+
"missing-md-extension": "This link's target does not end in .md, so it is not a link to a document.",
|
|
32
|
+
"reserved-target": "This link's target is a reserved file (index.md or log.md), which is never a document.",
|
|
33
|
+
"invalid-target": "This link's target is not a valid document id, so it is not a link to a document.",
|
|
34
|
+
};
|
|
35
|
+
const TARGET_ABSENT_MESSAGE = "No document exists at this link's target yet; the link is kept as a forward declaration.";
|
|
36
|
+
const TYPE_VIOLATION_MESSAGE = "This link's text is a declared link type, but its target is not the declared kind.";
|
|
37
|
+
const TYPE_QUALIFIED_MESSAGE = "This link's text is declared as a link into another bundle, but it points inside this bundle.";
|
|
38
|
+
const TYPE_CASE_VARIANT_MESSAGE = "This link's text differs only in case from a declared link type.";
|
|
39
|
+
const WIKILINK = /\[\[([^[\]\n]+)\]\]/g;
|
|
40
|
+
const ANY_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
41
|
+
function docType(doc) {
|
|
42
|
+
return typeof doc?.frontmatter.type === "string" ? doc.frontmatter.type : "";
|
|
43
|
+
}
|
|
44
|
+
/** The path part of an href: anchor and query dropped, trimmed. */
|
|
45
|
+
function hrefPath(href) {
|
|
46
|
+
return (href.split("#")[0] ?? "").split("?")[0]?.trim() ?? "";
|
|
47
|
+
}
|
|
48
|
+
/** Characters a markdown link target cannot carry unescaped, so a suggestion with one would not register either. */
|
|
49
|
+
const UNREGISTRABLE = /[\s()<>[\]]/;
|
|
50
|
+
/** Return the suggestion only if it would actually register a document link. */
|
|
51
|
+
function suggestion(fromId, href) {
|
|
52
|
+
if (UNREGISTRABLE.test(href))
|
|
53
|
+
return {};
|
|
54
|
+
const suggestedTo = resolveConceptId(fromId, href);
|
|
55
|
+
return suggestedTo === null ? {} : { suggestedHref: href, suggestedTo };
|
|
56
|
+
}
|
|
57
|
+
/** True for a relative target written without `/`, `./` or `../`. */
|
|
58
|
+
function isBareRelative(path) {
|
|
59
|
+
return !path.startsWith("/") && !path.startsWith("./") && !path.startsWith("../");
|
|
60
|
+
}
|
|
61
|
+
function notRecognized(reason, fields) {
|
|
62
|
+
return {
|
|
63
|
+
code: LINK_NOT_RECOGNIZED,
|
|
64
|
+
message: NOT_RECOGNIZED_MESSAGES[reason],
|
|
65
|
+
field: "body",
|
|
66
|
+
severity: "warning",
|
|
67
|
+
details: { reason, ...fields },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Why a markdown link that {@link resolveConceptId} drops still looks meant for a document, if it does. */
|
|
71
|
+
function classifyUnresolved(fromId, text, href, at) {
|
|
72
|
+
if (isQualifiedHref(href))
|
|
73
|
+
return undefined; // cross-bundle links have their own grammar and lint
|
|
74
|
+
const path = hrefPath(href);
|
|
75
|
+
if (path === "" || isExternalHref(path) || ANY_SCHEME.test(path))
|
|
76
|
+
return undefined;
|
|
77
|
+
if (path.endsWith(".md")) {
|
|
78
|
+
const resolved = path.startsWith("/") ? path.slice(1) : path;
|
|
79
|
+
return notRecognized(isReservedFile(resolved.replace(/^(\.\.?\/)+/, "")) ? "reserved-target" : "invalid-target", { text, href, ...at });
|
|
80
|
+
}
|
|
81
|
+
const last = path.slice(path.lastIndexOf("/") + 1);
|
|
82
|
+
// A last segment with its own extension is an asset link (a PDF, an image), not a near miss.
|
|
83
|
+
if (last === "" || last.includes("."))
|
|
84
|
+
return undefined;
|
|
85
|
+
return notRecognized("missing-md-extension", { text, href, ...at, ...suggestion(fromId, `${path}.md`) });
|
|
86
|
+
}
|
|
87
|
+
function wikilinkFindings(doc) {
|
|
88
|
+
const masked = maskMarkdownCode(doc.body);
|
|
89
|
+
const out = [];
|
|
90
|
+
for (const match of masked.matchAll(WIKILINK)) {
|
|
91
|
+
const start = match.index;
|
|
92
|
+
const end = start + match[0].length;
|
|
93
|
+
const inner = doc.body.slice(start + 2, end - 2);
|
|
94
|
+
const bar = inner.indexOf("|");
|
|
95
|
+
const target = (bar >= 0 ? inner.slice(0, bar) : inner).trim();
|
|
96
|
+
const text = (bar >= 0 ? inner.slice(bar + 1) : inner).trim();
|
|
97
|
+
const path = hrefPath(target).replace(/^\/+/, "");
|
|
98
|
+
out.push(notRecognized("wikilink", {
|
|
99
|
+
text,
|
|
100
|
+
href: target,
|
|
101
|
+
start,
|
|
102
|
+
end,
|
|
103
|
+
...(path === "" ? {} : suggestion(doc.id, `/${path.endsWith(".md") ? path : `${path}.md`}`)),
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A document's registered edges plus the link-shaped text that will not register
|
|
110
|
+
* (`LINK_NOT_RECOGNIZED`), in body order. Pure; reads nothing. Edges are exactly the graph's,
|
|
111
|
+
* including any written inside code; link-shaped text inside code is never reported, since
|
|
112
|
+
* there it is an example rather than an attempt to link.
|
|
113
|
+
*/
|
|
114
|
+
export function inspectDocumentLinks(doc) {
|
|
115
|
+
const links = [];
|
|
116
|
+
const findings = [];
|
|
117
|
+
const outsideCode = new Set(extractMarkdownLinkSpans(doc.body, { skipCode: true }).map((span) => span.start));
|
|
118
|
+
for (const span of extractMarkdownLinkSpans(doc.body)) {
|
|
119
|
+
if (span.image)
|
|
120
|
+
continue;
|
|
121
|
+
const to = resolveConceptId(doc.id, span.href);
|
|
122
|
+
if (to !== null) {
|
|
123
|
+
links.push({ from: doc.id, to, text: span.text, href: span.href });
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (!outsideCode.has(span.start))
|
|
127
|
+
continue;
|
|
128
|
+
const finding = classifyUnresolved(doc.id, span.text, span.href, { start: span.start, end: span.end });
|
|
129
|
+
if (finding)
|
|
130
|
+
findings.push(finding);
|
|
131
|
+
}
|
|
132
|
+
findings.push(...wikilinkFindings(doc));
|
|
133
|
+
findings.sort((a, b) => (a.details.start ?? 0) - (b.details.start ?? 0));
|
|
134
|
+
return { links, findings };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The finding for an edge whose target has no document, or undefined when it has one. The link
|
|
138
|
+
* itself stays legal: dangling links are forward declarations.
|
|
139
|
+
*/
|
|
140
|
+
export async function linkTargetAbsentFinding(link, readTarget) {
|
|
141
|
+
if ((await readTarget(link.to)) !== undefined)
|
|
142
|
+
return undefined;
|
|
143
|
+
return { code: LINK_TARGET_ABSENT, message: TARGET_ABSENT_MESSAGE, field: "body", severity: "warning", details: { ...link } };
|
|
144
|
+
}
|
|
145
|
+
async function typeFinding(declarations, link, readTarget) {
|
|
146
|
+
if (declarations.size === 0)
|
|
147
|
+
return undefined;
|
|
148
|
+
const { sourceType, ...where } = link;
|
|
149
|
+
const exact = declarations.get(link.text);
|
|
150
|
+
if (exact?.some(d => d.governs === sourceType)) {
|
|
151
|
+
// Only an exact match needs the target's actual type; a near miss never pays for the read.
|
|
152
|
+
const target = await readTarget(link.to);
|
|
153
|
+
const targetType = target === undefined ? null : docType(target);
|
|
154
|
+
const qualified = localEdgeQualifiedDeclaration(exact, sourceType);
|
|
155
|
+
if (qualified) {
|
|
156
|
+
return {
|
|
157
|
+
code: LINK_TYPE_VIOLATION,
|
|
158
|
+
message: TYPE_QUALIFIED_MESSAGE,
|
|
159
|
+
field: "body",
|
|
160
|
+
severity: "warning",
|
|
161
|
+
details: {
|
|
162
|
+
...where,
|
|
163
|
+
declaredBy: qualified.governs,
|
|
164
|
+
declaredTarget: qualified.target,
|
|
165
|
+
sourceType,
|
|
166
|
+
targetType,
|
|
167
|
+
targetAlias: parseQualifiedKindTarget(qualified.target).alias,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const violated = localEdgeViolation(exact, sourceType, targetType ?? undefined);
|
|
172
|
+
if (!violated)
|
|
173
|
+
return undefined;
|
|
174
|
+
return {
|
|
175
|
+
code: LINK_TYPE_VIOLATION,
|
|
176
|
+
message: TYPE_VIOLATION_MESSAGE,
|
|
177
|
+
field: "body",
|
|
178
|
+
severity: "warning",
|
|
179
|
+
details: { ...where, declaredBy: violated.governs, declaredTarget: violated.target, sourceType, targetType },
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const lower = link.text.toLowerCase();
|
|
183
|
+
for (const [declaredText, declared] of declarations) {
|
|
184
|
+
if (declaredText.toLowerCase() === lower && declared.some(d => d.governs === sourceType)) {
|
|
185
|
+
return {
|
|
186
|
+
code: LINK_TYPE_CASE_VARIANT,
|
|
187
|
+
message: TYPE_CASE_VARIANT_MESSAGE,
|
|
188
|
+
field: "body",
|
|
189
|
+
severity: "warning",
|
|
190
|
+
details: { ...where, declaredText },
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Type-conformance finding for one local edge. When `text` exactly matches a link type declared by
|
|
198
|
+
* the source's exact Kind, the target's actual Kind is checked (`LINK_TYPE_VIOLATION`; a
|
|
199
|
+
* missing target remains unchecked). When `text` matches a declared type only
|
|
200
|
+
* case-insensitively within that source Kind, `LINK_TYPE_CASE_VARIANT` names the declared spelling. Untyped text, or a
|
|
201
|
+
* registry with no `links` declarations, yields undefined without reading anything.
|
|
202
|
+
*/
|
|
203
|
+
export function linkTypeFinding(registry, link, readTarget) {
|
|
204
|
+
return typeFinding(collectLinkDeclarations(registry), link, readTarget);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Everything {@link inspectDocumentLinks} reports, plus, per registered edge: an absent target
|
|
208
|
+
* (with a root-absolute suggestion for a bare relative href) and, when `registry` is given, link
|
|
209
|
+
* type conformance. Each distinct target is read at most once. A missing-`.md` suggestion is
|
|
210
|
+
* re-pointed at the bundle-root reading when only that one names an existing document.
|
|
211
|
+
*/
|
|
212
|
+
export async function documentLinkReport(doc, opts) {
|
|
213
|
+
const { links, findings } = inspectDocumentLinks(doc);
|
|
214
|
+
const cache = new Map();
|
|
215
|
+
const read = (id) => {
|
|
216
|
+
let pending = cache.get(id);
|
|
217
|
+
if (!pending) {
|
|
218
|
+
pending = opts.readTarget(id);
|
|
219
|
+
cache.set(id, pending);
|
|
220
|
+
}
|
|
221
|
+
return pending;
|
|
222
|
+
};
|
|
223
|
+
const exists = async (id) => (await read(id)) !== undefined;
|
|
224
|
+
const rootReading = (path) => (isBareRelative(path) ? resolveConceptId(doc.id, `/${path}`) : null);
|
|
225
|
+
for (const finding of findings) {
|
|
226
|
+
if (finding.code !== LINK_NOT_RECOGNIZED || finding.details.reason !== "missing-md-extension")
|
|
227
|
+
continue;
|
|
228
|
+
const relative = finding.details.suggestedTo;
|
|
229
|
+
if (relative !== undefined && (await exists(relative)))
|
|
230
|
+
continue;
|
|
231
|
+
const path = `${hrefPath(finding.details.href)}.md`;
|
|
232
|
+
const root = rootReading(path);
|
|
233
|
+
if (root !== null && root !== relative && !UNREGISTRABLE.test(path) && (await exists(root))) {
|
|
234
|
+
finding.details.suggestedHref = `/${path}`;
|
|
235
|
+
finding.details.suggestedTo = root;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const declarations = opts.registry ? collectLinkDeclarations(opts.registry) : new Map();
|
|
239
|
+
const sourceType = docType(doc);
|
|
240
|
+
const spans = extractMarkdownLinkSpans(doc.body).filter((span) => !span.image && resolveConceptId(doc.id, span.href) !== null);
|
|
241
|
+
for (const [index, link] of links.entries()) {
|
|
242
|
+
if (isQualifiedHref(link.href))
|
|
243
|
+
continue; // a malformed okf: href is a cross-bundle finding, not a local edge
|
|
244
|
+
const span = spans[index];
|
|
245
|
+
const where = { start: span.start, end: span.end };
|
|
246
|
+
const absent = await linkTargetAbsentFinding({ to: link.to, href: link.href, text: link.text, ...where }, read);
|
|
247
|
+
if (absent) {
|
|
248
|
+
const path = hrefPath(link.href);
|
|
249
|
+
const root = rootReading(path);
|
|
250
|
+
if (root !== null && root !== link.to && (await exists(root))) {
|
|
251
|
+
absent.details.suggestedHref = `/${path}`;
|
|
252
|
+
absent.details.suggestedTo = root;
|
|
253
|
+
}
|
|
254
|
+
findings.push(absent);
|
|
255
|
+
}
|
|
256
|
+
const typed = await typeFinding(declarations, { sourceType, text: link.text, to: link.to, ...where }, read);
|
|
257
|
+
if (typed)
|
|
258
|
+
findings.push(typed);
|
|
259
|
+
}
|
|
260
|
+
findings.sort((a, b) => (a.details.start ?? 0) - (b.details.start ?? 0));
|
|
261
|
+
return { links, findings };
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=link-findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-findings.js","sourceRoot":"","sources":["../src/link-findings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,kBAAkB,EAA4B,MAAM,iBAAiB,CAAC;AACvI,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAKjF,sGAAsG;AACtG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AA+F/D,MAAM,uBAAuB,GAA4C;IACvE,QAAQ,EAAE,2FAA2F;IACrG,sBAAsB,EAAE,4EAA4E;IACpG,iBAAiB,EAAE,wFAAwF;IAC3G,gBAAgB,EAAE,mFAAmF;CACtG,CA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D,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5G,IAAI,KAAK;YAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { KindRegistry } from "./kinds.js";
|
|
2
|
+
/** One kind's declared `links` entry for a given link-type text: the declaring kind + its required target kind. */
|
|
3
|
+
export interface LinkTypeDeclaration {
|
|
4
|
+
governs: string;
|
|
5
|
+
target: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Flatten every declared kind's `links` map into `link-type text -> declaring kind(s)`, across the
|
|
9
|
+
* WHOLE registry (a bundle may reuse a link-type name for more than one kind — e.g. both a Roadmap
|
|
10
|
+
* Item and an Epic declaring `contains: Task`). Pure derivation over an already-loaded registry, no
|
|
11
|
+
* I/O.
|
|
12
|
+
*/
|
|
13
|
+
export declare function collectLinkDeclarations(registry: KindRegistry): Map<string, LinkTypeDeclaration[]>;
|
|
14
|
+
/**
|
|
15
|
+
* A LOCAL edge under a qualified declaration (`links: {pours: "beers:Beer"}` and a link to a doc in
|
|
16
|
+
* this bundle): the declaration it violates, else null. Qualified targets are parsed here, at use;
|
|
17
|
+
* `KindConvention.links` stays raw strings.
|
|
18
|
+
*/
|
|
19
|
+
export declare function localEdgeQualifiedDeclaration(declared: readonly LinkTypeDeclaration[] | undefined, sourceType: string): LinkTypeDeclaration | null;
|
|
20
|
+
/**
|
|
21
|
+
* A LOCAL edge whose source Kind declares its text: the declaration it violates when the
|
|
22
|
+
* resolved target is another kind, else null. `targetType` undefined means the target has no
|
|
23
|
+
* document, so no target check applies; an empty string is an untyped target. The caller
|
|
24
|
+
* checks {@link localEdgeQualifiedDeclaration} first; this compares kinds only.
|
|
25
|
+
*/
|
|
26
|
+
export declare function localEdgeViolation(declared: readonly LinkTypeDeclaration[] | undefined, sourceType: string, targetType: string | undefined): LinkTypeDeclaration | null;
|
|
27
|
+
/**
|
|
28
|
+
* A qualified edge (`okf://<alias>/...`) whose source Kind declares its text: the declaration it violates
|
|
29
|
+
* when the target is local or names another alias, else null. The target's
|
|
30
|
+
* kind is checked only when the caller supplies the type of an admitted resolved document.
|
|
31
|
+
* Omitting actualTargetType preserves metadata-only lint; an empty type is a known mismatch.
|
|
32
|
+
*/
|
|
33
|
+
export declare function qualifiedEdgeViolation(declared: readonly LinkTypeDeclaration[] | undefined, sourceType: string, alias: string, actualTargetType?: string): LinkTypeDeclaration | null;
|
|
34
|
+
//# sourceMappingURL=link-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-types.d.ts","sourceRoot":"","sources":["../src/link-types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,mHAAmH;AACnH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAWlG;AAUD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACpD,UAAU,EAAE,MAAM,GACjB,mBAAmB,GAAG,IAAI,CAK5B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACpD,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,mBAAmB,GAAG,IAAI,CAM5B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACpD,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,gBAAgB,CAAC,EAAE,MAAM,GACxB,mBAAmB,GAAG,IAAI,CAQ5B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Shared typed-edge vocabulary derivation: flattens a loaded `KindRegistry`'s per-kind `links`
|
|
2
|
+
// declarations into one `link-type text -> declaring kind(s)` index. Consumed by link findings
|
|
3
|
+
// (`link-findings.ts`, the write-time lint every surface renders) and `status` (bundle-wide
|
|
4
|
+
// `link_type_violations` sweep),
|
|
5
|
+
// and by recipe evolution's link-type addition check, so every consumer shares ONE derivation
|
|
6
|
+
// instead of each carrying its own copy (one registry, no parallel logic).
|
|
7
|
+
import { parseQualifiedKindTarget } from "./qualified-links.js";
|
|
8
|
+
/**
|
|
9
|
+
* Flatten every declared kind's `links` map into `link-type text -> declaring kind(s)`, across the
|
|
10
|
+
* WHOLE registry (a bundle may reuse a link-type name for more than one kind — e.g. both a Roadmap
|
|
11
|
+
* Item and an Epic declaring `contains: Task`). Pure derivation over an already-loaded registry, no
|
|
12
|
+
* I/O.
|
|
13
|
+
*/
|
|
14
|
+
export function collectLinkDeclarations(registry) {
|
|
15
|
+
const byText = new Map();
|
|
16
|
+
for (const kind of registry.kinds.values()) {
|
|
17
|
+
if (!kind.links)
|
|
18
|
+
continue;
|
|
19
|
+
for (const [text, target] of Object.entries(kind.links)) {
|
|
20
|
+
const list = byText.get(text) ?? [];
|
|
21
|
+
list.push({ governs: kind.governs, target });
|
|
22
|
+
byText.set(text, list);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return byText;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The declaration a typed edge from `sourceType` is checked against: the one its source kind
|
|
29
|
+
* declares, or none. A label declared by another source Kind imposes no constraint.
|
|
30
|
+
*/
|
|
31
|
+
function declarationFor(declared, sourceType) {
|
|
32
|
+
return declared.find((d) => d.governs === sourceType);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A LOCAL edge under a qualified declaration (`links: {pours: "beers:Beer"}` and a link to a doc in
|
|
36
|
+
* this bundle): the declaration it violates, else null. Qualified targets are parsed here, at use;
|
|
37
|
+
* `KindConvention.links` stays raw strings.
|
|
38
|
+
*/
|
|
39
|
+
export function localEdgeQualifiedDeclaration(declared, sourceType) {
|
|
40
|
+
if (!declared || declared.length === 0)
|
|
41
|
+
return null;
|
|
42
|
+
const matched = declarationFor(declared, sourceType);
|
|
43
|
+
if (!matched)
|
|
44
|
+
return null;
|
|
45
|
+
return parseQualifiedKindTarget(matched.target) === null ? null : matched;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A LOCAL edge whose source Kind declares its text: the declaration it violates when the
|
|
49
|
+
* resolved target is another kind, else null. `targetType` undefined means the target has no
|
|
50
|
+
* document, so no target check applies; an empty string is an untyped target. The caller
|
|
51
|
+
* checks {@link localEdgeQualifiedDeclaration} first; this compares kinds only.
|
|
52
|
+
*/
|
|
53
|
+
export function localEdgeViolation(declared, sourceType, targetType) {
|
|
54
|
+
if (!declared || declared.length === 0)
|
|
55
|
+
return null;
|
|
56
|
+
const matched = declarationFor(declared, sourceType);
|
|
57
|
+
if (!matched)
|
|
58
|
+
return null;
|
|
59
|
+
const targetOk = targetType === undefined || targetType === matched.target;
|
|
60
|
+
return targetOk ? null : matched;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A qualified edge (`okf://<alias>/...`) whose source Kind declares its text: the declaration it violates
|
|
64
|
+
* when the target is local or names another alias, else null. The target's
|
|
65
|
+
* kind is checked only when the caller supplies the type of an admitted resolved document.
|
|
66
|
+
* Omitting actualTargetType preserves metadata-only lint; an empty type is a known mismatch.
|
|
67
|
+
*/
|
|
68
|
+
export function qualifiedEdgeViolation(declared, sourceType, alias, actualTargetType) {
|
|
69
|
+
if (!declared || declared.length === 0)
|
|
70
|
+
return null;
|
|
71
|
+
const matched = declarationFor(declared, sourceType);
|
|
72
|
+
if (!matched)
|
|
73
|
+
return null;
|
|
74
|
+
const target = parseQualifiedKindTarget(matched.target);
|
|
75
|
+
const targetOk = target !== null && target.alias === alias &&
|
|
76
|
+
(actualTargetType === undefined || actualTargetType === target.kind);
|
|
77
|
+
return targetOk ? null : matched;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=link-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-types.js","sourceRoot":"","sources":["../src/link-types.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,+FAA+F;AAC/F,4FAA4F;AAC5F,iCAAiC;AACjC,8FAA8F;AAC9F,2EAA2E;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAShE;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAsB;IAC5D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAiC,CAAC;IACxD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,SAAS;QAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG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C,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAoD,EACpD,UAAkB,EAClB,KAAa,EACb,gBAAyB;IAEzB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,MAAM,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK;QACxD,CAAC,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;IACvE,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AACnC,CAAC"}
|
package/dist/links.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - absolute bundle-relative: `/tables/users.md` (spec-recommended, move-stable)
|
|
10
10
|
* - relative: `./x.md`, `../refs/m.md`
|
|
11
11
|
* External (`scheme://…`, `mailto:`), in-page (`#…`) and non-`.md` targets are
|
|
12
|
-
* ignored
|
|
12
|
+
* ignored. Paths that leave the bundle do not name concept edges. A link to a nonexistent target is
|
|
13
13
|
* still returned (broken links are valid, §5). A link whose resolved target's
|
|
14
14
|
* FINAL SEGMENT is a reserved OKF filename (`index.md`/`log.md`, at any directory
|
|
15
15
|
* level per §3.1) is likewise dropped: reserved files are never concept documents
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
* These functions are pure and dependency-free — INCLUDING free of `node:path`:
|
|
23
23
|
* this module is the ONE link resolver and it now also runs in
|
|
24
24
|
* the BROWSER (the shell's doc reader routes links through it), where `node:path`
|
|
25
|
-
* does not bundle.
|
|
25
|
+
* does not bundle. POSIX normalization and relative path logic use pure
|
|
26
26
|
* string helpers below, parity-pinned against `node:path.posix` by
|
|
27
27
|
* `links-path-parity.test.ts` and against browser bundling by `browser-bundle.test.ts` (the
|
|
28
28
|
* isomorphic-boundary gate over every browser-consumed core subpath).
|
|
29
29
|
*/
|
|
30
30
|
import type { ConceptId, Link, OkfDocument } from "./types.js";
|
|
31
|
-
/** Normalize
|
|
31
|
+
/** Normalize POSIX segments without clamping traversal at the root. */
|
|
32
32
|
export declare function normalizeSegments(segments: string[]): string[];
|
|
33
33
|
/** A raw markdown link as written in the body, before resolution. */
|
|
34
34
|
export interface RawLink {
|
|
@@ -37,14 +37,69 @@ export interface RawLink {
|
|
|
37
37
|
}
|
|
38
38
|
/** True for links that never become concept edges (external / mail / in-page anchors). */
|
|
39
39
|
export declare function isExternalHref(href: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
export
|
|
40
|
+
/** One markdown link or image as written in a body, with the offsets of its parts in that body. */
|
|
41
|
+
export interface MarkdownLinkSpan {
|
|
42
|
+
text: string;
|
|
43
|
+
href: string;
|
|
44
|
+
/** Offset of the opening `[` (of the `!` for an image). */
|
|
45
|
+
start: number;
|
|
46
|
+
/** Offset just past the closing `)`. */
|
|
47
|
+
end: number;
|
|
48
|
+
/** Offset of the href's first character. */
|
|
49
|
+
hrefStart: number;
|
|
50
|
+
/** Offset just past the href's last character. */
|
|
51
|
+
hrefEnd: number;
|
|
52
|
+
/** True for ``. */
|
|
53
|
+
image: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Extract every non-image markdown link from a body, in document order. With `skipCode`, a link
|
|
57
|
+
* written inside an inline code span or a fenced or indented code block ({@link maskMarkdownCode})
|
|
58
|
+
* is not a link; the returned text and href are still sliced from the original body. This is
|
|
59
|
+
* {@link extractMarkdownLinkSpans} without images, so the link graph and a span-driven body
|
|
60
|
+
* rewrite always agree about what a link is.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractMarkdownLinks(source: string, options?: {
|
|
63
|
+
skipCode?: boolean;
|
|
64
|
+
}): RawLink[];
|
|
42
65
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
66
|
+
* Replace hrefs by offset. `replace` returns the new href for a span, or undefined to keep it.
|
|
67
|
+
* Spans are applied from the end of the body backwards, so earlier offsets stay valid; link text
|
|
68
|
+
* and everything outside the hrefs never changes. A span that overlaps another or does not match
|
|
69
|
+
* the body is refused.
|
|
70
|
+
*/
|
|
71
|
+
export declare function rewriteMarkdownLinks(body: string, spans: readonly MarkdownLinkSpan[], replace: (span: MarkdownLinkSpan) => string | undefined): string;
|
|
72
|
+
/**
|
|
73
|
+
* Extract every markdown link AND image from a body, in document order, with offsets: the one
|
|
74
|
+
* link scanner. With `skipCode`, a link inside code is not a link (see {@link extractMarkdownLinks}).
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractMarkdownLinkSpans(source: string, options?: {
|
|
77
|
+
skipCode?: boolean;
|
|
78
|
+
}): MarkdownLinkSpan[];
|
|
79
|
+
/**
|
|
80
|
+
* Blank out (with spaces, keeping every newline and the string's length) the CommonMark code a
|
|
81
|
+
* reader sees as code: fenced blocks (``` and ~~~, fence lines included), indented blocks, and
|
|
82
|
+
* inline code spans with their backticks. Offsets into the result are offsets into `body`.
|
|
83
|
+
*
|
|
84
|
+
* Linear time and line-based. Block quote markers and list-item content indentation are honored
|
|
85
|
+
* so an indented continuation paragraph in a list stays prose, and a fence ends with the block
|
|
86
|
+
* quote or list item that holds it. HTML blocks (`<pre>`) are not modelled. An unclosed fence runs to the end of the body, and an unmatched
|
|
87
|
+
* backtick run is literal text, as in CommonMark.
|
|
46
88
|
*/
|
|
47
|
-
|
|
89
|
+
/** @internal Exported for the qualified-link parser and its tests; not a stable API. */
|
|
90
|
+
export declare function maskMarkdownCode(body: string): string;
|
|
91
|
+
/** Encode one path component for a Markdown href. */
|
|
92
|
+
export declare function encodeMarkdownPathSegment(segment: string): string;
|
|
93
|
+
type ConceptLinkTarget = {
|
|
94
|
+
kind: "concept";
|
|
95
|
+
id: ConceptId;
|
|
96
|
+
} | {
|
|
97
|
+
kind: "outside_bundle" | "not_concept";
|
|
98
|
+
};
|
|
99
|
+
/** Classify a Markdown href relative to its containing document or the explicit bundle root. */
|
|
100
|
+
export declare function classifyConceptLink(fromId: ConceptId, href: string, okfVersion?: string): ConceptLinkTarget;
|
|
101
|
+
/** Resolve an internal Markdown concept href, or return null for any non-concept link. */
|
|
102
|
+
export declare function resolveConceptId(fromId: ConceptId, href: string, okfVersion?: string): ConceptId | null;
|
|
48
103
|
/**
|
|
49
104
|
* Build a bundle-RELATIVE markdown href from `fromId` to a target concept id (or
|
|
50
105
|
* pass an external URL through unchanged). This is the emit-side counterpart of
|
|
@@ -59,4 +114,8 @@ export declare function relativeHref(fromId: ConceptId, target: string): string;
|
|
|
59
114
|
* anchors, non-`.md`) are dropped; broken (unresolved-target) links are kept.
|
|
60
115
|
*/
|
|
61
116
|
export declare function parseLinksFromDoc(doc: OkfDocument): Link[];
|
|
117
|
+
export declare function resolveDocumentLinks(from: ConceptId, rawLinks: readonly RawLink[], okfVersion?: string): Link[];
|
|
118
|
+
/** OKF 0.3 path-field targets. The graph projection checks which targets are concepts. */
|
|
119
|
+
export declare function parsePathFieldLinks(doc: OkfDocument): Link[];
|
|
120
|
+
export {};
|
|
62
121
|
//# sourceMappingURL=links.d.ts.map
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,SAAS,E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