filesystem simulation
This commit is contained in:
parent
460cdc5aec
commit
02d67a6f96
7 changed files with 667 additions and 8 deletions
|
|
@ -226,8 +226,11 @@ export function hoist<A, E, T extends Tag, const Items extends Replacements = re
|
|||
return { ...node, dependencies: node.dependencies.map(context.visit) }
|
||||
}
|
||||
if (node.tag === tag) {
|
||||
// Replacement rewriting can produce copies of the same node with
|
||||
// rewritten dependencies, so compare implementations rather than
|
||||
// object identity: only a different layer is a real conflict.
|
||||
const existing = hoisted.get(node.name)
|
||||
if (existing && existing !== node) {
|
||||
if (existing && existing.implementation !== node.implementation) {
|
||||
throw new Error(`Tag ${tag} has conflicting implementations for ${node.name}`)
|
||||
}
|
||||
hoisted.set(node.name, node)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export namespace FSUtil {
|
|||
|
||||
export const use = serviceUse(Service)
|
||||
|
||||
const layer = Layer.effect(
|
||||
// Exported so simulation can wrap this layer and override the methods that
|
||||
// bypass the injected FileSystem (readDirectoryEntries, glob, globUp).
|
||||
export const layer = Layer.effect(
|
||||
Service,
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue