@effected/workspaces 0.45.0 → 0.47.0

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/LayerPolicy.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { causeMessage } from "./internal/causeMessage.js";
2
2
  import { ALL_DEPENDENCY_FIELDS } from "./internal/dependencyFields.js";
3
3
  import { Effect, FileSystem, Result, Schema } from "effect";
4
- import { GlobSet } from "@effected/glob";
5
4
  import { DependencyField } from "@effected/npm";
5
+ import { GlobSet } from "@effected/glob";
6
6
 
7
7
  // src/LayerPolicy.ts
8
8
  const REQUIRED_EDGE = /^\S+ -> \S+$/u;
@@ -1,11 +1,12 @@
1
1
  import { enumerate } from "./internal/enumerate.js";
2
2
  import { isStringRecord } from "./internal/guards.js";
3
3
  import { findLayerRoot } from "./internal/layerRoot.js";
4
- import { readPatterns } from "./internal/patterns.js";
4
+ import { membershipOf, rulesFor } from "./internal/membership.js";
5
+ import { MARKER_FILES } from "./internal/packageManagerDecision.js";
6
+ import { readPatternSource } from "./internal/patterns.js";
5
7
  import { WorkspacePackage } from "./WorkspacePackage.js";
6
8
  import { WorkspaceRoot } from "./WorkspaceRoot.js";
7
9
  import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, Schema } from "effect";
8
- import { GlobSet } from "@effected/glob";
9
10
  import { DependencyResolutionError, WorkspaceResolver } from "@effected/npm";
10
11
  import { PackageJsonFormat } from "@effected/package-json";
11
12
 
@@ -70,7 +71,13 @@ var WorkspacePatternError = class extends Schema.TaggedError()("WorkspacePattern
70
71
  "unreadableDirectory"
71
72
  ]),
72
73
  /** A short, structured detail — the missing directory, or the bound exceeded. */
73
- detail: Schema.String
74
+ detail: Schema.String,
75
+ /**
76
+ * For `uncompilable`: the typed error that stopped the patterns being read —
77
+ * glob's `GlobPatternError`, or `@effected/npm`'s `NpmWorkspacePatternsError`
78
+ * when an npm root's `workspaces` field passes one of npm's pattern ceilings.
79
+ */
80
+ cause: Schema.optionalKey(Schema.Defect())
74
81
  }) {
75
82
  /** Renders the pattern and failure kind into a one-line message. */
76
83
  get message() {
@@ -216,19 +223,22 @@ var WorkspaceDiscovery = class WorkspaceDiscovery extends Context.Service()("@ef
216
223
  * branch that adds or removes a package stays invisible. This re-reads.
217
224
  */
218
225
  const discoverAt = (root) => Effect.gen(function* () {
219
- const patterns = yield* readPatterns(root).pipe(Effect.mapError((failure) => new WorkspaceDiscoveryError({
226
+ const source = yield* readPatternSource(root).pipe(Effect.mapError((failure) => new WorkspaceDiscoveryError({
220
227
  root,
221
228
  path: failure.path,
222
229
  kind: failure.kind,
223
230
  cause: failure.cause
224
231
  })));
225
- const globs = yield* GlobSet.compile(patterns).pipe(Effect.mapError((error) => new WorkspacePatternError({
232
+ const { patterns } = source;
233
+ const present = Option.isNone(source.manifest) ? /* @__PURE__ */ new Set() : new Set(yield* Effect.filter(MARKER_FILES, (file) => fs.exists(path.join(root, file)).pipe(Effect.orElseSucceed(() => false))));
234
+ const membership = yield* Effect.fromResult(membershipOf(patterns, rulesFor(source.manifest, (file) => present.has(file)))).pipe(Effect.mapError((failure) => new WorkspacePatternError({
226
235
  root,
227
- pattern: error.pattern,
236
+ pattern: failure.pattern,
228
237
  kind: "uncompilable",
229
- detail: error.message
238
+ detail: failure.detail,
239
+ cause: failure.cause
230
240
  })));
231
- const directories = yield* enumerate(root, globs, { maxDepth: options?.maxDepth ?? 32 }).pipe(Effect.mapError((failure) => new WorkspacePatternError({
241
+ const directories = yield* enumerate(root, membership, { maxDepth: options?.maxDepth ?? 32 }).pipe(Effect.mapError((failure) => new WorkspacePatternError({
232
242
  root,
233
243
  pattern: failure.pattern,
234
244
  kind: patternKindOf(failure.kind),
@@ -1,8 +1,8 @@
1
1
  import { ALL_DEPENDENCY_FIELDS } from "./internal/dependencyFields.js";
2
2
  import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
3
3
  import { Effect, Graph, Option, Schema } from "effect";
4
- import { GlobSet } from "@effected/glob";
5
4
  import { DependencyField } from "@effected/npm";
5
+ import { GlobSet } from "@effected/glob";
6
6
 
7
7
  // src/WorkspaceLayering.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  import { Effect, FileSystem, Option, Schema } from "effect";
2
- import { GlobPattern } from "@effected/glob";
3
2
  import { Package, PackageJsonFormat } from "@effected/package-json";
3
+ import { GlobPattern } from "@effected/glob";
4
4
  import { WorkspaceManifest } from "@effected/lockfiles";
5
5
 
6
6
  // src/WorkspacePackage.ts
@@ -2,6 +2,7 @@ import { ConfigDependencyHooks } from "./ConfigDependencyHooks.js";
2
2
  import { isStringRecord } from "./internal/guards.js";
3
3
  import { importerVersionsOf } from "./internal/importerVersions.js";
4
4
  import { findLayerRoot } from "./internal/layerRoot.js";
5
+ import { membershipOf, rulesFor } from "./internal/membership.js";
5
6
  import { manifestPatternsOf, pnpmPatternsOf } from "./internal/patterns.js";
6
7
  import { CatalogSet, WorkspaceCatalogs, injectFromDocument } from "./WorkspaceCatalogs.js";
7
8
  import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
@@ -9,7 +10,6 @@ import { WorkspaceRoot } from "./WorkspaceRoot.js";
9
10
  import { PackageStateSnapshot, WorkspaceStateSnapshot } from "./WorkspaceStateSnapshot.js";
10
11
  import { Git } from "@effected/git";
11
12
  import { Context, Duration, Effect, Exit, Layer, Option, Predicate, Result } from "effect";
12
- import { GlobSet } from "@effected/glob";
13
13
  import { CatalogAssemblyError } from "@effected/npm";
14
14
  import { PackageJsonFormat } from "@effected/package-json";
15
15
  import { Yaml } from "@effected/yaml";
@@ -140,6 +140,7 @@ var WorkspaceSnapshots = class WorkspaceSnapshots extends Context.Service()("@ef
140
140
  onSome: parseJsonObject
141
141
  });
142
142
  let patterns;
143
+ let patternManifest = Option.none();
143
144
  let inline;
144
145
  let injected;
145
146
  let recorded;
@@ -152,6 +153,7 @@ var WorkspaceSnapshots = class WorkspaceSnapshots extends Context.Service()("@ef
152
153
  })));
153
154
  const pnpmPatterns = pnpmPatternsOf(document);
154
155
  patterns = pnpmPatterns.length > 0 ? pnpmPatterns : manifestPatternsOf(rootManifest);
156
+ if (pnpmPatterns.length === 0) patternManifest = Option.some(rootManifest);
155
157
  inline = yield* CatalogSet.fromWorkspaceYaml(pnpmWorkspaceText.value);
156
158
  const lockfile = yield* lockfileText(root, ref, "pnpm");
157
159
  const replayed = yield* injectFromDocument(hooks, root, document, inline, {
@@ -163,17 +165,22 @@ var WorkspaceSnapshots = class WorkspaceSnapshots extends Context.Service()("@ef
163
165
  recorded = yield* lockfileRecord(lockfile, "pnpm");
164
166
  } else {
165
167
  patterns = manifestPatternsOf(rootManifest);
168
+ patternManifest = Option.some(rootManifest);
166
169
  inline = bunInlineCatalogs(rootManifest);
167
170
  injected = CatalogSet.empty();
168
171
  recorded = yield* lockfileRecord(yield* lockfileText(root, ref, "bun"), "bun");
169
172
  }
170
173
  const catalogs = CatalogSet.merge(recorded.catalogs, inline, injected);
171
- const globs = yield* GlobSet.compile(patterns).pipe(Effect.mapError((error) => new CatalogAssemblyError({
172
- source: "manifest",
173
- path: error.pattern,
174
- cause: error
175
- })));
176
174
  const entries = yield* git.lsTree(root, ref);
175
+ const rootFiles = /* @__PURE__ */ new Set();
176
+ for (const entry of entries) if (entry.type === "blob" && !entry.path.includes("/")) rootFiles.add(entry.path);
177
+ const membership = membershipOf(patterns, rulesFor(patternManifest, (file) => rootFiles.has(file)));
178
+ if (Result.isFailure(membership)) return yield* new CatalogAssemblyError({
179
+ source: "manifest",
180
+ path: membership.failure.pattern,
181
+ cause: membership.failure.cause
182
+ });
183
+ const isMember = membership.success.matches;
177
184
  const memberDirs = [];
178
185
  let hasRootManifest = false;
179
186
  for (const entry of entries) {
@@ -184,7 +191,7 @@ var WorkspaceSnapshots = class WorkspaceSnapshots extends Context.Service()("@ef
184
191
  }
185
192
  if (!entry.path.endsWith("/package.json")) continue;
186
193
  const dir = entry.path.slice(0, entry.path.length - 13);
187
- if (globs.matches(dir)) memberDirs.push(dir);
194
+ if (isMember(dir)) memberDirs.push(dir);
188
195
  }
189
196
  memberDirs.sort();
190
197
  const members = yield* Effect.forEach(memberDirs, (dir) => git.show(root, ref, `./${dir}/package.json`).pipe(Effect.map((content) => snapshotOf(content, dir))), { concurrency: 10 });
package/WorkspacesSync.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { isStringRecord } from "./internal/guards.js";
2
+ import { membershipOf, rulesFor } from "./internal/membership.js";
2
3
  import { decidePackageManager } from "./internal/packageManagerDecision.js";
3
4
  import { manifestPatternsOf, pnpmPatternsOf } from "./internal/patterns.js";
4
5
  import { Traversal, badMaxDepthMessage, isPruned, isValidMaxDepth, joinRelative } from "./internal/traverse.js";
5
6
  import { DetectedPackageManager, PackageManagerDetectionError, PackageManagerEvidence } from "./PackageManagerName.js";
7
+ import { WorkspaceDiscoveryError, WorkspacePatternError } from "./WorkspaceDiscovery.js";
6
8
  import { WorkspaceRootMatch, probedMarkers } from "./WorkspaceMarker.js";
7
9
  import { PublishConfig, WorkspaceManifestError, WorkspacePackage } from "./WorkspacePackage.js";
8
10
  import { Effect, Exit, Option, Result, Schema } from "effect";
9
- import { GlobSet } from "@effected/glob";
10
11
  import { PackageJsonFormat } from "@effected/package-json";
11
12
  import { Yaml } from "@effected/yaml";
12
13
  import { LocalExec, LocalExecError } from "@effected/commands";
@@ -17,8 +18,8 @@ import { LocalExec, LocalExecError } from "@effected/commands";
17
18
  *
18
19
  * The three failures are kept apart — a throwing consumer `readFile`, a JSON
19
20
  * syntax error, and valid JSON that is not an object — because the skip report
20
- * carries the distinction; the two other callers of {@link readJson} do not
21
- * need it and keep the collapsed form.
21
+ * carries the distinction; the root ascent's {@link readJson} does not
22
+ * need it and keeps the collapsed form.
22
23
  */
23
24
  const readManifest = (fileSystem, file) => {
24
25
  let text;
@@ -200,24 +201,80 @@ const locateWorkspaceRootSync = (cwd, options) => {
200
201
  }
201
202
  return null;
202
203
  };
203
- /** The workspace `packages:` patterns for `root`, matching `internal/patterns.ts`'s precedence. */
204
+ /**
205
+ * The workspace `packages:` patterns for `root`, matching `internal/patterns.ts`'s
206
+ * precedence: `pnpm-workspace.yaml` first, then the root `package.json`
207
+ * `workspaces` field.
208
+ *
209
+ * A `pnpm-workspace.yaml` that EXISTS but cannot be read or parsed throws the
210
+ * `WorkspaceDiscoveryError` (`read` / `invalidYaml`) the Effect surface fails
211
+ * with. Falling back to `package.json#workspaces` there would answer from the
212
+ * wrong config, and an empty list would read as "no packages" — both decisions
213
+ * taken on a corrupt file. An ABSENT one is still the ordinary fallback.
214
+ *
215
+ * The root `package.json`, when it is the pattern source, follows the same
216
+ * rule: absent is no patterns, a throwing read is `read`, unparseable text is
217
+ * `invalidJson`, and valid JSON that is not an object declares no patterns.
218
+ */
204
219
  const readPatternsSync = (options, root) => {
205
220
  const { fileSystem, path } = options;
206
221
  const workspaceYaml = path.join(root, "pnpm-workspace.yaml");
207
222
  if (fileSystem.exists(workspaceYaml)) {
208
- let text = "";
223
+ let text;
209
224
  try {
210
225
  text = fileSystem.readFile(workspaceYaml);
211
- } catch {
212
- text = "";
213
- }
214
- const exit = Effect.runSyncExit(Yaml.parse(text));
215
- if (Exit.isSuccess(exit)) {
216
- const patterns = pnpmPatternsOf(exit.value);
217
- if (patterns.length > 0) return patterns;
226
+ } catch (cause) {
227
+ throw new WorkspaceDiscoveryError({
228
+ root,
229
+ path: workspaceYaml,
230
+ kind: "read",
231
+ cause
232
+ });
218
233
  }
234
+ const parsed = Yaml.parseResult(text);
235
+ if (Result.isFailure(parsed)) throw new WorkspaceDiscoveryError({
236
+ root,
237
+ path: workspaceYaml,
238
+ kind: "invalidYaml",
239
+ cause: parsed.failure
240
+ });
241
+ const patterns = pnpmPatternsOf(parsed.success);
242
+ if (patterns.length > 0) return {
243
+ patterns,
244
+ manifest: Option.none()
245
+ };
219
246
  }
220
- return manifestPatternsOf(readJson(fileSystem, path.join(root, "package.json")) ?? {});
247
+ const manifestPath = path.join(root, "package.json");
248
+ if (!fileSystem.exists(manifestPath)) return {
249
+ patterns: [],
250
+ manifest: Option.none()
251
+ };
252
+ let content;
253
+ try {
254
+ content = fileSystem.readFile(manifestPath);
255
+ } catch (cause) {
256
+ throw new WorkspaceDiscoveryError({
257
+ root,
258
+ path: manifestPath,
259
+ kind: "read",
260
+ cause
261
+ });
262
+ }
263
+ const manifest = PackageJsonFormat.parseObjectResult(content);
264
+ if (Result.isSuccess(manifest)) return {
265
+ patterns: manifestPatternsOf(manifest.success),
266
+ manifest: Option.some(manifest.success)
267
+ };
268
+ if (manifest.failure.reason === "not-an-object") return {
269
+ patterns: [],
270
+ manifest: Option.none()
271
+ };
272
+ throw new WorkspaceDiscoveryError({
273
+ root,
274
+ path: manifestPath,
275
+ kind: "invalidJson",
276
+ cause: manifest.failure
277
+ });
221
278
  };
222
279
  /**
223
280
  * Build a `WorkspacePackage` from a directory, or a {@link WorkspaceDiscoverySkip}
@@ -286,15 +343,41 @@ const readPackageSync = (options, root, directory, relativePath) => {
286
343
  * drive the **same traversal state machine** (`internal/traverse.ts`), so the
287
344
  * dequeue order, the depth rule, the visit budget and the prune list cannot
288
345
  * drift apart. A `packages/**` finds exactly the same packages here as there,
289
- * including at the depth boundary.
346
+ * including at the depth boundary. Which directories the patterns declare is
347
+ * one decision too: on an npm root (as `detectPackageManagerSync` would
348
+ * report it) `package.json#workspaces` is read the way npm reads it, through
349
+ * `@effected/npm`'s `NpmWorkspacePatterns` — ordered negation, a trailing
350
+ * `/`, an even `!` run, a backslash as a separator — and on a pnpm, yarn or
351
+ * bun root as one `GlobSet`.
290
352
  *
291
353
  * The one deliberate difference is what happens at a bound: the Effect surface
292
- * fails typed (`depthExceeded` / `budgetExceeded`), while this one is **total**
293
- * and truncates. An unenumerable pattern or an unreadable manifest is skipped,
294
- * not raised — a function with no error channel should not pretend to have one,
295
- * and a Vitest config has nowhere to put a failure. Totality covers *data*, not
296
- * caller mistakes: a `maxDepth` that is not a positive integer throws, matching
297
- * the enumerator's defect.
354
+ * fails typed (`depthExceeded` / `budgetExceeded`), while this one truncates.
355
+ * An unenumerable pattern or an unreadable manifest is skipped, not raised —
356
+ * there the other patterns and members are still a real partial answer, and a
357
+ * Vitest config has nowhere to put a failure. A `maxDepth` that is not a
358
+ * positive integer throws a `RangeError`, matching the enumerator's defect.
359
+ *
360
+ * **A pattern set that does not compile throws.** The patterns compile as one
361
+ * `GlobSet`, and when that fails — one malformed member, or members that each
362
+ * compile alone but together exhaust the set's shared compile budget, or an
363
+ * npm root's `workspaces` field past one of `NpmWorkspacePatterns`' ceilings —
364
+ * there is no partial answer to degrade to: every pattern is lost at once. Returning
365
+ * the root alone would read as "no workspace packages", a decision taken on a
366
+ * corrupt config, so the facade throws the `WorkspacePatternError` (kind
367
+ * `"uncompilable"`, `pattern` the member the compile stopped at) that
368
+ * `WorkspaceDiscovery` fails with on the same root, before any manifest is
369
+ * read and before `onSkip` is called.
370
+ *
371
+ * **So does a `pnpm-workspace.yaml` that exists but cannot be used.** One
372
+ * whose `readFile` throws, or whose text does not parse as YAML, throws the
373
+ * `WorkspaceDiscoveryError` (kind `"read"` / `"invalidYaml"`, `path` the YAML
374
+ * file) the Effect surface fails with, rather than falling back to
375
+ * `package.json#workspaces`. A MISSING one is the ordinary fallback, as on
376
+ * the Effect surface. When that fallback is taken, the root `package.json`
377
+ * is held to the same rule: one whose `readFile` throws, or whose text is not
378
+ * JSON, throws kind `"read"` / `"invalidJson"`, while a missing one is a
379
+ * standalone directory (`[]`) and valid JSON that is not an object declares
380
+ * no patterns and is reported through `onSkip` as the root's `invalidShape`.
298
381
  *
299
382
  * **A skip is never silent.** Every manifest left out is reported through
300
383
  * `onSkip` with its path and the same `kind` the Effect surface would have
@@ -306,6 +389,14 @@ const readPackageSync = (options, root, directory, relativePath) => {
306
389
  * @param root - The workspace root, from {@link findWorkspaceRootSync}.
307
390
  * @param options - The consumer-supplied operations and traversal bounds; see
308
391
  * {@link GetWorkspacePackagesSyncOptions}.
392
+ * @throws `WorkspaceDiscoveryError` (kind `"read"` or `"invalidYaml"`) when
393
+ * `pnpm-workspace.yaml` exists but cannot be read or parsed, and (kind
394
+ * `"read"` or `"invalidJson"`) when the root `package.json` is the pattern
395
+ * source and exists but cannot be read or parsed;
396
+ * `WorkspacePatternError` (kind `"uncompilable"`, `cause` the typed error)
397
+ * when the workspace's `packages:` patterns do not compile as one `GlobSet`
398
+ * or, on an npm root, pass an `NpmWorkspacePatterns` ceiling; `RangeError` for a
399
+ * `maxDepth` that is not a positive integer.
309
400
  *
310
401
  * @example
311
402
  * ```ts
@@ -332,15 +423,20 @@ const getWorkspacePackagesSync = (root, options) => {
332
423
  const { fileSystem, path } = options;
333
424
  const maxDepth = options.maxDepth ?? 32;
334
425
  if (!isValidMaxDepth(maxDepth)) throw new RangeError(`getWorkspacePackagesSync: ${badMaxDepthMessage(maxDepth)}`);
335
- const patterns = readPatternsSync(options, root);
336
- const compiled = Effect.runSyncExit(GlobSet.compile(patterns));
337
- if (Exit.isFailure(compiled)) return [];
338
- const globs = compiled.value;
339
- const excludes = globs.excludes;
340
- const isExcluded = excludes.length === 0 ? (_) => false : (relative) => excludes.some((exclude) => exclude.matches(relative));
426
+ const { patterns, manifest } = readPatternsSync(options, root);
427
+ const read = membershipOf(patterns, rulesFor(manifest, (file) => fileSystem.exists(path.join(root, file))));
428
+ if (Result.isFailure(read)) throw new WorkspacePatternError({
429
+ root,
430
+ pattern: read.failure.pattern,
431
+ kind: "uncompilable",
432
+ detail: read.failure.detail,
433
+ cause: read.failure.cause
434
+ });
435
+ const globs = read.success.candidates;
436
+ const isMember = read.success.matches;
341
437
  const included = /* @__PURE__ */ new Map();
342
438
  for (const literal of globs.literals) {
343
- if (isExcluded(literal)) continue;
439
+ if (!isMember(literal)) continue;
344
440
  const absolute = path.join(root, literal);
345
441
  if (isPackage(options, absolute)) included.set(literal, absolute);
346
442
  }
@@ -363,7 +459,7 @@ const getWorkspacePackagesSync = (root, options) => {
363
459
  stopped = true;
364
460
  break;
365
461
  }
366
- if (wildcard.matches(relative) && !isExcluded(relative) && isPackage(options, absolute)) included.set(relative, absolute);
462
+ if (wildcard.matches(relative) && isMember(relative) && isPackage(options, absolute)) included.set(relative, absolute);
367
463
  if (!wildcard.crossesSegments) continue;
368
464
  traversal.push(current, relative, absolute);
369
465
  }
package/index.d.ts CHANGED
@@ -1,3 +1,32 @@
1
+ /**
2
+ * Monorepo workspace tooling as Effect services: find the workspace root,
3
+ * enumerate its packages, walk the dependency graph, detect the package
4
+ * manager, resolve pnpm catalogs, read the lockfile, and work out which
5
+ * packages a git range touches.
6
+ *
7
+ * The pure halves live in siblings — `@effected/lockfiles` parses lockfile
8
+ * text, `@effected/glob` matches patterns, `@effected/walker` ascends
9
+ * directories. This package is the part that needs a filesystem and a package
10
+ * manager under it, and it is where `@effected/npm`'s `CatalogResolver` and
11
+ * `WorkspaceResolver` contracts are implemented.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import * as NodeServices from "@effect/platform-node/NodeServices";
16
+ * import { WorkspaceDiscovery, Workspaces } from "@effected/workspaces";
17
+ * import { Effect, Layer } from "effect";
18
+ *
19
+ * const WorkspacesLayer = Workspaces.layer().pipe(Layer.provide(NodeServices.layer));
20
+ *
21
+ * const program = Effect.gen(function* () {
22
+ * const discovery = yield* WorkspaceDiscovery;
23
+ * const packages = yield* discovery.listPackages();
24
+ * return packages.map((pkg) => pkg.name);
25
+ * }).pipe(Effect.provide(WorkspacesLayer));
26
+ * ```
27
+ *
28
+ * @packageDocumentation
29
+ */
1
30
  import { Git, GitCommandError, NotARepositoryError, UnknownRefError } from "@effected/git";
2
31
  import { Context, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
3
32
  import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError, Manifest, PartialReleaseAgeGate, ReleaseAgeGate, UnresolvedDependencyError, WorkspaceResolver } from "@effected/npm";
@@ -552,6 +581,12 @@ declare const WorkspacePatternError_base: Schema.Class<WorkspacePatternError, Sc
552
581
  readonly kind: Schema.Literals<readonly ["missingBaseDir", "uncompilable", "depthExceeded", "budgetExceeded", "unreadableDirectory"]>;
553
582
  /** A short, structured detail — the missing directory, or the bound exceeded. */
554
583
  readonly detail: Schema.String;
584
+ /**
585
+ * For `uncompilable`: the typed error that stopped the patterns being read —
586
+ * glob's `GlobPatternError`, or `@effected/npm`'s `NpmWorkspacePatternsError`
587
+ * when an npm root's `workspaces` field passes one of npm's pattern ceilings.
588
+ */
589
+ readonly cause: Schema.optionalKey<Schema.Defect>;
555
590
  }>, import("effect/Cause").YieldableError>;
556
591
  /**
557
592
  * Raised when a `packages:` pattern cannot be enumerated: its base directory is
@@ -4943,14 +4978,19 @@ export declare class Workspaces {
4943
4978
  * permission error mid-read — and every throw is absorbed into the documented
4944
4979
  * degraded-skip semantics: a throwing `readFile` reads as an unusable
4945
4980
  * manifest, a throwing `readDirectory` as an unreadable directory, a throwing
4946
- * `isDirectory` as "not a directory". Nothing propagates.
4981
+ * `isDirectory` as "not a directory". The one exception is a `readFile` of
4982
+ * the file `getWorkspacePackagesSync` takes its patterns from (an existing
4983
+ * `pnpm-workspace.yaml`, or the root `package.json` in its absence): there is
4984
+ * no partial answer without it, so the throw comes back as a
4985
+ * `WorkspaceDiscoveryError` of kind `"read"` carrying it as `cause`. Nothing
4986
+ * propagates raw.
4947
4987
  *
4948
4988
  * @public
4949
4989
  */
4950
4990
  interface SyncFileSystem {
4951
4991
  /** Whether a file or directory exists at `path`. Must not throw. */
4952
4992
  readonly exists: (path: string) => boolean;
4953
- /** Read the file at `path` as text. May throw; a throw degrades to a skip. */
4993
+ /** Read the file at `path` as text. May throw; a throw degrades to a skip (the pattern source excepted). */
4954
4994
  readonly readFile: (path: string) => string;
4955
4995
  /** The entry names inside the directory at `path`. May throw; a throw skips the directory. */
4956
4996
  readonly readDirectory: (path: string) => ReadonlyArray<string>;
@@ -5271,15 +5311,41 @@ interface GetWorkspacePackagesSyncOptions extends WorkspacesSyncOptions {
5271
5311
  * drive the **same traversal state machine** (`internal/traverse.ts`), so the
5272
5312
  * dequeue order, the depth rule, the visit budget and the prune list cannot
5273
5313
  * drift apart. A `packages/**` finds exactly the same packages here as there,
5274
- * including at the depth boundary.
5314
+ * including at the depth boundary. Which directories the patterns declare is
5315
+ * one decision too: on an npm root (as `detectPackageManagerSync` would
5316
+ * report it) `package.json#workspaces` is read the way npm reads it, through
5317
+ * `@effected/npm`'s `NpmWorkspacePatterns` — ordered negation, a trailing
5318
+ * `/`, an even `!` run, a backslash as a separator — and on a pnpm, yarn or
5319
+ * bun root as one `GlobSet`.
5275
5320
  *
5276
5321
  * The one deliberate difference is what happens at a bound: the Effect surface
5277
- * fails typed (`depthExceeded` / `budgetExceeded`), while this one is **total**
5278
- * and truncates. An unenumerable pattern or an unreadable manifest is skipped,
5279
- * not raised — a function with no error channel should not pretend to have one,
5280
- * and a Vitest config has nowhere to put a failure. Totality covers *data*, not
5281
- * caller mistakes: a `maxDepth` that is not a positive integer throws, matching
5282
- * the enumerator's defect.
5322
+ * fails typed (`depthExceeded` / `budgetExceeded`), while this one truncates.
5323
+ * An unenumerable pattern or an unreadable manifest is skipped, not raised —
5324
+ * there the other patterns and members are still a real partial answer, and a
5325
+ * Vitest config has nowhere to put a failure. A `maxDepth` that is not a
5326
+ * positive integer throws a `RangeError`, matching the enumerator's defect.
5327
+ *
5328
+ * **A pattern set that does not compile throws.** The patterns compile as one
5329
+ * `GlobSet`, and when that fails — one malformed member, or members that each
5330
+ * compile alone but together exhaust the set's shared compile budget, or an
5331
+ * npm root's `workspaces` field past one of `NpmWorkspacePatterns`' ceilings —
5332
+ * there is no partial answer to degrade to: every pattern is lost at once. Returning
5333
+ * the root alone would read as "no workspace packages", a decision taken on a
5334
+ * corrupt config, so the facade throws the `WorkspacePatternError` (kind
5335
+ * `"uncompilable"`, `pattern` the member the compile stopped at) that
5336
+ * `WorkspaceDiscovery` fails with on the same root, before any manifest is
5337
+ * read and before `onSkip` is called.
5338
+ *
5339
+ * **So does a `pnpm-workspace.yaml` that exists but cannot be used.** One
5340
+ * whose `readFile` throws, or whose text does not parse as YAML, throws the
5341
+ * `WorkspaceDiscoveryError` (kind `"read"` / `"invalidYaml"`, `path` the YAML
5342
+ * file) the Effect surface fails with, rather than falling back to
5343
+ * `package.json#workspaces`. A MISSING one is the ordinary fallback, as on
5344
+ * the Effect surface. When that fallback is taken, the root `package.json`
5345
+ * is held to the same rule: one whose `readFile` throws, or whose text is not
5346
+ * JSON, throws kind `"read"` / `"invalidJson"`, while a missing one is a
5347
+ * standalone directory (`[]`) and valid JSON that is not an object declares
5348
+ * no patterns and is reported through `onSkip` as the root's `invalidShape`.
5283
5349
  *
5284
5350
  * **A skip is never silent.** Every manifest left out is reported through
5285
5351
  * `onSkip` with its path and the same `kind` the Effect surface would have
@@ -5291,6 +5357,14 @@ interface GetWorkspacePackagesSyncOptions extends WorkspacesSyncOptions {
5291
5357
  * @param root - The workspace root, from {@link findWorkspaceRootSync}.
5292
5358
  * @param options - The consumer-supplied operations and traversal bounds; see
5293
5359
  * {@link GetWorkspacePackagesSyncOptions}.
5360
+ * @throws `WorkspaceDiscoveryError` (kind `"read"` or `"invalidYaml"`) when
5361
+ * `pnpm-workspace.yaml` exists but cannot be read or parsed, and (kind
5362
+ * `"read"` or `"invalidJson"`) when the root `package.json` is the pattern
5363
+ * source and exists but cannot be read or parsed;
5364
+ * `WorkspacePatternError` (kind `"uncompilable"`, `cause` the typed error)
5365
+ * when the workspace's `packages:` patterns do not compile as one `GlobSet`
5366
+ * or, on an npm root, pass an `NpmWorkspacePatterns` ceiling; `RangeError` for a
5367
+ * `maxDepth` that is not a positive integer.
5294
5368
  *
5295
5369
  * @example
5296
5370
  * ```ts
@@ -5,21 +5,22 @@ import { Effect, FileSystem, Path } from "effect";
5
5
  /** Strip a trailing slash from `GlobPattern.enumerationPrefix` to get a relative directory. */
6
6
  const baseOf = (pattern) => pattern.enumerationPrefix.replace(/\/$/, "");
7
7
  /**
8
- * Enumerate the workspace directories a compiled `packages:` set selects.
8
+ * Enumerate the workspace directories a membership selects.
9
9
  *
10
- * Every returned directory holds a `package.json`, matches at least one include
11
- * (literal or wildcard), and is rejected by no exclude. Results are sorted by
12
- * relative path.
10
+ * The walk is bounded by `membership.candidates` — its literals are looked up,
11
+ * its wildcards drive the descent — and every returned directory holds a
12
+ * `package.json`, is a candidate, and is a member by `membership.matches`.
13
+ * Results are sorted by relative path.
13
14
  */
14
- const enumerate = (root, globs, options) => Effect.gen(function* () {
15
+ const enumerate = (root, membership, options) => Effect.gen(function* () {
15
16
  const fs = yield* FileSystem.FileSystem;
16
17
  const path = yield* Path.Path;
17
18
  const maxDepth = options?.maxDepth ?? 32;
18
19
  if (!isValidMaxDepth(maxDepth)) return yield* Effect.die(/* @__PURE__ */ new Error(`enumerate: ${badMaxDepthMessage(maxDepth)}`));
19
20
  const isPackage = (absolute) => fs.exists(path.join(absolute, "package.json")).pipe(Effect.orElseSucceed(() => false));
20
21
  const isDirectory = (absolute) => fs.stat(absolute).pipe(Effect.map((info) => info.type === "Directory"), Effect.orElseSucceed(() => false));
21
- const excludes = globs.excludes;
22
- const isExcluded = excludes.length === 0 ? (_) => false : (relative) => excludes.some((exclude) => exclude.matches(relative));
22
+ const globs = membership.candidates;
23
+ const isMember = membership.matches;
23
24
  const included = /* @__PURE__ */ new Map();
24
25
  /** A shared-traversal stop, materialized as this module's failure record. */
25
26
  const failureOf = (stop, pattern) => ({
@@ -28,7 +29,7 @@ const enumerate = (root, globs, options) => Effect.gen(function* () {
28
29
  detail: stop.detail
29
30
  });
30
31
  const literalHits = yield* Effect.forEach(globs.literals, (literal) => Effect.gen(function* () {
31
- if (isExcluded(literal)) return void 0;
32
+ if (!isMember(literal)) return void 0;
32
33
  const absolute = path.join(root, literal);
33
34
  return (yield* isPackage(absolute)) ? [literal, absolute] : void 0;
34
35
  }), { concurrency: 10 });
@@ -60,7 +61,7 @@ const enumerate = (root, globs, options) => Effect.gen(function* () {
60
61
  const absolute = path.join(frame.absolute, entry);
61
62
  if (!(yield* isDirectory(absolute))) continue;
62
63
  if (wildcard.crossesSegments && !traversal.admits(frame)) return yield* Effect.fail(failureOf(traversal.depthStop(), wildcard.source));
63
- if (wildcard.matches(relative) && !isExcluded(relative) && (yield* isPackage(absolute))) included.set(relative, absolute);
64
+ if (wildcard.matches(relative) && isMember(relative) && (yield* isPackage(absolute))) included.set(relative, absolute);
64
65
  if (!wildcard.crossesSegments) continue;
65
66
  traversal.push(frame, relative, absolute);
66
67
  }
@@ -0,0 +1,95 @@
1
+ import { decidePackageManager } from "./packageManagerDecision.js";
2
+ import { Option, Result } from "effect";
3
+ import { NpmWorkspacePatterns } from "@effected/npm";
4
+ import { GlobSet } from "@effected/glob";
5
+
6
+ // src/internal/membership.ts
7
+ /** The rules for a root that is not npm's. */
8
+ const GLOB_RULES = { _tag: "glob" };
9
+ /**
10
+ * The rules a root's patterns are read under.
11
+ *
12
+ * `manifest` is the root `package.json` when it is the pattern source — none
13
+ * when `pnpm-workspace.yaml` supplied the patterns. The manager is decided the
14
+ * way `PackageManagerDetector` decides it, over the same `has` the caller
15
+ * answers with its own IO, so "npm root" here and there are one answer.
16
+ */
17
+ const rulesFor = (manifest, has) => {
18
+ if (Option.isNone(manifest)) return GLOB_RULES;
19
+ return decidePackageManager(manifest, has)?.name === "npm" ? {
20
+ _tag: "npm",
21
+ field: manifest.value.workspaces
22
+ } : GLOB_RULES;
23
+ };
24
+ /**
25
+ * A positive npm pattern as npm reads it, as a `GlobSet` include, or
26
+ * `undefined` for a negation or an empty pattern: an even `!` run dropped, one
27
+ * leading `./` or `/` run stripped, backslashes turned to `/`, and a trailing
28
+ * `/.` run and `/` dropped (npm matches directories, so `packages/*\/` is
29
+ * `packages/*`).
30
+ */
31
+ const npmCandidateOf = (entry) => {
32
+ const bangs = /^!+/.exec(entry)?.[0].length ?? 0;
33
+ if (bangs % 2 === 1) return void 0;
34
+ let pattern = entry.slice(bangs).replace(/^\.?\/+/, "").replace(/\\/g, "/");
35
+ let end = pattern.length;
36
+ for (;;) if (end >= 1 && pattern.charCodeAt(end - 1) === 47) end -= 1;
37
+ else if (end >= 2 && pattern.charCodeAt(end - 1) === 46 && pattern.charCodeAt(end - 2) === 47) end -= 2;
38
+ else break;
39
+ pattern = pattern.slice(0, end);
40
+ return pattern === "" ? void 0 : pattern;
41
+ };
42
+ /** The `GlobSet` compile failure, materialized. */
43
+ const globFailure = (error) => ({
44
+ pattern: error.pattern,
45
+ detail: error.message,
46
+ cause: error
47
+ });
48
+ /**
49
+ * The membership `patterns` declare under `rules`, or the failure that stops
50
+ * them being read. There is no fallback reading: an npm field past one of
51
+ * `NpmWorkspacePatterns`' ceilings fails rather than being read as a `GlobSet`,
52
+ * which would silently decide members by other rules.
53
+ */
54
+ const membershipOf = (patterns, rules) => {
55
+ if (rules._tag === "glob") {
56
+ const compiled = GlobSet.compileResult(patterns);
57
+ if (Result.isFailure(compiled)) return Result.fail(globFailure(compiled.failure));
58
+ const globs = compiled.success;
59
+ return Result.succeed({
60
+ candidates: globs,
61
+ matches: (relative) => globs.matches(relative)
62
+ });
63
+ }
64
+ const matcher = NpmWorkspacePatterns.matcherResult(rules.field);
65
+ if (Result.isFailure(matcher)) {
66
+ const error = matcher.failure;
67
+ const at = error.index === void 0 ? void 0 : declaredAt(rules.field, error.index);
68
+ return Result.fail({
69
+ pattern: at ?? "package.json#workspaces",
70
+ detail: error.message,
71
+ cause: error
72
+ });
73
+ }
74
+ const candidates = [];
75
+ for (const entry of patterns) {
76
+ const candidate = npmCandidateOf(entry);
77
+ if (candidate !== void 0) candidates.push(candidate);
78
+ }
79
+ const compiled = GlobSet.compileResult(candidates);
80
+ if (Result.isFailure(compiled)) return Result.fail(globFailure(compiled.failure));
81
+ return Result.succeed({
82
+ candidates: compiled.success,
83
+ matches: matcher.success
84
+ });
85
+ };
86
+ /** The string entry at `index` of a `workspaces` field, in either shape. */
87
+ const declaredAt = (field, index) => {
88
+ const packages = typeof field === "object" && field !== null && !Array.isArray(field) && Object.hasOwn(field, "packages") ? field.packages : void 0;
89
+ const declared = Array.isArray(packages) ? packages : field;
90
+ if (!Array.isArray(declared)) return void 0;
91
+ const entry = declared[index];
92
+ return typeof entry === "string" ? entry : void 0;
93
+ };
94
+
95
+ export { GLOB_RULES, membershipOf, rulesFor };
@@ -1,4 +1,4 @@
1
- import { Effect, FileSystem, Path, Result } from "effect";
1
+ import { Effect, FileSystem, Option, Path, Result } from "effect";
2
2
  import { PackageJsonFormat } from "@effected/package-json";
3
3
  import { Yaml } from "@effected/yaml";
4
4
 
@@ -19,12 +19,8 @@ const manifestPatternsOf = (manifest) => {
19
19
  if (workspaces !== null && typeof workspaces === "object" && "packages" in workspaces) return stringsOf(workspaces.packages) ?? [];
20
20
  return [];
21
21
  };
22
- /**
23
- * The workspace `packages:` patterns for `root`: `pnpm-workspace.yaml` first,
24
- * then the root package.json `workspaces` field. An absent config is a
25
- * standalone package, not an error — it yields an empty list.
26
- */
27
- const readPatterns = (root) => Effect.gen(function* () {
22
+ /** {@link readPatterns}, with the root manifest when it is the pattern source. */
23
+ const readPatternSource = (root) => Effect.gen(function* () {
28
24
  const fs = yield* FileSystem.FileSystem;
29
25
  const path = yield* Path.Path;
30
26
  const pnpmWorkspacePath = path.join(root, "pnpm-workspace.yaml");
@@ -40,18 +36,30 @@ const readPatterns = (root) => Effect.gen(function* () {
40
36
  cause
41
37
  })));
42
38
  const patterns = pnpmPatternsOf(document);
43
- if (patterns.length > 0) return patterns;
39
+ if (patterns.length > 0) return {
40
+ patterns,
41
+ manifest: Option.none()
42
+ };
44
43
  }
45
44
  const manifestPath = path.join(root, "package.json");
46
- if (!(yield* fs.exists(manifestPath).pipe(Effect.orElseSucceed(() => false)))) return [];
45
+ if (!(yield* fs.exists(manifestPath).pipe(Effect.orElseSucceed(() => false)))) return {
46
+ patterns: [],
47
+ manifest: Option.none()
48
+ };
47
49
  const content = yield* fs.readFileString(manifestPath).pipe(Effect.mapError((cause) => ({
48
50
  path: manifestPath,
49
51
  kind: "read",
50
52
  cause
51
53
  })));
52
54
  const manifest = PackageJsonFormat.parseObjectResult(content);
53
- if (Result.isSuccess(manifest)) return manifestPatternsOf(manifest.success);
54
- if (manifest.failure.reason === "not-an-object") return [];
55
+ if (Result.isSuccess(manifest)) return {
56
+ patterns: manifestPatternsOf(manifest.success),
57
+ manifest: Option.some(manifest.success)
58
+ };
59
+ if (manifest.failure.reason === "not-an-object") return {
60
+ patterns: [],
61
+ manifest: Option.none()
62
+ };
55
63
  return yield* Effect.fail({
56
64
  path: manifestPath,
57
65
  kind: "invalidJson",
@@ -59,4 +67,4 @@ const readPatterns = (root) => Effect.gen(function* () {
59
67
  });
60
68
  });
61
69
 
62
- export { manifestPatternsOf, pnpmPatternsOf, readPatterns, stringsOf };
70
+ export { manifestPatternsOf, pnpmPatternsOf, readPatternSource, stringsOf };
package/node-sync.d.ts CHANGED
@@ -1,9 +1,28 @@
1
- import "@effected/commands";
2
- import "effect";
3
- import "@effected/glob";
4
- import "@effected/lockfiles";
5
- import "@effected/package-json";
6
- import "@effected/npm";
1
+ /**
2
+ * The Node.js binding for the sync entry points — ready-made `SyncFileSystem`
3
+ * and `SyncPath` operations over `node:fs` / `node:path`, so adopting
4
+ * `findWorkspaceRootSync` / `getWorkspacePackagesSync` is one import instead
5
+ * of four hand-wired one-liners.
6
+ *
7
+ * Deliberately a **separate subpath** (`@effected/workspaces/node-sync`), not
8
+ * part of the main entry: the main entry imports nothing platform-shaped, and
9
+ * re-exporting these from it would drag `node:*` imports into every consumer —
10
+ * including the ones supplying their own operations (a win32-explicit `path`,
11
+ * a Bun or Deno binding, a test fake). Import this module only where Node's
12
+ * built-ins are the platform you mean; `nodePath` is the running platform's
13
+ * `node:path`, so on Windows the paths handed back are win32 paths.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { findWorkspaceRootSync, getWorkspacePackagesSync } from "@effected/workspaces";
18
+ * import { nodeSyncOps } from "@effected/workspaces/node-sync";
19
+ *
20
+ * const root = findWorkspaceRootSync(process.cwd(), nodeSyncOps);
21
+ * const packages = root === null ? [] : getWorkspacePackagesSync(root, nodeSyncOps);
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
7
26
  /**
8
27
  * The synchronous file operations the sync entry points need, supplied by the
9
28
  * consumer. Node's built-ins satisfy it directly:
@@ -24,14 +43,19 @@ import "@effected/npm";
24
43
  * permission error mid-read — and every throw is absorbed into the documented
25
44
  * degraded-skip semantics: a throwing `readFile` reads as an unusable
26
45
  * manifest, a throwing `readDirectory` as an unreadable directory, a throwing
27
- * `isDirectory` as "not a directory". Nothing propagates.
46
+ * `isDirectory` as "not a directory". The one exception is a `readFile` of
47
+ * the file `getWorkspacePackagesSync` takes its patterns from (an existing
48
+ * `pnpm-workspace.yaml`, or the root `package.json` in its absence): there is
49
+ * no partial answer without it, so the throw comes back as a
50
+ * `WorkspaceDiscoveryError` of kind `"read"` carrying it as `cause`. Nothing
51
+ * propagates raw.
28
52
  *
29
53
  * @public
30
54
  */
31
55
  interface SyncFileSystem {
32
56
  /** Whether a file or directory exists at `path`. Must not throw. */
33
57
  readonly exists: (path: string) => boolean;
34
- /** Read the file at `path` as text. May throw; a throw degrades to a skip. */
58
+ /** Read the file at `path` as text. May throw; a throw degrades to a skip (the pattern source excepted). */
35
59
  readonly readFile: (path: string) => string;
36
60
  /** The entry names inside the directory at `path`. May throw; a throw skips the directory. */
37
61
  readonly readDirectory: (path: string) => ReadonlyArray<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/workspaces",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "private": false,
5
5
  "description": "Monorepo workspace tooling as Effect services — root discovery, package enumeration, the dependency graph, package-manager detection, pnpm catalog resolution, lockfile IO and git-based change detection.",
6
6
  "keywords": [
@@ -55,11 +55,11 @@
55
55
  "@effected/git": "^0.32.0",
56
56
  "@effected/glob": "^0.21.0",
57
57
  "@effected/jsonc": "^0.25.0",
58
- "@effected/lockfiles": "^0.24.0",
59
- "@effected/npm": "^0.33.0",
60
- "@effected/package-json": "^0.32.0",
58
+ "@effected/lockfiles": "^0.24.1",
59
+ "@effected/npm": "^0.34.0",
60
+ "@effected/package-json": "^0.32.1",
61
61
  "@effected/semver": "^0.24.0",
62
- "@effected/walker": "^0.27.0",
62
+ "@effected/walker": "^0.28.0",
63
63
  "@effected/yaml": "^0.30.0",
64
64
  "@pnpm/catalogs.config": "^1100.0.5",
65
65
  "@pnpm/catalogs.protocol-parser": "^1100.0.0",
package/testing.d.ts CHANGED
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Repo-shape checks for a monorepo's own test suite: `SourceBoundary` keeps
3
+ * `process`, `node:` imports and console writes out of modules meant to be
4
+ * free of them, `ImportGraph` answers the two questions that belong to the
5
+ * import graph rather than to any one file — whether the entries reach a
6
+ * forbidden import at all, and whether every runtime import is declared —
7
+ * `WorkspaceLayering` holds the package graph to a committed
8
+ * `LayerPolicy`, and `PackedInstall` proves a carrier's bins install from its
9
+ * packed tarballs under every available package manager.
10
+ *
11
+ * @remarks
12
+ * A separate subpath, never re-exported from `.`, so the main entry's
13
+ * consumers never load a scanner, a policy decoder or package-manager
14
+ * orchestration they do not use.
15
+ *
16
+ * @packageDocumentation
17
+ */
1
18
  import { DependencyField, WorkspaceResolver } from "@effected/npm";
2
19
  import { Context, Duration, Effect, FileSystem, Layer, Option, Path, PlatformError, Schema, Stream } from "effect";
3
20
  import { GlobPattern } from "@effected/glob";
@@ -544,6 +561,12 @@ declare const WorkspacePatternError_base: Schema.Class<WorkspacePatternError, Sc
544
561
  readonly kind: Schema.Literals<readonly ["missingBaseDir", "uncompilable", "depthExceeded", "budgetExceeded", "unreadableDirectory"]>;
545
562
  /** A short, structured detail — the missing directory, or the bound exceeded. */
546
563
  readonly detail: Schema.String;
564
+ /**
565
+ * For `uncompilable`: the typed error that stopped the patterns being read —
566
+ * glob's `GlobPatternError`, or `@effected/npm`'s `NpmWorkspacePatternsError`
567
+ * when an npm root's `workspaces` field passes one of npm's pattern ceilings.
568
+ */
569
+ readonly cause: Schema.optionalKey<Schema.Defect>;
547
570
  }>, import("effect/Cause").YieldableError>;
548
571
  /**
549
572
  * Raised when a `packages:` pattern cannot be enumerated: its base directory is