@xemahq/repo-build-tooling 0.2.2 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/repo-build-tooling",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Dev-time build tooling shared by every Xema repository. Ships as plain ESM with zero dependencies so the published artifact is the reviewed source.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
@@ -29,7 +29,7 @@
29
29
  // examined.
30
30
  // ═══════════════════════════════════════════════════════════════════════════
31
31
  import { execFileSync } from 'node:child_process';
32
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
32
+ import { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
33
33
  import { join, relative } from 'node:path';
34
34
  import { pathToFileURL } from 'node:url';
35
35
 
@@ -173,6 +173,42 @@ function main() {
173
173
 
174
174
  // Importing this module must not run the scan — the test suite imports it for
175
175
  // `satisfies` alone.
176
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '.').href) {
176
+ //
177
+ // COMPARE REALPATHS. `import.meta.url` is the RESOLVED path of this file;
178
+ // `process.argv[1]` is the path the shell was handed. Inside the xema-monorepo
179
+ // aggregator those are different strings for the same file, because
180
+ // `node_modules/@xemahq/repo-build-tooling` is a symlink into the workspace and
181
+ // pnpm's bin shim execs THROUGH it:
182
+ //
183
+ // argv[1] …/node_modules/@xemahq/repo-build-tooling/src/check-…mjs
184
+ // resolved …/repos/xema-runtime-core/packages/sdks/repo-build-tooling/src/check-…mjs
185
+ //
186
+ // So the guard was false, `main()` never ran, and the bin printed NOTHING and
187
+ // exited 0 — the check reporting green while executing nothing, which is this
188
+ // fleet's most-repeated defect and the one it has the most machinery against.
189
+ //
190
+ // Measured 2026-08-21: `repos/xema-biome-sdk` carried two `workspace:^6.1.0`
191
+ // declarations against a local `@xemahq/biome-sdk@7.0.0` — the exact dropped
192
+ // build edge this file exists to catch, and a range pnpm refuses outright with
193
+ // ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE. `xema-check-workspace-ranges`
194
+ // exited 0 in silence; the same file run by its real path exited 1 and named
195
+ // both. Every carved repo's `pnpm check` and every pre-push hook in this
196
+ // checkout invoked it the silent way.
197
+ //
198
+ // A carved repo's own CI installs the PUBLISHED tarball, so there argv[1] is
199
+ // already a real path and the guard held. That is why the hole survived: it is
200
+ // invisible in exactly the lane people point at as proof.
201
+ const invokedPath = process.argv[1];
202
+ let invokedRealPath = null;
203
+ if (typeof invokedPath === 'string' && invokedPath.length > 0) {
204
+ try {
205
+ invokedRealPath = realpathSync(invokedPath);
206
+ } catch {
207
+ // Not a path on disk (a `node -e` entry, say). Nothing was invoked, so
208
+ // nothing should run — fall through as a plain import.
209
+ invokedRealPath = null;
210
+ }
211
+ }
212
+ if (invokedRealPath !== null && import.meta.url === pathToFileURL(invokedRealPath).href) {
177
213
  process.exit(main());
178
214
  }
@@ -303,7 +303,6 @@ function reExportsReach(entry, target, depth = 6, seen = new Set()) {
303
303
  } catch {
304
304
  return false;
305
305
  }
306
- const dir = dirname(entry);
307
306
  for (const m of src.matchAll(/require\("(\.[^"]*)"\)/g)) {
308
307
  let next;
309
308
  try {
@@ -499,7 +498,7 @@ async function assertScannable(dir) {
499
498
  }
500
499
  if (!s.isDirectory()) throw new ScrubFailure(`not a directory: ${dir}`);
501
500
 
502
- for await (const _file of walk(dir)) return; // eslint-disable-line no-unused-vars
501
+ for await (const _file of walk(dir)) return;
503
502
  throw new ScrubFailure(
504
503
  `output directory holds no compiled .js: ${dir}\n` +
505
504
  ` Same failure as a missing directory: nothing was scrubbed and nothing was verified.`,