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

Function nativeOverlayFs

ark/aot/declareNative.ts:626–645  ·  view source on GitHub ↗
(
	overlay: VirtualDeclarations,
	serverFS: Fs["serverFS"],
	cwd: string
)

Source from the content-addressed store, hash-verified

624}
625
626const nativeOverlayFs = (
627 overlay: VirtualDeclarations,
628 serverFS: Fs["serverFS"],
629 cwd: string
630): tsgoFs.FileSystemCallbacks => ({
631 fileExists: path => (overlay.get(path) !== undefined ? true : serverFS.useOS),
632 readFile: path => overlay.get(path) ?? serverFS.useOS,
633 directoryExists: path => (overlay.hasDir(path) ? true : serverFS.useOS),
634 getAccessibleEntries: serverFS.useOS,
635 realpath: path =>
636 overlay.get(path) !== undefined || overlay.hasDir(path) ?
637 tsPath(realpathLongestAncestor(path, cwd))
638 : serverFS.useOS,
639 stat: path =>
640 overlay.get(path) !== undefined || overlay.hasDir(path) ?
641 serverFS.fakeStat
642 : serverFS.useOS,
643 writeFile: serverFS.noop,
644 removeFile: serverFS.noop
645})
646
647export interface DiscoveredNativeProjects {
648 ordered: string[]

Callers 1

openNativeFunction · 0.85

Calls 4

tsPathFunction · 0.90
realpathLongestAncestorFunction · 0.90
hasDirMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected