patram 0.6.2 → 0.7.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.d.ts +40 -0
- package/lib/build-graph.d.ts +11 -0
- package/lib/build-graph.types.d.ts +24 -0
- package/lib/claim-helpers.d.ts +20 -0
- package/lib/document-node-identity.d.ts +47 -0
- package/lib/list-source-files.d.ts +29 -0
- package/lib/load-patram-config.d.ts +384 -0
- package/lib/load-patram-config.types.d.ts +45 -0
- package/lib/load-project-graph.d.ts +35 -0
- package/lib/output-view.types.d.ts +80 -0
- package/lib/overlay-graph.d.ts +43 -0
- package/lib/overlay-graph.js +191 -0
- package/lib/parse-claims.d.ts +40 -0
- package/lib/parse-claims.types.d.ts +31 -0
- package/lib/parse-jsdoc-blocks.d.ts +15 -0
- package/lib/parse-jsdoc-claims.d.ts +9 -0
- package/lib/parse-jsdoc-prose.d.ts +28 -0
- package/lib/parse-markdown-claims.d.ts +14 -0
- package/lib/parse-markdown-directives.d.ts +34 -0
- package/lib/parse-where-clause.d.ts +75 -0
- package/lib/parse-where-clause.js +157 -37
- package/lib/parse-where-clause.types.d.ts +63 -0
- package/lib/parse-yaml-claims.d.ts +38 -0
- package/lib/patram-config.d.ts +106 -0
- package/lib/patram-config.types.d.ts +14 -0
- package/lib/patram.d.ts +73 -0
- package/lib/patram.js +3 -0
- package/lib/query-graph.d.ts +68 -0
- package/lib/query-graph.js +27 -24
- package/lib/query-inspection.d.ts +86 -0
- package/lib/resolve-patram-graph-config.d.ts +9 -0
- package/lib/source-file-defaults.d.ts +5 -0
- package/lib/tagged-fenced-block-error.d.ts +10 -0
- package/lib/tagged-fenced-block-markdown.d.ts +47 -0
- package/lib/tagged-fenced-block-metadata.d.ts +26 -0
- package/lib/tagged-fenced-block-parser.d.ts +61 -0
- package/lib/tagged-fenced-blocks.d.ts +39 -0
- package/lib/tagged-fenced-blocks.types.d.ts +32 -0
- package/package.json +13 -2
package/lib/query-graph.js
CHANGED
|
@@ -43,6 +43,14 @@ export const DEFAULT_QUERY_LIMIT = 25;
|
|
|
43
43
|
* }} RelationIndexes
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {{
|
|
48
|
+
* bindings?: Record<string, string>,
|
|
49
|
+
* limit?: number,
|
|
50
|
+
* offset?: number,
|
|
51
|
+
* }} QueryGraphOptions
|
|
52
|
+
*/
|
|
53
|
+
|
|
46
54
|
/**
|
|
47
55
|
* @typedef {{
|
|
48
56
|
* nodes: BuildGraphResult['nodes'],
|
|
@@ -55,17 +63,21 @@ export const DEFAULT_QUERY_LIMIT = 25;
|
|
|
55
63
|
*
|
|
56
64
|
* @param {BuildGraphResult} graph
|
|
57
65
|
* @param {string} where_clause
|
|
58
|
-
* @param {PatramRepoConfig |
|
|
59
|
-
* @param {
|
|
66
|
+
* @param {PatramRepoConfig | QueryGraphOptions=} repo_config_or_query_options
|
|
67
|
+
* @param {QueryGraphOptions=} query_options
|
|
60
68
|
* @returns {{ diagnostics: PatramDiagnostic[], nodes: GraphNode[], total_count: number }}
|
|
61
69
|
*/
|
|
62
70
|
export function queryGraph(
|
|
63
71
|
graph,
|
|
64
72
|
where_clause,
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
repo_config_or_query_options = {},
|
|
74
|
+
query_options = {},
|
|
67
75
|
) {
|
|
68
|
-
const
|
|
76
|
+
const { query_options: resolved_query_options, repo_config } =
|
|
77
|
+
resolveQueryGraphOptions(repo_config_or_query_options, query_options);
|
|
78
|
+
const parse_result = parseWhereClause(where_clause, {
|
|
79
|
+
bindings: resolved_query_options.bindings,
|
|
80
|
+
});
|
|
69
81
|
|
|
70
82
|
if (!parse_result.success) {
|
|
71
83
|
return {
|
|
@@ -75,9 +87,6 @@ export function queryGraph(
|
|
|
75
87
|
};
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
const { pagination_options: resolved_pagination_options, repo_config } =
|
|
79
|
-
resolveQueryGraphOptions(repo_config_or_pagination, pagination_options);
|
|
80
|
-
|
|
81
90
|
if (repo_config) {
|
|
82
91
|
const diagnostics = getQuerySemanticDiagnostics(
|
|
83
92
|
repo_config,
|
|
@@ -102,10 +111,7 @@ export function queryGraph(
|
|
|
102
111
|
const matching_nodes = graph_nodes.filter((graph_node) =>
|
|
103
112
|
matchesExpression(graph_node, parse_result.expression, evaluation_context),
|
|
104
113
|
);
|
|
105
|
-
const paginated_nodes = paginateNodes(
|
|
106
|
-
matching_nodes,
|
|
107
|
-
resolved_pagination_options,
|
|
108
|
-
);
|
|
114
|
+
const paginated_nodes = paginateNodes(matching_nodes, resolved_query_options);
|
|
109
115
|
|
|
110
116
|
return {
|
|
111
117
|
diagnostics: [],
|
|
@@ -501,29 +507,26 @@ function getScalarFieldValue(field_value) {
|
|
|
501
507
|
}
|
|
502
508
|
|
|
503
509
|
/**
|
|
504
|
-
* @param {PatramRepoConfig |
|
|
505
|
-
* @param {
|
|
506
|
-
* @returns {{
|
|
510
|
+
* @param {PatramRepoConfig | QueryGraphOptions} repo_config_or_query_options
|
|
511
|
+
* @param {QueryGraphOptions} query_options
|
|
512
|
+
* @returns {{ query_options: QueryGraphOptions, repo_config: PatramRepoConfig | null }}
|
|
507
513
|
*/
|
|
508
|
-
function resolveQueryGraphOptions(
|
|
509
|
-
|
|
510
|
-
pagination_options,
|
|
511
|
-
) {
|
|
512
|
-
if (isRepoConfig(repo_config_or_pagination)) {
|
|
514
|
+
function resolveQueryGraphOptions(repo_config_or_query_options, query_options) {
|
|
515
|
+
if (isRepoConfig(repo_config_or_query_options)) {
|
|
513
516
|
return {
|
|
514
|
-
|
|
515
|
-
repo_config:
|
|
517
|
+
query_options,
|
|
518
|
+
repo_config: repo_config_or_query_options,
|
|
516
519
|
};
|
|
517
520
|
}
|
|
518
521
|
|
|
519
522
|
return {
|
|
520
|
-
|
|
523
|
+
query_options: repo_config_or_query_options,
|
|
521
524
|
repo_config: null,
|
|
522
525
|
};
|
|
523
526
|
}
|
|
524
527
|
|
|
525
528
|
/**
|
|
526
|
-
* @param {PatramRepoConfig |
|
|
529
|
+
* @param {PatramRepoConfig | QueryGraphOptions} value
|
|
527
530
|
* @returns {value is PatramRepoConfig}
|
|
528
531
|
*/
|
|
529
532
|
function isRepoConfig(value) {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{ kind: 'ad_hoc' } | { kind: 'stored_query', name: string }} QuerySource
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('./parse-where-clause.types.ts').ParsedFieldTerm | import('./parse-where-clause.types.ts').ParsedFieldSetTerm} FieldDiagnosticTerm
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {{ query_source: QuerySource, where_clause: string }} ResolvedWhereClause
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {{ inspection_mode: 'explain' | 'lint', limit: number | null, offset: number }} QueryInspectionOptions
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {{
|
|
15
|
+
* execution?: {
|
|
16
|
+
* limit: number | null,
|
|
17
|
+
* offset: number,
|
|
18
|
+
* },
|
|
19
|
+
* expression?: ParsedExpression,
|
|
20
|
+
* inspection_mode: 'explain' | 'lint',
|
|
21
|
+
* query_source: QuerySource,
|
|
22
|
+
* where_clause: string,
|
|
23
|
+
* }} QueryInspectionSuccess
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Inspect one resolved query without executing it.
|
|
27
|
+
*
|
|
28
|
+
* @param {PatramRepoConfig} repo_config
|
|
29
|
+
* @param {ResolvedWhereClause} resolved_where_clause
|
|
30
|
+
* @param {QueryInspectionOptions} inspection_options
|
|
31
|
+
* @returns {{ success: true, value: QueryInspectionSuccess } | { diagnostics: PatramDiagnostic[], success: false }}
|
|
32
|
+
*/
|
|
33
|
+
export function inspectQuery(repo_config: PatramRepoConfig, resolved_where_clause: ResolvedWhereClause, inspection_options: QueryInspectionOptions): {
|
|
34
|
+
success: true;
|
|
35
|
+
value: QueryInspectionSuccess;
|
|
36
|
+
} | {
|
|
37
|
+
diagnostics: PatramDiagnostic[];
|
|
38
|
+
success: false;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Render a successful query inspection in one output mode.
|
|
42
|
+
*
|
|
43
|
+
* @param {QueryInspectionSuccess} query_inspection
|
|
44
|
+
* @param {ResolvedOutputMode} output_mode
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
export function renderQueryInspection(query_inspection: QueryInspectionSuccess, output_mode: ResolvedOutputMode): string;
|
|
48
|
+
/**
|
|
49
|
+
* Collect schema-aware diagnostics for one parsed where clause.
|
|
50
|
+
*
|
|
51
|
+
* @param {PatramRepoConfig} repo_config
|
|
52
|
+
* @param {QuerySource} query_source
|
|
53
|
+
* @param {ParsedExpression} expression
|
|
54
|
+
* @returns {PatramDiagnostic[]}
|
|
55
|
+
*/
|
|
56
|
+
export function getQuerySemanticDiagnostics(repo_config: PatramRepoConfig, query_source: QuerySource, expression: ParsedExpression): PatramDiagnostic[];
|
|
57
|
+
export type QuerySource = {
|
|
58
|
+
kind: "ad_hoc";
|
|
59
|
+
} | {
|
|
60
|
+
kind: "stored_query";
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
export type FieldDiagnosticTerm = import("./parse-where-clause.types.ts").ParsedFieldTerm | import("./parse-where-clause.types.ts").ParsedFieldSetTerm;
|
|
64
|
+
export type ResolvedWhereClause = {
|
|
65
|
+
query_source: QuerySource;
|
|
66
|
+
where_clause: string;
|
|
67
|
+
};
|
|
68
|
+
export type QueryInspectionOptions = {
|
|
69
|
+
inspection_mode: "explain" | "lint";
|
|
70
|
+
limit: number | null;
|
|
71
|
+
offset: number;
|
|
72
|
+
};
|
|
73
|
+
export type QueryInspectionSuccess = {
|
|
74
|
+
execution?: {
|
|
75
|
+
limit: number | null;
|
|
76
|
+
offset: number;
|
|
77
|
+
};
|
|
78
|
+
expression?: ParsedExpression;
|
|
79
|
+
inspection_mode: "explain" | "lint";
|
|
80
|
+
query_source: QuerySource;
|
|
81
|
+
where_clause: string;
|
|
82
|
+
};
|
|
83
|
+
import type { PatramRepoConfig } from './load-patram-config.types.ts';
|
|
84
|
+
import type { PatramDiagnostic } from './load-patram-config.types.ts';
|
|
85
|
+
import type { ResolvedOutputMode } from './output-view.types.ts';
|
|
86
|
+
import type { ParsedExpression } from './parse-where-clause.types.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge built-in Patram graph semantics with repo-defined schema.
|
|
3
|
+
*
|
|
4
|
+
* @param {PatramRepoConfig} repo_config
|
|
5
|
+
* @returns {PatramConfig}
|
|
6
|
+
*/
|
|
7
|
+
export function resolvePatramGraphConfig(repo_config: PatramRepoConfig): PatramConfig;
|
|
8
|
+
import type { PatramRepoConfig } from './load-patram-config.types.ts';
|
|
9
|
+
import type { PatramConfig } from './patram-config.types.ts';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const MARKDOWN_SOURCE_FILE_EXTENSIONS: string[];
|
|
2
|
+
export const YAML_SOURCE_FILE_EXTENSIONS: string[];
|
|
3
|
+
export const JSDOC_SOURCE_FILE_EXTENSIONS: string[];
|
|
4
|
+
export const SUPPORTED_SOURCE_FILE_EXTENSIONS: string[];
|
|
5
|
+
export const DEFAULT_INCLUDE_PATTERNS: string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { TaggedFencedBlockError } from './tagged-fenced-blocks.types.ts';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} code
|
|
6
|
+
* @param {string} message
|
|
7
|
+
* @returns {TaggedFencedBlockError}
|
|
8
|
+
*/
|
|
9
|
+
export function createTaggedFencedBlockError(code: string, message: string): TaggedFencedBlockError;
|
|
10
|
+
import type { TaggedFencedBlockError } from './tagged-fenced-blocks.types.ts';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string[]} lines
|
|
3
|
+
* @returns {number}
|
|
4
|
+
*/
|
|
5
|
+
export function findMarkdownBodyStartLineIndex(lines: string[]): number;
|
|
6
|
+
/**
|
|
7
|
+
* @param {string[]} lines
|
|
8
|
+
* @param {number} body_start
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function getMarkdownTitle(lines: string[], body_start: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} line
|
|
14
|
+
* @returns {{ level: number, text: string } | null}
|
|
15
|
+
*/
|
|
16
|
+
export function parseHeading(line: string): {
|
|
17
|
+
level: number;
|
|
18
|
+
text: string;
|
|
19
|
+
} | null;
|
|
20
|
+
/**
|
|
21
|
+
* @param {string[]} heading_path
|
|
22
|
+
* @param {string} title
|
|
23
|
+
* @param {{ level: number, text: string }} heading
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
26
|
+
export function updateHeadingPath(heading_path: string[], title: string, heading: {
|
|
27
|
+
level: number;
|
|
28
|
+
text: string;
|
|
29
|
+
}): string[];
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} line
|
|
32
|
+
* @returns {{ character: string, lang: string, length: number } | null}
|
|
33
|
+
*/
|
|
34
|
+
export function parseOpeningMarkdownFence(line: string): {
|
|
35
|
+
character: string;
|
|
36
|
+
lang: string;
|
|
37
|
+
length: number;
|
|
38
|
+
} | null;
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} line
|
|
41
|
+
* @param {{ character: string, length: number }} open_fence
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
export function isClosingMarkdownFence(line: string, open_fence: {
|
|
45
|
+
character: string;
|
|
46
|
+
length: number;
|
|
47
|
+
}): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} file_path
|
|
3
|
+
* @param {{ metadata: Record<string, string>, tag_lines: number[] }} pending_tag_set
|
|
4
|
+
* @param {{ metadata: Record<string, string>, tag_lines: number[] }} next_tag_set
|
|
5
|
+
* @returns {{ metadata: Record<string, string>, tag_lines: number[] }}
|
|
6
|
+
*/
|
|
7
|
+
export function mergePendingTagSets(file_path: string, pending_tag_set: {
|
|
8
|
+
metadata: Record<string, string>;
|
|
9
|
+
tag_lines: number[];
|
|
10
|
+
}, next_tag_set: {
|
|
11
|
+
metadata: Record<string, string>;
|
|
12
|
+
tag_lines: number[];
|
|
13
|
+
}): {
|
|
14
|
+
metadata: Record<string, string>;
|
|
15
|
+
tag_lines: number[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} file_path
|
|
19
|
+
* @param {string} line
|
|
20
|
+
* @param {number} line_number
|
|
21
|
+
* @returns {{ metadata: Record<string, string>, tag_lines: number[] } | null}
|
|
22
|
+
*/
|
|
23
|
+
export function parseTaggedMetadataLine(file_path: string, line: string, line_number: number): {
|
|
24
|
+
metadata: Record<string, string>;
|
|
25
|
+
tag_lines: number[];
|
|
26
|
+
} | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{ metadata: Record<string, string>, tag_lines: number[] }} PendingTagSet
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {{
|
|
6
|
+
* heading_path: string[];
|
|
7
|
+
* lang: string;
|
|
8
|
+
* line_start: number;
|
|
9
|
+
* metadata: Record<string, string>;
|
|
10
|
+
* tag_lines: number[];
|
|
11
|
+
* value_lines: string[];
|
|
12
|
+
* }} OpenTaggedBlock
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {{ character: string, lang: string, length: number }} OpenFence
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {{
|
|
19
|
+
* blocks: TaggedFencedBlock[];
|
|
20
|
+
* body_start: number;
|
|
21
|
+
* heading_path: string[];
|
|
22
|
+
* open_fence: OpenFence | null;
|
|
23
|
+
* open_tagged_block: OpenTaggedBlock | null;
|
|
24
|
+
* pending_tag_set: PendingTagSet | null;
|
|
25
|
+
* title: string;
|
|
26
|
+
* }} TaggedBlockScannerState
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @param {TaggedFencedBlocksInput} input
|
|
30
|
+
* @returns {TaggedFencedBlockFile}
|
|
31
|
+
*/
|
|
32
|
+
export function extractTaggedFencedBlocksFromSource(input: TaggedFencedBlocksInput): TaggedFencedBlockFile;
|
|
33
|
+
export type PendingTagSet = {
|
|
34
|
+
metadata: Record<string, string>;
|
|
35
|
+
tag_lines: number[];
|
|
36
|
+
};
|
|
37
|
+
export type OpenTaggedBlock = {
|
|
38
|
+
heading_path: string[];
|
|
39
|
+
lang: string;
|
|
40
|
+
line_start: number;
|
|
41
|
+
metadata: Record<string, string>;
|
|
42
|
+
tag_lines: number[];
|
|
43
|
+
value_lines: string[];
|
|
44
|
+
};
|
|
45
|
+
export type OpenFence = {
|
|
46
|
+
character: string;
|
|
47
|
+
lang: string;
|
|
48
|
+
length: number;
|
|
49
|
+
};
|
|
50
|
+
export type TaggedBlockScannerState = {
|
|
51
|
+
blocks: TaggedFencedBlock[];
|
|
52
|
+
body_start: number;
|
|
53
|
+
heading_path: string[];
|
|
54
|
+
open_fence: OpenFence | null;
|
|
55
|
+
open_tagged_block: OpenTaggedBlock | null;
|
|
56
|
+
pending_tag_set: PendingTagSet | null;
|
|
57
|
+
title: string;
|
|
58
|
+
};
|
|
59
|
+
import type { TaggedFencedBlocksInput } from './tagged-fenced-blocks.types.ts';
|
|
60
|
+
import type { TaggedFencedBlockFile } from './tagged-fenced-blocks.types.ts';
|
|
61
|
+
import type { TaggedFencedBlock } from './tagged-fenced-blocks.types.ts';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tagged fenced block public API.
|
|
3
|
+
*
|
|
4
|
+
* Loads or extracts one markdown file worth of tagged fenced blocks and
|
|
5
|
+
* provides exact-match selection helpers.
|
|
6
|
+
*
|
|
7
|
+
* Kind: parse
|
|
8
|
+
* Status: active
|
|
9
|
+
* Tracked in: ../docs/plans/v0/tagged-fenced-block-extraction.md
|
|
10
|
+
* Decided by: ../docs/decisions/tagged-fenced-block-extraction.md
|
|
11
|
+
* @patram
|
|
12
|
+
* @see {@link ../docs/decisions/tagged-fenced-block-extraction.md}
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @param {TaggedFencedBlocksInput} input
|
|
16
|
+
* @returns {TaggedFencedBlockFile}
|
|
17
|
+
*/
|
|
18
|
+
export function extractTaggedFencedBlocks(input: TaggedFencedBlocksInput): TaggedFencedBlockFile;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} file_path
|
|
21
|
+
* @returns {Promise<TaggedFencedBlockFile>}
|
|
22
|
+
*/
|
|
23
|
+
export function loadTaggedFencedBlocks(file_path: string): Promise<TaggedFencedBlockFile>;
|
|
24
|
+
/**
|
|
25
|
+
* @param {TaggedFencedBlock[]} blocks
|
|
26
|
+
* @param {TaggedFencedBlockCriteria} criteria
|
|
27
|
+
* @returns {TaggedFencedBlock[]}
|
|
28
|
+
*/
|
|
29
|
+
export function selectTaggedBlocks(blocks: TaggedFencedBlock[], criteria: TaggedFencedBlockCriteria): TaggedFencedBlock[];
|
|
30
|
+
/**
|
|
31
|
+
* @param {TaggedFencedBlock[]} blocks
|
|
32
|
+
* @param {TaggedFencedBlockCriteria} criteria
|
|
33
|
+
* @returns {TaggedFencedBlock}
|
|
34
|
+
*/
|
|
35
|
+
export function selectTaggedBlock(blocks: TaggedFencedBlock[], criteria: TaggedFencedBlockCriteria): TaggedFencedBlock;
|
|
36
|
+
import type { TaggedFencedBlocksInput } from './tagged-fenced-blocks.types.ts';
|
|
37
|
+
import type { TaggedFencedBlockFile } from './tagged-fenced-blocks.types.ts';
|
|
38
|
+
import type { TaggedFencedBlock } from './tagged-fenced-blocks.types.ts';
|
|
39
|
+
import type { TaggedFencedBlockCriteria } from './tagged-fenced-blocks.types.ts';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface TaggedFencedBlocksInput {
|
|
2
|
+
file_path: string;
|
|
3
|
+
source_text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TaggedFencedBlockCriteria {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TaggedFencedBlockOrigin {
|
|
9
|
+
path: string;
|
|
10
|
+
line_start: number;
|
|
11
|
+
line_end: number;
|
|
12
|
+
tag_lines: number[];
|
|
13
|
+
}
|
|
14
|
+
export interface TaggedFencedBlockContext {
|
|
15
|
+
heading_path: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface TaggedFencedBlock {
|
|
18
|
+
id: string;
|
|
19
|
+
lang: string;
|
|
20
|
+
value: string;
|
|
21
|
+
metadata: Record<string, string>;
|
|
22
|
+
origin: TaggedFencedBlockOrigin;
|
|
23
|
+
context: TaggedFencedBlockContext;
|
|
24
|
+
}
|
|
25
|
+
export interface TaggedFencedBlockFile {
|
|
26
|
+
path: string;
|
|
27
|
+
title: string;
|
|
28
|
+
blocks: TaggedFencedBlock[];
|
|
29
|
+
}
|
|
30
|
+
export interface TaggedFencedBlockError extends Error {
|
|
31
|
+
code: string;
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patram",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/patram.js",
|
|
6
|
+
"types": "./lib/patram.d.ts",
|
|
6
7
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/patram.d.ts",
|
|
10
|
+
"default": "./lib/patram.js"
|
|
11
|
+
},
|
|
8
12
|
"./bin/patram.js": "./bin/patram.js"
|
|
9
13
|
},
|
|
10
14
|
"files": [
|
|
11
15
|
"bin/patram.js",
|
|
16
|
+
"lib/**/*.d.ts",
|
|
12
17
|
"lib/**/*.js",
|
|
13
18
|
"lib/**/*.ts",
|
|
19
|
+
"!bin/**/*.test.d.ts",
|
|
20
|
+
"!bin/**/*.test-helpers.d.ts",
|
|
14
21
|
"!bin/**/*.test.js",
|
|
15
22
|
"!bin/**/*.test-helpers.js",
|
|
23
|
+
"!lib/**/*.test.d.ts",
|
|
24
|
+
"!lib/**/*.test-helpers.d.ts",
|
|
16
25
|
"!lib/**/*.test.js",
|
|
17
26
|
"!lib/**/*.test-helpers.js"
|
|
18
27
|
],
|
|
@@ -37,6 +46,8 @@
|
|
|
37
46
|
"check:staged": "lint-staged",
|
|
38
47
|
"check:types": "tsc",
|
|
39
48
|
"postversion": "git push && git push --tags",
|
|
49
|
+
"postpack": "node scripts/clean-package-api-declarations.js",
|
|
50
|
+
"prepack": "node scripts/build-package-api-declarations.js",
|
|
40
51
|
"preversion": "npm run all",
|
|
41
52
|
"prepare": "husky",
|
|
42
53
|
"test": "vitest run",
|