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.
- package/lib/build-graph-identity.js +70 -84
- package/lib/build-graph.js +171 -19
- package/lib/build-graph.types.ts +1 -0
- package/lib/check-directive-metadata.js +36 -4
- package/lib/check-directive-value.js +9 -0
- package/lib/check-graph.js +1 -2
- package/lib/cli-help-metadata.js +12 -0
- package/lib/command-output.js +16 -1
- package/lib/discover-fields.js +9 -1
- package/lib/document-node-identity.js +317 -0
- package/lib/layout-stored-queries.js +122 -29
- package/lib/load-patram-config.js +172 -112
- package/lib/load-patram-config.types.ts +50 -152
- package/lib/parse-claims.js +2 -3
- package/lib/parse-jsdoc-claims.js +3 -3
- package/lib/parse-where-clause.js +237 -66
- package/lib/parse-where-clause.types.ts +21 -6
- package/lib/patram-cli.js +34 -2
- package/lib/patram-config.js +26 -9
- package/lib/patram-config.types.ts +18 -36
- package/lib/query-graph.js +29 -19
- package/lib/query-inspection.js +173 -68
- package/lib/render-field-discovery.js +44 -8
- package/lib/render-output-view.js +72 -27
- package/lib/render-rich-source.js +245 -14
- package/lib/resolve-patram-graph-config.js +40 -2
- package/lib/show-document.js +15 -2
- package/package.json +1 -1
package/lib/show-document.js
CHANGED
|
@@ -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(
|
|
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 =
|
|
226
|
+
const target_node =
|
|
227
|
+
graph_nodes[resolveDocumentNodeId(document_node_ids, target_path)];
|
|
215
228
|
|
|
216
229
|
return {
|
|
217
230
|
label: claim_value.text,
|