@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.
@@ -295,6 +295,33 @@ const ChangesetConfigReaderLive = Layer.effect(ChangesetConfigReader, Effect.gen
295
295
  return { read };
296
296
  }));
297
297
 
298
+ //#endregion
299
+ //#region ../silk-effects/dist/dev/pkg/errors/PublishTargetBindingError.js
300
+ /**
301
+ * Raised when publishability detection selects a directory that the package's
302
+ * `dist/prod/targets.json` binding does not describe.
303
+ *
304
+ * @remarks
305
+ * The bundler's prod build writes `targets.json` naming every byte-group
306
+ * directory it produced. Once that binding exists it is authoritative: the only
307
+ * directories whose bytes may be published are the ones it lists. A detector
308
+ * that returns anything else — most often `publishConfig.directory` pointing at
309
+ * a **dev** build, because silk mode was misdetected — is about to pack an
310
+ * unresolved workspace manifest and ship it to a registry.
311
+ *
312
+ * That is the `yaml-effect@0.7.1` failure: detection picked `dist/dev/pkg`, the
313
+ * dev manifest still carried `catalog:` specifiers, and the published package
314
+ * was uninstallable (`EUNSUPPORTEDPROTOCOL`).
315
+ *
316
+ * @since 3.1.0
317
+ * @public
318
+ */
319
+ var PublishTargetBindingError = class extends Data.TaggedError("PublishTargetBindingError") {
320
+ get message() {
321
+ 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.`;
322
+ }
323
+ };
324
+
298
325
  //#endregion
299
326
  //#region ../silk-effects/dist/dev/pkg/services/ChangesetConfig.js
300
327
  /**
@@ -372,7 +399,7 @@ const ChangesetConfigLive = Layer.effect(ChangesetConfig, Effect.gen(function* (
372
399
  }));
373
400
 
374
401
  //#endregion
375
- //#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
402
+ //#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
376
403
  /**
377
404
  * Base constant for {@link CatalogAssemblyError}.
378
405
  *
@@ -400,7 +427,7 @@ var CatalogAssemblyError = class extends CatalogAssemblyErrorBase {
400
427
  };
401
428
 
402
429
  //#endregion
403
- //#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
430
+ //#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
404
431
  /**
405
432
  * Base constant for {@link CatalogResolutionError}.
406
433
  *
@@ -427,7 +454,7 @@ var CatalogResolutionError = class extends CatalogResolutionErrorBase {
427
454
  };
428
455
 
429
456
  //#endregion
430
- //#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
457
+ //#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
431
458
  /**
432
459
  * Base constant for {@link GitReadError}.
433
460
  *
@@ -453,7 +480,7 @@ var GitReadError = class extends GitReadErrorBase {
453
480
  };
454
481
 
455
482
  //#endregion
456
- //#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
483
+ //#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
457
484
  /**
458
485
  * Base constant for {@link PackageNotFoundError}.
459
486
  *
@@ -505,7 +532,7 @@ var PackageNotFoundError = class extends PackageNotFoundErrorBase {
505
532
  };
506
533
 
507
534
  //#endregion
508
- //#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
535
+ //#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
509
536
  /**
510
537
  * Base constant for {@link WorkspaceDiscoveryError}.
511
538
  *
@@ -557,7 +584,7 @@ var WorkspaceDiscoveryError = class extends WorkspaceDiscoveryErrorBase {
557
584
  };
558
585
 
559
586
  //#endregion
560
- //#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
587
+ //#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
561
588
  /**
562
589
  * Base constant for {@link WorkspaceRootNotFoundError}.
563
590
  *
@@ -608,7 +635,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
608
635
  };
609
636
 
610
637
  //#endregion
611
- //#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
638
+ //#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
612
639
  /**
613
640
  * Service for discovering workspace packages in a monorepo.
614
641
  *
@@ -659,7 +686,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
659
686
  var WorkspaceDiscovery = class extends Context.Tag("@spencerbeggs/workspaces-effect/WorkspaceDiscovery")() {};
660
687
 
661
688
  //#endregion
662
- //#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
689
+ //#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
663
690
  /**
664
691
  * Service for finding the workspace root directory.
665
692
  *
@@ -6402,7 +6429,7 @@ function parse$3(text, options) {
6402
6429
  }
6403
6430
 
6404
6431
  //#endregion
6405
- //#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
6432
+ //#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
6406
6433
  /**
6407
6434
  * Parse a pnpm-workspace.yaml text into its catalog/config-dependency/packages
6408
6435
  * slice. Pure with respect to the filesystem.
@@ -6478,7 +6505,7 @@ function checkDefaultCatalogIsDefinedOnce(manifest) {
6478
6505
  }
6479
6506
 
6480
6507
  //#endregion
6481
- //#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
6508
+ //#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
6482
6509
  /** Merge catalog sources; later sources win per dependency within a catalog. */
6483
6510
  function mergeCatalogs(...sources) {
6484
6511
  const result = {};
@@ -6563,7 +6590,7 @@ function resolveFromCatalog(catalogs, wantedDependency) {
6563
6590
  }
6564
6591
 
6565
6592
  //#endregion
6566
- //#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
6593
+ //#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
6567
6594
  const DEP_FIELDS = [
6568
6595
  "dependencies",
6569
6596
  "devDependencies",
@@ -6634,7 +6661,7 @@ function resolveManifest(catalogs, workspaceVersions, manifest) {
6634
6661
  }
6635
6662
 
6636
6663
  //#endregion
6637
- //#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
6664
+ //#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
6638
6665
  /**
6639
6666
  * An immutable, fully-normalized catalog collection with the one
6640
6667
  * resolution semantic shared by live and point-in-time resolution.
@@ -6725,7 +6752,7 @@ var CatalogSet = class CatalogSet extends Schema.Class("CatalogSet")({ entries:
6725
6752
  };
6726
6753
 
6727
6754
  //#endregion
6728
- //#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
6755
+ //#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
6729
6756
  /**
6730
6757
  * The ONE code path that reads the working tree's catalog sources
6731
6758
  * (`pnpm-workspace.yaml` + `pnpm-lock.yaml`). Consumed by
@@ -8281,7 +8308,7 @@ minimatch.escape = escape;
8281
8308
  minimatch.unescape = unescape;
8282
8309
 
8283
8310
  //#endregion
8284
- //#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
8311
+ //#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
8285
8312
  /**
8286
8313
  * Schema for supported package manager identifiers.
8287
8314
  *
@@ -9904,7 +9931,7 @@ function modifyImpl(text, path, value, formattingOptions) {
9904
9931
  }
9905
9932
 
9906
9933
  //#endregion
9907
- //#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
9934
+ //#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
9908
9935
  const DepRecord = Schema.optionalWith(Schema.Record({
9909
9936
  key: Schema.String,
9910
9937
  value: Schema.String
@@ -9974,7 +10001,7 @@ var WorkspaceStateSnapshot = class extends Schema.Class("WorkspaceStateSnapshot"
9974
10001
  };
9975
10002
 
9976
10003
  //#endregion
9977
- //#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
10004
+ //#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
9978
10005
  /**
9979
10006
  * Service for reading a monorepo's workspace state at a specific moment: any
9980
10007
  * git ref (via `git show`/`git ls-tree`, without checking the ref out) or the
@@ -10002,7 +10029,7 @@ var WorkspaceStateSnapshot = class extends Schema.Class("WorkspaceStateSnapshot"
10002
10029
  var PointInTimeWorkspace = class extends Context.Tag("@spencerbeggs/workspaces-effect/PointInTimeWorkspace")() {};
10003
10030
 
10004
10031
  //#endregion
10005
- //#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
10032
+ //#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
10006
10033
  const normalize$2 = (pattern) => pattern.replace(/\/\*\*$/, "/*");
10007
10034
  const toRegex = (glob) => new RegExp(`^${glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
10008
10035
  /**
@@ -10046,7 +10073,7 @@ const compileWorkspaceGlobs = (patterns) => {
10046
10073
  };
10047
10074
 
10048
10075
  //#endregion
10049
- //#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
10076
+ //#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
10050
10077
  /**
10051
10078
  * Stderr shapes that mean "the path is not present at this ref" rather than
10052
10079
  * "the git command failed."
@@ -10139,7 +10166,7 @@ const makeGitReader = (executor, options) => {
10139
10166
  };
10140
10167
 
10141
10168
  //#endregion
10142
- //#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
10169
+ //#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
10143
10170
  /**
10144
10171
  * Live layer for the {@link PointInTimeWorkspace} service.
10145
10172
  *
@@ -10261,6 +10288,7 @@ const PointInTimeWorkspaceLive = Layer.effect(PointInTimeWorkspace, Effect.gen(f
10261
10288
  }).pipe(Effect.withSpan("PointInTimeWorkspace.at", { attributes: { ref } }));
10262
10289
  const worktree = (options) => Effect.gen(function* () {
10263
10290
  const root = yield* resolveRoot(options?.cwd);
10291
+ yield* discovery.refresh();
10264
10292
  return new WorkspaceStateSnapshot({
10265
10293
  packages: (yield* discovery.listPackages(root)).map((p) => new PackageStateSnapshot({
10266
10294
  name: p.name,
@@ -10281,7 +10309,7 @@ const PointInTimeWorkspaceLive = Layer.effect(PointInTimeWorkspace, Effect.gen(f
10281
10309
  }));
10282
10310
 
10283
10311
  //#endregion
10284
- //#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
10312
+ //#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
10285
10313
  /**
10286
10314
  * Schema for package publish targets.
10287
10315
  *
@@ -10325,7 +10353,7 @@ var PublishTarget = class extends Schema.Class("PublishTarget")({
10325
10353
  }) {};
10326
10354
 
10327
10355
  //#endregion
10328
- //#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
10356
+ //#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
10329
10357
  /**
10330
10358
  * Service for detecting whether a workspace package is publishable and
10331
10359
  * identifying its publish targets (npm, GitHub Packages, etc.).
@@ -10388,7 +10416,7 @@ var PublishTarget = class extends Schema.Class("PublishTarget")({
10388
10416
  var PublishabilityDetector = class extends Context.Tag("@spencerbeggs/workspaces-effect/PublishabilityDetector")() {};
10389
10417
 
10390
10418
  //#endregion
10391
- //#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
10419
+ //#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
10392
10420
  /**
10393
10421
  * Default live implementation of the {@link PublishabilityDetector} service.
10394
10422
  *
@@ -10461,7 +10489,7 @@ const PublishabilityDetectorLive = Layer.succeed(PublishabilityDetector, { detec
10461
10489
  }).pipe(Effect.withSpan("PublishabilityDetector.detect", { attributes: { "workspace.package": pkg.name } })) });
10462
10490
 
10463
10491
  //#endregion
10464
- //#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
10492
+ //#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
10465
10493
  /**
10466
10494
  * Live implementation of the {@link WorkspaceDiscovery} service.
10467
10495
  *
@@ -10749,7 +10777,7 @@ const WorkspaceDiscoveryLive = Layer.effect(WorkspaceDiscovery, Effect.gen(funct
10749
10777
  }));
10750
10778
 
10751
10779
  //#endregion
10752
- //#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
10780
+ //#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
10753
10781
  /**
10754
10782
  * Live implementation of the {@link WorkspaceRoot} service.
10755
10783
  *
@@ -10970,6 +10998,17 @@ var SilkPublishability = class {
10970
10998
  * Resolve a package's publish targets via {@link SilkPublishability}, then drop any
10971
10999
  * whose built `directory` package.json is `private: true`. Returned targets keep the
10972
11000
  * detector's original (possibly package-relative) `directory`.
11001
+ *
11002
+ * @remarks
11003
+ * When the prod build has written `dist/prod/targets.json`, that binding is
11004
+ * authoritative: every surviving target's directory must be one of the group
11005
+ * directories it names. A directory outside the binding means detection did
11006
+ * not select the prod output — the `yaml-effect@0.7.1` shape, where a dev
11007
+ * manifest carrying `catalog:` specifiers was packed and published. Rather
11008
+ * than ship those bytes, fail with {@link PublishTargetBindingError}.
11009
+ *
11010
+ * Before the prod build runs there is no binding, and the detector's
11011
+ * placeholder directories are left alone.
10973
11012
  */
10974
11013
  static resolveTargets(pkg, root) {
10975
11014
  return Effect.gen(function* () {
@@ -10981,6 +11020,18 @@ var SilkPublishability = class {
10981
11020
  const dir = isAbsolute(t.directory) ? t.directory : join(pkg.path, t.directory);
10982
11021
  if (!(yield* isTargetPrivate(fs, dir))) kept.push(t);
10983
11022
  }
11023
+ const binding = yield* readTargetsBinding(fs, pkg.path);
11024
+ if (binding === null) return kept;
11025
+ const boundDirectories = binding.groups.map((g) => normalizeDir(g.dir));
11026
+ const bound = new Set(boundDirectories);
11027
+ for (const t of kept) {
11028
+ const relativeDir = normalizeDir(isAbsolute(t.directory) ? relative(pkg.path, t.directory) : t.directory);
11029
+ if (!bound.has(relativeDir)) return yield* Effect.fail(new PublishTargetBindingError({
11030
+ pkg: pkg.name,
11031
+ directory: relativeDir,
11032
+ boundDirectories
11033
+ }));
11034
+ }
10984
11035
  return kept;
10985
11036
  });
10986
11037
  }
@@ -11007,6 +11058,26 @@ var SilkPublishability = class {
11007
11058
  });
11008
11059
  }
11009
11060
  };
11061
+ /**
11062
+ * Reduce a directory to a comparable package-relative POSIX path: backslashes to
11063
+ * forward slashes, no `./` prefix, no trailing slash. `""` (the package root)
11064
+ * normalizes to `.`, matching how a root-directory target is recorded.
11065
+ *
11066
+ * @remarks
11067
+ * Trailing slashes are trimmed with an index scan rather than `/\/+$/`. That
11068
+ * regex is unanchored at the start, so the engine retries the match from every
11069
+ * position and degrades to O(n²) on a path of many slashes (CodeQL
11070
+ * `js/polynomial-redos`). `dir` reaches here from `dist/prod/targets.json`, which
11071
+ * the bundler writes but a consumer repo could hand-edit.
11072
+ */
11073
+ const normalizeDir = (dir) => {
11074
+ const slashed = dir.replaceAll("\\", "/");
11075
+ const withoutPrefix = slashed.startsWith("./") ? slashed.slice(2) : slashed;
11076
+ let end = withoutPrefix.length;
11077
+ while (end > 0 && withoutPrefix[end - 1] === "/") end -= 1;
11078
+ const normalized = withoutPrefix.slice(0, end);
11079
+ return normalized === "" ? "." : normalized;
11080
+ };
11010
11081
  /** True when a built target directory's package.json is `private: true`. Missing/unreadable/malformed → false. */
11011
11082
  const isTargetPrivate = (fs, targetDir) => fs.readFileString(join(targetDir, "package.json")).pipe(Effect.flatMap((content) => Effect.try({
11012
11083
  try: () => JSON.parse(content).private === true,
@@ -39747,6 +39818,7 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
39747
39818
  const plan = (options) => Effect.gen(function* () {
39748
39819
  const resolvedCwd = resolve(options.cwd);
39749
39820
  const changesetDir = join(resolvedCwd, ".changeset");
39821
+ yield* discovery.refresh();
39750
39822
  let fromRef = options.from;
39751
39823
  if (!fromRef) {
39752
39824
  let baseBranch = options.base;
@@ -287,6 +287,32 @@ const ChangesetConfigReaderLive = effect.Layer.effect(ChangesetConfigReader, eff
287
287
  return { read };
288
288
  }));
289
289
  //#endregion
290
+ //#region ../silk-effects/dist/dev/pkg/errors/PublishTargetBindingError.js
291
+ /**
292
+ * Raised when publishability detection selects a directory that the package's
293
+ * `dist/prod/targets.json` binding does not describe.
294
+ *
295
+ * @remarks
296
+ * The bundler's prod build writes `targets.json` naming every byte-group
297
+ * directory it produced. Once that binding exists it is authoritative: the only
298
+ * directories whose bytes may be published are the ones it lists. A detector
299
+ * that returns anything else — most often `publishConfig.directory` pointing at
300
+ * a **dev** build, because silk mode was misdetected — is about to pack an
301
+ * unresolved workspace manifest and ship it to a registry.
302
+ *
303
+ * That is the `yaml-effect@0.7.1` failure: detection picked `dist/dev/pkg`, the
304
+ * dev manifest still carried `catalog:` specifiers, and the published package
305
+ * was uninstallable (`EUNSUPPORTEDPROTOCOL`).
306
+ *
307
+ * @since 3.1.0
308
+ * @public
309
+ */
310
+ var PublishTargetBindingError = class extends effect.Data.TaggedError("PublishTargetBindingError") {
311
+ get message() {
312
+ 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.`;
313
+ }
314
+ };
315
+ //#endregion
290
316
  //#region ../silk-effects/dist/dev/pkg/services/ChangesetConfig.js
291
317
  /**
292
318
  * Accessor service over a workspace root's `.changeset/config.json`.
@@ -362,7 +388,7 @@ const ChangesetConfigLive = effect.Layer.effect(ChangesetConfig, effect.Effect.g
362
388
  };
363
389
  }));
364
390
  //#endregion
365
- //#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
391
+ //#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
366
392
  /**
367
393
  * Base constant for {@link CatalogAssemblyError}.
368
394
  *
@@ -389,7 +415,7 @@ var CatalogAssemblyError = class extends CatalogAssemblyErrorBase {
389
415
  }
390
416
  };
391
417
  //#endregion
392
- //#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
418
+ //#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
393
419
  /**
394
420
  * Base constant for {@link CatalogResolutionError}.
395
421
  *
@@ -415,7 +441,7 @@ var CatalogResolutionError = class extends CatalogResolutionErrorBase {
415
441
  }
416
442
  };
417
443
  //#endregion
418
- //#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
444
+ //#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
419
445
  /**
420
446
  * Base constant for {@link GitReadError}.
421
447
  *
@@ -440,7 +466,7 @@ var GitReadError = class extends GitReadErrorBase {
440
466
  }
441
467
  };
442
468
  //#endregion
443
- //#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
469
+ //#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
444
470
  /**
445
471
  * Base constant for {@link PackageNotFoundError}.
446
472
  *
@@ -491,7 +517,7 @@ var PackageNotFoundError = class extends PackageNotFoundErrorBase {
491
517
  }
492
518
  };
493
519
  //#endregion
494
- //#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
520
+ //#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
495
521
  /**
496
522
  * Base constant for {@link WorkspaceDiscoveryError}.
497
523
  *
@@ -542,7 +568,7 @@ var WorkspaceDiscoveryError = class extends WorkspaceDiscoveryErrorBase {
542
568
  }
543
569
  };
544
570
  //#endregion
545
- //#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
571
+ //#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
546
572
  /**
547
573
  * Base constant for {@link WorkspaceRootNotFoundError}.
548
574
  *
@@ -592,7 +618,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
592
618
  }
593
619
  };
594
620
  //#endregion
595
- //#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
621
+ //#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
596
622
  /**
597
623
  * Service for discovering workspace packages in a monorepo.
598
624
  *
@@ -642,7 +668,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
642
668
  */
643
669
  var WorkspaceDiscovery = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/WorkspaceDiscovery")() {};
644
670
  //#endregion
645
- //#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
671
+ //#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
646
672
  /**
647
673
  * Service for finding the workspace root directory.
648
674
  *
@@ -6328,7 +6354,7 @@ function parse$3(text, options) {
6328
6354
  }));
6329
6355
  }
6330
6356
  //#endregion
6331
- //#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
6357
+ //#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
6332
6358
  /**
6333
6359
  * Parse a pnpm-workspace.yaml text into its catalog/config-dependency/packages
6334
6360
  * slice. Pure with respect to the filesystem.
@@ -6396,7 +6422,7 @@ function checkDefaultCatalogIsDefinedOnce(manifest) {
6396
6422
  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.");
6397
6423
  }
6398
6424
  //#endregion
6399
- //#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
6425
+ //#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
6400
6426
  /** Merge catalog sources; later sources win per dependency within a catalog. */
6401
6427
  function mergeCatalogs(...sources) {
6402
6428
  const result = {};
@@ -6477,7 +6503,7 @@ function resolveFromCatalog(catalogs, wantedDependency) {
6477
6503
  };
6478
6504
  }
6479
6505
  //#endregion
6480
- //#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
6506
+ //#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
6481
6507
  const DEP_FIELDS = [
6482
6508
  "dependencies",
6483
6509
  "devDependencies",
@@ -6547,7 +6573,7 @@ function resolveManifest(catalogs, workspaceVersions, manifest) {
6547
6573
  return out;
6548
6574
  }
6549
6575
  //#endregion
6550
- //#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
6576
+ //#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
6551
6577
  /**
6552
6578
  * An immutable, fully-normalized catalog collection with the one
6553
6579
  * resolution semantic shared by live and point-in-time resolution.
@@ -6637,7 +6663,7 @@ var CatalogSet = class CatalogSet extends effect.Schema.Class("CatalogSet")({ en
6637
6663
  }
6638
6664
  };
6639
6665
  //#endregion
6640
- //#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
6666
+ //#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
6641
6667
  /**
6642
6668
  * The ONE code path that reads the working tree's catalog sources
6643
6669
  * (`pnpm-workspace.yaml` + `pnpm-lock.yaml`). Consumed by
@@ -8182,7 +8208,7 @@ minimatch.Minimatch = Minimatch;
8182
8208
  minimatch.escape = escape;
8183
8209
  minimatch.unescape = unescape;
8184
8210
  //#endregion
8185
- //#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
8211
+ //#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
8186
8212
  /**
8187
8213
  * Schema for supported package manager identifiers.
8188
8214
  *
@@ -9723,7 +9749,7 @@ function modifyImpl(text, path, value, formattingOptions) {
9723
9749
  return [];
9724
9750
  }
9725
9751
  //#endregion
9726
- //#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
9752
+ //#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
9727
9753
  const DepRecord = effect.Schema.optionalWith(effect.Schema.Record({
9728
9754
  key: effect.Schema.String,
9729
9755
  value: effect.Schema.String
@@ -9792,7 +9818,7 @@ var WorkspaceStateSnapshot = class extends effect.Schema.Class("WorkspaceStateSn
9792
9818
  }
9793
9819
  };
9794
9820
  //#endregion
9795
- //#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
9821
+ //#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
9796
9822
  /**
9797
9823
  * Service for reading a monorepo's workspace state at a specific moment: any
9798
9824
  * git ref (via `git show`/`git ls-tree`, without checking the ref out) or the
@@ -9819,7 +9845,7 @@ var WorkspaceStateSnapshot = class extends effect.Schema.Class("WorkspaceStateSn
9819
9845
  */
9820
9846
  var PointInTimeWorkspace = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/PointInTimeWorkspace")() {};
9821
9847
  //#endregion
9822
- //#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
9848
+ //#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
9823
9849
  const normalize$1 = (pattern) => pattern.replace(/\/\*\*$/, "/*");
9824
9850
  const toRegex = (glob) => new RegExp(`^${glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
9825
9851
  /**
@@ -9862,7 +9888,7 @@ const compileWorkspaceGlobs = (patterns) => {
9862
9888
  };
9863
9889
  };
9864
9890
  //#endregion
9865
- //#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
9891
+ //#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
9866
9892
  /**
9867
9893
  * Stderr shapes that mean "the path is not present at this ref" rather than
9868
9894
  * "the git command failed."
@@ -9954,7 +9980,7 @@ const makeGitReader = (executor, options) => {
9954
9980
  };
9955
9981
  };
9956
9982
  //#endregion
9957
- //#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
9983
+ //#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
9958
9984
  /**
9959
9985
  * Live layer for the {@link PointInTimeWorkspace} service.
9960
9986
  *
@@ -10076,6 +10102,7 @@ const PointInTimeWorkspaceLive = effect.Layer.effect(PointInTimeWorkspace, effec
10076
10102
  }).pipe(effect.Effect.withSpan("PointInTimeWorkspace.at", { attributes: { ref } }));
10077
10103
  const worktree = (options) => effect.Effect.gen(function* () {
10078
10104
  const root = yield* resolveRoot(options?.cwd);
10105
+ yield* discovery.refresh();
10079
10106
  return new WorkspaceStateSnapshot({
10080
10107
  packages: (yield* discovery.listPackages(root)).map((p) => new PackageStateSnapshot({
10081
10108
  name: p.name,
@@ -10095,7 +10122,7 @@ const PointInTimeWorkspaceLive = effect.Layer.effect(PointInTimeWorkspace, effec
10095
10122
  });
10096
10123
  }));
10097
10124
  //#endregion
10098
- //#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
10125
+ //#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
10099
10126
  /**
10100
10127
  * Schema for package publish targets.
10101
10128
  *
@@ -10138,7 +10165,7 @@ var PublishTarget = class extends effect.Schema.Class("PublishTarget")({
10138
10165
  provenance: effect.Schema.optionalWith(effect.Schema.Boolean, { default: () => false })
10139
10166
  }) {};
10140
10167
  //#endregion
10141
- //#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
10168
+ //#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
10142
10169
  /**
10143
10170
  * Service for detecting whether a workspace package is publishable and
10144
10171
  * identifying its publish targets (npm, GitHub Packages, etc.).
@@ -10200,7 +10227,7 @@ var PublishTarget = class extends effect.Schema.Class("PublishTarget")({
10200
10227
  */
10201
10228
  var PublishabilityDetector = class extends effect.Context.Tag("@spencerbeggs/workspaces-effect/PublishabilityDetector")() {};
10202
10229
  //#endregion
10203
- //#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
10230
+ //#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
10204
10231
  /**
10205
10232
  * Default live implementation of the {@link PublishabilityDetector} service.
10206
10233
  *
@@ -10272,7 +10299,7 @@ const PublishabilityDetectorLive = effect.Layer.succeed(PublishabilityDetector,
10272
10299
  return targets;
10273
10300
  }).pipe(effect.Effect.withSpan("PublishabilityDetector.detect", { attributes: { "workspace.package": pkg.name } })) });
10274
10301
  //#endregion
10275
- //#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
10302
+ //#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
10276
10303
  /**
10277
10304
  * Live implementation of the {@link WorkspaceDiscovery} service.
10278
10305
  *
@@ -10559,7 +10586,7 @@ const WorkspaceDiscoveryLive = effect.Layer.effect(WorkspaceDiscovery, effect.Ef
10559
10586
  };
10560
10587
  }));
10561
10588
  //#endregion
10562
- //#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
10589
+ //#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
10563
10590
  /**
10564
10591
  * Live implementation of the {@link WorkspaceRoot} service.
10565
10592
  *
@@ -10779,6 +10806,17 @@ var SilkPublishability = class {
10779
10806
  * Resolve a package's publish targets via {@link SilkPublishability}, then drop any
10780
10807
  * whose built `directory` package.json is `private: true`. Returned targets keep the
10781
10808
  * detector's original (possibly package-relative) `directory`.
10809
+ *
10810
+ * @remarks
10811
+ * When the prod build has written `dist/prod/targets.json`, that binding is
10812
+ * authoritative: every surviving target's directory must be one of the group
10813
+ * directories it names. A directory outside the binding means detection did
10814
+ * not select the prod output — the `yaml-effect@0.7.1` shape, where a dev
10815
+ * manifest carrying `catalog:` specifiers was packed and published. Rather
10816
+ * than ship those bytes, fail with {@link PublishTargetBindingError}.
10817
+ *
10818
+ * Before the prod build runs there is no binding, and the detector's
10819
+ * placeholder directories are left alone.
10782
10820
  */
10783
10821
  static resolveTargets(pkg, root) {
10784
10822
  return effect.Effect.gen(function* () {
@@ -10790,6 +10828,18 @@ var SilkPublishability = class {
10790
10828
  const dir = (0, node_path.isAbsolute)(t.directory) ? t.directory : (0, node_path.join)(pkg.path, t.directory);
10791
10829
  if (!(yield* isTargetPrivate(fs, dir))) kept.push(t);
10792
10830
  }
10831
+ const binding = yield* readTargetsBinding(fs, pkg.path);
10832
+ if (binding === null) return kept;
10833
+ const boundDirectories = binding.groups.map((g) => normalizeDir(g.dir));
10834
+ const bound = new Set(boundDirectories);
10835
+ for (const t of kept) {
10836
+ const relativeDir = normalizeDir((0, node_path.isAbsolute)(t.directory) ? (0, node_path.relative)(pkg.path, t.directory) : t.directory);
10837
+ if (!bound.has(relativeDir)) return yield* effect.Effect.fail(new PublishTargetBindingError({
10838
+ pkg: pkg.name,
10839
+ directory: relativeDir,
10840
+ boundDirectories
10841
+ }));
10842
+ }
10793
10843
  return kept;
10794
10844
  });
10795
10845
  }
@@ -10816,6 +10866,26 @@ var SilkPublishability = class {
10816
10866
  });
10817
10867
  }
10818
10868
  };
10869
+ /**
10870
+ * Reduce a directory to a comparable package-relative POSIX path: backslashes to
10871
+ * forward slashes, no `./` prefix, no trailing slash. `""` (the package root)
10872
+ * normalizes to `.`, matching how a root-directory target is recorded.
10873
+ *
10874
+ * @remarks
10875
+ * Trailing slashes are trimmed with an index scan rather than `/\/+$/`. That
10876
+ * regex is unanchored at the start, so the engine retries the match from every
10877
+ * position and degrades to O(n²) on a path of many slashes (CodeQL
10878
+ * `js/polynomial-redos`). `dir` reaches here from `dist/prod/targets.json`, which
10879
+ * the bundler writes but a consumer repo could hand-edit.
10880
+ */
10881
+ const normalizeDir = (dir) => {
10882
+ const slashed = dir.replaceAll("\\", "/");
10883
+ const withoutPrefix = slashed.startsWith("./") ? slashed.slice(2) : slashed;
10884
+ let end = withoutPrefix.length;
10885
+ while (end > 0 && withoutPrefix[end - 1] === "/") end -= 1;
10886
+ const normalized = withoutPrefix.slice(0, end);
10887
+ return normalized === "" ? "." : normalized;
10888
+ };
10819
10889
  /** True when a built target directory's package.json is `private: true`. Missing/unreadable/malformed → false. */
10820
10890
  const isTargetPrivate = (fs, targetDir) => fs.readFileString((0, node_path.join)(targetDir, "package.json")).pipe(effect.Effect.flatMap((content) => effect.Effect.try({
10821
10891
  try: () => JSON.parse(content).private === true,
@@ -39302,6 +39372,7 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
39302
39372
  const plan = (options) => effect.Effect.gen(function* () {
39303
39373
  const resolvedCwd = (0, node_path.resolve)(options.cwd);
39304
39374
  const changesetDir = (0, node_path.join)(resolvedCwd, ".changeset");
39375
+ yield* discovery.refresh();
39305
39376
  let fromRef = options.from;
39306
39377
  if (!fromRef) {
39307
39378
  let baseBranch = options.base;