aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/isexe/dist/commonjs
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/isexe/dist/commonjs')
-rw-r--r--node_modules/isexe/dist/commonjs/index.d.ts14
-rw-r--r--node_modules/isexe/dist/commonjs/index.js56
-rw-r--r--node_modules/isexe/dist/commonjs/index.min.js2
-rw-r--r--node_modules/isexe/dist/commonjs/options.d.ts32
-rw-r--r--node_modules/isexe/dist/commonjs/options.js3
-rw-r--r--node_modules/isexe/dist/commonjs/package.json3
-rw-r--r--node_modules/isexe/dist/commonjs/posix.d.ts18
-rw-r--r--node_modules/isexe/dist/commonjs/posix.js67
-rw-r--r--node_modules/isexe/dist/commonjs/win32.d.ts18
-rw-r--r--node_modules/isexe/dist/commonjs/win32.js63
10 files changed, 276 insertions, 0 deletions
diff --git a/node_modules/isexe/dist/commonjs/index.d.ts b/node_modules/isexe/dist/commonjs/index.d.ts
new file mode 100644
index 0000000..223bf78
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/index.d.ts
@@ -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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/index.js b/node_modules/isexe/dist/commonjs/index.js
new file mode 100644
index 0000000..71882e7
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/index.js
@@ -0,0 +1,56 @@
+"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 () {
+ var ownKeys = function(o) {
+ ownKeys = Object.getOwnPropertyNames || function (o) {
+ var ar = [];
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
+ return ar;
+ };
+ return ownKeys(o);
+ };
+ return function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
+ __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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/index.min.js b/node_modules/isexe/dist/commonjs/index.min.js
new file mode 100644
index 0000000..7cb0271
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/index.min.js
@@ -0,0 +1,2 @@
+"use strict";var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _=a(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.sync=i.isexe=void 0;var M=require("node:fs"),x=require("node:fs/promises"),q=async(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return d(await(0,x.stat)(t),e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};i.isexe=q;var m=(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return d((0,M.statSync)(t),e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};i.sync=m;var d=(t,e)=>t.isFile()&&A(t,e),A=(t,e)=>{let r=e.uid??process.getuid?.(),s=e.groups??process.getgroups?.()??[],n=e.gid??process.getgid?.()??s[0];if(r===void 0||n===void 0)throw new Error("cannot get uid or gid");let u=new Set([n,...s]),c=t.mode,S=t.uid,P=t.gid,f=parseInt("100",8),l=parseInt("010",8),j=parseInt("001",8),C=f|l;return!!(c&j||c&l&&u.has(P)||c&f&&S===r||c&C&&r===0)}});var g=a(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.sync=o.isexe=void 0;var T=require("node:fs"),I=require("node:fs/promises"),D=require("node:path"),F=async(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return y(await(0,I.stat)(t),t,e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};o.isexe=F;var L=(t,e={})=>{let{ignoreErrors:r=!1}=e;try{return y((0,T.statSync)(t),t,e)}catch(s){let n=s;if(r||n.code==="EACCES")return!1;throw n}};o.sync=L;var B=(t,e)=>{let{pathExt:r=process.env.PATHEXT||""}=e,s=r.split(D.delimiter);if(s.indexOf("")!==-1)return!0;for(let n of s){let u=n.toLowerCase(),c=t.substring(t.length-u.length).toLowerCase();if(u&&c===u)return!0}return!1},y=(t,e,r)=>t.isFile()&&B(e,r)});var p=a(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0})});var v=exports&&exports.__createBinding||(Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]})),G=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),w=exports&&exports.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),n=0;n<s.length;n++)s[n]!=="default"&&v(r,e,s[n]);return G(r,e),r}})(),X=exports&&exports.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v(e,t,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.sync=exports.isexe=exports.posix=exports.win32=void 0;var E=w(_());exports.posix=E;var O=w(g());exports.win32=O;X(p(),exports);var H=process.env._ISEXE_TEST_PLATFORM_||process.platform,b=H==="win32"?O:E;exports.isexe=b.isexe;exports.sync=b.sync;
+//# sourceMappingURL=index.min.js.map
diff --git a/node_modules/isexe/dist/commonjs/options.d.ts b/node_modules/isexe/dist/commonjs/options.d.ts
new file mode 100644
index 0000000..c30a29b
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/options.d.ts
@@ -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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/options.js b/node_modules/isexe/dist/commonjs/options.js
new file mode 100644
index 0000000..0dfad07
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/options.js
@@ -0,0 +1,3 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+//# sourceMappingURL=options.js.map \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/package.json b/node_modules/isexe/dist/commonjs/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/node_modules/isexe/dist/commonjs/posix.d.ts b/node_modules/isexe/dist/commonjs/posix.d.ts
new file mode 100644
index 0000000..04874a1
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/posix.d.ts
@@ -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.js';
+/**
+ * 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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/posix.js b/node_modules/isexe/dist/commonjs/posix.js
new file mode 100644
index 0000000..c6b9f63
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/posix.js
@@ -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 node_fs_1 = require("node:fs");
+const promises_1 = require("node: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, node_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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/win32.d.ts b/node_modules/isexe/dist/commonjs/win32.d.ts
new file mode 100644
index 0000000..e3f68d1
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/win32.d.ts
@@ -0,0 +1,18 @@
+/**
+ * This is the Windows implementation of isexe, which uses the file
+ * extension and PATHEXT setting.
+ *
+ * @module
+ */
+import { IsexeOptions } from './options.js';
+/**
+ * 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 \ No newline at end of file
diff --git a/node_modules/isexe/dist/commonjs/win32.js b/node_modules/isexe/dist/commonjs/win32.js
new file mode 100644
index 0000000..c1524a1
--- /dev/null
+++ b/node_modules/isexe/dist/commonjs/win32.js
@@ -0,0 +1,63 @@
+"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 node_fs_1 = require("node:fs");
+const promises_1 = require("node:fs/promises");
+const node_path_1 = require("node:path");
+/**
+ * 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, node_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(node_path_1.delimiter);
+ if (peSplit.indexOf('') !== -1) {
+ return true;
+ }
+ for (const pes of peSplit) {
+ const p = pes.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 \ No newline at end of file