@effected/workspaces 0.47.1 → 0.48.1

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.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import { ChangeDetectionError, ChangeDetectionOptions, ChangeDetector } from "./ChangeDetector.js";
2
- import { ConfigDependencyHooks, NoPeerDependencyRules } from "./ConfigDependencyHooks.js";
2
+ import { ConfigDependencyHooks } from "./ConfigDependencyHooks.js";
3
3
  import { ConfigDependencySpec, InvalidConfigDependencySpecError } from "./ConfigDependencySpec.js";
4
4
  import { CyclicDependencyError, DependencyGraph } from "./DependencyGraph.js";
5
5
  import { Dependent, DuplicateCheck, DuplicateInstance, DuplicatedPackage, DuplicatedVersion } from "./DuplicateCheck.js";
6
6
  import { LockfileReadError, LockfileReader } from "./LockfileReader.js";
7
- import { DetectedPackageManager, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName } from "./PackageManagerName.js";
7
+ import { DetectedPackageManager, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName, UnsupportedPackageManagerError } from "./PackageManagerName.js";
8
8
  import { PeerCheck, PeerParent, UnsatisfiedPeer } from "./PeerCheck.js";
9
- import { PnpmSettings, PnpmSettingsError } from "./PnpmSettings.js";
10
9
  import { PublishTarget, PublishabilityDetector } from "./Publishability.js";
11
10
  import { ReleaseTag, TagStyle, TrackingTag, classifyTag } from "./ReleaseTag.js";
12
11
  import { VersioningStrategy, VersioningStrategyType } from "./VersioningStrategy.js";
@@ -20,4 +19,4 @@ import { PackageStateSnapshot, WorkspaceStateSnapshot } from "./WorkspaceStateSn
20
19
  import { Workspaces } from "./Workspaces.js";
21
20
  import { detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync } from "./WorkspacesSync.js";
22
21
 
23
- export { CatalogSet, ChangeDetectionError, ChangeDetectionOptions, ChangeDetector, ConfigDependencyHooks, ConfigDependencySpec, CyclicDependencyError, DependencyGraph, Dependent, DetectedPackageManager, DuplicateCheck, DuplicateInstance, DuplicatedPackage, DuplicatedVersion, InvalidConfigDependencySpecError, LockfileReadError, LockfileReader, NoPeerDependencyRules, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName, PackageNotFoundError, PackageStateSnapshot, PeerCheck, PeerParent, PnpmSettings, PnpmSettingsError, PublishConfig, PublishTarget, PublishabilityDetector, ReleaseTag, TagStyle, TrackingTag, UnsatisfiedPeer, VersioningStrategy, VersioningStrategyType, WORKSPACE_MARKERS, WorkspaceCatalogs, WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspaceInfo, WorkspaceManifestError, WorkspaceMarker, WorkspacePackage, WorkspacePatternError, WorkspaceRoot, WorkspaceRootMatch, WorkspaceRootNotFoundError, WorkspaceSnapshots, WorkspaceStateSnapshot, Workspaces, classifyTag, detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync };
22
+ export { CatalogSet, ChangeDetectionError, ChangeDetectionOptions, ChangeDetector, ConfigDependencyHooks, ConfigDependencySpec, CyclicDependencyError, DependencyGraph, Dependent, DetectedPackageManager, DuplicateCheck, DuplicateInstance, DuplicatedPackage, DuplicatedVersion, InvalidConfigDependencySpecError, LockfileReadError, LockfileReader, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName, PackageNotFoundError, PackageStateSnapshot, PeerCheck, PeerParent, PublishConfig, PublishTarget, PublishabilityDetector, ReleaseTag, TagStyle, TrackingTag, UnsatisfiedPeer, UnsupportedPackageManagerError, VersioningStrategy, VersioningStrategyType, WORKSPACE_MARKERS, WorkspaceCatalogs, WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspaceInfo, WorkspaceManifestError, WorkspaceMarker, WorkspacePackage, WorkspacePatternError, WorkspaceRoot, WorkspaceRootMatch, WorkspaceRootNotFoundError, WorkspaceSnapshots, WorkspaceStateSnapshot, Workspaces, classifyTag, detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync };
@@ -1,24 +1,46 @@
1
- import { getCatalogsFromWorkspaceManifest, mergeCatalogs } from "@pnpm/catalogs.config";
2
- import { parseCatalogProtocol } from "@pnpm/catalogs.protocol-parser";
3
- import { matchCatalogResolveResult, resolveFromCatalog } from "@pnpm/catalogs.resolver";
4
-
5
1
  // src/internal/catalogs.ts
6
- /** Project a pnpm-workspace manifest's `catalog` / `catalogs` fields into a `Catalogs` map. */
2
+ /** The name pnpm gives the unnamed top-level catalog. */
3
+ const DEFAULT_CATALOG_NAME = "default";
4
+ const CATALOG_PROTOCOL = "catalog:";
5
+ /**
6
+ * Project a pnpm-workspace manifest's `catalog` / `catalogs` fields into one
7
+ * `Catalogs` map, the top-level `catalog` under `"default"`.
8
+ *
9
+ * pnpm refuses a manifest that defines the default catalog twice (a top-level
10
+ * `catalog` and a `catalogs.default`). That is a malformed workspace file, a
11
+ * data condition, so it yields the empty map rather than a defect.
12
+ */
7
13
  const inlineCatalogs = (manifest) => {
8
- if (manifest.catalog === void 0 && manifest.catalogs === void 0) return {};
9
- try {
10
- return getCatalogsFromWorkspaceManifest({
11
- catalog: manifest.catalog,
12
- catalogs: manifest.catalogs
13
- });
14
- } catch {
15
- return {};
14
+ const { catalog, catalogs: named } = manifest;
15
+ if (catalog != null && named != null && Object.hasOwn(named, DEFAULT_CATALOG_NAME)) return {};
16
+ const catalogs = {};
17
+ if (catalog != null) define(catalogs, DEFAULT_CATALOG_NAME, catalog);
18
+ if (named != null) for (const [name, entries] of Object.entries(named)) define(catalogs, name, entries);
19
+ return catalogs;
20
+ };
21
+ /**
22
+ * Merge catalog sources; later sources win per dependency within a catalog.
23
+ * Keys are copied as own data properties, so a `__proto__` name is inert.
24
+ */
25
+ const merge = (...sources) => {
26
+ const result = {};
27
+ for (const source of sources) {
28
+ if (source == null) continue;
29
+ for (const [name, catalog] of Object.entries(source)) {
30
+ if (catalog == null) continue;
31
+ const target = Object.hasOwn(result, name) ? result[name] ?? {} : {};
32
+ for (const [dependency, specifier] of Object.entries(catalog)) define(target, dependency, specifier);
33
+ define(result, name, target);
34
+ }
16
35
  }
36
+ return result;
17
37
  };
18
- /** Merge catalog sources; later sources win per dependency within a catalog. */
19
- const merge = (...sources) => mergeCatalogs(...sources);
20
38
  /** Whether `specifier` is a `catalog:` protocol reference, and which catalog it names. */
21
- const catalogNameOf = (specifier) => parseCatalogProtocol(specifier);
39
+ const catalogNameOf = (specifier) => {
40
+ if (!specifier.startsWith(CATALOG_PROTOCOL)) return null;
41
+ const name = specifier.slice(8).trim();
42
+ return name === "" ? DEFAULT_CATALOG_NAME : name;
43
+ };
22
44
  /** Normalize the arbitrary shape of a catalog map into `CatalogEntries`, dropping anything unusable. */
23
45
  const normalize = (raw) => {
24
46
  if (raw === null || typeof raw !== "object") return {};
@@ -47,24 +69,25 @@ const define = (target, key, value) => {
47
69
  /**
48
70
  * Resolve one `catalog:` specifier against an assembled catalog set.
49
71
  *
50
- * Returns the range on a hit, `undefined` on a miss (the specifier names no
51
- * catalog entry — an ordinary `Option.none()` to the caller), and a
52
- * `CatalogMisconfiguration` when pnpm reports the catalog itself is malformed.
72
+ * Returns the entry as written on a hit, `undefined` for a specifier that is
73
+ * not a `catalog:` reference, and a `CatalogMisconfiguration` when pnpm would
74
+ * report the reference misconfigured: no entry for the dependency in the named
75
+ * catalog, or an entry that is itself a `catalog:` reference.
53
76
  */
54
77
  const rangeOf = (catalogs, dependency, specifier) => {
55
- if (catalogNameOf(specifier) === null) return void 0;
56
- const result = resolveFromCatalog(catalogs, {
57
- alias: dependency,
58
- bareSpecifier: specifier
59
- });
60
- return matchCatalogResolveResult(result, {
61
- found: (hit) => hit.resolution.specifier,
62
- misconfiguration: (bad) => ({
63
- catalogName: bad.catalogName,
64
- detail: bad.error.message
65
- }),
66
- unused: () => void 0
67
- });
78
+ const catalogName = catalogNameOf(specifier);
79
+ if (catalogName === null) return void 0;
80
+ const catalog = Object.hasOwn(catalogs, catalogName) ? catalogs[catalogName] : void 0;
81
+ const entry = catalog !== void 0 && Object.hasOwn(catalog, dependency) ? catalog[dependency] : void 0;
82
+ if (entry === void 0) return {
83
+ catalogName,
84
+ detail: `No catalog entry '${dependency}' was found for catalog '${catalogName}'.`
85
+ };
86
+ if (catalogNameOf(entry) !== null) return {
87
+ catalogName,
88
+ detail: `Found invalid catalog entry using the catalog protocol recursively. The entry for '${dependency}' in catalog '${catalogName}' is invalid.`
89
+ };
90
+ return entry;
68
91
  };
69
92
 
70
93
  export { catalogNameOf, inlineCatalogs, merge, normalize, rangeOf };
@@ -73,7 +73,7 @@ const importerVersionsOf = (lockfile) => {
73
73
  const unanimousVersionOf = (index, dependency) => {
74
74
  let agreed;
75
75
  for (const versions of Object.values(index)) {
76
- const version = versions[dependency];
76
+ const version = Object.hasOwn(versions, dependency) ? versions[dependency] : void 0;
77
77
  if (version === void 0) continue;
78
78
  if (agreed === void 0) {
79
79
  agreed = version;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  const MAX_ENUMERATION_ENTRIES = 1e5;
10
10
  /**
11
- * Directory names never descended into. pnpm, npm, yarn and bun all ignore
11
+ * Directory names never descended into. Every package manager ignores
12
12
  * `node_modules` when expanding workspace globs; without the prune a
13
13
  * `packages/**` in an installed repo would walk the entire store.
14
14
  *
@@ -16,7 +16,8 @@ const GLOB_RULES = { _tag: "glob" };
16
16
  */
17
17
  const rulesFor = (manifest, has) => {
18
18
  if (Option.isNone(manifest)) return GLOB_RULES;
19
- return decidePackageManager(manifest, has)?.name === "npm" ? {
19
+ const decision = decidePackageManager(manifest, has);
20
+ return decision?._tag === "Supported" && decision.name === "npm" ? {
20
21
  _tag: "npm",
21
22
  field: manifest.value.workspaces
22
23
  } : GLOB_RULES;
@@ -91,6 +91,7 @@ const decidePackageManager = (manifest, has) => {
91
91
  corepack: Option.flatMap(manifest, corepackHint)
92
92
  };
93
93
  const make = (name, evidence) => ({
94
+ _tag: "Supported",
94
95
  name,
95
96
  version: versionFor(hints, name),
96
97
  runtime: name === "bun" ? "bun" : "node",
@@ -99,17 +100,27 @@ const decidePackageManager = (manifest, has) => {
99
100
  if (has("pnpm-workspace.yaml")) return make("pnpm", "pnpm-workspace.yaml");
100
101
  const bunLock = has("bun.lock") ? "bun.lock" : has("bun.lockb") ? "bun.lockb" : void 0;
101
102
  if (bunLock !== void 0 && namesManager(hints, "bun")) return make("bun", bunLock);
102
- if (has("yarn.lock") && namesManager(hints, "yarn")) return make("yarn", "yarn.lock");
103
+ const declaresYarn = namesManager(hints, "yarn");
104
+ const otherLockfile = bunLock !== void 0 || has("pnpm-lock.yaml") || has("package-lock.json");
105
+ if (has("yarn.lock") && (declaresYarn || Option.isNone(declaredName(hints)) && !otherLockfile)) return {
106
+ _tag: "Unsupported",
107
+ manager: "yarn",
108
+ evidence: "yarn.lock"
109
+ };
110
+ if (declaresYarn) return {
111
+ _tag: "Unsupported",
112
+ manager: "yarn",
113
+ evidence: Option.isSome(hints.devEngines) ? "package.json#devEngines.packageManager" : "package.json#packageManager"
114
+ };
103
115
  const workspaces = Option.map(manifest, (fields) => fields.workspaces);
104
116
  if (Option.isSome(workspaces) && workspaces.value !== void 0 && workspaces.value !== null) return make("npm", "package.json#workspaces");
105
117
  if (has("pnpm-lock.yaml")) return make("pnpm", "pnpm-lock.yaml");
106
118
  if (bunLock !== void 0 && namesManager(hints, "bun")) return make("bun", bunLock);
107
- if (has("yarn.lock") && namesManager(hints, "yarn")) return make("yarn", "yarn.lock");
108
119
  if (has("package-lock.json")) return make("npm", "package-lock.json");
109
120
  const declared = declaredName(hints);
110
121
  if (Option.isSome(declared)) {
111
122
  const name = declared.value;
112
- if (name === "pnpm" || name === "npm" || name === "yarn" || name === "bun") return make(name, Option.isSome(hints.devEngines) ? "package.json#devEngines.packageManager" : "package.json#packageManager");
123
+ if (name === "pnpm" || name === "npm" || name === "bun") return make(name, Option.isSome(hints.devEngines) ? "package.json#devEngines.packageManager" : "package.json#packageManager");
113
124
  }
114
125
  };
115
126
 
@@ -12,16 +12,14 @@ const TRAPS = /* @__PURE__ */ new Set([
12
12
  "PNPM_SCRIPT_SRC_DIR",
13
13
  "PNPM_PACKAGE_NAME"
14
14
  ]);
15
- /** Prefixes of whole families of parent-run context: npm's, pnpm's config, and Yarn's. */
16
- const TRAP_PREFIXES = /^(npm_|pnpm_config_|yarn_)/i;
15
+ /** Prefixes of whole families of parent-run context: npm's and pnpm's config. */
16
+ const TRAP_PREFIXES = /^(npm_|pnpm_config_)/i;
17
17
  /**
18
18
  * `env` without undefined values and without the parent's context: every
19
19
  * `npm_*` variable (a pnpm-run vitest leaks `npm_config_user_agent`), every
20
20
  * `pnpm_config_*` variable plus `PNPM_SCRIPT_SRC_DIR` and `PNPM_PACKAGE_NAME`
21
21
  * (a `pnpm exec` child carries all three, `pnpm_config_verify_deps_before_run`
22
- * among them), every `YARN_*` variable (Berry lets them override
23
- * `.yarnrc.yml`, so `YARN_NODE_LINKER=pnp` would defeat the consumer's
24
- * `nodeLinker`), `CI` (Yarn Berry turns on immutable installs), `INIT_CWD`,
22
+ * among them), `CI` (pnpm turns on a frozen lockfile), `INIT_CWD`,
25
23
  * `NODE_V8_COVERAGE` (a spawned manager writes coverage files that race
26
24
  * vitest's V8 provider), and `NODE_OPTIONS` (a workspace's `nodeOptions`, such
27
25
  * as `--import=tsx`, is injected into every script a manager runs; the scratch
@@ -35,12 +33,11 @@ const TRAP_PREFIXES = /^(npm_|pnpm_config_|yarn_)/i;
35
33
  * Stripping `CI` does not make the child believe it runs locally: ci-info
36
34
  * also reads provider variables such as `GITHUB_ACTIONS`, which stay. That is
37
35
  * harmless today, because the only CI-conditional behaviour a consumer
38
- * install trips on (Berry's immutable installs, pnpm's frozen lockfile) keys
39
- * on a lockfile the fresh consumer does not have, or is switched off in the
40
- * files `consumerFiles` writes.
36
+ * install trips on (pnpm's frozen lockfile) keys on a lockfile the fresh
37
+ * consumer does not have.
41
38
  *
42
39
  * User-level configuration is inherited by design: `HOME` stays, so each
43
- * manager still reads the user's `~/.npmrc`, `~/.yarnrc.yml` and friends, and
40
+ * manager still reads the user's `~/.npmrc` and friends, and
44
41
  * with them the registry, auth and proxy a real install on this machine
45
42
  * would use.
46
43
  */
@@ -82,16 +79,6 @@ const closureOf = (packages, carrier, closure) => {
82
79
  }
83
80
  return Result.succeed(ordered);
84
81
  };
85
- const major = (version) => Number.parseInt(version.split(".")[0] ?? "", 10);
86
- const minor = (version) => Number.parseInt(version.split(".")[1] ?? "", 10);
87
- const YARNRC = "nodeLinker: node-modules\nenableImmutableInstalls: false\nenableScripts: false\nenableTelemetry: false\n";
88
- /**
89
- * Berry's release-age gate, off: the consumer installs packages its caller
90
- * has just released, so the gate only ever quarantines them. 4.10 introduced
91
- * the setting, and Berry fails every command on a setting it does not know.
92
- */
93
- const YARNRC_AGE_GATE = "npmMinimalAgeGate: 0\n";
94
- const yarnrc = (version) => major(version) > 4 || major(version) === 4 && minor(version) >= 10 ? `${YARNRC}${YARNRC_AGE_GATE}` : YARNRC;
95
82
  /**
96
83
  * JSON strings are valid YAML double-quoted scalars. `minimumReleaseAge: 0`
97
84
  * switches off pnpm's release-age gate, on by default in pnpm 11 and 12 and
@@ -106,7 +93,7 @@ const pnpmWorkspaceYaml = (specs) => {
106
93
  * The files of one scratch consumer. The carrier and the caller's extra
107
94
  * dependencies are its only direct dependencies; every other packed package
108
95
  * is steered to its tarball through the field this manager reads:
109
- * `overrides` (npm, bun), `resolutions` (yarn), or a settings-only
96
+ * `overrides` (npm, bun) or a settings-only
110
97
  * `pnpm-workspace.yaml` (pnpm 10+ reads overrides there, and pnpm 11+ no
111
98
  * longer reads `package.json#pnpm`).
112
99
  *
@@ -134,8 +121,7 @@ const consumerFiles = (input) => {
134
121
  [input.carrier.name]: carrierSpec,
135
122
  ...extra
136
123
  },
137
- ...input.manager === "npm" || input.manager === "bun" ? { overrides: specs } : {},
138
- ...input.manager === "yarn" ? { resolutions: specs } : {}
124
+ ...input.manager === "npm" || input.manager === "bun" ? { overrides: specs } : {}
139
125
  };
140
126
  const files = [{
141
127
  file: "package.json",
@@ -145,14 +131,10 @@ const consumerFiles = (input) => {
145
131
  file: "pnpm-workspace.yaml",
146
132
  content: pnpmWorkspaceYaml(specs)
147
133
  });
148
- if (input.manager === "yarn" && major(input.version) >= 2) files.push({
149
- file: ".yarnrc.yml",
150
- content: yarnrc(input.version)
151
- });
152
134
  return files;
153
135
  };
154
136
  /** The install argv, lifecycle scripts skipped the way this manager spells it. */
155
- const installArgs = (manager, version) => {
137
+ const installArgs = (manager) => {
156
138
  switch (manager) {
157
139
  case "npm": return [
158
140
  "install",
@@ -161,11 +143,6 @@ const installArgs = (manager, version) => {
161
143
  "--no-fund"
162
144
  ];
163
145
  case "pnpm": return ["install", "--config.ignore-scripts=true"];
164
- case "yarn": return major(version) >= 2 ? ["install"] : [
165
- "install",
166
- "--ignore-scripts",
167
- "--non-interactive"
168
- ];
169
146
  case "bun": return ["install", "--ignore-scripts"];
170
147
  }
171
148
  };
@@ -208,7 +185,7 @@ const binTargetOf = (manifestJson, name) => {
208
185
  };
209
186
  /**
210
187
  * The first bin the carrier declares that another packed package declares
211
- * too. Under a flat layout (npm, bun, Yarn's `node-modules` linker) either
188
+ * too. Under a flat layout (npm, bun) either
212
189
  * package can take `node_modules/.bin/<bin>`, so a bin check or a bin run
213
190
  * could pass on the wrong package. `PackedInstall.run` refuses it unless the
214
191
  * caller shares bin names deliberately (`allowSharedBins`).
@@ -1,6 +1,6 @@
1
- import { NoPeerDependencyRules } from "../ConfigDependencyHooks.js";
2
1
  import { stringsOf } from "./patterns.js";
3
2
  import { Predicate } from "effect";
3
+ import { PeerDependencyRules } from "@effected/pnpm";
4
4
 
5
5
  // src/internal/workspaceYaml.ts
6
6
  /** The `configDependencies` map (name → version+integrity) of a parsed pnpm-workspace document. */
@@ -27,17 +27,17 @@ const configDependenciesOf = (document) => {
27
27
  * discard a well-formed `allowedVersions`.
28
28
  */
29
29
  const inlinePeerDependencyRules = (document) => {
30
- if (!Predicate.isObject(document) || !Predicate.isObject(document.peerDependencyRules)) return NoPeerDependencyRules;
30
+ if (!Predicate.isObject(document) || !Predicate.isObject(document.peerDependencyRules)) return PeerDependencyRules.empty;
31
31
  const block = document.peerDependencyRules;
32
32
  const allowedVersions = {};
33
33
  if (Predicate.isObject(block.allowedVersions)) {
34
34
  for (const [key, value] of Object.entries(block.allowedVersions)) if (typeof value === "string") allowedVersions[key] = value;
35
35
  }
36
- return {
36
+ return PeerDependencyRules.make({
37
37
  allowedVersions,
38
38
  ignoreMissing: stringsOf(block.ignoreMissing) ?? [],
39
39
  allowAny: stringsOf(block.allowAny) ?? []
40
- };
40
+ });
41
41
  };
42
42
 
43
43
  export { configDependenciesOf, inlinePeerDependencyRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/workspaces",
3
- "version": "0.47.1",
3
+ "version": "0.48.1",
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": [
@@ -51,20 +51,18 @@
51
51
  "./package.json": "./package.json"
52
52
  },
53
53
  "dependencies": {
54
- "@effected/commands": "^0.21.0",
54
+ "@effected/bun": "^0.1.0",
55
+ "@effected/commands": "^0.22.0",
55
56
  "@effected/git": "^0.32.0",
56
- "@effected/glob": "^0.22.0",
57
+ "@effected/glob": "^0.23.0",
57
58
  "@effected/jsonc": "^0.25.0",
58
- "@effected/lockfiles": "^0.25.0",
59
- "@effected/npm": "^0.34.1",
60
- "@effected/package-json": "^0.32.1",
59
+ "@effected/lockfiles": "^0.27.0",
60
+ "@effected/npm": "^0.35.1",
61
+ "@effected/package-json": "^0.32.2",
62
+ "@effected/pnpm": "^0.1.1",
61
63
  "@effected/semver": "^0.24.0",
62
- "@effected/walker": "^0.29.0",
63
- "@effected/yaml": "^0.30.0",
64
- "@pnpm/catalogs.config": "^1100.0.5",
65
- "@pnpm/catalogs.protocol-parser": "^1100.0.0",
66
- "@pnpm/catalogs.resolver": "^1100.0.0",
67
- "@pnpm/catalogs.types": "^1100.0.0"
64
+ "@effected/walker": "^0.30.0",
65
+ "@effected/yaml": "^0.30.0"
68
66
  },
69
67
  "peerDependencies": {
70
68
  "effect": "~4.1.0"
package/testing.d.ts CHANGED
@@ -65,6 +65,12 @@ declare const PublishConfig_base: Schema.Class<PublishConfig, Schema.Struct<{
65
65
  readonly linkDirectory: Schema.optionalKey<Schema.Boolean>;
66
66
  /** The dist-tag to publish under. */
67
67
  readonly tag: Schema.optionalKey<Schema.String>;
68
+ /**
69
+ * The name the package publishes under when it differs from its manifest
70
+ * `name`. An empty string is no rename, as pnpm's `published_name` reads it,
71
+ * so a reader of the registry name takes `name` only when it is non-empty.
72
+ */
73
+ readonly name: Schema.optionalKey<Schema.String>;
68
74
  }>, {}>;
69
75
  /**
70
76
  * The `publishConfig` fields workspace tooling reads.
@@ -322,7 +328,7 @@ interface FindWorkspaceRootOptions {
322
328
  * @remarks
323
329
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
324
330
  * `package.json#workspaces`, so a member package that kept the field (common
325
- * after a yarn migration) must not read as the root. An empty list is a
331
+ * after a migration to pnpm) must not read as the root. An empty list is a
326
332
  * **defect**, like a bad `maxDepth`.
327
333
  *
328
334
  * @defaultValue every marker, `WORKSPACE_MARKERS`
@@ -673,7 +679,7 @@ interface WorkspaceDiscoveryOptions {
673
679
  * @remarks
674
680
  * Pass `["pnpm-workspace.yaml"]` for a pnpm-only tool: pnpm ignores
675
681
  * `package.json#workspaces`, so a member package that kept the field
676
- * (common after a yarn migration) must not read as the root. An empty
682
+ * (common after a migration to pnpm) must not read as the root. An empty
677
683
  * list is a **defect** at first use, as it is for `find`.
678
684
  *
679
685
  * Unlike `stopAt`, it applies to the per-call `infoIn`, `listPackagesIn`
@@ -1308,13 +1314,18 @@ export declare class LayerPolicy extends LayerPolicy_base {
1308
1314
  } | undefined) => Effect.Effect<LayerPolicy, LayerPolicyError, FileSystem.FileSystem>;
1309
1315
  }
1310
1316
  /**
1311
- * The four package managers this package understands.
1317
+ * The package managers this package acts on: npm, pnpm and bun.
1318
+ *
1319
+ * @remarks
1320
+ * A repository run by any other manager still discovers — its members come
1321
+ * from `package.json#workspaces` — but detection reports it as an
1322
+ * `UnsupportedPackageManagerError` rather than naming one of these.
1312
1323
  *
1313
1324
  * @public
1314
1325
  */
1315
- export declare const PackageManagerName: Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>;
1326
+ export declare const PackageManagerName: Schema.Literals<readonly ["npm", "pnpm", "bun"]>;
1316
1327
  /**
1317
- * The decoded type of {@link (PackageManagerName:variable)}: `"npm" | "pnpm" | "yarn" | "bun"`.
1328
+ * The decoded type of {@link (PackageManagerName:variable)}: `"npm" | "pnpm" | "bun"`.
1318
1329
  *
1319
1330
  * @public
1320
1331
  */
@@ -1375,7 +1386,7 @@ interface PackedInstallClosureOptions {
1375
1386
  * manifest must be named as its key, carry no specifier only a workspace
1376
1387
  * could resolve, and it joins `PackedInstallResult.tarballs`. Each
1377
1388
  * consumer steers the package to that tarball through the same override
1378
- * field as the closure (npm's and bun's `overrides`, Yarn's `resolutions`,
1389
+ * field as the closure (npm's and bun's `overrides`,
1379
1390
  * pnpm's `overrides` in `pnpm-workspace.yaml`), so the carrier's
1380
1391
  * transitive references resolve to it too, whatever range they ask for.
1381
1392
  *
@@ -1426,8 +1437,8 @@ interface PackedInstallOptions extends PackedInstallClosureOptions {
1426
1437
  * By default only the carrier may declare them. Whatever this lists, a
1427
1438
  * packed package other than the carrier that declares one of the
1428
1439
  * carrier's own bin names fails `BinConflict` before any install, unless
1429
- * `allowSharedBins` is set: under a flat layout (npm, bun,
1430
- * Yarn's `node-modules` linker) either package can take the `.bin` slot,
1440
+ * `allowSharedBins` is set: under a flat layout (npm, bun)
1441
+ * either package can take the `.bin` slot,
1431
1442
  * so the bin check and every bin run could pass on the wrong package.
1432
1443
  *
1433
1444
  * The check compares packed packages only (the carrier, the closure and
@@ -1443,11 +1454,10 @@ interface PackedInstallOptions extends PackedInstallClosureOptions {
1443
1454
  * @remarks
1444
1455
  * A supported, permanent choice for a carrier whose front ends are also
1445
1456
  * installed and run on their own, and a stopgap for one migrating to
1446
- * carrier-only bins. Its cost is provenance: under npm, bun and Yarn's
1447
- * `node-modules` linker, either package can take the `.bin` slot (npm was
1457
+ * carrier-only bins. Its cost is provenance: under npm and bun, either
1458
+ * package can take the `.bin` slot (npm was
1448
1459
  * observed to link the package whose name sorts first, which for a `cli`
1449
- * front end and a `plugin` carrier is the front end; Yarn 1 and 4 were
1450
- * observed to keep the carrier's, the consumer's direct dependency; recent bun
1460
+ * front end and a `plugin` carrier is the front end; recent bun
1451
1461
  * gives the slot to a direct dependency of the consumer, while older
1452
1462
  * releases took the alphabetically first package, so a carrier that is the
1453
1463
  * consumer's one direct dependency keeps it only on recent bun),
@@ -1465,7 +1475,7 @@ interface PackedInstallOptions extends PackedInstallClosureOptions {
1465
1475
  /**
1466
1476
  * The environment for every spawn: pass `process.env` from the test file, the edge that supplies the host
1467
1477
  * environment. It is taken whole because the parent manager's context is stripped by prefix (`npm_*`,
1468
- * `pnpm_config_*`, `yarn_*`), which `Config`, reading keys by name, cannot enumerate; read single keys such as
1478
+ * `pnpm_config_*`), which `Config`, reading keys by name, cannot enumerate; read single keys such as
1469
1479
  * `CI` through `Config`.
1470
1480
  */
1471
1481
  readonly env: Readonly<Record<string, string | undefined>>;
@@ -1509,7 +1519,7 @@ declare const PackedInstallError_base: Schema.Class<PackedInstallError, Schema.T
1509
1519
  */
1510
1520
  readonly message: Schema.String;
1511
1521
  /** The package manager involved. */
1512
- readonly manager: Schema.optionalKey<Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>>;
1522
+ readonly manager: Schema.optionalKey<Schema.Literals<readonly ["npm", "pnpm", "bun"]>>;
1513
1523
  /** The workspace package involved. */
1514
1524
  readonly package: Schema.optionalKey<Schema.String>;
1515
1525
  /** The tail of the failing command's output, both streams, stdout first. */
@@ -1579,7 +1589,7 @@ interface BinProvenance {
1579
1589
  }
1580
1590
  declare const InstalledConsumer_base: Schema.Class<InstalledConsumer, Schema.Struct<{
1581
1591
  /** The package manager that installed it. */
1582
- readonly manager: Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>;
1592
+ readonly manager: Schema.Literals<readonly ["npm", "pnpm", "bun"]>;
1583
1593
  /** The version it reported and was pinned to. */
1584
1594
  readonly managerVersion: Schema.String;
1585
1595
  /** The consumer project directory (realpath'd). */
@@ -1609,8 +1619,7 @@ export declare class InstalledConsumer extends InstalledConsumer_base {
1609
1619
  * Which installed package the `node_modules/.bin` entry `name` resolves into.
1610
1620
  *
1611
1621
  * @remarks
1612
- * Under a flat layout (npm, bun, and Yarn with the `node-modules` linker
1613
- * this run configures), a hoisted bin of the same name from another package
1622
+ * Under a flat layout (npm, bun), a hoisted bin of the same name from another package
1614
1623
  * can shadow the carrier's, and running it cannot tell you which one ran.
1615
1624
  * Those managers write each `.bin` entry as a symlink, so this reads the
1616
1625
  * link, realpaths its target, and walks up to the nearest `package.json`
@@ -1689,8 +1698,7 @@ export declare class InstalledConsumer extends InstalledConsumer_base {
1689
1698
  * won the `node_modules/.bin` slot.
1690
1699
  *
1691
1700
  * @remarks
1692
- * With `allowSharedBins`, a flat layout (npm, bun, Yarn's `node-modules`
1693
- * linker) can link a front end's same-named bin into `.bin`, so
1701
+ * With `allowSharedBins`, a flat layout (npm, bun) can link a front end's same-named bin into `.bin`, so
1694
1702
  * {@link InstalledConsumer.runBin} proves only that SOME package's bin runs.
1695
1703
  * This reads the carrier's installed `node_modules/<carrier>/package.json`,
1696
1704
  * takes `name` from its `bin` map (a `bin` string answers to the unscoped
@@ -1741,7 +1749,7 @@ declare const PackedInstallResult_base: Schema.Class<PackedInstallResult, Schema
1741
1749
  /** One consumer per available manager, in the order requested. */
1742
1750
  readonly consumers: Schema.$Array<typeof InstalledConsumer>;
1743
1751
  /** The requested managers that did not answer `--version`. */
1744
- readonly unavailable: Schema.$Array<Schema.Literals<readonly ["npm", "pnpm", "yarn", "bun"]>>;
1752
+ readonly unavailable: Schema.$Array<Schema.Literals<readonly ["npm", "pnpm", "bun"]>>;
1745
1753
  /** Every packed package: name to absolute tarball path. */
1746
1754
  readonly tarballs: Schema.$Record<Schema.String, Schema.String>;
1747
1755
  /**
@@ -1905,14 +1913,14 @@ export declare class PackedInstall {
1905
1913
  * import { Duration } from "effect";
1906
1914
  *
1907
1915
  * const budget = PackedInstall.timeoutBudget({
1908
- * managers: ["npm", "pnpm", "yarn", "bun"],
1916
+ * managers: ["npm", "pnpm", "bun"],
1909
1917
  * installTimeout: "3 minutes",
1910
1918
  * packTimeout: "30 seconds",
1911
1919
  * packages: ["my-tool", "my-tool-cli", "my-tool-core"],
1912
1920
  * perConsumer: "2 minutes",
1913
1921
  * });
1914
1922
  * console.log(Duration.format(budget));
1915
- * // => 26m 30s
1923
+ * // => 21m
1916
1924
  * ```
1917
1925
  */
1918
1926
  static readonly timeoutBudget: (budget: PackedInstallBudget) => Duration.Duration;