File size: 884 Bytes
fea495a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { SegmentNodeState } from '../userspace/app/segment-explorer-node';
/**
 * Trie data structure for storing and searching paths
 *
 * This can be used to store app router paths and search for them efficiently.
 * e.g.
 *
 * [trie root]
 *   β”œβ”€β”€ layout.js
 *   β”œβ”€β”€ page.js
 *   β”œβ”€β”€ blog
 *       β”œβ”€β”€ layout.js
 *       β”œβ”€β”€ page.js
 *       β”œβ”€β”€ [slug]
 *          β”œβ”€β”€ layout.js
 *          β”œβ”€β”€ page.js
 **/
type TrieNode<Value = string> = {
    value: Value | undefined;
    children: {
        [key: string]: TrieNode<Value> | undefined;
    };
};
export type SegmentTrieNode = TrieNode<SegmentNodeState>;
export declare const insertSegmentNode: (value: SegmentNodeState) => void;
export declare const removeSegmentNode: (value: SegmentNodeState) => void;
export declare function useSegmentTree(): SegmentTrieNode;
export {};