patram 0.3.0 → 0.5.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.
@@ -8,6 +8,7 @@
8
8
  import { readFile } from 'node:fs/promises';
9
9
  import { posix, relative, resolve } from 'node:path';
10
10
 
11
+ import { resolveDocumentNodeId } from './build-graph-identity.js';
11
12
  import { parseSourceFile } from './parse-claims.js';
12
13
 
13
14
  /**
@@ -92,6 +93,7 @@ export async function loadShowOutput(
92
93
  source_file_path,
93
94
  source_text,
94
95
  parse_result.claims,
96
+ graph.document_node_ids,
95
97
  graph.nodes,
96
98
  ),
97
99
  };
@@ -101,10 +103,17 @@ export async function loadShowOutput(
101
103
  * @param {string} source_file_path
102
104
  * @param {string} source_text
103
105
  * @param {PatramClaim[]} claims
106
+ * @param {import('./build-graph.types.ts').BuildGraphResult['document_node_ids']} document_node_ids
104
107
  * @param {Record<string, GraphNode>} graph_nodes
105
108
  * @returns {{ path: string, rendered_source: string, resolved_links: Array<{ label: string, reference: number, target: { kind?: string, path: string, status?: string, title: string } }>, source: string }}
106
109
  */
107
- function createShowOutput(source_file_path, source_text, claims, graph_nodes) {
110
+ function createShowOutput(
111
+ source_file_path,
112
+ source_text,
113
+ claims,
114
+ document_node_ids,
115
+ graph_nodes,
116
+ ) {
108
117
  const link_claims = claims.filter(isResolvedLinkClaim);
109
118
  const rendered_link_claims = link_claims.filter(isMarkdownLinkClaim);
110
119
  const resolved_links = link_claims.map((claim, claim_index) =>
@@ -112,6 +121,7 @@ function createShowOutput(source_file_path, source_text, claims, graph_nodes) {
112
121
  source_file_path,
113
122
  claim,
114
123
  claim_index + 1,
124
+ document_node_ids,
115
125
  graph_nodes,
116
126
  ),
117
127
  );
@@ -197,6 +207,7 @@ function renderResolvedSourceLine(
197
207
  * @param {string} source_file_path
198
208
  * @param {PatramClaim} claim
199
209
  * @param {number} reference
210
+ * @param {import('./build-graph.types.ts').BuildGraphResult['document_node_ids']} document_node_ids
200
211
  * @param {Record<string, GraphNode>} graph_nodes
201
212
  * @returns {{ label: string, reference: number, target: { kind?: string, path: string, status?: string, title: string } }}
202
213
  */
@@ -204,6 +215,7 @@ function createResolvedLinkSummary(
204
215
  source_file_path,
205
216
  claim,
206
217
  reference,
218
+ document_node_ids,
207
219
  graph_nodes,
208
220
  ) {
209
221
  const claim_value = getLinkClaimValue(claim);
@@ -211,7 +223,8 @@ function createResolvedLinkSummary(
211
223
  source_file_path,
212
224
  claim_value.target,
213
225
  );
214
- const target_node = graph_nodes[`doc:${target_path}`];
226
+ const target_node =
227
+ graph_nodes[resolveDocumentNodeId(document_node_ids, target_path)];
215
228
 
216
229
  return {
217
230
  label: claim_value.text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patram",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./lib/patram.js",
6
6
  "exports": {