@oa-sdk/spec-bundler 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ import type { LinkDiagnostic, LinkResolutionConfig } from "./types.js";
2
+ /**
3
+ * Temporarily masks code blocks and inline code to prevent false-positive link mutations.
4
+ * Provides character-accurate original line and column mapping.
5
+ */
6
+ export declare function maskCodeBlocks(markdown: string): {
7
+ masked: string;
8
+ restore: (text: string) => string;
9
+ getOriginalPosition: (maskedOffset: number) => {
10
+ line: number;
11
+ column: number;
12
+ offset: number;
13
+ };
14
+ };
15
+ /**
16
+ * Resolves a raw href from markdown to an absolute local filesystem path.
17
+ */
18
+ export declare function resolveLocalPath(rawPath: string, sourceFileAbs: string, workspaceRoot: string): string | null;
19
+ /**
20
+ * Rewrites markdown links and reference definitions in a file so that they point to bundle-relative locations.
21
+ */
22
+ export declare function rewriteMarkdownContent(content: string, sourceFileAbs: string, bundleDestPath: string, sourceAbsToBundleDest: Map<string, string>, workspaceRoot: string, config?: LinkResolutionConfig): {
23
+ rewritten: string;
24
+ diagnostics: LinkDiagnostic[];
25
+ };
26
+ /**
27
+ * Rewrites TypeSpec (@evidence, relative import, and @doc markdown) references in a file
28
+ * so that they point to bundle-relative locations.
29
+ */
30
+ export declare function rewriteTypeSpecContent(content: string, sourceFileAbs: string, bundleDestPath: string, sourceAbsToBundleDest: Map<string, string>, workspaceRoot: string, config?: LinkResolutionConfig): {
31
+ rewritten: string;
32
+ diagnostics: LinkDiagnostic[];
33
+ };
34
+ /**
35
+ * Normalizes heading text into a GitHub CommonMark-compliant anchor slug.
36
+ * Supports Unicode (Korean, CJK, etc.) and alphanumeric characters.
37
+ */
38
+ export declare function normalizeSlug(text: string): string;
39
+ export interface DocumentAnchors {
40
+ readonly slugs: Set<string>;
41
+ readonly explicit: Set<string>;
42
+ readonly all: Set<string>;
43
+ }
44
+ export declare function extractDocumentAnchors(content: string): DocumentAnchors;
45
+ /**
46
+ * Finds high-confidence closest candidate anchor in existingAnchors using Levenshtein distance.
47
+ */
48
+ export declare function findClosestAnchor(missingAnchor: string, existingAnchors: Set<string>): string | null;
49
+ /**
50
+ * Verifies that all relative markdown and TypeSpec links point to files that actually exist within the bundle.
51
+ */
52
+ export declare function verifyBundleLinkIntegrity(bundleEntries: Map<string, string | Buffer>, options?: {
53
+ severity?: "warning" | "error";
54
+ unbundledPolicy?: string;
55
+ checkAnchors?: boolean;
56
+ }): LinkDiagnostic[];
57
+ /**
58
+ * Calculates Levenshtein edit distance between two strings.
59
+ */
60
+ export declare function levenshteinDistance(a: string, b: string): number;
61
+ /**
62
+ * Finds high-confidence closest candidate file path in existingFiles for a missing target path.
63
+ */
64
+ export declare function findClosestFile(missingPath: string, existingFiles: Set<string>): string | null;
65
+ //# sourceMappingURL=link-rewriter.d.ts.map