node-version-utils 1.3.8 → 1.3.10
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/cjs/spawnOptions.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _envpathkey = /*#__PURE__*/ _interop_require_default(require("env-path-key"));
|
|
12
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
13
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
14
|
var _pathstringprepend = /*#__PURE__*/ _interop_require_default(require("path-string-prepend"));
|
|
14
15
|
var _startsWithFnts = /*#__PURE__*/ _interop_require_default(require("./lib/startsWithFn.js"));
|
|
@@ -75,6 +76,13 @@ var startsNPM = (0, _startsWithFnts.default)('npm_');
|
|
|
75
76
|
var startsPath = (0, _startsWithFnts.default)('path');
|
|
76
77
|
function spawnOptions(installPath) {
|
|
77
78
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
79
|
+
// Resolve symlinks to get real path (fixes nvm-windows symlink issues where
|
|
80
|
+
// C:\nvm4w\nodejs points to the active Node version via symlink)
|
|
81
|
+
try {
|
|
82
|
+
installPath = _fs.default.realpathSync(installPath);
|
|
83
|
+
} catch (_e) {
|
|
84
|
+
// Keep original path if resolution fails
|
|
85
|
+
}
|
|
78
86
|
var PATH_KEY = (0, _envpathkey.default)();
|
|
79
87
|
var processEnv = process.env;
|
|
80
88
|
var bin = isWindows ? installPath : _path.default.join(installPath, 'bin');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-utils/src/spawnOptions.ts"],"sourcesContent":["import pathKey from 'env-path-key';\nimport path from 'path';\nimport prepend from 'path-string-prepend';\nimport startsWithFn from './lib/startsWithFn.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst NODE = isWindows ? 'node.exe' : 'node';\n\nconst startsNPM = startsWithFn('npm_');\nconst startsPath = startsWithFn('path');\n\nimport type { ProcessEnv, SpawnOptions } from './types.ts';\n\nexport default function spawnOptions(installPath: string, options: SpawnOptions = {}): SpawnOptions {\n const PATH_KEY = pathKey();\n const processEnv = process.env;\n const bin = isWindows ? installPath : path.join(installPath, 'bin');\n const env = {} as ProcessEnv;\n env.npm_node_execpath = path.join(bin, NODE);\n env.npm_config_prefix = installPath;\n\n // copy the environment not for npm and skip case-insesitive additional paths\n for (const key in processEnv) {\n // skip npm_ variants and non-matching path\n if (key.length > 4 && startsNPM(key)) continue;\n if (key.length === 4 && startsPath(key) && key !== PATH_KEY) continue;\n env[key] = processEnv[key];\n }\n\n // override node\n if (env.NODE !== undefined) env.NODE = env.npm_node_execpath;\n if (env.NODE_EXE !== undefined) env.NODE_EXE = env.npm_node_execpath;\n\n // put the path to node and npm at the front and remove nvs\n env[PATH_KEY] = prepend(env[PATH_KEY] || '', bin) as string;\n return { ...options, cwd: process.cwd(), env } as SpawnOptions;\n}\n"],"names":["spawnOptions","isWindows","process","platform","test","env","OSTYPE","NODE","startsNPM","startsWithFn","startsPath","installPath","options","PATH_KEY","pathKey","processEnv","bin","path","join","npm_node_execpath","npm_config_prefix","key","length","undefined","NODE_EXE","prepend","cwd"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-utils/src/spawnOptions.ts"],"sourcesContent":["import pathKey from 'env-path-key';\nimport fs from 'fs';\nimport path from 'path';\nimport prepend from 'path-string-prepend';\nimport startsWithFn from './lib/startsWithFn.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst NODE = isWindows ? 'node.exe' : 'node';\n\nconst startsNPM = startsWithFn('npm_');\nconst startsPath = startsWithFn('path');\n\nimport type { ProcessEnv, SpawnOptions } from './types.ts';\n\nexport default function spawnOptions(installPath: string, options: SpawnOptions = {}): SpawnOptions {\n // Resolve symlinks to get real path (fixes nvm-windows symlink issues where\n // C:\\nvm4w\\nodejs points to the active Node version via symlink)\n try {\n installPath = fs.realpathSync(installPath);\n } catch (_e) {\n // Keep original path if resolution fails\n }\n\n const PATH_KEY = pathKey();\n const processEnv = process.env;\n const bin = isWindows ? installPath : path.join(installPath, 'bin');\n const env = {} as ProcessEnv;\n env.npm_node_execpath = path.join(bin, NODE);\n env.npm_config_prefix = installPath;\n\n // copy the environment not for npm and skip case-insesitive additional paths\n for (const key in processEnv) {\n // skip npm_ variants and non-matching path\n if (key.length > 4 && startsNPM(key)) continue;\n if (key.length === 4 && startsPath(key) && key !== PATH_KEY) continue;\n env[key] = processEnv[key];\n }\n\n // override node\n if (env.NODE !== undefined) env.NODE = env.npm_node_execpath;\n if (env.NODE_EXE !== undefined) env.NODE_EXE = env.npm_node_execpath;\n\n // put the path to node and npm at the front and remove nvs\n env[PATH_KEY] = prepend(env[PATH_KEY] || '', bin) as string;\n return { ...options, cwd: process.cwd(), env } as SpawnOptions;\n}\n"],"names":["spawnOptions","isWindows","process","platform","test","env","OSTYPE","NODE","startsNPM","startsWithFn","startsPath","installPath","options","fs","realpathSync","_e","PATH_KEY","pathKey","processEnv","bin","path","join","npm_node_execpath","npm_config_prefix","key","length","undefined","NODE_EXE","prepend","cwd"],"mappings":";;;;+BAcA;;;eAAwBA;;;iEAdJ;yDACL;2DACE;wEACG;qEACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,OAAON,YAAY,aAAa;AAEtC,IAAMO,YAAYC,IAAAA,uBAAY,EAAC;AAC/B,IAAMC,aAAaD,IAAAA,uBAAY,EAAC;AAIjB,SAAST,aAAaW,WAAmB;QAAEC,UAAAA,iEAAwB,CAAC;IACjF,4EAA4E;IAC5E,iEAAiE;IACjE,IAAI;QACFD,cAAcE,WAAE,CAACC,YAAY,CAACH;IAChC,EAAE,OAAOI,IAAI;IACX,yCAAyC;IAC3C;IAEA,IAAMC,WAAWC,IAAAA,mBAAO;IACxB,IAAMC,aAAahB,QAAQG,GAAG;IAC9B,IAAMc,MAAMlB,YAAYU,cAAcS,aAAI,CAACC,IAAI,CAACV,aAAa;IAC7D,IAAMN,MAAM,CAAC;IACbA,IAAIiB,iBAAiB,GAAGF,aAAI,CAACC,IAAI,CAACF,KAAKZ;IACvCF,IAAIkB,iBAAiB,GAAGZ;IAExB,6EAA6E;IAC7E,IAAK,IAAMa,OAAON,WAAY;QAC5B,2CAA2C;QAC3C,IAAIM,IAAIC,MAAM,GAAG,KAAKjB,UAAUgB,MAAM;QACtC,IAAIA,IAAIC,MAAM,KAAK,KAAKf,WAAWc,QAAQA,QAAQR,UAAU;QAC7DX,GAAG,CAACmB,IAAI,GAAGN,UAAU,CAACM,IAAI;IAC5B;IAEA,gBAAgB;IAChB,IAAInB,IAAIE,IAAI,KAAKmB,WAAWrB,IAAIE,IAAI,GAAGF,IAAIiB,iBAAiB;IAC5D,IAAIjB,IAAIsB,QAAQ,KAAKD,WAAWrB,IAAIsB,QAAQ,GAAGtB,IAAIiB,iBAAiB;IAEpE,2DAA2D;IAC3DjB,GAAG,CAACW,SAAS,GAAGY,IAAAA,0BAAO,EAACvB,GAAG,CAACW,SAAS,IAAI,IAAIG;IAC7C,OAAO,wCAAKP;QAASiB,KAAK3B,QAAQ2B,GAAG;QAAIxB,KAAAA;;AAC3C"}
|
package/dist/esm/spawnOptions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pathKey from 'env-path-key';
|
|
2
|
+
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import prepend from 'path-string-prepend';
|
|
4
5
|
import startsWithFn from './lib/startsWithFn.js';
|
|
@@ -7,6 +8,13 @@ const NODE = isWindows ? 'node.exe' : 'node';
|
|
|
7
8
|
const startsNPM = startsWithFn('npm_');
|
|
8
9
|
const startsPath = startsWithFn('path');
|
|
9
10
|
export default function spawnOptions(installPath, options = {}) {
|
|
11
|
+
// Resolve symlinks to get real path (fixes nvm-windows symlink issues where
|
|
12
|
+
// C:\nvm4w\nodejs points to the active Node version via symlink)
|
|
13
|
+
try {
|
|
14
|
+
installPath = fs.realpathSync(installPath);
|
|
15
|
+
} catch (_e) {
|
|
16
|
+
// Keep original path if resolution fails
|
|
17
|
+
}
|
|
10
18
|
const PATH_KEY = pathKey();
|
|
11
19
|
const processEnv = process.env;
|
|
12
20
|
const bin = isWindows ? installPath : path.join(installPath, 'bin');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-utils/src/spawnOptions.ts"],"sourcesContent":["import pathKey from 'env-path-key';\nimport path from 'path';\nimport prepend from 'path-string-prepend';\nimport startsWithFn from './lib/startsWithFn.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst NODE = isWindows ? 'node.exe' : 'node';\n\nconst startsNPM = startsWithFn('npm_');\nconst startsPath = startsWithFn('path');\n\nimport type { ProcessEnv, SpawnOptions } from './types.ts';\n\nexport default function spawnOptions(installPath: string, options: SpawnOptions = {}): SpawnOptions {\n const PATH_KEY = pathKey();\n const processEnv = process.env;\n const bin = isWindows ? installPath : path.join(installPath, 'bin');\n const env = {} as ProcessEnv;\n env.npm_node_execpath = path.join(bin, NODE);\n env.npm_config_prefix = installPath;\n\n // copy the environment not for npm and skip case-insesitive additional paths\n for (const key in processEnv) {\n // skip npm_ variants and non-matching path\n if (key.length > 4 && startsNPM(key)) continue;\n if (key.length === 4 && startsPath(key) && key !== PATH_KEY) continue;\n env[key] = processEnv[key];\n }\n\n // override node\n if (env.NODE !== undefined) env.NODE = env.npm_node_execpath;\n if (env.NODE_EXE !== undefined) env.NODE_EXE = env.npm_node_execpath;\n\n // put the path to node and npm at the front and remove nvs\n env[PATH_KEY] = prepend(env[PATH_KEY] || '', bin) as string;\n return { ...options, cwd: process.cwd(), env } as SpawnOptions;\n}\n"],"names":["pathKey","path","prepend","startsWithFn","isWindows","process","platform","test","env","OSTYPE","NODE","startsNPM","startsPath","spawnOptions","installPath","options","PATH_KEY","processEnv","bin","join","npm_node_execpath","npm_config_prefix","key","length","undefined","NODE_EXE","cwd"],"mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,OAAOC,UAAU,OAAO;AACxB,OAAOC,aAAa,sBAAsB;AAC1C,OAAOC,kBAAkB,wBAAwB;AAEjD,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,MAAMC,OAAON,YAAY,aAAa;AAEtC,MAAMO,YAAYR,aAAa;AAC/B,MAAMS,aAAaT,aAAa;AAIhC,eAAe,SAASU,aAAaC,WAAmB,EAAEC,UAAwB,CAAC,CAAC;IAClF,MAAMC,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-utils/src/spawnOptions.ts"],"sourcesContent":["import pathKey from 'env-path-key';\nimport fs from 'fs';\nimport path from 'path';\nimport prepend from 'path-string-prepend';\nimport startsWithFn from './lib/startsWithFn.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst NODE = isWindows ? 'node.exe' : 'node';\n\nconst startsNPM = startsWithFn('npm_');\nconst startsPath = startsWithFn('path');\n\nimport type { ProcessEnv, SpawnOptions } from './types.ts';\n\nexport default function spawnOptions(installPath: string, options: SpawnOptions = {}): SpawnOptions {\n // Resolve symlinks to get real path (fixes nvm-windows symlink issues where\n // C:\\nvm4w\\nodejs points to the active Node version via symlink)\n try {\n installPath = fs.realpathSync(installPath);\n } catch (_e) {\n // Keep original path if resolution fails\n }\n\n const PATH_KEY = pathKey();\n const processEnv = process.env;\n const bin = isWindows ? installPath : path.join(installPath, 'bin');\n const env = {} as ProcessEnv;\n env.npm_node_execpath = path.join(bin, NODE);\n env.npm_config_prefix = installPath;\n\n // copy the environment not for npm and skip case-insesitive additional paths\n for (const key in processEnv) {\n // skip npm_ variants and non-matching path\n if (key.length > 4 && startsNPM(key)) continue;\n if (key.length === 4 && startsPath(key) && key !== PATH_KEY) continue;\n env[key] = processEnv[key];\n }\n\n // override node\n if (env.NODE !== undefined) env.NODE = env.npm_node_execpath;\n if (env.NODE_EXE !== undefined) env.NODE_EXE = env.npm_node_execpath;\n\n // put the path to node and npm at the front and remove nvs\n env[PATH_KEY] = prepend(env[PATH_KEY] || '', bin) as string;\n return { ...options, cwd: process.cwd(), env } as SpawnOptions;\n}\n"],"names":["pathKey","fs","path","prepend","startsWithFn","isWindows","process","platform","test","env","OSTYPE","NODE","startsNPM","startsPath","spawnOptions","installPath","options","realpathSync","_e","PATH_KEY","processEnv","bin","join","npm_node_execpath","npm_config_prefix","key","length","undefined","NODE_EXE","cwd"],"mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,OAAOC,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,aAAa,sBAAsB;AAC1C,OAAOC,kBAAkB,wBAAwB;AAEjD,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,MAAMC,OAAON,YAAY,aAAa;AAEtC,MAAMO,YAAYR,aAAa;AAC/B,MAAMS,aAAaT,aAAa;AAIhC,eAAe,SAASU,aAAaC,WAAmB,EAAEC,UAAwB,CAAC,CAAC;IAClF,4EAA4E;IAC5E,iEAAiE;IACjE,IAAI;QACFD,cAAcd,GAAGgB,YAAY,CAACF;IAChC,EAAE,OAAOG,IAAI;IACX,yCAAyC;IAC3C;IAEA,MAAMC,WAAWnB;IACjB,MAAMoB,aAAad,QAAQG,GAAG;IAC9B,MAAMY,MAAMhB,YAAYU,cAAcb,KAAKoB,IAAI,CAACP,aAAa;IAC7D,MAAMN,MAAM,CAAC;IACbA,IAAIc,iBAAiB,GAAGrB,KAAKoB,IAAI,CAACD,KAAKV;IACvCF,IAAIe,iBAAiB,GAAGT;IAExB,6EAA6E;IAC7E,IAAK,MAAMU,OAAOL,WAAY;QAC5B,2CAA2C;QAC3C,IAAIK,IAAIC,MAAM,GAAG,KAAKd,UAAUa,MAAM;QACtC,IAAIA,IAAIC,MAAM,KAAK,KAAKb,WAAWY,QAAQA,QAAQN,UAAU;QAC7DV,GAAG,CAACgB,IAAI,GAAGL,UAAU,CAACK,IAAI;IAC5B;IAEA,gBAAgB;IAChB,IAAIhB,IAAIE,IAAI,KAAKgB,WAAWlB,IAAIE,IAAI,GAAGF,IAAIc,iBAAiB;IAC5D,IAAId,IAAImB,QAAQ,KAAKD,WAAWlB,IAAImB,QAAQ,GAAGnB,IAAIc,iBAAiB;IAEpE,2DAA2D;IAC3Dd,GAAG,CAACU,SAAS,GAAGhB,QAAQM,GAAG,CAACU,SAAS,IAAI,IAAIE;IAC7C,OAAO;QAAE,GAAGL,OAAO;QAAEa,KAAKvB,QAAQuB,GAAG;QAAIpB;IAAI;AAC/C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-version-utils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"description": "Utilities for running commands on a specific version of node by installed path",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"main": "dist/cjs/index.js",
|
|
31
|
+
"source": "src/index.ts",
|
|
31
32
|
"types": "dist/cjs/index.d.ts",
|
|
32
33
|
"files": [
|
|
33
34
|
"dist"
|
|
@@ -35,7 +36,8 @@
|
|
|
35
36
|
"scripts": {
|
|
36
37
|
"build": "tsds build",
|
|
37
38
|
"format": "biome check --write --unsafe",
|
|
38
|
-
"
|
|
39
|
+
"prepublishOnly": "tsds validate",
|
|
40
|
+
"test": "tsds test:node --no-timeouts",
|
|
39
41
|
"test:engines": "nvu engines tsds test:node --no-timeouts",
|
|
40
42
|
"version": "tsds version"
|
|
41
43
|
},
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
"path-string-prepend": "*"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
49
|
+
"@biomejs/biome": "*",
|
|
47
50
|
"@types/mocha": "*",
|
|
48
51
|
"@types/node": "*",
|
|
49
52
|
"cr": "*",
|
|
@@ -51,12 +54,11 @@
|
|
|
51
54
|
"is-version": "*",
|
|
52
55
|
"node-install-release": "*",
|
|
53
56
|
"node-resolve-versions": "*",
|
|
54
|
-
"
|
|
57
|
+
"node-version-use": "*",
|
|
58
|
+
"rimraf2": "*",
|
|
59
|
+
"ts-dev-stack": "*"
|
|
55
60
|
},
|
|
56
61
|
"engines": {
|
|
57
62
|
"node": ">=0.8"
|
|
58
|
-
},
|
|
59
|
-
"tsds": {
|
|
60
|
-
"source": "src/index.ts"
|
|
61
63
|
}
|
|
62
64
|
}
|