@westbayberry/dg 1.0.9 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/index.mjs +26 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3296,7 +3296,7 @@ var require_react_development = __commonJS({
3296
3296
  }
3297
3297
  return dispatcher.useContext(Context);
3298
3298
  }
3299
- function useState5(initialState) {
3299
+ function useState6(initialState) {
3300
3300
  var dispatcher = resolveDispatcher();
3301
3301
  return dispatcher.useState(initialState);
3302
3302
  }
@@ -3308,7 +3308,7 @@ var require_react_development = __commonJS({
3308
3308
  var dispatcher = resolveDispatcher();
3309
3309
  return dispatcher.useRef(initialValue);
3310
3310
  }
3311
- function useEffect12(create2, deps) {
3311
+ function useEffect13(create2, deps) {
3312
3312
  var dispatcher = resolveDispatcher();
3313
3313
  return dispatcher.useEffect(create2, deps);
3314
3314
  }
@@ -4091,7 +4091,7 @@ var require_react_development = __commonJS({
4091
4091
  exports.useContext = useContext7;
4092
4092
  exports.useDebugValue = useDebugValue;
4093
4093
  exports.useDeferredValue = useDeferredValue;
4094
- exports.useEffect = useEffect12;
4094
+ exports.useEffect = useEffect13;
4095
4095
  exports.useId = useId;
4096
4096
  exports.useImperativeHandle = useImperativeHandle;
4097
4097
  exports.useInsertionEffect = useInsertionEffect;
@@ -4099,7 +4099,7 @@ var require_react_development = __commonJS({
4099
4099
  exports.useMemo = useMemo4;
4100
4100
  exports.useReducer = useReducer5;
4101
4101
  exports.useRef = useRef6;
4102
- exports.useState = useState5;
4102
+ exports.useState = useState6;
4103
4103
  exports.useSyncExternalStore = useSyncExternalStore;
4104
4104
  exports.useTransition = useTransition;
4105
4105
  exports.version = ReactVersion;
@@ -38881,7 +38881,7 @@ var init_LoginApp = __esm({
38881
38881
  "Logged in as ",
38882
38882
  state.email
38883
38883
  ] }),
38884
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "API key saved to ~/.dgrc.json" }),
38884
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Credentials saved." }),
38885
38885
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
38886
38886
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
38887
38887
  "Run ",
@@ -39994,7 +39994,7 @@ async function runStaticLogin() {
39994
39994
  process.stderr.write(
39995
39995
  import_chalk4.default.green(`
39996
39996
  Logged in as ${result.email ?? "unknown"}
39997
- `) + import_chalk4.default.dim(" API key saved to ~/.dgrc.json\n\n")
39997
+ `) + import_chalk4.default.dim(" Credentials saved.\n\n")
39998
39998
  );
39999
39999
  return;
40000
40000
  }
@@ -40963,10 +40963,12 @@ function reducer3(_state, action) {
40963
40963
  function useScan(config) {
40964
40964
  const [state, dispatch] = (0, import_react27.useReducer)(reducer3, { phase: "discovering" });
40965
40965
  const started = (0, import_react27.useRef)(false);
40966
- const discoveredProjects = (0, import_react27.useRef)(null);
40966
+ const [multiProjects, setMultiProjects] = (0, import_react27.useState)(null);
40967
40967
  (0, import_react27.useEffect)(() => {
40968
40968
  if (started.current) return;
40969
40969
  started.current = true;
40970
+ const projects = discoverProjects(process.cwd());
40971
+ if (projects.length > 1) setMultiProjects(projects);
40970
40972
  try {
40971
40973
  const discovery = discoverChanges(process.cwd(), config);
40972
40974
  const packages = discovery.packages.filter((p) => !config.allowlist.includes(p.name));
@@ -40978,8 +40980,6 @@ function useScan(config) {
40978
40980
  dispatch({ type: "DISCOVERY_COMPLETE", packages, skippedCount: discovery.skipped.length });
40979
40981
  runNpmScan(packages, discovery.skipped.length, config, dispatch);
40980
40982
  } catch {
40981
- const projects = discoverProjects(process.cwd());
40982
- discoveredProjects.current = projects.length > 1 ? projects : null;
40983
40983
  if (projects.length === 0) {
40984
40984
  dispatch({ type: "DISCOVERY_EMPTY", message: "No dependency files found." });
40985
40985
  return;
@@ -40997,13 +40997,13 @@ function useScan(config) {
40997
40997
  scanProjects(projects, config, dispatch);
40998
40998
  }, [config]);
40999
40999
  const restartSelection = (0, import_react27.useCallback)(() => {
41000
- if (!discoveredProjects.current) return;
41001
- dispatch({ type: "RESTART_SELECTION", projects: discoveredProjects.current });
41002
- }, []);
41000
+ if (!multiProjects) return;
41001
+ dispatch({ type: "RESTART_SELECTION", projects: multiProjects });
41002
+ }, [multiProjects]);
41003
41003
  return {
41004
41004
  state,
41005
41005
  scanSelectedProjects,
41006
- restartSelection: discoveredProjects.current ? restartSelection : null
41006
+ restartSelection: multiProjects ? restartSelection : null
41007
41007
  };
41008
41008
  }
41009
41009
  async function runNpmScan(packages, skippedCount, config, dispatch) {
@@ -41189,7 +41189,7 @@ function groupPackages3(packages) {
41189
41189
  group.push(pkg);
41190
41190
  map.set(fingerprint, group);
41191
41191
  }
41192
- return [...map.values()].map((pkgs) => ({ packages: pkgs, key: pkgs[0].name })).sort((a, b) => b.packages[0].score - a.packages[0].score);
41192
+ return [...map.entries()].map(([fingerprint, pkgs]) => ({ packages: pkgs, key: fingerprint })).sort((a, b) => b.packages[0].score - a.packages[0].score);
41193
41193
  }
41194
41194
  function actionBadge4(score, config) {
41195
41195
  if (score >= config.blockThreshold)
@@ -41394,6 +41394,11 @@ var init_InteractiveResultsView = __esm({
41394
41394
  if (expIdx === cursor && expLvl === "detail") return;
41395
41395
  const newVp = adjustViewport(cursor, cursor, "detail", vpStart);
41396
41396
  dispatchView({ type: "EXPAND", expandedIndex: cursor, expandLevel: "detail", viewport: newVp });
41397
+ } else if (input === "c") {
41398
+ if (expIdx !== null && expLvl !== null) {
41399
+ const newVp = adjustViewport(cursor, null, null, vpStart);
41400
+ dispatchView({ type: "EXPAND", expandedIndex: null, expandLevel: null, viewport: newVp });
41401
+ }
41397
41402
  } else if (input === "b" && onBack) {
41398
41403
  onBack();
41399
41404
  } else if (input === "q") {
@@ -41519,7 +41524,10 @@ var init_InteractiveResultsView = __esm({
41519
41524
  " toggle",
41520
41525
  " ",
41521
41526
  import_chalk10.default.cyan("e"),
41522
- " detail",
41527
+ " expand",
41528
+ " ",
41529
+ import_chalk10.default.cyan("c"),
41530
+ " collapse",
41523
41531
  " ",
41524
41532
  onBack && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
41525
41533
  import_chalk10.default.cyan("b"),
@@ -41665,6 +41673,9 @@ var init_ProjectSelector = __esm({
41665
41673
  import_jsx_runtime11 = __toESM(require_jsx_runtime());
41666
41674
  ProjectSelector = ({ projects, onConfirm, onCancel }) => {
41667
41675
  const [cursor, setCursor] = (0, import_react30.useState)(0);
41676
+ (0, import_react30.useEffect)(() => {
41677
+ process.stdout.write("\x1B[2J\x1B[H");
41678
+ }, []);
41668
41679
  const [selected, setSelected] = (0, import_react30.useState)(() => new Set(projects.map((_, i) => i)));
41669
41680
  use_input_default((input, key) => {
41670
41681
  if (key.upArrow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westbayberry/dg",
3
- "version": "1.0.9",
3
+ "version": "1.0.13",
4
4
  "description": "Supply chain security scanner — scan npm dependencies in any CI or terminal",
5
5
  "bin": {
6
6
  "dependency-guardian": "dist/index.mjs",