← Files JuicyLucy AdsARCHIVED FILE
skills/hyperframes-audio/scripts/lib/main-module.mjs
479 Bytes · Nov 19, 2026 · 00:42 UTC
import { realpathSync } from "node:fs";
import { pathToFileURL } from "node:url";
// Node resolves symlinks in the main module's import.meta.url but argv[1] keeps the invoked
// spelling (a symlinked skills dir, or /tmp vs /private/tmp on macOS), so compare real paths.
export function isMainModule(importMetaUrl) {
if (!process.argv[1]) return false;
try {
return pathToFileURL(realpathSync(process.argv[1])).href === importMetaUrl;
} catch {
return false;
}
}
SHA-256: 61811e09110856e1439c29875e4a4ad7701ae45d4045f9d1dcb6a7929698e4c0