@r_masseater/msch 0.77.0 → 0.77.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/dist/cli.mjs CHANGED
@@ -16813,13 +16813,30 @@ const FIRST_COLUMN$1 = 1;
16813
16813
  const READ_CONCURRENCY$3 = 16;
16814
16814
  const LAST_SEGMENT$1 = /[^/]*$/u;
16815
16815
  const directoryOf$1 = (file) => String$1.replace(LAST_SEGMENT$1, "")(file);
16816
- const packageAt = (file, text) => pipe(decodeVersionedPackageJson(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map(({ name, version }) => ({
16816
+ const packageAt = (file, text) => pipe(decodeVersionedPackageJson(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map((manifest) => ({
16817
16817
  file,
16818
16818
  directory: directoryOf$1(file),
16819
- name,
16820
- version,
16821
- text
16819
+ name: manifest.name,
16820
+ version: manifest.version,
16821
+ text,
16822
+ depends: namesIn(manifest, DEPENDENCY_SECTIONS)
16822
16823
  })));
16824
+ const hiddenAt = (file, text) => pipe(decodePackageJson(text), Option.filter((manifest) => manifest.private === true), Option.flatMap((manifest) => Option.map(Option.fromUndefinedOr(manifest.name), (name) => [name, {
16825
+ directory: directoryOf$1(file),
16826
+ depends: namesIn(manifest, DEPENDENCY_SECTIONS)
16827
+ }])));
16828
+ const visit$1 = (hidden, seen, name) => {
16829
+ if (seen.has(name)) return seen;
16830
+ return Option.match(Option.fromUndefinedOr(hidden.get(name)), {
16831
+ onNone: () => seen,
16832
+ onSome: (found) => {
16833
+ const added = /* @__PURE__ */ new Set([...seen, name]);
16834
+ return Array$1.reduce(found.depends, added, (next, dependency) => visit$1(hidden, next, dependency));
16835
+ }
16836
+ });
16837
+ };
16838
+ const bundledBy = (hidden, depends) => [...Array$1.reduce(depends, /* @__PURE__ */ new Set(), (seen, name) => visit$1(hidden, seen, name))];
16839
+ const hiddenPackagesIn = (manifests) => new Map(pipe(manifests, Array$1.flatMap(({ file, text }) => Option.toArray(hiddenAt(file, text)))));
16823
16840
  const versionAt = (name, text) => pipe(text, Option.flatMap(decodeVersionedPackageJson), Option.filter((manifest) => manifest.name === name), Option.map(({ version }) => version), Option.filter((version) => semver.valid(version) !== null));
16824
16841
  const versionLine = (text) => pipe(String$1.split(text, "\n"), Array$1.findFirstIndex((line) => String$1.includes("\"version\"")(line)), Option.match({
16825
16842
  onNone: () => FIRST_LINE$1,
@@ -16838,7 +16855,11 @@ const floorOf$1 = (versions) => {
16838
16855
  });
16839
16856
  return floor;
16840
16857
  };
16841
- const message = ({ name, version }, floor) => `${name} changed, but its version ${version} is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;
16858
+ const changedPart = (hidden, changed, pack) => {
16859
+ if (shippedChange(pack.directory, changed)) return Option.some(pack.name);
16860
+ return pipe(bundledBy(hidden, pack.depends), Array$1.findFirst((name) => Option.exists(Option.fromUndefinedOr(hidden.get(name)), ({ directory }) => shippedChange(directory, changed))), Option.map((name) => `${name}, which ${pack.name} bundles,`));
16861
+ };
16862
+ const message = ({ name, version }, part, floor) => `${part} changed, but the version of ${name}, ${version}, is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;
16842
16863
  /** @internal */
16843
16864
  const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPackageVersions(root) {
16844
16865
  const files = yield* RepositoryFiles;
@@ -16847,8 +16868,11 @@ const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPa
16847
16868
  const tip = yield* baseName$1;
16848
16869
  const changed = yield* files.changedFiles(root, base.value);
16849
16870
  const manifests = yield* manifestTexts(root);
16850
- const packages = pipe(manifests, Array$1.map(({ file, text }) => packageAt(file, text)));
16851
- const found = yield* Effect.forEach(pipe(Array$1.getSomes(packages), Array$1.filter(({ directory }) => shippedChange(directory, changed))), (pack) => Effect.gen(function* compare() {
16871
+ const hidden = hiddenPackagesIn(manifests);
16872
+ const found = yield* Effect.forEach(pipe(manifests, Array$1.flatMap(({ file, text }) => Option.toArray(packageAt(file, text))), Array$1.flatMap((pack) => pipe(changedPart(hidden, changed, pack), Option.map((part) => ({
16873
+ pack,
16874
+ part
16875
+ })), Option.toArray))), ({ pack, part }) => Effect.gen(function* compare() {
16852
16876
  const before = yield* files.readAtRevision(root, base.value, pack.file);
16853
16877
  const claimed = yield* files.readAtRevision(root, tip, pack.file);
16854
16878
  const floor = floorOf$1([versionAt(pack.name, before), versionAt(pack.name, claimed)]);
@@ -16857,7 +16881,7 @@ const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPa
16857
16881
  line: versionLine(pack.text),
16858
16882
  column: FIRST_COLUMN$1,
16859
16883
  rule: RULE$15,
16860
- message: message(pack, lowest)
16884
+ message: message(pack, part, lowest)
16861
16885
  })), Option.toArray);
16862
16886
  }), { concurrency: READ_CONCURRENCY$3 });
16863
16887
  return Array$1.flatten(found);