@orkestrel/guide 0.0.27 → 0.0.29
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.cjs +5 -28
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +0 -21
- package/dist/src/core/index.d.ts +0 -21
- package/dist/src/core/index.js +7 -29
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +31 -4
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +15 -0
- package/dist/src/server/index.d.ts +15 -0
- package/dist/src/server/index.js +31 -5
- package/dist/src/server/index.js.map +1 -1
- package/package.json +6 -6
package/dist/src/core/index.cjs
CHANGED
|
@@ -961,7 +961,7 @@ function findUnexampled(names, fences, examples) {
|
|
|
961
961
|
const exampled = new Set(examples);
|
|
962
962
|
return names.filter((name) => {
|
|
963
963
|
if (exampled.has(name)) return false;
|
|
964
|
-
const boundary = new RegExp(`\\b${escapeRegExp(name)}\\b`);
|
|
964
|
+
const boundary = new RegExp(`\\b${(0, _orkestrel_contract.escapeRegExp)(name)}\\b`);
|
|
965
965
|
return !fences.some((fence) => boundary.test(fence));
|
|
966
966
|
});
|
|
967
967
|
}
|
|
@@ -1098,7 +1098,7 @@ function findFirstCode(nodes) {
|
|
|
1098
1098
|
*/
|
|
1099
1099
|
function extractCellLinks(cell) {
|
|
1100
1100
|
const links = [];
|
|
1101
|
-
for (const node of (0, _orkestrel_markdown.
|
|
1101
|
+
for (const node of (0, _orkestrel_markdown.walkMarkdownNodes)({
|
|
1102
1102
|
element: "paragraph",
|
|
1103
1103
|
children: cell
|
|
1104
1104
|
})) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
|
|
@@ -1642,28 +1642,6 @@ function joinHead(lines, start) {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
1644
|
/**
|
|
1645
|
-
* Escapes every regex metacharacter in a literal string so it reads as text
|
|
1646
|
-
* inside a larger `RegExp` source rather than as syntax.
|
|
1647
|
-
*
|
|
1648
|
-
* @remarks
|
|
1649
|
-
* A caller-supplied name reaches a `RegExp` through this: {@link
|
|
1650
|
-
* findUnexampled} splices it into a word-boundary search, so a name carrying
|
|
1651
|
-
* `$`, `(`, `[`, or `.` matches that character literally instead of throwing or
|
|
1652
|
-
* matching text it does not name. Pure and total; never throws.
|
|
1653
|
-
*
|
|
1654
|
-
* @param value - The literal string to escape
|
|
1655
|
-
* @returns `value` with every regex metacharacter backslash-escaped
|
|
1656
|
-
*
|
|
1657
|
-
* @example
|
|
1658
|
-
* ```ts
|
|
1659
|
-
* escapeRegExp('A.B') // 'A\\.B'
|
|
1660
|
-
* new RegExp(`^${escapeRegExp('A.B')}$`).test('AxB') // false
|
|
1661
|
-
* ```
|
|
1662
|
-
*/
|
|
1663
|
-
function escapeRegExp(value) {
|
|
1664
|
-
return value.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
1665
|
-
}
|
|
1666
|
-
/**
|
|
1667
1645
|
* Collects every `export class` / `export interface` declaration one file's source text declares,
|
|
1668
1646
|
* each keyed `${keyword} ${name}` and carrying the body lines and the base identifiers read from
|
|
1669
1647
|
* its own head, so a body and a heritage clause always come from the same declaration.
|
|
@@ -2178,7 +2156,7 @@ function extractUnnamed(document) {
|
|
|
2178
2156
|
*/
|
|
2179
2157
|
function extractLinks(document) {
|
|
2180
2158
|
const links = [];
|
|
2181
|
-
for (const node of (0, _orkestrel_markdown.
|
|
2159
|
+
for (const node of (0, _orkestrel_markdown.walkMarkdownNodes)(document)) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
|
|
2182
2160
|
return links;
|
|
2183
2161
|
}
|
|
2184
2162
|
/**
|
|
@@ -2195,7 +2173,7 @@ function extractLinks(document) {
|
|
|
2195
2173
|
*/
|
|
2196
2174
|
function extractTests(document) {
|
|
2197
2175
|
const links = [];
|
|
2198
|
-
for (const block of selectSectionBlocks(document, TESTS)) for (const node of (0, _orkestrel_markdown.
|
|
2176
|
+
for (const block of selectSectionBlocks(document, TESTS)) for (const node of (0, _orkestrel_markdown.walkMarkdownNodes)(block)) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
|
|
2199
2177
|
return links;
|
|
2200
2178
|
}
|
|
2201
2179
|
/**
|
|
@@ -2731,7 +2709,7 @@ function extractFences(document) {
|
|
|
2731
2709
|
*/
|
|
2732
2710
|
function collectFences(document) {
|
|
2733
2711
|
const fences = [];
|
|
2734
|
-
Iterator.from((0, _orkestrel_markdown.
|
|
2712
|
+
Iterator.from((0, _orkestrel_markdown.walkMarkdownNodes)(document)).reduce((title, node) => {
|
|
2735
2713
|
if ((0, _orkestrel_markdown.isHeadingNode)(node)) return (0, _orkestrel_markdown.flattenText)(node).trim();
|
|
2736
2714
|
if ((0, _orkestrel_markdown.isCodeBlockNode)(node)) fences.push([node, {
|
|
2737
2715
|
language: node.lang,
|
|
@@ -4711,7 +4689,6 @@ exports.createSourceExampleContract = createSourceExampleContract;
|
|
|
4711
4689
|
exports.createSourceManager = createSourceManager;
|
|
4712
4690
|
exports.createSurfaceSymbolContract = createSurfaceSymbolContract;
|
|
4713
4691
|
exports.driftShape = driftShape;
|
|
4714
|
-
exports.escapeRegExp = escapeRegExp;
|
|
4715
4692
|
exports.extractBodyLines = extractBodyLines;
|
|
4716
4693
|
exports.extractCellLinks = extractCellLinks;
|
|
4717
4694
|
exports.extractCellText = extractCellText;
|