@savvy-web/silk 2.2.0 → 2.2.2

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.
@@ -283,6 +283,32 @@ const ChangesetConfigReaderLive = effect.Layer.effect(ChangesetConfigReader, eff
283
283
  return { read };
284
284
  }));
285
285
  //#endregion
286
+ //#region ../silk-effects/dist/dev/pkg/errors/PublishTargetBindingError.js
287
+ /**
288
+ * Raised when publishability detection selects a directory that the package's
289
+ * `dist/prod/targets.json` binding does not describe.
290
+ *
291
+ * @remarks
292
+ * The bundler's prod build writes `targets.json` naming every byte-group
293
+ * directory it produced. Once that binding exists it is authoritative: the only
294
+ * directories whose bytes may be published are the ones it lists. A detector
295
+ * that returns anything else — most often `publishConfig.directory` pointing at
296
+ * a **dev** build, because silk mode was misdetected — is about to pack an
297
+ * unresolved workspace manifest and ship it to a registry.
298
+ *
299
+ * That is the `yaml-effect@0.7.1` failure: detection picked `dist/dev/pkg`, the
300
+ * dev manifest still carried `catalog:` specifiers, and the published package
301
+ * was uninstallable (`EUNSUPPORTEDPROTOCOL`).
302
+ *
303
+ * @since 3.1.0
304
+ * @public
305
+ */
306
+ var PublishTargetBindingError = class extends effect.Data.TaggedError("PublishTargetBindingError") {
307
+ get message() {
308
+ return `Package ${this.pkg} resolved publish directory "${this.directory}", which is not one of the directories bound by dist/prod/targets.json (${this.boundDirectories.join(", ")}). This means publishability detection did not select the prod build output — refusing to publish before packing an unresolved manifest.`;
309
+ }
310
+ };
311
+ //#endregion
286
312
  //#region ../silk-effects/dist/dev/pkg/services/ChangesetConfig.js
287
313
  /**
288
314
  * Accessor service over a workspace root's `.changeset/config.json`.
@@ -358,7 +384,7 @@ const ChangesetConfigLive = effect.Layer.effect(ChangesetConfig, effect.Effect.g
358
384
  };
359
385
  }));
360
386
  //#endregion
361
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogAssemblyError.js
387
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogAssemblyError.js
362
388
  /**
363
389
  * Base constant for {@link CatalogAssemblyError}.
364
390
  *
@@ -385,7 +411,7 @@ var CatalogAssemblyError = class extends CatalogAssemblyErrorBase {
385
411
  }
386
412
  };
387
413
  //#endregion
388
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogResolutionError.js
414
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogResolutionError.js
389
415
  /**
390
416
  * Base constant for {@link CatalogResolutionError}.
391
417
  *
@@ -411,7 +437,7 @@ var CatalogResolutionError = class extends CatalogResolutionErrorBase {
411
437
  }
412
438
  };
413
439
  //#endregion
414
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/GitReadError.js
440
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/GitReadError.js
415
441
  /**
416
442
  * Base constant for {@link GitReadError}.
417
443
  *
@@ -436,7 +462,7 @@ var GitReadError = class extends GitReadErrorBase {
436
462
  }
437
463
  };
438
464
  //#endregion
439
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/PackageNotFoundError.js
465
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/PackageNotFoundError.js
440
466
  /**
441
467
  * Base constant for {@link PackageNotFoundError}.
442
468
  *
@@ -487,7 +513,7 @@ var PackageNotFoundError = class extends PackageNotFoundErrorBase {
487
513
  }
488
514
  };
489
515
  //#endregion
490
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceDiscoveryError.js
516
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceDiscoveryError.js
491
517
  /**
492
518
  * Base constant for {@link WorkspaceDiscoveryError}.
493
519
  *
@@ -538,7 +564,7 @@ var WorkspaceDiscoveryError = class extends WorkspaceDiscoveryErrorBase {
538
564
  }
539
565
  };
540
566
  //#endregion
541
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceRootNotFoundError.js
567
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceRootNotFoundError.js
542
568
  /**
543
569
  * Base constant for {@link WorkspaceRootNotFoundError}.
544
570
  *
@@ -588,7 +614,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
588
614
  }
589
615
  };
590
616
  //#endregion
591
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceDiscovery.js
617
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceDiscovery.js
592
618
  /**
593
619
  * Service for discovering workspace packages in a monorepo.
594
620
  *
@@ -638,7 +664,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
638
664
  */
639
665
  var WorkspaceDiscovery = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/WorkspaceDiscovery")() {};
640
666
  //#endregion
641
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceRoot.js
667
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceRoot.js
642
668
  /**
643
669
  * Service for finding the workspace root directory.
644
670
  *
@@ -6324,7 +6350,7 @@ function parse$3(text, options) {
6324
6350
  }));
6325
6351
  }
6326
6352
  //#endregion
6327
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/workspace-manifest.js
6353
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/workspace-manifest.js
6328
6354
  /**
6329
6355
  * Parse a pnpm-workspace.yaml text into its catalog/config-dependency/packages
6330
6356
  * slice. Pure with respect to the filesystem.
@@ -6392,7 +6418,7 @@ function checkDefaultCatalogIsDefinedOnce(manifest) {
6392
6418
  if (manifest.catalog != null && manifest.catalogs?.default != null) throw new PnpmError("INVALID_CATALOGS_CONFIGURATION", "The 'default' catalog was defined multiple times. Use the 'catalog' field or 'catalogs.default', but not both.");
6393
6419
  }
6394
6420
  //#endregion
6395
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/assemble.js
6421
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/assemble.js
6396
6422
  /** Merge catalog sources; later sources win per dependency within a catalog. */
6397
6423
  function mergeCatalogs(...sources) {
6398
6424
  const result = {};
@@ -6473,7 +6499,7 @@ function resolveFromCatalog(catalogs, wantedDependency) {
6473
6499
  };
6474
6500
  }
6475
6501
  //#endregion
6476
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/resolve.js
6502
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/resolve.js
6477
6503
  const DEP_FIELDS = [
6478
6504
  "dependencies",
6479
6505
  "devDependencies",
@@ -6543,7 +6569,7 @@ function resolveManifest(catalogs, workspaceVersions, manifest) {
6543
6569
  return out;
6544
6570
  }
6545
6571
  //#endregion
6546
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/CatalogSet.js
6572
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/CatalogSet.js
6547
6573
  /**
6548
6574
  * An immutable, fully-normalized catalog collection with the one
6549
6575
  * resolution semantic shared by live and point-in-time resolution.
@@ -6633,7 +6659,7 @@ var CatalogSet = class CatalogSet extends effect.Schema.Class("CatalogSet")({ en
6633
6659
  }
6634
6660
  };
6635
6661
  //#endregion
6636
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/worktree-catalogs.js
6662
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/worktree-catalogs.js
6637
6663
  /**
6638
6664
  * The ONE code path that reads the working tree's catalog sources
6639
6665
  * (`pnpm-workspace.yaml` + `pnpm-lock.yaml`). Consumed by
@@ -8178,7 +8204,7 @@ minimatch.Minimatch = Minimatch;
8178
8204
  minimatch.escape = escape;
8179
8205
  minimatch.unescape = unescape;
8180
8206
  //#endregion
8181
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/core.js
8207
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/core.js
8182
8208
  /**
8183
8209
  * Schema for supported package manager identifiers.
8184
8210
  *
@@ -9719,7 +9745,7 @@ function modifyImpl(text, path, value, formattingOptions) {
9719
9745
  return [];
9720
9746
  }
9721
9747
  //#endregion
9722
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/WorkspaceStateSnapshot.js
9748
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/WorkspaceStateSnapshot.js
9723
9749
  const DepRecord = effect.Schema.optionalWith(effect.Schema.Record({
9724
9750
  key: effect.Schema.String,
9725
9751
  value: effect.Schema.String
@@ -9788,7 +9814,7 @@ var WorkspaceStateSnapshot = class extends effect.Schema.Class("WorkspaceStateSn
9788
9814
  }
9789
9815
  };
9790
9816
  //#endregion
9791
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PointInTimeWorkspace.js
9817
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PointInTimeWorkspace.js
9792
9818
  /**
9793
9819
  * Service for reading a monorepo's workspace state at a specific moment: any
9794
9820
  * git ref (via `git show`/`git ls-tree`, without checking the ref out) or the
@@ -9815,7 +9841,7 @@ var WorkspaceStateSnapshot = class extends effect.Schema.Class("WorkspaceStateSn
9815
9841
  */
9816
9842
  var PointInTimeWorkspace = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/PointInTimeWorkspace")() {};
9817
9843
  //#endregion
9818
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/discovery/glob-core.js
9844
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/discovery/glob-core.js
9819
9845
  const normalize$1 = (pattern) => pattern.replace(/\/\*\*$/, "/*");
9820
9846
  const toRegex = (glob) => new RegExp(`^${glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
9821
9847
  /**
@@ -9858,7 +9884,7 @@ const compileWorkspaceGlobs = (patterns) => {
9858
9884
  };
9859
9885
  };
9860
9886
  //#endregion
9861
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/git.js
9887
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/git.js
9862
9888
  /**
9863
9889
  * Stderr shapes that mean "the path is not present at this ref" rather than
9864
9890
  * "the git command failed."
@@ -9950,7 +9976,7 @@ const makeGitReader = (executor, options) => {
9950
9976
  };
9951
9977
  };
9952
9978
  //#endregion
9953
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PointInTimeWorkspaceLive.js
9979
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PointInTimeWorkspaceLive.js
9954
9980
  /**
9955
9981
  * Live layer for the {@link PointInTimeWorkspace} service.
9956
9982
  *
@@ -10072,6 +10098,7 @@ const PointInTimeWorkspaceLive = effect.Layer.effect(PointInTimeWorkspace, effec
10072
10098
  }).pipe(effect.Effect.withSpan("PointInTimeWorkspace.at", { attributes: { ref } }));
10073
10099
  const worktree = (options) => effect.Effect.gen(function* () {
10074
10100
  const root = yield* resolveRoot(options?.cwd);
10101
+ yield* discovery.refresh();
10075
10102
  return new WorkspaceStateSnapshot({
10076
10103
  packages: (yield* discovery.listPackages(root)).map((p) => new PackageStateSnapshot({
10077
10104
  name: p.name,
@@ -10091,7 +10118,7 @@ const PointInTimeWorkspaceLive = effect.Layer.effect(PointInTimeWorkspace, effec
10091
10118
  });
10092
10119
  }));
10093
10120
  //#endregion
10094
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/publish.js
10121
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/publish.js
10095
10122
  /**
10096
10123
  * Schema for package publish targets.
10097
10124
  *
@@ -10134,7 +10161,7 @@ var PublishTarget = class extends effect.Schema.Class("PublishTarget")({
10134
10161
  provenance: effect.Schema.optionalWith(effect.Schema.Boolean, { default: () => false })
10135
10162
  }) {};
10136
10163
  //#endregion
10137
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PublishabilityDetector.js
10164
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PublishabilityDetector.js
10138
10165
  /**
10139
10166
  * Service for detecting whether a workspace package is publishable and
10140
10167
  * identifying its publish targets (npm, GitHub Packages, etc.).
@@ -10196,7 +10223,7 @@ var PublishTarget = class extends effect.Schema.Class("PublishTarget")({
10196
10223
  */
10197
10224
  var PublishabilityDetector = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/PublishabilityDetector")() {};
10198
10225
  //#endregion
10199
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PublishabilityDetectorLive.js
10226
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PublishabilityDetectorLive.js
10200
10227
  /**
10201
10228
  * Default live implementation of the {@link PublishabilityDetector} service.
10202
10229
  *
@@ -10268,7 +10295,7 @@ const PublishabilityDetectorLive = effect.Layer.succeed(PublishabilityDetector,
10268
10295
  return targets;
10269
10296
  }).pipe(effect.Effect.withSpan("PublishabilityDetector.detect", { attributes: { "workspace.package": pkg.name } })) });
10270
10297
  //#endregion
10271
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceDiscoveryLive.js
10298
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceDiscoveryLive.js
10272
10299
  /**
10273
10300
  * Live implementation of the {@link WorkspaceDiscovery} service.
10274
10301
  *
@@ -10555,7 +10582,7 @@ const WorkspaceDiscoveryLive = effect.Layer.effect(WorkspaceDiscovery, effect.Ef
10555
10582
  };
10556
10583
  }));
10557
10584
  //#endregion
10558
- //#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceRootLive.js
10585
+ //#region ../../node_modules/.pnpm/workspaces-effect@2.0.3_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceRootLive.js
10559
10586
  /**
10560
10587
  * Live implementation of the {@link WorkspaceRoot} service.
10561
10588
  *
@@ -10775,6 +10802,17 @@ var SilkPublishability = class {
10775
10802
  * Resolve a package's publish targets via {@link SilkPublishability}, then drop any
10776
10803
  * whose built `directory` package.json is `private: true`. Returned targets keep the
10777
10804
  * detector's original (possibly package-relative) `directory`.
10805
+ *
10806
+ * @remarks
10807
+ * When the prod build has written `dist/prod/targets.json`, that binding is
10808
+ * authoritative: every surviving target's directory must be one of the group
10809
+ * directories it names. A directory outside the binding means detection did
10810
+ * not select the prod output — the `yaml-effect@0.7.1` shape, where a dev
10811
+ * manifest carrying `catalog:` specifiers was packed and published. Rather
10812
+ * than ship those bytes, fail with {@link PublishTargetBindingError}.
10813
+ *
10814
+ * Before the prod build runs there is no binding, and the detector's
10815
+ * placeholder directories are left alone.
10778
10816
  */
10779
10817
  static resolveTargets(pkg, root) {
10780
10818
  return effect.Effect.gen(function* () {
@@ -10786,6 +10824,18 @@ var SilkPublishability = class {
10786
10824
  const dir = (0, node_path.isAbsolute)(t.directory) ? t.directory : (0, node_path.join)(pkg.path, t.directory);
10787
10825
  if (!(yield* isTargetPrivate(fs, dir))) kept.push(t);
10788
10826
  }
10827
+ const binding = yield* readTargetsBinding(fs, pkg.path);
10828
+ if (binding === null) return kept;
10829
+ const boundDirectories = binding.groups.map((g) => normalizeDir(g.dir));
10830
+ const bound = new Set(boundDirectories);
10831
+ for (const t of kept) {
10832
+ const relativeDir = normalizeDir((0, node_path.isAbsolute)(t.directory) ? (0, node_path.relative)(pkg.path, t.directory) : t.directory);
10833
+ if (!bound.has(relativeDir)) return yield* effect.Effect.fail(new PublishTargetBindingError({
10834
+ pkg: pkg.name,
10835
+ directory: relativeDir,
10836
+ boundDirectories
10837
+ }));
10838
+ }
10789
10839
  return kept;
10790
10840
  });
10791
10841
  }
@@ -10812,6 +10862,26 @@ var SilkPublishability = class {
10812
10862
  });
10813
10863
  }
10814
10864
  };
10865
+ /**
10866
+ * Reduce a directory to a comparable package-relative POSIX path: backslashes to
10867
+ * forward slashes, no `./` prefix, no trailing slash. `""` (the package root)
10868
+ * normalizes to `.`, matching how a root-directory target is recorded.
10869
+ *
10870
+ * @remarks
10871
+ * Trailing slashes are trimmed with an index scan rather than `/\/+$/`. That
10872
+ * regex is unanchored at the start, so the engine retries the match from every
10873
+ * position and degrades to O(n²) on a path of many slashes (CodeQL
10874
+ * `js/polynomial-redos`). `dir` reaches here from `dist/prod/targets.json`, which
10875
+ * the bundler writes but a consumer repo could hand-edit.
10876
+ */
10877
+ const normalizeDir = (dir) => {
10878
+ const slashed = dir.replaceAll("\\", "/");
10879
+ const withoutPrefix = slashed.startsWith("./") ? slashed.slice(2) : slashed;
10880
+ let end = withoutPrefix.length;
10881
+ while (end > 0 && withoutPrefix[end - 1] === "/") end -= 1;
10882
+ const normalized = withoutPrefix.slice(0, end);
10883
+ return normalized === "" ? "." : normalized;
10884
+ };
10815
10885
  /** True when a built target directory's package.json is `private: true`. Missing/unreadable/malformed → false. */
10816
10886
  const isTargetPrivate = (fs, targetDir) => fs.readFileString((0, node_path.join)(targetDir, "package.json")).pipe(effect.Effect.flatMap((content) => effect.Effect.try({
10817
10887
  try: () => JSON.parse(content).private === true,
@@ -39298,6 +39368,7 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
39298
39368
  const plan = (options) => effect.Effect.gen(function* () {
39299
39369
  const resolvedCwd = (0, node_path.resolve)(options.cwd);
39300
39370
  const changesetDir = (0, node_path.join)(resolvedCwd, ".changeset");
39371
+ yield* discovery.refresh();
39301
39372
  let fromRef = options.from;
39302
39373
  if (!fromRef) {
39303
39374
  let baseBranch = options.base;