@opencode/util 0.0.0-dev-1358 → 0.0.0-dev-1360

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/npm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * as Npm from "./npm.js";
2
- import { Effect, Schema, Context } from "effect";
2
+ import { Effect, Schema, Context, Layer } from "effect";
3
3
  import { EffectFlock } from "./effect-flock.js";
4
4
  declare const InstallFailedError_base: Schema.Class<InstallFailedError, Schema.TaggedStruct<"NpmInstallFailedError", {
5
5
  readonly add: Schema.optional<Schema.$Array<Schema.String>>;
@@ -40,4 +40,5 @@ export declare function sanitize(pkg: string): string;
40
40
  export declare function isRegistryPackage(pkg: string): Promise<boolean>;
41
41
  export declare function isInstallablePackage(pkg: string): Promise<boolean>;
42
42
  export declare function cacheKey(pkg: string): Promise<string>;
43
+ export declare const unsupportedLayer: Layer.Layer<Service, never, never>;
43
44
  export declare const node: import("./effect/layer-node.js").Provider<Service, never, import("./effect/layer-node.js").Tag<"global">, true>;
package/dist/npm.js CHANGED
@@ -413,6 +413,20 @@ const layer = Layer.effect(Service, Effect.gen(function* () {
413
413
  which,
414
414
  });
415
415
  }));
416
+ const unsupported = (what, pkg) => Effect.fail(new InstallFailedError({
417
+ add: [pkg],
418
+ dir: "",
419
+ cause: new Error(`${what} is not supported in this runtime`),
420
+ }));
421
+ export const unsupportedLayer = Layer.succeed(Service, Service.of({
422
+ add: (pkg) => unsupported("Npm.add", pkg),
423
+ resolve: (name) => Effect.succeed({ directory: "", name }),
424
+ check: () => Effect.succeed(false),
425
+ update: (pkg) => unsupported("Npm.update", pkg),
426
+ follows: () => Effect.succeed(false),
427
+ reject: () => Effect.succeed(false),
428
+ which: () => Effect.undefined,
429
+ }));
416
430
  export const node = makeGlobalNode({
417
431
  service: Service,
418
432
  layer: layer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/util",
4
- "version": "0.0.0-dev-1358",
4
+ "version": "0.0.0-dev-1360",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {