@vltpkg/which 1.0.0-rc.10 → 1.0.0-rc.12
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgEA,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAAE,GAAG,EAAE,IAAI,CAAA;CAAE,CAAA;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAEhE,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAA;AAClE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAElE,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GACxD,iBAAiB,CAAA;AACnB,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAC1D,mBAAmB,CAAA;AAErB,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAC1D,mBAAmB,CAAA;AACrB,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GACxD,iBAAiB,CAAA;AAEnB,wBAAsB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AACzD,wBAAsB,KAAK,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAAC,MAAM,EAAE,GAA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CAAC;IAED,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC","sourcesContent":["import { isexe, sync as isexeSync } from 'isexe'\nimport { delimiter, join, sep } from 'node:path'\n\nconst isWindows = process.platform === 'win32'\n\n// used to check for slashed in commands passed in. always checks for the posix\n// separator on all platforms, and checks for the current separator when not on\n// a posix platform. don't use the isWindows check for this since that is\n// mocked in tests but we still need the code to actually work when called.\n// that is also why it is ignored from coverage.\n/* c8 ignore next */\nconst rSlash = sep === '/' ? /\\// : /[\\\\/]/\nconst rRel = new RegExp(`^\\\\.${rSlash.source}`)\n\n// Simulate a NodeJS.ErrnoException\nconst getNotFoundError = (cmd: string) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (\n cmd: string,\n {\n path: optPath = process.env.PATH,\n pathExt: optPathExt = process.env.PATHEXT,\n delimiter: optDelimiter = delimiter,\n }: WhichOptions,\n) => {\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv =\n cmd.match(rSlash) ?\n ['']\n : [\n // windows always checks the cwd first\n /* c8 ignore next - platform-specific */\n ...(isWindows ? [process.cwd()] : []),\n ...(optPath ?? /* c8 ignore next - very unusual */ '').split(\n optDelimiter,\n ),\n ]\n\n if (isWindows) {\n const pathExtExe =\n optPathExt ||\n ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)\n const pathExt = pathExtExe\n .split(optDelimiter)\n .flatMap(item => [item, item.toLowerCase()])\n if (cmd.includes('.') && pathExt[0] !== '') {\n pathExt.unshift('')\n }\n return { pathEnv, pathExt, pathExtExe }\n /* c8 ignore start - not reachable on windows */\n }\n\n return { pathEnv, pathExt: [''] }\n}\n/* c8 ignore stop */\n\nconst getPathPart = (raw: string, cmd: string) => {\n const pathPart = /^\".*\"$/.test(raw) ? raw.slice(1, -1) : raw\n const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ''\n return prefix + join(pathPart, cmd)\n}\n\nexport type WhichOptions = {\n all?: boolean\n path?: string\n pathExt?: string\n nothrow?: boolean\n delimiter?: string\n}\n\nexport type WhichOptionsFindAll = WhichOptions & { all: true }\nexport type WhichOptionsFindOne = WhichOptions & { all?: false }\n\nexport type WhichOptionsNoThrow = WhichOptions & { nothrow: true }\nexport type WhichOptionsThrow = WhichOptions & { nothrow?: false }\n\nexport type WhichOptionsFindOneThrow = WhichOptionsFindOne &\n WhichOptionsThrow\nexport type WhichOptionsFindOneNoThrow = WhichOptionsFindOne &\n WhichOptionsNoThrow\n\nexport type WhichOptionsFindAllNoThrow = WhichOptionsFindAll &\n WhichOptionsNoThrow\nexport type WhichOptionsFindAllThrow = WhichOptionsFindAll &\n WhichOptionsThrow\n\nexport async function which(cmd: string): Promise<string>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAllNoThrow,\n): Promise<string[] | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOneNoThrow,\n): Promise<string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAllThrow,\n): Promise<string[]>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOneThrow,\n): Promise<string>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOne,\n): Promise<string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsNoThrow,\n): Promise<string[] | string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAll,\n): Promise<string[] | null>\nexport async function which(\n cmd: string,\n opt: WhichOptions,\n): Promise<string[] | string | null>\nexport async function which(cmd: string, opt: WhichOptions = {}) {\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (const envPart of pathEnv) {\n const p = getPathPart(envPart, cmd)\n\n for (const ext of pathExt) {\n const withExt = p + ext\n const is = await isexe(withExt, {\n pathExt: pathExtExe,\n ignoreErrors: true,\n })\n if (is) {\n if (!opt.all) {\n return withExt\n }\n found.push(withExt)\n }\n }\n }\n\n if (opt.all && found.length) {\n return found\n }\n\n if (opt.nothrow) {\n return null\n }\n\n throw getNotFoundError(cmd)\n}\n\nexport function whichSync(cmd: string): string\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAllNoThrow,\n): string[] | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOneNoThrow,\n): string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAllThrow,\n): string[]\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOneThrow,\n): string\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOne,\n): string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsNoThrow,\n): string[] | string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAll,\n): string[] | null\nexport function whichSync(\n cmd: string,\n opt?: WhichOptions,\n): string[] | string | null\nexport function whichSync(cmd: string, opt: WhichOptions = {}) {\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (const pathEnvPart of pathEnv) {\n const p = getPathPart(pathEnvPart, cmd)\n\n for (const ext of pathExt) {\n const withExt = p + ext\n const is = isexeSync(withExt, {\n pathExt: pathExtExe,\n ignoreErrors: true,\n })\n if (is) {\n if (!opt.all) {\n return withExt\n }\n found.push(withExt)\n }\n }\n }\n\n if (opt.all && found.length) {\n return found\n }\n\n if (opt.nothrow) {\n return null\n }\n\n throw getNotFoundError(cmd)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/which",
|
|
3
3
|
"description": "Find the first executable in the path (TS port of 'which')",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
8
8
|
"directory": "src/which"
|
|
9
9
|
},
|
|
10
10
|
"author": "vlt technology inc. <support@vlt.sh> (http://vlt.sh)",
|
|
11
|
-
"tshy": {
|
|
12
|
-
"selfLink": false,
|
|
13
|
-
"liveDev": true,
|
|
14
|
-
"dialects": [
|
|
15
|
-
"esm"
|
|
16
|
-
],
|
|
17
|
-
"exports": {
|
|
18
|
-
"./package.json": "./package.json",
|
|
19
|
-
".": "./src/index.ts"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
11
|
"dependencies": {
|
|
23
12
|
"isexe": "^3.1.1"
|
|
24
13
|
},
|
|
@@ -28,7 +17,6 @@
|
|
|
28
17
|
"eslint": "^9.39.1",
|
|
29
18
|
"prettier": "^3.7.4",
|
|
30
19
|
"tap": "^21.5.0",
|
|
31
|
-
"tshy": "^3.1.0",
|
|
32
20
|
"typedoc": "~0.27.9",
|
|
33
21
|
"typescript": "5.7.3",
|
|
34
22
|
"typescript-eslint": "^8.49.0"
|
|
@@ -41,14 +29,13 @@
|
|
|
41
29
|
"extends": "../../tap-config.yaml"
|
|
42
30
|
},
|
|
43
31
|
"prettier": "../../.prettierrc.js",
|
|
44
|
-
"module": "./dist/
|
|
32
|
+
"module": "./dist/index.js",
|
|
45
33
|
"type": "module",
|
|
46
34
|
"exports": {
|
|
47
35
|
"./package.json": "./package.json",
|
|
48
36
|
".": {
|
|
49
37
|
"import": {
|
|
50
|
-
"
|
|
51
|
-
"default": "./dist/esm/index.js"
|
|
38
|
+
"default": "./dist/index.js"
|
|
52
39
|
}
|
|
53
40
|
}
|
|
54
41
|
},
|
|
@@ -63,7 +50,6 @@
|
|
|
63
50
|
"snap": "tap",
|
|
64
51
|
"test": "tap",
|
|
65
52
|
"posttest": "tsc --noEmit",
|
|
66
|
-
"tshy": "tshy",
|
|
67
53
|
"typecheck": "tsc --noEmit"
|
|
68
54
|
}
|
|
69
55
|
}
|
package/dist/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgEA,MAAM,MAAM,YAAY,GAA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AAC,OAAO,EAAE,CAAC;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC;AAmCD,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,MAAoB,EAAE;IAC3D,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC9D,MAAM,KAAK,GAAG,EAAE,CAAA;IAEhB,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;QAEvC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,CAAC,GAAG,GAAG,CAAA;YACvB,MAAM,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE;gBAC5B,OAAO,EAAE,UAAU;gBACnB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAA;YACF,IAAI,EAAE,EAAE,CAAC;gBACP,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;oBACb,OAAO,OAAO,CAAA;gBAChB,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC","sourcesContent":["import { isexe, sync as isexeSync } from 'isexe'\nimport { delimiter, join, sep } from 'node:path'\n\nconst isWindows = process.platform === 'win32'\n\n// used to check for slashed in commands passed in. always checks for the posix\n// separator on all platforms, and checks for the current separator when not on\n// a posix platform. don't use the isWindows check for this since that is\n// mocked in tests but we still need the code to actually work when called.\n// that is also why it is ignored from coverage.\n/* c8 ignore next */\nconst rSlash = sep === '/' ? /\\// : /[\\\\/]/\nconst rRel = new RegExp(`^\\\\.${rSlash.source}`)\n\n// Simulate a NodeJS.ErrnoException\nconst getNotFoundError = (cmd: string) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (\n cmd: string,\n {\n path: optPath = process.env.PATH,\n pathExt: optPathExt = process.env.PATHEXT,\n delimiter: optDelimiter = delimiter,\n }: WhichOptions,\n) => {\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv =\n cmd.match(rSlash) ?\n ['']\n : [\n // windows always checks the cwd first\n /* c8 ignore next - platform-specific */\n ...(isWindows ? [process.cwd()] : []),\n ...(optPath ?? /* c8 ignore next - very unusual */ '').split(\n optDelimiter,\n ),\n ]\n\n if (isWindows) {\n const pathExtExe =\n optPathExt ||\n ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)\n const pathExt = pathExtExe\n .split(optDelimiter)\n .flatMap(item => [item, item.toLowerCase()])\n if (cmd.includes('.') && pathExt[0] !== '') {\n pathExt.unshift('')\n }\n return { pathEnv, pathExt, pathExtExe }\n /* c8 ignore start - not reachable on windows */\n }\n\n return { pathEnv, pathExt: [''] }\n}\n/* c8 ignore stop */\n\nconst getPathPart = (raw: string, cmd: string) => {\n const pathPart = /^\".*\"$/.test(raw) ? raw.slice(1, -1) : raw\n const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ''\n return prefix + join(pathPart, cmd)\n}\n\nexport type WhichOptions = {\n all?: boolean\n path?: string\n pathExt?: string\n nothrow?: boolean\n delimiter?: string\n}\n\nexport type WhichOptionsFindAll = WhichOptions & { all: true }\nexport type WhichOptionsFindOne = WhichOptions & { all?: false }\n\nexport type WhichOptionsNoThrow = WhichOptions & { nothrow: true }\nexport type WhichOptionsThrow = WhichOptions & { nothrow?: false }\n\nexport type WhichOptionsFindOneThrow = WhichOptionsFindOne &\n WhichOptionsThrow\nexport type WhichOptionsFindOneNoThrow = WhichOptionsFindOne &\n WhichOptionsNoThrow\n\nexport type WhichOptionsFindAllNoThrow = WhichOptionsFindAll &\n WhichOptionsNoThrow\nexport type WhichOptionsFindAllThrow = WhichOptionsFindAll &\n WhichOptionsThrow\n\nexport async function which(cmd: string): Promise<string>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAllNoThrow,\n): Promise<string[] | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOneNoThrow,\n): Promise<string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAllThrow,\n): Promise<string[]>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOneThrow,\n): Promise<string>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindOne,\n): Promise<string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsNoThrow,\n): Promise<string[] | string | null>\nexport async function which(\n cmd: string,\n opt: WhichOptionsFindAll,\n): Promise<string[] | null>\nexport async function which(\n cmd: string,\n opt: WhichOptions,\n): Promise<string[] | string | null>\nexport async function which(cmd: string, opt: WhichOptions = {}) {\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (const envPart of pathEnv) {\n const p = getPathPart(envPart, cmd)\n\n for (const ext of pathExt) {\n const withExt = p + ext\n const is = await isexe(withExt, {\n pathExt: pathExtExe,\n ignoreErrors: true,\n })\n if (is) {\n if (!opt.all) {\n return withExt\n }\n found.push(withExt)\n }\n }\n }\n\n if (opt.all && found.length) {\n return found\n }\n\n if (opt.nothrow) {\n return null\n }\n\n throw getNotFoundError(cmd)\n}\n\nexport function whichSync(cmd: string): string\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAllNoThrow,\n): string[] | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOneNoThrow,\n): string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAllThrow,\n): string[]\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOneThrow,\n): string\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindOne,\n): string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsNoThrow,\n): string[] | string | null\nexport function whichSync(\n cmd: string,\n opt: WhichOptionsFindAll,\n): string[] | null\nexport function whichSync(\n cmd: string,\n opt?: WhichOptions,\n): string[] | string | null\nexport function whichSync(cmd: string, opt: WhichOptions = {}) {\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (const pathEnvPart of pathEnv) {\n const p = getPathPart(pathEnvPart, cmd)\n\n for (const ext of pathExt) {\n const withExt = p + ext\n const is = isexeSync(withExt, {\n pathExt: pathExtExe,\n ignoreErrors: true,\n })\n if (is) {\n if (!opt.all) {\n return withExt\n }\n found.push(withExt)\n }\n }\n }\n\n if (opt.all && found.length) {\n return found\n }\n\n if (opt.nothrow) {\n return null\n }\n\n throw getNotFoundError(cmd)\n}\n"]}
|
package/dist/esm/package.json
DELETED
|
File without changes
|
|
File without changes
|