MCPcopy Create free account
hub / github.com/Effect-TS/effect / Snapshotter

Class Snapshotter

packages/tools/api-diff/src/Snapshot.ts:851–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849): string => fingerprint(["snapshot-v4", sha, ts.version, modules === undefined ? "all" : [...modules].sort()])
850
851export class Snapshotter extends Context.Service<Snapshotter, {
852 readonly extract: (options: ExtractSnapshotOptions) => Effect.Effect<
853 ApiSnapshot,
854 ApiDiffError | SnapshotExtractionError
855 >
856}>()("@effect/api-diff/Snapshotter") {
857 static readonly layerNoDependencies = Layer.effect(
858 Snapshotter,
859 Effect.gen(function*() {
860 const discovery = yield* Discovery
861 const path = yield* Path.Path
862
863 const extract = Effect.fnUntraced(function*(options: ExtractSnapshotOptions) {
864 const discovered = yield* discovery.discoverEntrypoints(options.repoRoot, options.modules)
865 return yield* Effect.try({
866 try: () => extractSnapshot(options, discovered, path),
867 catch: (cause) =>
868 isSnapshotExtractionError(cause)
869 ? cause
870 : new ApiDiffError({
871 message: `Could not extract the API snapshot for ${options.ref}`,
872 cause
873 })
874 })
875 })
876
877 return Snapshotter.of({ extract })
878 })
879 )
880
881 static readonly layer = this.layerNoDependencies.pipe(
882 Layer.provide(Discovery.layer)
883 )
884}

Callers

nothing calls this directly

Calls 6

extractSnapshotFunction · 0.85
discoverEntrypointsMethod · 0.80
ofMethod · 0.65
pipeMethod · 0.65
provideMethod · 0.45

Tested by

no test coverage detected