summaryrefslogtreecommitdiffhomepage
path: root/packages/shared/src
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-15 22:39:59 -0400
committerGitHub <[email protected]>2026-04-16 02:39:59 +0000
commit6c7e9f6f3ac211454576e6e51cc5ff65718cd491 (patch)
tree6d6caacf16a0130e2e653ff06aa43fabbe0e449f /packages/shared/src
parent48f88af9aa930e245321b2cec5765896b02c36ef (diff)
downloadopencode-6c7e9f6f3ac211454576e6e51cc5ff65718cd491.tar.gz
opencode-6c7e9f6f3ac211454576e6e51cc5ff65718cd491.zip
refactor: migrate Effect call sites from Flock to EffectFlock (#22688)
Diffstat (limited to 'packages/shared/src')
-rw-r--r--packages/shared/src/npm.ts8
-rw-r--r--packages/shared/src/util/effect-flock.ts2
2 files changed, 6 insertions, 4 deletions
diff --git a/packages/shared/src/npm.ts b/packages/shared/src/npm.ts
index 994ec04da..8bd0cc468 100644
--- a/packages/shared/src/npm.ts
+++ b/packages/shared/src/npm.ts
@@ -5,7 +5,7 @@ import { Effect, Schema, Context, Layer, Option, FileSystem } from "effect"
import { NodeFileSystem } from "@effect/platform-node"
import { AppFileSystem } from "./filesystem"
import { Global } from "./global"
-import { Flock } from "./util/flock"
+import { EffectFlock } from "./util/effect-flock"
export namespace Npm {
export class InstallFailedError extends Schema.TaggedErrorClass<InstallFailedError>()("NpmInstallFailedError", {
@@ -62,6 +62,7 @@ export namespace Npm {
const afs = yield* AppFileSystem.Service
const global = yield* Global.Service
const fs = yield* FileSystem.FileSystem
+ const flock = yield* EffectFlock.Service
const directory = (pkg: string) => path.join(global.cache, "packages", sanitize(pkg))
const outdated = Effect.fn("Npm.outdated")(function* (pkg: string, cachedVersion: string) {
@@ -92,7 +93,7 @@ export namespace Npm {
const add = Effect.fn("Npm.add")(function* (pkg: string) {
const dir = directory(pkg)
- yield* Flock.effect(`npm-install:${dir}`)
+ yield* flock.acquire(`npm-install:${dir}`)
const arborist = new Arborist({
path: dir,
@@ -133,7 +134,7 @@ export namespace Npm {
}, Effect.scoped)
const install = Effect.fn("Npm.install")(function* (dir: string) {
- yield* Flock.effect(`npm-install:${dir}`)
+ yield* flock.acquire(`npm-install:${dir}`)
const reify = Effect.fnUntraced(function* () {
const arb = new Arborist({
@@ -240,6 +241,7 @@ export namespace Npm {
)
export const defaultLayer = layer.pipe(
+ Layer.provide(EffectFlock.layer),
Layer.provide(AppFileSystem.layer),
Layer.provide(Global.layer),
Layer.provide(NodeFileSystem.layer),
diff --git a/packages/shared/src/util/effect-flock.ts b/packages/shared/src/util/effect-flock.ts
index d728c0ef1..3e00afc9e 100644
--- a/packages/shared/src/util/effect-flock.ts
+++ b/packages/shared/src/util/effect-flock.ts
@@ -274,5 +274,5 @@ export namespace EffectFlock {
}),
)
- export const live = layer.pipe(Layer.provide(AppFileSystem.defaultLayer))
+ export const defaultLayer = layer.pipe(Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Global.layer))
}