From 5c25f2d905f70ef427c22aa9400efaf5ffeefc55 Mon Sep 17 00:00:00 2001 From: Jeff Yates Date: Fri, 1 May 2026 16:44:00 -0500 Subject: [PATCH] [fixmain] Fix path issue --- .changeset/swift-schools-live.md | 5 +++++ src/bin/x.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/swift-schools-live.md diff --git a/.changeset/swift-schools-live.md b/.changeset/swift-schools-live.md new file mode 100644 index 0000000..9efdbf2 --- /dev/null +++ b/.changeset/swift-schools-live.md @@ -0,0 +1,5 @@ +--- +"@somewhatabstract/x": patch +--- + +Make sure that we resolve to realpaths when comparing file paths in module import diff --git a/src/bin/x.ts b/src/bin/x.ts index 49e046f..6659e28 100755 --- a/src/bin/x.ts +++ b/src/bin/x.ts @@ -1,4 +1,5 @@ #!/usr/bin/env node +import {realpathSync} from "node:fs"; import {fileURLToPath} from "node:url"; import yargs from "yargs"; import {hideBin} from "yargs/helpers"; @@ -134,7 +135,7 @@ export async function main(rawArgv: string[]): Promise { // Only run main if we aren't being imported as a module. /* v8 ignore start -- runtime-only CLI bootstrap */ -if (process.argv[1] === fileURLToPath(import.meta.url)) { +if (realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) { main(process.argv) .then((result) => { process.exit(result.exitCode);