node-version-use 2.4.0 → 2.4.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 (71) hide show
  1. package/README.md +61 -84
  2. package/assets/bin/node +0 -0
  3. package/assets/installBinaries.cjs +95 -18
  4. package/assets/postinstall.cjs +16 -1
  5. package/dist/cjs/assets/installBinaries.cjs +95 -18
  6. package/dist/cjs/assets/installBinaries.cjs.map +1 -1
  7. package/dist/cjs/assets/postinstall.cjs +16 -1
  8. package/dist/cjs/assets/postinstall.cjs.map +1 -1
  9. package/dist/cjs/cli.js.map +1 -1
  10. package/dist/cjs/commands/default.js +30 -4
  11. package/dist/cjs/commands/default.js.map +1 -1
  12. package/dist/cjs/commands/index.js.map +1 -1
  13. package/dist/cjs/commands/install.js.map +1 -1
  14. package/dist/cjs/commands/list.js.map +1 -1
  15. package/dist/cjs/commands/local.js.map +1 -1
  16. package/dist/cjs/commands/setup.d.cts +2 -3
  17. package/dist/cjs/commands/setup.d.ts +2 -3
  18. package/dist/cjs/commands/setup.js +9 -84
  19. package/dist/cjs/commands/setup.js.map +1 -1
  20. package/dist/cjs/commands/teardown.js.map +1 -1
  21. package/dist/cjs/commands/uninstall.js.map +1 -1
  22. package/dist/cjs/commands/which.js +15 -0
  23. package/dist/cjs/commands/which.js.map +1 -1
  24. package/dist/cjs/compat.d.cts +1 -0
  25. package/dist/cjs/compat.d.ts +1 -0
  26. package/dist/cjs/compat.js +17 -3
  27. package/dist/cjs/compat.js.map +1 -1
  28. package/dist/cjs/constants.js.map +1 -1
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/lib/findInstalledVersions.js.map +1 -1
  31. package/dist/cjs/lib/loadNodeVersionInstall.js +1 -1
  32. package/dist/cjs/lib/loadNodeVersionInstall.js.map +1 -1
  33. package/dist/cjs/lib/resolveSystemBinary.d.cts +10 -0
  34. package/dist/cjs/lib/resolveSystemBinary.d.ts +10 -0
  35. package/dist/cjs/lib/resolveSystemBinary.js +96 -0
  36. package/dist/cjs/lib/resolveSystemBinary.js.map +1 -0
  37. package/dist/cjs/worker.js +53 -56
  38. package/dist/cjs/worker.js.map +1 -1
  39. package/dist/esm/assets/installBinaries.cjs +78 -18
  40. package/dist/esm/assets/installBinaries.cjs.map +1 -1
  41. package/dist/esm/assets/postinstall.cjs +16 -1
  42. package/dist/esm/assets/postinstall.cjs.map +1 -1
  43. package/dist/esm/cli.js.map +1 -1
  44. package/dist/esm/commands/default.js +30 -4
  45. package/dist/esm/commands/default.js.map +1 -1
  46. package/dist/esm/commands/index.js.map +1 -1
  47. package/dist/esm/commands/install.js.map +1 -1
  48. package/dist/esm/commands/list.js.map +1 -1
  49. package/dist/esm/commands/local.js.map +1 -1
  50. package/dist/esm/commands/setup.d.ts +2 -3
  51. package/dist/esm/commands/setup.js +9 -84
  52. package/dist/esm/commands/setup.js.map +1 -1
  53. package/dist/esm/commands/teardown.js.map +1 -1
  54. package/dist/esm/commands/uninstall.js.map +1 -1
  55. package/dist/esm/commands/which.js +15 -0
  56. package/dist/esm/commands/which.js.map +1 -1
  57. package/dist/esm/compat.d.ts +1 -0
  58. package/dist/esm/compat.js +16 -5
  59. package/dist/esm/compat.js.map +1 -1
  60. package/dist/esm/constants.js.map +1 -1
  61. package/dist/esm/index.js.map +1 -1
  62. package/dist/esm/lib/findInstalledVersions.js.map +1 -1
  63. package/dist/esm/lib/loadNodeVersionInstall.js +1 -1
  64. package/dist/esm/lib/loadNodeVersionInstall.js.map +1 -1
  65. package/dist/esm/lib/resolveSystemBinary.d.ts +10 -0
  66. package/dist/esm/lib/resolveSystemBinary.js +78 -0
  67. package/dist/esm/lib/resolveSystemBinary.js.map +1 -0
  68. package/dist/esm/types.js.map +1 -1
  69. package/dist/esm/worker.js +58 -11
  70. package/dist/esm/worker.js.map +1 -1
  71. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/commands/setup.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport Module from 'module';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst { installBinaries, printInstructions } = _require('../assets/installBinaries.cjs');\n\n/**\n * nvu setup [--shims]\n *\n * Install/reinstall nvu binaries to ~/.nvu/bin\n * With --shims: create shims for existing global packages\n */\nexport default function setupCmd(args: string[]): void {\n const options = getopts(args, { boolean: ['force'] });\n\n installBinaries(options, (err, installed) => {\n if (err) {\n console.error(`Setup failed: ${err.message || err}`);\n exit(1);\n return;\n }\n\n printInstructions();\n if (!installed) console.log('Use --force to reinstall.');\n\n if (options.force) {\n const binDir = path.join(storagePath, 'bin');\n createShimsForGlobalPackages(binDir);\n return;\n }\n });\n}\n\n/**\n * Create shims for all global packages in the default Node version\n */\nfunction createShimsForGlobalPackages(binDir: string): void {\n // Read default version\n const defaultPath = path.join(storagePath, 'default');\n if (!fs.existsSync(defaultPath)) {\n console.log('No default Node version set.');\n console.log('Set one with: nvu default <version>');\n exit(1);\n return;\n }\n\n const defaultVersion = fs.readFileSync(defaultPath, 'utf8').trim();\n const versionsDir = path.join(storagePath, 'installed');\n\n // Resolve to exact version\n const matches = findInstalledVersions(versionsDir, defaultVersion);\n if (matches.length === 0) {\n console.log(`Default version ${defaultVersion} is not installed.`);\n exit(1);\n return;\n }\n\n const resolvedVersion = matches[matches.length - 1];\n const nodeBinDir = path.join(versionsDir, resolvedVersion, 'bin');\n\n if (!fs.existsSync(nodeBinDir)) {\n console.log(`No bin directory found for ${resolvedVersion}`);\n exit(1);\n return;\n }\n\n // Get the node shim to copy from\n const nodeShim = path.join(binDir, 'node');\n if (!fs.existsSync(nodeShim)) {\n console.log('Node shim not found. Run: nvu setup');\n exit(1);\n return;\n }\n\n // Scan binaries in Node's bin directory\n const entries = readdirWithTypes(nodeBinDir);\n let created = 0;\n let skipped = 0;\n\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n const name = entry.name;\n\n // Skip our routing shims (node/npm/npx) - don't overwrite them\n if (name === 'node' || name === 'npm' || name === 'npx') continue;\n const shimPath = path.join(binDir, name);\n\n // Skip if shim already exists\n if (fs.existsSync(shimPath)) {\n skipped++;\n continue;\n }\n\n // Copy the node shim\n try {\n const shimContent = fs.readFileSync(nodeShim);\n fs.writeFileSync(shimPath, shimContent);\n fs.chmodSync(shimPath, 493); // 0755\n console.log(`Created shim: ${name}`);\n created++;\n } catch (err) {\n console.error(`Failed to create shim for ${name}: ${(err as Error).message}`);\n }\n }\n\n console.log('');\n console.log(`Done. Created ${created} shims, skipped ${skipped} (already exists).`);\n exit(0);\n}\n"],"names":["setupCmd","_require","require","Module","createRequire","installBinaries","printInstructions","args","options","getopts","boolean","err","installed","console","error","message","exit","log","force","binDir","path","join","storagePath","createShimsForGlobalPackages","defaultPath","fs","existsSync","defaultVersion","readFileSync","trim","versionsDir","matches","findInstalledVersions","length","resolvedVersion","nodeBinDir","nodeShim","entries","readdirWithTypes","created","skipped","i","entry","name","shimPath","shimContent","writeFileSync","chmodSync"],"mappings":";;;;+BAYA;;;;;CAKC,GACD;;;eAAwBA;;;iEAlBP;yDACF;oEACK;6DACD;2DACF;wBACgB;2BACL;uCACU;;;;;;AAEtC,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAA+CD,YAAAA,SAAS,kCAAhDI,kBAAuCJ,UAAvCI,iBAAiBC,oBAAsBL,UAAtBK;AAQV,SAASN,SAASO,IAAc;IAC7C,IAAMC,UAAUC,IAAAA,sBAAO,EAACF,MAAM;QAAEG,SAAS;YAAC;SAAQ;IAAC;IAEnDL,gBAAgBG,SAAS,SAACG,KAAKC;QAC7B,IAAID,KAAK;YACPE,QAAQC,KAAK,CAAC,AAAC,iBAAmC,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;QACZD,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,wCAAwC;IACxC,IAAMqB,UAAUC,IAAAA,0BAAgB,EAACH;IACjC,IAAII,UAAU;IACd,IAAIC,UAAU;IAEd,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,QAAQJ,MAAM,EAAEQ,IAAK;QACvC,IAAMC,QAAQL,OAAO,CAACI,EAAE;QACxB,IAAME,OAAOD,MAAMC,IAAI;QAEvB,+DAA+D;QAC/D,IAAIA,SAAS,UAAUA,SAAS,SAASA,SAAS,OAAO;QACzD,IAAMC,WAAWxB,aAAI,CAACC,IAAI,CAACF,QAAQwB;QAEnC,8BAA8B;QAC9B,IAAIlB,WAAE,CAACC,UAAU,CAACkB,WAAW;YAC3BJ;YACA;QACF;QAEA,qBAAqB;QACrB,IAAI;YACF,IAAMK,cAAcpB,WAAE,CAACG,YAAY,CAACQ;YACpCX,WAAE,CAACqB,aAAa,CAACF,UAAUC;YAC3BpB,WAAE,CAACsB,SAAS,CAACH,UAAU,MAAM,OAAO;YACpC/B,QAAQI,GAAG,CAAC,AAAC,iBAAqB,OAAL0B;YAC7BJ;QACF,EAAE,OAAO5B,KAAK;YACZE,QAAQC,KAAK,CAAC,AAAC,6BAAqC,OAAT6B,MAAK,MAA2B,OAAvB,AAAChC,IAAcI,OAAO;QAC5E;IACF;IAEAF,QAAQI,GAAG,CAAC;IACZJ,QAAQI,GAAG,CAAC,AAAC,iBAA0CuB,OAA1BD,SAAQ,oBAA0B,OAARC,SAAQ;IAC/DxB,IAAAA,mBAAI,EAAC;AACP"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/setup.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport Module from 'module';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst { installBinaries, printInstructions, syncAllShims } = _require('../assets/installBinaries.cjs');\n\n/**\n * nvu setup\n *\n * Install/reinstall nvu binaries to ~/.nvu/bin\n */\nexport default function setupCmd(_args: string[]): void {\n installBinaries({}, (err, installed) => {\n if (err) {\n console.error(`Setup failed: ${err.message || err}`);\n exit(1);\n return;\n }\n\n // Sync all shims to the new binary\n const binDir = path.join(storagePath, 'bin');\n syncAllShims(binDir);\n\n printInstructions();\n if (!installed) console.log('Use --force to reinstall binaries.');\n\n exit(0);\n });\n}\n"],"names":["setupCmd","_require","require","Module","createRequire","installBinaries","printInstructions","syncAllShims","_args","err","installed","console","error","message","exit","binDir","path","join","storagePath","log"],"mappings":";;;;+BAQA;;;;CAIC,GACD;;;eAAwBA;;;iEAbP;6DACE;2DACF;2BACW;;;;;;AAE5B,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAA6DD,YAAAA,SAAS,kCAA9DI,kBAAqDJ,UAArDI,iBAAiBC,oBAAoCL,UAApCK,mBAAmBC,eAAiBN,UAAjBM;AAO7B,SAASP,SAASQ,KAAe;IAC9CH,gBAAgB,CAAC,GAAG,SAACI,KAAKC;QACxB,IAAID,KAAK;YACPE,QAAQC,KAAK,CAAC,AAAC,iBAAmC,OAAnBH,IAAII,OAAO,IAAIJ;YAC9CK,IAAAA,mBAAI,EAAC;YACL;QACF;QAEA,mCAAmC;QACnC,IAAMC,SAASC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;QACtCX,aAAaQ;QAEbT;QACA,IAAI,CAACI,WAAWC,QAAQQ,GAAG,CAAC;QAE5BL,IAAAA,mBAAI,EAAC;IACP;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/commands/teardown.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport { rmSync } from 'fs-remove-compat';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n/**\n * nvu teardown\n *\n * Remove nvu binaries from ~/.nvu/bin\n */\nexport default function teardownCmd(_args: string[]): void {\n const binDir = path.join(storagePath, 'bin');\n\n const binaries = ['node', 'npm', 'npx'];\n const ext = isWindows ? '.exe' : '';\n\n let removed = 0;\n for (let i = 0; i < binaries.length; i++) {\n const binaryPath = path.join(binDir, binaries[i] + ext);\n if (fs.existsSync(binaryPath)) {\n rmSync(binaryPath, { force: true });\n removed++;\n }\n }\n\n if (removed > 0) {\n console.log(`Removed ${removed} binary(s) from ${binDir}`);\n console.log('');\n console.log('You may also want to remove ~/.nvu/bin from your PATH.');\n } else {\n console.log('No binaries found to remove.');\n }\n\n exit(0);\n}\n"],"names":["teardownCmd","isWindows","process","platform","test","env","OSTYPE","_args","binDir","path","join","storagePath","binaries","ext","removed","i","length","binaryPath","fs","existsSync","rmSync","force","console","log","exit"],"mappings":";;;;+BAQA;;;;CAIC,GACD;;;eAAwBA;;;iEAbP;yDACF;8BACQ;2DACN;2BACW;;;;;;AAE5B,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAO5E,SAASN,YAAYO,KAAe;IACjD,IAAMC,SAASC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAEtC,IAAMC,WAAW;QAAC;QAAQ;QAAO;KAAM;IACvC,IAAMC,MAAMZ,YAAY,SAAS;IAEjC,IAAIa,UAAU;IACd,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,IAAME,aAAaR,aAAI,CAACC,IAAI,CAACF,QAAQI,QAAQ,CAACG,EAAE,GAAGF;QACnD,IAAIK,WAAE,CAACC,UAAU,CAACF,aAAa;YAC7BG,IAAAA,sBAAM,EAACH,YAAY;gBAAEI,OAAO;YAAK;YACjCP;QACF;IACF;IAEA,IAAIA,UAAU,GAAG;QACfQ,QAAQC,GAAG,CAAC,AAAC,WAAoCf,OAA1BM,SAAQ,oBAAyB,OAAPN;QACjDc,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;IACd,OAAO;QACLD,QAAQC,GAAG,CAAC;IACd;IAEAC,IAAAA,mBAAI,EAAC;AACP"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/teardown.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport { rmSync } from 'fs-remove-compat';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n/**\n * nvu teardown\n *\n * Remove nvu binaries from ~/.nvu/bin\n */\nexport default function teardownCmd(_args: string[]): void {\n const binDir = path.join(storagePath, 'bin');\n\n const binaries = ['node', 'npm', 'npx'];\n const ext = isWindows ? '.exe' : '';\n\n let removed = 0;\n for (let i = 0; i < binaries.length; i++) {\n const binaryPath = path.join(binDir, binaries[i] + ext);\n if (fs.existsSync(binaryPath)) {\n rmSync(binaryPath, { force: true });\n removed++;\n }\n }\n\n if (removed > 0) {\n console.log(`Removed ${removed} binary(s) from ${binDir}`);\n console.log('');\n console.log('You may also want to remove ~/.nvu/bin from your PATH.');\n } else {\n console.log('No binaries found to remove.');\n }\n\n exit(0);\n}\n"],"names":["teardownCmd","isWindows","process","platform","test","env","OSTYPE","_args","binDir","path","join","storagePath","binaries","ext","removed","i","length","binaryPath","fs","existsSync","rmSync","force","console","log","exit"],"mappings":";;;;+BAQA;;;;CAIC,GACD;;;eAAwBA;;;iEAbP;yDACF;8BACQ;2DACN;2BACW;;;;;;AAE5B,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAO5E,SAASN,YAAYO,KAAe;IACjD,IAAMC,SAASC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAEtC,IAAMC,WAAW;QAAC;QAAQ;QAAO;KAAM;IACvC,IAAMC,MAAMZ,YAAY,SAAS;IAEjC,IAAIa,UAAU;IACd,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,IAAME,aAAaR,aAAI,CAACC,IAAI,CAACF,QAAQI,QAAQ,CAACG,EAAE,GAAGF;QACnD,IAAIK,WAAE,CAACC,UAAU,CAACF,aAAa;YAC7BG,IAAAA,sBAAM,EAACH,YAAY;gBAAEI,OAAO;YAAK;YACjCP;QACF;IACF;IAEA,IAAIA,UAAU,GAAG;QACfQ,QAAQC,GAAG,CAAC,AAAC,WAAoCf,OAA1BM,SAAQ,oBAAyB,OAAPN;QACjDc,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;IACd,OAAO;QACLD,QAAQC,GAAG,CAAC;IACd;IAEAC,IAAAA,mBAAI,EAAC;AACP"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/commands/uninstall.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { rmSync } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions, getAllInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu uninstall <version>\n *\n * Remove an installed Node version.\n */\nexport default function uninstallCmd(args: string[]): void {\n if (args.length === 0) {\n console.log('Usage: nvu uninstall <version>');\n console.log('Example: nvu uninstall 20');\n console.log(' nvu uninstall v20.19.6');\n exit(1);\n return;\n }\n\n const version = args[0].trim();\n const versionsPath = path.join(storagePath, 'installed');\n\n // Find all matching installed versions\n const matches = findInstalledVersions(versionsPath, version);\n\n if (matches.length === 0) {\n console.log(`Node ${version} is not installed.`);\n console.log('');\n console.log('Installed versions:');\n listInstalledVersions(versionsPath);\n exit(1);\n return;\n }\n\n if (matches.length > 1) {\n console.log(`Multiple versions match \"${version}\":`);\n for (let i = 0; i < matches.length; i++) {\n console.log(` ${matches[i]}`);\n }\n console.log('');\n console.log('Please specify the exact version to uninstall.');\n exit(1);\n return;\n }\n\n const installedVersion = matches[0];\n const versionPath = path.join(versionsPath, installedVersion);\n\n // Check if this is the current default (exact match since we store exact versions)\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n const defaultVersion = fs.readFileSync(defaultPath, 'utf8').trim();\n\n // Normalize both for comparison\n const normalizedDefault = defaultVersion.replace(/^v/, '');\n const normalizedInstalled = installedVersion.replace(/^v/, '');\n\n if (normalizedInstalled === normalizedDefault) {\n console.error(`Cannot uninstall default version ${installedVersion}.`);\n console.error('');\n console.error('Change your default first:');\n console.error(' nvu default <version>');\n exit(1);\n return;\n }\n }\n\n // Remove the version directory\n try {\n rmSync(versionPath);\n console.log(`Removed Node ${installedVersion}`);\n } catch (err) {\n console.error(`Failed to remove Node ${installedVersion}:`, (err as Error).message);\n exit(1);\n return;\n }\n\n exit(0);\n}\n\n/**\n * List installed versions for user reference\n */\nfunction listInstalledVersions(versionsPath: string): void {\n const versions = getAllInstalledVersions(versionsPath);\n\n if (versions.length === 0) {\n console.log(' (none)');\n } else {\n for (let i = 0; i < versions.length; i++) {\n console.log(` ${versions[i]}`);\n }\n }\n}\n"],"names":["uninstallCmd","args","length","console","log","exit","version","trim","versionsPath","path","join","storagePath","matches","findInstalledVersions","listInstalledVersions","i","installedVersion","versionPath","defaultPath","fs","existsSync","defaultVersion","readFileSync","normalizedDefault","replace","normalizedInstalled","error","rmSync","err","message","versions","getAllInstalledVersions"],"mappings":";;;;+BAOA;;;;CAIC,GACD;;;eAAwBA;;;iEAZP;yDACF;2DACE;wBACM;2BACK;uCACmC;;;;;;AAOhD,SAASA,aAAaC,IAAc;IACjD,IAAIA,KAAKC,MAAM,KAAK,GAAG;QACrBC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZC,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAMC,UAAUL,IAAI,CAAC,EAAE,CAACM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AAAA,mBAAI,EAAC;YACL;QACF;IACF;IAEA,+BAA+B;IAC/B,IAAI;QACFsB,IAAAA,gBAAM,EAACV;QACPd,QAAQC,GAAG,CAAC,AAAC,gBAAgC,OAAjBY;IAC9B,EAAE,OAAOY,KAAK;QACZzB,QAAQuB,KAAK,CAAC,AAAC,yBAAyC,OAAjBV,kBAAiB,MAAI,AAACY,IAAcC,OAAO;QAClFxB,IAAAA,mBAAI,EAAC;QACL;IACF;IAEAA,IAAAA,mBAAI,EAAC;AACP;AAEA;;CAEC,GACD,SAASS,sBAAsBN,YAAoB;IACjD,IAAMsB,WAAWC,IAAAA,gDAAuB,EAACvB;IAEzC,IAAIsB,SAAS5B,MAAM,KAAK,GAAG;QACzBC,QAAQC,GAAG,CAAC;IACd,OAAO;QACL,IAAK,IAAIW,IAAI,GAAGA,IAAIe,SAAS5B,MAAM,EAAEa,IAAK;YACxCZ,QAAQC,GAAG,CAAC,AAAC,KAAgB,OAAZ0B,QAAQ,CAACf,EAAE;QAC9B;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/uninstall.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { rmSync } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions, getAllInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu uninstall <version>\n *\n * Remove an installed Node version.\n */\nexport default function uninstallCmd(args: string[]): void {\n if (args.length === 0) {\n console.log('Usage: nvu uninstall <version>');\n console.log('Example: nvu uninstall 20');\n console.log(' nvu uninstall v20.19.6');\n exit(1);\n return;\n }\n\n const version = args[0].trim();\n const versionsPath = path.join(storagePath, 'installed');\n\n // Find all matching installed versions\n const matches = findInstalledVersions(versionsPath, version);\n\n if (matches.length === 0) {\n console.log(`Node ${version} is not installed.`);\n console.log('');\n console.log('Installed versions:');\n listInstalledVersions(versionsPath);\n exit(1);\n return;\n }\n\n if (matches.length > 1) {\n console.log(`Multiple versions match \"${version}\":`);\n for (let i = 0; i < matches.length; i++) {\n console.log(` ${matches[i]}`);\n }\n console.log('');\n console.log('Please specify the exact version to uninstall.');\n exit(1);\n return;\n }\n\n const installedVersion = matches[0];\n const versionPath = path.join(versionsPath, installedVersion);\n\n // Check if this is the current default (exact match since we store exact versions)\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n const defaultVersion = fs.readFileSync(defaultPath, 'utf8').trim();\n\n // Normalize both for comparison\n const normalizedDefault = defaultVersion.replace(/^v/, '');\n const normalizedInstalled = installedVersion.replace(/^v/, '');\n\n if (normalizedInstalled === normalizedDefault) {\n console.error(`Cannot uninstall default version ${installedVersion}.`);\n console.error('');\n console.error('Change your default first:');\n console.error(' nvu default <version>');\n exit(1);\n return;\n }\n }\n\n // Remove the version directory\n try {\n rmSync(versionPath);\n console.log(`Removed Node ${installedVersion}`);\n } catch (err) {\n console.error(`Failed to remove Node ${installedVersion}:`, (err as Error).message);\n exit(1);\n return;\n }\n\n exit(0);\n}\n\n/**\n * List installed versions for user reference\n */\nfunction listInstalledVersions(versionsPath: string): void {\n const versions = getAllInstalledVersions(versionsPath);\n\n if (versions.length === 0) {\n console.log(' (none)');\n } else {\n for (let i = 0; i < versions.length; i++) {\n console.log(` ${versions[i]}`);\n }\n }\n}\n"],"names":["uninstallCmd","args","length","console","log","exit","version","trim","versionsPath","path","join","storagePath","matches","findInstalledVersions","listInstalledVersions","i","installedVersion","versionPath","defaultPath","fs","existsSync","defaultVersion","readFileSync","normalizedDefault","replace","normalizedInstalled","error","rmSync","err","message","versions","getAllInstalledVersions"],"mappings":";;;;+BAOA;;;;CAIC,GACD;;;eAAwBA;;;iEAZP;yDACF;2DACE;wBACM;2BACK;uCACmC;;;;;;AAOhD,SAASA,aAAaC,IAAc;IACjD,IAAIA,KAAKC,MAAM,KAAK,GAAG;QACrBC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QAC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V,kBAAiB;YACnEb,QAAQuB,KAAK,CAAC;YACdvB,QAAQuB,KAAK,CAAC;YACdvB,QAAQuB,KAAK,CAAC;YACdrB,IAAAA,mBAAI,EAAC;YACL;QACF;IACF;IAEA,+BAA+B;IAC/B,IAAI;QACFsB,IAAAA,gBAAM,EAACV;QACPd,QAAQC,GAAG,CAAC,AAAC,gBAAgC,OAAjBY;IAC9B,EAAE,OAAOY,KAAK;QACZzB,QAAQuB,KAAK,CAAC,AAAC,yBAAyC,OAAjBV,kBAAiB,MAAI,AAACY,IAAcC,OAAO;QAClFxB,IAAAA,mBAAI,EAAC;QACL;IACF;IAEAA,IAAAA,mBAAI,EAAC;AACP;AAEA;;CAEC,GACD,SAASS,sBAAsBN,YAAoB;IACjD,IAAMsB,WAAWC,IAAAA,gDAAuB,EAACvB;IAEzC,IAAIsB,SAAS5B,MAAM,KAAK,GAAG;QACzBC,QAAQC,GAAG,CAAC;IACd,OAAO;QACL,IAAK,IAAIW,IAAI,GAAGA,IAAIe,SAAS5B,MAAM,EAAEa,IAAK;YACxCZ,QAAQC,GAAG,CAAC,AAAC,KAAgB,OAAZ0B,QAAQ,CAACf,EAAE;QAC9B;IACF;AACF"}
@@ -18,6 +18,7 @@ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
18
18
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
19
19
  var _constantsts = require("../constants.js");
20
20
  var _findInstalledVersionsts = require("../lib/findInstalledVersions.js");
21
+ var _resolveSystemBinaryts = require("../lib/resolveSystemBinary.js");
21
22
  function _interop_require_default(obj) {
22
23
  return obj && obj.__esModule ? obj : {
23
24
  default: obj
@@ -36,6 +37,20 @@ function whichCmd(_args) {
36
37
  (0, _exitcompat.default)(1);
37
38
  return;
38
39
  }
40
+ // Handle "system" version specially
41
+ if (version === 'system') {
42
+ console.log('Version: system');
43
+ console.log("Source: ".concat(getVersionSource(cwd)));
44
+ var systemNode = (0, _resolveSystemBinaryts.resolveSystemBinary)('node');
45
+ console.log("Binary: ".concat(systemNode || 'not found'));
46
+ if (systemNode) {
47
+ console.log('Status: Available');
48
+ } else {
49
+ console.log('Status: Not found (install Node.js on your system)');
50
+ }
51
+ (0, _exitcompat.default)(0);
52
+ return;
53
+ }
39
54
  // Resolve partial version to exact installed version
40
55
  var versionsPath = _path.default.join(_constantsts.storagePath, 'installed');
41
56
  var matches = (0, _findInstalledVersionsts.findInstalledVersions)(versionsPath, version);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/commands/which.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu which\n *\n * Show which Node binary would be used based on current directory.\n * This simulates what the nvu binary would do.\n */\nexport default function whichCmd(_args: string[]): void {\n const cwd = process.cwd();\n\n // Resolve version using the same logic as the nvu binary\n const version = resolveVersion(cwd);\n\n if (!version) {\n console.log('No Node version configured for this directory.');\n console.log('');\n console.log('To configure a version:');\n console.log(' nvu local <version> - Set version for this project');\n console.log(' nvu default <version> - Set global default');\n exit(1);\n return;\n }\n\n // Resolve partial version to exact installed version\n const versionsPath = path.join(storagePath, 'installed');\n const matches = findInstalledVersions(versionsPath, version);\n const resolvedVersion = matches.length > 0 ? matches[matches.length - 1] : null;\n\n // Display version (show resolution if different)\n if (resolvedVersion && resolvedVersion !== version && resolvedVersion !== `v${version}`) {\n console.log(`Version: ${version} \\u2192 ${resolvedVersion}`);\n } else {\n console.log(`Version: ${resolvedVersion || version}`);\n }\n console.log(`Source: ${getVersionSource(cwd)}`);\n\n if (resolvedVersion) {\n const actualVersionPath = path.join(versionsPath, resolvedVersion);\n const nodePath = path.join(actualVersionPath, 'bin', 'node');\n console.log(`Binary: ${nodePath}`);\n if (fs.existsSync(nodePath)) {\n console.log('Status: Installed');\n } else {\n console.log('Status: Directory exists but binary not found');\n }\n } else {\n console.log(`Status: Not installed (run: nvu install ${version})`);\n }\n\n exit(0);\n}\n\n/**\n * Resolve version from config files (mirrors nvu binary logic)\n */\nfunction resolveVersion(cwd: string): string | null {\n // Walk up directories looking for .nvurc or .nvmrc\n let dir = cwd;\n while (true) {\n // Check .nvurc first\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return fs.readFileSync(nvurcPath, 'utf8').trim();\n }\n\n // Check .nvmrc\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return fs.readFileSync(nvmrcPath, 'utf8').trim();\n }\n\n // Move to parent\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n // Check global default\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return fs.readFileSync(defaultPath, 'utf8').trim();\n }\n\n return null;\n}\n\n/**\n * Determine the source of the version (for display)\n */\nfunction getVersionSource(cwd: string): string {\n let dir = cwd;\n while (true) {\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return nvurcPath;\n }\n\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return nvmrcPath;\n }\n\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return `${defaultPath} (global default)`;\n }\n\n return 'none';\n}\n"],"names":["whichCmd","_args","cwd","process","version","resolveVersion","console","log","exit","versionsPath","path","join","storagePath","matches","findInstalledVersions","resolvedVersion","length","getVersionSource","actualVersionPath","nodePath","fs","existsSync","dir","nvurcPath","readFileSync","trim","nvmrcPath","parent","dirname","defaultPath"],"mappings":";;;;+BAMA;;;;;CAKC,GACD;;;eAAwBA;;;iEAZP;yDACF;2DACE;2BACW;uCACU;;;;;;AAQvB,SAASA,SAASC,KAAe;IAC9C,IAAMC,MAAMC,QAAQD,GAAG;IAEvB,yDAAy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penSource/node-version/node-version-use/src/commands/which.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\nimport { resolveSystemBinary } from '../lib/resolveSystemBinary.ts';\n\n/**\n * nvu which\n *\n * Show which Node binary would be used based on current directory.\n * This simulates what the nvu binary would do.\n */\nexport default function whichCmd(_args: string[]): void {\n const cwd = process.cwd();\n\n // Resolve version using the same logic as the nvu binary\n const version = resolveVersion(cwd);\n\n if (!version) {\n console.log('No Node version configured for this directory.');\n console.log('');\n console.log('To configure a version:');\n console.log(' nvu local <version> - Set version for this project');\n console.log(' nvu default <version> - Set global default');\n exit(1);\n return;\n }\n\n // Handle \"system\" version specially\n if (version === 'system') {\n console.log('Version: system');\n console.log(`Source: ${getVersionSource(cwd)}`);\n const systemNode = resolveSystemBinary('node');\n console.log(`Binary: ${systemNode || 'not found'}`);\n if (systemNode) {\n console.log('Status: Available');\n } else {\n console.log('Status: Not found (install Node.js on your system)');\n }\n exit(0);\n return;\n }\n\n // Resolve partial version to exact installed version\n const versionsPath = path.join(storagePath, 'installed');\n const matches = findInstalledVersions(versionsPath, version);\n const resolvedVersion = matches.length > 0 ? matches[matches.length - 1] : null;\n\n // Display version (show resolution if different)\n if (resolvedVersion && resolvedVersion !== version && resolvedVersion !== `v${version}`) {\n console.log(`Version: ${version} \\u2192 ${resolvedVersion}`);\n } else {\n console.log(`Version: ${resolvedVersion || version}`);\n }\n console.log(`Source: ${getVersionSource(cwd)}`);\n\n if (resolvedVersion) {\n const actualVersionPath = path.join(versionsPath, resolvedVersion);\n const nodePath = path.join(actualVersionPath, 'bin', 'node');\n console.log(`Binary: ${nodePath}`);\n if (fs.existsSync(nodePath)) {\n console.log('Status: Installed');\n } else {\n console.log('Status: Directory exists but binary not found');\n }\n } else {\n console.log(`Status: Not installed (run: nvu install ${version})`);\n }\n\n exit(0);\n}\n\n/**\n * Resolve version from config files (mirrors nvu binary logic)\n */\nfunction resolveVersion(cwd: string): string | null {\n // Walk up directories looking for .nvurc or .nvmrc\n let dir = cwd;\n while (true) {\n // Check .nvurc first\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return fs.readFileSync(nvurcPath, 'utf8').trim();\n }\n\n // Check .nvmrc\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return fs.readFileSync(nvmrcPath, 'utf8').trim();\n }\n\n // Move to parent\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n // Check global default\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return fs.readFileSync(defaultPath, 'utf8').trim();\n }\n\n return null;\n}\n\n/**\n * Determine the source of the version (for display)\n */\nfunction getVersionSource(cwd: string): string {\n let dir = cwd;\n while (true) {\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return nvurcPath;\n }\n\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return nvmrcPath;\n }\n\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return `${defaultPath} (global default)`;\n }\n\n return 'none';\n}\n"],"names":["whichCmd","_args","cwd","process","version","resolveVersion","console","log","exit","getVersionSource","systemNode","resolveSystemBinary","versionsPath","path","join","storagePath","matches","findInstalledVersions","resolvedVersion","length","actualVersionPath","nodePath","fs","existsSync","dir","nvurcPath","readFileSync","trim","nvmrcPath","parent","dirname","defaultPath"],"mappings":";;;;+BAOA;;;;;CAKC,GACD;;;eAAwBA;;;iEAbP;yDACF;2DACE;2BACW;uCACU;qCACF;;;;;;AAQrB,SAASA,SAASC,KAAe;IAC9C,IAAMC,MAAMC,QAAQD,GAAG;IAEvB,yDAAyD;IACzD,IAAME,UAAUC,eAAeH;IAE/B,I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OA;QACT;QAEA,IAAMC,SAAShB,aAAI,CAACiB,OAAO,CAACN;QAC5B,IAAIK,WAAWL,KAAK;QACpBA,MAAMK;IACR;IAEA,IAAME,cAAclB,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAC3C,IAAIO,WAAE,CAACC,UAAU,CAACQ,cAAc;QAC9B,OAAO,AAAC,GAAc,OAAZA,aAAY;IACxB;IAEA,OAAO;AACT"}
@@ -18,3 +18,4 @@ export interface DirEntry {
18
18
  isDirectory(): boolean;
19
19
  }
20
20
  export declare function readdirWithTypes(dir: string): DirEntry[];
21
+ export declare function objectAssign<T, U>(target: T, source: U): T & U;
@@ -18,3 +18,4 @@ export interface DirEntry {
18
18
  isDirectory(): boolean;
19
19
  }
20
20
  export declare function readdirWithTypes(dir: string): DirEntry[];
21
+ export declare function objectAssign<T, U>(target: T, source: U): T & U;
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  get mkdirpSync () {
19
19
  return mkdirpSync;
20
20
  },
21
+ get objectAssign () {
22
+ return objectAssign;
23
+ },
21
24
  get readdirWithTypes () {
22
25
  return readdirWithTypes;
23
26
  },
@@ -54,9 +57,7 @@ function tmpdir() {
54
57
  * - Falls back to lastIndexOf on Node 0.8-3.x
55
58
  */ var hasEndsWith = typeof String.prototype.endsWith === 'function';
56
59
  function stringEndsWith(str, search, position) {
57
- if (hasEndsWith) {
58
- return str.endsWith(search, position);
59
- }
60
+ if (hasEndsWith) return str.endsWith(search, position);
60
61
  var len = position === undefined ? str.length : position;
61
62
  return str.lastIndexOf(search) === len - search.length;
62
63
  }
@@ -92,4 +93,17 @@ function readdirWithTypes(dir) {
92
93
  };
93
94
  });
94
95
  }
96
+ /**
97
+ * Object.assign wrapper for Node.js 0.8+
98
+ * - Uses native Object.assign on Node 4.0+
99
+ * - Falls back to manual property copy on Node 0.8-3.x
100
+ */ var hasObjectAssign = typeof Object.assign === 'function';
101
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
102
+ function objectAssign(target, source) {
103
+ if (hasObjectAssign) return Object.assign(target, source);
104
+ for(var key in source){
105
+ if (_hasOwnProperty.call(source, key)) target[key] = source[key];
106
+ }
107
+ return target;
108
+ }
95
109
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport fs from 'fs';\nimport _Module from 'module';\nimport os from 'os';\nimport path from 'path';\n\n// Use existing require in CJS, or createRequire in ESM (Node 12.2+)\nconst _require = typeof require === 'undefined' ? _Module.createRequire(import.meta.url) : require;\n\nexport function homedir(): string {\n return typeof os.homedir === 'function' ? os.homedir() : require('homedir-polyfill')();\n}\n\nexport function tmpdir(): string {\n return typeof os.tmpdir === 'function' ? os.tmpdir() : require('os-shim').tmpdir();\n}\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith) {\n return str.endsWith(search, position);\n }\n const len = position === undefined ? str.length : position;\n return str.lastIndexOf(search) === len - search.length;\n}\n\n/**\n * Recursive mkdir for Node.js 0.8+\n */\nexport function mkdirpSync(dir: string): void {\n const mkdirp = _require('mkdirp-classic');\n mkdirp.sync(dir);\n}\n\n/**\n * Recursive rm for Node.js 0.8+\n */\nexport function rmSync(dir: string): void {\n const safeRmSync = _require('fs-remove-compat').safeRmSync;\n safeRmSync(dir);\n}\n\n/**\n * Read directory entries with types for Node.js 0.8+\n * Returns array of {name, isDirectory()}\n */\nexport interface DirEntry {\n name: string;\n isDirectory(): boolean;\n}\n\nexport function readdirWithTypes(dir: string): DirEntry[] {\n const names = fs.readdirSync(dir);\n return names.map((name) => {\n const fullPath = path.join(dir, name);\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch (_e) {\n // If stat fails, treat as non-directory\n return { name: name, isDirectory: () => false };\n }\n return {\n name: name,\n isDirectory: () => stat.isDirectory(),\n };\n });\n}\n"],"names":["homedir","mkdirpSync","readdirWithTypes","rmSync","stringEndsWith","tmpdir","_require","require","_Module","createRequire","os","hasEndsWith","String","prototype","endsWith","str","search","position","len","undefined","length","lastIndexOf","dir","mkdirp","sync","safeRmSync","names","fs","readdirSync","map","name","fullPath","path","join","stat","statSync","_e","isDirectory"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;QASeA;eAAAA;;QAyBAC;eAAAA;;QAsBAC;eAAAA;;QAdAC;eAAAA;;QAnBAC;eAAAA;;QAVAC;eAAAA;;;yDAZD;6DACK;yDACL;2DACE;;;;;;AAEjB,oEAAoE;AACpE,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAO,CAACC,aAAa,CAAC,uDAAmBF;AAEpF,SAASP;IACd,OAAO,OAAOU,WAAE,CAACV,OAAO,KAAK,aAAaU,WAAE,CAACV,OAAO,KAAKO,QAAQ;AACnE;AAEO,SAASF;IACd,OAAO,OAAOK,WAAE,CAACL,MAAM,KAAK,aAAaK,WAAE,CAACL,MAAM,KAAKE,QAAQ,WAAWF,MAAM;AAClF;AAEA;;;;CAIC,GACD,IAAMM,cAAc,OAAOC,OAAOC,SAAS,CAACC,QAAQ,KAAK;AAClD,SAASV,eAAeW,GAAW,EAAEC,MAAc,EAAEC,QAAiB;IAC3E,IAAIN,aAAa;QACf,OAAOI,IAAID,QAAQ,CAACE,QAAQC;IAC9B;IACA,IAAMC,MAAMD,aAAaE,YAAYJ,IAAIK,MAAM,GAAGH;IAClD,OAAOF,IAAIM,WAAW,CAACL,YAAYE,MAAMF,OAAOI,MAAM;AACxD;AAKO,SAASnB,WAAWqB,GAAW;IACpC,IAAMC,SAASjB,SAAS;IACxBiB,OAAOC,IAAI,CAACF;AACd;AAKO,SAASnB,OAAOmB,GAAW;IAChC,IAAMG,aAAanB,SAAS,oBAAoBmB,UAAU;IAC1DA,WAAWH;AACb;AAWO,SAASpB,iBAAiBoB,GAAW;IAC1C,IAAMI,QAAQC,WAAE,CAACC,WAAW,CAACN;IAC7B,OAAOI,MAAMG,GAAG,CAAC,SAACC;QAChB,IAAMC,WAAWC,aAAI,CAACC,IAAI,CAACX,KAAKQ;QAChC,IAAII;QACJ,IAAI;YACFA,OAAOP,WAAE,CAACQ,QAAQ,CAACJ;QACrB,EAAE,OAAOK,IAAI;YACX,wCAAwC;YACxC,OAAO;gBAAEN,MAAMA;gBAAMO,aAAa;2BAAM;;YAAM;QAChD;QACA,OAAO;YACLP,MAAMA;YACNO,aAAa;uBAAMH,KAAKG,WAAW;;QACrC;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport fs from 'fs';\nimport Module from 'module';\nimport os from 'os';\nimport path from 'path';\n\n// Use existing require in CJS, or createRequire in ESM (Node 12.2+)\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nexport function homedir(): string {\n return typeof os.homedir === 'function' ? os.homedir() : require('homedir-polyfill')();\n}\n\nexport function tmpdir(): string {\n return typeof os.tmpdir === 'function' ? os.tmpdir() : require('os-shim').tmpdir();\n}\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith) return str.endsWith(search, position);\n const len = position === undefined ? str.length : position;\n return str.lastIndexOf(search) === len - search.length;\n}\n\n/**\n * Recursive mkdir for Node.js 0.8+\n */\nexport function mkdirpSync(dir: string): void {\n const mkdirp = _require('mkdirp-classic');\n mkdirp.sync(dir);\n}\n\n/**\n * Recursive rm for Node.js 0.8+\n */\nexport function rmSync(dir: string): void {\n const safeRmSync = _require('fs-remove-compat').safeRmSync;\n safeRmSync(dir);\n}\n\n/**\n * Read directory entries with types for Node.js 0.8+\n * Returns array of {name, isDirectory()}\n */\nexport interface DirEntry {\n name: string;\n isDirectory(): boolean;\n}\n\nexport function readdirWithTypes(dir: string): DirEntry[] {\n const names = fs.readdirSync(dir);\n return names.map((name) => {\n const fullPath = path.join(dir, name);\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch (_e) {\n // If stat fails, treat as non-directory\n return { name: name, isDirectory: () => false };\n }\n return {\n name: name,\n isDirectory: () => stat.isDirectory(),\n };\n });\n}\n\n/**\n * Object.assign wrapper for Node.js 0.8+\n * - Uses native Object.assign on Node 4.0+\n * - Falls back to manual property copy on Node 0.8-3.x\n */\nconst hasObjectAssign = typeof Object.assign === 'function';\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport function objectAssign<T, U>(target: T, source: U): T & U {\n if (hasObjectAssign) return Object.assign(target, source);\n\n for (const key in source) {\n if (_hasOwnProperty.call(source, key)) (target as Record<string, unknown>)[key] = source[key];\n }\n return target as T & U;\n}\n"],"names":["homedir","mkdirpSync","objectAssign","readdirWithTypes","rmSync","stringEndsWith","tmpdir","_require","require","Module","createRequire","os","hasEndsWith","String","prototype","endsWith","str","search","position","len","undefined","length","lastIndexOf","dir","mkdirp","sync","safeRmSync","names","fs","readdirSync","map","name","fullPath","path","join","stat","statSync","_e","isDirectory","hasObjectAssign","Object","assign","_hasOwnProperty","hasOwnProperty","target","source","key","call"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;QASeA;eAAAA;;QAuBAC;eAAAA;;QAgDAC;eAAAA;;QA1BAC;eAAAA;;QAdAC;eAAAA;;QAjBA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,WAAW;;QACrC;IACF;AACF;AAEA;;;;CAIC,GACD,IAAMC,kBAAkB,OAAOC,OAAOC,MAAM,KAAK;AACjD,IAAMC,kBAAkBF,OAAO1B,SAAS,CAAC6B,cAAc;AAEhD,SAASzC,aAAmB0C,MAAS,EAAEC,MAAS;IACrD,IAAIN,iBAAiB,OAAOC,OAAOC,MAAM,CAACG,QAAQC;IAElD,IAAK,IAAMC,OAAOD,OAAQ;QACxB,IAAIH,gBAAgBK,IAAI,CAACF,QAAQC,MAAM,AAACF,MAAkC,CAACE,IAAI,GAAGD,MAAM,CAACC,IAAI;IAC/F;IACA,OAAOF;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport { homedir } from './compat.ts';\n\n// Allow NVU_HOME override for testing\nexport const storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n"],"names":["storagePath","process","env","NVU_HOME","path","join","homedir"],"mappings":";;;;+BAIaA;;;eAAAA;;;2DAJI;wBACO;;;;;;AAGjB,IAAMA,cAAeC,QAAQC,GAAG,CAACC,QAAQ,IAAIC,aAAI,CAACC,IAAI,CAACC,IAAAA,iBAAO,KAAI"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport { homedir } from './compat.ts';\n\n// Allow NVU_HOME override for testing\nexport const storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n"],"names":["storagePath","process","env","NVU_HOME","path","join","homedir"],"mappings":";;;;+BAIaA;;;eAAAA;;;2DAJI;wBACO;;;;;;AAGjB,IAAMA,cAAeC,QAAQC,GAAG,CAACC,QAAQ,IAAIC,aAAI,CAACC,IAAI,CAACC,IAAAA,iBAAO,KAAI"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/index.ts"],"sourcesContent":["import type { UseCallback, UseOptions, UseResult } from './types.ts';\nimport worker from './worker.ts';\n\nexport type * from './types.ts';\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[]): Promise<UseResult[]>;\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options: UseOptions): Promise<UseResult[]>;\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], callback: UseCallback): void;\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options: UseOptions, callback: UseCallback): void;\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options?: UseOptions | UseCallback, callback?: UseCallback): void | Promise<UseResult[]> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as UseOptions);\n\n if (typeof callback === 'function') return worker(versionExpression, command, args, options, callback);\n return new Promise((resolve, reject) =>\n worker(versionExpression, command, args, options, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n}\n"],"names":["nodeVersionUse","versionExpression","command","args","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;+BAWA;;;eAAwBA;;;+DAVL;;;;;;AAUJ,SAASA,eAAeC,iBAAyB,EAAEC,OAAe,EAAEC,IAAc,EAAEC,OAAkC,EAAEC,QAAsB;IAC3JA,WAAW,OAAOD,YAAY,aAAaA,UAAUC;IACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;IAE7D,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,iBAAM,EAACL,mBAAmBC,SAASC,MAAMC,SAASC;IAC7F,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAC3BH,IAAAA,iBAAM,EAACL,mBAAmBC,SAASC,MAAMC,SAAS,SAACM,KAAKC;YACtDD,MAAMD,OAAOC,OAAOF,QAAQG;QAC9B;;AAEJ"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/index.ts"],"sourcesContent":["import type { UseCallback, UseOptions, UseResult } from './types.ts';\nimport worker from './worker.ts';\n\nexport type * from './types.ts';\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[]): Promise<UseResult[]>;\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options: UseOptions): Promise<UseResult[]>;\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], callback: UseCallback): void;\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options: UseOptions, callback: UseCallback): void;\n\nexport default function nodeVersionUse(versionExpression: string, command: string, args: string[], options?: UseOptions | UseCallback, callback?: UseCallback): void | Promise<UseResult[]> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as UseOptions);\n\n if (typeof callback === 'function') return worker(versionExpression, command, args, options, callback);\n return new Promise((resolve, reject) =>\n worker(versionExpression, command, args, options, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n}\n"],"names":["nodeVersionUse","versionExpression","command","args","options","callback","worker","Promise","resolve","reject","err","result"],"mappings":";;;;+BAWA;;;eAAwBA;;;+DAVL;;;;;;AAUJ,SAASA,eAAeC,iBAAyB,EAAEC,OAAe,EAAEC,IAAc,EAAEC,OAAkC,EAAEC,QAAsB;IAC3JA,WAAW,OAAOD,YAAY,aAAaA,UAAUC;IACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;IAE7D,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,iBAAM,EAACL,mBAAmBC,SAASC,MAAMC,SAASC;IAC7F,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAC3BH,IAAAA,iBAAM,EAACL,mBAAmBC,SAASC,MAAMC,SAAS,SAACM,KAAKC;YACtDD,MAAMD,OAAOC,OAAOF,QAAQG;QAC9B;;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/lib/findInstalledVersions.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\n\n/**\n * Compare two semver version strings (e.g., \"20.19.0\" vs \"20.9.1\")\n * Returns: negative if a < b, positive if a > b, 0 if equal\n */\nfunction compareVersions(a: string, b: string): number {\n const aParts = a.replace(/^v/, '').split('.');\n const bParts = b.replace(/^v/, '').split('.');\n const len = Math.max(aParts.length, bParts.length);\n\n for (let i = 0; i < len; i++) {\n const aNum = parseInt(aParts[i], 10) || 0;\n const bNum = parseInt(bParts[i], 10) || 0;\n if (aNum !== bNum) {\n return aNum - bNum;\n }\n }\n return 0;\n}\n\n/**\n * Find all installed versions matching the given version string\n * Results are sorted in ascending semver order (lowest first, highest last)\n */\nexport function findInstalledVersions(versionsPath: string, version: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const normalizedVersion = version.replace(/^v/, '');\n const matches: string[] = [];\n\n // Try exact matches first\n const exactMatches = [version, `v${normalizedVersion}`, normalizedVersion];\n for (let i = 0; i < exactMatches.length; i++) {\n const v = exactMatches[i];\n const versionPath = path.join(versionsPath, v);\n if (fs.existsSync(versionPath) && fs.statSync(versionPath).isDirectory()) {\n if (matches.indexOf(v) === -1) {\n matches.push(v);\n }\n }\n }\n\n // If we have an exact match, return just that\n if (matches.length > 0) {\n return matches;\n }\n\n // Try partial match (e.g., \"20\" matches \"v20.19.6\")\n const entries = readdirWithTypes(versionsPath);\n for (let j = 0; j < entries.length; j++) {\n const entry = entries[j];\n if (!entry.isDirectory()) continue;\n const dirVersion = entry.name.replace(/^v/, '');\n if (dirVersion.indexOf(`${normalizedVersion}.`) === 0) {\n matches.push(entry.name);\n }\n }\n\n // Sort by semver (ascending) so highest version is last\n matches.sort(compareVersions);\n\n return matches;\n}\n\n/**\n * Get all installed versions\n */\nexport function getAllInstalledVersions(versionsPath: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const entries = readdirWithTypes(versionsPath);\n const versions: string[] = [];\n for (let i = 0; i < entries.length; i++) {\n if (entries[i].isDirectory()) {\n versions.push(entries[i].name);\n }\n }\n\n return versions;\n}\n"],"names":["findInstalledVersions","getAllInstalledVersions","compareVersions","a","b","aParts","replace","split","bParts","len","Math","max","length","i","aNum","parseInt","bNum","versionsPath","version","fs","existsSync","normalizedVersion","matches","exactMatches","v","versionPath","path","join","statSync","isDirectory","indexOf","push","entries","readdirWithTypes","j","entry","dirVersion","name","sort","versions"],"mappings":";;;;;;;;;;;QA2BgBA;eAAAA;;QA6CAC;eAAAA;;;yDAxED;2DACE;wBACgB;;;;;;AAEjC;;;CAGC,GACD,SAASC,gBAAgBC,CAAS,EAAEC,CAAS;IAC3C,IAAMC,SAASF,EAAEG,OAAO,CAAC,MAAM,IAAIC,KAAK,CAAC;IACzC,IAAMC,SAASJ,EAAEE,OAAO,CAAC,MAAM,IAAIC,KAAK,CAAC;IACzC,IAAME,MAAMC,KAAKC,GAAG,CAACN,OAAOO,MAAM,EAAEJ,OAAOI,MAAM;IAEjD,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,KAAKI,IAAK;QAC5B,IAAMC,OAAOC,SAASV,MAAM,CAACQ,EAAE,EAAE,OAAO;QACxC,IAAMG,OAAOD,SAASP,MAAM,CAACK,EAAE,EAAE,OAAO;QACxC,IAAIC,SAASE,MAAM;YACjB,OAAOF,OAAOE;QAChB;IACF;IACA,OAAO;AACT;AAMO,SAAShB,sBAAsBiB,YAAoB,EAAEC,OAAe;IACzE,IAAI,CAACC,WAAE,CAACC,UAAU,CAACH,eAAe;QAChC,OAAO,EAAE;IACX;IAEA,IAAMI,oBAAoBH,QAAQZ,OAAO,CAAC,MAAM;IAChD,IAAMgB,UAAoB,EAAE;IAE5B,0BAA0B;IAC1B,IAAMC,eAAe;QAACL;QAAU,IAAqB,OAAlBG;QAAqBA;KAAkB;IAC1E,IAAK,IAAIR,IAAI,GAAGA,IAAIU,aAAaX,MAAM,EAAEC,IAAK;QAC5C,IAAMW,IAAID,YAAY,CAACV,EAAE;QACzB,IAAMY,cAAcC,aAAI,CAACC,IAAI,CAACV,cAAcO;QAC5C,IAAIL,WAAE,CAACC,UAAU,CAACK,gBAAgBN,WAAE,CAACS,QAAQ,CAACH,aAAaI,WAAW,IAAI;YACxE,IAAIP,QAAQQ,OAAO,CAACN,OAAO,CAAC,GAAG;gBAC7BF,QAAQS,IAAI,CAACP;YACf;QACF;IACF;IAEA,8CAA8C;IAC9C,IAAIF,QAAQV,MAAM,GAAG,GAAG;QACtB,OAAOU;IACT;IAEA,oDAAoD;IACpD,IAAMU,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAK,IAAIiB,IAAI,GAAGA,IAAIF,QAAQpB,MAAM,EAAEsB,IAAK;QACvC,IAAMC,QAAQH,OAAO,CAACE,EAAE;QACxB,IAAI,CAACC,MAAMN,WAAW,IAAI;QAC1B,IAAMO,aAAaD,MAAME,IAAI,CAAC/B,OAAO,CAAC,MAAM;QAC5C,IAAI8B,WAAWN,OAAO,CAAC,AAAC,GAAoB,OAAlBT,mBAAkB,UAAQ,GAAG;YACrDC,QAAQS,IAAI,CAACI,MAAME,IAAI;QACzB;IACF;IAEA,wDAAwD;IACxDf,QAAQgB,IAAI,CAACpC;IAEb,OAAOoB;AACT;AAKO,SAASrB,wBAAwBgB,YAAoB;IAC1D,IAAI,CAACE,WAAE,CAACC,UAAU,CAACH,eAAe;QAChC,OAAO,EAAE;IACX;IAEA,IAAMe,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAMsB,WAAqB,EAAE;IAC7B,IAAK,IAAI1B,IAAI,GAAGA,IAAImB,QAAQpB,MAAM,EAAEC,IAAK;QACvC,IAAImB,OAAO,CAACnB,EAAE,CAACgB,WAAW,IAAI;YAC5BU,SAASR,IAAI,CAACC,OAAO,CAACnB,EAAE,CAACwB,IAAI;QAC/B;IACF;IAEA,OAAOE;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/lib/findInstalledVersions.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\n\n/**\n * Compare two semver version strings (e.g., \"20.19.0\" vs \"20.9.1\")\n * Returns: negative if a < b, positive if a > b, 0 if equal\n */\nfunction compareVersions(a: string, b: string): number {\n const aParts = a.replace(/^v/, '').split('.');\n const bParts = b.replace(/^v/, '').split('.');\n const len = Math.max(aParts.length, bParts.length);\n\n for (let i = 0; i < len; i++) {\n const aNum = parseInt(aParts[i], 10) || 0;\n const bNum = parseInt(bParts[i], 10) || 0;\n if (aNum !== bNum) {\n return aNum - bNum;\n }\n }\n return 0;\n}\n\n/**\n * Find all installed versions matching the given version string\n * Results are sorted in ascending semver order (lowest first, highest last)\n */\nexport function findInstalledVersions(versionsPath: string, version: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const normalizedVersion = version.replace(/^v/, '');\n const matches: string[] = [];\n\n // Try exact matches first\n const exactMatches = [version, `v${normalizedVersion}`, normalizedVersion];\n for (let i = 0; i < exactMatches.length; i++) {\n const v = exactMatches[i];\n const versionPath = path.join(versionsPath, v);\n if (fs.existsSync(versionPath) && fs.statSync(versionPath).isDirectory()) {\n if (matches.indexOf(v) === -1) {\n matches.push(v);\n }\n }\n }\n\n // If we have an exact match, return just that\n if (matches.length > 0) {\n return matches;\n }\n\n // Try partial match (e.g., \"20\" matches \"v20.19.6\")\n const entries = readdirWithTypes(versionsPath);\n for (let j = 0; j < entries.length; j++) {\n const entry = entries[j];\n if (!entry.isDirectory()) continue;\n const dirVersion = entry.name.replace(/^v/, '');\n if (dirVersion.indexOf(`${normalizedVersion}.`) === 0) {\n matches.push(entry.name);\n }\n }\n\n // Sort by semver (ascending) so highest version is last\n matches.sort(compareVersions);\n\n return matches;\n}\n\n/**\n * Get all installed versions\n */\nexport function getAllInstalledVersions(versionsPath: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const entries = readdirWithTypes(versionsPath);\n const versions: string[] = [];\n for (let i = 0; i < entries.length; i++) {\n if (entries[i].isDirectory()) {\n versions.push(entries[i].name);\n }\n }\n\n return versions;\n}\n"],"names":["findInstalledVersions","getAllInstalledVersions","compareVersions","a","b","aParts","replace","split","bParts","len","Math","max","length","i","aNum","parseInt","bNum","versionsPath","version","fs","existsSync","normalizedVersion","matches","exactMatches","v","versionPath","path","join","statSync","isDirectory","indexOf","push","entries","readdirWithTypes","j","entry","dirVersion","name","sort","versions"],"mappings":";;;;;;;;;;;QA2BgBA;eAAAA;;QA6CAC;eAAAA;;;yDAxED;2DACE;wBACgB;;;;;;AAEjC;;;CAGC,GACD,SAASC,gBAAgBC,CAAS,EAAEC,CAAS;IAC3C,IAAMC,SAASF,EAAEG,OAAO,CAAC,MAAM,IAAIC,KAAK,CAAC;IACzC,IAAMC,SAASJ,EAAEE,OAAO,CAAC,MAAM,IAAIC,KAAK,CAAC;IACzC,IAAME,MAAMC,KAAKC,GAAG,CAACN,OAAOO,MAAM,EAAEJ,OAAOI,MAAM;IAEjD,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,KAAKI,IAAK;QAC5B,IAAMC,OAAOC,SAASV,MAAM,CAACQ,EAAE,EAAE,OAAO;QACxC,IAAMG,OAAOD,SAASP,MAAM,CAACK,EAAE,EAAE,OAAO;QACxC,IAAIC,SAASE,MAAM;YACjB,OAAOF,OAAOE;QAChB;IACF;IACA,OAAO;AACT;AAMO,SAAShB,sBAAsBiB,YAAoB,EAAEC,OAAe;IACzE,IAAI,CAACC,WAAE,CAACC,UAAU,CAACH,eAAe;QAChC,OAAO,EAAE;IACX;IAEA,IAAMI,oBAAoBH,QAAQZ,OAAO,CAAC,MAAM;IAChD,IAAMgB,UAAoB,EAAE;IAE5B,0BAA0B;IAC1B,IAAMC,eAAe;QAACL;QAAU,IAAqB,OAAlBG;QAAqBA;KAAkB;IAC1E,IAAK,IAAIR,IAAI,GAAGA,IAAIU,aAAaX,MAAM,EAAEC,IAAK;QAC5C,IAAMW,IAAID,YAAY,CAACV,EAAE;QACzB,IAAMY,cAAcC,aAAI,CAACC,IAAI,CAACV,cAAcO;QAC5C,IAAIL,WAAE,CAACC,UAAU,CAACK,gBAAgBN,WAAE,CAACS,QAAQ,CAACH,aAAaI,WAAW,IAAI;YACxE,IAAIP,QAAQQ,OAAO,CAACN,OAAO,CAAC,GAAG;gBAC7BF,QAAQS,IAAI,CAACP;YACf;QACF;IACF;IAEA,8CAA8C;IAC9C,IAAIF,QAAQV,MAAM,GAAG,GAAG;QACtB,OAAOU;IACT;IAEA,oDAAoD;IACpD,IAAMU,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAK,IAAIiB,IAAI,GAAGA,IAAIF,QAAQpB,MAAM,EAAEsB,IAAK;QACvC,IAAMC,QAAQH,OAAO,CAACE,EAAE;QACxB,IAAI,CAACC,MAAMN,WAAW,IAAI;QAC1B,IAAMO,aAAaD,MAAME,IAAI,CAAC/B,OAAO,CAAC,MAAM;QAC5C,IAAI8B,WAAWN,OAAO,CAAC,AAAC,GAAoB,OAAlBT,mBAAkB,UAAQ,GAAG;YACrDC,QAAQS,IAAI,CAACI,MAAME,IAAI;QACzB;IACF;IAEA,wDAAwD;IACxDf,QAAQgB,IAAI,CAACpC;IAEb,OAAOoB;AACT;AAKO,SAASrB,wBAAwBgB,YAAoB;IAC1D,IAAI,CAACE,WAAE,CAACC,UAAU,CAACH,eAAe;QAChC,OAAO,EAAE;IACX;IAEA,IAAMe,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAMsB,WAAqB,EAAE;IAC7B,IAAK,IAAI1B,IAAI,GAAGA,IAAImB,QAAQpB,MAAM,EAAEC,IAAK;QACvC,IAAImB,OAAO,CAACnB,EAAE,CAACgB,WAAW,IAAI;YAC5BU,SAASR,IAAI,CAACC,OAAO,CAACnB,EAAE,CAACwB,IAAI;QAC/B;IACF;IAEA,OAAOE;AACT"}
@@ -57,7 +57,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
57
57
  }
58
58
  return newObj;
59
59
  }
60
- var _dirname = _path.default.dirname(typeof __dirname !== 'undefined' ? __dirname : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
60
+ var _dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
61
61
  var nodeModules = _path.default.join(_dirname, '..', '..', '..', 'node_modules');
62
62
  var moduleName = 'node-version-install';
63
63
  var cached;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/_later/node-version-use/src/lib/loadNodeVersionInstall.ts"],"sourcesContent":["import installModule from 'install-module-linked';\nimport type { InstallOptions, InstallResult } from 'node-version-install';\nimport path from 'path';\nimport url from 'url';\n\nconst _dirname = path.dirname(typeof __dirname !== 'undefined' ? __dirname : url.fileURLToPath(import.meta.url));\nconst nodeModules = path.join(_dirname, '..', '..', '..', 'node_modules');\nconst moduleName = 'node-version-install';\n\ntype InstallCallback = (err?: Error, results?: InstallResult[]) => void;\ntype InstallVersionFn = (version: string, options: InstallOptions, callback: InstallCallback) => void;\n\nlet cached: InstallVersionFn | undefined;\n\nfunction loadModule(moduleName, callback) {\n if (typeof require === 'undefined') {\n import(moduleName)\n .then((mod) => {\n callback(null, mod?.default ?? null);\n })\n .catch(callback);\n } else {\n try {\n callback(null, require(moduleName));\n } catch (err) {\n callback(err, null);\n }\n }\n}\n\nexport default function loadNodeVersionInstall(callback: (err: Error | null, installVersion: InstallVersionFn) => void): void {\n if (cached !== undefined) return callback(null, cached);\n\n installModule(moduleName, nodeModules, {}, (err) => {\n if (err) return callback(err, null);\n loadModule(moduleName, (err, _cached: InstallVersionFn) => {\n if (err) return callback(err, null);\n cached = _cached;\n callback(null, cached);\n });\n });\n}\n"],"names":["loadNodeVersionInstall","_dirname","path","dirname","__dirname","url","fileURLToPath","nodeModules","join","moduleName","cached","loadModule","callback","require","then","mod","default","catch","err","undefined","installModule","_cached"],"mappings":";;;;+BA8BA;;;eAAwBA;;;0EA9BE;2DAET;0DACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhB,IAAMC,WAAWC,aAAI,CAACC,OAAO,CAAC,OAAOC,cAAc,cAAcA,YAAYC,YAAG,CAACC,aAAa,CAAC;AAC/F,IAAMC,cAAcL,aAAI,CAACM,IAAI,CAACP,UAAU,MAAM,MAAM,MAAM;AAC1D,IAAMQ,aAAa;AAKnB,IAAIC;AAEJ,SAASC,WAAWF,UAAU,EAAEG,QAAQ;IACtC,IAAI,OAAOC,YAAY,aAAa;QAClC,gBAAOJ;2DAAP;WACGK,IAAI,CAAC,SAACC;;YACLH,SAAS,cAAMG,gBAAAA,0BAAAA,IAAKC,OAAO,uCAAI;QACjC,GACCC,KAAK,CAACL;IACX,OAAO;QACL,IAAI;YACFA,SAAS,MAAMC,QAAQJ;QACzB,EAAE,OAAOS,KAAK;YACZN,SAASM,KAAK;QAChB;IACF;AACF;AAEe,SAASlB,uBAAuBY,QAAuE;IACpH,IAAIF,WAAWS,WAAW,OAAOP,SAAS,MAAMF;IAEhDU,IAAAA,4BAAa,EAACX,YAAYF,aAAa,CAAC,GAAG,SAACW;QAC1C,IAAIA,KAAK,OAAON,SAASM,KAAK;QAC9BP,WAAWF,YAAY,SAACS,KAAKG;YAC3B,IAAIH,KAAK,OAAON,SAASM,KAAK;YAC9BR,SAASW;YACTT,SAAS,MAAMF;QACjB;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/lib/loadNodeVersionInstall.ts"],"sourcesContent":["import installModule from 'install-module-linked';\nimport type { InstallOptions, InstallResult } from 'node-version-install';\nimport path from 'path';\nimport url from 'url';\n\nconst _dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst nodeModules = path.join(_dirname, '..', '..', '..', 'node_modules');\nconst moduleName = 'node-version-install';\n\ntype InstallCallback = (err?: Error, results?: InstallResult[]) => void;\ntype InstallVersionFn = (version: string, options: InstallOptions, callback: InstallCallback) => void;\n\nlet cached: InstallVersionFn | undefined;\n\nfunction loadModule(moduleName, callback) {\n if (typeof require === 'undefined') {\n import(moduleName)\n .then((mod) => {\n callback(null, mod?.default ?? null);\n })\n .catch(callback);\n } else {\n try {\n callback(null, require(moduleName));\n } catch (err) {\n callback(err, null);\n }\n }\n}\n\nexport default function loadNodeVersionInstall(callback: (err: Error | null, installVersion: InstallVersionFn) => void): void {\n if (cached !== undefined) return callback(null, cached);\n\n installModule(moduleName, nodeModules, {}, (err) => {\n if (err) return callback(err, null);\n loadModule(moduleName, (err, _cached: InstallVersionFn) => {\n if (err) return callback(err, null);\n cached = _cached;\n callback(null, cached);\n });\n });\n}\n"],"names":["loadNodeVersionInstall","_dirname","path","dirname","__filename","url","fileURLToPath","nodeModules","join","moduleName","cached","loadModule","callback","require","then","mod","default","catch","err","undefined","installModule","_cached"],"mappings":";;;;+BA8BA;;;eAAwBA;;;0EA9BE;2DAET;0DACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhB,IAAMC,WAAWC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACvG,IAAMG,cAAcL,aAAI,CAACM,IAAI,CAACP,UAAU,MAAM,MAAM,MAAM;AAC1D,IAAMQ,aAAa;AAKnB,IAAIC;AAEJ,SAASC,WAAWF,UAAU,EAAEG,QAAQ;IACtC,IAAI,OAAOC,YAAY,aAAa;QAClC,gBAAOJ;2DAAP;WACGK,IAAI,CAAC,SAACC;;YACLH,SAAS,cAAMG,gBAAAA,0BAAAA,IAAKC,OAAO,uCAAI;QACjC,GACCC,KAAK,CAACL;IACX,OAAO;QACL,IAAI;YACFA,SAAS,MAAMC,QAAQJ;QACzB,EAAE,OAAOS,KAAK;YACZN,SAASM,KAAK;QAChB;IACF;AACF;AAEe,SAASlB,uBAAuBY,QAAuE;IACpH,IAAIF,WAAWS,WAAW,OAAOP,SAAS,MAAMF;IAEhDU,IAAAA,4BAAa,EAACX,YAAYF,aAAa,CAAC,GAAG,SAACW;QAC1C,IAAIA,KAAK,OAAON,SAASM,KAAK;QAC9BP,WAAWF,YAAY,SAACS,KAAKG;YAC3B,IAAIH,KAAK,OAAON,SAASM,KAAK;YAC9BR,SAASW;YACTT,SAAS,MAAMF;QACjB;IACF;AACF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Find a system binary by searching PATH, excluding ~/.nvu/bin
3
+ * Returns the full path to the binary, or null if not found
4
+ */
5
+ export declare function resolveSystemBinary(name: string): string | null;
6
+ /**
7
+ * Get PATH with ~/.nvu/bin removed
8
+ * Used to create an environment for spawning system commands
9
+ */
10
+ export declare function getPathWithoutNvuBin(): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Find a system binary by searching PATH, excluding ~/.nvu/bin
3
+ * Returns the full path to the binary, or null if not found
4
+ */
5
+ export declare function resolveSystemBinary(name: string): string | null;
6
+ /**
7
+ * Get PATH with ~/.nvu/bin removed
8
+ * Used to create an environment for spawning system commands
9
+ */
10
+ export declare function getPathWithoutNvuBin(): string;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Resolve system binaries by searching PATH while excluding ~/.nvu/bin
3
+ * This mirrors the Go binary's findSystemBinary() function
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: Object.getOwnPropertyDescriptor(all, name).get
12
+ });
13
+ }
14
+ _export(exports, {
15
+ get getPathWithoutNvuBin () {
16
+ return getPathWithoutNvuBin;
17
+ },
18
+ get resolveSystemBinary () {
19
+ return resolveSystemBinary;
20
+ }
21
+ });
22
+ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
23
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
24
+ var _compatts = require("../compat.js");
25
+ function _interop_require_default(obj) {
26
+ return obj && obj.__esModule ? obj : {
27
+ default: obj
28
+ };
29
+ }
30
+ var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
31
+ var nvuBinDir = _path.default.join((0, _compatts.homedir)(), '.nvu', 'bin');
32
+ /**
33
+ * Check if two paths are equal (case-insensitive on Windows)
34
+ */ function pathsEqual(a, b) {
35
+ if (isWindows) {
36
+ return a.toLowerCase() === b.toLowerCase();
37
+ }
38
+ return a === b;
39
+ }
40
+ /**
41
+ * Check if a path is within the nvu bin directory
42
+ */ function isInNvuBin(filePath) {
43
+ try {
44
+ var realPath = _fs.default.realpathSync(filePath);
45
+ return realPath.indexOf(_path.default.join('.nvu', 'bin')) >= 0 || pathsEqual(_path.default.dirname(realPath), nvuBinDir);
46
+ } catch (_e) {
47
+ return false;
48
+ }
49
+ }
50
+ function resolveSystemBinary(name) {
51
+ var pathEnv = process.env.PATH || '';
52
+ var pathSep = isWindows ? ';' : ':';
53
+ var dirs = pathEnv.split(pathSep);
54
+ for(var i = 0; i < dirs.length; i++){
55
+ var dir = dirs[i];
56
+ if (!dir) continue;
57
+ // Skip ~/.nvu/bin
58
+ if (pathsEqual(dir, nvuBinDir)) continue;
59
+ // Build candidate path with appropriate extension
60
+ var candidates = isWindows ? [
61
+ _path.default.join(dir, "".concat(name, ".exe")),
62
+ _path.default.join(dir, "".concat(name, ".cmd")),
63
+ _path.default.join(dir, name)
64
+ ] : [
65
+ _path.default.join(dir, name)
66
+ ];
67
+ for(var j = 0; j < candidates.length; j++){
68
+ var candidate = candidates[j];
69
+ try {
70
+ var stat = _fs.default.statSync(candidate);
71
+ if (!stat.isFile()) continue;
72
+ // Make sure it's not in ~/.nvu/bin (via symlink)
73
+ if (isInNvuBin(candidate)) continue;
74
+ return candidate;
75
+ } catch (_e) {
76
+ // File doesn't exist, continue
77
+ }
78
+ }
79
+ }
80
+ return null;
81
+ }
82
+ function getPathWithoutNvuBin() {
83
+ var pathEnv = process.env.PATH || '';
84
+ var pathSep = isWindows ? ';' : ':';
85
+ var dirs = pathEnv.split(pathSep);
86
+ var filtered = [];
87
+ for(var i = 0; i < dirs.length; i++){
88
+ var dir = dirs[i];
89
+ if (!dir) continue;
90
+ if (pathsEqual(dir, nvuBinDir)) continue;
91
+ if (dir.indexOf(_path.default.join('.nvu', 'bin')) >= 0) continue;
92
+ filtered.push(dir);
93
+ }
94
+ return filtered.join(pathSep);
95
+ }
96
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/lib/resolveSystemBinary.ts"],"sourcesContent":["/**\n * Resolve system binaries by searching PATH while excluding ~/.nvu/bin\n * This mirrors the Go binary's findSystemBinary() function\n */\nimport fs from 'fs';\nimport path from 'path';\nimport { homedir } from '../compat.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst nvuBinDir = path.join(homedir(), '.nvu', 'bin');\n\n/**\n * Check if two paths are equal (case-insensitive on Windows)\n */\nfunction pathsEqual(a: string, b: string): boolean {\n if (isWindows) {\n return a.toLowerCase() === b.toLowerCase();\n }\n return a === b;\n}\n\n/**\n * Check if a path is within the nvu bin directory\n */\nfunction isInNvuBin(filePath: string): boolean {\n try {\n const realPath = fs.realpathSync(filePath);\n return realPath.indexOf(path.join('.nvu', 'bin')) >= 0 || pathsEqual(path.dirname(realPath), nvuBinDir);\n } catch (_e) {\n return false;\n }\n}\n\n/**\n * Find a system binary by searching PATH, excluding ~/.nvu/bin\n * Returns the full path to the binary, or null if not found\n */\nexport function resolveSystemBinary(name: string): string | null {\n const pathEnv = process.env.PATH || '';\n const pathSep = isWindows ? ';' : ':';\n const dirs = pathEnv.split(pathSep);\n\n for (let i = 0; i < dirs.length; i++) {\n const dir = dirs[i];\n if (!dir) continue;\n\n // Skip ~/.nvu/bin\n if (pathsEqual(dir, nvuBinDir)) continue;\n\n // Build candidate path with appropriate extension\n const candidates = isWindows ? [path.join(dir, `${name}.exe`), path.join(dir, `${name}.cmd`), path.join(dir, name)] : [path.join(dir, name)];\n\n for (let j = 0; j < candidates.length; j++) {\n const candidate = candidates[j];\n try {\n const stat = fs.statSync(candidate);\n if (!stat.isFile()) continue;\n\n // Make sure it's not in ~/.nvu/bin (via symlink)\n if (isInNvuBin(candidate)) continue;\n\n return candidate;\n } catch (_e) {\n // File doesn't exist, continue\n }\n }\n }\n\n return null;\n}\n\n/**\n * Get PATH with ~/.nvu/bin removed\n * Used to create an environment for spawning system commands\n */\nexport function getPathWithoutNvuBin(): string {\n const pathEnv = process.env.PATH || '';\n const pathSep = isWindows ? ';' : ':';\n const dirs = pathEnv.split(pathSep);\n\n const filtered: string[] = [];\n for (let i = 0; i < dirs.length; i++) {\n const dir = dirs[i];\n if (!dir) continue;\n if (pathsEqual(dir, nvuBinDir)) continue;\n if (dir.indexOf(path.join('.nvu', 'bin')) >= 0) continue;\n filtered.push(dir);\n }\n\n return filtered.join(pathSep);\n}\n"],"names":["getPathWithoutNvuBin","resolveSystemBinary","isWindows","process","platform","test","env","OSTYPE","nvuBinDir","path","join","homedir","pathsEqual","a","b","toLowerCase","isInNvuBin","filePath","realPath","fs","realpathSync","indexOf","dirname","_e","name","pathEnv","PATH","pathSep","dirs","split","i","length","dir","candidates","j","candidate","stat","statSync","isFile","filtered","push"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;QAwEeA;eAAAA;;QAtCAC;eAAAA;;;yDAjCD;2DACE;wBACO;;;;;;AAExB,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,YAAYC,aAAI,CAACC,IAAI,CAACC,IAAAA,iBAAO,KAAI,QAAQ;AAE/C;;CAEC,GACD,SAASC,WAAWC,CAAS,EAAEC,CAAS;IACtC,IAAIZ,WAAW;QACb,OAAOW,EAAEE,WAAW,OAA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AEA,OAAO;AACT;AAMO,SAASvB;IACd,IAAMyB,UAAUtB,QAAQG,GAAG,CAACoB,IAAI,IAAI;IACpC,IAAMC,UAAUzB,YAAY,MAAM;IAClC,IAAM0B,OAAOH,QAAQI,KAAK,CAACF;IAE3B,IAAMY,WAAqB,EAAE;IAC7B,IAAK,IAAIT,IAAI,GAAGA,IAAIF,KAAKG,MAAM,EAAED,IAAK;QACpC,IAAME,MAAMJ,IAAI,CAACE,EAAE;QACnB,IAAI,CAACE,KAAK;QACV,IAAIpB,WAAWoB,KAAKxB,YAAY;QAChC,IAAIwB,IAAIX,OAAO,CAACZ,aAAI,CAACC,IAAI,CAAC,QAAQ,WAAW,GAAG;QAChD6B,SAASC,IAAI,CAACR;IAChB;IAEA,OAAOO,SAAS7B,IAAI,CAACiB;AACvB"}
@@ -20,64 +20,12 @@ var _spawnterm = require("spawn-term");
20
20
  var _compatts = require("./compat.js");
21
21
  var _constantsts = require("./constants.js");
22
22
  var _loadNodeVersionInstallts = /*#__PURE__*/ _interop_require_default(require("./lib/loadNodeVersionInstall.js"));
23
- function _array_like_to_array(arr, len) {
24
- if (len == null || len > arr.length) len = arr.length;
25
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
26
- return arr2;
27
- }
28
- function _array_without_holes(arr) {
29
- if (Array.isArray(arr)) return _array_like_to_array(arr);
30
- }
31
- function _define_property(obj, key, value) {
32
- if (key in obj) {
33
- Object.defineProperty(obj, key, {
34
- value: value,
35
- enumerable: true,
36
- configurable: true,
37
- writable: true
38
- });
39
- } else {
40
- obj[key] = value;
41
- }
42
- return obj;
43
- }
23
+ var _resolveSystemBinaryts = require("./lib/resolveSystemBinary.js");
44
24
  function _interop_require_default(obj) {
45
25
  return obj && obj.__esModule ? obj : {
46
26
  default: obj
47
27
  };
48
28
  }
49
- function _iterable_to_array(iter) {
50
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
51
- }
52
- function _non_iterable_spread() {
53
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
- }
55
- function _object_spread(target) {
56
- for(var i = 1; i < arguments.length; i++){
57
- var source = arguments[i] != null ? arguments[i] : {};
58
- var ownKeys = Object.keys(source);
59
- if (typeof Object.getOwnPropertySymbols === "function") {
60
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
61
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
62
- }));
63
- }
64
- ownKeys.forEach(function(key) {
65
- _define_property(target, key, source[key]);
66
- });
67
- }
68
- return target;
69
- }
70
- function _to_consumable_array(arr) {
71
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
72
- }
73
- function _unsupported_iterable_to_array(o, minLen) {
74
- if (!o) return;
75
- if (typeof o === "string") return _array_like_to_array(o, minLen);
76
- var n = Object.prototype.toString.call(o).slice(8, -1);
77
- if (n === "Object" && o.constructor) n = o.constructor.name;
78
- if (n === "Map" || n === "Set") return Array.from(n);
79
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
80
- }
81
29
  var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
82
30
  var NODE = isWindows ? 'node.exe' : 'node';
83
31
  // Parse npm-generated .cmd wrapper to extract the JS script path
@@ -112,7 +60,7 @@ function resolveCommand(command, args) {
112
60
  command: NODE,
113
61
  args: [
114
62
  scriptPath
115
- ].concat(_to_consumable_array(args))
63
+ ].concat(args)
116
64
  };
117
65
  }
118
66
  }
@@ -123,7 +71,7 @@ function resolveCommand(command, args) {
123
71
  command: NODE,
124
72
  args: [
125
73
  binPath
126
- ].concat(_to_consumable_array(args))
74
+ ].concat(args)
127
75
  };
128
76
  } catch (_e) {
129
77
  // Not an npm package bin, use original command
@@ -134,6 +82,11 @@ function resolveCommand(command, args) {
134
82
  };
135
83
  }
136
84
  function worker(versionExpression, command, args, options, callback) {
85
+ // Handle "system" as a special version that uses system binaries directly
86
+ if (versionExpression === 'system') {
87
+ runWithSystemBinaries(command, args, options, callback);
88
+ return;
89
+ }
137
90
  // Load node-version-install lazily
138
91
  (0, _loadNodeVersionInstallts.default)(function(loadErr, installVersion) {
139
92
  if (loadErr) return callback(loadErr);
@@ -143,7 +96,7 @@ function worker(versionExpression, command, args, options, callback) {
143
96
  callback(new Error("No versions found from expression: ".concat(versionExpression)));
144
97
  return;
145
98
  }
146
- var installOptions = _object_spread({
99
+ var installOptions = (0, _compatts.objectAssign)({
147
100
  storagePath: _constantsts.storagePath
148
101
  }, options);
149
102
  var streamingOptions = options;
@@ -218,4 +171,48 @@ function worker(versionExpression, command, args, options, callback) {
218
171
  });
219
172
  });
220
173
  }
174
+ /**
175
+ * Run command using system binaries (bypassing nvu version management)
176
+ * This handles the "system" version specifier
177
+ */ function runWithSystemBinaries(command, args, options, callback) {
178
+ // Find the system binary for the command
179
+ var systemBinary = (0, _resolveSystemBinaryts.resolveSystemBinary)(command);
180
+ if (!systemBinary) {
181
+ callback(new Error("System ".concat(command, " not found in PATH")));
182
+ return;
183
+ }
184
+ // Create spawn options with PATH excluding ~/.nvu/bin
185
+ // This ensures any child processes also use system binaries
186
+ var cleanPath = (0, _resolveSystemBinaryts.getPathWithoutNvuBin)();
187
+ var spawnOptions = (0, _compatts.objectAssign)({}, options);
188
+ spawnOptions.env = (0, _compatts.objectAssign)({}, process.env);
189
+ spawnOptions.env.PATH = cleanPath;
190
+ spawnOptions.stdio = options.stdio || 'inherit';
191
+ // On Windows, resolve npm bin commands to bypass .cmd wrappers
192
+ var resolved = resolveCommand(command, args);
193
+ // For system, use the resolved system binary path
194
+ var finalCommand = resolved.command === command ? systemBinary : resolved.command;
195
+ var finalArgs = resolved.command === command ? args : resolved.args;
196
+ if (!options.silent) {
197
+ console.log("$ ".concat((0, _spawnterm.formatArguments)([
198
+ finalCommand
199
+ ].concat(finalArgs)).join(' ')));
200
+ }
201
+ (0, _crossspawncb.default)(finalCommand, finalArgs, spawnOptions, function(err, res) {
202
+ if (err && err.message && err.message.indexOf('ExperimentalWarning') >= 0) {
203
+ res = err;
204
+ err = null;
205
+ }
206
+ var result = {
207
+ install: null,
208
+ command: command,
209
+ version: 'system',
210
+ error: err,
211
+ result: res
212
+ };
213
+ callback(err, [
214
+ result
215
+ ]);
216
+ });
217
+ }
221
218
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }