okf-core 1.1.0 → 2.0.0
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/dist/graph.d.ts +11 -0
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +19 -6
- package/dist/graph.js.map +1 -1
- package/package.json +1 -1
package/dist/graph.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import type { AnalyzedDocument, BundleGraph } from "okf-contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Project a bundle onto its graph.
|
|
4
|
+
*
|
|
5
|
+
* Indexes are included. They carry no frontmatter, so they have nothing to say about their own
|
|
6
|
+
* type or trust, but their links are authored: somebody wrote each entry, grouped it under a
|
|
7
|
+
* heading, and described it. Dropping them dropped the spine of a bundle and drew the rest as
|
|
8
|
+
* unrelated islands — a picture that asserts the opposite of what the bundle says.
|
|
9
|
+
*
|
|
10
|
+
* Logs stay out. A log is a dated history of changes to a scope, so its links point at what
|
|
11
|
+
* happened rather than at what relates to what.
|
|
12
|
+
*/
|
|
2
13
|
export declare function buildGraph(documents: readonly AnalyzedDocument[]): BundleGraph;
|
|
3
14
|
//# sourceMappingURL=graph.d.ts.map
|
package/dist/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EAGZ,MAAM,eAAe,CAAC;AAIvB,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EAGZ,MAAM,eAAe,CAAC;AAIvB;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,GAAG,WAAW,CA8C9E"}
|
package/dist/graph.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { byCodePoint } from "./paths.js";
|
|
2
|
+
/**
|
|
3
|
+
* Project a bundle onto its graph.
|
|
4
|
+
*
|
|
5
|
+
* Indexes are included. They carry no frontmatter, so they have nothing to say about their own
|
|
6
|
+
* type or trust, but their links are authored: somebody wrote each entry, grouped it under a
|
|
7
|
+
* heading, and described it. Dropping them dropped the spine of a bundle and drew the rest as
|
|
8
|
+
* unrelated islands — a picture that asserts the opposite of what the bundle says.
|
|
9
|
+
*
|
|
10
|
+
* Logs stay out. A log is a dated history of changes to a scope, so its links point at what
|
|
11
|
+
* happened rather than at what relates to what.
|
|
12
|
+
*/
|
|
2
13
|
export function buildGraph(documents) {
|
|
3
|
-
const
|
|
4
|
-
.filter((document) => document.kind === "concept")
|
|
14
|
+
const linked = documents
|
|
15
|
+
.filter((document) => document.kind === "concept" || document.kind === "index")
|
|
5
16
|
.sort((left, right) => byCodePoint(left.path, right.path));
|
|
6
|
-
const known = new Set(
|
|
7
|
-
const nodes =
|
|
17
|
+
const known = new Set(linked.map((document) => document.path));
|
|
18
|
+
const nodes = linked.map((document) => ({
|
|
8
19
|
id: document.path,
|
|
9
20
|
path: document.path,
|
|
10
21
|
title: document.derived.title,
|
|
11
|
-
type
|
|
22
|
+
// An index declares no type. Naming it one keeps the vocabulary honest and lets a reader
|
|
23
|
+
// tell a table of contents from a claim.
|
|
24
|
+
type: document.derived.type ?? (document.kind === "index" ? "Index" : "Concept"),
|
|
12
25
|
description: document.derived.description,
|
|
13
26
|
status: document.derived.status,
|
|
14
27
|
trustTier: document.derived.trustTier,
|
|
@@ -16,7 +29,7 @@ export function buildGraph(documents) {
|
|
|
16
29
|
tags: document.derived.tags,
|
|
17
30
|
}));
|
|
18
31
|
const relations = new Map();
|
|
19
|
-
for (const document of
|
|
32
|
+
for (const document of linked) {
|
|
20
33
|
for (const link of document.links) {
|
|
21
34
|
if (link.kind !== "internal" || link.resolvedPath === null || !known.has(link.resolvedPath)) {
|
|
22
35
|
continue;
|
package/dist/graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,UAAU,CAAC,SAAsC;IAC/D,MAAM,
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,SAAsC;IAC/D,MAAM,MAAM,GAAG,SAAS;SACrB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;SAC9E,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAsB,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACzD,EAAE,EAAE,QAAQ,CAAC,IAAI;QACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK;QAC7B,yFAAyF;QACzF,yCAAyC;QACzC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC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