Skip to content

Commit 1174ea0

Browse files
authored
Merge pull request #155 from cachix/bump-dependencies
Bump dependencies
2 parents 91ae9b4 + 3503b3e commit 1174ea0

File tree

3 files changed

+1668
-3031
lines changed

3 files changed

+1668
-3031
lines changed

dist/main/index.js

Lines changed: 83 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4116,128 +4116,118 @@ exports["default"] = _default;
41164116

41174117
/***/ }),
41184118

4119-
/***/ 207:
4119+
/***/ 143:
41204120
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
41214121

4122-
const isWindows = process.platform === 'win32' ||
4123-
process.env.OSTYPE === 'cygwin' ||
4124-
process.env.OSTYPE === 'msys'
4125-
4126-
const path = __nccwpck_require__(17)
4127-
const COLON = isWindows ? ';' : ':'
41284122
const isexe = __nccwpck_require__(126)
4123+
const { join, delimiter, sep, posix } = __nccwpck_require__(17)
4124+
4125+
const isWindows = process.platform === 'win32'
4126+
4127+
// used to check for slashed in commands passed in. always checks for the posix
4128+
// seperator on all platforms, and checks for the current separator when not on
4129+
// a posix platform. don't use the isWindows check for this since that is mocked
4130+
// in tests but we still need the code to actually work when called. that is also
4131+
// why it is ignored from coverage.
4132+
/* istanbul ignore next */
4133+
const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1'))
4134+
const rRel = new RegExp(`^\\.${rSlash.source}`)
41294135

41304136
const getNotFoundError = (cmd) =>
41314137
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
41324138

4133-
const getPathInfo = (cmd, opt) => {
4134-
const colon = opt.colon || COLON
4135-
4139+
const getPathInfo = (cmd, {
4140+
path: optPath = process.env.PATH,
4141+
pathExt: optPathExt = process.env.PATHEXT,
4142+
delimiter: optDelimiter = delimiter,
4143+
}) => {
41364144
// If it has a slash, then we don't bother searching the pathenv.
41374145
// just check the file itself, and that's it.
4138-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
4139-
: (
4140-
[
4141-
// windows always checks the cwd first
4142-
...(isWindows ? [process.cwd()] : []),
4143-
...(opt.path || process.env.PATH ||
4144-
/* istanbul ignore next: very unusual */ '').split(colon),
4145-
]
4146-
)
4147-
const pathExtExe = isWindows
4148-
? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
4149-
: ''
4150-
const pathExt = isWindows ? pathExtExe.split(colon) : ['']
4146+
const pathEnv = cmd.match(rSlash) ? [''] : [
4147+
// windows always checks the cwd first
4148+
...(isWindows ? [process.cwd()] : []),
4149+
...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter),
4150+
]
41514151

41524152
if (isWindows) {
4153-
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
4153+
const pathExtExe = optPathExt ||
4154+
['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)
4155+
const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item) => {
4156+
acc.push(item)
4157+
acc.push(item.toLowerCase())
4158+
return acc
4159+
}, [])
4160+
if (cmd.includes('.') && pathExt[0] !== '') {
41544161
pathExt.unshift('')
4162+
}
4163+
return { pathEnv, pathExt, pathExtExe }
41554164
}
41564165

4157-
return {
4158-
pathEnv,
4159-
pathExt,
4160-
pathExtExe,
4161-
}
4166+
return { pathEnv, pathExt: [''] }
41624167
}
41634168

4164-
const which = (cmd, opt, cb) => {
4165-
if (typeof opt === 'function') {
4166-
cb = opt
4167-
opt = {}
4168-
}
4169-
if (!opt)
4170-
opt = {}
4169+
const getPathPart = (raw, cmd) => {
4170+
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw
4171+
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ''
4172+
return prefix + join(pathPart, cmd)
4173+
}
41714174

4175+
const which = async (cmd, opt = {}) => {
41724176
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
41734177
const found = []
41744178

4175-
const step = i => new Promise((resolve, reject) => {
4176-
if (i === pathEnv.length)
4177-
return opt.all && found.length ? resolve(found)
4178-
: reject(getNotFoundError(cmd))
4179+
for (const envPart of pathEnv) {
4180+
const p = getPathPart(envPart, cmd)
41794181

4180-
const ppRaw = pathEnv[i]
4181-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
4182-
4183-
const pCmd = path.join(pathPart, cmd)
4184-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
4185-
: pCmd
4182+
for (const ext of pathExt) {
4183+
const withExt = p + ext
4184+
const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true })
4185+
if (is) {
4186+
if (!opt.all) {
4187+
return withExt
4188+
}
4189+
found.push(withExt)
4190+
}
4191+
}
4192+
}
41864193

4187-
resolve(subStep(p, i, 0))
4188-
})
4194+
if (opt.all && found.length) {
4195+
return found
4196+
}
41894197

4190-
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
4191-
if (ii === pathExt.length)
4192-
return resolve(step(i + 1))
4193-
const ext = pathExt[ii]
4194-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
4195-
if (!er && is) {
4196-
if (opt.all)
4197-
found.push(p + ext)
4198-
else
4199-
return resolve(p + ext)
4200-
}
4201-
return resolve(subStep(p, i, ii + 1))
4202-
})
4203-
})
4198+
if (opt.nothrow) {
4199+
return null
4200+
}
42044201

4205-
return cb ? step(0).then(res => cb(null, res), cb) : step(0)
4202+
throw getNotFoundError(cmd)
42064203
}
42074204

4208-
const whichSync = (cmd, opt) => {
4209-
opt = opt || {}
4210-
4205+
const whichSync = (cmd, opt = {}) => {
42114206
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
42124207
const found = []
42134208

4214-
for (let i = 0; i < pathEnv.length; i ++) {
4215-
const ppRaw = pathEnv[i]
4216-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
4217-
4218-
const pCmd = path.join(pathPart, cmd)
4219-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
4220-
: pCmd
4221-
4222-
for (let j = 0; j < pathExt.length; j ++) {
4223-
const cur = p + pathExt[j]
4224-
try {
4225-
const is = isexe.sync(cur, { pathExt: pathExtExe })
4226-
if (is) {
4227-
if (opt.all)
4228-
found.push(cur)
4229-
else
4230-
return cur
4209+
for (const pathEnvPart of pathEnv) {
4210+
const p = getPathPart(pathEnvPart, cmd)
4211+
4212+
for (const ext of pathExt) {
4213+
const withExt = p + ext
4214+
const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true })
4215+
if (is) {
4216+
if (!opt.all) {
4217+
return withExt
42314218
}
4232-
} catch (ex) {}
4219+
found.push(withExt)
4220+
}
42334221
}
42344222
}
42354223

4236-
if (opt.all && found.length)
4224+
if (opt.all && found.length) {
42374225
return found
4226+
}
42384227

4239-
if (opt.nothrow)
4228+
if (opt.nothrow) {
42404229
return null
4230+
}
42414231

42424232
throw getNotFoundError(cmd)
42434233
}
@@ -4255,7 +4245,11 @@ which.sync = whichSync
42554245

42564246
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42574247
if (k2 === undefined) k2 = k;
4258-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4248+
var desc = Object.getOwnPropertyDescriptor(m, k);
4249+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4250+
desc = { enumerable: true, get: function() { return m[k]; } };
4251+
}
4252+
Object.defineProperty(o, k2, desc);
42594253
}) : (function(o, m, k, k2) {
42604254
if (k2 === undefined) k2 = k;
42614255
o[k2] = m[k];
@@ -4268,7 +4262,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
42684262
var __importStar = (this && this.__importStar) || function (mod) {
42694263
if (mod && mod.__esModule) return mod;
42704264
var result = {};
4271-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
4265+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42724266
__setModuleDefault(result, mod);
42734267
return result;
42744268
};
@@ -4288,7 +4282,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
42884282
exports.IsPost = void 0;
42894283
const core = __importStar(__nccwpck_require__(186));
42904284
const exec = __importStar(__nccwpck_require__(514));
4291-
const which_1 = __importDefault(__nccwpck_require__(207));
4285+
const which_1 = __importDefault(__nccwpck_require__(143));
42924286
exports.IsPost = !!process.env['STATE_isPost'];
42934287
// inputs
42944288
const name = core.getInput('name', { required: true });

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
"dependencies": {
2323
"@actions/core": "^1.10.0",
2424
"@actions/exec": "^1.1.1",
25-
"which": "^2.0.2"
25+
"which": "^3.0.1"
2626
},
2727
"devDependencies": {
28-
"@types/jest": "^24.0.13",
29-
"@types/node": "^12.0.4",
30-
"@vercel/ncc": "^0.34",
31-
"@types/which": "^2.0.1",
32-
"jest": "^24.8.0",
33-
"jest-circus": "^24.7.1",
34-
"ts-jest": "^24.0.2",
35-
"ts-node": "^8.4.1",
36-
"typescript": "^3.5.1"
28+
"@types/jest": "^29.5.3",
29+
"@types/node": "^20.5.0",
30+
"@types/which": "^3.0.0",
31+
"@vercel/ncc": "^0.36.1",
32+
"jest": "^29.6.2",
33+
"jest-circus": "^29.6.2",
34+
"ts-jest": "^29.1.1",
35+
"ts-node": "^10.9.1",
36+
"typescript": "^5.1.6"
3737
}
3838
}

0 commit comments

Comments
 (0)