rman 2.11.2 → 2.11.3

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.
@@ -136,10 +136,12 @@ export declare namespace PublishService {
136
136
  * landed on the registry first, and publishing is rare enough (once per release) that the
137
137
  * simplicity is worth more than the parallelism `run` gets from `power-tasks`.
138
138
  *
139
- * If a package fails, every other still-pending entry depending on it (transitively) is marked
140
- * `'error'` too and never attempted - publishing a package whose own new dependency range points
141
- * at a version that never actually reached the registry would hand consumers a broken install.
142
- * A package's own failure doesn't stop unrelated packages elsewhere in the plan, though.
139
+ * If a package fails, every other still-pending entry that **a consumer's install needs it for**
140
+ * (transitively) is marked `'error'` too and never attempted - publishing a package whose own new
141
+ * dependency range points at a version that never actually reached the registry would hand
142
+ * consumers a broken install. A package's own failure doesn't stop unrelated packages elsewhere in
143
+ * the plan, though, nor one that lists it only where an install does not need it (see
144
+ * `consumerNeeds`).
143
145
  */
144
146
  function applyPlan(repository: Repository, plan: Entry[], options?: ApplyOptions): Promise<Entry[]>;
145
147
  }
@@ -259,10 +259,12 @@ export var PublishService;
259
259
  * landed on the registry first, and publishing is rare enough (once per release) that the
260
260
  * simplicity is worth more than the parallelism `run` gets from `power-tasks`.
261
261
  *
262
- * If a package fails, every other still-pending entry depending on it (transitively) is marked
263
- * `'error'` too and never attempted - publishing a package whose own new dependency range points
264
- * at a version that never actually reached the registry would hand consumers a broken install.
265
- * A package's own failure doesn't stop unrelated packages elsewhere in the plan, though.
262
+ * If a package fails, every other still-pending entry that **a consumer's install needs it for**
263
+ * (transitively) is marked `'error'` too and never attempted - publishing a package whose own new
264
+ * dependency range points at a version that never actually reached the registry would hand
265
+ * consumers a broken install. A package's own failure doesn't stop unrelated packages elsewhere in
266
+ * the plan, though, nor one that lists it only where an install does not need it (see
267
+ * `consumerNeeds`).
266
268
  */
267
269
  async function applyPlan(repository, plan, options = {}) {
268
270
  const packageManager = CiService.resolvePackageManager(repository, options.packageManager);
@@ -279,7 +281,7 @@ export var PublishService;
279
281
  continue;
280
282
  }
281
283
  const pkg = entry.package;
282
- const blocker = pkg.dependencies.find(d => failed.has(d.name));
284
+ const blocker = pkg.dependencies.find(d => failed.has(d.name) && consumerNeeds(pkg, d.name));
283
285
  if (blocker) {
284
286
  failed.add(pkg.name);
285
287
  result.push({ ...entry, status: 'error', reason: `dependency "${blocker.name}" failed to publish` });
@@ -343,6 +345,24 @@ function resolvePublishDir(pkg, contentsOverride) {
343
345
  function privateBySource(pkg) {
344
346
  return !!pkg.manifest.raw.private && !pkg.manifest.raw.publishConfig;
345
347
  }
348
+ /** Whether a consumer installing `pkg` needs `name` to resolve: a `dependencies` entry, or a peer
349
+ * not marked optional. */
350
+ /* **Not every edge blocks a publish**, and blocking on all of them cost a release. A failed publish
351
+ * stops its dependents because their published range would point at a version that is not there -
352
+ * which is only true of what reaches the consumer:
353
+ * - `devDependencies` are removed from the published manifest (`derivePublishManifest`);
354
+ * - an optional peer that cannot be satisfied does not fail an install;
355
+ * - `optionalDependencies` are the ones npm proceeds without "if it cannot be found or fails to
356
+ * install" (npm's own documentation; not measured here).
357
+ * Measured on opra's 1.31.0 release: `@opra/api-ui` failed its first publish, and `@opra/http` -
358
+ * which lists it as an optional peer and a devDependency only - was blocked, taking elastic, mongodb
359
+ * and sqb with it, though none of their installs would have needed api-ui. */
360
+ function consumerNeeds(pkg, name) {
361
+ const raw = pkg.manifest.raw;
362
+ if (raw.dependencies?.[name] !== undefined)
363
+ return true;
364
+ return raw.peerDependencies?.[name] !== undefined && !raw.peerDependenciesMeta?.[name]?.optional;
365
+ }
346
366
  /** Whether `pkg` is published from its own directory, whose `package.json` is then the manifest. */
347
367
  /* In place, `private` is the source's whatever `publishConfig` says - npm refuses to publish it. */
348
368
  function publishesInPlace(pkg, contentsOverride) {
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.11.2';
1
+ export const version = '2.11.3';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.11.2",
4
+ "version": "2.11.3",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {