@orkestrel/guide 0.0.15 → 0.0.16
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 +12 -12
- package/dist/src/core/index.cjs +323 -229
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +528 -351
- package/dist/src/core/index.d.ts +528 -351
- package/dist/src/core/index.js +306 -214
- package/dist/src/core/index.js.map +1 -1
- package/package.json +9 -10
package/dist/src/core/index.cjs
CHANGED
|
@@ -3,23 +3,41 @@ let _orkestrel_markdown = require("@orkestrel/markdown");
|
|
|
3
3
|
let _orkestrel_contract = require("@orkestrel/contract");
|
|
4
4
|
//#region src/core/constants.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Lists the declaration keywords a documented or exported symbol carries, in
|
|
7
|
+
* the order the reflection grammar names them.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* One frozen list feeds the `ExportKeyword` type, the `isExportKeyword` guard, and
|
|
11
|
+
* `surfaceSymbolShape`, so a keyword cannot be admitted by one and refused by
|
|
12
|
+
* another. Comment and template payload is excluded before reflection, and
|
|
13
|
+
* `enum` is outside this population rather than forbidden by general package
|
|
14
|
+
* policy.
|
|
15
|
+
*/
|
|
16
|
+
var EXPORT_KEYWORDS = Object.freeze([
|
|
17
|
+
"type",
|
|
18
|
+
"interface",
|
|
19
|
+
"const",
|
|
20
|
+
"function",
|
|
21
|
+
"class"
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* Names the `## Surface` heading text a guide's documented exports section is keyed on.
|
|
7
25
|
*/
|
|
8
26
|
var SURFACE = "Surface";
|
|
9
27
|
/**
|
|
10
|
-
*
|
|
28
|
+
* Names the `## Methods` heading text a guide's documented interface-methods section is keyed on.
|
|
11
29
|
*/
|
|
12
30
|
var METHODS = "Methods";
|
|
13
31
|
/**
|
|
14
|
-
*
|
|
32
|
+
* Names the `## Tests` heading text a guide's documented test-link section is keyed on.
|
|
15
33
|
*/
|
|
16
34
|
var TESTS = "Tests";
|
|
17
35
|
/**
|
|
18
|
-
*
|
|
36
|
+
* Names the `## By concept` heading text the manifest's run-map table is keyed on.
|
|
19
37
|
*/
|
|
20
38
|
var MANIFEST = "By concept";
|
|
21
39
|
/**
|
|
22
|
-
*
|
|
40
|
+
* Lists the link `href` schemes a guides-parity link check skips as external — a link
|
|
23
41
|
* with one of these prefixes (or a bare `#` anchor, handled separately in
|
|
24
42
|
* `isExternalLink`) is never resolved against the filesystem.
|
|
25
43
|
*/
|
|
@@ -32,42 +50,43 @@ var EXTERNAL_SCHEMES = Object.freeze([
|
|
|
32
50
|
//#endregion
|
|
33
51
|
//#region src/core/validators.ts
|
|
34
52
|
/**
|
|
35
|
-
*
|
|
36
|
-
* guard behind extracting a Surface table's `Kind` cell into a
|
|
53
|
+
* Checks whether `value` is one of the documented {@link ExportKeyword}
|
|
54
|
+
* literals — the guard behind extracting a Surface table's `Kind` cell into a
|
|
55
|
+
* typed symbol.
|
|
37
56
|
*
|
|
38
57
|
* @param value - The candidate value
|
|
39
|
-
* @returns
|
|
58
|
+
* @returns True if `value` is a valid {@link ExportKeyword}; false otherwise
|
|
40
59
|
*
|
|
41
60
|
* @example
|
|
42
61
|
* ```ts
|
|
43
|
-
*
|
|
44
|
-
*
|
|
62
|
+
* isExportKeyword('class') // true
|
|
63
|
+
* isExportKeyword('enum') // false
|
|
45
64
|
* ```
|
|
46
65
|
*/
|
|
47
|
-
var
|
|
66
|
+
var isExportKeyword = (0, _orkestrel_contract.literalOf)(EXPORT_KEYWORDS);
|
|
48
67
|
/**
|
|
49
|
-
*
|
|
50
|
-
* paired with a valid {@link
|
|
68
|
+
* Checks whether `value` is a well-formed {@link SurfaceSymbol} — a `name`
|
|
69
|
+
* string paired with a valid {@link ExportKeyword}.
|
|
51
70
|
*
|
|
52
71
|
* @param value - The value to test
|
|
53
|
-
* @returns
|
|
72
|
+
* @returns True if `value` is a well-formed {@link SurfaceSymbol}; false otherwise
|
|
54
73
|
*
|
|
55
74
|
* @example
|
|
56
75
|
* ```ts
|
|
57
|
-
* isSurfaceSymbol({ name: 'Markdown',
|
|
58
|
-
* isSurfaceSymbol({ name: 'Markdown',
|
|
76
|
+
* isSurfaceSymbol({ name: 'Markdown', keyword: 'class' }) // true
|
|
77
|
+
* isSurfaceSymbol({ name: 'Markdown', keyword: 'enum' }) // false
|
|
59
78
|
* ```
|
|
60
79
|
*/
|
|
61
80
|
var isSurfaceSymbol = (0, _orkestrel_contract.recordOf)({
|
|
62
81
|
name: _orkestrel_contract.isString,
|
|
63
|
-
|
|
82
|
+
keyword: isExportKeyword
|
|
64
83
|
});
|
|
65
84
|
/**
|
|
66
|
-
*
|
|
85
|
+
* Checks whether `value` is a well-formed {@link MethodGroup} — a backticked
|
|
67
86
|
* `interface` name paired with its documented `methods`.
|
|
68
87
|
*
|
|
69
88
|
* @param value - The value to test
|
|
70
|
-
* @returns
|
|
89
|
+
* @returns True if `value` is a well-formed {@link MethodGroup}; false otherwise
|
|
71
90
|
*
|
|
72
91
|
* @example
|
|
73
92
|
* ```ts
|
|
@@ -80,11 +99,12 @@ var isMethodGroup = (0, _orkestrel_contract.recordOf)({
|
|
|
80
99
|
methods: (0, _orkestrel_contract.arrayOf)(_orkestrel_contract.isString)
|
|
81
100
|
});
|
|
82
101
|
/**
|
|
83
|
-
*
|
|
84
|
-
* manifest row, its `source` accepting either a single directory
|
|
102
|
+
* Checks whether `value` is a well-formed {@link ManifestEntry} — a
|
|
103
|
+
* `## By concept` manifest row, its `source` accepting either a single directory
|
|
104
|
+
* or several.
|
|
85
105
|
*
|
|
86
106
|
* @param value - The value to test
|
|
87
|
-
* @returns
|
|
107
|
+
* @returns True if `value` is a well-formed {@link ManifestEntry}; false otherwise
|
|
88
108
|
*
|
|
89
109
|
* @example
|
|
90
110
|
* ```ts
|
|
@@ -101,7 +121,7 @@ var isManifestEntry = (0, _orkestrel_contract.recordOf)({
|
|
|
101
121
|
//#endregion
|
|
102
122
|
//#region src/core/helpers.ts
|
|
103
123
|
/**
|
|
104
|
-
*
|
|
124
|
+
* Extracts aligned physical source-line records in one character traversal.
|
|
105
125
|
* Real line and block comments and complete template tokens become spaces in
|
|
106
126
|
* {@link SourceLine.code}, while ordinary code, quoted strings, and recognized
|
|
107
127
|
* regex literals retain their columns. Genuine JSDoc opened from reflection
|
|
@@ -590,12 +610,12 @@ function extractSourceLines(source) {
|
|
|
590
610
|
return lines;
|
|
591
611
|
}
|
|
592
612
|
/**
|
|
593
|
-
*
|
|
613
|
+
* Checks whether an opaque inventory key contains only canonical slash-separated
|
|
594
614
|
* segments. Empty, `.` and `..` segments are rejected without rewriting the
|
|
595
615
|
* key; ordinary dotfile segments remain valid.
|
|
596
616
|
*
|
|
597
617
|
* @param key - The opaque inventory key to inspect
|
|
598
|
-
* @returns
|
|
618
|
+
* @returns True if every segment is canonical; false otherwise
|
|
599
619
|
*
|
|
600
620
|
* @example
|
|
601
621
|
* ```ts
|
|
@@ -607,7 +627,7 @@ function hasCanonicalSegments(key) {
|
|
|
607
627
|
return key.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
608
628
|
}
|
|
609
629
|
/**
|
|
610
|
-
*
|
|
630
|
+
* Normalizes a module scope to its canonical directory list. `'.'` represents
|
|
611
631
|
* workspace root; empty, trailing, and dot-segment spellings reduce through
|
|
612
632
|
* {@link resolvePath}, and duplicates are removed in first-seen order.
|
|
613
633
|
*
|
|
@@ -632,7 +652,7 @@ function normalizeDirectories(module) {
|
|
|
632
652
|
return directories;
|
|
633
653
|
}
|
|
634
654
|
/**
|
|
635
|
-
*
|
|
655
|
+
* Computes the stable cache key for a {@link GuideModule}. Directories normalize before
|
|
636
656
|
* joining, so equivalent module spellings share one key. The NUL separator
|
|
637
657
|
* cannot occur in filesystem-backed canonical-segment inventory keys, so no
|
|
638
658
|
* directory boundary can collide with directory text.
|
|
@@ -642,14 +662,14 @@ function normalizeDirectories(module) {
|
|
|
642
662
|
*
|
|
643
663
|
* @example
|
|
644
664
|
* ```ts
|
|
645
|
-
*
|
|
665
|
+
* computeModuleKey(['src/core', 'src/browser']) // 'src/core\0src/browser'
|
|
646
666
|
* ```
|
|
647
667
|
*/
|
|
648
|
-
function
|
|
668
|
+
function computeModuleKey(module) {
|
|
649
669
|
return normalizeDirectories(module).join("\0");
|
|
650
670
|
}
|
|
651
671
|
/**
|
|
652
|
-
*
|
|
672
|
+
* Selects the exact opaque file-inventory keys belonging under any canonical
|
|
653
673
|
* {@link GuideModule} directory, sorted. `'.'` selects canonical root-relative
|
|
654
674
|
* keys without accepting `/`, `./`, or `../` aliases. Every selected exact
|
|
655
675
|
* `index.ts` and every `.test.ts` key is excluded independent of scope order.
|
|
@@ -677,22 +697,22 @@ function selectModuleKeys(files, module) {
|
|
|
677
697
|
return keys.sort();
|
|
678
698
|
}
|
|
679
699
|
/**
|
|
680
|
-
*
|
|
681
|
-
* symbol-set comparison diffs (name,
|
|
700
|
+
* Computes the bijection key for a surface symbol — its keyword and name combined — so a
|
|
701
|
+
* symbol-set comparison diffs (name, keyword) pairs rather than names alone.
|
|
682
702
|
*
|
|
683
703
|
* @param symbol - The symbol to key
|
|
684
|
-
* @returns The `${
|
|
704
|
+
* @returns The `${keyword} ${name}` key
|
|
685
705
|
*
|
|
686
706
|
* @example
|
|
687
707
|
* ```ts
|
|
688
|
-
*
|
|
708
|
+
* computeSymbolKey({ name: 'Markdown', keyword: 'class' }) // 'class Markdown'
|
|
689
709
|
* ```
|
|
690
710
|
*/
|
|
691
|
-
function
|
|
692
|
-
return `${symbol.
|
|
711
|
+
function computeSymbolKey(symbol) {
|
|
712
|
+
return `${symbol.keyword} ${symbol.name}`;
|
|
693
713
|
}
|
|
694
714
|
/**
|
|
695
|
-
*
|
|
715
|
+
* Finds the names present in `names` but absent from `source` — the set-difference
|
|
696
716
|
* behind a both-directions bijection assertion.
|
|
697
717
|
*
|
|
698
718
|
* @param names - The candidate names
|
|
@@ -709,7 +729,7 @@ function findMissing(names, source) {
|
|
|
709
729
|
return names.filter((name) => !existing.has(name));
|
|
710
730
|
}
|
|
711
731
|
/**
|
|
712
|
-
*
|
|
732
|
+
* Finds the fences whose language is absent from the caller's listed languages.
|
|
713
733
|
* Untagged fences are always returned because they have no language to list.
|
|
714
734
|
*
|
|
715
735
|
* @param fences - The guide fences to check
|
|
@@ -727,9 +747,9 @@ function findUnlisted(fences, languages) {
|
|
|
727
747
|
return fences.filter((fence) => fence.language === void 0 || !listed.has(fence.language));
|
|
728
748
|
}
|
|
729
749
|
/**
|
|
730
|
-
*
|
|
731
|
-
* absent from `source`, compared by {@link
|
|
732
|
-
* neither name nor
|
|
750
|
+
* Finds the symbol-key set-difference between two symbol lists — `symbols` present but
|
|
751
|
+
* absent from `source`, compared by {@link computeSymbolKey} so a symbol can drift in
|
|
752
|
+
* neither name nor keyword.
|
|
733
753
|
*
|
|
734
754
|
* @param symbols - The candidate symbols
|
|
735
755
|
* @param source - The symbols to compare against
|
|
@@ -737,14 +757,14 @@ function findUnlisted(fences, languages) {
|
|
|
737
757
|
*
|
|
738
758
|
* @example
|
|
739
759
|
* ```ts
|
|
740
|
-
*
|
|
760
|
+
* findMissingSymbols([{ name: 'X', keyword: 'class' }], []) // ['class X']
|
|
741
761
|
* ```
|
|
742
762
|
*/
|
|
743
|
-
function
|
|
744
|
-
return findMissing(symbols.map(
|
|
763
|
+
function findMissingSymbols(symbols, source) {
|
|
764
|
+
return findMissing(symbols.map(computeSymbolKey), source.map(computeSymbolKey));
|
|
745
765
|
}
|
|
746
766
|
/**
|
|
747
|
-
*
|
|
767
|
+
* Finds the names in `names` that have no example — a fence containing the name at a
|
|
748
768
|
* word boundary in `fences`, or a membership in `examples`, both count as
|
|
749
769
|
* "has an example"; presence-only, fence and JSDoc content are never checked.
|
|
750
770
|
*
|
|
@@ -763,25 +783,25 @@ function findUnexampled(names, fences, examples) {
|
|
|
763
783
|
const exampled = new Set(examples);
|
|
764
784
|
return names.filter((name) => {
|
|
765
785
|
if (exampled.has(name)) return false;
|
|
766
|
-
const boundary = new RegExp(`\\b${name}\\b`);
|
|
786
|
+
const boundary = new RegExp(`\\b${escapeRegExp(name)}\\b`);
|
|
767
787
|
return !fences.some((fence) => boundary.test(fence));
|
|
768
788
|
});
|
|
769
789
|
}
|
|
770
790
|
/**
|
|
771
|
-
*
|
|
772
|
-
* names — handles `import type`, mixed multiline braces, and `x as y` aliases
|
|
773
|
-
*
|
|
774
|
-
*
|
|
791
|
+
* Parses a fence's `import` statements into per-specifier imported identifier
|
|
792
|
+
* names — handles `import type`, mixed multiline braces, and `x as y` aliases,
|
|
793
|
+
* resolving each alias to the exported name `x` because that is the name the
|
|
794
|
+
* checked barrel surface must hold.
|
|
775
795
|
*
|
|
776
796
|
* @param fence - A ```ts Patterns fence's verbatim body text
|
|
777
797
|
* @returns One entry per `import ... from 'specifier'` statement, in fence order
|
|
778
798
|
*
|
|
779
799
|
* @example
|
|
780
800
|
* ```ts
|
|
781
|
-
*
|
|
801
|
+
* extractFenceImports("import { a, b as c } from 'x'\n") // [{ specifier: 'x', names: ['a', 'b'] }]
|
|
782
802
|
* ```
|
|
783
803
|
*/
|
|
784
|
-
function
|
|
804
|
+
function extractFenceImports(fence) {
|
|
785
805
|
const results = [];
|
|
786
806
|
const pattern = /import\s+(?:type\s+)?\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/gs;
|
|
787
807
|
let match;
|
|
@@ -800,11 +820,11 @@ function fenceImports(fence) {
|
|
|
800
820
|
return results;
|
|
801
821
|
}
|
|
802
822
|
/**
|
|
803
|
-
*
|
|
804
|
-
*
|
|
823
|
+
* Checks whether a guides-parity link check skips a link `href` — an external
|
|
824
|
+
* scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.
|
|
805
825
|
*
|
|
806
826
|
* @param href - The link destination
|
|
807
|
-
* @returns
|
|
827
|
+
* @returns True if a link check leaves the href unresolved against the filesystem; false otherwise
|
|
808
828
|
*
|
|
809
829
|
* @example
|
|
810
830
|
* ```ts
|
|
@@ -817,7 +837,7 @@ function isExternalLink(href) {
|
|
|
817
837
|
return EXTERNAL_SCHEMES.some((scheme) => href.startsWith(scheme));
|
|
818
838
|
}
|
|
819
839
|
/**
|
|
820
|
-
*
|
|
840
|
+
* Resolves a relative `target` from a root-relative `directory`, normalizing
|
|
821
841
|
* forward-slash dot segments without filesystem or extension inference. A
|
|
822
842
|
* parent pops only a retained real component; every excess leading parent is
|
|
823
843
|
* preserved.
|
|
@@ -848,7 +868,7 @@ function resolvePath(directory, target) {
|
|
|
848
868
|
return segments.length === 0 ? "." : segments.join("/");
|
|
849
869
|
}
|
|
850
870
|
/**
|
|
851
|
-
*
|
|
871
|
+
* Resolves a relative `target` from the directory containing a root-relative
|
|
852
872
|
* declaring `file`. A slashless file belongs to the workspace root; path
|
|
853
873
|
* reduction is delegated to {@link resolvePath}.
|
|
854
874
|
*
|
|
@@ -867,7 +887,7 @@ function resolveLink(file, target) {
|
|
|
867
887
|
return resolvePath(index < 0 ? "." : file.slice(0, index), target);
|
|
868
888
|
}
|
|
869
889
|
/**
|
|
870
|
-
*
|
|
890
|
+
* Finds the first code-span value by descending an inline node list, following
|
|
871
891
|
* into `emphasis` / `link` / `image` children — the extraction rule behind a
|
|
872
892
|
* Surface or Methods table row's first-column identifier.
|
|
873
893
|
*
|
|
@@ -876,30 +896,30 @@ function resolveLink(file, target) {
|
|
|
876
896
|
*
|
|
877
897
|
* @example
|
|
878
898
|
* ```ts
|
|
879
|
-
*
|
|
899
|
+
* findFirstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'
|
|
880
900
|
* ```
|
|
881
901
|
*/
|
|
882
|
-
function
|
|
902
|
+
function findFirstCode(nodes) {
|
|
883
903
|
for (const node of nodes) {
|
|
884
904
|
if ((0, _orkestrel_markdown.isCodeSpanNode)(node)) return node.value;
|
|
885
905
|
if ((0, _orkestrel_markdown.isEmphasisNode)(node) || (0, _orkestrel_markdown.isLinkNode)(node) || (0, _orkestrel_markdown.isImageNode)(node)) {
|
|
886
|
-
const value =
|
|
906
|
+
const value = findFirstCode(node.children);
|
|
887
907
|
if (value !== void 0) return value;
|
|
888
908
|
}
|
|
889
909
|
}
|
|
890
910
|
}
|
|
891
911
|
/**
|
|
892
|
-
*
|
|
912
|
+
* Extracts the link hrefs within one table cell's inline content.
|
|
893
913
|
*
|
|
894
914
|
* @param cell - The cell's inline nodes
|
|
895
915
|
* @returns The cell's link hrefs, in walk order
|
|
896
916
|
*
|
|
897
917
|
* @example
|
|
898
918
|
* ```ts
|
|
899
|
-
*
|
|
919
|
+
* extractCellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']
|
|
900
920
|
* ```
|
|
901
921
|
*/
|
|
902
|
-
function
|
|
922
|
+
function extractCellLinks(cell) {
|
|
903
923
|
const links = [];
|
|
904
924
|
for (const node of (0, _orkestrel_markdown.walkNodes)({
|
|
905
925
|
element: "paragraph",
|
|
@@ -908,7 +928,7 @@ function cellLinks(cell) {
|
|
|
908
928
|
return links;
|
|
909
929
|
}
|
|
910
930
|
/**
|
|
911
|
-
*
|
|
931
|
+
* Returns the identifier prefix of a code-span text — everything before its first `<`,
|
|
912
932
|
* trimmed. Guide cells and headings may annotate a generic-parameterized name
|
|
913
933
|
* (`MarkdownHandler<TNode, T>`) for readability, but the bijection key is the
|
|
914
934
|
* bare identifier the source scanner captures, so both sides must normalize
|
|
@@ -919,16 +939,16 @@ function cellLinks(cell) {
|
|
|
919
939
|
*
|
|
920
940
|
* @example
|
|
921
941
|
* ```ts
|
|
922
|
-
*
|
|
923
|
-
*
|
|
942
|
+
* normalizeIdentifier('MarkdownHandler<TNode, T>') // 'MarkdownHandler'
|
|
943
|
+
* normalizeIdentifier('fold') // 'fold'
|
|
924
944
|
* ```
|
|
925
945
|
*/
|
|
926
|
-
function
|
|
946
|
+
function normalizeIdentifier(code) {
|
|
927
947
|
const index = code.indexOf("<");
|
|
928
948
|
return (index < 0 ? code : code.slice(0, index)).trim();
|
|
929
949
|
}
|
|
930
950
|
/**
|
|
931
|
-
*
|
|
951
|
+
* Finds the index of a table's `Kind` column by its header text so it survives
|
|
932
952
|
* column reordering. The match is exact and case-sensitive (`'Kind'`) — a table
|
|
933
953
|
* without that exact header contributes no symbols to the surface it feeds.
|
|
934
954
|
*
|
|
@@ -937,10 +957,10 @@ function identifierOf(code) {
|
|
|
937
957
|
*
|
|
938
958
|
* @example
|
|
939
959
|
* ```ts
|
|
940
|
-
*
|
|
960
|
+
* findKindIndex(table) // 1, or undefined
|
|
941
961
|
* ```
|
|
942
962
|
*/
|
|
943
|
-
function
|
|
963
|
+
function findKindIndex(table) {
|
|
944
964
|
for (let index = 0; index < table.header.length; index += 1) {
|
|
945
965
|
const cell = table.header[index];
|
|
946
966
|
if (cell !== void 0 && (0, _orkestrel_markdown.flattenText)({
|
|
@@ -950,10 +970,11 @@ function kindIndex(table) {
|
|
|
950
970
|
}
|
|
951
971
|
}
|
|
952
972
|
/**
|
|
953
|
-
*
|
|
973
|
+
* Extracts the module-scope exports declared in one file's source text — matches
|
|
954
974
|
* `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
|
|
955
|
-
* by (
|
|
956
|
-
* `function` — its trailing `*` is stripped before the
|
|
975
|
+
* by (keyword, name). A generator export (`export function* walk`) scans as the
|
|
976
|
+
* `function` keyword — its trailing `*` is stripped before the
|
|
977
|
+
* {@link ExportKeyword} check.
|
|
957
978
|
* Scanning uses {@link extractSourceLines}, so comment and template payload is
|
|
958
979
|
* excluded while its uninterrupted column-zero head remains required; preserved
|
|
959
980
|
* columns do not grant membership to leading/interrupted comment forms. The population is
|
|
@@ -965,38 +986,37 @@ function kindIndex(table) {
|
|
|
965
986
|
*
|
|
966
987
|
* @example
|
|
967
988
|
* ```ts
|
|
968
|
-
*
|
|
969
|
-
*
|
|
989
|
+
* extractExports('export class Markdown {}\n') // [{ name: 'Markdown', keyword: 'class' }]
|
|
990
|
+
* extractExports('export function* walk() {}\n') // [{ name: 'walk', keyword: 'function' }]
|
|
970
991
|
* ```
|
|
971
992
|
*/
|
|
972
|
-
function
|
|
993
|
+
function extractExports(source) {
|
|
973
994
|
const symbols = [];
|
|
974
995
|
const seen = /* @__PURE__ */ new Set();
|
|
975
996
|
for (const line of extractSourceLines(source)) {
|
|
976
997
|
const match = line.code.match(/^export (?:async )?(function\*?|class|const|interface|type) (\w+)/);
|
|
977
|
-
const
|
|
998
|
+
const rawKeyword = match?.[1];
|
|
978
999
|
const name = match?.[2];
|
|
979
|
-
const
|
|
980
|
-
if (!(0, _orkestrel_contract.isNonEmptyString)(
|
|
981
|
-
const key = `${
|
|
1000
|
+
const keyword = rawKeyword === void 0 ? void 0 : rawKeyword.replace(/\*$/, "");
|
|
1001
|
+
if (!(0, _orkestrel_contract.isNonEmptyString)(keyword) || !(0, _orkestrel_contract.isNonEmptyString)(name) || !isExportKeyword(keyword)) continue;
|
|
1002
|
+
const key = `${keyword} ${name}`;
|
|
982
1003
|
if (seen.has(key)) continue;
|
|
983
1004
|
seen.add(key);
|
|
984
1005
|
symbols.push({
|
|
985
1006
|
name,
|
|
986
|
-
|
|
1007
|
+
keyword
|
|
987
1008
|
});
|
|
988
1009
|
}
|
|
989
1010
|
return symbols;
|
|
990
1011
|
}
|
|
991
1012
|
/**
|
|
992
|
-
*
|
|
993
|
-
* source text — the mirror image of {@link
|
|
1013
|
+
* Extracts the module-scope declarations lacking the `export` keyword in one file's
|
|
1014
|
+
* source text — the mirror image of {@link extractExports}'s grammar, anchored
|
|
994
1015
|
* the same way (column 0, so an indented inner declaration never matches).
|
|
995
|
-
* Scans only the
|
|
996
|
-
* `const` / `interface` / `type`) — a module-scope `let` or `var` is
|
|
997
|
-
*
|
|
998
|
-
*
|
|
999
|
-
* this check's contract. Scanning uses {@link extractSourceLines}, so comment
|
|
1016
|
+
* Scans only the {@link ExportKeyword} keywords (`function` / `class` /
|
|
1017
|
+
* `const` / `interface` / `type`) — a module-scope `let` or `var` is outside
|
|
1018
|
+
* this scanner's declaration-keyword grammar and out of this check's contract.
|
|
1019
|
+
* Scanning uses {@link extractSourceLines}, so comment
|
|
1000
1020
|
* and template payload is excluded while its uninterrupted column-zero head
|
|
1001
1021
|
* remains required; preserved columns do not widen membership. `enum` is likewise outside this reflection population, not
|
|
1002
1022
|
* forbidden by general package policy.
|
|
@@ -1006,32 +1026,32 @@ function exportsFrom(source) {
|
|
|
1006
1026
|
*
|
|
1007
1027
|
* @example
|
|
1008
1028
|
* ```ts
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
1029
|
+
* extractHidden('function secretHelper() {}\n') // [{ name: 'secretHelper', keyword: 'function' }]
|
|
1030
|
+
* extractHidden('export class X {}\n') // []
|
|
1011
1031
|
* ```
|
|
1012
1032
|
*/
|
|
1013
|
-
function
|
|
1033
|
+
function extractHidden(source) {
|
|
1014
1034
|
const symbols = [];
|
|
1015
1035
|
const seen = /* @__PURE__ */ new Set();
|
|
1016
1036
|
for (const line of extractSourceLines(source)) {
|
|
1017
1037
|
if (line.code.startsWith("export ")) continue;
|
|
1018
1038
|
const match = line.code.match(/^(?:async )?(function\*?|class|const|interface|type) (\w+)/);
|
|
1019
|
-
const
|
|
1039
|
+
const rawKeyword = match?.[1];
|
|
1020
1040
|
const name = match?.[2];
|
|
1021
|
-
const
|
|
1022
|
-
if (!(0, _orkestrel_contract.isNonEmptyString)(
|
|
1023
|
-
const key = `${
|
|
1041
|
+
const keyword = rawKeyword === void 0 ? void 0 : rawKeyword.replace(/\*$/, "");
|
|
1042
|
+
if (!(0, _orkestrel_contract.isNonEmptyString)(keyword) || !(0, _orkestrel_contract.isNonEmptyString)(name) || !isExportKeyword(keyword)) continue;
|
|
1043
|
+
const key = `${keyword} ${name}`;
|
|
1024
1044
|
if (seen.has(key)) continue;
|
|
1025
1045
|
seen.add(key);
|
|
1026
1046
|
symbols.push({
|
|
1027
1047
|
name,
|
|
1028
|
-
|
|
1048
|
+
keyword
|
|
1029
1049
|
});
|
|
1030
1050
|
}
|
|
1031
1051
|
return symbols;
|
|
1032
1052
|
}
|
|
1033
1053
|
/**
|
|
1034
|
-
*
|
|
1054
|
+
* Joins the declaration head starting at `start` into one space-separated
|
|
1035
1055
|
* line, consuming lines until the first that ends with `{`.
|
|
1036
1056
|
*
|
|
1037
1057
|
* @param lines - The file's source lines
|
|
@@ -1056,37 +1076,87 @@ function joinHead(lines, start) {
|
|
|
1056
1076
|
}
|
|
1057
1077
|
}
|
|
1058
1078
|
/**
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1079
|
+
* Escapes every regex metacharacter in a literal string so it reads as text
|
|
1080
|
+
* inside a larger `RegExp` source rather than as syntax.
|
|
1081
|
+
*
|
|
1082
|
+
* @remarks
|
|
1083
|
+
* Every caller-supplied name reaches a `RegExp` through this: {@link
|
|
1084
|
+
* extractDeclaration} splices it into the head grammar and {@link
|
|
1085
|
+
* findUnexampled} into a word-boundary search, so a name carrying `$`, `(`,
|
|
1086
|
+
* `[`, or `.` matches that character literally instead of throwing or matching
|
|
1087
|
+
* text it does not name. Pure and total; never throws.
|
|
1088
|
+
*
|
|
1089
|
+
* @param value - The literal string to escape
|
|
1090
|
+
* @returns `value` with every regex metacharacter backslash-escaped
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```ts
|
|
1094
|
+
* escapeRegExp('A.B') // 'A\\.B'
|
|
1095
|
+
* new RegExp(`^${escapeRegExp('A.B')}$`).test('AxB') // false
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
function escapeRegExp(value) {
|
|
1099
|
+
return value.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Locates the named `export class` / `export interface` declaration in one
|
|
1103
|
+
* file's source text and returns its body lines and its base identifiers read
|
|
1104
|
+
* from that one head, so a body and a heritage clause always come from the same
|
|
1105
|
+
* declaration.
|
|
1106
|
+
*
|
|
1107
|
+
* @remarks
|
|
1108
|
+
* The head is matched on projected lines (column 0, an oxfmt-wrapped signature
|
|
1109
|
+
* joined through {@link joinHead}), with an optional generic parameter list and
|
|
1110
|
+
* an optional heritage clause between the identifier and the opening `{`; the
|
|
1111
|
+
* identifier matches exactly and is escaped through {@link escapeRegExp}, so a
|
|
1112
|
+
* metacharacter in `name` is literal text. The returned body lines are the raw
|
|
1113
|
+
* source between that head and the first projected column-zero `}`, keeping
|
|
1114
|
+
* JSDoc evidence intact. Every balanced `<...>` span is removed from the head
|
|
1115
|
+
* before its `extends` clause is read, so a `T extends Base` type parameter is
|
|
1116
|
+
* never a base and `Base<T>` reads as `Base`; a class's `implements` clause and
|
|
1117
|
+
* everything after it is excluded, and a qualified base such as
|
|
1118
|
+
* `namespace.Base` is returned verbatim. A head that opens no column-zero close
|
|
1119
|
+
* is skipped and the scan continues, so a later real declaration still answers.
|
|
1063
1120
|
*
|
|
1064
1121
|
* @param source - The file's source text to search
|
|
1065
1122
|
* @param keyword - Whether to look for a `class` or an `interface`
|
|
1066
1123
|
* @param name - The declaration's identifier
|
|
1067
|
-
* @returns
|
|
1124
|
+
* @returns Its body and bases, or `undefined` when `source` declares no such head
|
|
1068
1125
|
*
|
|
1069
1126
|
* @example
|
|
1070
1127
|
* ```ts
|
|
1071
|
-
*
|
|
1128
|
+
* extractDeclaration('export interface X extends Y {\n\twalk(): void\n}\n', 'interface', 'X')
|
|
1129
|
+
* // { body: ['\twalk(): void'], bases: ['Y'] }
|
|
1072
1130
|
* ```
|
|
1073
1131
|
*/
|
|
1074
|
-
function
|
|
1132
|
+
function extractDeclaration(source, keyword, name) {
|
|
1075
1133
|
const opener = `export ${keyword} ${name}`;
|
|
1076
|
-
const
|
|
1134
|
+
const grammar = new RegExp(`^${escapeRegExp(opener)}(?:<.*>)?(?: .*)? \\{$`);
|
|
1077
1135
|
const lines = extractSourceLines(source);
|
|
1078
1136
|
const projected = lines.map((line) => line.code);
|
|
1079
1137
|
for (let index = 0; index < projected.length; index += 1) {
|
|
1080
1138
|
const line = projected[index];
|
|
1081
1139
|
if (line === void 0 || !line.startsWith(opener)) continue;
|
|
1082
1140
|
const head = joinHead(projected, index);
|
|
1083
|
-
if (head === void 0 || !
|
|
1084
|
-
|
|
1141
|
+
if (head === void 0 || !grammar.test(head.text)) continue;
|
|
1142
|
+
let depth = 0;
|
|
1143
|
+
let flat = "";
|
|
1144
|
+
for (const character of head.text.slice(opener.length, -1)) if (character === "<") depth += 1;
|
|
1145
|
+
else if (character === ">") depth = Math.max(0, depth - 1);
|
|
1146
|
+
else if (depth === 0) flat += character;
|
|
1147
|
+
const clause = flat.replace(/\bimplements\b[\s\S]*$/, "").match(/\bextends\b([\s\S]*)$/)?.[1];
|
|
1148
|
+
const bases = clause === void 0 ? [] : clause.split(",").map((base) => base.trim()).filter(_orkestrel_contract.isNonEmptyString);
|
|
1149
|
+
for (let close = head.end + 1; close < projected.length; close += 1) {
|
|
1150
|
+
if (projected[close] !== "}") continue;
|
|
1151
|
+
return {
|
|
1152
|
+
body: lines.slice(head.end + 1, close).map((record) => record.source),
|
|
1153
|
+
bases
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1085
1156
|
}
|
|
1086
|
-
return [];
|
|
1087
1157
|
}
|
|
1088
1158
|
/**
|
|
1089
|
-
*
|
|
1159
|
+
* Selects the member lines declaring a callable member: plain, `async`, generator
|
|
1090
1160
|
* (`*`), and optional (`records?(`) methods all count; getters, setters,
|
|
1091
1161
|
* `static` members, and `#` privates never do (their keyword or `#` breaks
|
|
1092
1162
|
* the `name(` shape). Matching runs once over projected lines so commented
|
|
@@ -1097,32 +1167,32 @@ function declarationBody(source, keyword, name) {
|
|
|
1097
1167
|
*
|
|
1098
1168
|
* @example
|
|
1099
1169
|
* ```ts
|
|
1100
|
-
*
|
|
1170
|
+
* extractMemberMethods(['\tmap(): void', '\tfilter(): void']) // ['filter', 'map']
|
|
1101
1171
|
* ```
|
|
1102
1172
|
*/
|
|
1103
|
-
function
|
|
1173
|
+
function extractMemberMethods(lines) {
|
|
1104
1174
|
const methods = [];
|
|
1105
1175
|
for (const line of extractSourceLines(lines.join("\n"))) {
|
|
1106
|
-
const method = line.code.match(/^\t(?:async )?\*?(\w+)(<.*>)
|
|
1176
|
+
const method = line.code.match(/^\t(?:async )?\*?(\w+)\??(<.*>)?\(/);
|
|
1107
1177
|
if (method?.[1] !== void 0) methods.push(method[1]);
|
|
1108
1178
|
}
|
|
1109
1179
|
return Array.from(new Set(methods)).sort();
|
|
1110
1180
|
}
|
|
1111
1181
|
/**
|
|
1112
|
-
*
|
|
1182
|
+
* Selects the block nodes under the named `##` heading, up to the next `##`-or-higher
|
|
1113
1183
|
* heading (or the document's end) — the section-scoping window `extractSurface` /
|
|
1114
1184
|
* `extractMethods` walk over.
|
|
1115
1185
|
*
|
|
1116
1186
|
* @param document - The parsed guide document
|
|
1117
|
-
* @param heading - The `##` heading text to scope to
|
|
1187
|
+
* @param heading - The `##` heading text to scope to, for example `Surface`
|
|
1118
1188
|
* @returns The blocks belonging to that section, in document order
|
|
1119
1189
|
*
|
|
1120
1190
|
* @example
|
|
1121
1191
|
* ```ts
|
|
1122
|
-
*
|
|
1192
|
+
* selectSectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`
|
|
1123
1193
|
* ```
|
|
1124
1194
|
*/
|
|
1125
|
-
function
|
|
1195
|
+
function selectSectionBlocks(document, heading) {
|
|
1126
1196
|
const blocks = [];
|
|
1127
1197
|
let active = false;
|
|
1128
1198
|
for (const block of document.children) {
|
|
@@ -1138,10 +1208,10 @@ function sectionBlocks(document, heading) {
|
|
|
1138
1208
|
return blocks;
|
|
1139
1209
|
}
|
|
1140
1210
|
/**
|
|
1141
|
-
*
|
|
1211
|
+
* Extracts every `## Surface` identifier the guide documents — each table row's column 0
|
|
1142
1212
|
* code span (the name) paired with its `Kind` column (located by header text)
|
|
1143
|
-
*
|
|
1144
|
-
* (`{name: <codeSpan>,
|
|
1213
|
+
* unioned with every backticked H3 entity heading in the section
|
|
1214
|
+
* (`{name: <codeSpan>, keyword: 'class'}`), deduped by {@link computeSymbolKey}. A row with
|
|
1145
1215
|
* no code-span name, or an unrecognized `Kind` text, is skipped.
|
|
1146
1216
|
*
|
|
1147
1217
|
* @param document - The parsed guide document
|
|
@@ -1149,31 +1219,31 @@ function sectionBlocks(document, heading) {
|
|
|
1149
1219
|
*
|
|
1150
1220
|
* @example
|
|
1151
1221
|
* ```ts
|
|
1152
|
-
* extractSurface(document) // [{ name: 'Markdown',
|
|
1222
|
+
* extractSurface(document) // [{ name: 'Markdown', keyword: 'class' }, ...]
|
|
1153
1223
|
* ```
|
|
1154
1224
|
*/
|
|
1155
1225
|
function extractSurface(document) {
|
|
1156
1226
|
const symbols = [];
|
|
1157
1227
|
const seen = /* @__PURE__ */ new Set();
|
|
1158
|
-
for (const block of
|
|
1228
|
+
for (const block of selectSectionBlocks(document, SURFACE)) {
|
|
1159
1229
|
if ((0, _orkestrel_markdown.isTableNode)(block)) {
|
|
1160
|
-
const column =
|
|
1230
|
+
const column = findKindIndex(block);
|
|
1161
1231
|
for (const row of block.rows) {
|
|
1162
1232
|
const nameCell = row[0];
|
|
1163
|
-
const rawName = nameCell === void 0 ? void 0 :
|
|
1164
|
-
const name = rawName === void 0 ? void 0 :
|
|
1233
|
+
const rawName = nameCell === void 0 ? void 0 : findFirstCode(nameCell);
|
|
1234
|
+
const name = rawName === void 0 ? void 0 : normalizeIdentifier(rawName);
|
|
1165
1235
|
if (name === void 0) continue;
|
|
1166
1236
|
const kindCell = column === void 0 ? void 0 : row[column];
|
|
1167
1237
|
const kindText = kindCell === void 0 ? "" : (0, _orkestrel_markdown.flattenText)({
|
|
1168
1238
|
element: "paragraph",
|
|
1169
1239
|
children: kindCell
|
|
1170
1240
|
}).trim();
|
|
1171
|
-
if (!
|
|
1241
|
+
if (!isExportKeyword(kindText)) continue;
|
|
1172
1242
|
const symbol = {
|
|
1173
1243
|
name,
|
|
1174
|
-
|
|
1244
|
+
keyword: kindText
|
|
1175
1245
|
};
|
|
1176
|
-
const key =
|
|
1246
|
+
const key = computeSymbolKey(symbol);
|
|
1177
1247
|
if (seen.has(key)) continue;
|
|
1178
1248
|
seen.add(key);
|
|
1179
1249
|
symbols.push(symbol);
|
|
@@ -1181,14 +1251,14 @@ function extractSurface(document) {
|
|
|
1181
1251
|
continue;
|
|
1182
1252
|
}
|
|
1183
1253
|
if ((0, _orkestrel_markdown.isHeadingNode)(block) && block.level === 3) {
|
|
1184
|
-
const rawName =
|
|
1185
|
-
const name = rawName === void 0 ? void 0 :
|
|
1254
|
+
const rawName = findFirstCode(block.children);
|
|
1255
|
+
const name = rawName === void 0 ? void 0 : normalizeIdentifier(rawName);
|
|
1186
1256
|
if (name === void 0) continue;
|
|
1187
1257
|
const symbol = {
|
|
1188
1258
|
name,
|
|
1189
|
-
|
|
1259
|
+
keyword: "class"
|
|
1190
1260
|
};
|
|
1191
|
-
const key =
|
|
1261
|
+
const key = computeSymbolKey(symbol);
|
|
1192
1262
|
if (seen.has(key)) continue;
|
|
1193
1263
|
seen.add(key);
|
|
1194
1264
|
symbols.push(symbol);
|
|
@@ -1197,7 +1267,7 @@ function extractSurface(document) {
|
|
|
1197
1267
|
return symbols;
|
|
1198
1268
|
}
|
|
1199
1269
|
/**
|
|
1200
|
-
*
|
|
1270
|
+
* Extracts one {@link MethodGroup} per documented behavioral interface in `## Methods` —
|
|
1201
1271
|
* an H4 with a code span sets the current interface, and the table immediately
|
|
1202
1272
|
* following becomes its documented methods.
|
|
1203
1273
|
*
|
|
@@ -1212,18 +1282,18 @@ function extractSurface(document) {
|
|
|
1212
1282
|
function extractMethods(document) {
|
|
1213
1283
|
const groups = [];
|
|
1214
1284
|
let current;
|
|
1215
|
-
for (const block of
|
|
1285
|
+
for (const block of selectSectionBlocks(document, METHODS)) {
|
|
1216
1286
|
if ((0, _orkestrel_markdown.isHeadingNode)(block) && block.level === 4) {
|
|
1217
|
-
const rawInterface =
|
|
1218
|
-
current = rawInterface === void 0 ? void 0 :
|
|
1287
|
+
const rawInterface = findFirstCode(block.children);
|
|
1288
|
+
current = rawInterface === void 0 ? void 0 : normalizeIdentifier(rawInterface);
|
|
1219
1289
|
continue;
|
|
1220
1290
|
}
|
|
1221
1291
|
if ((0, _orkestrel_markdown.isTableNode)(block) && current !== void 0) {
|
|
1222
1292
|
const methods = [];
|
|
1223
1293
|
for (const row of block.rows) {
|
|
1224
1294
|
const cell = row[0];
|
|
1225
|
-
const rawName = cell === void 0 ? void 0 :
|
|
1226
|
-
const name = rawName === void 0 ? void 0 :
|
|
1295
|
+
const rawName = cell === void 0 ? void 0 : findFirstCode(cell);
|
|
1296
|
+
const name = rawName === void 0 ? void 0 : normalizeIdentifier(rawName);
|
|
1227
1297
|
if (name !== void 0) methods.push(name);
|
|
1228
1298
|
}
|
|
1229
1299
|
groups.push({
|
|
@@ -1236,7 +1306,7 @@ function extractMethods(document) {
|
|
|
1236
1306
|
return groups;
|
|
1237
1307
|
}
|
|
1238
1308
|
/**
|
|
1239
|
-
*
|
|
1309
|
+
* Extracts every link href in the guide document, including table cells — a full,
|
|
1240
1310
|
* depth-first walk of the whole AST.
|
|
1241
1311
|
*
|
|
1242
1312
|
* @param document - The parsed guide document
|
|
@@ -1253,7 +1323,7 @@ function extractLinks(document) {
|
|
|
1253
1323
|
return links;
|
|
1254
1324
|
}
|
|
1255
1325
|
/**
|
|
1256
|
-
*
|
|
1326
|
+
* Extracts the relative test links declared under `## Tests` — every link href found
|
|
1257
1327
|
* within that section only.
|
|
1258
1328
|
*
|
|
1259
1329
|
* @param document - The parsed guide document
|
|
@@ -1266,11 +1336,11 @@ function extractLinks(document) {
|
|
|
1266
1336
|
*/
|
|
1267
1337
|
function extractTests(document) {
|
|
1268
1338
|
const links = [];
|
|
1269
|
-
for (const block of
|
|
1339
|
+
for (const block of selectSectionBlocks(document, TESTS)) for (const node of (0, _orkestrel_markdown.walkNodes)(block)) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
|
|
1270
1340
|
return links;
|
|
1271
1341
|
}
|
|
1272
1342
|
/**
|
|
1273
|
-
*
|
|
1343
|
+
* Selects the next physical record after an eligible genuine JSDoc whose final
|
|
1274
1344
|
* authoritative span carries an exact block-position `@example` tag. Title
|
|
1275
1345
|
* text is allowed. A leading whitespace-separated span chain is last-span
|
|
1276
1346
|
* authoritative; intervening source material severs association, while a
|
|
@@ -1351,7 +1421,7 @@ function extractExampleLines(lines) {
|
|
|
1351
1421
|
return examples;
|
|
1352
1422
|
}
|
|
1353
1423
|
/**
|
|
1354
|
-
*
|
|
1424
|
+
* Extracts the exported functions in one file's source text whose immediately preceding
|
|
1355
1425
|
* eligible genuine JSDoc block carries `@example`. Shared adjacency comes from
|
|
1356
1426
|
* {@link extractExampleLines}; exported-function membership is matched against
|
|
1357
1427
|
* the aligned code projection, so comment and template payload cannot qualify.
|
|
@@ -1362,11 +1432,11 @@ function extractExampleLines(lines) {
|
|
|
1362
1432
|
* @example
|
|
1363
1433
|
* ```ts
|
|
1364
1434
|
* const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\n')
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1435
|
+
* extractExamples(block) // ['walk']
|
|
1436
|
+
* extractExamples('export function walk() {}\n') // []
|
|
1367
1437
|
* ```
|
|
1368
1438
|
*/
|
|
1369
|
-
function
|
|
1439
|
+
function extractExamples(source) {
|
|
1370
1440
|
const names = [];
|
|
1371
1441
|
const seen = /* @__PURE__ */ new Set();
|
|
1372
1442
|
for (const line of extractExampleLines(extractSourceLines(source))) {
|
|
@@ -1379,7 +1449,7 @@ function examplesFrom(source) {
|
|
|
1379
1449
|
return names;
|
|
1380
1450
|
}
|
|
1381
1451
|
/**
|
|
1382
|
-
*
|
|
1452
|
+
* Extracts the callable-member names in a declaration body (per {@link extractMemberMethods}'
|
|
1383
1453
|
* grammar) whose immediately preceding eligible genuine JSDoc block, within
|
|
1384
1454
|
* the same body, carries `@example`. Shared adjacency comes from
|
|
1385
1455
|
* {@link extractExampleLines}; member membership is matched against aligned
|
|
@@ -1390,14 +1460,14 @@ function examplesFrom(source) {
|
|
|
1390
1460
|
*
|
|
1391
1461
|
* @example
|
|
1392
1462
|
* ```ts
|
|
1393
|
-
*
|
|
1463
|
+
* extractExampleMethods(['\t/**', '\t * @example', '\t *' + '/', '\twalk(): void']) // ['walk']
|
|
1394
1464
|
* ```
|
|
1395
1465
|
*/
|
|
1396
|
-
function
|
|
1466
|
+
function extractExampleMethods(lines) {
|
|
1397
1467
|
const methods = [];
|
|
1398
1468
|
const seen = /* @__PURE__ */ new Set();
|
|
1399
1469
|
for (const line of extractExampleLines(extractSourceLines(lines.join("\n")))) {
|
|
1400
|
-
const name = line.code.match(/^\t(?:async )?\*?(\w+)(<.*>)
|
|
1470
|
+
const name = line.code.match(/^\t(?:async )?\*?(\w+)\??(<.*>)?\(/)?.[1];
|
|
1401
1471
|
if ((0, _orkestrel_contract.isNonEmptyString)(name) && !seen.has(name)) {
|
|
1402
1472
|
seen.add(name);
|
|
1403
1473
|
methods.push(name);
|
|
@@ -1406,7 +1476,7 @@ function exampleMethods(lines) {
|
|
|
1406
1476
|
return Array.from(new Set(methods)).sort();
|
|
1407
1477
|
}
|
|
1408
1478
|
/**
|
|
1409
|
-
*
|
|
1479
|
+
* Extracts every fenced code block anywhere in the guide document. A full AST walk
|
|
1410
1480
|
* includes fences nested inside blockquotes and lists.
|
|
1411
1481
|
*
|
|
1412
1482
|
* @param document - The parsed guide document
|
|
@@ -1428,7 +1498,7 @@ function extractFences(document) {
|
|
|
1428
1498
|
//#endregion
|
|
1429
1499
|
//#region src/core/parsers.ts
|
|
1430
1500
|
/**
|
|
1431
|
-
*
|
|
1501
|
+
* Parses a `## By concept` manifest table into its {@link ManifestEntry} rows —
|
|
1432
1502
|
* each row's Concept cell (flattened text), Spec / Tests cells (a single link
|
|
1433
1503
|
* href, resolved against `directory`), and Source cell (every link href,
|
|
1434
1504
|
* resolved against `directory`; Source links canonicalize through
|
|
@@ -1436,7 +1506,7 @@ function extractFences(document) {
|
|
|
1436
1506
|
* a `readonly string[]`). A row missing a concept, spec link, tests link, or
|
|
1437
1507
|
* source link is skipped as malformed.
|
|
1438
1508
|
*
|
|
1439
|
-
* @param markdown - The manifest markdown source
|
|
1509
|
+
* @param markdown - The manifest markdown source, for example the content of `guides/README.md`
|
|
1440
1510
|
* @param directory - The root-relative directory containing the manifest
|
|
1441
1511
|
* @returns The manifest's entries, in row order
|
|
1442
1512
|
*
|
|
@@ -1448,7 +1518,7 @@ function extractFences(document) {
|
|
|
1448
1518
|
function parseManifest(markdown, directory) {
|
|
1449
1519
|
const document = (0, _orkestrel_markdown.createMarkdown)(markdown).document;
|
|
1450
1520
|
const entries = [];
|
|
1451
|
-
for (const block of
|
|
1521
|
+
for (const block of selectSectionBlocks(document, MANIFEST)) {
|
|
1452
1522
|
if (!(0, _orkestrel_markdown.isTableNode)(block)) continue;
|
|
1453
1523
|
for (const row of block.rows) {
|
|
1454
1524
|
const conceptCell = row[0];
|
|
@@ -1461,10 +1531,10 @@ function parseManifest(markdown, directory) {
|
|
|
1461
1531
|
children: conceptCell
|
|
1462
1532
|
}).trim();
|
|
1463
1533
|
if ((0, _orkestrel_contract.isEmptyString)(concept)) continue;
|
|
1464
|
-
const specHref =
|
|
1465
|
-
const testsHref =
|
|
1534
|
+
const specHref = extractCellLinks(specCell)[0];
|
|
1535
|
+
const testsHref = extractCellLinks(testsCell)[0];
|
|
1466
1536
|
if (specHref === void 0 || testsHref === void 0) continue;
|
|
1467
|
-
const sourceHrefs = normalizeDirectories(
|
|
1537
|
+
const sourceHrefs = normalizeDirectories(extractCellLinks(sourceCell).map((href) => resolvePath(directory, href)));
|
|
1468
1538
|
if (!(0, _orkestrel_contract.isNonEmptyArray)(sourceHrefs)) continue;
|
|
1469
1539
|
const [firstSource] = sourceHrefs;
|
|
1470
1540
|
const source = sourceHrefs.length === 1 ? firstSource : sourceHrefs;
|
|
@@ -1481,8 +1551,8 @@ function parseManifest(markdown, directory) {
|
|
|
1481
1551
|
//#endregion
|
|
1482
1552
|
//#region src/core/shapers.ts
|
|
1483
1553
|
/**
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1554
|
+
* Shapes a {@link SurfaceSymbol} — a documented / exported symbol's `name`
|
|
1555
|
+
* paired with its {@link ExportKeyword}.
|
|
1486
1556
|
*
|
|
1487
1557
|
* @example
|
|
1488
1558
|
* ```ts
|
|
@@ -1490,22 +1560,16 @@ function parseManifest(markdown, directory) {
|
|
|
1490
1560
|
* import { surfaceSymbolShape } from '@orkestrel/guide'
|
|
1491
1561
|
*
|
|
1492
1562
|
* const surfaceSymbol = createContract(surfaceSymbolShape)
|
|
1493
|
-
* surfaceSymbol.is({ name: 'Markdown',
|
|
1563
|
+
* surfaceSymbol.is({ name: 'Markdown', keyword: 'class' }) // true
|
|
1494
1564
|
* ```
|
|
1495
1565
|
*/
|
|
1496
1566
|
var surfaceSymbolShape = (0, _orkestrel_contract.objectShape)({
|
|
1497
1567
|
name: (0, _orkestrel_contract.stringShape)(),
|
|
1498
|
-
|
|
1499
|
-
"type",
|
|
1500
|
-
"interface",
|
|
1501
|
-
"const",
|
|
1502
|
-
"function",
|
|
1503
|
-
"class"
|
|
1504
|
-
])
|
|
1568
|
+
keyword: (0, _orkestrel_contract.literalShape)(EXPORT_KEYWORDS)
|
|
1505
1569
|
});
|
|
1506
1570
|
/**
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1571
|
+
* Shapes a {@link MethodGroup} — a backticked `interface` name paired with
|
|
1572
|
+
* its documented `methods`.
|
|
1509
1573
|
*
|
|
1510
1574
|
* @example
|
|
1511
1575
|
* ```ts
|
|
@@ -1521,8 +1585,8 @@ var methodGroupShape = (0, _orkestrel_contract.objectShape)({
|
|
|
1521
1585
|
methods: (0, _orkestrel_contract.arrayShape)((0, _orkestrel_contract.stringShape)())
|
|
1522
1586
|
});
|
|
1523
1587
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1588
|
+
* Shapes a {@link ManifestEntry} — one `## By concept` manifest row, `source`
|
|
1589
|
+
* accepting either a single directory or several.
|
|
1526
1590
|
*
|
|
1527
1591
|
* @example
|
|
1528
1592
|
* ```ts
|
|
@@ -1542,22 +1606,22 @@ var manifestEntryShape = (0, _orkestrel_contract.objectShape)({
|
|
|
1542
1606
|
//#endregion
|
|
1543
1607
|
//#region src/core/Guide.ts
|
|
1544
1608
|
/**
|
|
1545
|
-
*
|
|
1609
|
+
* Presents a pure, structured view over one parsed guide — the documented
|
|
1546
1610
|
* projections (`sections` / `surface` / `methods` / `links` / `tests` /
|
|
1547
1611
|
* `fences`) are extracted once at construction and cached.
|
|
1548
1612
|
*
|
|
1549
1613
|
* @remarks
|
|
1550
|
-
*
|
|
1551
|
-
* filesystem — `Guide`
|
|
1552
|
-
*
|
|
1553
|
-
* every call.
|
|
1614
|
+
* Parses `source` once through `@orkestrel/markdown` and never touches the
|
|
1615
|
+
* filesystem — `Guide` reads only the markdown text it is given and records
|
|
1616
|
+
* nothing about where the guide came from. Every accessor returns the same
|
|
1617
|
+
* cached, readonly array on every call.
|
|
1554
1618
|
*
|
|
1555
1619
|
* @example
|
|
1556
1620
|
* ```ts
|
|
1557
1621
|
* import { Guide } from '@orkestrel/guide'
|
|
1558
1622
|
*
|
|
1559
1623
|
* const guide = new Guide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
|
|
1560
|
-
* guide.surface() // [{ name: 'X',
|
|
1624
|
+
* guide.surface() // [{ name: 'X', keyword: 'class' }]
|
|
1561
1625
|
* ```
|
|
1562
1626
|
*/
|
|
1563
1627
|
var Guide = class {
|
|
@@ -1598,10 +1662,10 @@ var Guide = class {
|
|
|
1598
1662
|
//#endregion
|
|
1599
1663
|
//#region src/core/sources/Source.ts
|
|
1600
1664
|
/**
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
*
|
|
1665
|
+
* Reflects, as a pure `SourceInterface`, a module scope's intentional direct declarations,
|
|
1666
|
+
* conventional barrel-reachable surface, and member methods over a consumer-supplied file
|
|
1667
|
+
* inventory, using text-only line scanners rather than the TypeScript compiler API or the
|
|
1668
|
+
* filesystem. `Source` never touches disk:
|
|
1605
1669
|
* the consumer gathers the inventory however their environment allows
|
|
1606
1670
|
* (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) and
|
|
1607
1671
|
* passes it in as `files`. Conventional barrel traversal recurses through both
|
|
@@ -1610,7 +1674,12 @@ var Guide = class {
|
|
|
1610
1674
|
* construction, and exact opaque inventory keys are never rewritten; keys with
|
|
1611
1675
|
* empty, `.` or `..` segments stay outside both initial and resolved barrel
|
|
1612
1676
|
* inventory entrances after relative-row reduction; canonical parent hops
|
|
1613
|
-
* remain valid.
|
|
1677
|
+
* remain valid. `methods` resolves a declaration's members through its
|
|
1678
|
+
* `extends` chain within the same module scope, keeping the keyword it started
|
|
1679
|
+
* from; a base the scope does not declare contributes nothing. One declaration
|
|
1680
|
+
* answers for a name: the first file in sorted key order that declares the head
|
|
1681
|
+
* supplies its members and its bases, and a second file declaring the same name
|
|
1682
|
+
* adds nothing. Source projection preserves columns without widening
|
|
1614
1683
|
* direct/hidden column-zero heads. Literal ECMAScript Unicode identifiers
|
|
1615
1684
|
* participate in bounded slash-state recognition without escape decoding.
|
|
1616
1685
|
* Regex recognition is bounded: slash after bare `}` is division, so a
|
|
@@ -1630,8 +1699,8 @@ var Guide = class {
|
|
|
1630
1699
|
* },
|
|
1631
1700
|
* module: 'src/core',
|
|
1632
1701
|
* })
|
|
1633
|
-
* source.exports() // [{ name: 'Guide',
|
|
1634
|
-
* source.surface() // [{ name: 'Guide',
|
|
1702
|
+
* source.exports() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
|
|
1703
|
+
* source.surface() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
|
|
1635
1704
|
* source.methods('GuideInterface') // ['sections']
|
|
1636
1705
|
* source.exists('src/core/Guide.ts') // true
|
|
1637
1706
|
* ```
|
|
@@ -1648,7 +1717,7 @@ var Source = class {
|
|
|
1648
1717
|
this.#directories = normalizeDirectories(options.module);
|
|
1649
1718
|
}
|
|
1650
1719
|
exports() {
|
|
1651
|
-
if (this.#exports === void 0) this.#exports = this.#scanSymbols(
|
|
1720
|
+
if (this.#exports === void 0) this.#exports = this.#scanSymbols(extractExports);
|
|
1652
1721
|
return this.#exports;
|
|
1653
1722
|
}
|
|
1654
1723
|
surface() {
|
|
@@ -1656,15 +1725,16 @@ var Source = class {
|
|
|
1656
1725
|
return this.#surface;
|
|
1657
1726
|
}
|
|
1658
1727
|
methods(name) {
|
|
1659
|
-
const
|
|
1660
|
-
if (
|
|
1661
|
-
|
|
1728
|
+
const declared = this.#members("interface", name, /* @__PURE__ */ new Set());
|
|
1729
|
+
if (declared !== void 0) return declared;
|
|
1730
|
+
const inherited = this.#members("class", name, /* @__PURE__ */ new Set());
|
|
1731
|
+
return inherited === void 0 ? [] : inherited.filter((method) => method !== "constructor");
|
|
1662
1732
|
}
|
|
1663
1733
|
exists(relative) {
|
|
1664
1734
|
return Object.keys(this.#files).some((key) => key === relative || key.startsWith(`${relative}/`));
|
|
1665
1735
|
}
|
|
1666
1736
|
hidden() {
|
|
1667
|
-
if (this.#hidden === void 0) this.#hidden = this.#scanSymbols(
|
|
1737
|
+
if (this.#hidden === void 0) this.#hidden = this.#scanSymbols(extractHidden);
|
|
1668
1738
|
return this.#hidden;
|
|
1669
1739
|
}
|
|
1670
1740
|
examples(name) {
|
|
@@ -1680,7 +1750,7 @@ var Source = class {
|
|
|
1680
1750
|
for (const key of selectModuleKeys(this.#files, this.#directories)) {
|
|
1681
1751
|
const text = this.#files[key];
|
|
1682
1752
|
if (text === void 0) continue;
|
|
1683
|
-
for (const name of
|
|
1753
|
+
for (const name of extractExamples(text)) {
|
|
1684
1754
|
if (seen.has(name)) continue;
|
|
1685
1755
|
seen.add(name);
|
|
1686
1756
|
names.push(name);
|
|
@@ -1715,8 +1785,8 @@ var Source = class {
|
|
|
1715
1785
|
visited.add(path);
|
|
1716
1786
|
const text = this.#files[path];
|
|
1717
1787
|
if (text === void 0) continue;
|
|
1718
|
-
for (const symbol of
|
|
1719
|
-
const identity =
|
|
1788
|
+
for (const symbol of extractExports(text)) {
|
|
1789
|
+
const identity = computeSymbolKey(symbol);
|
|
1720
1790
|
if (seen.has(identity)) continue;
|
|
1721
1791
|
seen.add(identity);
|
|
1722
1792
|
symbols.push(symbol);
|
|
@@ -1724,9 +1794,7 @@ var Source = class {
|
|
|
1724
1794
|
}
|
|
1725
1795
|
}
|
|
1726
1796
|
#exampleMembers(name) {
|
|
1727
|
-
const
|
|
1728
|
-
const classBody = this.#declarationBody("class", name);
|
|
1729
|
-
const members = /* @__PURE__ */ new Set([...exampleMethods(interfaceBody), ...exampleMethods(classBody)]);
|
|
1797
|
+
const members = /* @__PURE__ */ new Set([...extractExampleMethods(this.#locate("interface", name)?.body ?? []), ...extractExampleMethods(this.#locate("class", name)?.body ?? [])]);
|
|
1730
1798
|
return Array.from(members).sort();
|
|
1731
1799
|
}
|
|
1732
1800
|
#scanSymbols(scan) {
|
|
@@ -1736,7 +1804,7 @@ var Source = class {
|
|
|
1736
1804
|
const text = this.#files[key];
|
|
1737
1805
|
if (text === void 0) continue;
|
|
1738
1806
|
for (const symbol of scan(text)) {
|
|
1739
|
-
const identity =
|
|
1807
|
+
const identity = computeSymbolKey(symbol);
|
|
1740
1808
|
if (seen.has(identity)) continue;
|
|
1741
1809
|
seen.add(identity);
|
|
1742
1810
|
symbols.push(symbol);
|
|
@@ -1744,14 +1812,24 @@ var Source = class {
|
|
|
1744
1812
|
}
|
|
1745
1813
|
return symbols.sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1);
|
|
1746
1814
|
}
|
|
1747
|
-
#
|
|
1815
|
+
#members(keyword, name, visited) {
|
|
1816
|
+
if (visited.has(name)) return [];
|
|
1817
|
+
visited.add(name);
|
|
1818
|
+
const declaration = this.#locate(keyword, name);
|
|
1819
|
+
if (declaration === void 0) return void 0;
|
|
1820
|
+
const methods = new Set(extractMemberMethods(declaration.body));
|
|
1821
|
+
for (const base of declaration.bases) for (const member of this.#members(keyword, base, visited) ?? []) methods.add(member);
|
|
1822
|
+
return Array.from(methods).sort();
|
|
1823
|
+
}
|
|
1824
|
+
#locate(keyword, name) {
|
|
1748
1825
|
for (const key of selectModuleKeys(this.#files, this.#directories)) {
|
|
1749
1826
|
const text = this.#files[key];
|
|
1750
1827
|
if (text === void 0) continue;
|
|
1751
|
-
const
|
|
1752
|
-
if (
|
|
1828
|
+
const declaration = extractDeclaration(text, keyword, name);
|
|
1829
|
+
if (declaration === void 0) continue;
|
|
1830
|
+
if (declaration.body.length === 0 && declaration.bases.length === 0) continue;
|
|
1831
|
+
return declaration;
|
|
1753
1832
|
}
|
|
1754
|
-
return [];
|
|
1755
1833
|
}
|
|
1756
1834
|
};
|
|
1757
1835
|
//#endregion
|
|
@@ -1760,6 +1838,8 @@ var Source = class {
|
|
|
1760
1838
|
* Resolves a consumer-owned import-specifier policy into pure source views and
|
|
1761
1839
|
* caches those views by module, so aliases for one module share one entity.
|
|
1762
1840
|
* Unmapped specifiers remain foreign to the consumer and return `undefined`.
|
|
1841
|
+
* `sources()` enumerates the same shared views, one per distinct module the
|
|
1842
|
+
* policy maps.
|
|
1763
1843
|
*
|
|
1764
1844
|
* @example
|
|
1765
1845
|
* ```ts
|
|
@@ -1770,6 +1850,7 @@ var Source = class {
|
|
|
1770
1850
|
* modules: { '@scope/package': 'src/core' },
|
|
1771
1851
|
* })
|
|
1772
1852
|
* sources.source('@scope/package')?.surface()
|
|
1853
|
+
* sources.sources() // [the same shared view]
|
|
1773
1854
|
* ```
|
|
1774
1855
|
*/
|
|
1775
1856
|
var SourceManager = class {
|
|
@@ -1784,7 +1865,7 @@ var SourceManager = class {
|
|
|
1784
1865
|
if (!Object.hasOwn(this.#modules, specifier)) return void 0;
|
|
1785
1866
|
const module = this.#modules[specifier];
|
|
1786
1867
|
if (module === void 0) return void 0;
|
|
1787
|
-
const key =
|
|
1868
|
+
const key = computeModuleKey(module);
|
|
1788
1869
|
const existing = this.#sources.get(key);
|
|
1789
1870
|
if (existing !== void 0) return existing;
|
|
1790
1871
|
const source = new Source({
|
|
@@ -1794,11 +1875,22 @@ var SourceManager = class {
|
|
|
1794
1875
|
this.#sources.set(key, source);
|
|
1795
1876
|
return source;
|
|
1796
1877
|
}
|
|
1878
|
+
sources() {
|
|
1879
|
+
const views = [];
|
|
1880
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1881
|
+
for (const specifier of Object.keys(this.#modules)) {
|
|
1882
|
+
const view = this.source(specifier);
|
|
1883
|
+
if (view === void 0 || seen.has(view)) continue;
|
|
1884
|
+
seen.add(view);
|
|
1885
|
+
views.push(view);
|
|
1886
|
+
}
|
|
1887
|
+
return views;
|
|
1888
|
+
}
|
|
1797
1889
|
};
|
|
1798
1890
|
//#endregion
|
|
1799
1891
|
//#region src/core/factories.ts
|
|
1800
1892
|
/**
|
|
1801
|
-
*
|
|
1893
|
+
* Creates a structured {@link GuideInterface} view over one guide's markdown
|
|
1802
1894
|
* source — parses once and caches its `sections` / `surface` / `methods` /
|
|
1803
1895
|
* `links` / `tests` / `fences` projections.
|
|
1804
1896
|
*
|
|
@@ -1810,14 +1902,14 @@ var SourceManager = class {
|
|
|
1810
1902
|
* import { createGuide } from '@orkestrel/guide'
|
|
1811
1903
|
*
|
|
1812
1904
|
* const guide = createGuide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
|
|
1813
|
-
* guide.surface() // [{ name: 'X',
|
|
1905
|
+
* guide.surface() // [{ name: 'X', keyword: 'class' }]
|
|
1814
1906
|
* ```
|
|
1815
1907
|
*/
|
|
1816
1908
|
function createGuide(source) {
|
|
1817
1909
|
return new Guide(source);
|
|
1818
1910
|
}
|
|
1819
1911
|
/**
|
|
1820
|
-
*
|
|
1912
|
+
* Creates a pure {@link SourceInterface} over a consumer-supplied file
|
|
1821
1913
|
* inventory — see {@link Source}.
|
|
1822
1914
|
*
|
|
1823
1915
|
* @param options - The file inventory and module scope to reflect
|
|
@@ -1831,14 +1923,14 @@ function createGuide(source) {
|
|
|
1831
1923
|
* files: { 'src/core/Guide.ts': 'export class Guide {}\n' },
|
|
1832
1924
|
* module: 'src/core',
|
|
1833
1925
|
* })
|
|
1834
|
-
* source.exports() // [{ name: 'Guide',
|
|
1926
|
+
* source.exports() // [{ name: 'Guide', keyword: 'class' }]
|
|
1835
1927
|
* ```
|
|
1836
1928
|
*/
|
|
1837
1929
|
function createSource(options) {
|
|
1838
1930
|
return new Source(options);
|
|
1839
1931
|
}
|
|
1840
1932
|
/**
|
|
1841
|
-
*
|
|
1933
|
+
* Creates a {@link SourceManagerInterface} that resolves the consumer's local
|
|
1842
1934
|
* import specifiers and shares one source view per module.
|
|
1843
1935
|
*
|
|
1844
1936
|
* @param options - The shared file inventory and specifier-to-module policy
|
|
@@ -1859,9 +1951,9 @@ function createSourceManager(options) {
|
|
|
1859
1951
|
return new SourceManager(options);
|
|
1860
1952
|
}
|
|
1861
1953
|
/**
|
|
1862
|
-
*
|
|
1954
|
+
* Compiles the {@link surfaceSymbolShape} into a {@link ContractInterface} for
|
|
1863
1955
|
* {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded
|
|
1864
|
-
* generator from one shape declaration (AGENTS §
|
|
1956
|
+
* generator from one shape declaration (AGENTS.md § Design laws).
|
|
1865
1957
|
*
|
|
1866
1958
|
* @returns A `SurfaceSymbol` contract bundling `schema` / `is` / `parse` / `generate`
|
|
1867
1959
|
*
|
|
@@ -1870,16 +1962,16 @@ function createSourceManager(options) {
|
|
|
1870
1962
|
* import { createSurfaceSymbolContract } from '@orkestrel/guide'
|
|
1871
1963
|
*
|
|
1872
1964
|
* const surfaceSymbol = createSurfaceSymbolContract()
|
|
1873
|
-
* surfaceSymbol.is({ name: 'Markdown',
|
|
1965
|
+
* surfaceSymbol.is({ name: 'Markdown', keyword: 'class' }) // true
|
|
1874
1966
|
* ```
|
|
1875
1967
|
*/
|
|
1876
1968
|
function createSurfaceSymbolContract() {
|
|
1877
1969
|
return (0, _orkestrel_contract.createContract)(surfaceSymbolShape);
|
|
1878
1970
|
}
|
|
1879
1971
|
/**
|
|
1880
|
-
*
|
|
1972
|
+
* Compiles the {@link methodGroupShape} into a {@link ContractInterface} for
|
|
1881
1973
|
* {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded
|
|
1882
|
-
* generator from one shape declaration (AGENTS §
|
|
1974
|
+
* generator from one shape declaration (AGENTS.md § Design laws).
|
|
1883
1975
|
*
|
|
1884
1976
|
* @returns A `MethodGroup` contract bundling `schema` / `is` / `parse` / `generate`
|
|
1885
1977
|
*
|
|
@@ -1895,9 +1987,9 @@ function createMethodGroupContract() {
|
|
|
1895
1987
|
return (0, _orkestrel_contract.createContract)(methodGroupShape);
|
|
1896
1988
|
}
|
|
1897
1989
|
/**
|
|
1898
|
-
*
|
|
1990
|
+
* Compiles the {@link manifestEntryShape} into a {@link ContractInterface} for
|
|
1899
1991
|
* {@link ManifestEntry} — a guard, coercing parser, JSON Schema, and seeded
|
|
1900
|
-
* generator from one shape declaration (AGENTS §
|
|
1992
|
+
* generator from one shape declaration (AGENTS.md § Design laws).
|
|
1901
1993
|
*
|
|
1902
1994
|
* @returns A `ManifestEntry` contract bundling `schema` / `is` / `parse` / `generate`
|
|
1903
1995
|
*
|
|
@@ -1913,6 +2005,7 @@ function createManifestEntryContract() {
|
|
|
1913
2005
|
return (0, _orkestrel_contract.createContract)(manifestEntryShape);
|
|
1914
2006
|
}
|
|
1915
2007
|
//#endregion
|
|
2008
|
+
exports.EXPORT_KEYWORDS = EXPORT_KEYWORDS;
|
|
1916
2009
|
exports.EXTERNAL_SCHEMES = EXTERNAL_SCHEMES;
|
|
1917
2010
|
exports.Guide = Guide;
|
|
1918
2011
|
exports.MANIFEST = MANIFEST;
|
|
@@ -1921,51 +2014,52 @@ exports.SURFACE = SURFACE;
|
|
|
1921
2014
|
exports.Source = Source;
|
|
1922
2015
|
exports.SourceManager = SourceManager;
|
|
1923
2016
|
exports.TESTS = TESTS;
|
|
1924
|
-
exports.
|
|
2017
|
+
exports.computeModuleKey = computeModuleKey;
|
|
2018
|
+
exports.computeSymbolKey = computeSymbolKey;
|
|
1925
2019
|
exports.createGuide = createGuide;
|
|
1926
2020
|
exports.createManifestEntryContract = createManifestEntryContract;
|
|
1927
2021
|
exports.createMethodGroupContract = createMethodGroupContract;
|
|
1928
2022
|
exports.createSource = createSource;
|
|
1929
2023
|
exports.createSourceManager = createSourceManager;
|
|
1930
2024
|
exports.createSurfaceSymbolContract = createSurfaceSymbolContract;
|
|
1931
|
-
exports.
|
|
1932
|
-
exports.
|
|
1933
|
-
exports.
|
|
1934
|
-
exports.exportsFrom = exportsFrom;
|
|
2025
|
+
exports.escapeRegExp = escapeRegExp;
|
|
2026
|
+
exports.extractCellLinks = extractCellLinks;
|
|
2027
|
+
exports.extractDeclaration = extractDeclaration;
|
|
1935
2028
|
exports.extractExampleLines = extractExampleLines;
|
|
2029
|
+
exports.extractExampleMethods = extractExampleMethods;
|
|
2030
|
+
exports.extractExamples = extractExamples;
|
|
2031
|
+
exports.extractExports = extractExports;
|
|
2032
|
+
exports.extractFenceImports = extractFenceImports;
|
|
1936
2033
|
exports.extractFences = extractFences;
|
|
2034
|
+
exports.extractHidden = extractHidden;
|
|
1937
2035
|
exports.extractLinks = extractLinks;
|
|
2036
|
+
exports.extractMemberMethods = extractMemberMethods;
|
|
1938
2037
|
exports.extractMethods = extractMethods;
|
|
1939
2038
|
exports.extractSourceLines = extractSourceLines;
|
|
1940
2039
|
exports.extractSurface = extractSurface;
|
|
1941
2040
|
exports.extractTests = extractTests;
|
|
1942
|
-
exports.
|
|
2041
|
+
exports.findFirstCode = findFirstCode;
|
|
2042
|
+
exports.findKindIndex = findKindIndex;
|
|
1943
2043
|
exports.findMissing = findMissing;
|
|
2044
|
+
exports.findMissingSymbols = findMissingSymbols;
|
|
1944
2045
|
exports.findUnexampled = findUnexampled;
|
|
1945
2046
|
exports.findUnlisted = findUnlisted;
|
|
1946
|
-
exports.firstCode = firstCode;
|
|
1947
2047
|
exports.hasCanonicalSegments = hasCanonicalSegments;
|
|
1948
|
-
exports.
|
|
1949
|
-
exports.identifierOf = identifierOf;
|
|
1950
|
-
exports.isExportKind = isExportKind;
|
|
2048
|
+
exports.isExportKeyword = isExportKeyword;
|
|
1951
2049
|
exports.isExternalLink = isExternalLink;
|
|
1952
2050
|
exports.isManifestEntry = isManifestEntry;
|
|
1953
2051
|
exports.isMethodGroup = isMethodGroup;
|
|
1954
2052
|
exports.isSurfaceSymbol = isSurfaceSymbol;
|
|
1955
2053
|
exports.joinHead = joinHead;
|
|
1956
|
-
exports.kindIndex = kindIndex;
|
|
1957
2054
|
exports.manifestEntryShape = manifestEntryShape;
|
|
1958
|
-
exports.memberMethods = memberMethods;
|
|
1959
2055
|
exports.methodGroupShape = methodGroupShape;
|
|
1960
|
-
exports.missingSymbols = missingSymbols;
|
|
1961
|
-
exports.moduleKey = moduleKey;
|
|
1962
2056
|
exports.normalizeDirectories = normalizeDirectories;
|
|
2057
|
+
exports.normalizeIdentifier = normalizeIdentifier;
|
|
1963
2058
|
exports.parseManifest = parseManifest;
|
|
1964
2059
|
exports.resolveLink = resolveLink;
|
|
1965
2060
|
exports.resolvePath = resolvePath;
|
|
1966
|
-
exports.sectionBlocks = sectionBlocks;
|
|
1967
2061
|
exports.selectModuleKeys = selectModuleKeys;
|
|
2062
|
+
exports.selectSectionBlocks = selectSectionBlocks;
|
|
1968
2063
|
exports.surfaceSymbolShape = surfaceSymbolShape;
|
|
1969
|
-
exports.symbolKey = symbolKey;
|
|
1970
2064
|
|
|
1971
2065
|
//# sourceMappingURL=index.cjs.map
|