| import path from 'node:path'; |
| import fs from 'node:fs/promises'; |
| import { c as collectionReader, s as singletonReader } from '../../dist/generic-71b58c64.node.esm.js'; |
| import '@keystar/ui/checkbox'; |
| import '@keystar/ui/typography'; |
| import 'react/jsx-runtime'; |
| import '@keystar/ui/text-field'; |
| import 'react'; |
| import '../../dist/cloud-image-preview-5844b305.node.esm.js'; |
| import '@markdoc/markdoc'; |
| import 'slate'; |
| import 'emery/assertions'; |
| import 'emery'; |
| import '@keystar/ui/field'; |
| import '@keystar/ui/layout'; |
| import '@keystar/ui/split-view'; |
| import '@keystar/ui/button'; |
| import '@keystar/ui/dialog'; |
| import '@keystar/ui/drag-and-drop'; |
| import '@keystar/ui/icon'; |
| import '@keystar/ui/icon/icons/trash2Icon'; |
| import '@keystar/ui/list-view'; |
| import '@keystar/ui/slots'; |
| import '@keystar/ui/tooltip'; |
| import '@react-aria/i18n'; |
| import '../../dist/languages-0f35f3f7.node.esm.js'; |
| import '@braintree/sanitize-url'; |
| import 'slate-react'; |
| import 'is-hotkey'; |
| import '@keystar/ui/style'; |
| import '@keystar/ui/icon/icons/editIcon'; |
| import '@keystar/ui/icon/icons/externalLinkIcon'; |
| import '@keystar/ui/icon/icons/linkIcon'; |
| import '@keystar/ui/icon/icons/unlinkIcon'; |
| import '@keystar/ui/action-group'; |
| import '@keystar/ui/icon/icons/boldIcon'; |
| import '@keystar/ui/icon/icons/chevronDownIcon'; |
| import '@keystar/ui/icon/icons/codeIcon'; |
| import '@keystar/ui/icon/icons/italicIcon'; |
| import '@keystar/ui/icon/icons/maximizeIcon'; |
| import '@keystar/ui/icon/icons/minimizeIcon'; |
| import '@keystar/ui/icon/icons/plusIcon'; |
| import '@keystar/ui/icon/icons/removeFormattingIcon'; |
| import '@keystar/ui/icon/icons/strikethroughIcon'; |
| import '@keystar/ui/icon/icons/subscriptIcon'; |
| import '@keystar/ui/icon/icons/superscriptIcon'; |
| import '@keystar/ui/icon/icons/typeIcon'; |
| import '@keystar/ui/icon/icons/underlineIcon'; |
| import '@keystar/ui/menu'; |
| import '@keystar/ui/picker'; |
| import '@keystar/ui/icon/icons/alignLeftIcon'; |
| import '@keystar/ui/icon/icons/alignRightIcon'; |
| import '@keystar/ui/icon/icons/alignCenterIcon'; |
| import '@keystar/ui/icon/icons/quoteIcon'; |
| import '@react-stately/collections'; |
| import 'match-sorter'; |
| import '@keystar/ui/combobox'; |
| import '@keystar/ui/icon/icons/trashIcon'; |
| import '@emotion/weak-memoize'; |
| import '@keystar/ui/icon/icons/minusIcon'; |
| import '@keystar/ui/icon/icons/columnsIcon'; |
| import '@keystar/ui/icon/icons/listIcon'; |
| import '@keystar/ui/icon/icons/listOrderedIcon'; |
| import '@keystar/ui/icon/icons/fileUpIcon'; |
| import '@keystar/ui/icon/icons/imageIcon'; |
| import '@keystar/ui/number-field'; |
| import 'minimatch'; |
| import '@ts-gql/tag/no-transform'; |
| import 'urql'; |
| import 'lru-cache'; |
| import 'zod'; |
| import '@sindresorhus/slugify'; |
| import '@keystar/ui/link'; |
| import '@keystar/ui/progress'; |
| import '@react-stately/overlays'; |
| import '@keystar/ui/icon/icons/link2Icon'; |
| import '@keystar/ui/icon/icons/link2OffIcon'; |
| import '@keystar/ui/icon/icons/pencilIcon'; |
| import '@keystar/ui/icon/icons/undo2Icon'; |
| import '@keystar/ui/utils'; |
| import '@keystar/ui/icon/icons/sheetIcon'; |
| import '@keystar/ui/icon/icons/tableIcon'; |
| import 'scroll-into-view-if-needed'; |
| import '@react-aria/overlays'; |
| import '@react-stately/list'; |
| import '@keystar/ui/listbox'; |
| import '@keystar/ui/overlays'; |
| import 'slate-history'; |
| import 'mdast-util-from-markdown'; |
| import 'mdast-util-gfm-autolink-literal/from-markdown'; |
| import 'micromark-extension-gfm-autolink-literal'; |
| import 'mdast-util-gfm-strikethrough/from-markdown'; |
| import 'micromark-extension-gfm-strikethrough'; |
| import 'js-base64'; |
| import '@keystar/ui/icon/icons/panelLeftOpenIcon'; |
| import '@keystar/ui/icon/icons/panelLeftCloseIcon'; |
| import '@keystar/ui/icon/icons/panelRightOpenIcon'; |
| import '@keystar/ui/icon/icons/panelRightCloseIcon'; |
| import '@react-aria/utils'; |
| import '@keystar/ui/badge'; |
| import '@keystar/ui/nav-list'; |
| import '@keystar/ui/status-light'; |
| import '@keystar/ui/core'; |
| import 'crypto'; |
| import 'cookie'; |
| import '../../dist/required-files-f12cd7f9.node.esm.js'; |
| import 'js-yaml'; |
|
|
| function createReader(repoPath, config) { |
| const fs$1 = { |
| async fileExists(path$1) { |
| try { |
| await fs.stat(path.join(repoPath, path$1)); |
| return true; |
| } catch (err) { |
| if (err.code === 'ENOENT') return false; |
| throw err; |
| } |
| }, |
| async readdir(path$1) { |
| try { |
| const entries = await fs.readdir(path.join(repoPath, path$1), { |
| withFileTypes: true |
| }); |
| const filtered = []; |
| for (const entry of entries) { |
| if (entry.isDirectory()) { |
| filtered.push({ |
| name: entry.name, |
| kind: 'directory' |
| }); |
| } |
| if (entry.isFile()) { |
| filtered.push({ |
| name: entry.name, |
| kind: 'file' |
| }); |
| } |
| } |
| return filtered; |
| } catch (err) { |
| if (err.code === 'ENOENT') return []; |
| throw err; |
| } |
| }, |
| async readFile(path$1) { |
| try { |
| return await fs.readFile(path.join(repoPath, path$1)); |
| } catch (err) { |
| if (err.code === 'ENOENT') return null; |
| throw err; |
| } |
| } |
| }; |
| return { |
| collections: Object.fromEntries(Object.keys(config.collections || {}).map(key => [key, collectionReader(key, config, fs$1)])), |
| singletons: Object.fromEntries(Object.keys(config.singletons || {}).map(key => [key, singletonReader(key, config, fs$1)])), |
| repoPath, |
| config |
| }; |
| } |
|
|
| export { createReader }; |