@hublo/sentinel 1.2.0-alpha.30 → 1.2.0-alpha.32

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.
@@ -22,7 +22,7 @@ import {
22
22
  registerAdapters,
23
23
  resolve,
24
24
  resolveBin
25
- } from "../chunk-37Y7RALA.js";
25
+ } from "../chunk-UULHGNMK.js";
26
26
 
27
27
  // bin/sentinel.ts
28
28
  import { program } from "commander";
@@ -1037,14 +1037,15 @@ var movedSpecifiers = (toolchain) => new Set(toolchain.owned.map((entry) => entr
1037
1037
  var defaultExportNames = (toolchain) => Object.fromEntries(
1038
1038
  toolchain.owned.filter((entry) => entry.default !== void 0).map((entry) => [entry.specifier, entry.default])
1039
1039
  );
1040
- function renderImport(bindings, presetSpecifier) {
1040
+ function renderImport(bindings, presetSpecifier, semi) {
1041
1041
  const render = (list) => list.map((b) => b.exported === b.local ? b.exported : `${b.exported} as ${b.local}`).sort((left, right) => left.localeCompare(right)).join(", ");
1042
+ const end = semi ? ";" : "";
1042
1043
  const values = bindings.filter((b) => !b.typeOnly);
1043
1044
  const types = bindings.filter((b) => b.typeOnly);
1044
1045
  const lines = [];
1045
- if (values.length > 0) lines.push(`import { ${render(values)} } from '${presetSpecifier}'`);
1046
+ if (values.length > 0) lines.push(`import { ${render(values)} } from '${presetSpecifier}'${end}`);
1046
1047
  if (types.length > 0) {
1047
- lines.push(`import type { ${render(types)} } from '${presetSpecifier}'`);
1048
+ lines.push(`import type { ${render(types)} } from '${presetSpecifier}'${end}`);
1048
1049
  }
1049
1050
  return lines.join("\n");
1050
1051
  }
@@ -1113,7 +1114,8 @@ function rewriteToolchainImports(toolchain, source, fileName) {
1113
1114
  const after = out.slice(span.end).match(/^\r?\n/)?.[0].length ?? 0;
1114
1115
  out = out.slice(0, span.start) + out.slice(span.end + after);
1115
1116
  }
1116
- out = out.slice(0, first.start) + renderImport(bindings, toolchain.presetSpecifier) + out.slice(first.end);
1117
+ const semi = source.slice(first.start, first.end).trimEnd().endsWith(";");
1118
+ out = out.slice(0, first.start) + renderImport(bindings, toolchain.presetSpecifier, semi) + out.slice(first.end);
1117
1119
  return {
1118
1120
  kind: "rewritten",
1119
1121
  source: out,
@@ -5584,8 +5586,6 @@ function registerLint() {
5584
5586
 
5585
5587
  // src/roles/test/adapters/vitest/vitest.adapter.ts
5586
5588
  import { spawnSync as spawnSync5 } from "child_process";
5587
- import { existsSync as existsSync26 } from "fs";
5588
- import { join as join30 } from "path";
5589
5589
 
5590
5590
  // src/roles/test/presets/toolchain.json
5591
5591
  var toolchain_default2 = {
@@ -5846,12 +5846,10 @@ function plan3(context) {
5846
5846
 
5847
5847
  // src/roles/test/adapters/vitest/vitest.adapter.ts
5848
5848
  function resolveVitest(cwd) {
5849
- const fromSentinel = join30(
5850
- new URL("../../../../../node_modules/.bin/vitest", import.meta.url).pathname
5851
- );
5852
- if (existsSync26(fromSentinel)) return { bin: fromSentinel, origin: "sentinel" };
5853
- const fromModule = join30(cwd, "node_modules", ".bin", "vitest");
5854
- return existsSync26(fromModule) ? { bin: fromModule, origin: "module" } : { bin: void 0, origin: "module" };
5849
+ const fromSentinel = binFromOwnInstall("vitest", "vitest");
5850
+ if (fromSentinel !== void 0) return { bin: fromSentinel, origin: "sentinel" };
5851
+ const fromModule = resolveBin(cwd, "vitest");
5852
+ return fromModule !== void 0 ? { bin: fromModule, origin: "module" } : { bin: void 0, origin: "module" };
5855
5853
  }
5856
5854
  var VitestAdapter = class extends BaseAdapter {
5857
5855
  target = "test";
@@ -5928,9 +5926,9 @@ function registerTest() {
5928
5926
 
5929
5927
  // src/roles/typescript/adapters/tsc/tsc.adapter.ts
5930
5928
  import { spawnSync as spawnSync6 } from "child_process";
5931
- import { existsSync as existsSync27, readFileSync as readFileSync25 } from "fs";
5929
+ import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
5932
5930
  import { createRequire as createRequire4 } from "module";
5933
- import { join as join32 } from "path";
5931
+ import { join as join31 } from "path";
5934
5932
 
5935
5933
  // src/roles/typescript/presets/nest.json
5936
5934
  var nest_default2 = {
@@ -6112,7 +6110,7 @@ function readTsconfigAdoption(cwd) {
6112
6110
 
6113
6111
  // src/roles/typescript/adapters/tsc/plan.ts
6114
6112
  import { readFileSync as readFileSync24 } from "fs";
6115
- import { join as join31 } from "path";
6113
+ import { join as join30 } from "path";
6116
6114
 
6117
6115
  // src/roles/typescript/typecheck-script.ts
6118
6116
  var SENTINEL_TYPECHECK_COMMAND = "sentinel --run --typescript";
@@ -6205,7 +6203,7 @@ function planAdoption(context) {
6205
6203
  };
6206
6204
  }
6207
6205
  const existing = parseJsonc(
6208
- readFileSync24(join31(context.cwd, target.path), "utf8"),
6206
+ readFileSync24(join30(context.cwd, target.path), "utf8"),
6209
6207
  target.path
6210
6208
  );
6211
6209
  const extendsChain = composeExtends(existing.extends, preset);
@@ -6343,7 +6341,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6343
6341
  let chain;
6344
6342
  try {
6345
6343
  const parsed = parseJsonc(
6346
- readFileSync25(join32(cwd, target.path), "utf8"),
6344
+ readFileSync25(join31(cwd, target.path), "utf8"),
6347
6345
  target.path
6348
6346
  );
6349
6347
  chain = parsed.extends;
@@ -6356,7 +6354,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6356
6354
  );
6357
6355
  if (preset === void 0) return void 0;
6358
6356
  try {
6359
- createRequire4(join32(cwd, "noop.js")).resolve(preset);
6357
+ createRequire4(join31(cwd, "noop.js")).resolve(preset);
6360
6358
  return void 0;
6361
6359
  } catch {
6362
6360
  return preset;
@@ -6452,7 +6450,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6452
6450
  referencedProjects(cwd, config) {
6453
6451
  try {
6454
6452
  const parsed = parseJsonc(
6455
- readFileSync25(join32(cwd, config), "utf8"),
6453
+ readFileSync25(join31(cwd, config), "utf8"),
6456
6454
  config
6457
6455
  );
6458
6456
  const referenced = (parsed.references ?? []).map((reference) => reference.path).filter((path) => typeof path === "string" && path.length > 0);
@@ -6468,7 +6466,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6468
6466
  * check.
6469
6467
  */
6470
6468
  typecheckTarget(cwd) {
6471
- if (existsSync27(join32(cwd, "tsconfig.json"))) return "tsconfig.json";
6469
+ if (existsSync26(join31(cwd, "tsconfig.json"))) return "tsconfig.json";
6472
6470
  const target = resolveTsconfigTarget(cwd);
6473
6471
  return target.reason === "none" ? null : target.path;
6474
6472
  }
@@ -6673,7 +6671,7 @@ function replaceLines(current, replacements) {
6673
6671
  }
6674
6672
 
6675
6673
  // src/core/apply-plan.ts
6676
- import { existsSync as existsSync28, readFileSync as readFileSync26, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
6674
+ import { existsSync as existsSync27, readFileSync as readFileSync26, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
6677
6675
  import { resolve as resolve4, sep } from "path";
6678
6676
  import { applyEdits, findNodeAtLocation, modify, parseTree } from "jsonc-parser";
6679
6677
 
@@ -6692,7 +6690,7 @@ function resolveWithinRoot(cwd, relativePath) {
6692
6690
  return absolutePath;
6693
6691
  }
6694
6692
  function readIfExists(absolutePath) {
6695
- return existsSync28(absolutePath) ? readFileSync26(absolutePath, "utf8") : void 0;
6693
+ return existsSync27(absolutePath) ? readFileSync26(absolutePath, "utf8") : void 0;
6696
6694
  }
6697
6695
  function* leaves(value, prefix = []) {
6698
6696
  for (const [key, keyValue] of Object.entries(value)) {
@@ -6810,8 +6808,8 @@ function applyPlan(cwd, plan4) {
6810
6808
  }
6811
6809
 
6812
6810
  // src/core/config/preset-evidence.ts
6813
- import { existsSync as existsSync29, readdirSync as readdirSync4, readFileSync as readFileSync27 } from "fs";
6814
- import { join as join33 } from "path";
6811
+ import { existsSync as existsSync28, readdirSync as readdirSync4, readFileSync as readFileSync27 } from "fs";
6812
+ import { join as join32 } from "path";
6815
6813
  var PATH_SIGNALS = [
6816
6814
  {
6817
6815
  preset: "nest",
@@ -6825,8 +6823,8 @@ var DEPENDENCY_SIGNALS = [
6825
6823
  { preset: "nest", pattern: /^@nestjs\// }
6826
6824
  ];
6827
6825
  function dependencyNames(cwd) {
6828
- const path = join33(cwd, "package.json");
6829
- if (!existsSync29(path)) return [];
6826
+ const path = join32(cwd, "package.json");
6827
+ if (!existsSync28(path)) return [];
6830
6828
  try {
6831
6829
  const manifest = parseJsonc(
6832
6830
  readFileSync27(path, "utf8"),
@@ -6852,7 +6850,7 @@ function declaresJsx(cwd) {
6852
6850
  for (const name of entries) {
6853
6851
  try {
6854
6852
  const config = parseJsonc(
6855
- readFileSync27(join33(cwd, name), "utf8"),
6853
+ readFileSync27(join32(cwd, name), "utf8"),
6856
6854
  name
6857
6855
  );
6858
6856
  if (config.compilerOptions?.jsx !== void 0) return true;
@@ -7032,4 +7030,4 @@ export {
7032
7030
  detectFramework,
7033
7031
  dispatch
7034
7032
  };
7035
- //# sourceMappingURL=chunk-37Y7RALA.js.map
7033
+ //# sourceMappingURL=chunk-UULHGNMK.js.map
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  registerAdapters,
8
8
  resolve,
9
9
  setDefaultRunner
10
- } from "./chunk-37Y7RALA.js";
10
+ } from "./chunk-UULHGNMK.js";
11
11
  export {
12
12
  BaseAdapter,
13
13
  all,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.2.0-alpha.30",
3
+ "version": "1.2.0-alpha.32",
4
4
  "description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",