locus-product-planning 1.2.2 → 1.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/dist/index.cjs CHANGED
@@ -12477,32 +12477,51 @@ var import_fs = require("fs");
12477
12477
  var import_path = require("path");
12478
12478
  var import_url = require("url");
12479
12479
  var import_meta = {};
12480
+ var _cachedDirname = null;
12480
12481
  function getCurrentDirname() {
12482
+ if (_cachedDirname) return _cachedDirname;
12481
12483
  try {
12482
12484
  const meta = import_meta;
12483
12485
  if (meta?.url && typeof meta.url === "string" && meta.url.startsWith("file:")) {
12484
12486
  const result = (0, import_path.dirname)((0, import_url.fileURLToPath)(meta.url));
12485
12487
  if (typeof result === "string" && result.length > 0) {
12488
+ _cachedDirname = result;
12486
12489
  return result;
12487
12490
  }
12488
12491
  }
12489
12492
  } catch {
12490
12493
  }
12494
+ try {
12495
+ const globalDirname = globalThis.__dirname;
12496
+ if (typeof globalDirname === "string" && globalDirname.length > 0) {
12497
+ _cachedDirname = globalDirname;
12498
+ return globalDirname;
12499
+ }
12500
+ } catch {
12501
+ }
12491
12502
  try {
12492
12503
  const packageJsonPath = require.resolve("locus-product-planning/package.json");
12493
12504
  if (typeof packageJsonPath === "string") {
12494
- return (0, import_path.join)((0, import_path.dirname)(packageJsonPath), "dist");
12505
+ const result = (0, import_path.join)((0, import_path.dirname)(packageJsonPath), "dist");
12506
+ _cachedDirname = result;
12507
+ return result;
12495
12508
  }
12496
12509
  } catch {
12497
12510
  }
12498
- const cacheLocations = [
12499
- (0, import_path.join)(process.env.HOME || "", ".cache", "opencode", "node_modules", "locus-product-planning"),
12500
- (0, import_path.join)(process.env.HOME || "", ".config", "opencode", "node_modules", "locus-product-planning")
12501
- ];
12502
- for (const loc of cacheLocations) {
12503
- const distPath = (0, import_path.join)(loc, "dist");
12504
- if ((0, import_fs.existsSync)(distPath)) {
12505
- return distPath;
12511
+ const homeDir = process.env.USERPROFILE || process.env.HOME || "";
12512
+ if (homeDir) {
12513
+ const cacheLocations = [
12514
+ (0, import_path.join)(homeDir, ".cache", "opencode", "node_modules", "locus-product-planning", "dist"),
12515
+ (0, import_path.join)(homeDir, ".config", "opencode", "node_modules", "locus-product-planning", "dist")
12516
+ ];
12517
+ for (const loc of cacheLocations) {
12518
+ try {
12519
+ if ((0, import_fs.existsSync)(loc)) {
12520
+ _cachedDirname = loc;
12521
+ return loc;
12522
+ }
12523
+ } catch {
12524
+ }
12506
12525
  }
12507
12526
  }
12508
12527
  const cwd = process.cwd();
@@ -12511,12 +12530,16 @@ function getCurrentDirname() {
12511
12530
  if ((0, import_fs.existsSync)(pkgPath)) {
12512
12531
  const pkg = JSON.parse((0, import_fs.readFileSync)(pkgPath, "utf-8"));
12513
12532
  if (pkg.name === "locus-product-planning") {
12514
- return (0, import_path.resolve)(cwd, "dist");
12533
+ const result = (0, import_path.resolve)(cwd, "dist");
12534
+ _cachedDirname = result;
12535
+ return result;
12515
12536
  }
12516
12537
  }
12517
12538
  } catch {
12518
12539
  }
12519
- return (0, import_path.resolve)(cwd, "dist");
12540
+ const fallback = (0, import_path.resolve)(cwd, "dist");
12541
+ _cachedDirname = fallback;
12542
+ return fallback;
12520
12543
  }
12521
12544
  var currentDirname = getCurrentDirname();
12522
12545
  function getPackageRoot() {