request-wallet-sign 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/bin/index.js +12 -4
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -1132,10 +1132,18 @@ export async function run(argv) {
1132
1132
  }
1133
1133
 
1134
1134
  // ── Entry point ───────────────────────────────────────────────────────────────
1135
- // Only execute when run directly (not when imported by tests).
1136
-
1137
- const isMain = process.argv[1] &&
1138
- new URL(import.meta.url).pathname === process.argv[1];
1135
+ // Only execute when run directly (not when imported by tests). Resolve symlinks
1136
+ // on both sides: when launched via an installed bin (npx / global install),
1137
+ // process.argv[1] is a symlink in node_modules/.bin whose realpath is this file,
1138
+ // while import.meta.url is already the resolved path — comparing them raw fails.
1139
+ import { realpathSync } from 'node:fs';
1140
+ import { fileURLToPath } from 'node:url';
1141
+
1142
+ let isMain = false;
1143
+ try {
1144
+ isMain = !!process.argv[1] &&
1145
+ realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
1146
+ } catch { isMain = false; }
1139
1147
 
1140
1148
  if (isMain) {
1141
1149
  run(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "request-wallet-sign",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Let AI agents surface wallet signing requests to users via a local browser page",
5
5
  "type": "module",
6
6
  "engines": {