First upload version 0.0.1
This commit is contained in:
15
node_modules/isexe/LICENSE
generated
vendored
Normal file
15
node_modules/isexe/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2016-2022 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
74
node_modules/isexe/README.md
generated
vendored
Normal file
74
node_modules/isexe/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# isexe
|
||||
|
||||
Minimal module to check if a file is executable, and a normal file.
|
||||
|
||||
Uses `fs.stat` and tests against the `PATHEXT` environment variable on
|
||||
Windows.
|
||||
|
||||
## USAGE
|
||||
|
||||
```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')
|
||||
} else {
|
||||
console.error('cannot be run')
|
||||
}
|
||||
}, (err) => {
|
||||
console.error('probably file doesnt exist or something')
|
||||
})
|
||||
|
||||
// same thing but synchronous, throws errors
|
||||
isExe = sync('some-file-name')
|
||||
|
||||
// treat errors as just "not executable"
|
||||
const isExe = await isexe('maybe-missing-file', { ignoreErrors: true })
|
||||
const isExe = sync('maybe-missing-file', { ignoreErrors: true })
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `isexe(path, [options]) => Promise<boolean>`
|
||||
|
||||
Check if the path is executable.
|
||||
|
||||
Will raise whatever errors may be raised by `fs.stat`, unless
|
||||
`options.ignoreErrors` is set to true.
|
||||
|
||||
### `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
|
||||
|
||||
```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.
|
||||
14
node_modules/isexe/dist/cjs/index.d.ts
generated
vendored
Normal file
14
node_modules/isexe/dist/cjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as posix from './posix.js';
|
||||
import * as win32 from './win32.js';
|
||||
export * from './options.js';
|
||||
export { win32, posix };
|
||||
/**
|
||||
* Determine whether a path is executable on the current platform.
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: import("./options.js").IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable on the
|
||||
* current platform.
|
||||
*/
|
||||
export declare const sync: (path: string, options?: import("./options.js").IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/isexe/dist/cjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAKvB;;GAEG;AACH,eAAO,MAAM,KAAK,mFAAa,CAAA;AAC/B;;;GAGG;AACH,eAAO,MAAM,IAAI,0EAAY,CAAA"}
|
||||
46
node_modules/isexe/dist/cjs/index.js
generated
vendored
Normal file
46
node_modules/isexe/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sync = exports.isexe = exports.posix = exports.win32 = void 0;
|
||||
const posix = __importStar(require("./posix.js"));
|
||||
exports.posix = posix;
|
||||
const win32 = __importStar(require("./win32.js"));
|
||||
exports.win32 = win32;
|
||||
__exportStar(require("./options.js"), exports);
|
||||
const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
|
||||
const impl = platform === 'win32' ? win32 : posix;
|
||||
/**
|
||||
* Determine whether a path is executable on the current platform.
|
||||
*/
|
||||
exports.isexe = impl.isexe;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable on the
|
||||
* current platform.
|
||||
*/
|
||||
exports.sync = impl.sync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/isexe/dist/cjs/index.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmC;AAGnB,sBAAK;AAFrB,kDAAmC;AAE1B,sBAAK;AADd,+CAA4B;AAG5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,QAAQ,CAAA;AACtE,MAAM,IAAI,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEjD;;GAEG;AACU,QAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;AAC/B;;;GAGG;AACU,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA","sourcesContent":["import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"]}
|
||||
32
node_modules/isexe/dist/cjs/options.d.ts
generated
vendored
Normal file
32
node_modules/isexe/dist/cjs/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
export interface IsexeOptions {
|
||||
/**
|
||||
* Ignore errors arising from attempting to get file access status
|
||||
* Note that EACCES is always ignored, because that just means
|
||||
* it's not executable. If this is not set, then attempting to check
|
||||
* the executable-ness of a nonexistent file will raise ENOENT, for
|
||||
* example.
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
/**
|
||||
* effective uid when checking executable mode flags on posix
|
||||
* Defaults to process.getuid()
|
||||
*/
|
||||
uid?: number;
|
||||
/**
|
||||
* effective gid when checking executable mode flags on posix
|
||||
* Defaults to process.getgid()
|
||||
*/
|
||||
gid?: number;
|
||||
/**
|
||||
* effective group ID list to use when checking executable mode flags
|
||||
* on posix
|
||||
* Defaults to process.getgroups()
|
||||
*/
|
||||
groups?: number[];
|
||||
/**
|
||||
* The ;-delimited path extension list for win32 implementation.
|
||||
* Defaults to process.env.PATHEXT
|
||||
*/
|
||||
pathExt?: string;
|
||||
}
|
||||
//# sourceMappingURL=options.d.ts.map
|
||||
1
node_modules/isexe/dist/cjs/options.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/options.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
||||
3
node_modules/isexe/dist/cjs/options.js
generated
vendored
Normal file
3
node_modules/isexe/dist/cjs/options.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/isexe/dist/cjs/options.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"","sourcesContent":["export interface IsexeOptions {\n /**\n * Ignore errors arising from attempting to get file access status\n * Note that EACCES is always ignored, because that just means\n * it's not executable. If this is not set, then attempting to check\n * the executable-ness of a nonexistent file will raise ENOENT, for\n * example.\n */\n ignoreErrors?: boolean\n\n /**\n * effective uid when checking executable mode flags on posix\n * Defaults to process.getuid()\n */\n uid?: number\n\n /**\n * effective gid when checking executable mode flags on posix\n * Defaults to process.getgid()\n */\n gid?: number\n\n /**\n * effective group ID list to use when checking executable mode flags\n * on posix\n * Defaults to process.getgroups()\n */\n groups?: number[]\n\n /**\n * The ;-delimited path extension list for win32 implementation.\n * Defaults to process.env.PATHEXT\n */\n pathExt?: string\n}\n"]}
|
||||
3
node_modules/isexe/dist/cjs/package.json
generated
vendored
Normal file
3
node_modules/isexe/dist/cjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
18
node_modules/isexe/dist/cjs/posix.d.ts
generated
vendored
Normal file
18
node_modules/isexe/dist/cjs/posix.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This is the Posix implementation of isexe, which uses the file
|
||||
* mode and uid/gid values.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { IsexeOptions } from './options';
|
||||
/**
|
||||
* Determine whether a path is executable according to the mode and
|
||||
* current (or specified) user and group IDs.
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable according to
|
||||
* the mode and current (or specified) user and group IDs.
|
||||
*/
|
||||
export declare const sync: (path: string, options?: IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=posix.d.ts.map
|
||||
1
node_modules/isexe/dist/cjs/posix.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/posix.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,YACH,YAAY,KACpB,QAAQ,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,SACT,MAAM,YACH,YAAY,KACpB,OASF,CAAA"}
|
||||
67
node_modules/isexe/dist/cjs/posix.js
generated
vendored
Normal file
67
node_modules/isexe/dist/cjs/posix.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
/**
|
||||
* This is the Posix implementation of isexe, which uses the file
|
||||
* mode and uid/gid values.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sync = exports.isexe = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const promises_1 = require("fs/promises");
|
||||
/**
|
||||
* Determine whether a path is executable according to the mode and
|
||||
* current (or specified) user and group IDs.
|
||||
*/
|
||||
const isexe = async (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(await (0, promises_1.stat)(path), options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
exports.isexe = isexe;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable according to
|
||||
* the mode and current (or specified) user and group IDs.
|
||||
*/
|
||||
const sync = (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat((0, fs_1.statSync)(path), options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
exports.sync = sync;
|
||||
const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options);
|
||||
const checkMode = (stat, options) => {
|
||||
const myUid = options.uid ?? process.getuid?.();
|
||||
const myGroups = options.groups ?? process.getgroups?.() ?? [];
|
||||
const myGid = options.gid ?? process.getgid?.() ?? myGroups[0];
|
||||
if (myUid === undefined || myGid === undefined) {
|
||||
throw new Error('cannot get uid or gid');
|
||||
}
|
||||
const groups = new Set([myGid, ...myGroups]);
|
||||
const mod = stat.mode;
|
||||
const uid = stat.uid;
|
||||
const gid = stat.gid;
|
||||
const u = parseInt('100', 8);
|
||||
const g = parseInt('010', 8);
|
||||
const o = parseInt('001', 8);
|
||||
const ug = u | g;
|
||||
return !!(mod & o ||
|
||||
(mod & g && groups.has(gid)) ||
|
||||
(mod & u && uid === myUid) ||
|
||||
(mod & ug && myUid === 0));
|
||||
};
|
||||
//# sourceMappingURL=posix.js.map
|
||||
1
node_modules/isexe/dist/cjs/posix.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/posix.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":";AAAA;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;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAA;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC9D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;KACzC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAA;IAE5C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAA;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IAEpB,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;IAEhB,OAAO,CAAC,CAAC,CACP,GAAG,GAAG,CAAC;QACP,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,CAAC;QAC1B,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'fs'\nimport { stat } from 'fs/promises'\nimport { IsexeOptions } from './options'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {}\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {}\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n"]}
|
||||
18
node_modules/isexe/dist/cjs/win32.d.ts
generated
vendored
Normal file
18
node_modules/isexe/dist/cjs/win32.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This is the Windows implementation of isexe, which uses the file
|
||||
* extension and PATHEXT setting.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { IsexeOptions } from './options';
|
||||
/**
|
||||
* Determine whether a path is executable based on the file extension
|
||||
* and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable based on the file
|
||||
* extension and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export declare const sync: (path: string, options?: IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=win32.d.ts.map
|
||||
1
node_modules/isexe/dist/cjs/win32.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/win32.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"win32.d.ts","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,YACH,YAAY,KACpB,QAAQ,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,SACT,MAAM,YACH,YAAY,KACpB,OASF,CAAA"}
|
||||
62
node_modules/isexe/dist/cjs/win32.js
generated
vendored
Normal file
62
node_modules/isexe/dist/cjs/win32.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
/**
|
||||
* This is the Windows implementation of isexe, which uses the file
|
||||
* extension and PATHEXT setting.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sync = exports.isexe = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const promises_1 = require("fs/promises");
|
||||
/**
|
||||
* Determine whether a path is executable based on the file extension
|
||||
* and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
const isexe = async (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(await (0, promises_1.stat)(path), path, options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
exports.isexe = isexe;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable based on the file
|
||||
* extension and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
const sync = (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat((0, fs_1.statSync)(path), path, options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
exports.sync = sync;
|
||||
const checkPathExt = (path, options) => {
|
||||
const { pathExt = process.env.PATHEXT || '' } = options;
|
||||
const peSplit = pathExt.split(';');
|
||||
if (peSplit.indexOf('') !== -1) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < peSplit.length; i++) {
|
||||
const p = peSplit[i].toLowerCase();
|
||||
const ext = path.substring(path.length - p.length).toLowerCase();
|
||||
if (p && ext === p) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options);
|
||||
//# sourceMappingURL=win32.js.map
|
||||
1
node_modules/isexe/dist/cjs/win32.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/cjs/win32.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"win32.js","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2BAAoC;AACpC,0CAAkC;AAGlC;;;GAGG;AACI,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI;QACF,OAAO,SAAS,CAAC,MAAM,IAAA,eAAI,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;KAClD;IAAC,OAAO,CAAC,E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,CAAC,CAAC,WAAW,EAAE,CAAA;QAEhE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE;YAClB,OAAO,IAAI,CAAA;SACZ;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,IAAY,EAAE,OAAqB,EAAE,EAAE,CACrE,IAAI,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA","sourcesContent":["/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'fs'\nimport { stat } from 'fs/promises'\nimport { IsexeOptions } from './options'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {}\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {}\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(';')\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (let i = 0; i < peSplit.length; i++) {\n const p = peSplit[i].toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n"]}
|
||||
14
node_modules/isexe/dist/mjs/index.d.ts
generated
vendored
Normal file
14
node_modules/isexe/dist/mjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as posix from './posix.js';
|
||||
import * as win32 from './win32.js';
|
||||
export * from './options.js';
|
||||
export { win32, posix };
|
||||
/**
|
||||
* Determine whether a path is executable on the current platform.
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: import("./options.js").IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable on the
|
||||
* current platform.
|
||||
*/
|
||||
export declare const sync: (path: string, options?: import("./options.js").IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/isexe/dist/mjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAKvB;;GAEG;AACH,eAAO,MAAM,KAAK,mFAAa,CAAA;AAC/B;;;GAGG;AACH,eAAO,MAAM,IAAI,0EAAY,CAAA"}
|
||||
16
node_modules/isexe/dist/mjs/index.js
generated
vendored
Normal file
16
node_modules/isexe/dist/mjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as posix from './posix.js';
|
||||
import * as win32 from './win32.js';
|
||||
export * from './options.js';
|
||||
export { win32, posix };
|
||||
const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
|
||||
const impl = platform === 'win32' ? win32 : posix;
|
||||
/**
|
||||
* Determine whether a path is executable on the current platform.
|
||||
*/
|
||||
export const isexe = impl.isexe;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable on the
|
||||
* current platform.
|
||||
*/
|
||||
export const sync = impl.sync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/isexe/dist/mjs/index.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAEvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,QAAQ,CAAA;AACtE,MAAM,IAAI,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;AAC/B;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA","sourcesContent":["import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"]}
|
||||
32
node_modules/isexe/dist/mjs/options.d.ts
generated
vendored
Normal file
32
node_modules/isexe/dist/mjs/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
export interface IsexeOptions {
|
||||
/**
|
||||
* Ignore errors arising from attempting to get file access status
|
||||
* Note that EACCES is always ignored, because that just means
|
||||
* it's not executable. If this is not set, then attempting to check
|
||||
* the executable-ness of a nonexistent file will raise ENOENT, for
|
||||
* example.
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
/**
|
||||
* effective uid when checking executable mode flags on posix
|
||||
* Defaults to process.getuid()
|
||||
*/
|
||||
uid?: number;
|
||||
/**
|
||||
* effective gid when checking executable mode flags on posix
|
||||
* Defaults to process.getgid()
|
||||
*/
|
||||
gid?: number;
|
||||
/**
|
||||
* effective group ID list to use when checking executable mode flags
|
||||
* on posix
|
||||
* Defaults to process.getgroups()
|
||||
*/
|
||||
groups?: number[];
|
||||
/**
|
||||
* The ;-delimited path extension list for win32 implementation.
|
||||
* Defaults to process.env.PATHEXT
|
||||
*/
|
||||
pathExt?: string;
|
||||
}
|
||||
//# sourceMappingURL=options.d.ts.map
|
||||
1
node_modules/isexe/dist/mjs/options.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/options.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
||||
2
node_modules/isexe/dist/mjs/options.js
generated
vendored
Normal file
2
node_modules/isexe/dist/mjs/options.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/isexe/dist/mjs/options.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"","sourcesContent":["export interface IsexeOptions {\n /**\n * Ignore errors arising from attempting to get file access status\n * Note that EACCES is always ignored, because that just means\n * it's not executable. If this is not set, then attempting to check\n * the executable-ness of a nonexistent file will raise ENOENT, for\n * example.\n */\n ignoreErrors?: boolean\n\n /**\n * effective uid when checking executable mode flags on posix\n * Defaults to process.getuid()\n */\n uid?: number\n\n /**\n * effective gid when checking executable mode flags on posix\n * Defaults to process.getgid()\n */\n gid?: number\n\n /**\n * effective group ID list to use when checking executable mode flags\n * on posix\n * Defaults to process.getgroups()\n */\n groups?: number[]\n\n /**\n * The ;-delimited path extension list for win32 implementation.\n * Defaults to process.env.PATHEXT\n */\n pathExt?: string\n}\n"]}
|
||||
3
node_modules/isexe/dist/mjs/package.json
generated
vendored
Normal file
3
node_modules/isexe/dist/mjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
18
node_modules/isexe/dist/mjs/posix.d.ts
generated
vendored
Normal file
18
node_modules/isexe/dist/mjs/posix.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This is the Posix implementation of isexe, which uses the file
|
||||
* mode and uid/gid values.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { IsexeOptions } from './options';
|
||||
/**
|
||||
* Determine whether a path is executable according to the mode and
|
||||
* current (or specified) user and group IDs.
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable according to
|
||||
* the mode and current (or specified) user and group IDs.
|
||||
*/
|
||||
export declare const sync: (path: string, options?: IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=posix.d.ts.map
|
||||
1
node_modules/isexe/dist/mjs/posix.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/posix.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,YACH,YAAY,KACpB,QAAQ,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,SACT,MAAM,YACH,YAAY,KACpB,OASF,CAAA"}
|
||||
62
node_modules/isexe/dist/mjs/posix.js
generated
vendored
Normal file
62
node_modules/isexe/dist/mjs/posix.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This is the Posix implementation of isexe, which uses the file
|
||||
* mode and uid/gid values.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { statSync } from 'fs';
|
||||
import { stat } from 'fs/promises';
|
||||
/**
|
||||
* Determine whether a path is executable according to the mode and
|
||||
* current (or specified) user and group IDs.
|
||||
*/
|
||||
export const isexe = async (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(await stat(path), options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Synchronously determine whether a path is executable according to
|
||||
* the mode and current (or specified) user and group IDs.
|
||||
*/
|
||||
export const sync = (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(statSync(path), options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options);
|
||||
const checkMode = (stat, options) => {
|
||||
const myUid = options.uid ?? process.getuid?.();
|
||||
const myGroups = options.groups ?? process.getgroups?.() ?? [];
|
||||
const myGid = options.gid ?? process.getgid?.() ?? myGroups[0];
|
||||
if (myUid === undefined || myGid === undefined) {
|
||||
throw new Error('cannot get uid or gid');
|
||||
}
|
||||
const groups = new Set([myGid, ...myGroups]);
|
||||
const mod = stat.mode;
|
||||
const uid = stat.uid;
|
||||
const gid = stat.gid;
|
||||
const u = parseInt('100', 8);
|
||||
const g = parseInt('010', 8);
|
||||
const o = parseInt('001', 8);
|
||||
const ug = u | g;
|
||||
return !!(mod & o ||
|
||||
(mod & g && groups.has(gid)) ||
|
||||
(mod & u && uid === myUid) ||
|
||||
(mod & ug && myUid === 0));
|
||||
};
|
||||
//# sourceMappingURL=posix.js.map
|
||||
1
node_modules/isexe/dist/mjs/posix.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/posix.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/posix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,QAAQ,EAAE,MAAM,IAAI,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI;QACF,OAAO,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;KAC5C;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;KACT;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAY,EACZ,UAAwB,EAAE,EACjB,E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C,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;IAEhB,OAAO,CAAC,CAAC,CACP,GAAG,GAAG,CAAC;QACP,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,CAAC;QAC1B,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'fs'\nimport { stat } from 'fs/promises'\nimport { IsexeOptions } from './options'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {}\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {}\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n"]}
|
||||
18
node_modules/isexe/dist/mjs/win32.d.ts
generated
vendored
Normal file
18
node_modules/isexe/dist/mjs/win32.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This is the Windows implementation of isexe, which uses the file
|
||||
* extension and PATHEXT setting.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { IsexeOptions } from './options';
|
||||
/**
|
||||
* Determine whether a path is executable based on the file extension
|
||||
* and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export declare const isexe: (path: string, options?: IsexeOptions) => Promise<boolean>;
|
||||
/**
|
||||
* Synchronously determine whether a path is executable based on the file
|
||||
* extension and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export declare const sync: (path: string, options?: IsexeOptions) => boolean;
|
||||
//# sourceMappingURL=win32.d.ts.map
|
||||
1
node_modules/isexe/dist/mjs/win32.d.ts.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/win32.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"win32.d.ts","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,YACH,YAAY,KACpB,QAAQ,OAAO,CASjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,SACT,MAAM,YACH,YAAY,KACpB,OASF,CAAA"}
|
||||
57
node_modules/isexe/dist/mjs/win32.js
generated
vendored
Normal file
57
node_modules/isexe/dist/mjs/win32.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* This is the Windows implementation of isexe, which uses the file
|
||||
* extension and PATHEXT setting.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
import { statSync } from 'fs';
|
||||
import { stat } from 'fs/promises';
|
||||
/**
|
||||
* Determine whether a path is executable based on the file extension
|
||||
* and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export const isexe = async (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(await stat(path), path, options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Synchronously determine whether a path is executable based on the file
|
||||
* extension and PATHEXT environment variable (or specified pathExt option)
|
||||
*/
|
||||
export const sync = (path, options = {}) => {
|
||||
const { ignoreErrors = false } = options;
|
||||
try {
|
||||
return checkStat(statSync(path), path, options);
|
||||
}
|
||||
catch (e) {
|
||||
const er = e;
|
||||
if (ignoreErrors || er.code === 'EACCES')
|
||||
return false;
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
const checkPathExt = (path, options) => {
|
||||
const { pathExt = process.env.PATHEXT || '' } = options;
|
||||
const peSplit = pathExt.split(';');
|
||||
if (peSplit.indexOf('') !== -1) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < peSplit.length; i++) {
|
||||
const p = peSplit[i].toLowerCase();
|
||||
const ext = path.substring(path.length - p.length).toLowerCase();
|
||||
if (p && ext === p) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options);
|
||||
//# sourceMappingURL=win32.js.map
|
||||
1
node_modules/isexe/dist/mjs/win32.js.map
generated
vendored
Normal file
1
node_modules/isexe/dist/mjs/win32.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"win32.js","sourceRoot":"","sources":["../../src/win32.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,QAAQ,EAAE,MAAM,IAAI,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,IAAY,EACZ,UAAwB,EAAE,EACR,EAAE;IACpB,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI;QACF,OAAO,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;KAClD;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;KACT;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAY,EACZ,UAAwB,EAAE,EACjB,EAAE;IACX,MAAM,EAAE,YAAY,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IACxC,IAAI;QACF,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;KAChD;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAA0B,CAAA;QACrC,IAAI,YAAY,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAA;QACtD,MAAM,EAAE,CAAA;KACT;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,OAAqB,EAAE,EAAE;IAC3D,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,OAAO,CAAA;IACvD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;QAClC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;QAEhE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE;YAClB,OAAO,IAAI,CAAA;SACZ;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,IAAY,EAAE,OAAqB,EAAE,EAAE,CACrE,IAAI,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA","sourcesContent":["/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'fs'\nimport { stat } from 'fs/promises'\nimport { IsexeOptions } from './options'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {}\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {}\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(';')\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (let i = 0; i < peSplit.length; i++) {\n const p = peSplit[i].toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n"]}
|
||||
96
node_modules/isexe/package.json
generated
vendored
Normal file
96
node_modules/isexe/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"name": "isexe",
|
||||
"version": "3.1.1",
|
||||
"description": "Minimal module to check if a file is executable.",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"module": "./dist/mjs/index.js",
|
||||
"types": "./dist/cjs/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"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",
|
||||
"sync-content": "^1.0.2",
|
||||
"tap": "^16.3.8",
|
||||
"ts-node": "^10.9.1",
|
||||
"typedoc": "^0.24.8",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"scripts": {
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"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",
|
||||
"tap": {
|
||||
"coverage": false,
|
||||
"node-arg": [
|
||||
"--enable-source-maps",
|
||||
"--no-warnings",
|
||||
"--loader",
|
||||
"ts-node/esm"
|
||||
],
|
||||
"ts": false
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
},
|
||||
"repository": "https://github.com/isaacs/isexe",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user