@driftsys/markspec 0.2.0 → 0.3.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/README.md +32 -8
- package/esm/compiler/inverses.d.ts +22 -0
- package/esm/compiler/inverses.d.ts.map +1 -0
- package/esm/compiler/inverses.js +147 -0
- package/esm/compiler/link_target.d.ts +19 -0
- package/esm/compiler/link_target.d.ts.map +1 -0
- package/esm/compiler/link_target.js +66 -0
- package/esm/compiler/mod.d.ts +7 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +61 -14
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +20 -1
- package/esm/config/markspec.d.ts +51 -0
- package/esm/config/markspec.d.ts.map +1 -0
- package/esm/config/markspec.js +216 -0
- package/esm/config/mod.d.ts +4 -0
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +27 -16
- package/esm/formatter/mod.d.ts +12 -2
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +130 -22
- package/esm/mod.d.ts +10 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +5 -2
- package/esm/model/attributes.d.ts +47 -0
- package/esm/model/attributes.d.ts.map +1 -0
- package/esm/model/attributes.js +97 -0
- package/esm/model/mod.d.ts +255 -26
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +27 -1
- package/esm/model/profile.d.ts +189 -0
- package/esm/model/profile.d.ts.map +1 -0
- package/esm/model/profile.js +31 -0
- package/esm/parser/attributes.d.ts +13 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +47 -0
- package/esm/parser/frontmatter.d.ts +53 -0
- package/esm/parser/frontmatter.d.ts.map +1 -0
- package/esm/parser/frontmatter.js +185 -0
- package/esm/parser/grammars.js +11 -2
- package/esm/parser/markdown.d.ts +11 -4
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +85 -38
- package/esm/parser/mod.d.ts +26 -10
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +39 -9
- package/esm/parser/source.d.ts +12 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +20 -13
- package/esm/profile/cache.d.ts +29 -0
- package/esm/profile/cache.d.ts.map +1 -0
- package/esm/profile/cache.js +45 -0
- package/esm/profile/chain.d.ts +42 -0
- package/esm/profile/chain.d.ts.map +1 -0
- package/esm/profile/chain.js +193 -0
- package/esm/profile/git-cache.d.ts +73 -0
- package/esm/profile/git-cache.d.ts.map +1 -0
- package/esm/profile/git-cache.js +96 -0
- package/esm/profile/load.d.ts +28 -0
- package/esm/profile/load.d.ts.map +1 -0
- package/esm/profile/load.js +50 -0
- package/esm/profile/manifest.d.ts +21 -0
- package/esm/profile/manifest.d.ts.map +1 -0
- package/esm/profile/manifest.js +830 -0
- package/esm/profile/merge.d.ts +26 -0
- package/esm/profile/merge.d.ts.map +1 -0
- package/esm/profile/merge.js +518 -0
- package/esm/profile/mod.d.ts +23 -0
- package/esm/profile/mod.d.ts.map +1 -0
- package/esm/profile/mod.js +14 -0
- package/esm/profile/npm.d.ts +51 -0
- package/esm/profile/npm.d.ts.map +1 -0
- package/esm/profile/npm.js +186 -0
- package/esm/profile/resolver.d.ts +60 -0
- package/esm/profile/resolver.d.ts.map +1 -0
- package/esm/profile/resolver.js +132 -0
- package/esm/reporter/mod.js +14 -27
- package/esm/validator/attributes.d.ts +43 -0
- package/esm/validator/attributes.d.ts.map +1 -0
- package/esm/validator/attributes.js +169 -0
- package/esm/validator/mod.d.ts +27 -6
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +132 -124
- package/esm/validator/normalize.d.ts +21 -0
- package/esm/validator/normalize.d.ts.map +1 -0
- package/esm/validator/normalize.js +58 -0
- package/esm/validator/pattern.d.ts +23 -0
- package/esm/validator/pattern.d.ts.map +1 -0
- package/esm/validator/pattern.js +44 -0
- package/esm/validator/pipeline.d.ts +30 -0
- package/esm/validator/pipeline.d.ts.map +1 -0
- package/esm/validator/pipeline.js +115 -0
- package/esm/validator/traceability.d.ts +48 -0
- package/esm/validator/traceability.d.ts.map +1 -0
- package/esm/validator/traceability.js +141 -0
- package/esm/validator/types.d.ts +48 -0
- package/esm/validator/types.d.ts.map +1 -0
- package/esm/validator/types.js +140 -0
- package/esm/validator/value_types.d.ts +20 -0
- package/esm/validator/value_types.d.ts.map +1 -0
- package/esm/validator/value_types.js +126 -0
- package/package.json +1 -1
- package/script/compiler/inverses.d.ts +22 -0
- package/script/compiler/inverses.d.ts.map +1 -0
- package/script/compiler/inverses.js +150 -0
- package/script/compiler/link_target.d.ts +19 -0
- package/script/compiler/link_target.d.ts.map +1 -0
- package/script/compiler/link_target.js +69 -0
- package/script/compiler/mod.d.ts +7 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +62 -14
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +20 -1
- package/script/config/markspec.d.ts +51 -0
- package/script/config/markspec.d.ts.map +1 -0
- package/script/config/markspec.js +222 -0
- package/script/config/mod.d.ts +4 -0
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +28 -16
- package/script/formatter/mod.d.ts +12 -2
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +131 -22
- package/script/mod.d.ts +10 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +48 -19
- package/script/model/attributes.d.ts +47 -0
- package/script/model/attributes.d.ts.map +1 -0
- package/script/model/attributes.js +101 -0
- package/script/model/mod.d.ts +255 -26
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +34 -2
- package/script/model/profile.d.ts +189 -0
- package/script/model/profile.d.ts.map +1 -0
- package/script/model/profile.js +34 -0
- package/script/parser/attributes.d.ts +13 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +48 -0
- package/script/parser/frontmatter.d.ts +53 -0
- package/script/parser/frontmatter.d.ts.map +1 -0
- package/script/parser/frontmatter.js +188 -0
- package/script/parser/grammars.js +11 -2
- package/script/parser/markdown.d.ts +11 -4
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +84 -37
- package/script/parser/mod.d.ts +26 -10
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +41 -10
- package/script/parser/source.d.ts +12 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +20 -13
- package/script/profile/cache.d.ts +29 -0
- package/script/profile/cache.d.ts.map +1 -0
- package/script/profile/cache.js +48 -0
- package/script/profile/chain.d.ts +42 -0
- package/script/profile/chain.d.ts.map +1 -0
- package/script/profile/chain.js +229 -0
- package/script/profile/git-cache.d.ts +73 -0
- package/script/profile/git-cache.d.ts.map +1 -0
- package/script/profile/git-cache.js +104 -0
- package/script/profile/load.d.ts +28 -0
- package/script/profile/load.d.ts.map +1 -0
- package/script/profile/load.js +53 -0
- package/script/profile/manifest.d.ts +21 -0
- package/script/profile/manifest.d.ts.map +1 -0
- package/script/profile/manifest.js +833 -0
- package/script/profile/merge.d.ts +26 -0
- package/script/profile/merge.d.ts.map +1 -0
- package/script/profile/merge.js +521 -0
- package/script/profile/mod.d.ts +23 -0
- package/script/profile/mod.d.ts.map +1 -0
- package/script/profile/mod.js +31 -0
- package/script/profile/npm.d.ts +51 -0
- package/script/profile/npm.d.ts.map +1 -0
- package/script/profile/npm.js +191 -0
- package/script/profile/resolver.d.ts +60 -0
- package/script/profile/resolver.d.ts.map +1 -0
- package/script/profile/resolver.js +136 -0
- package/script/reporter/mod.js +14 -27
- package/script/validator/attributes.d.ts +43 -0
- package/script/validator/attributes.d.ts.map +1 -0
- package/script/validator/attributes.js +173 -0
- package/script/validator/mod.d.ts +27 -6
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +145 -123
- package/script/validator/normalize.d.ts +21 -0
- package/script/validator/normalize.d.ts.map +1 -0
- package/script/validator/normalize.js +61 -0
- package/script/validator/pattern.d.ts +23 -0
- package/script/validator/pattern.d.ts.map +1 -0
- package/script/validator/pattern.js +47 -0
- package/script/validator/pipeline.d.ts +30 -0
- package/script/validator/pipeline.d.ts.map +1 -0
- package/script/validator/pipeline.js +118 -0
- package/script/validator/traceability.d.ts +48 -0
- package/script/validator/traceability.d.ts.map +1 -0
- package/script/validator/traceability.js +146 -0
- package/script/validator/types.d.ts +48 -0
- package/script/validator/types.d.ts.map +1 -0
- package/script/validator/types.js +144 -0
- package/script/validator/value_types.d.ts +20 -0
- package/script/validator/value_types.d.ts.map +1 -0
- package/script/validator/value_types.js +129 -0
|
@@ -3,32 +3,42 @@
|
|
|
3
3
|
* @module parser/markdown
|
|
4
4
|
*
|
|
5
5
|
* CommonMark + MarkSpec extension parser. Walks the mdast AST to detect
|
|
6
|
-
* `- [
|
|
6
|
+
* `- [DISPLAY_ID] Title` entry blocks and extract structured attributes.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.parseMarkdown = parseMarkdown;
|
|
10
|
+
const mod_js_1 = require("../model/mod.js");
|
|
10
11
|
const attributes_js_1 = require("./attributes.js");
|
|
11
12
|
const remark_js_1 = require("./remark.js");
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Reference entry display ID pattern: letters, digits, hyphens.
|
|
14
|
+
* Slug pattern for referenced-entry display IDs.
|
|
15
|
+
*
|
|
16
|
+
* Pandoc/BibTeX cite-key convention, restricted to a portable character set
|
|
17
|
+
* (`.`, `/`, `_`, `-` accepted inside; must start with a letter and end
|
|
18
|
+
* with an alphanumeric).
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
20
|
+
const SLUG_RE = /^[A-Za-z]([A-Za-z0-9._/-]*[A-Za-z0-9])?$/;
|
|
21
|
+
/** Match `[...]` at the start of a list item paragraph. Captures: [1] = display ID, [2] = title. */
|
|
22
|
+
const ENTRY_START_RE = /^\[([^\]]+)\]\s*(.*)$/;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Find the `Id:` attribute on an entry. Returns undefined when absent. If
|
|
25
|
+
* more than one `Id:` is present, returns the first — the validator flags
|
|
26
|
+
* this as MSL-R003.
|
|
24
27
|
*/
|
|
25
|
-
|
|
28
|
+
function findIdentityAttribute(attributes) {
|
|
29
|
+
for (const attr of attributes) {
|
|
30
|
+
if (attr.key === mod_js_1.IDENTITY_KEY)
|
|
31
|
+
return attr;
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
26
35
|
/**
|
|
27
36
|
* Parse a Markdown string and return all MarkSpec entries found.
|
|
28
37
|
*
|
|
29
|
-
* Walks the mdast AST to detect `- [DISPLAY_ID] Title` list items
|
|
30
|
-
*
|
|
31
|
-
*
|
|
38
|
+
* Walks the mdast AST to detect `- [DISPLAY_ID] Title` list items with
|
|
39
|
+
* indented body content. Extracts display ID, title, body, and trailing
|
|
40
|
+
* attribute blocks. Entry shape (identified or referenced) is decided by
|
|
41
|
+
* the `Id:` attribute's value format.
|
|
32
42
|
*
|
|
33
43
|
* @param markdown - Markdown source text
|
|
34
44
|
* @param options - Parse options (file path for source locations)
|
|
@@ -36,6 +46,7 @@ const ENTRY_START_RE = /^\[([^\]]+)\]\s*(.*)$/;
|
|
|
36
46
|
*/
|
|
37
47
|
function parseMarkdown(markdown, options) {
|
|
38
48
|
const file = options?.file ?? "<unknown>";
|
|
49
|
+
const isReferencesDoc = detectReferencesDocument(file, options?.isReferencesDoc);
|
|
39
50
|
const tree = remark_js_1.processor.parse(markdown);
|
|
40
51
|
const entries = [];
|
|
41
52
|
// Collect link definition identifiers for shortcut reference exclusion.
|
|
@@ -50,18 +61,30 @@ function parseMarkdown(markdown, options) {
|
|
|
50
61
|
if (list.ordered)
|
|
51
62
|
continue;
|
|
52
63
|
for (const item of list.children) {
|
|
53
|
-
const entry = extractEntry(item, markdown, file, definitions);
|
|
64
|
+
const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc);
|
|
54
65
|
if (entry)
|
|
55
66
|
entries.push(entry);
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
return entries;
|
|
59
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Detect if a file is a references document.
|
|
73
|
+
* References context enables recognition of reference entries (slugs).
|
|
74
|
+
* @param file - File path
|
|
75
|
+
* @param explicit - Explicit override (undefined = auto-detect)
|
|
76
|
+
*/
|
|
77
|
+
function detectReferencesDocument(file, explicit) {
|
|
78
|
+
if (explicit !== undefined)
|
|
79
|
+
return explicit;
|
|
80
|
+
const basename = file.split("/").pop() ?? "";
|
|
81
|
+
return basename === "references.md" || file.includes("/references/");
|
|
82
|
+
}
|
|
60
83
|
/**
|
|
61
84
|
* Attempt to extract a MarkSpec entry from a list item.
|
|
62
85
|
* Returns undefined if the list item is not an entry block.
|
|
63
86
|
*/
|
|
64
|
-
function extractEntry(item, markdown, file, definitions) {
|
|
87
|
+
function extractEntry(item, markdown, file, definitions, isReferencesDoc) {
|
|
65
88
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
66
89
|
if (item.checked != null)
|
|
67
90
|
return undefined;
|
|
@@ -114,28 +137,49 @@ function extractEntry(item, markdown, file, definitions) {
|
|
|
114
137
|
}
|
|
115
138
|
if (!displayId)
|
|
116
139
|
return undefined;
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
//
|
|
122
|
-
// If there's only one child (the title paragraph) and no further content,
|
|
123
|
-
// it's not an entry block.
|
|
124
|
-
if (item.children.length < 2)
|
|
125
|
-
return undefined;
|
|
126
|
-
// Extract entry type from typed display IDs
|
|
127
|
-
const typedMatch = TYPED_ID_RE.exec(displayId);
|
|
128
|
-
const entryType = typedMatch
|
|
129
|
-
? typedMatch[1]
|
|
130
|
-
: undefined;
|
|
131
|
-
// Extract body content from remaining children
|
|
140
|
+
// Strip optional leading `@` on referenced-entry display IDs for Pandoc
|
|
141
|
+
// citation compatibility. Canonical slug never contains `@`.
|
|
142
|
+
if (displayId.startsWith("@"))
|
|
143
|
+
displayId = displayId.slice(1);
|
|
144
|
+
// Extract body content and attributes.
|
|
132
145
|
const bodyContent = extractBodyContent(item, markdown);
|
|
133
|
-
// Split body and attributes
|
|
134
146
|
const [body, attrLines] = (0, attributes_js_1.splitBodyAndAttributes)(bodyContent);
|
|
135
147
|
const attributes = (0, attributes_js_1.parseAttributes)(attrLines);
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
// Discriminate shape by the `Id:` attribute's value format.
|
|
149
|
+
let shape;
|
|
150
|
+
let id;
|
|
151
|
+
const identityAttr = findIdentityAttribute(attributes);
|
|
152
|
+
if (identityAttr) {
|
|
153
|
+
id = identityAttr.value;
|
|
154
|
+
shape = (0, mod_js_1.shapeFromIdValue)(identityAttr.value);
|
|
155
|
+
if (shape === undefined) {
|
|
156
|
+
// `Id:` is neither a ULID nor a scheme-qualified URI. Accept as an
|
|
157
|
+
// identified entry so the validator can surface MSL-R004; missing
|
|
158
|
+
// shape on a parsed entry is not useful downstream.
|
|
159
|
+
shape = "identified";
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
// No `Id:`. Fall back on display-ID shape + document context to decide
|
|
164
|
+
// whether to admit the entry at all.
|
|
165
|
+
if (isReferencesDoc && SLUG_RE.test(displayId)) {
|
|
166
|
+
shape = "referenced";
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// No identity attribute and no references-doc context — admit as
|
|
170
|
+
// identified so the validator can surface the missing-`Id:` error.
|
|
171
|
+
shape = "identified";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Inferred type from display-ID prefix — left to the profile layer. For
|
|
175
|
+
// now the core records no type; downstream profile-aware code populates
|
|
176
|
+
// this field when a profile is loaded.
|
|
177
|
+
const type = undefined;
|
|
178
|
+
// Body requirement: identified entries require a body; referenced entries
|
|
179
|
+
// may omit it. If there's only one child (the title paragraph), admit
|
|
180
|
+
// only referenced entries.
|
|
181
|
+
if (shape !== "referenced" && item.children.length < 2)
|
|
182
|
+
return undefined;
|
|
139
183
|
// Source location
|
|
140
184
|
const line = item.position?.start.line ?? 1;
|
|
141
185
|
const column = item.position?.start.column ?? 1;
|
|
@@ -143,11 +187,14 @@ function extractEntry(item, markdown, file, definitions) {
|
|
|
143
187
|
displayId,
|
|
144
188
|
title: title ?? "",
|
|
145
189
|
body,
|
|
146
|
-
attributes,
|
|
190
|
+
rawAttributes: attributes,
|
|
191
|
+
typedAttributes: (0, attributes_js_1.collateAttributes)(attributes),
|
|
147
192
|
id,
|
|
148
|
-
|
|
193
|
+
type,
|
|
194
|
+
shape,
|
|
149
195
|
location: { file, line, column },
|
|
150
196
|
source: "markdown",
|
|
197
|
+
properties: { file: { path: file, line, column } },
|
|
151
198
|
};
|
|
152
199
|
}
|
|
153
200
|
/**
|
package/script/parser/mod.d.ts
CHANGED
|
@@ -9,15 +9,17 @@
|
|
|
9
9
|
* - directives: HTML comment directive extraction
|
|
10
10
|
* - source: doc comment extraction from Rust, Kotlin, C, C++, Java
|
|
11
11
|
*/
|
|
12
|
-
import type { Caption, Entry } from "../model/mod.js";
|
|
12
|
+
import type { Caption, Diagnostic, Document, Entry } from "../model/mod.js";
|
|
13
13
|
import { type DetectCaptionsOptions } from "./captions.js";
|
|
14
14
|
export type { DetectCaptionsOptions } from "./captions.js";
|
|
15
15
|
export { detectDirectives } from "./directives.js";
|
|
16
16
|
export type { DetectDirectivesOptions } from "./directives.js";
|
|
17
|
+
export { extractFrontMatter } from "./frontmatter.js";
|
|
18
|
+
export type { ExtractFrontMatterOptions, FrontMatterResult, } from "./frontmatter.js";
|
|
17
19
|
export { detectInlineRefs } from "./references.js";
|
|
18
20
|
export type { DetectInlineRefsOptions } from "./references.js";
|
|
19
21
|
export { parseSource } from "./source.js";
|
|
20
|
-
export type { ParseSourceOptions } from "./source.js";
|
|
22
|
+
export type { ParseSourceOptions, ParseSourceResult } from "./source.js";
|
|
21
23
|
export { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
22
24
|
/** Options for {@linkcode parse}. */
|
|
23
25
|
export interface ParseOptions {
|
|
@@ -32,20 +34,34 @@ export interface ParseOptions {
|
|
|
32
34
|
* @returns Array of parsed entries
|
|
33
35
|
*/
|
|
34
36
|
export declare function parse(markdown: string, options?: ParseOptions): Entry[];
|
|
37
|
+
/** Result of parsing a file (entries + optional document + diagnostics). */
|
|
38
|
+
export interface ParseFileResult {
|
|
39
|
+
/** Parsed entries. */
|
|
40
|
+
readonly entries: Entry[];
|
|
41
|
+
/**
|
|
42
|
+
* Document-level metadata parsed from YAML front matter. `undefined` for
|
|
43
|
+
* source files (Rust/Kotlin/C/...) and for Markdown files without front
|
|
44
|
+
* matter; present otherwise so downstream consumers can resolve
|
|
45
|
+
* `{{document.*}}` inline references.
|
|
46
|
+
*/
|
|
47
|
+
readonly document?: Document;
|
|
48
|
+
/**
|
|
49
|
+
* Parse-level diagnostics (forbidden front-matter keys, malformed YAML).
|
|
50
|
+
* Merged into the compile result's diagnostics.
|
|
51
|
+
*/
|
|
52
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
53
|
+
}
|
|
35
54
|
/**
|
|
36
|
-
* Parse a file and return
|
|
55
|
+
* Parse a file and return entries, annotation links, and (for Markdown
|
|
56
|
+
* files) a Document with front-matter attributes.
|
|
37
57
|
*
|
|
38
58
|
* Source files (`.rs`, `.java`, `.c`, `.cpp`, etc.) are parsed with
|
|
39
|
-
* tree-sitter to extract doc comment entries
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param content - File content
|
|
43
|
-
* @param options - Must include `file` path for extension detection
|
|
44
|
-
* @returns Array of parsed entries
|
|
59
|
+
* tree-sitter to extract doc comment entries; no front matter is
|
|
60
|
+
* recognized on source files.
|
|
45
61
|
*/
|
|
46
62
|
export declare function parseFile(content: string, options: {
|
|
47
63
|
readonly file: string;
|
|
48
|
-
}): Promise<
|
|
64
|
+
}): Promise<ParseFileResult>;
|
|
49
65
|
/**
|
|
50
66
|
* Detect table and figure captions in a Markdown string.
|
|
51
67
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/parser/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/parser/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAK5E,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAElE,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,KAAK,EAAE,CAET;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAYD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC,OAAO,CAAC,eAAe,CAAC,CAiC1B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,EAAE,CAEX"}
|
package/script/parser/mod.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - source: doc comment extraction from Rust, Kotlin, C, C++, Java
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.loadGrammar = exports.isSupportedExtension = exports.parseSource = exports.detectInlineRefs = exports.detectDirectives = void 0;
|
|
14
|
+
exports.loadGrammar = exports.isSupportedExtension = exports.parseSource = exports.detectInlineRefs = exports.extractFrontMatter = exports.detectDirectives = void 0;
|
|
15
15
|
exports.parse = parse;
|
|
16
16
|
exports.parseFile = parseFile;
|
|
17
17
|
exports.detectCaptions = detectCaptions;
|
|
@@ -19,9 +19,12 @@ const path_1 = require("@std/path");
|
|
|
19
19
|
const markdown_js_1 = require("./markdown.js");
|
|
20
20
|
const grammars_js_1 = require("./grammars.js");
|
|
21
21
|
const source_js_1 = require("./source.js");
|
|
22
|
+
const frontmatter_js_1 = require("./frontmatter.js");
|
|
22
23
|
const captions_js_1 = require("./captions.js");
|
|
23
24
|
var directives_js_1 = require("./directives.js");
|
|
24
25
|
Object.defineProperty(exports, "detectDirectives", { enumerable: true, get: function () { return directives_js_1.detectDirectives; } });
|
|
26
|
+
var frontmatter_js_2 = require("./frontmatter.js");
|
|
27
|
+
Object.defineProperty(exports, "extractFrontMatter", { enumerable: true, get: function () { return frontmatter_js_2.extractFrontMatter; } });
|
|
25
28
|
var references_js_1 = require("./references.js");
|
|
26
29
|
Object.defineProperty(exports, "detectInlineRefs", { enumerable: true, get: function () { return references_js_1.detectInlineRefs; } });
|
|
27
30
|
var source_js_2 = require("./source.js");
|
|
@@ -40,23 +43,51 @@ function parse(markdown, options) {
|
|
|
40
43
|
return (0, markdown_js_1.parseMarkdown)(markdown, options);
|
|
41
44
|
}
|
|
42
45
|
/**
|
|
43
|
-
*
|
|
46
|
+
* Detect if a file is a references document.
|
|
47
|
+
* References context enables recognition of reference entries (slugs).
|
|
48
|
+
* @param file - File path
|
|
49
|
+
*/
|
|
50
|
+
function isReferencesDocument(file) {
|
|
51
|
+
const basename = file.split("/").pop() ?? "";
|
|
52
|
+
return basename === "references.md" || file.includes("/references/");
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse a file and return entries, annotation links, and (for Markdown
|
|
56
|
+
* files) a Document with front-matter attributes.
|
|
44
57
|
*
|
|
45
58
|
* Source files (`.rs`, `.java`, `.c`, `.cpp`, etc.) are parsed with
|
|
46
|
-
* tree-sitter to extract doc comment entries
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param content - File content
|
|
50
|
-
* @param options - Must include `file` path for extension detection
|
|
51
|
-
* @returns Array of parsed entries
|
|
59
|
+
* tree-sitter to extract doc comment entries; no front matter is
|
|
60
|
+
* recognized on source files.
|
|
52
61
|
*/
|
|
53
62
|
async function parseFile(content, options) {
|
|
54
63
|
const ext = (0, path_1.extname)(options.file);
|
|
55
64
|
if ((0, grammars_js_1.isSupportedExtension)(ext)) {
|
|
56
65
|
const language = await (0, grammars_js_1.loadGrammar)(ext);
|
|
57
|
-
|
|
66
|
+
const result = (0, source_js_1.parseSource)(content, {
|
|
67
|
+
file: options.file,
|
|
68
|
+
language,
|
|
69
|
+
});
|
|
70
|
+
return { entries: result.entries, diagnostics: [] };
|
|
58
71
|
}
|
|
59
|
-
|
|
72
|
+
const fm = (0, frontmatter_js_1.extractFrontMatter)(content, { file: options.file });
|
|
73
|
+
const body = fm.hadFrontMatter ? fm.markdown : content;
|
|
74
|
+
const isReferencesDoc = isReferencesDocument(options.file);
|
|
75
|
+
const entries = (0, markdown_js_1.parseMarkdown)(body, {
|
|
76
|
+
file: options.file,
|
|
77
|
+
isReferencesDoc,
|
|
78
|
+
});
|
|
79
|
+
const document = fm.hadFrontMatter
|
|
80
|
+
? {
|
|
81
|
+
file: options.file,
|
|
82
|
+
attributes: fm.attributes,
|
|
83
|
+
properties: {},
|
|
84
|
+
}
|
|
85
|
+
: undefined;
|
|
86
|
+
return {
|
|
87
|
+
entries,
|
|
88
|
+
document,
|
|
89
|
+
diagnostics: fm.diagnostics,
|
|
90
|
+
};
|
|
60
91
|
}
|
|
61
92
|
/**
|
|
62
93
|
* Detect table and figure captions in a Markdown string.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module parser/source
|
|
3
3
|
*
|
|
4
|
-
* Source-code doc-comment parser. Extracts MarkSpec
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Source-code doc-comment parser. Extracts MarkSpec entry blocks from doc
|
|
5
|
+
* comments in Rust, Kotlin, C, C++, and Java source files. Delegates parsed
|
|
6
|
+
* content to the markdown parser for entry extraction.
|
|
7
7
|
*/
|
|
8
8
|
import Parser from "web-tree-sitter";
|
|
9
9
|
import type { Entry } from "../model/mod.js";
|
|
@@ -14,16 +14,20 @@ export interface ParseSourceOptions {
|
|
|
14
14
|
/** Pre-loaded tree-sitter language grammar. */
|
|
15
15
|
readonly language: Parser.Language;
|
|
16
16
|
}
|
|
17
|
+
/** Result of parsing a source file. */
|
|
18
|
+
export interface ParseSourceResult {
|
|
19
|
+
/** Entries found in doc comment blocks. */
|
|
20
|
+
readonly entries: Entry[];
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
|
-
* Parse a source file and return
|
|
23
|
+
* Parse a source file and return entries extracted from doc comments.
|
|
19
24
|
*
|
|
20
25
|
* Uses tree-sitter to parse the source, walks the AST to find doc comment
|
|
21
|
-
* nodes, strips comment prefixes, and delegates to the markdown parser
|
|
22
|
-
*
|
|
26
|
+
* nodes, strips comment prefixes, and delegates to the markdown parser for
|
|
27
|
+
* entry extraction. Doc comments that don't contain entry blocks are ignored.
|
|
23
28
|
*
|
|
24
29
|
* @param content - Source file text
|
|
25
30
|
* @param options - Parse options (language grammar, file path)
|
|
26
|
-
* @returns Array of parsed entries with `source: "doc-comment"`
|
|
27
31
|
*/
|
|
28
|
-
export declare function parseSource(content: string, options: ParseSourceOptions):
|
|
32
|
+
export declare function parseSource(content: string, options: ParseSourceOptions): ParseSourceResult;
|
|
29
33
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/parser/source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CACpC;AAYD
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/parser/source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CACpC;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;CAC3B;AAYD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CAsCnB"}
|
package/script/parser/source.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @module parser/source
|
|
4
4
|
*
|
|
5
|
-
* Source-code doc-comment parser. Extracts MarkSpec
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Source-code doc-comment parser. Extracts MarkSpec entry blocks from doc
|
|
6
|
+
* comments in Rust, Kotlin, C, C++, and Java source files. Delegates parsed
|
|
7
|
+
* content to the markdown parser for entry extraction.
|
|
8
8
|
*/
|
|
9
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -14,15 +14,14 @@ exports.parseSource = parseSource;
|
|
|
14
14
|
const web_tree_sitter_1 = __importDefault(require("web-tree-sitter"));
|
|
15
15
|
const markdown_js_1 = require("./markdown.js");
|
|
16
16
|
/**
|
|
17
|
-
* Parse a source file and return
|
|
17
|
+
* Parse a source file and return entries extracted from doc comments.
|
|
18
18
|
*
|
|
19
19
|
* Uses tree-sitter to parse the source, walks the AST to find doc comment
|
|
20
|
-
* nodes, strips comment prefixes, and delegates to the markdown parser
|
|
21
|
-
*
|
|
20
|
+
* nodes, strips comment prefixes, and delegates to the markdown parser for
|
|
21
|
+
* entry extraction. Doc comments that don't contain entry blocks are ignored.
|
|
22
22
|
*
|
|
23
23
|
* @param content - Source file text
|
|
24
24
|
* @param options - Parse options (language grammar, file path)
|
|
25
|
-
* @returns Array of parsed entries with `source: "doc-comment"`
|
|
26
25
|
*/
|
|
27
26
|
function parseSource(content, options) {
|
|
28
27
|
const file = options.file ?? "<unknown>";
|
|
@@ -36,20 +35,28 @@ function parseSource(content, options) {
|
|
|
36
35
|
const markdown = wrapAsListItem(block.lines);
|
|
37
36
|
const parsed = (0, markdown_js_1.parseMarkdown)(markdown, { file });
|
|
38
37
|
for (const entry of parsed) {
|
|
38
|
+
const location = {
|
|
39
|
+
file,
|
|
40
|
+
line: block.startLine,
|
|
41
|
+
column: block.startColumn,
|
|
42
|
+
};
|
|
39
43
|
entries.push({
|
|
40
44
|
...entry,
|
|
41
45
|
source: "doc-comment",
|
|
42
|
-
location
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
location,
|
|
47
|
+
properties: {
|
|
48
|
+
file: {
|
|
49
|
+
path: file,
|
|
50
|
+
line: block.startLine,
|
|
51
|
+
column: block.startColumn,
|
|
52
|
+
},
|
|
46
53
|
},
|
|
47
54
|
});
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
tree.delete();
|
|
51
58
|
parser.delete();
|
|
52
|
-
return entries;
|
|
59
|
+
return { entries };
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* Recursively walk the tree-sitter AST and collect doc comment blocks.
|
|
@@ -101,7 +108,7 @@ function walkForDocComments(node, blocks) {
|
|
|
101
108
|
});
|
|
102
109
|
continue;
|
|
103
110
|
}
|
|
104
|
-
// Non-comment node — flush pending line comments, then recurse
|
|
111
|
+
// Non-comment node — flush pending line comments, then recurse.
|
|
105
112
|
flushLineBlock();
|
|
106
113
|
if (child.childCount > 0) {
|
|
107
114
|
walkForDocComments(child, blocks);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/cache
|
|
3
|
+
*
|
|
4
|
+
* XDG-compliant cache directory resolution for profile storage.
|
|
5
|
+
* Profiles fetched from git or npm are cached globally so they can
|
|
6
|
+
* be shared across projects.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Environment variables consulted for cache directory resolution.
|
|
10
|
+
* Injectable for testing — production code passes `Deno.env.toObject()`.
|
|
11
|
+
*/
|
|
12
|
+
export interface CacheEnv {
|
|
13
|
+
readonly XDG_CACHE_HOME?: string;
|
|
14
|
+
readonly HOME?: string;
|
|
15
|
+
readonly LOCALAPPDATA?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the global markspec cache directory (XDG-compliant).
|
|
19
|
+
*
|
|
20
|
+
* - `$XDG_CACHE_HOME/markspec` if set (any platform)
|
|
21
|
+
* - macOS: `~/Library/Caches/markspec`
|
|
22
|
+
* - Windows: `%LOCALAPPDATA%/markspec/cache`
|
|
23
|
+
* - Linux/other: `~/.cache/markspec`
|
|
24
|
+
*
|
|
25
|
+
* @param env - Environment variables (injectable for tests)
|
|
26
|
+
* @param platform - OS platform string (injectable for tests; defaults to `Deno.build.os`)
|
|
27
|
+
*/
|
|
28
|
+
export declare function cacheDir(env?: CacheEnv, platform?: string): string;
|
|
29
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/profile/cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,GAAG,CAAC,EAAE,QAAQ,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAsBR"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module core/profile/cache
|
|
4
|
+
*
|
|
5
|
+
* XDG-compliant cache directory resolution for profile storage.
|
|
6
|
+
* Profiles fetched from git or npm are cached globally so they can
|
|
7
|
+
* be shared across projects.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.cacheDir = cacheDir;
|
|
11
|
+
const path_1 = require("@std/path");
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the global markspec cache directory (XDG-compliant).
|
|
14
|
+
*
|
|
15
|
+
* - `$XDG_CACHE_HOME/markspec` if set (any platform)
|
|
16
|
+
* - macOS: `~/Library/Caches/markspec`
|
|
17
|
+
* - Windows: `%LOCALAPPDATA%/markspec/cache`
|
|
18
|
+
* - Linux/other: `~/.cache/markspec`
|
|
19
|
+
*
|
|
20
|
+
* @param env - Environment variables (injectable for tests)
|
|
21
|
+
* @param platform - OS platform string (injectable for tests; defaults to `Deno.build.os`)
|
|
22
|
+
*/
|
|
23
|
+
function cacheDir(env, platform) {
|
|
24
|
+
const e = env ?? envFromDeno();
|
|
25
|
+
const os = platform ?? Deno.build.os;
|
|
26
|
+
if (e.XDG_CACHE_HOME) {
|
|
27
|
+
return (0, path_1.join)(e.XDG_CACHE_HOME, "markspec");
|
|
28
|
+
}
|
|
29
|
+
if (os === "darwin") {
|
|
30
|
+
const home = e.HOME ?? "/tmp";
|
|
31
|
+
return (0, path_1.join)(home, "Library", "Caches", "markspec");
|
|
32
|
+
}
|
|
33
|
+
if (os === "windows") {
|
|
34
|
+
const localAppData = e.LOCALAPPDATA ??
|
|
35
|
+
(0, path_1.join)(e.HOME ?? "C:\\Users\\default", "AppData", "Local");
|
|
36
|
+
return (0, path_1.join)(localAppData, "markspec", "cache");
|
|
37
|
+
}
|
|
38
|
+
// Linux and others — XDG default
|
|
39
|
+
const home = e.HOME ?? "/tmp";
|
|
40
|
+
return (0, path_1.join)(home, ".cache", "markspec");
|
|
41
|
+
}
|
|
42
|
+
function envFromDeno() {
|
|
43
|
+
return {
|
|
44
|
+
XDG_CACHE_HOME: Deno.env.get("XDG_CACHE_HOME"),
|
|
45
|
+
HOME: Deno.env.get("HOME"),
|
|
46
|
+
LOCALAPPDATA: Deno.env.get("LOCALAPPDATA"),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/chain
|
|
3
|
+
*
|
|
4
|
+
* Profile chain loader. Walks the `extends:` pointer from a leaf specifier
|
|
5
|
+
* up to the root, producing a multi-tier {@linkcode ProfileChain} ordered
|
|
6
|
+
* root → leaf.
|
|
7
|
+
*
|
|
8
|
+
* Supports both local and git specifiers, with cycle + depth detection. Git
|
|
9
|
+
* specifiers route through {@linkcode resolveGitSpecifier} (per-project
|
|
10
|
+
* shallow+sparse clone cache); local specifiers route through
|
|
11
|
+
* {@linkcode resolveLocalSpecifier}. The chain's {@linkcode EffectiveProfile}
|
|
12
|
+
* is produced by {@linkcode mergeChain}.
|
|
13
|
+
*/
|
|
14
|
+
import type { ReadFile } from "../config/mod.js";
|
|
15
|
+
import type { Diagnostic, ProfileChain, ProfileSpecifier } from "../model/mod.js";
|
|
16
|
+
import type { AppendFile, RunGit } from "./git-cache.js";
|
|
17
|
+
/** Result of loading a profile chain. */
|
|
18
|
+
export interface LoadChainResult {
|
|
19
|
+
readonly chain: ProfileChain | null;
|
|
20
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
21
|
+
}
|
|
22
|
+
/** Options accepted by {@linkcode loadChain}. */
|
|
23
|
+
export interface LoadChainOptions {
|
|
24
|
+
readonly runGit?: RunGit;
|
|
25
|
+
readonly appendFile?: AppendFile;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load a profile chain from a specifier, walking the `extends:` pointer up
|
|
29
|
+
* to the root. The returned chain's tiers are ordered root → leaf, so
|
|
30
|
+
* `tiers[0]` is the ultimate ancestor and `tiers[last]` is the leaf
|
|
31
|
+
* specified by the caller.
|
|
32
|
+
*
|
|
33
|
+
* @param specifier - The leaf specifier (from `.markspec.yaml`)
|
|
34
|
+
* @param contextDir - Directory the specifier was declared in (for local
|
|
35
|
+
* path resolution)
|
|
36
|
+
* @param projectRoot - Absolute path of the project root (used to locate
|
|
37
|
+
* the `.markspec/cache/` directory for git specifiers)
|
|
38
|
+
* @param readFile - File reader abstraction
|
|
39
|
+
* @param opts - Injectable runners for git-cache operations (optional)
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadChain(specifier: ProfileSpecifier, contextDir: string, projectRoot: string, readFile: ReadFile, opts?: LoadChainOptions): Promise<LoadChainResult>;
|
|
42
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/profile/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EAGV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAYzD,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA+G1B"}
|