@orkestrel/guide 0.0.4 → 0.0.6
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/src/core/index.d.cts +904 -9
- package/dist/src/core/index.d.ts +904 -9
- package/package.json +18 -13
- package/dist/src/core/Guide.d.ts +0 -30
- package/dist/src/core/Source.d.ts +0 -35
- package/dist/src/core/constants.d.ts +0 -22
- package/dist/src/core/factories.d.ts +0 -86
- package/dist/src/core/helpers.d.ts +0 -196
- package/dist/src/core/parsers.d.ts +0 -218
- package/dist/src/core/shapers.d.ts +0 -54
- package/dist/src/core/types.d.ts +0 -148
- package/dist/src/core/validators.d.ts +0 -58
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,9 +1,904 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ArrayShape } from '@orkestrel/contract';
|
|
2
|
+
import { BlockNode } from '@orkestrel/markdown';
|
|
3
|
+
import { ContractInterface } from '@orkestrel/contract';
|
|
4
|
+
import { Guard } from '@orkestrel/contract';
|
|
5
|
+
import { InlineNode } from '@orkestrel/markdown';
|
|
6
|
+
import { LiteralShape } from '@orkestrel/contract';
|
|
7
|
+
import { MarkdownDocument } from '@orkestrel/markdown';
|
|
8
|
+
import { ObjectShape } from '@orkestrel/contract';
|
|
9
|
+
import { StringShape } from '@orkestrel/contract';
|
|
10
|
+
import { TableNode } from '@orkestrel/markdown';
|
|
11
|
+
import { UnionShape } from '@orkestrel/contract';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The link hrefs found within one table cell's inline content.
|
|
15
|
+
*
|
|
16
|
+
* @param cell - The cell's inline nodes
|
|
17
|
+
* @returns The cell's link hrefs, in walk order
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* cellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function cellLinks(cell: readonly InlineNode[]): readonly string[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create a structured {@link GuideInterface} view over one guide's markdown
|
|
28
|
+
* source — parses once and caches its `sections` / `surface` / `methods` /
|
|
29
|
+
* `links` / `tests` projections.
|
|
30
|
+
*
|
|
31
|
+
* @param source - The guide's markdown source text
|
|
32
|
+
* @returns A working {@link GuideInterface}
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { createGuide } from '@orkestrel/guide'
|
|
37
|
+
*
|
|
38
|
+
* const guide = createGuide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
|
|
39
|
+
* guide.surface() // [{ name: 'X', kind: 'class' }]
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function createGuide(source: string): GuideInterface;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Compile the {@link manifestEntryShape} into a {@link ContractInterface} for
|
|
46
|
+
* {@link ManifestEntry} — a guard, coercing parser, JSON Schema, and seeded
|
|
47
|
+
* generator from one shape declaration (AGENTS §14).
|
|
48
|
+
*
|
|
49
|
+
* @returns A `ManifestEntry` contract bundling `schema` / `is` / `parse` / `generate`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { createManifestEntryContract } from '@orkestrel/guide/core'
|
|
54
|
+
*
|
|
55
|
+
* const manifestEntry = createManifestEntryContract()
|
|
56
|
+
* manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function createManifestEntryContract(): ContractInterface<ManifestEntry>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Compile the {@link methodGroupShape} into a {@link ContractInterface} for
|
|
63
|
+
* {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded
|
|
64
|
+
* generator from one shape declaration (AGENTS §14).
|
|
65
|
+
*
|
|
66
|
+
* @returns A `MethodGroup` contract bundling `schema` / `is` / `parse` / `generate`
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { createMethodGroupContract } from '@orkestrel/guide/core'
|
|
71
|
+
*
|
|
72
|
+
* const methodGroup = createMethodGroupContract()
|
|
73
|
+
* methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function createMethodGroupContract(): ContractInterface<MethodGroup>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Create a pure {@link SourceInterface} over a consumer-supplied file
|
|
80
|
+
* inventory — see {@link Source}.
|
|
81
|
+
*
|
|
82
|
+
* @param options - The file inventory and module scope to reflect
|
|
83
|
+
* @returns A `SourceInterface` reflecting the given module scope
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { createSource } from '@orkestrel/guide'
|
|
88
|
+
*
|
|
89
|
+
* const source = createSource({
|
|
90
|
+
* files: { 'src/core/Guide.ts': 'export class Guide {}\n' },
|
|
91
|
+
* module: 'src/core',
|
|
92
|
+
* })
|
|
93
|
+
* source.exports() // [{ name: 'Guide', kind: 'class' }]
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function createSource(options: SourceOptions): SourceInterface;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for
|
|
100
|
+
* {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded
|
|
101
|
+
* generator from one shape declaration (AGENTS §14).
|
|
102
|
+
*
|
|
103
|
+
* @returns A `SurfaceSymbol` contract bundling `schema` / `is` / `parse` / `generate`
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { createSurfaceSymbolContract } from '@orkestrel/guide/core'
|
|
108
|
+
*
|
|
109
|
+
* const surfaceSymbol = createSurfaceSymbolContract()
|
|
110
|
+
* surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function createSurfaceSymbolContract(): ContractInterface<SurfaceSymbol>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The body lines of the named `export class` / `export interface` declaration
|
|
117
|
+
* within one file's source text — everything between the head's opening `{`
|
|
118
|
+
* and the column-0 closing `}`.
|
|
119
|
+
*
|
|
120
|
+
* @param source - The file's source text to search
|
|
121
|
+
* @param keyword - Whether to look for a `class` or an `interface`
|
|
122
|
+
* @param name - The declaration's identifier
|
|
123
|
+
* @returns The declaration's body lines, or an empty array when `source` does not declare it
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* declarationBody('export interface X {\n\twalk(): void\n}\n', 'interface', 'X') // ['\twalk(): void']
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function declarationBody(source: string, keyword: 'class' | 'interface', name: string): readonly string[];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A declaration head joined into a single line, plus the index of the line
|
|
134
|
+
* carrying its opening `{` — how a head that oxfmt wrapped across lines
|
|
135
|
+
* (printWidth 100) is matched as if it were written on one.
|
|
136
|
+
*/
|
|
137
|
+
export declare interface DeclarationHead {
|
|
138
|
+
/** The joined, space-separated head text. */
|
|
139
|
+
readonly text: string;
|
|
140
|
+
/** The index (within the source `lines`) of the line ending in `{`. */
|
|
141
|
+
readonly end: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The callable-member names in a declaration body (per {@link memberMethods}'
|
|
146
|
+
* grammar) whose immediately preceding JSDoc block, within the same body,
|
|
147
|
+
* carries `@example` — the member-level mirror of {@link examplesFrom}.
|
|
148
|
+
*
|
|
149
|
+
* @param lines - A declaration's body lines
|
|
150
|
+
* @returns The exemplified member names, deduped and sorted
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* exampleMethods(['\t/**', '\t * @example', '\t *' + '/', '\twalk(): void']) // ['walk']
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function exampleMethods(lines: readonly string[]): readonly string[];
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The exported functions in one file's source text whose immediately preceding
|
|
161
|
+
* JSDoc block carries `@example` — walked line by line, tracking the current
|
|
162
|
+
* comment block; the block resets on any non-comment, non-export line so an
|
|
163
|
+
* `@example` never attaches to a declaration it does not directly precede.
|
|
164
|
+
*
|
|
165
|
+
* @param source - The file's source text
|
|
166
|
+
* @returns The exported function names with an `@example`, in file order
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\n')
|
|
171
|
+
* examplesFrom(block) // ['walk']
|
|
172
|
+
* examplesFrom('export function walk() {}\n') // []
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function examplesFrom(source: string): readonly string[];
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The declaration kind a documented / exported symbol carries — the half of the
|
|
179
|
+
* bijection key (alongside its name) a `## Surface` table's `Kind` column encodes.
|
|
180
|
+
*/
|
|
181
|
+
export declare type ExportKind = 'type' | 'interface' | 'const' | 'function' | 'class';
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The module-scope exports declared in one file's source text — matches
|
|
185
|
+
* `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
|
|
186
|
+
* by (kind, name). A generator export (`export function* walk`) scans as kind
|
|
187
|
+
* `function` — its trailing `*` is stripped before the {@link ExportKind} check.
|
|
188
|
+
*
|
|
189
|
+
* @param source - The file's source text
|
|
190
|
+
* @returns The file's exported symbols, in file order
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* exportsFrom('export class Markdown {}\n') // [{ name: 'Markdown', kind: 'class' }]
|
|
195
|
+
* exportsFrom('export function* walk() {}\n') // [{ name: 'walk', kind: 'function' }]
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export declare function exportsFrom(source: string): readonly SurfaceSymbol[];
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The link `href` schemes a guides-parity link check skips as external — a link
|
|
202
|
+
* with one of these prefixes (or a bare `#` anchor, handled separately in
|
|
203
|
+
* `isExternalLink`) is never resolved against the filesystem.
|
|
204
|
+
*/
|
|
205
|
+
export declare const EXTERNAL_SCHEMES: readonly string[];
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Every link href in the guide document, including table cells — a full,
|
|
209
|
+
* depth-first walk of the whole AST.
|
|
210
|
+
*
|
|
211
|
+
* @param document - The parsed guide document
|
|
212
|
+
* @returns Every link's href, in walk order
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* extractLinks(document) // ['../../src/core/helpers.ts', 'https://example.com']
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export declare function extractLinks(document: MarkdownDocument): readonly string[];
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* One {@link MethodGroup} per documented behavioral interface in `## Methods` —
|
|
223
|
+
* an H4 with a code span sets the current interface, and the table immediately
|
|
224
|
+
* following becomes its documented methods.
|
|
225
|
+
*
|
|
226
|
+
* @param document - The parsed guide document
|
|
227
|
+
* @returns The documented method groups, in document order
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* extractMethods(document) // [{ interface: 'MarkdownInterface', methods: ['walk', ...] }]
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export declare function extractMethods(document: MarkdownDocument): readonly MethodGroup[];
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Every ```ts fenced code block's body text anywhere in the guide document —
|
|
238
|
+
* a full AST walk so a fence nested inside a blockquote or list still counts.
|
|
239
|
+
*
|
|
240
|
+
* @param document - The parsed guide document
|
|
241
|
+
* @returns Every `ts`-lang fence's verbatim code, in walk order
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* extractPatterns(document) // ["import { X } from './x.js'\nX()"]
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export declare function extractPatterns(document: MarkdownDocument): readonly string[];
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Every `## Surface` identifier the guide documents — each table row's column 0
|
|
252
|
+
* code span (the name) paired with its `Kind` column (located by header text)
|
|
253
|
+
* UNION every backticked H3 entity heading in the section
|
|
254
|
+
* (`{name: <codeSpan>, kind: 'class'}`), deduped by {@link symbolKey}. A row with
|
|
255
|
+
* no code-span name, or an unrecognized `Kind` text, is skipped.
|
|
256
|
+
*
|
|
257
|
+
* @param document - The parsed guide document
|
|
258
|
+
* @returns The documented surface, in encounter order
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* extractSurface(document) // [{ name: 'Markdown', kind: 'class' }, ...]
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export declare function extractSurface(document: MarkdownDocument): readonly SurfaceSymbol[];
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* The relative test links declared under `## Tests` — every link href found
|
|
269
|
+
* within that section only.
|
|
270
|
+
*
|
|
271
|
+
* @param document - The parsed guide document
|
|
272
|
+
* @returns The `## Tests` section's link hrefs, in walk order
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* extractTests(document) // ['../../tests/src/core/Markdown.test.ts', ...]
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
export declare function extractTests(document: MarkdownDocument): readonly string[];
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Parse a fence's `import` statements into per-specifier imported identifier
|
|
283
|
+
* names — handles `import type`, mixed multiline braces, and `x as y` aliases
|
|
284
|
+
* (resolved to the local name `x`... the ORIGINAL exported name, since it is
|
|
285
|
+
* the export that must exist in `source.exports()`).
|
|
286
|
+
*
|
|
287
|
+
* @param fence - A ```ts Patterns fence's verbatim body text
|
|
288
|
+
* @returns One entry per `import ... from 'specifier'` statement, in fence order
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* fenceImports("import { a, b as c } from 'x'\n") // [{ specifier: 'x', names: ['a', 'b'] }]
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
export declare function fenceImports(fence: string): readonly {
|
|
296
|
+
specifier: string;
|
|
297
|
+
names: readonly string[];
|
|
298
|
+
}[];
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The names present in `names` but absent from `source` — the set-difference
|
|
302
|
+
* behind a both-directions bijection assertion.
|
|
303
|
+
*
|
|
304
|
+
* @param names - The candidate names
|
|
305
|
+
* @param source - The names to compare against
|
|
306
|
+
* @returns The names in `names` that are not in `source`
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* findMissing(['a', 'b'], ['a']) // ['b']
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export declare function findMissing(names: readonly string[], source: readonly string[]): readonly string[];
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The names in `names` that have no example — a fence containing the name at a
|
|
317
|
+
* word boundary in `fences`, or a membership in `examples`, both count as
|
|
318
|
+
* "has an example"; presence-only, fence and JSDoc content are never checked.
|
|
319
|
+
*
|
|
320
|
+
* @param names - The candidate symbol/member names to check
|
|
321
|
+
* @param fences - The guide's ```ts Patterns fence bodies to search
|
|
322
|
+
* @param examples - The names already known to carry an `@example` JSDoc block
|
|
323
|
+
* @returns The names in `names` with no fence mention and no `@example`
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* findUnexampled(['walk', 'fold'], ['walk()'], []) // ['fold']
|
|
328
|
+
* findUnexampled(['walk'], [], ['walk']) // []
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export declare function findUnexampled(names: readonly string[], fences: readonly string[], examples: readonly string[]): readonly string[];
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The first code-span value found by descending an inline node list, following
|
|
335
|
+
* into `emphasis` / `link` children — the extraction rule behind a Surface or
|
|
336
|
+
* Methods table row's first-column identifier.
|
|
337
|
+
*
|
|
338
|
+
* @param nodes - The inline nodes to search
|
|
339
|
+
* @returns The first code span's literal text, or `undefined` when none is found
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* firstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
export declare function firstCode(nodes: readonly InlineNode[]): string | undefined;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* A stateful, structured view over one parsed guide — the five documented
|
|
350
|
+
* projections (`sections` / `surface` / `methods` / `links` / `tests`) are
|
|
351
|
+
* extracted once at construction and cached.
|
|
352
|
+
*
|
|
353
|
+
* @remarks
|
|
354
|
+
* Pure: parses `source` once via `@orkestrel/markdown` and never touches the
|
|
355
|
+
* filesystem — `Guide` has no notion of "where" the guide came from, only its
|
|
356
|
+
* markdown text. Every accessor returns the same cached, readonly array on
|
|
357
|
+
* every call.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* import { Guide } from '@orkestrel/guide/core'
|
|
362
|
+
*
|
|
363
|
+
* const guide = new Guide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
|
|
364
|
+
* guide.surface() // [{ name: 'X', kind: 'class' }]
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
export declare class Guide implements GuideInterface {
|
|
368
|
+
#private;
|
|
369
|
+
constructor(source: string);
|
|
370
|
+
sections(): readonly string[];
|
|
371
|
+
surface(): readonly SurfaceSymbol[];
|
|
372
|
+
methods(): readonly MethodGroup[];
|
|
373
|
+
links(): readonly string[];
|
|
374
|
+
tests(): readonly string[];
|
|
375
|
+
patterns(): readonly string[];
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The structured, pure view of one parsed guide — every projection extracted and
|
|
380
|
+
* cached once at construction (see {@link createGuide}).
|
|
381
|
+
*/
|
|
382
|
+
export declare interface GuideInterface {
|
|
383
|
+
/** The `##` heading names, in document order — the non-vacuousness guard for section presence. */
|
|
384
|
+
sections(): readonly string[];
|
|
385
|
+
/** Every `## Surface` identifier + kind — table rows union backticked entity headings. */
|
|
386
|
+
surface(): readonly SurfaceSymbol[];
|
|
387
|
+
/** One {@link MethodGroup} per documented behavioral interface in `## Methods`. */
|
|
388
|
+
methods(): readonly MethodGroup[];
|
|
389
|
+
/**
|
|
390
|
+
* Every link href in the guide, including table cells.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```ts
|
|
394
|
+
* guide.links() // ['../../src/core/helpers.ts']
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
links(): readonly string[];
|
|
398
|
+
/**
|
|
399
|
+
* The relative test links declared under `## Tests`.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```ts
|
|
403
|
+
* guide.tests() // ['../../tests/src/core/Guide.test.ts']
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
tests(): readonly string[];
|
|
407
|
+
/**
|
|
408
|
+
* Every fenced `ts` code block's body text, whole document.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* guide.patterns() // ["import { createGuide } from '@orkestrel/guide'"]
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
patterns(): readonly string[];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* The source scope a guide's manifest entry covers — one module directory, or
|
|
420
|
+
* several when a layer guide spans multiple source directories (a core module
|
|
421
|
+
* plus its backend implementations).
|
|
422
|
+
*/
|
|
423
|
+
export declare type GuideModule = string | readonly string[];
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* The module-scope declarations LACKING the `export` keyword in one file's
|
|
427
|
+
* source text — the mirror image of {@link exportsFrom}'s grammar, anchored
|
|
428
|
+
* the same way (column 0, so an indented inner declaration never matches).
|
|
429
|
+
* Scans only the five {@link ExportKind} keywords (`function` / `class` /
|
|
430
|
+
* `const` / `interface` / `type`) — a module-scope `let` or `var` is a
|
|
431
|
+
* different violation class (AGENTS §1 bans `var`; a bare `let` is not a
|
|
432
|
+
* declaration kind this scanner's five-kind grammar covers) and is out of
|
|
433
|
+
* this check's contract.
|
|
434
|
+
*
|
|
435
|
+
* @param source - The file's source text
|
|
436
|
+
* @returns The file's hidden (non-exported) symbols, in file order
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* hiddenFrom('function secretHelper() {}\n') // [{ name: 'secretHelper', kind: 'function' }]
|
|
441
|
+
* hiddenFrom('export class X {}\n') // []
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
export declare function hiddenFrom(source: string): readonly SurfaceSymbol[];
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* The identifier prefix of a code-span text — everything before its first `<`,
|
|
448
|
+
* trimmed. Guide cells and headings may annotate a generic-parameterized name
|
|
449
|
+
* (`MarkdownHandler<TNode, T>`) for readability, but the bijection key is the
|
|
450
|
+
* bare identifier the source scanner captures, so both sides must normalize
|
|
451
|
+
* the same way.
|
|
452
|
+
*
|
|
453
|
+
* @param code - A code span's literal text
|
|
454
|
+
* @returns The identifier prefix, or an empty string when `code` is empty
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* identifierOf('MarkdownHandler<TNode, T>') // 'MarkdownHandler'
|
|
459
|
+
* identifierOf('fold') // 'fold'
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
export declare function identifierOf(code: string): string;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Whether `value` is one of the five documented {@link ExportKind} literals — the
|
|
466
|
+
* guard behind extracting a Surface table's `Kind` cell into a typed symbol.
|
|
467
|
+
*
|
|
468
|
+
* @param value - The candidate value
|
|
469
|
+
* @returns `true` when `value` is a valid {@link ExportKind}
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* isExportKind('class') // true
|
|
474
|
+
* isExportKind('enum') // false
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
export declare const isExportKind: Guard<ExportKind>;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Whether a link `href` should be skipped by the guides-parity link checks — an
|
|
481
|
+
* external scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.
|
|
482
|
+
*
|
|
483
|
+
* @param href - The link destination
|
|
484
|
+
* @returns `true` when the link should not be resolved against the filesystem
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* isExternalLink('https://example.com') // true
|
|
489
|
+
* isExternalLink('../helpers.ts') // false
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
export declare function isExternalLink(href: string): boolean;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`
|
|
496
|
+
* manifest row, its `source` accepting either a single directory or several.
|
|
497
|
+
*
|
|
498
|
+
* @param value - The value to test
|
|
499
|
+
* @returns `true` when `value` is a well-formed {@link ManifestEntry}
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
|
|
504
|
+
* isManifestEntry({ concept: 1 }) // false
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
export declare const isManifestEntry: Guard<ManifestEntry>;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Whether `value` is a well-formed {@link MethodGroup} — a backticked
|
|
511
|
+
* `interface` name paired with its documented `methods`.
|
|
512
|
+
*
|
|
513
|
+
* @param value - The value to test
|
|
514
|
+
* @returns `true` when `value` is a well-formed {@link MethodGroup}
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
|
|
519
|
+
* isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
export declare const isMethodGroup: Guard<MethodGroup>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string
|
|
526
|
+
* paired with a valid {@link ExportKind}.
|
|
527
|
+
*
|
|
528
|
+
* @param value - The value to test
|
|
529
|
+
* @returns `true` when `value` is a well-formed {@link SurfaceSymbol}
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true
|
|
534
|
+
* isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
export declare const isSurfaceSymbol: Guard<SurfaceSymbol>;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Join the declaration head starting at `start` into one space-separated
|
|
541
|
+
* line, consuming lines until the first that ends with `{`.
|
|
542
|
+
*
|
|
543
|
+
* @param lines - The file's source lines
|
|
544
|
+
* @param start - The index of the head's first line
|
|
545
|
+
* @returns The joined head, or `undefined` when no line opens a body
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```ts
|
|
549
|
+
* joinHead(['export class X {'], 0) // { text: 'export class X {', end: 0 }
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
export declare function joinHead(lines: readonly string[], start: number): DeclarationHead | undefined;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* The index of a table's `Kind` column, found by its header text so it survives
|
|
556
|
+
* column reordering. The match is exact and case-sensitive (`'Kind'`) — a table
|
|
557
|
+
* without that exact header contributes no symbols to the surface it feeds.
|
|
558
|
+
*
|
|
559
|
+
* @param table - The table to inspect
|
|
560
|
+
* @returns The `Kind` column's index, or `undefined` when the table has no `Kind` header
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```ts
|
|
564
|
+
* kindIndex(table) // 1, or undefined
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
export declare function kindIndex(table: TableNode): number | undefined;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The `## By concept` heading text the manifest's run-map table is keyed on.
|
|
571
|
+
*/
|
|
572
|
+
export declare const MANIFEST: string;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* One `## By concept` manifest row — a single guides-parity check target, paths
|
|
576
|
+
* normalized to workspace root.
|
|
577
|
+
*/
|
|
578
|
+
export declare interface ManifestEntry {
|
|
579
|
+
/** The concept name — the row's first cell, flattened. */
|
|
580
|
+
readonly concept: string;
|
|
581
|
+
/** The guide `.md` this entry documents, root-relative. */
|
|
582
|
+
readonly spec: string;
|
|
583
|
+
/** The source directory (or directories) the guide documents. */
|
|
584
|
+
readonly source: GuideModule;
|
|
585
|
+
/** The tests directory the guide's `## Tests` links resolve against. */
|
|
586
|
+
readonly tests: string;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* The shape of a {@link ManifestEntry} — one `## By concept` manifest row,
|
|
591
|
+
* `source` accepting either a single directory or several.
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```ts
|
|
595
|
+
* import { createContract } from '@orkestrel/contract'
|
|
596
|
+
* import { manifestEntryShape } from '@orkestrel/guide/core'
|
|
597
|
+
*
|
|
598
|
+
* const manifestEntry = createContract(manifestEntryShape)
|
|
599
|
+
* manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
export declare const manifestEntryShape: ObjectShape<{
|
|
603
|
+
concept: StringShape;
|
|
604
|
+
spec: StringShape;
|
|
605
|
+
source: UnionShape<readonly [ StringShape, ArrayShape<StringShape>]>;
|
|
606
|
+
tests: StringShape;
|
|
607
|
+
}, false>;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* The member lines declaring a callable member: plain, `async`, generator
|
|
611
|
+
* (`*`), and optional (`records?(`) methods all count; getters, setters,
|
|
612
|
+
* `static` members, and `#` privates never do (their keyword or `#` breaks
|
|
613
|
+
* the `name(` shape).
|
|
614
|
+
*
|
|
615
|
+
* @param lines - A declaration's body lines
|
|
616
|
+
* @returns The declared method names, deduped and sorted
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```ts
|
|
620
|
+
* memberMethods(['\tmap(): void', '\tfilter(): void']) // ['filter', 'map']
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
export declare function memberMethods(lines: readonly string[]): readonly string[];
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* One `#### \`Interface\`` block in a guide's `## Methods` section — the
|
|
627
|
+
* documented member names of one behavioral interface.
|
|
628
|
+
*/
|
|
629
|
+
export declare interface MethodGroup {
|
|
630
|
+
/** The backticked interface name. */
|
|
631
|
+
readonly interface: string;
|
|
632
|
+
/** Its documented Method-cell identifiers, in table order. */
|
|
633
|
+
readonly methods: readonly string[];
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* The shape of a {@link MethodGroup} — a backticked `interface` name paired
|
|
638
|
+
* with its documented `methods`.
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```ts
|
|
642
|
+
* import { createContract } from '@orkestrel/contract'
|
|
643
|
+
* import { methodGroupShape } from '@orkestrel/guide/core'
|
|
644
|
+
*
|
|
645
|
+
* const methodGroup = createContract(methodGroupShape)
|
|
646
|
+
* methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
export declare const methodGroupShape: ObjectShape<{
|
|
650
|
+
interface: StringShape;
|
|
651
|
+
methods: ArrayShape<StringShape>;
|
|
652
|
+
}, false>;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* The `## Methods` heading text a guide's documented interface-methods section is keyed on.
|
|
656
|
+
*/
|
|
657
|
+
export declare const METHODS: string;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* The symbol-key set-difference between two symbol lists — `symbols` present but
|
|
661
|
+
* absent from `source`, compared by {@link symbolKey} so a symbol can drift in
|
|
662
|
+
* neither name nor kind.
|
|
663
|
+
*
|
|
664
|
+
* @param symbols - The candidate symbols
|
|
665
|
+
* @param source - The symbols to compare against
|
|
666
|
+
* @returns The symbol keys in `symbols` that are not in `source`
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```ts
|
|
670
|
+
* missingSymbols([{ name: 'X', kind: 'class' }], []) // ['class X']
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
export declare function missingSymbols(symbols: readonly SurfaceSymbol[], source: readonly SurfaceSymbol[]): readonly string[];
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* A module scope normalized to its directory list — a single directory
|
|
677
|
+
* becomes a one-element list so every scanner walks the same shape.
|
|
678
|
+
*
|
|
679
|
+
* @param module - The module scope to normalize
|
|
680
|
+
* @returns The directory list `module` denotes
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```ts
|
|
684
|
+
* moduleDirs('src/core') // ['src/core']
|
|
685
|
+
* moduleDirs(['src/core', 'src/browser']) // ['src/core', 'src/browser']
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
export declare function moduleDirs(module: GuideModule): readonly string[];
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* The file inventory's keys belonging to a {@link GuideModule} scope, sorted —
|
|
692
|
+
* a key belongs when it starts with one of the scope's directories, ends in
|
|
693
|
+
* `.ts`, and is neither that directory's `index.ts` nor a `.test.ts` file.
|
|
694
|
+
*
|
|
695
|
+
* @param files - The workspace file inventory, root-relative path → file text
|
|
696
|
+
* @param module - The module scope to filter to
|
|
697
|
+
* @returns The scope's file keys, root-relative and sorted
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* moduleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']
|
|
702
|
+
* ```
|
|
703
|
+
*/
|
|
704
|
+
export declare function moduleKeys(files: Readonly<Record<string, string>>, module: GuideModule): readonly string[];
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Parse a `## By concept` manifest table into its {@link ManifestEntry} rows —
|
|
708
|
+
* each row's Concept cell (flattened text), Spec / Tests cells (a single link
|
|
709
|
+
* href, resolved against `base`), and Source cell (every link href, resolved
|
|
710
|
+
* against `base`; one directory collapses to a `string`, several become a
|
|
711
|
+
* `readonly string[]`). A row missing a concept, spec link, tests link, or
|
|
712
|
+
* source link is skipped as malformed.
|
|
713
|
+
*
|
|
714
|
+
* @param markdown - The manifest markdown source (e.g. `guides/README.md`'s content)
|
|
715
|
+
* @param base - A single directory name relative to the workspace root that the manifest's
|
|
716
|
+
* links are resolved against (e.g. `'guides'`) — {@link resolveLink}'s arithmetic supports
|
|
717
|
+
* only one path segment, so a deeper or nested base is not supported
|
|
718
|
+
* @returns The manifest's entries, in row order
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```ts
|
|
722
|
+
* parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]
|
|
723
|
+
* ```
|
|
724
|
+
*/
|
|
725
|
+
export declare function parseManifest(markdown: string, base: string): readonly ManifestEntry[];
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Resolve a relative link `target` against `from` and normalize the result — `from`
|
|
729
|
+
* is treated as a file (its directory is everything before the last `/`) when it
|
|
730
|
+
* carries a `/`, or as a bare directory itself when it does not; `.` segments drop
|
|
731
|
+
* and `..` segments pop the preceding component, purely (no `node:path`).
|
|
732
|
+
*
|
|
733
|
+
* @param from - The declaring guide path (a file) or manifest base (a directory)
|
|
734
|
+
* @param target - The relative link destination to resolve
|
|
735
|
+
* @returns The normalized, workspace-root-relative path
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```ts
|
|
739
|
+
* resolveLink('guides/src/markdown.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'
|
|
740
|
+
* resolveLink('guides', '../src/core') // 'src/core'
|
|
741
|
+
* ```
|
|
742
|
+
*/
|
|
743
|
+
export declare function resolveLink(from: string, target: string): string;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* The block nodes under the named `##` heading, up to the next `##`-or-higher
|
|
747
|
+
* heading (or the document's end) — the section-scoping window `extractSurface` /
|
|
748
|
+
* `extractMethods` walk over.
|
|
749
|
+
*
|
|
750
|
+
* @param document - The parsed guide document
|
|
751
|
+
* @param heading - The `##` heading text to scope to (e.g. `Surface`)
|
|
752
|
+
* @returns The blocks belonging to that section, in document order
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* sectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`
|
|
757
|
+
* ```
|
|
758
|
+
*/
|
|
759
|
+
export declare function sectionBlocks(document: MarkdownDocument, heading: string): readonly BlockNode[];
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* A pure `SourceInterface` — reflects a module scope's exports and member
|
|
763
|
+
* methods over a consumer-supplied file inventory (AGENTS §22, `PROPOSAL.md`
|
|
764
|
+
* §7), using text-only line scanners rather than the TypeScript compiler API
|
|
765
|
+
* or the filesystem. `Source` never touches disk: the consumer gathers the
|
|
766
|
+
* inventory however their environment allows (`node:fs` in a Node script,
|
|
767
|
+
* `import.meta.glob` in a browser/vitest run) and passes it in as `files`.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```ts
|
|
771
|
+
* import { Source } from '@orkestrel/guide'
|
|
772
|
+
*
|
|
773
|
+
* const source = new Source({
|
|
774
|
+
* files: {
|
|
775
|
+
* 'src/core/Guide.ts': 'export class Guide {}\n',
|
|
776
|
+
* 'src/core/types.ts': 'export interface GuideInterface {\n\tsections(): void\n}\n',
|
|
777
|
+
* },
|
|
778
|
+
* module: 'src/core',
|
|
779
|
+
* })
|
|
780
|
+
* source.exports() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]
|
|
781
|
+
* source.methods('GuideInterface') // ['sections']
|
|
782
|
+
* source.exists('src/core/Guide.ts') // true
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
export declare class Source implements SourceInterface {
|
|
786
|
+
#private;
|
|
787
|
+
constructor(options: SourceOptions);
|
|
788
|
+
exports(): readonly SurfaceSymbol[];
|
|
789
|
+
methods(name: string): readonly string[];
|
|
790
|
+
exists(relative: string): boolean;
|
|
791
|
+
hidden(): readonly SurfaceSymbol[];
|
|
792
|
+
examples(): readonly string[];
|
|
793
|
+
examples(name: string): readonly string[];
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* The reflected source truth a guide's documented surface is checked against —
|
|
798
|
+
* a pure view over a consumer-supplied file inventory (see {@link Source}).
|
|
799
|
+
*/
|
|
800
|
+
export declare interface SourceInterface {
|
|
801
|
+
/** Every module-scope export, including type-only, by (name, kind). */
|
|
802
|
+
exports(): readonly SurfaceSymbol[];
|
|
803
|
+
/** The call-signature members of the `class` / `interface` named `name`. */
|
|
804
|
+
methods(name: string): readonly string[];
|
|
805
|
+
/** Whether a workspace-root-relative path exists in the inventory. */
|
|
806
|
+
exists(relative: string): boolean;
|
|
807
|
+
/**
|
|
808
|
+
* Every module-scope declaration LACKING the `export` keyword (AGENTS §5's
|
|
809
|
+
* export-discipline reflection) — empty on a conforming module.
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
* ```ts
|
|
813
|
+
* source.hidden() // []
|
|
814
|
+
* ```
|
|
815
|
+
*/
|
|
816
|
+
hidden(): readonly SurfaceSymbol[];
|
|
817
|
+
/**
|
|
818
|
+
* The names of every exported function whose preceding JSDoc carries `@example`.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```ts
|
|
822
|
+
* source.examples() // ['createGuide', 'createSource']
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
examples(): readonly string[];
|
|
826
|
+
/**
|
|
827
|
+
* The members of the `class` / `interface` named `name` whose preceding JSDoc,
|
|
828
|
+
* within the declaration body, carries `@example`.
|
|
829
|
+
*
|
|
830
|
+
* @example
|
|
831
|
+
* ```ts
|
|
832
|
+
* source.examples('GuideInterface') // ['links', 'tests', 'patterns']
|
|
833
|
+
* ```
|
|
834
|
+
*/
|
|
835
|
+
examples(name: string): readonly string[];
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* The construction input for a {@link Source} — a consumer-supplied file
|
|
840
|
+
* inventory (root-relative path → file text) plus the module scope to
|
|
841
|
+
* reflect. The consumer gathers `files` however their environment allows
|
|
842
|
+
* (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) —
|
|
843
|
+
* `Source` itself never touches disk.
|
|
844
|
+
*/
|
|
845
|
+
export declare interface SourceOptions {
|
|
846
|
+
/** The workspace's file inventory, root-relative path → file text. */
|
|
847
|
+
readonly files: Readonly<Record<string, string>>;
|
|
848
|
+
/** The source directory (or directories) this guide documents, root-relative. */
|
|
849
|
+
readonly module: GuideModule;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* The `## Surface` heading text a guide's documented exports section is keyed on.
|
|
854
|
+
*/
|
|
855
|
+
export declare const SURFACE: string;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* One documented / exported symbol — its identifier plus its declaration kind.
|
|
859
|
+
*/
|
|
860
|
+
export declare interface SurfaceSymbol {
|
|
861
|
+
/** Its identifier. */
|
|
862
|
+
readonly name: string;
|
|
863
|
+
/** Its declaration kind — half of the bijection key alongside {@link name}. */
|
|
864
|
+
readonly kind: ExportKind;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* The shape of a {@link SurfaceSymbol} — a documented / exported symbol's
|
|
869
|
+
* `name` paired with its {@link ExportKind}.
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```ts
|
|
873
|
+
* import { createContract } from '@orkestrel/contract'
|
|
874
|
+
* import { surfaceSymbolShape } from '@orkestrel/guide/core'
|
|
875
|
+
*
|
|
876
|
+
* const surfaceSymbol = createContract(surfaceSymbolShape)
|
|
877
|
+
* surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
export declare const surfaceSymbolShape: ObjectShape<{
|
|
881
|
+
name: StringShape;
|
|
882
|
+
kind: LiteralShape<readonly ["type", "interface", "const", "function", "class"]>;
|
|
883
|
+
}, false>;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* The bijection key for a surface symbol — its kind and name combined — so a
|
|
887
|
+
* symbol-set comparison diffs (name, kind) pairs rather than names alone.
|
|
888
|
+
*
|
|
889
|
+
* @param symbol - The symbol to key
|
|
890
|
+
* @returns The `${kind} ${name}` key
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```ts
|
|
894
|
+
* symbolKey({ name: 'Markdown', kind: 'class' }) // 'class Markdown'
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
export declare function symbolKey(symbol: SurfaceSymbol): string;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* The `## Tests` heading text a guide's documented test-link section is keyed on.
|
|
901
|
+
*/
|
|
902
|
+
export declare const TESTS: string;
|
|
903
|
+
|
|
904
|
+
export { }
|