@effected/workspaces 0.47.0 → 0.48.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/index.d.ts CHANGED
@@ -29,10 +29,11 @@
29
29
  */
30
30
  import { Git, GitCommandError, NotARepositoryError, UnknownRefError } from "@effected/git";
31
31
  import { Context, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
32
- import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError, Manifest, PartialReleaseAgeGate, ReleaseAgeGate, UnresolvedDependencyError, WorkspaceResolver } from "@effected/npm";
32
+ import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError, Manifest, UnresolvedDependencyError, WorkspaceResolver } from "@effected/npm";
33
33
  import { GlobPattern } from "@effected/glob";
34
34
  import { Lockfile, LockfileFramingError, LockfileIntegrity, LockfileParseError, ResolvedPackage, WorkspaceManifest } from "@effected/lockfiles";
35
35
  import { Package } from "@effected/package-json";
36
+ import { PartialReleaseAgeGate, PeerDependencyRules, ReleaseAgeGate } from "@effected/pnpm";
36
37
  import { ChildProcessSpawner } from "effect/process";
37
38
  import { SemVer } from "@effected/semver";
38
39
  import { ExecContext, LocalExec, LocalExecError } from "@effected/commands";
@@ -85,6 +86,12 @@ declare const PublishConfig_base: Schema.Class<PublishConfig, Schema.Struct<{
85
86
  readonly linkDirectory: Schema.optionalKey<Schema.Boolean>;
86
87
  /** The dist-tag to publish under. */
87
88
  readonly tag: Schema.optionalKey<Schema.String>;
89
+ /**
90
+ * The name the package publishes under when it differs from its manifest
91
+ * `name`. An empty string is no rename, as pnpm's `published_name` reads it,
92
+ * so a reader of the registry name takes `name` only when it is non-empty.
93
+ */
94
+ readonly name: Schema.optionalKey<Schema.String>;
88
95
  }>, {}>;
89
96
  /**
90
97
  * The `publishConfig` fields workspace tooling reads.
@@ -342,7 +349,7 @@ interface FindWorkspaceRootOptions {
342
349
  * @remarks
343
350
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
344
351
  * `package.json#workspaces`, so a member package that kept the field (common
345
- * after a yarn migration) must not read as the root. An empty list is a
352
+ * after a migration to pnpm) must not read as the root. An empty list is a
346
353
  * **defect**, like a bad `maxDepth`.
347
354
  *
348
355
  * @defaultValue every marker, `WORKSPACE_MARKERS`
@@ -693,7 +700,7 @@ interface WorkspaceDiscoveryOptions {
693
700
  * @remarks
694
701
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
695
702
  * `package.json#workspaces`, so a member package that kept the field
696
- * (common after a yarn migration) must not read as the root. An empty
703
+ * (common after a migration to pnpm) must not read as the root. An empty
697
704
  * list is a **defect** at first use, as it is for `find`.
698
705
  *
699
706
  * Unlike `stopAt`, it applies to the per-call `infoIn`, `listPackagesIn`
@@ -1046,52 +1053,6 @@ export declare class ChangeDetector extends ChangeDetector_base {
1046
1053
  /** The live layer. */
1047
1054
  static readonly layer: Layer.Layer<ChangeDetector, never, Git | WorkspaceDiscovery>;
1048
1055
  }
1049
- /**
1050
- * pnpm's `peerDependencyRules` block — the suppression policy pnpm applies
1051
- * **after** computing peer violations, in pnpm's own shape.
1052
- *
1053
- * @remarks
1054
- * The shape is pnpm's own, because that is what comes back off the threaded
1055
- * config: a replayed hook returns `{ allowedVersions, ignoreMissing, allowAny }`
1056
- * intact, needing no reshaping.
1057
- *
1058
- * All three axes are consumed by `PeerCheck`, matching `pnpm peers check`.
1059
- * `ignoreMissing` and `allowAny` are lists of **peer-name patterns** in pnpm's `@pnpm/matcher`
1060
- * grammar (`*` wildcard, leading `!` negation) — not `parent>peer` keys, which
1061
- * match nothing on those two axes. `ignoreMissing` hides only a required peer
1062
- * that resolved to nothing; `allowAny` hides only a peer that resolved outside
1063
- * its wanted range; the two never cross.
1064
- *
1065
- * `allowedVersions` keys come in two spellings in the wild, and both must be
1066
- * handled: parent-versioned (`"@effect/ai-anthropic@4.0.0>effect"`, as
1067
- * `pnpm:export` materializes them into `pnpm-workspace.yaml`) and unversioned
1068
- * (`"@effect/vitest>vitest"`, as a config-dependency plugin injects them).
1069
- *
1070
- * @public
1071
- */
1072
- interface PeerDependencyRules {
1073
- /** `parent>peer` → the peer version or range the rule permits. */
1074
- readonly allowedVersions: Readonly<Record<string, string>>;
1075
- /** Peer-name patterns whose absence pnpm does not report (a required peer that resolved to nothing). */
1076
- readonly ignoreMissing: ReadonlyArray<string>;
1077
- /** Peer-name patterns for which any resolved version is accepted. */
1078
- readonly allowAny: ReadonlyArray<string>;
1079
- }
1080
- /**
1081
- * The empty {@link PeerDependencyRules}: every axis present and empty.
1082
- *
1083
- * @remarks
1084
- * Exported so that "I assert this workspace's rules are empty" is **one token**
1085
- * rather than three hand-written empty axes. That matters where the distinction
1086
- * is load-bearing — supplying rules asserts they were looked up, while omitting
1087
- * them asserts nothing — and a caller spelling the object out by hand will
1088
- * eventually fill two of the three axes and mean the third.
1089
- *
1090
- * Frozen, since it is shared.
1091
- *
1092
- * @public
1093
- */
1094
- export declare const NoPeerDependencyRules: PeerDependencyRules;
1095
1056
  /**
1096
1057
  * Where a replayed config dependency's declared version was found: the
1097
1058
  * `node_modules/.pnpm-config` copy, the pnpm store's `links/` tree, the store
@@ -1419,7 +1380,7 @@ export declare class ConfigDependencyHooks extends ConfigDependencyHooks_base {
1419
1380
  * `layerLive` — which captures nothing — would succeed).
1420
1381
  *
1421
1382
  * Catalog folding and normalization stay in the **parent** (the same
1422
- * `@pnpm/catalogs`-derived path `layerLive` uses); the child returns only the
1383
+ * catalog engine path `layerLive` uses); the child returns only the
1423
1384
  * raw threaded config slice, since the script cannot import kit code.
1424
1385
  *
1425
1386
  * Requires core's `ChildProcessSpawner`, resolved when the layer is built —
@@ -1912,13 +1873,18 @@ export declare class DuplicateCheck extends DuplicateCheck_base {
1912
1873
  static run(lockfile: Lockfile, options?: DuplicateCheckOptions): DuplicateCheck;
1913
1874
  }
1914
1875
  /**
1915
- * The four package managers this package understands.
1876
+ * The package managers this package acts on: npm, pnpm and bun.
1877
+ *
1878
+ * @remarks
1879
+ * A repository run by any other manager still discovers — its members come
1880
+ * from `package.json#workspaces` — but detection reports it as an
1881
+ * `UnsupportedPackageManagerError` rather than naming one of these.
1916
1882
  *
1917
1883
  * @public
1918
1884
  */
1919
- export declare const PackageManagerName: Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>;
1885
+ export declare const PackageManagerName: Schema.Literals<readonly ["npm", "pnpm", "bun"]>;
1920
1886
  /**
1921
- * The decoded type of {@link (PackageManagerName:variable)}: `"npm" | "pnpm" | "yarn" | "bun"`.
1887
+ * The decoded type of {@link (PackageManagerName:variable)}: `"npm" | "pnpm" | "bun"`.
1922
1888
  *
1923
1889
  * @public
1924
1890
  */
@@ -1941,7 +1907,7 @@ export type PackageManagerName = typeof PackageManagerName.Type;
1941
1907
  *
1942
1908
  * @public
1943
1909
  */
1944
- export declare const PackageManagerEvidence: Schema.Literals<readonly ["pnpm-workspace.yaml", "bun.lock", "bun.lockb", "yarn.lock", "package.json#workspaces", "pnpm-lock.yaml", "package-lock.json", "package.json#devEngines.packageManager", "package.json#packageManager"]>;
1910
+ export declare const PackageManagerEvidence: Schema.Literals<readonly ["pnpm-workspace.yaml", "bun.lock", "bun.lockb", "package.json#workspaces", "pnpm-lock.yaml", "package-lock.json", "package.json#devEngines.packageManager", "package.json#packageManager"]>;
1945
1911
  /**
1946
1912
  * The decoded type of {@link (PackageManagerEvidence:variable)}: the marker
1947
1913
  * that decided a detection.
@@ -1951,29 +1917,29 @@ export declare const PackageManagerEvidence: Schema.Literals<readonly ["pnpm-wor
1951
1917
  export type PackageManagerEvidence = typeof PackageManagerEvidence.Type;
1952
1918
  declare const DetectedPackageManager_base: Schema.Class<DetectedPackageManager, Schema.Struct<{
1953
1919
  /** The detected manager. */
1954
- readonly name: Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>;
1920
+ readonly name: Schema.Literals<readonly ["npm", "pnpm", "bun"]>;
1955
1921
  /** Its version, when a manifest field agrees on the manager and carries one. */
1956
1922
  readonly version: Schema.Option<Schema.String>;
1957
1923
  /** The JavaScript runtime the manager implies. */
1958
1924
  readonly runtime: Schema.Literals<readonly ["node", "bun"]>;
1959
1925
  /** The rung of the priority order that decided the name. */
1960
- readonly evidence: Schema.Literals<readonly ["pnpm-workspace.yaml", "bun.lock", "bun.lockb", "yarn.lock", "package.json#workspaces", "pnpm-lock.yaml", "package-lock.json", "package.json#devEngines.packageManager", "package.json#packageManager"]>;
1926
+ readonly evidence: Schema.Literals<readonly ["pnpm-workspace.yaml", "bun.lock", "bun.lockb", "package.json#workspaces", "pnpm-lock.yaml", "package-lock.json", "package.json#devEngines.packageManager", "package.json#packageManager"]>;
1961
1927
  }>, {}>;
1962
1928
  /**
1963
1929
  * The outcome of package-manager detection at a workspace root.
1964
1930
  *
1965
1931
  * @remarks
1966
1932
  * `version` is `Option.none()` unless a manifest field naming the *same* manager
1967
- * that was detected also carries a version — a `packageManager: "yarn@4"` in a
1968
- * pnpm workspace tells us nothing about pnpm's version, so it is not reported as
1969
- * one. The two fields consulted are the corepack top-level `packageManager` and
1933
+ * that was detected also carries a version — a `packageManager: "bun@1.2.0"` in
1934
+ * a pnpm workspace tells us nothing about pnpm's version, so it is not reported
1935
+ * as one. The two fields consulted are the corepack top-level `packageManager` and
1970
1936
  * `devEngines.packageManager`; see {@link PackageManagerDetector} for the
1971
1937
  * precedence between them.
1972
1938
  *
1973
1939
  * `evidence` is the rung of the priority order that decided the **name** — the
1974
1940
  * verdict's provenance, in the same vocabulary the failure path reports as
1975
- * `PackageManagerDetectionError.checked`. For the bun and yarn rungs the
1976
- * lockfile is the recorded signal even though the rung is a conjunction (the
1941
+ * `PackageManagerDetectionError.checked`. For the bun rung the lockfile is the
1942
+ * recorded signal even though the rung is a conjunction (the
1977
1943
  * lockfile *plus* a manifest field naming the manager): the manifest field alone
1978
1944
  * would have resolved in the declaration tier, so the lockfile is what this rung
1979
1945
  * added. The version's provenance is deliberately not carried — it follows the
@@ -1998,14 +1964,42 @@ export declare class PackageManagerDetectionError extends PackageManagerDetectio
1998
1964
  /** Renders the root and probed markers into a one-line message. */
1999
1965
  get message(): string;
2000
1966
  }
1967
+ declare const UnsupportedPackageManagerError_base: Schema.Class<UnsupportedPackageManagerError, Schema.TaggedStruct<"UnsupportedPackageManagerError", {
1968
+ /** The workspace root that was probed. */
1969
+ readonly root: Schema.String;
1970
+ /** The unsupported manager the root belongs to. */
1971
+ readonly manager: Schema.Literal<"yarn">;
1972
+ /** The signal that identified it. */
1973
+ readonly evidence: Schema.Literals<readonly ["yarn.lock", "package.json#devEngines.packageManager", "package.json#packageManager"]>;
1974
+ }>, import("effect/Cause").YieldableError>;
1975
+ /**
1976
+ * Raised when a root belongs to a package manager this package does not act
1977
+ * on, so detection names it instead of guessing a supported one.
1978
+ *
1979
+ * @remarks
1980
+ * yarn is that manager. A yarn repository declares its members in
1981
+ * `package.json#workspaces` exactly as npm does, so discovery, the root ascent
1982
+ * and the dependency graph work on it unchanged; what fails is everything that
1983
+ * runs or provisions a manager, parses its lockfile or launches its tools.
1984
+ * Reporting npm there would run the wrong manager against a yarn tree.
1985
+ *
1986
+ * `evidence` is the signal that identified the manager: its lockfile, or the
1987
+ * manifest field that names it.
1988
+ *
1989
+ * @public
1990
+ */
1991
+ export declare class UnsupportedPackageManagerError extends UnsupportedPackageManagerError_base {
1992
+ /** Renders the root, manager and evidence into a one-line message. */
1993
+ get message(): string;
1994
+ }
2001
1995
  /**
2002
1996
  * Every failure {@link PackageManagerDetector} can surface: no manager could be
2003
- * attributed to the root, or the root's `package.json` exists but cannot be read
2004
- * or parsed.
1997
+ * attributed to the root, the root belongs to an unsupported manager, or the
1998
+ * root's `package.json` exists but cannot be read or parsed.
2005
1999
  *
2006
2000
  * @public
2007
2001
  */
2008
- type PackageManagerDetectionFailure = PackageManagerDetectionError | WorkspaceManifestError;
2002
+ type PackageManagerDetectionFailure = PackageManagerDetectionError | UnsupportedPackageManagerError | WorkspaceManifestError;
2009
2003
  /**
2010
2004
  * The {@link PackageManagerDetector} service shape.
2011
2005
  *
@@ -2027,12 +2021,16 @@ declare const PackageManagerDetector_base: Context.ServiceClass<PackageManagerDe
2027
2021
  * @remarks
2028
2022
  * **Lockfile evidence is the primary signal** — it is what says which manager
2029
2023
  * actually ran. Priority, first match wins: a `pnpm-workspace.yaml` means pnpm;
2030
- * a bun lockfile *plus* a manifest field naming bun means bun; a `yarn.lock`
2031
- * *plus* a manifest field naming yarn means yarn; a root `package.json` with a
2032
- * `workspaces` field falls back to npm.
2024
+ * a bun lockfile *plus* a manifest field naming bun means bun; a root
2025
+ * `package.json` with a `workspaces` field falls back to npm.
2026
+ *
2027
+ * The manifest conjunction is deliberate: a stray bun lockfile in an npm repo
2028
+ * is common, and only a declared manager name disambiguates it.
2033
2029
  *
2034
- * The manifest conjunction is deliberate: a stray `yarn.lock` in an npm repo is
2035
- * common, and only a declared manager name disambiguates it.
2030
+ * A yarn repository fails with {@link UnsupportedPackageManagerError} instead
2031
+ * of falling back to npm: a manifest field naming yarn decides it, and so does
2032
+ * a `yarn.lock` that is the root's only lockfile when the manifest names no
2033
+ * manager.
2036
2034
  *
2037
2035
  * **Two manifest fields declare a manager, and they are not interchangeable.**
2038
2036
  * Corepack reads both, and this is the rule that falls out of how it treats
@@ -2049,8 +2047,8 @@ declare const PackageManagerDetector_base: Context.ServiceClass<PackageManagerDe
2049
2047
  * supplies the version instead.
2050
2048
  *
2051
2049
  * A version is reported **only when the field it came from names the manager
2052
- * that was actually detected**. A `packageManager: "yarn@4"` in a pnpm workspace
2053
- * says nothing about pnpm's version, so no version is reported — and the same
2050
+ * that was actually detected**. A `packageManager: "bun@1.2.0"` in a pnpm
2051
+ * workspace says nothing about pnpm's version, so no version is reported — and the same
2054
2052
  * discipline applies to `devEngines`.
2055
2053
  *
2056
2054
  * Malformed manifest *hints* are ignored rather than fatal, matching corepack: a
@@ -2127,7 +2125,7 @@ declare const LockfileReadError_base: Schema.Class<LockfileReadError, Schema.Tag
2127
2125
  /** Absolute path to the lockfile that could not be read. */
2128
2126
  readonly lockfilePath: Schema.String;
2129
2127
  /** The format the detected package manager implies. */
2130
- readonly format: Schema.Literals<readonly ["bun", "npm", "pnpm", "yarn"]>;
2128
+ readonly format: Schema.Literals<readonly ["bun", "npm", "pnpm"]>;
2131
2129
  /** The originating failure. */
2132
2130
  readonly cause: Schema.Defect;
2133
2131
  }>, import("effect/Cause").YieldableError>;
@@ -2219,7 +2217,7 @@ interface LockfileReaderOptions {
2219
2217
  * @remarks
2220
2218
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
2221
2219
  * `package.json#workspaces`, so a member package that kept the field
2222
- * (common after a yarn migration) must not read as the root. An empty
2220
+ * (common after a migration to pnpm) must not read as the root. An empty
2223
2221
  * list is a **defect** at first use, as it is for `find`.
2224
2222
  *
2225
2223
  * Give it the same value as {@link WorkspaceDiscoveryOptions.markers}
@@ -2416,7 +2414,7 @@ export declare class CatalogSet extends CatalogSet_base {
2416
2414
  * the default catalog declared twice — once as `workspaces.catalog` and again
2417
2415
  * as `workspaces.catalogs.default` — fails with `CatalogAssemblyError`
2418
2416
  * naming what was wrong. An absent `workspaces` field, one explicitly `null`,
2419
- * or the plain array form (npm/yarn patterns, which carry no catalogs) yields
2417
+ * or the plain array form (npm patterns, which carry no catalogs) yields
2420
2418
  * the empty set. Presence is checked structurally, so an explicitly-declared
2421
2419
  * empty `catalog: {}` still counts as a declaration.
2422
2420
  *
@@ -2578,7 +2576,7 @@ interface WorkspaceCatalogsOptions {
2578
2576
  * @remarks
2579
2577
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
2580
2578
  * `package.json#workspaces`, so a member package that kept the field
2581
- * (common after a yarn migration) must not read as the root. An empty
2579
+ * (common after a migration to pnpm) must not read as the root. An empty
2582
2580
  * list is a **defect** at first use, as it is for `find`.
2583
2581
  *
2584
2582
  * Give it the same value as {@link WorkspaceDiscoveryOptions.markers}
@@ -2816,7 +2814,7 @@ type UnverifiedReason = "peerRulesNotApplied" | "unresolvedEdge" | "peerRangeUnr
2816
2814
  *
2817
2815
  * @remarks
2818
2816
  * **Presence of `peerDependencyRules` is the assertion; its contents are the
2819
- * value.** Supplying `NoPeerDependencyRules` asserts the workspace has none and
2817
+ * value.** Supplying `PeerDependencyRules.empty` asserts the workspace has none and
2820
2818
  * yields a verified report; omitting the key entirely says nothing was looked
2821
2819
  * up and always yields `"peerRulesNotApplied"`. The two are deliberately
2822
2820
  * different results, because a gate must be able to tell "clean" from
@@ -2944,11 +2942,10 @@ declare const PeerCheck_base: Schema.Class<PeerCheck, Schema.Struct<{
2944
2942
  /**
2945
2943
  * Whether the lockfile's format records peer resolution at all.
2946
2944
  *
2947
- * `false` for yarn: yarn resolves peers **virtually**, giving a
2948
- * peer-bearing package one `@virtual:` locator per consumer, and the
2949
- * lockfile does not record which virtual instance satisfied which peer.
2950
- * The answer is not recoverable, so it is not fabricated — `unsatisfied`
2951
- * is empty and this flag says why.
2945
+ * `false` for a format whose lockfile does not record which instance
2946
+ * satisfied which peer. The answer is not recoverable there, so it is not
2947
+ * fabricated — `unsatisfied` is empty and this flag says why. Every format
2948
+ * `Lockfile.parse` reads today records it.
2952
2949
  */
2953
2950
  readonly supported: Schema.Boolean;
2954
2951
  /** Every unsatisfied peer found, optional ones included. */
@@ -3047,7 +3044,7 @@ export declare class PeerCheck extends PeerCheck_base {
3047
3044
  * - **A workspace-linked provider counts.** Resolution is followed through
3048
3045
  * whatever the edge names, including a workspace row.
3049
3046
  *
3050
- * Known limits it does not paper over: yarn (see `supported`), the npm and
3047
+ * Known limits it does not paper over: the npm and
3051
3048
  * bun root importer (see `unresolvedImporters`), and pnpm recording no peer
3052
3049
  * declarations for workspace projects themselves — under pnpm a workspace
3053
3050
  * package's *own* unsatisfied peers are not in the lockfile at all, and
@@ -3097,326 +3094,6 @@ export declare class PeerCheck extends PeerCheck_base {
3097
3094
  */
3098
3095
  static run(lockfile: Lockfile, options?: PeerCheckOptions): PeerCheck;
3099
3096
  }
3100
- declare const PnpmSettingsError_base: Schema.Class<PnpmSettingsError, Schema.TaggedStruct<"PnpmSettingsError", {
3101
- /** Why the file could not be used. */
3102
- readonly reason: Schema.Literals<readonly ["read", "parse", "shape", "membership"]>;
3103
- /** The file involved, when the source named one. */
3104
- readonly path: Schema.optionalKey<Schema.String>;
3105
- /** The underlying failure, for `"read"`, `"parse"` and `"membership"`. */
3106
- readonly cause: Schema.optionalKey<Schema.Defect>;
3107
- }>, import("effect/Cause").YieldableError>;
3108
- /**
3109
- * A pnpm settings file could not be used.
3110
- *
3111
- * @remarks
3112
- * `reason` routes: `"read"` — the file exists but could not be read (the
3113
- * platform failure is the `cause`); `"parse"` — the file is not valid YAML (the
3114
- * `YamlParseError` is the `cause`); `"shape"` — the file is valid YAML but its
3115
- * document is not a mapping (a list or a scalar), which pnpm refuses too;
3116
- * `"membership"` — the workspace's `packages:` patterns each compile alone but
3117
- * fail as a set (they share one compile budget; the `GlobError` is the
3118
- * `cause`), so whether the directory is a member cannot be decided and the
3119
- * load fails rather than reading the workspace file as not applying. A
3120
- * file that does not exist is not an error: pnpm skips it, and so does
3121
- * {@link PnpmSettings.load}. An empty file is an empty mapping.
3122
- *
3123
- * @public
3124
- */
3125
- export declare class PnpmSettingsError extends PnpmSettingsError_base {
3126
- get message(): string;
3127
- }
3128
- /**
3129
- * Where a setting's value came from, highest precedence first: a
3130
- * `pnpm_config_*` / `PNPM_CONFIG_*` environment variable, the workspace's
3131
- * `pnpm-workspace.yaml`, or pnpm's global `config.yaml`.
3132
- *
3133
- * @public
3134
- */
3135
- type PnpmSettingOrigin = "environment" | "workspace" | "global";
3136
- /**
3137
- * One YAML settings file for {@link PnpmSettings.fromSourcesResult}: its text
3138
- * and, for errors and `PnpmSettings.files`, where it came from.
3139
- *
3140
- * @public
3141
- */
3142
- interface PnpmSettingsSource {
3143
- /** The YAML text. */
3144
- readonly text: string;
3145
- /** Where it was read from. */
3146
- readonly path?: string | undefined;
3147
- }
3148
- /**
3149
- * The inputs {@link PnpmSettings.fromSourcesResult} merges.
3150
- *
3151
- * @public
3152
- */
3153
- interface PnpmSettingsSources {
3154
- /** The workspace root's `pnpm-workspace.yaml`. */
3155
- readonly workspace?: PnpmSettingsSource | undefined;
3156
- /** pnpm's global `config.yaml`. */
3157
- readonly global?: PnpmSettingsSource | undefined;
3158
- /** The environment, read for `pnpm_config_*` and `PNPM_CONFIG_*` variables. */
3159
- readonly env?: Readonly<Record<string, string | undefined>> | undefined;
3160
- }
3161
- /**
3162
- * Options for {@link PnpmSettings.load}.
3163
- *
3164
- * @public
3165
- */
3166
- interface PnpmSettingsLoadOptions {
3167
- /**
3168
- * Where pnpm would run. The workspace file is the nearest
3169
- * `pnpm-workspace.yaml` at or above its real path, when this directory
3170
- * belongs to that workspace, unless the environment names a workspace
3171
- * directory (`PNPM_CONFIG_WORKSPACE_DIR`, then `NPM_CONFIG_WORKSPACE_DIR`,
3172
- * each in either case). See {@link PnpmSettings.load} for the membership
3173
- * rule.
3174
- */
3175
- readonly cwd: string;
3176
- /**
3177
- * The environment, as a plain record (pass `process.env` at the edge). Read
3178
- * for `pnpm_config_*` settings, the workspace-directory override,
3179
- * `XDG_CONFIG_HOME`, `LOCALAPPDATA` and `HOME`.
3180
- */
3181
- readonly env: Readonly<Record<string, string | undefined>>;
3182
- /**
3183
- * The platform pnpm runs on (pass `process.platform` at the edge). It picks
3184
- * pnpm's default global config directory when `XDG_CONFIG_HOME` is unset:
3185
- * `~/Library/Preferences/pnpm` on `"darwin"`, `%LOCALAPPDATA%\pnpm\config`
3186
- * on `"win32"`, `~/.config/pnpm` elsewhere.
3187
- */
3188
- readonly platform: string;
3189
- /**
3190
- * The home directory. Defaults to `env.HOME`, then `env.USERPROFILE`; with
3191
- * neither, and no `XDG_CONFIG_HOME` (or `LOCALAPPDATA` on win32), no global
3192
- * config file is read.
3193
- */
3194
- readonly home?: string | undefined;
3195
- /**
3196
- * pnpm's global config directory, holding `config.yaml`. Overrides the
3197
- * directory derived from the environment and platform.
3198
- */
3199
- readonly globalConfigDir?: string | undefined;
3200
- }
3201
- declare const PnpmSettings_base: Schema.Class<PnpmSettings, Schema.Struct<{
3202
- /** The environment's pnpm settings, keyed by camelCase name, as written. */
3203
- readonly environment: Schema.$Record<Schema.String, Schema.String>;
3204
- /** The top-level settings of the workspace's `pnpm-workspace.yaml`. */
3205
- readonly workspace: Schema.$Record<Schema.String, Schema.Unknown>;
3206
- /** The top-level settings of pnpm's global `config.yaml`. */
3207
- readonly global: Schema.$Record<Schema.String, Schema.Unknown>;
3208
- /** The settings files that were read, lowest precedence first. */
3209
- readonly files: Schema.$Array<Schema.String>;
3210
- }>, {}>;
3211
- /**
3212
- * pnpm's effective settings: the values `pnpm config get <key>` reports for a
3213
- * pnpm setting, merged from the sources pnpm reads with pnpm's precedence.
3214
- *
3215
- * @remarks
3216
- * Build one with {@link PnpmSettings.load} (finds and reads the files through
3217
- * `FileSystem`) or {@link PnpmSettings.fromSourcesResult} (from text you
3218
- * already hold), then read a setting by name:
3219
- *
3220
- * ```ts
3221
- * settings.minimumReleaseAge; // Option<number>
3222
- * settings.minimumReleaseAgeExclude; // ReadonlyArray<string>
3223
- * settings.getBoolean("minimumReleaseAgeStrict");
3224
- * ```
3225
- *
3226
- * **Precedence, highest first**: a `pnpm_config_<name>` or
3227
- * `PNPM_CONFIG_<NAME>` environment variable, the workspace root's
3228
- * `pnpm-workspace.yaml`, then pnpm's global `config.yaml`. A higher source
3229
- * replaces a lower one's value whole; lists are not merged. This is the order
3230
- * pnpm 11 and pnpm 12 apply to settings such as `minimumReleaseAge` and
3231
- * `minimumReleaseAgeExclude`.
3232
- *
3233
- * **What pnpm does not read for a pnpm setting, this does not read either.**
3234
- * `.npmrc` files (project, user and global), `npm_config_*` variables and
3235
- * the old global `rc` file carry no pnpm setting for pnpm 11 and 12: pnpm
3236
- * takes only registry and auth keys from `.npmrc`. A registry or a credential
3237
- * is `@effected/npm`'s `NpmConfig`, not this. Command-line `--config.*`
3238
- * flags, pnpm's built-in defaults (`minimumReleaseAge` reads as unset here,
3239
- * as `pnpm config get` reports it, though pnpm applies a default when it
3240
- * installs), and the per-setting source restrictions pnpm applies to a few
3241
- * machine-level settings (a `pnpm-workspace.yaml` cannot set `globalDir`, for
3242
- * example) are not modelled.
3243
- *
3244
- * **Keys.** Every accessor takes the camelCase name pnpm writes in YAML
3245
- * (`minimumReleaseAge`) or the kebab-case one an npmrc would use
3246
- * (`minimum-release-age`); both name the same setting. An environment
3247
- * variable names a setting in snake case: `pnpm_config_minimum_release_age`
3248
- * all lowercase, or `PNPM_CONFIG_MINIMUM_RELEASE_AGE` all uppercase. A mixed
3249
- * spelling is not a pnpm setting and is ignored, and an empty value is unset.
3250
- * When both spellings are set, the uppercase one wins, as in pnpm 12.
3251
- *
3252
- * **Typed reads.** An environment value is text, read as the type the
3253
- * accessor asks for: a number as a canonical decimal, a boolean as `true` or
3254
- * `false`, a list as a JSON array of strings. An environment value that does
3255
- * not read as that type is skipped, and the next source answers, as pnpm 12
3256
- * skips it. In a file, pnpm 12 coerces boolean words (`yes`, `on`, `"true"`)
3257
- * and digit strings (`"15"`), and so does this. A file value that still does
3258
- * not read as the type answers `None` instead of falling through, because
3259
- * pnpm 12 refuses to load a file with a mistyped setting; {@link
3260
- * PnpmSettings.get} shows the raw value. A `null` in a file is unset.
3261
- *
3262
- * @example
3263
- * ```ts
3264
- * import { PnpmSettings } from "@effected/workspaces";
3265
- * import { Effect, Option } from "effect";
3266
- *
3267
- * const cutoffMinutes = Effect.gen(function* () {
3268
- * const settings = yield* PnpmSettings.load({
3269
- * cwd: process.cwd(),
3270
- * env: process.env,
3271
- * platform: process.platform,
3272
- * });
3273
- * // Unset means pnpm's own default, 1440 minutes, not an open gate.
3274
- * return Option.getOrElse(settings.minimumReleaseAge, () => 1440);
3275
- * });
3276
- * ```
3277
- *
3278
- * @public
3279
- */
3280
- export declare class PnpmSettings extends PnpmSettings_base {
3281
- /**
3282
- * A setting's raw value from the highest source that sets it, or `None`.
3283
- *
3284
- * @remarks
3285
- * An environment value is the string as written; a file value is the
3286
- * decoded YAML (a number, a list, a mapping). Use the typed accessors to
3287
- * read it as a type.
3288
- *
3289
- * @param key - The setting, camelCase or kebab-case.
3290
- */
3291
- get(key: string): Option.Option<unknown>;
3292
- /**
3293
- * Which source {@link PnpmSettings.get} answers a setting from, or `None`
3294
- * when no source sets it.
3295
- *
3296
- * @param key - The setting, camelCase or kebab-case.
3297
- */
3298
- origin(key: string): Option.Option<PnpmSettingOrigin>;
3299
- /**
3300
- * A string setting: an environment value as written, or a string in a file.
3301
- *
3302
- * @param key - The setting, camelCase or kebab-case.
3303
- */
3304
- getString(key: string): Option.Option<string>;
3305
- /**
3306
- * A numeric setting: a finite number, or a canonical decimal string, in any
3307
- * source.
3308
- *
3309
- * @remarks
3310
- * A canonical decimal is an optional `-`, digits with no leading zero, and
3311
- * an optional fraction: `05`, `+5`, `0x10`, `1e2` and `1_000` are not
3312
- * numbers here, as pnpm 12 does not read them from the environment. An
3313
- * integer setting such as {@link PnpmSettings.minimumReleaseAge} is
3314
- * stricter still.
3315
- *
3316
- * @param key - The setting, camelCase or kebab-case.
3317
- */
3318
- getNumber(key: string): Option.Option<number>;
3319
- /**
3320
- * A boolean setting: `true` or `false` in the environment, a YAML boolean
3321
- * or a boolean word in a file.
3322
- *
3323
- * @remarks
3324
- * In a file, the strings `true`, `yes`, `y` and `on` read as `true` and
3325
- * `false`, `no`, `n` and `off` as `false`, trimmed and in any case, as
3326
- * pnpm 12 coerces them. A number (`1`, `0`) or any other string answers
3327
- * `None`; pnpm 12 refuses it as an invalid boolean. The environment is
3328
- * stricter: only `true` or `false`, trimmed and lowercase.
3329
- *
3330
- * @param key - The setting, camelCase or kebab-case.
3331
- */
3332
- getBoolean(key: string): Option.Option<boolean>;
3333
- /**
3334
- * A list setting: a JSON array of strings in the environment, a YAML list
3335
- * of strings in a file.
3336
- *
3337
- * @remarks
3338
- * A comma-separated environment value is not a list: pnpm 12 ignores it,
3339
- * and this skips it to the next source.
3340
- *
3341
- * @param key - The setting, camelCase or kebab-case.
3342
- */
3343
- getStringArray(key: string): Option.Option<ReadonlyArray<string>>;
3344
- /**
3345
- * `minimumReleaseAge`: the minutes a version must have been published before
3346
- * pnpm installs it, or `None` when no source sets it. `None` is not an
3347
- * open gate: pnpm then applies its built-in default of 1440 minutes.
3348
- *
3349
- * @remarks
3350
- * Only a non-negative safe integer counts, as pnpm 12 reads the setting
3351
- * (an unsigned 64-bit integer, here bounded by `Number.MAX_SAFE_INTEGER`).
3352
- * Text, in the environment or a quoted file value, must be canonical digits
3353
- * once trimmed: `" 30 "` reads as 30, while `05`, `+5`, `-0`, `5.0`, `0x10`
3354
- * and `1e2` do not read at all. Such an environment value is skipped to the
3355
- * next source; such a file value answers `None`. A YAML number is read as
3356
- * decoded, so an unquoted `5.0` or `1e2` in a file reads as 5 or 100 where
3357
- * pnpm 12 refuses the file.
3358
- */
3359
- get minimumReleaseAge(): Option.Option<number>;
3360
- /**
3361
- * `minimumReleaseAgeExclude`: the package patterns exempt from
3362
- * {@link PnpmSettings.minimumReleaseAge}, empty when no source sets them.
3363
- *
3364
- * @remarks
3365
- * An explicitly empty list in a higher source shadows a lower source's
3366
- * entries, as in pnpm.
3367
- */
3368
- get minimumReleaseAgeExclude(): ReadonlyArray<string>;
3369
- /**
3370
- * The typed read every accessor shares: an environment value that does not
3371
- * parse falls through; the first file that sets the key decides.
3372
- */
3373
- private read;
3374
- /**
3375
- * Merges pnpm's settings sources, with no IO.
3376
- *
3377
- * @remarks
3378
- * Parses each YAML file, keeps the environment's `pnpm_config_*` and
3379
- * `PNPM_CONFIG_*` variables, and records the named files in
3380
- * `PnpmSettings.files`. Fails `"parse"` for a file that is not YAML
3381
- * and `"shape"` for one whose document is not a mapping.
3382
- *
3383
- * @param sources - The workspace file, the global file and the environment.
3384
- */
3385
- static fromSourcesResult(sources: PnpmSettingsSources): Result.Result<PnpmSettings, PnpmSettingsError>;
3386
- /**
3387
- * Loads the settings pnpm would use when run in `options.cwd`.
3388
- *
3389
- * @remarks
3390
- * The workspace file is found as pnpm finds it. When a
3391
- * `PNPM_CONFIG_WORKSPACE_DIR` / `NPM_CONFIG_WORKSPACE_DIR` variable names a
3392
- * directory (resolved against `cwd`), its `pnpm-workspace.yaml` is the
3393
- * file, unconditionally. Otherwise `cwd` is resolved through
3394
- * `FileSystem.realPath` (the lexical path when that fails, as in pnpm), and
3395
- * the nearest `pnpm-workspace.yaml` at or above it is taken. A misnamed
3396
- * manifest (`pnpm-workspace.yml`, `.pnpm-workspace.yaml`) is not a
3397
- * workspace manifest and the ascent passes it, as pnpm 12 does; pnpm 11
3398
- * refuses to run below one. That workspace applies only when `cwd` belongs
3399
- * to it: `cwd`
3400
- * is its root, `cwd` holds no project manifest (`package.json`,
3401
- * `package.json5` or `package.yaml`), or `cwd` matches the manifest's
3402
- * `packages:` patterns. A manifest with no `packages:` key has the root as
3403
- * its only member, so a nested project with its own `package.json` (an
3404
- * example app, a fixture) reads no workspace file, exactly as pnpm skips
3405
- * it. A directory under `node_modules` or `bower_components` is never a
3406
- * member.
3407
- *
3408
- * The global file is `config.yaml` in pnpm's global config directory:
3409
- * {@link PnpmSettingsLoadOptions.globalConfigDir}, else
3410
- * `$XDG_CONFIG_HOME/pnpm`, else the platform default (see
3411
- * {@link PnpmSettingsLoadOptions.platform}). A file that does not exist is
3412
- * skipped; one that cannot be read fails `"read"` (so does a project
3413
- * manifest probe that fails other than not-found), and one that does not
3414
- * parse fails as {@link PnpmSettings.fromSourcesResult} does.
3415
- *
3416
- * @param options - See {@link PnpmSettingsLoadOptions}.
3417
- */
3418
- static readonly load: (options: PnpmSettingsLoadOptions) => Effect.Effect<PnpmSettings, PnpmSettingsError, FileSystem.FileSystem | Path.Path>;
3419
- }
3420
3097
  declare const PublishTarget_base: Schema.Class<PublishTarget, Schema.Struct<{
3421
3098
  /** The package name being published. */
3422
3099
  readonly name: Schema.NonEmptyString;
@@ -4356,7 +4033,7 @@ interface WorkspaceSnapshotsOptions {
4356
4033
  * @remarks
4357
4034
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
4358
4035
  * `package.json#workspaces`, so a member package that kept the field
4359
- * (common after a yarn migration) must not read as the root. An empty
4036
+ * (common after a migration to pnpm) must not read as the root. An empty
4360
4037
  * list is a **defect** at first use, as it is for `find`.
4361
4038
  *
4362
4039
  * Give it the same value as {@link WorkspaceDiscoveryOptions.markers}
@@ -4806,7 +4483,7 @@ export declare class Workspaces {
4806
4483
  * package ships the layer.
4807
4484
  *
4808
4485
  * **The argv knowledge is not duplicated.** `LocalExec.prefixes(name)` is
4809
- * the one home of the four managers' `exec`/`dlx`/script-runner prefixes;
4486
+ * the one home of the three managers' `exec`/`dlx`/script-runner prefixes;
4810
4487
  * this layer
4811
4488
  * detects *which* manager owns the directory and asks `commands` what that
4812
4489
  * manager's argv looks like. Neither package reimplements the other's
@@ -4820,7 +4497,10 @@ export declare class Workspaces {
4820
4497
  * `LocalExecError` is reserved for **mechanism** failure — a manifest that
4821
4498
  * exists but cannot be read or parsed, which means something is broken
4822
4499
  * rather than absent. That is npm's resolver convention, adopted
4823
- * verbatim.
4500
+ * verbatim. A root run by a manager this package does not launch (an
4501
+ * `UnsupportedPackageManagerError`) fails the same way: the manager is
4502
+ * known, and answering `None` would let a caller run a global tool in its
4503
+ * place.
4824
4504
  *
4825
4505
  * `directory` is the resolved **workspace root**, not the caller's cwd: a
4826
4506
  * project-local launcher has to run where the workspace is. `stopAt` caps
@@ -5315,8 +4995,8 @@ interface GetWorkspacePackagesSyncOptions extends WorkspacesSyncOptions {
5315
4995
  * one decision too: on an npm root (as `detectPackageManagerSync` would
5316
4996
  * report it) `package.json#workspaces` is read the way npm reads it, through
5317
4997
  * `@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`.
4998
+ * `/`, an even `!` run, a backslash as a separator — and on every other root
4999
+ * as one `GlobSet`.
5320
5000
  *
5321
5001
  * The one deliberate difference is what happens at a bound: the Effect surface
5322
5002
  * fails typed (`depthExceeded` / `budgetExceeded`), while this one truncates.
@@ -5444,7 +5124,9 @@ export declare const detectPackageManagerSync: (root: string, options: Workspace
5444
5124
  * - a detection refusal (`PackageManagerDetectionError`) is also
5445
5125
  * `Option.none()`: no identifiable launcher is not a failure;
5446
5126
  * - a root manifest that cannot be read or parsed is a mechanism failure, the
5447
- * `Result`'s `LocalExecError` with the `WorkspaceManifestError` as its cause.
5127
+ * `Result`'s `LocalExecError` with the `WorkspaceManifestError` as its cause;
5128
+ * - a root run by a manager the kit does not launch fails the same way, with
5129
+ * the `UnsupportedPackageManagerError` as the cause.
5448
5130
  *
5449
5131
  * The argv prefixes come from `LocalExec.prefixes` — the one home of that
5450
5132
  * knowledge — so nothing here re-derives `pnpm exec` or `npx --no --`.
@@ -5468,5 +5150,5 @@ export declare const detectPackageManagerSync: (root: string, options: Workspace
5468
5150
  * @public
5469
5151
  */
5470
5152
  export declare const localExecContextSync: (cwd: string, options: FindWorkspaceRootSyncOptions) => Result.Result<Option.Option<ExecContext>, LocalExecError>;
5471
- export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PeerDependencyRules, PnpmSettingOrigin, PnpmSettingsLoadOptions, PnpmSettingsSource, PnpmSettingsSources, PublishabilityDetectorShape, SyncDirectoryEntry, SyncFileSystem, SyncPath, TagClassification, TagFormatOptions, TrackingTagOptions, UnverifiedReason, VersioningDetectOptions, WorkspaceCatalogsOptions, WorkspaceCatalogsShape, WorkspaceDiscoveryFailure, WorkspaceDiscoveryOptions, WorkspaceDiscoveryShape, WorkspaceDiscoverySkip, WorkspaceDiscoverySkipKind, WorkspaceLookupFailure, WorkspaceRootShape, WorkspaceSnapshotAtFailure, WorkspaceSnapshotWorktreeFailure, WorkspaceSnapshotsOptions, WorkspaceSnapshotsShape, WorkspacesGitOptions, WorkspacesOptions, WorkspacesServices, WorkspacesSyncOptions };
5153
+ export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PublishabilityDetectorShape, SyncDirectoryEntry, SyncFileSystem, SyncPath, TagClassification, TagFormatOptions, TrackingTagOptions, UnverifiedReason, VersioningDetectOptions, WorkspaceCatalogsOptions, WorkspaceCatalogsShape, WorkspaceDiscoveryFailure, WorkspaceDiscoveryOptions, WorkspaceDiscoveryShape, WorkspaceDiscoverySkip, WorkspaceDiscoverySkipKind, WorkspaceLookupFailure, WorkspaceRootShape, WorkspaceSnapshotAtFailure, WorkspaceSnapshotWorktreeFailure, WorkspaceSnapshotsOptions, WorkspaceSnapshotsShape, WorkspacesGitOptions, WorkspacesOptions, WorkspacesServices, WorkspacesSyncOptions };
5472
5154
  //# sourceMappingURL=index.d.ts.map