@mnci/cli 4.1.1 → 4.1.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/dist/cli.js CHANGED
@@ -250,7 +250,7 @@ var import_node_path2 = require("path");
250
250
  var DEFAULT_STACK = { testRunner: "jest" };
251
251
  var TS_COMPILER_DEPENDENCIES = {
252
252
  "@typescript/native": "npm:typescript@^7.0.2",
253
- typescript: "npm:@typescript/typescript6@^6.0.2"
253
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
254
254
  };
255
255
  function registryUrl(registry) {
256
256
  if (registry.kind === "azure-artifacts") {
@@ -447,7 +447,7 @@ var ESLINT_PEER_OVERRIDES = {
447
447
  // both — and forcing those to v5 breaks them. So the blast radius is one
448
448
  // dependency edge per named parent, and a test asserts there is no top-level
449
449
  // entry.
450
- nx: { "brace-expansion": "^5.0.9" },
450
+ "nx": { "brace-expansion": "^5.0.9" },
451
451
  "@nx/js": { "brace-expansion": "^5.0.9" },
452
452
  "@nx/eslint": { "brace-expansion": "^5.0.9" },
453
453
  "@nx/eslint-plugin": { "brace-expansion": "^5.0.9" },
@@ -456,14 +456,14 @@ var ESLINT_PEER_OVERRIDES = {
456
456
  // which every publishable `npm-lib` gets. GHSA-2v37-7h3g-55p8 is high, fixed in
457
457
  // 3.3.18, and the fix is a patch — so unlike the entry above this one is not
458
458
  // even a trade, just a version nobody had bumped yet.
459
- postcss: { nanoid: "^3.3.18" }
459
+ "postcss": { nanoid: "^3.3.18" }
460
460
  };
461
461
  var SECURITY_OVERRIDES = {
462
462
  "brace-expansion@4.0.0 - 5.0.8": "^5.0.9"
463
463
  };
464
464
  function eslintToolchainDependencies(nxVersion) {
465
465
  return {
466
- eslint: ESLINT_VERSION,
466
+ "eslint": ESLINT_VERSION,
467
467
  "@nx/eslint": nxVersion,
468
468
  "@nx/eslint-plugin": nxVersion,
469
469
  "@mnci/eslint-config": eslintConfigSpec()
@@ -513,8 +513,13 @@ var ESLINT_BLOCK_INVENTORY = `// WHAT IS IN HERE. Each line is one config block,
513
513
  // (Vitest's globals too; the two stacks share them)
514
514
  // mnci/nx-dependency-checks @nx/eslint-plugin, on publishable packages' manifests
515
515
  // mnci/standard JavaScript Standard Style as ESLint rules \u2014 the
516
- // whole formatting opinion. Composed LAST, on
517
- // purpose: nothing may follow that disables it.
516
+ // whole formatting opinion, a faithful port of
517
+ // neostandard
518
+ // mnci/house-style the deliberate departures from Standard:
519
+ // trailing commas, aligned object values,
520
+ // consistent-as-needed quote-props, a blank line
521
+ // before return. Composed LAST, on purpose:
522
+ // nothing may follow that disables it.
518
523
  //
519
524
  // To list them as ESLint actually resolves them: npx eslint --inspect-config
520
525
  `;
@@ -657,14 +662,14 @@ function vscodeWorkspace(workspaceName, existingTasks, existingLaunch, existingS
657
662
  );
658
663
  }
659
664
  var ROOT_SCRIPTS = {
660
- build: "nx run-many -t build",
661
- lint: "nx run-many -t lint",
662
- test: "nx run-many -t test",
663
- typecheck: "nx run-many -t typecheck",
664
- affected: "nx affected -t lint,typecheck,test,build",
665
- graph: "nx graph",
665
+ "build": "nx run-many -t build",
666
+ "lint": "nx run-many -t lint",
667
+ "test": "nx run-many -t test",
668
+ "typecheck": "nx run-many -t typecheck",
669
+ "affected": "nx affected -t lint,typecheck,test,build",
670
+ "graph": "nx graph",
666
671
  "release:preview": "nx release --dry-run",
667
- prepare: "husky"
672
+ "prepare": "husky"
668
673
  };
669
674
  function rootScripts() {
670
675
  return {
@@ -673,7 +678,7 @@ function rootScripts() {
673
678
  // `format:check`: `lint` already reports formatting as ordinary errors.
674
679
  // Carrying a second script that ran the same tool twice would just make a
675
680
  // CI run slower for no extra coverage.
676
- format: "eslint . --fix --cache",
681
+ "format": "eslint . --fix --cache",
677
682
  "python:install": `${PYTHON_INSTALL_GUARD} && ${PYTHON_WORKSPACE_INSTALL_GUARD}`
678
683
  };
679
684
  }
@@ -1414,10 +1419,13 @@ var ROLLUP_ARG_ONE_WITH_SOURCE_MAPS = [
1414
1419
  ""
1415
1420
  ].join("\n");
1416
1421
  function hasRollupSourceMaps(config) {
1417
- return config.includes("sourceMap: true");
1422
+ return /sourceMap\s*:\s*true\b/.test(config);
1423
+ }
1424
+ function canRepairRollupConfig(config) {
1425
+ return config.includes(ROLLUP_ARG_ONE_BOUNDARY);
1418
1426
  }
1419
1427
  function withRollupSourceMaps(config) {
1420
- if (hasRollupSourceMaps(config) || !config.includes(ROLLUP_ARG_ONE_BOUNDARY)) {
1428
+ if (hasRollupSourceMaps(config) || !canRepairRollupConfig(config)) {
1421
1429
  return config;
1422
1430
  }
1423
1431
  const withCompiler = config.replace(GENERATED_COMPILER, () => SOURCE_MAP_CAPABLE_COMPILER);
@@ -1446,6 +1454,28 @@ function repairRollupSourceMaps(workspaceRoot) {
1446
1454
  }
1447
1455
  return changed;
1448
1456
  }
1457
+ function resolveRequireTarget(fromDir, specifier) {
1458
+ const base = (0, import_node_path3.join)(fromDir, specifier);
1459
+ return [base, `${base}.cjs`, `${base}.js`].find((candidate) => fileExists(candidate));
1460
+ }
1461
+ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()) {
1462
+ if (visited.has(configPath)) {
1463
+ return "";
1464
+ }
1465
+ visited.add(configPath);
1466
+ let text;
1467
+ try {
1468
+ text = (0, import_node_fs3.readFileSync)(configPath, "utf8");
1469
+ } catch {
1470
+ return "";
1471
+ }
1472
+ const specifiers = Array.from(
1473
+ text.matchAll(/require\((['"])(\.[^'"]*)\1\)/g),
1474
+ (match) => match[2]
1475
+ );
1476
+ const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path3.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
1477
+ return [text, ...requiredText].join("\n");
1478
+ }
1449
1479
  var SOURCEMAP_PATH_TRANSFORM = [
1450
1480
  " // Added by MoNecromanCI. rollup hands sourcemapPathTransform an OS-NATIVE",
1451
1481
  " // path with one parent segment too many, so `sources` resolve to nothing",
@@ -2864,9 +2894,9 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
2864
2894
  // src/deps/semver.ts
2865
2895
  var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
2866
2896
  var UPDATE_KIND_LABELS = {
2867
- patch: { title: "Patch Update", blurb: "Backwards-compatible bug fixes." },
2868
- minor: { title: "Minor Update", blurb: "New backwards-compatible features." },
2869
- major: { title: "Major Update", blurb: "Potentially breaking API changes. Use caution." },
2897
+ "patch": { title: "Patch Update", blurb: "Backwards-compatible bug fixes." },
2898
+ "minor": { title: "Minor Update", blurb: "New backwards-compatible features." },
2899
+ "major": { title: "Major Update", blurb: "Potentially breaking API changes. Use caution." },
2870
2900
  "non-semver": { title: "Non-Semver", blurb: "Versions less than 1.0.0, caution." }
2871
2901
  };
2872
2902
  var RANGE_OPERATORS = [">=", "<=", "^", "~", ">", "<", "="];
@@ -3452,18 +3482,19 @@ function checkRollupSourceMaps(workspaceRoot) {
3452
3482
  cwd: workspaceRoot
3453
3483
  }).map((config) => toPosix2(config));
3454
3484
  return configs.flatMap((relativePath) => {
3485
+ const configPath = (0, import_node_path14.join)(workspaceRoot, relativePath);
3455
3486
  let config;
3456
3487
  try {
3457
- config = (0, import_node_fs8.readFileSync)((0, import_node_path14.join)(workspaceRoot, relativePath), "utf8");
3488
+ config = (0, import_node_fs8.readFileSync)(configPath, "utf8");
3458
3489
  } catch {
3459
3490
  return [];
3460
3491
  }
3461
3492
  return [
3462
3493
  {
3463
3494
  check: `source maps enabled in ${relativePath}`,
3464
- ok: hasRollupSourceMaps(config),
3495
+ ok: hasRollupSourceMaps(resolveRollupConfigText(configPath)),
3465
3496
  detail: "rollup emits no .js.map without it, so a breakpoint in a .ts file can never bind",
3466
- remedy: "run `mnci upgrade`, which adds it to every rollup config"
3497
+ remedy: canRepairRollupConfig(config) ? "run `mnci upgrade`, which adds it to every rollup config" : "this config delegates via require() to a shared base mnci does not own \u2014 add `sourceMap: true` to withNx's first argument there by hand; `mnci upgrade` cannot repair a config in this shape"
3467
3498
  }
3468
3499
  ];
3469
3500
  });