locus-product-planning 1.2.1 → 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,31 +12477,69 @@ 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
- if (meta?.url) {
12484
- return (0, import_path.dirname)((0, import_url.fileURLToPath)(meta.url));
12485
+ if (meta?.url && typeof meta.url === "string" && meta.url.startsWith("file:")) {
12486
+ const result = (0, import_path.dirname)((0, import_url.fileURLToPath)(meta.url));
12487
+ if (typeof result === "string" && result.length > 0) {
12488
+ _cachedDirname = result;
12489
+ return result;
12490
+ }
12491
+ }
12492
+ } catch {
12493
+ }
12494
+ try {
12495
+ const globalDirname = globalThis.__dirname;
12496
+ if (typeof globalDirname === "string" && globalDirname.length > 0) {
12497
+ _cachedDirname = globalDirname;
12498
+ return globalDirname;
12485
12499
  }
12486
12500
  } catch {
12487
12501
  }
12488
12502
  try {
12489
12503
  const packageJsonPath = require.resolve("locus-product-planning/package.json");
12490
- return (0, import_path.join)((0, import_path.dirname)(packageJsonPath), "dist");
12504
+ if (typeof packageJsonPath === "string") {
12505
+ const result = (0, import_path.join)((0, import_path.dirname)(packageJsonPath), "dist");
12506
+ _cachedDirname = result;
12507
+ return result;
12508
+ }
12491
12509
  } catch {
12492
12510
  }
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
+ }
12525
+ }
12526
+ }
12493
12527
  const cwd = process.cwd();
12494
12528
  try {
12495
12529
  const pkgPath = (0, import_path.resolve)(cwd, "package.json");
12496
12530
  if ((0, import_fs.existsSync)(pkgPath)) {
12497
12531
  const pkg = JSON.parse((0, import_fs.readFileSync)(pkgPath, "utf-8"));
12498
12532
  if (pkg.name === "locus-product-planning") {
12499
- return (0, import_path.resolve)(cwd, "dist");
12533
+ const result = (0, import_path.resolve)(cwd, "dist");
12534
+ _cachedDirname = result;
12535
+ return result;
12500
12536
  }
12501
12537
  }
12502
12538
  } catch {
12503
12539
  }
12504
- return (0, import_path.resolve)(cwd, "dist");
12540
+ const fallback = (0, import_path.resolve)(cwd, "dist");
12541
+ _cachedDirname = fallback;
12542
+ return fallback;
12505
12543
  }
12506
12544
  var currentDirname = getCurrentDirname();
12507
12545
  function getPackageRoot() {