| 849 | ): string => fingerprint(["snapshot-v4", sha, ts.version, modules === undefined ? "all" : [...modules].sort()]) |
| 850 | |
| 851 | export 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 | } |
nothing calls this directly
no test coverage detected