| import nodePath from 'node:path'; |
| import nodeFs from 'node:fs/promises'; |
| import { c as collectionReader, s as singletonReader } from './generic-4cf09612.js'; |
| import 'react'; |
| import '@keystar/ui/picker'; |
| import './index-f4dc5ec4.js'; |
| import '@markdoc/markdoc/dist/index.mjs'; |
| import './react-compiler-runtime-0011f46e.js'; |
| import '@keystar/ui/field'; |
| import '@keystar/ui/layout'; |
| import '@keystar/ui/typography'; |
| import '@keystar/ui/style'; |
| import 'prosemirror-commands'; |
| import 'prosemirror-state'; |
| import 'prosemirror-transform'; |
| import '@keystar/ui/button'; |
| import '@keystar/ui/editor'; |
| import '@keystar/ui/icon'; |
| 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/listIcon'; |
| import '@keystar/ui/icon/icons/listOrderedIcon'; |
| import '@keystar/ui/icon/icons/minusIcon'; |
| import '@keystar/ui/icon/icons/plusIcon'; |
| import '@keystar/ui/icon/icons/quoteIcon'; |
| import '@keystar/ui/icon/icons/removeFormattingIcon'; |
| import '@keystar/ui/icon/icons/strikethroughIcon'; |
| import '@keystar/ui/icon/icons/tableIcon'; |
| import '@keystar/ui/menu'; |
| import '@keystar/ui/tooltip'; |
| import '@keystar/ui/icon/icons/fileCodeIcon'; |
| import '@keystar/ui/icon/icons/heading1Icon'; |
| import '@keystar/ui/icon/icons/heading2Icon'; |
| import '@keystar/ui/icon/icons/heading3Icon'; |
| import '@keystar/ui/icon/icons/heading4Icon'; |
| import '@keystar/ui/icon/icons/heading5Icon'; |
| import '@keystar/ui/icon/icons/heading6Icon'; |
| import '@keystar/ui/icon/icons/imageIcon'; |
| import '@keystar/ui/icon/icons/separatorHorizontalIcon'; |
| import 'prosemirror-model'; |
| import '@emotion/css'; |
| import '@keystar/ui/dialog'; |
| import 'emery'; |
| import './index-48f075ab.js'; |
| import '@react-stately/overlays'; |
| import 'slate-react'; |
| import 'superstruct'; |
| import '@keystar/ui/drag-and-drop'; |
| import '@keystar/ui/icon/icons/link2Icon'; |
| import '@keystar/ui/icon/icons/link2OffIcon'; |
| import '@keystar/ui/icon/icons/pencilIcon'; |
| import '@keystar/ui/icon/icons/trash2Icon'; |
| import '@keystar/ui/icon/icons/undo2Icon'; |
| import '@keystar/ui/link'; |
| import '@keystar/ui/number-field'; |
| import '@keystar/ui/progress'; |
| import '@keystar/ui/slots'; |
| import '@keystar/ui/text-field'; |
| import '@keystar/ui/toast'; |
| import '@keystar/ui/utils'; |
| import 'slate'; |
| import '@react-aria/overlays'; |
| import '@react-aria/utils'; |
| import '@keystar/ui/overlays'; |
| import 'react/jsx-runtime'; |
| import 'y-protocols/awareness'; |
| import 'yjs'; |
| import '@toeverything/y-indexeddb'; |
| import 'lib0/broadcastchannel'; |
| import 'lib0/time'; |
| import 'lib0/encoding'; |
| import 'lib0/decoding'; |
| import 'y-protocols/sync'; |
| import 'y-protocols/auth'; |
| import 'lib0/mutex'; |
| import 'lib0/math'; |
| import '@emotion/weak-memoize'; |
| import 'cookie'; |
| import '@ts-gql/tag/no-transform'; |
| import 'urql'; |
| import './base64-3538d789.js'; |
| import '@react-aria/i18n'; |
| import 'idb-keyval'; |
| import 'lru-cache'; |
| import 'partysocket/ws'; |
| import 'lib0/encoding.js'; |
| import '@keystar/ui/avatar'; |
| import '@keystar/ui/list-view'; |
| import '@react-aria/label'; |
| import 'is-hotkey'; |
| import '@keystar/ui/split-view'; |
| 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 '@keystar/ui/badge'; |
| import '@keystar/ui/nav-list'; |
| import '@keystar/ui/status-light'; |
| import '@keystar/ui/core'; |
| import '@react-stately/collections'; |
| import '@keystar/ui/icon/icons/logOutIcon'; |
| import '@keystar/ui/icon/icons/gitPullRequestIcon'; |
| import '@keystar/ui/icon/icons/gitBranchPlusIcon'; |
| import '@keystar/ui/icon/icons/githubIcon'; |
| import '@keystar/ui/icon/icons/gitForkIcon'; |
| import '@keystar/ui/icon/icons/monitorIcon'; |
| import '@keystar/ui/icon/icons/moonIcon'; |
| import '@keystar/ui/icon/icons/sunIcon'; |
| import '@keystar/ui/icon/icons/userIcon'; |
| import '@keystar/ui/combobox'; |
| import '@keystar/ui/icon/icons/gitBranchIcon'; |
| import '@keystar/ui/radio'; |
| 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 '@braintree/sanitize-url'; |
| import '@keystar/ui/action-group'; |
| import '@keystar/ui/icon/icons/maximizeIcon'; |
| import '@keystar/ui/icon/icons/minimizeIcon'; |
| 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/icon/icons/alignLeftIcon'; |
| import '@keystar/ui/icon/icons/alignRightIcon'; |
| import '@keystar/ui/icon/icons/alignCenterIcon'; |
| import 'match-sorter'; |
| import 'emery/assertions'; |
| import '@keystar/ui/icon/icons/trashIcon'; |
| import '@keystar/ui/icon/icons/columnsIcon'; |
| import '@keystar/ui/icon/icons/fileUpIcon'; |
| import '@keystar/ui/checkbox'; |
| import '@keystar/ui/action-bar'; |
| import 'minimatch'; |
| import '@keystar/ui/icon/icons/refreshCwIcon'; |
| import '@sindresorhus/slugify'; |
| import 'y-prosemirror'; |
| import '@keystar/ui/icon/icons/sheetIcon'; |
| import 'scroll-into-view-if-needed'; |
| import '@react-stately/list'; |
| import '@keystar/ui/listbox'; |
| import 'slate-history'; |
| import 'mdast-util-from-markdown'; |
| import 'mdast-util-gfm-autolink-literal'; |
| import 'micromark-extension-gfm-autolink-literal'; |
| import 'mdast-util-gfm-strikethrough'; |
| import 'micromark-extension-gfm-strikethrough'; |
| import 'prosemirror-view'; |
| import '@react-aria/selection'; |
| import 'prosemirror-tables'; |
| import 'react-dom'; |
| import 'prosemirror-history'; |
| import 'prosemirror-keymap'; |
| import 'escape-string-regexp'; |
| import 'mdast-util-to-markdown'; |
| import 'mdast-util-gfm-table'; |
| import 'mdast-util-mdx'; |
| import 'micromark-extension-gfm-table'; |
| import 'micromark-extension-mdxjs'; |
| import 'unist-util-visit'; |
| import './required-files-bd819871.js'; |
| import 'js-yaml'; |
|
|
| function createReader(repoPath, config) { |
| const fs = { |
| async fileExists(path) { |
| try { |
| await nodeFs.stat(nodePath.join(repoPath, path)); |
| return true; |
| } catch (err) { |
| if (err.code === 'ENOENT') return false; |
| throw err; |
| } |
| }, |
| async readdir(path) { |
| try { |
| const entries = await nodeFs.readdir(nodePath.join(repoPath, path), { |
| 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) { |
| try { |
| return await nodeFs.readFile(nodePath.join(repoPath, path)); |
| } 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)])), |
| singletons: Object.fromEntries(Object.keys(config.singletons || {}).map(key => [key, singletonReader(key, config, fs)])), |
| repoPath, |
| config |
| }; |
| } |
|
|
| export { createReader }; |