@antelopejs/tooling-configs 0.8.1-next.370.g331ab2e → 0.8.1-next.371.gdeb362e

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
3
3
  import { s as repositoryRoot } from "../files-C0avD1Eo.mjs";
4
- import { i as runChecks, n as CI_TIER_ENV, t as CHECKS_SKIP_ENV } from "../checks-Dle6fMcR.mjs";
4
+ import { i as runChecks, n as CI_TIER_ENV, t as CHECKS_SKIP_ENV } from "../checks-CH55mAfP.mjs";
5
5
  import { parseArgs } from "node:util";
6
6
  //#region src/bin/checks.ts
7
7
  const SIGNAL_EXIT = /* @__PURE__ */ new Map([
package/dist/bin/sync.mjs CHANGED
@@ -9,7 +9,7 @@ import { _ as ciRenovateSyncCallers, a as GITATTRIBUTES_ARTIFACT, b as sharedWor
9
9
  import { i as gitFiles, s as repositoryRoot } from "../files-C0avD1Eo.mjs";
10
10
  import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-CdgBviGf.mjs";
11
11
  import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
12
- import { a as verifyLayers, c as pnpmLockfiles, d as moveDependencyRanges, f as runPnpm, l as inWorkspace, o as matchingScripts, r as droppedChecksSteps, s as stepsOf, u as installsWithPnpm } from "../checks-Dle6fMcR.mjs";
12
+ import { a as verifyLayers, c as pnpmLockfiles, d as moveDependencyRanges, f as runPnpm, l as inWorkspace, o as matchingScripts, r as droppedChecksSteps, s as stepsOf, u as installsWithPnpm } from "../checks-CH55mAfP.mjs";
13
13
  import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-B30kar1T.mjs";
14
14
  import { c as typescript } from "../suppressions-BWTxQbDL.mjs";
15
15
  import { t as DEFAULT_SHARED } from "../map-C3j9QGqf.mjs";
@@ -13,7 +13,7 @@ import { basename, dirname, join, posix, relative, resolve, sep } from "node:pat
13
13
  import { spawnSync } from "node:child_process";
14
14
  import { createHash } from "node:crypto";
15
15
  import { tmpdir } from "node:os";
16
- import { Range, gtr, minVersion, prerelease, satisfies, valid, validRange } from "semver";
16
+ import { Range, gtr, major, minVersion, minor, prerelease, satisfies, valid, validRange } from "semver";
17
17
  import { gunzipSync } from "node:zlib";
18
18
  import { minimatch } from "minimatch";
19
19
  //#region src/guardrails/run-pnpm.ts
@@ -136,6 +136,26 @@ function compareVersions(a, b) {
136
136
  function cappedRange(floor) {
137
137
  return floor[0] === 0 ? `>=${formatVersion(floor)} <${formatVersion(nextMinor(floor))}` : `~${formatVersion(floor)}`;
138
138
  }
139
+ /** A preview `next` publishes ahead of release `X.Y.Z`: `X.Y.Z-next.<commit count>.g<short sha>`. */
140
+ const PREVIEW = /^(\d+)\.(\d+)\.(\d+)-next\.\d+\.g[0-9a-f]+$/u;
141
+ /**
142
+ * The release `version` previews, as `[major, minor, patch]`, when it is a preview `next` publishes; `undefined` for
143
+ * any other version or range. A repository tests another one's unreleased change by pinning its preview exactly, and the
144
+ * release train turns that pin into the capped range on the release at release time.
145
+ */
146
+ function previewRelease(version) {
147
+ const match = PREVIEW.exec(version.trim());
148
+ return match ? toVersion(match) : void 0;
149
+ }
150
+ /** Whether `version` is a preview `next` publishes, such as `0.5.2-next.926.gdaa3203`. */
151
+ function isPreview(version) {
152
+ return previewRelease(version) !== void 0;
153
+ }
154
+ /** `spec` as the release train publishes it: the capped range on the release an exact preview pin previews, else `spec`. */
155
+ function releasedSpec(spec) {
156
+ const release = previewRelease(spec);
157
+ return release ? cappedRange(release) : spec;
158
+ }
139
159
  function isCapped(bounds, local) {
140
160
  if (!bounds) return false;
141
161
  const { floor, ceiling } = bounds;
@@ -165,9 +185,12 @@ function publishedSpec(spec, local) {
165
185
  /**
166
186
  * The violation of one `@antelopejs/*` entry, if any. A `workspace:` spec is
167
187
  * judged as pnpm publishes it, and skipped in a private manifest, which is
168
- * never published, or when the sibling's version is not known.
188
+ * never published, or when the sibling's version is not known. An exact pin
189
+ * on a preview of a package outside the repository passes: the release train
190
+ * publishes it as a capped range.
169
191
  */
170
192
  function checkEntry(manifest, field, [name, spec], local) {
193
+ if (local === void 0 && isPreview(spec)) return void 0;
171
194
  const workspace = spec.startsWith(WORKSPACE_PREFIX);
172
195
  const localVersion = local === void 0 ? void 0 : readFloor(local);
173
196
  let published = spec;
@@ -238,7 +261,7 @@ function interfaceRanges(manifest) {
238
261
  }
239
262
  function describeViolation(violation) {
240
263
  const { field, name, spec, local, expected } = violation;
241
- return `${field}["${name}"] is "${spec}": AntelopeJS packages ship breaking changes in minor releases, so it must stop below the next minor${local === void 0 ? "" : ` and admit ${local}, the version in this repository`}; ${expected ? `use "${expected}"` : "declare it as >=<floor> <next minor> on 0.x or ~<floor> from 1.0"}`;
264
+ return `${field}["${name}"] is "${spec}": AntelopeJS packages ship breaking changes in minor releases, so it must stop below the next minor${local === void 0 ? "" : ` and admit ${local}, the version in this repository`} or pin a preview exactly, such as "0.5.2-next.926.gdaa3203"; ${expected ? `use "${expected}"` : "declare it as >=<floor> <next minor> on 0.x or ~<floor> from 1.0"}`;
242
265
  }
243
266
  //#endregion
244
267
  //#region src/guardrails/registry.ts
@@ -438,7 +461,8 @@ async function dmsReleases(local) {
438
461
  * `local` implements its interface on, since a project loads the interface version that release is built against. An
439
462
  * interface no such release implements is held instead to the `latest` dist-tag of its package: one line when every
440
463
  * release the range admits sits below it, and only when every published DMS release could be read, since an unread one
441
- * may implement it. A line that gives the fix an earlier one gave is skipped. A package whose release cannot be read,
464
+ * may implement it. An exact pin on a preview is judged as the capped range on its release, the range the release train
465
+ * publishes in its place. A line that gives the fix an earlier one gave is skipped. A package whose release cannot be read,
442
466
  * or whose `latest` is a prerelease, is skipped, so a registry outage leaves only the cap rule deciding the step.
443
467
  */
444
468
  async function staleRanges(ranges, local) {
@@ -446,9 +470,10 @@ async function staleRanges(ranges, local) {
446
470
  const names = [...new Set(ranges.map(({ name }) => name))];
447
471
  const [newest, { releases, complete }] = await Promise.all([Promise.all(names.map(async (name) => [name, await publishedVersion(name)])).then((entries) => new Map(entries)), dmsReleases(local)]);
448
472
  return ranges.flatMap(({ path, field, name, spec }) => {
449
- if (validRange(spec) === null) return [];
473
+ const released = releasedSpec(spec);
474
+ if (validRange(released) === null) return [];
450
475
  const implemented = implementations(name, releases);
451
- const findings = (implemented.length ? implemented.map((implementation) => outsideImplemented(spec, implementation)) : complete ? [belowNewest(spec, newest.get(name))] : []).filter((finding) => finding !== void 0);
476
+ const findings = (implemented.length ? implemented.map((implementation) => outsideImplemented(released, implementation)) : complete ? [belowNewest(released, newest.get(name))] : []).filter((finding) => finding !== void 0);
452
477
  return findings.filter(({ expected }, index) => findings.findIndex((finding) => finding.expected === expected) === index).map(({ reason, expected }) => `${path}: ${field}["${name}"] is "${spec}", ${reason}, and @antelopejs/core loads one copy of each interface; use "${expected}"\n`);
453
478
  });
454
479
  }
@@ -1280,6 +1305,8 @@ const SINGLETON = /^@antelopejs\/interface-/u;
1280
1305
  const PACKAGE_FIELDS = ["dependencies", "optionalDependencies"];
1281
1306
  /** How to move every importer onto one copy while pnpm keeps every other locked version, which `pnpm dedupe` does not. */
1282
1307
  const REPAIR = " Set the direct specifier that locks the older copy to the newer version, run `pnpm install --lockfile-only`, then restore the specifier.\n";
1308
+ /** How a puller that is a manifest of the repository, not a locked package, is named. */
1309
+ const IMPORTER = "importer ";
1283
1310
  /** A `name@version` key or a resolved version without its peer suffix, `(peer@1)`, which names no other copy. */
1284
1311
  function withoutPeers(reference) {
1285
1312
  const open = reference.indexOf("(");
@@ -1325,13 +1352,24 @@ function documentCopies(lockfile) {
1325
1352
  const packages = mapping(lockfile, "packages");
1326
1353
  for (const parsed of keys(packages).map(packageKey)) if (parsed && SINGLETON.test(parsed.name)) copies.set(parsed.name, (copies.get(parsed.name) ?? /* @__PURE__ */ new Map()).set(parsed.version, /* @__PURE__ */ new Set()));
1327
1354
  const importers = mapping(lockfile, "importers");
1328
- for (const importer of importers ? keys(importers) : ["."]) addPullers(copies, importers ? mapping(importers, importer) : lockfile, DIRECT_FIELDS, `importer "${importer}"`);
1355
+ for (const importer of importers ? keys(importers) : ["."]) addPullers(copies, importers ? mapping(importers, importer) : lockfile, DIRECT_FIELDS, `${IMPORTER}"${importer}"`);
1329
1356
  const resolved = mapping(lockfile, "snapshots") ?? packages;
1330
1357
  for (const key of keys(resolved)) addPullers(copies, mapping(resolved, key), PACKAGE_FIELDS, withoutPeers(key.replace(/^\//u, "")));
1331
1358
  return copies;
1332
1359
  }
1360
+ /** Whether `other` is a release, not a prerelease, on the minor of `version`. */
1361
+ const releaseOnMinor = (version, other) => valid(other) !== null && prerelease(other) === null && major(version) === major(other) && minor(version) === minor(other);
1362
+ const pulledByImporter = (by) => [...by].some((puller) => puller.startsWith(IMPORTER));
1363
+ /**
1364
+ * Whether the copy at `version` is a preview a manifest of the repository pins beside only releases on its minor that
1365
+ * locked packages pull, never a manifest: the repository tests that preview ahead of its release, which the packages
1366
+ * locking the older copy then admit.
1367
+ */
1368
+ function pinnedPreview(version, by, versions) {
1369
+ return isPreview(version) && pulledByImporter(by) && [...versions].every(([other, pullers]) => other === version || releaseOnMinor(version, other) && !pulledByImporter(pullers));
1370
+ }
1333
1371
  function report(file, copies) {
1334
- return [...copies].filter(([, versions]) => versions.size > 1).map(([name, versions]) => `${file} resolves "${name}" at ${versions.size} versions, and an interface package must load once:\n${[...versions].map(([version, by]) => ` ${version}, pulled by ${[...by].join(", ") || "nothing"}\n`).join("")}${REPAIR}`).join("");
1372
+ return [...copies].filter(([, versions]) => [...versions].filter(([version, by]) => !pinnedPreview(version, by, versions)).length > 1).map(([name, versions]) => `${file} resolves "${name}" at ${versions.size} versions, and an interface package must load once:\n${[...versions].map(([version, by]) => ` ${version}, pulled by ${[...by].join(", ") || "nothing"}\n`).join("")}${REPAIR}`).join("");
1335
1373
  }
1336
1374
  /** The folder holding a project's module locks, whose dev-only copies no production install reaches. */
1337
1375
  const MODULE_LOCKS = "antelope-lock";
@@ -1342,7 +1380,8 @@ function pnpmLockfiles(root) {
1342
1380
  /**
1343
1381
  * Fails when a `pnpm-lock.yaml` of the repository resolves an AntelopeJS interface package, any `@antelopejs/interface-*`,
1344
1382
  * at more than one version: each copy carries its own runtime, so two copies in one process break the contract between
1345
- * modules, or throw on a runtime protocol mismatch. Names, for each version, the importers and packages that pull it.
1383
+ * modules, or throw on a runtime protocol mismatch. A preview a manifest of the repository pins beside only releases on
1384
+ * its minor does not count. Names, for each version, the importers and packages that pull it.
1346
1385
  * Reads the lockfiles only: it spawns no package manager, writes no file and fetches nothing. Returns what failed, empty
1347
1386
  * when every interface package resolves once.
1348
1387
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.8.1-next.370.g331ab2e",
3
+ "version": "0.8.1-next.371.gdeb362e",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and a dependency range check",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -152,7 +152,7 @@
152
152
  "engines": {
153
153
  "node": ">=22.18.0"
154
154
  },
155
- "gitHead": "331ab2eae3f939bd665efe0b93657f78a8aa2a40",
155
+ "gitHead": "deb362eaa83fbb10f7c194934702e7d1be09b8e7",
156
156
  "scripts": {
157
157
  "build": "tsdown",
158
158
  "lint": "oxlint",