MCPcopy Create free account
hub / github.com/arktypeio/arktype / resolveFolder

Function resolveFolder

ark/docs/lib/content/pageTree.ts:171–194  ·  view source on GitHub ↗
(dir: string, section: string)

Source from the content-addressed store, hash-verified

169 )
170
171 const resolveFolder = (dir: string, section: string): NavFolder => {
172 const meta = readMeta(dir) ?? {}
173 const entries = meta.pages ?? defaultEntries(dir)
174 const indexPath = join(dir, "index.mdx")
175 let index: Page | undefined
176 if (!entries.includes("index") && existsSync(indexPath)) {
177 index = loadPage(indexPath, section)
178 listPage(index)
179 }
180 const folder: NavFolder = {
181 kind: "folder",
182 title: meta.title ?? index?.frontmatter.title ?? dir.split(sep).at(-1)!,
183 defaultOpen: meta.defaultOpen ?? false,
184 index,
185 items: resolveEntries(
186 dir,
187 entries.filter(entry => entry !== "index" || !index),
188 section
189 )
190 }
191 const icon = meta.icon ?? index?.frontmatter.icon
192 if (icon) folder.icon = icon
193 return folder
194 }
195
196 const rootMeta = readMeta(contentDir) ?? {}
197 const sectionIds = [

Callers 1

resolveEntriesFunction · 0.85

Calls 8

readMetaFunction · 0.85
defaultEntriesFunction · 0.85
joinFunction · 0.85
loadPageFunction · 0.85
listPageFunction · 0.85
resolveEntriesFunction · 0.85
filterMethod · 0.80
atMethod · 0.45

Tested by

no test coverage detected