locus-product-planning 1.2.2 → 1.2.4
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 +69 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +69 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12441,46 +12441,92 @@ import { homedir } from "os";
|
|
|
12441
12441
|
import { readFileSync, existsSync, readdirSync } from "fs";
|
|
12442
12442
|
import { join, basename, dirname, resolve } from "path";
|
|
12443
12443
|
import { fileURLToPath } from "url";
|
|
12444
|
+
var _cachedDirname = null;
|
|
12445
|
+
function safeString(value) {
|
|
12446
|
+
if (typeof value === "string" && value.length > 0) {
|
|
12447
|
+
return value;
|
|
12448
|
+
}
|
|
12449
|
+
return null;
|
|
12450
|
+
}
|
|
12444
12451
|
function getCurrentDirname() {
|
|
12452
|
+
if (typeof _cachedDirname === "string" && _cachedDirname.length > 0) {
|
|
12453
|
+
return _cachedDirname;
|
|
12454
|
+
}
|
|
12445
12455
|
try {
|
|
12446
12456
|
const meta = import.meta;
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12457
|
+
const url2 = safeString(meta?.url);
|
|
12458
|
+
if (url2 && url2.startsWith("file:")) {
|
|
12459
|
+
const result = safeString(dirname(fileURLToPath(url2)));
|
|
12460
|
+
if (result) {
|
|
12461
|
+
_cachedDirname = result;
|
|
12450
12462
|
return result;
|
|
12451
12463
|
}
|
|
12452
12464
|
}
|
|
12453
12465
|
} catch {
|
|
12454
12466
|
}
|
|
12455
12467
|
try {
|
|
12456
|
-
const
|
|
12457
|
-
if (
|
|
12458
|
-
|
|
12468
|
+
const globalDirname = safeString(globalThis.__dirname);
|
|
12469
|
+
if (globalDirname) {
|
|
12470
|
+
_cachedDirname = globalDirname;
|
|
12471
|
+
return globalDirname;
|
|
12459
12472
|
}
|
|
12460
12473
|
} catch {
|
|
12461
12474
|
}
|
|
12462
|
-
const cacheLocations = [
|
|
12463
|
-
join(process.env.HOME || "", ".cache", "opencode", "node_modules", "locus-product-planning"),
|
|
12464
|
-
join(process.env.HOME || "", ".config", "opencode", "node_modules", "locus-product-planning")
|
|
12465
|
-
];
|
|
12466
|
-
for (const loc of cacheLocations) {
|
|
12467
|
-
const distPath = join(loc, "dist");
|
|
12468
|
-
if (existsSync(distPath)) {
|
|
12469
|
-
return distPath;
|
|
12470
|
-
}
|
|
12471
|
-
}
|
|
12472
|
-
const cwd = process.cwd();
|
|
12473
12475
|
try {
|
|
12474
|
-
const
|
|
12475
|
-
if (
|
|
12476
|
-
const
|
|
12477
|
-
if (
|
|
12478
|
-
|
|
12476
|
+
const packageJsonPath = safeString(__require.resolve("locus-product-planning/package.json"));
|
|
12477
|
+
if (packageJsonPath) {
|
|
12478
|
+
const result = safeString(join(dirname(packageJsonPath), "dist"));
|
|
12479
|
+
if (result) {
|
|
12480
|
+
_cachedDirname = result;
|
|
12481
|
+
return result;
|
|
12479
12482
|
}
|
|
12480
12483
|
}
|
|
12481
12484
|
} catch {
|
|
12482
12485
|
}
|
|
12483
|
-
|
|
12486
|
+
const homeDir = safeString(process.env.USERPROFILE) || safeString(process.env.HOME);
|
|
12487
|
+
if (homeDir) {
|
|
12488
|
+
const cacheLocations = [
|
|
12489
|
+
join(homeDir, ".cache", "opencode", "node_modules", "locus-product-planning", "dist"),
|
|
12490
|
+
join(homeDir, ".config", "opencode", "node_modules", "locus-product-planning", "dist")
|
|
12491
|
+
];
|
|
12492
|
+
for (const loc of cacheLocations) {
|
|
12493
|
+
try {
|
|
12494
|
+
if (existsSync(loc)) {
|
|
12495
|
+
const result = safeString(loc);
|
|
12496
|
+
if (result) {
|
|
12497
|
+
_cachedDirname = result;
|
|
12498
|
+
return result;
|
|
12499
|
+
}
|
|
12500
|
+
}
|
|
12501
|
+
} catch {
|
|
12502
|
+
}
|
|
12503
|
+
}
|
|
12504
|
+
}
|
|
12505
|
+
const cwd = safeString(process.cwd());
|
|
12506
|
+
if (cwd) {
|
|
12507
|
+
try {
|
|
12508
|
+
const pkgPath = resolve(cwd, "package.json");
|
|
12509
|
+
if (existsSync(pkgPath)) {
|
|
12510
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
12511
|
+
if (pkg.name === "locus-product-planning") {
|
|
12512
|
+
const result = safeString(resolve(cwd, "dist"));
|
|
12513
|
+
if (result) {
|
|
12514
|
+
_cachedDirname = result;
|
|
12515
|
+
return result;
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
} catch {
|
|
12520
|
+
}
|
|
12521
|
+
const fallback = safeString(resolve(cwd, "dist"));
|
|
12522
|
+
if (fallback) {
|
|
12523
|
+
_cachedDirname = fallback;
|
|
12524
|
+
return fallback;
|
|
12525
|
+
}
|
|
12526
|
+
}
|
|
12527
|
+
const absoluteFallback = "/tmp/locus-product-planning/dist";
|
|
12528
|
+
_cachedDirname = absoluteFallback;
|
|
12529
|
+
return absoluteFallback;
|
|
12484
12530
|
}
|
|
12485
12531
|
var currentDirname = getCurrentDirname();
|
|
12486
12532
|
function getPackageRoot() {
|