jsdoczoom 1.0.0 → 1.2.1

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.
@@ -35,6 +35,56 @@ export declare function getLanguageService(
35
35
  * @internal
36
36
  */
37
37
  export declare function resetCache(): void;
38
+ /**
39
+ * Splits annotated .d.ts text into individual declaration chunks.
40
+ *
41
+ * Splits on blank-line boundaries that precede a line annotation (`// L`)
42
+ * or a declaration keyword (`export`, `declare`). Each chunk is a complete
43
+ * declaration including its preceding JSDoc comment and line annotation.
44
+ * Trailing whitespace is trimmed from each chunk. Empty chunks are filtered out.
45
+ *
46
+ * @param dtsText - The annotated .d.ts text to split
47
+ * @returns Array of declaration chunks
48
+ */
49
+ export declare function splitDeclarations(dtsText: string): string[];
50
+ /** A single top-level source block with its line annotation. */
51
+ export interface SourceBlock {
52
+ annotation: string;
53
+ blockText: string;
54
+ }
55
+ /**
56
+ * Extracts all top-level source blocks from a TypeScript file.
57
+ * Walks all top-level statements (not just exported), includes leading
58
+ * JSDoc comments, and annotates each block with source line references.
59
+ * Import declarations are excluded.
60
+ *
61
+ * Returns an empty array for empty files.
62
+ *
63
+ * @param filePath - Absolute path to the TypeScript source file
64
+ * @param content - Pre-read file content (avoids redundant disk read)
65
+ */
66
+ export declare function extractAllSourceBlocks(
67
+ filePath: string,
68
+ content: string,
69
+ ): SourceBlock[];
70
+ /**
71
+ * Extracts top-level source blocks from a file that match a regex.
72
+ *
73
+ * Walks all top-level statements (not just exported ones), includes leading
74
+ * JSDoc comments, and tests the regex against each block's source text.
75
+ * Matching blocks are annotated with `// LN` or `// LN-LM` and joined with
76
+ * blank line separators.
77
+ *
78
+ * @param filePath - Absolute path to the TypeScript source file
79
+ * @param content - Pre-read file content (avoids redundant disk read)
80
+ * @param regex - Regular expression to test against each block's source text
81
+ * @returns Annotated matching blocks joined with blank lines, or null if no match
82
+ */
83
+ export declare function extractSourceBlocks(
84
+ filePath: string,
85
+ content: string,
86
+ regex: RegExp,
87
+ ): string | null;
38
88
  /**
39
89
  * Generates TypeScript declaration output from a source file.
40
90
  *
@@ -54,4 +104,6 @@ export declare function resetCache(): void;
54
104
  * @returns The declaration output as a string
55
105
  * @throws {JsdocError} If the file cannot be read or parsed
56
106
  */
57
- export declare function generateTypeDeclarations(filePath: string): string;
107
+ export declare function generateTypeDeclarations(
108
+ filePath: string,
109
+ ): Promise<string>;