@avocadostudio-ai/migration-sdk 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,50 @@
1
+ /**
2
+ * HTML section extractor — converts raw HTML into structured sections
3
+ * for LLM-based block mapping.
4
+ *
5
+ * Instead of sending 50KB of raw HTML to the LLM, this module identifies
6
+ * semantic section boundaries, classifies them by CSS class patterns,
7
+ * extracts structured content, and resolves lazy-loaded images.
8
+ */
9
+ import type { ExtractedSection, NavExtraction, PageOutline, LayoutNode, VisualSection, RepeatGroup } from "./types.ts";
10
+ /** Classify a section by its CSS classes and content */
11
+ export declare function classifySection(openTag: string, innerHTML: string, preExtracted?: {
12
+ headings: Array<{
13
+ level: number;
14
+ text: string;
15
+ }>;
16
+ }): {
17
+ classHints: string[];
18
+ suggestedBlockType?: string;
19
+ };
20
+ /**
21
+ * Extract structured sections from HTML.
22
+ *
23
+ * Identifies section boundaries using semantic tags, Elementor containers,
24
+ * and generic div analysis. Classifies each section by CSS class patterns
25
+ * and content heuristics. Resolves lazy-loaded images.
26
+ */
27
+ export declare function extractSections(html: string, baseUrl: string): ExtractedSection[];
28
+ /**
29
+ * Segment layout nodes into visual sections by detecting vertical gaps.
30
+ */
31
+ export declare function segmentByVisualGaps(nodes: LayoutNode[], viewportWidth?: number): VisualSection[];
32
+ /**
33
+ * Detect repeated structural patterns within a set of layout nodes.
34
+ * Groups nodes by structural signature and classifies repeat groups.
35
+ */
36
+ export declare function detectRepeatedPatterns(nodes: LayoutNode[]): RepeatGroup[];
37
+ /**
38
+ * Extract a compact page outline from HTML.
39
+ *
40
+ * Splits the page at heading boundaries (h1/h2) to produce a section-per-heading
41
+ * representation that captures the FULL page structure in ~2KB regardless of HTML size.
42
+ * This ensures the LLM sees every section even when the raw HTML is truncated.
43
+ */
44
+ export declare function extractPageOutline(html: string, baseUrl: string, layoutNodes?: LayoutNode[]): PageOutline;
45
+ export declare function extractNavigation(html: string, baseUrl: string): NavExtraction;
46
+ /**
47
+ * Resolve lazy-loaded image sources in HTML.
48
+ * Replaces data-src, data-lazy-src, etc. with actual src attributes.
49
+ */
50
+ export declare function resolveLazyImages(html: string): string;