diff options
Diffstat (limited to '')
| -rw-r--r-- | node_modules/isexe/dist/esm/index.d.ts | 14 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/index.js | 16 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/index.min.js | 2 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/options.d.ts | 32 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/options.js | 2 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/package.json | 3 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/posix.d.ts | 18 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/posix.js | 62 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/win32.d.ts | 18 | ||||
| -rw-r--r-- | node_modules/isexe/dist/esm/win32.js | 58 |
10 files changed, 225 insertions, 0 deletions
diff --git a/node_modules/isexe/dist/esm/index.d.ts b/node_modules/isexe/dist/esm/index.d.ts new file mode 100644 index 0000000..223bf78 --- /dev/null +++ b/node_modules/isexe/dist/esm/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/esm/index.js b/node_modules/isexe/dist/esm/index.js new file mode 100644 index 0000000..1e309ac --- /dev/null +++ b/node_modules/isexe/dist/esm/index.js @@ -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
\ No newline at end of file diff --git a/node_modules/isexe/dist/esm/index.min.js b/node_modules/isexe/dist/esm/index.min.js new file mode 100644 index 0000000..f3a6fc3 --- /dev/null +++ b/node_modules/isexe/dist/esm/index.min.js @@ -0,0 +1,2 @@ +var y=Object.defineProperty;var u=(t,r)=>{for(var e in r)y(t,e,{get:r[e],enumerable:!0})};var i={};u(i,{isexe:()=>C,sync:()=>A});import{statSync as w}from"node:fs";import{stat as S}from"node:fs/promises";var C=async(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return d(await S(t),r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},A=(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return d(w(t),r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},d=(t,r)=>t.isFile()&&T(t,r),T=(t,r)=>{let e=r.uid??process.getuid?.(),s=r.groups??process.getgroups?.()??[],o=r.gid??process.getgid?.()??s[0];if(e===void 0||o===void 0)throw new Error("cannot get uid or gid");let c=new Set([o,...s]),n=t.mode,l=t.uid,E=t.gid,f=parseInt("100",8),p=parseInt("010",8),x=parseInt("001",8),h=f|p;return!!(n&x||n&p&&c.has(E)||n&f&&l===e||n&h&&e===0)};var a={};u(a,{isexe:()=>F,sync:()=>L});import{statSync as k}from"node:fs";import{stat as I}from"node:fs/promises";import{delimiter as _}from"node:path";var F=async(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return m(await I(t),t,r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},L=(t,r={})=>{let{ignoreErrors:e=!1}=r;try{return m(k(t),t,r)}catch(s){let o=s;if(e||o.code==="EACCES")return!1;throw o}},P=(t,r)=>{let{pathExt:e=process.env.PATHEXT||""}=r,s=e.split(_);if(s.indexOf("")!==-1)return!0;for(let o of s){let c=o.toLowerCase(),n=t.substring(t.length-c.length).toLowerCase();if(c&&n===c)return!0}return!1},m=(t,r,e)=>t.isFile()&&P(r,e);var v=process.env._ISEXE_TEST_PLATFORM_||process.platform,g=v==="win32"?a:i,R=g.isexe,U=g.sync;export{R as isexe,i as posix,U as sync,a as win32}; +//# sourceMappingURL=index.min.js.map diff --git a/node_modules/isexe/dist/esm/options.d.ts b/node_modules/isexe/dist/esm/options.d.ts new file mode 100644 index 0000000..c30a29b --- /dev/null +++ b/node_modules/isexe/dist/esm/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/esm/options.js b/node_modules/isexe/dist/esm/options.js new file mode 100644 index 0000000..e9ded40 --- /dev/null +++ b/node_modules/isexe/dist/esm/options.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=options.js.map
\ No newline at end of file diff --git a/node_modules/isexe/dist/esm/package.json b/node_modules/isexe/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/isexe/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/isexe/dist/esm/posix.d.ts b/node_modules/isexe/dist/esm/posix.d.ts new file mode 100644 index 0000000..04874a1 --- /dev/null +++ b/node_modules/isexe/dist/esm/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/esm/posix.js b/node_modules/isexe/dist/esm/posix.js new file mode 100644 index 0000000..f1af6d5 --- /dev/null +++ b/node_modules/isexe/dist/esm/posix.js @@ -0,0 +1,62 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { statSync } from 'node:fs'; +import { stat } from 'node: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
\ No newline at end of file diff --git a/node_modules/isexe/dist/esm/win32.d.ts b/node_modules/isexe/dist/esm/win32.d.ts new file mode 100644 index 0000000..e3f68d1 --- /dev/null +++ b/node_modules/isexe/dist/esm/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/esm/win32.js b/node_modules/isexe/dist/esm/win32.js new file mode 100644 index 0000000..2c75e67 --- /dev/null +++ b/node_modules/isexe/dist/esm/win32.js @@ -0,0 +1,58 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { statSync } from 'node:fs'; +import { stat } from 'node:fs/promises'; +import { delimiter } from 'node:path'; +/** + * 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(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 |