@suveren/gateway 0.4.0 → 0.4.1

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.
@@ -6,7 +6,7 @@ import {
6
6
  // src/index.ts
7
7
  import { randomBytes as randomBytes2 } from "crypto";
8
8
  import { existsSync as existsSync5, readFileSync as readFileSync4, renameSync } from "fs";
9
- import { join as join4 } from "path";
9
+ import { dirname as dirname3, join as join4 } from "path";
10
10
  import { homedir as homedir3 } from "os";
11
11
  import express from "express";
12
12
  import { createProxyMiddleware } from "http-proxy-middleware";
@@ -1471,15 +1471,15 @@ import { promisify } from "util";
1471
1471
  var run = promisify(execFile);
1472
1472
  var SUPPORTED = /* @__PURE__ */ new Set(["darwin", "win32", "linux"]);
1473
1473
  var MODULE_DIR = pathDirname(fileURLToPath(import.meta.url));
1474
- function findCli(dirname3 = MODULE_DIR) {
1474
+ function findCli(dirname4 = MODULE_DIR) {
1475
1475
  const candidates = [
1476
1476
  // Bundled (the shipped layout): dist/control-plane → dist → root → bin
1477
- resolve(dirname3, "..", "..", "bin", "suveren-gateway.js"),
1477
+ resolve(dirname4, "..", "..", "bin", "suveren-gateway.js"),
1478
1478
  // Bundled, were the routes/ directory ever preserved.
1479
- resolve(dirname3, "..", "..", "..", "bin", "suveren-gateway.js"),
1479
+ resolve(dirname4, "..", "..", "..", "bin", "suveren-gateway.js"),
1480
1480
  // Dev, running from source: the repo's own bundle directory.
1481
- resolve(dirname3, "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js"),
1482
- resolve(dirname3, "..", "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js")
1481
+ resolve(dirname4, "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js"),
1482
+ resolve(dirname4, "..", "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js")
1483
1483
  // Deliberately NO process.cwd() fallback: it makes the result depend on
1484
1484
  // where the process happened to be launched from, so the same install
1485
1485
  // resolves differently between a shell and a login service — and it would
@@ -2425,7 +2425,14 @@ function detectInstallMethod() {
2425
2425
  if (existsSync5("/.dockerenv")) return "docker";
2426
2426
  const dir = import.meta.dirname ?? __dirname;
2427
2427
  if (dir.includes("/node_modules/@suveren/gateway/")) return "npm";
2428
- return "dev";
2428
+ let cursor = dir;
2429
+ for (let i = 0; i < 8; i++) {
2430
+ if (existsSync5(join4(cursor, ".git"))) return "dev";
2431
+ const parent = dirname3(cursor);
2432
+ if (parent === cursor) break;
2433
+ cursor = parent;
2434
+ }
2435
+ return "npm";
2429
2436
  }
2430
2437
  var INSTALL_METHOD = detectInstallMethod();
2431
2438
  function detectRunningVersion() {