Comparing version 2.0.0 to 3.0.0
{ | ||
"name": "isexe", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Minimal module to check if a file is executable.", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "test" | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/mjs/index.js", | ||
"types": "./dist/cjs/index.js", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/mjs/index.d.ts", | ||
"default": "./dist/mjs/index.js" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/index.d.ts", | ||
"default": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"./posix": { | ||
"import": { | ||
"types": "./dist/mjs/posix.d.ts", | ||
"default": "./dist/mjs/posix.js" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/posix.d.ts", | ||
"default": "./dist/cjs/posix.js" | ||
} | ||
}, | ||
"./win32": { | ||
"import": { | ||
"types": "./dist/mjs/win32.d.ts", | ||
"default": "./dist/mjs/win32.js" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/win32.d.ts", | ||
"default": "./dist/cjs/win32.js" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.4.5", | ||
"@types/tap": "^15.0.8", | ||
"c8": "^8.0.1", | ||
"mkdirp": "^0.5.1", | ||
"prettier": "^2.8.8", | ||
"rimraf": "^2.5.0", | ||
"tap": "^10.3.0" | ||
"sync-content": "^1.0.2", | ||
"tap": "^16.3.8", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "^0.24.8", | ||
"typescript": "^5.1.6" | ||
}, | ||
"scripts": { | ||
"test": "tap test/*.js --100", | ||
"preversion": "npm test", | ||
"postversion": "npm publish", | ||
"postpublish": "git push origin --all; git push origin --tags" | ||
"prepublishOnly": "git push origin --follow-tags", | ||
"prepare": "tsc -p tsconfig/cjs.json && tsc -p tsconfig/esm.json && bash ./scripts/fixup.sh", | ||
"pretest": "npm run prepare", | ||
"presnap": "npm run prepare", | ||
"test": "c8 tap", | ||
"snap": "c8 tap", | ||
"format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache", | ||
"typedoc": "typedoc --tsconfig tsconfig/esm.json ./src/*.ts" | ||
}, | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
"license": "ISC", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/isaacs/isexe.git" | ||
"tap": { | ||
"coverage": false, | ||
"node-arg": [ | ||
"--enable-source-maps", | ||
"--no-warnings", | ||
"--loader", | ||
"ts-node/esm" | ||
], | ||
"ts": false | ||
}, | ||
"keywords": [], | ||
"bugs": { | ||
"url": "https://github.com/isaacs/isexe/issues" | ||
"prettier": { | ||
"semi": false, | ||
"printWidth": 75, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"jsxSingleQuote": false, | ||
"bracketSameLine": true, | ||
"arrowParens": "avoid", | ||
"endOfLine": "lf" | ||
}, | ||
"homepage": "https://github.com/isaacs/isexe#readme" | ||
"repository": "https://github.com/isaacs/isexe", | ||
"engines": { | ||
"node": ">=16" | ||
} | ||
} |
@@ -10,8 +10,8 @@ # isexe | ||
```javascript | ||
var isexe = require('isexe') | ||
isexe('some-file-name', function (err, isExe) { | ||
if (err) { | ||
console.error('probably file does not exist or something', err) | ||
} else if (isExe) { | ||
```js | ||
import { isexe, sync } from 'isexe' | ||
// or require() works too | ||
// const { isexe } = require('isexe') | ||
isexe('some-file-name').then(isExe => { | ||
if (isExe) { | ||
console.error('this thing can be run') | ||
@@ -21,10 +21,12 @@ } else { | ||
} | ||
}, (err) => { | ||
console.error('probably file doesnt exist or something') | ||
}) | ||
// same thing but synchronous, throws errors | ||
var isExe = isexe.sync('some-file-name') | ||
isExe = sync('some-file-name') | ||
// treat errors as just "not executable" | ||
isexe('maybe-missing-file', { ignoreErrors: true }, callback) | ||
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true }) | ||
const isExe = await isexe('maybe-missing-file', { ignoreErrors: true }) | ||
const isExe = sync('maybe-missing-file', { ignoreErrors: true }) | ||
``` | ||
@@ -34,6 +36,5 @@ | ||
### `isexe(path, [options], [callback])` | ||
### `isexe(path, [options]) => Promise<boolean>` | ||
Check if the path is executable. If no callback provided, and a | ||
global `Promise` object is available, then a Promise will be returned. | ||
Check if the path is executable. | ||
@@ -43,13 +44,35 @@ Will raise whatever errors may be raised by `fs.stat`, unless | ||
### `isexe.sync(path, [options])` | ||
### `sync(path, [options]) => boolean` | ||
Same as `isexe` but returns the value and throws any errors raised. | ||
## Platform Specific Implementations | ||
If for some reason you want to use the implementation for a | ||
specific platform, you can do that. | ||
```js | ||
import { win32, posix } from 'isexe' | ||
win32.isexe(...) | ||
win32.sync(...) | ||
// etc | ||
// or: | ||
import { isexe, sync } from 'isexe/posix' | ||
``` | ||
The default exported implementation will be chosen based on | ||
`process.platform`. | ||
### Options | ||
* `ignoreErrors` Treat all errors as "no, this is not executable", but | ||
don't raise them. | ||
* `uid` Number to use as the user id | ||
* `gid` Number to use as the group id | ||
```ts | ||
import type IsexeOptions from 'isexe' | ||
``` | ||
* `ignoreErrors` Treat all errors as "no, this is not | ||
executable", but don't raise them. | ||
* `uid` Number to use as the user id on posix | ||
* `gid` Number to use as the group id on posix | ||
* `pathExt` List of path extensions to use instead of `PATHEXT` | ||
environment variable on Windows. |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
230954
37
2002
75
0
11
1