function-exec-sync
Advanced tools
| export declare function tmpdir(): string; |
| export declare function tmpdir(): string; |
| /** | ||
| * Compatibility Layer for Node.js 0.8+ | ||
| * Local to this package - contains only needed functions. | ||
| */ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| Object.defineProperty(exports, "tmpdir", { | ||
| enumerable: true, | ||
| get: function() { | ||
| return tmpdir; | ||
| } | ||
| }); | ||
| var _os = /*#__PURE__*/ _interop_require_default(require("os")); | ||
| function _interop_require_default(obj) { | ||
| return obj && obj.__esModule ? obj : { | ||
| default: obj | ||
| }; | ||
| } | ||
| /** | ||
| * os.tmpdir wrapper for Node.js 0.8+ | ||
| * - Uses native os.tmpdir on Node 0.10+ | ||
| * - Falls back to os-shim on Node 0.8 | ||
| */ var hasTmpdir = typeof _os.default.tmpdir === 'function'; | ||
| function tmpdir() { | ||
| if (hasTmpdir) { | ||
| return _os.default.tmpdir(); | ||
| } | ||
| var osShim = require('os-shim'); | ||
| return osShim.tmpdir(); | ||
| } | ||
| /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; } |
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport os from 'os';\n\n/**\n * os.tmpdir wrapper for Node.js 0.8+\n * - Uses native os.tmpdir on Node 0.10+\n * - Falls back to os-shim on Node 0.8\n */\nvar hasTmpdir = typeof os.tmpdir === 'function';\n\nexport function tmpdir(): string {\n if (hasTmpdir) {\n return os.tmpdir();\n }\n var osShim = require('os-shim');\n return osShim.tmpdir();\n}\n"],"names":["tmpdir","hasTmpdir","os","osShim","require"],"mappings":"AAAA;;;CAGC;;;;+BAUeA;;;eAAAA;;;yDATD;;;;;;AAEf;;;;CAIC,GACD,IAAIC,YAAY,OAAOC,WAAE,CAACF,MAAM,KAAK;AAE9B,SAASA;IACd,IAAIC,WAAW;QACb,OAAOC,WAAE,CAACF,MAAM;IAClB;IACA,IAAIG,SAASC,QAAQ;IACrB,OAAOD,OAAOH,MAAM;AACtB"} |
| export declare function tmpdir(): string; |
| /** | ||
| * Compatibility Layer for Node.js 0.8+ | ||
| * Local to this package - contains only needed functions. | ||
| */ import os from 'os'; | ||
| /** | ||
| * os.tmpdir wrapper for Node.js 0.8+ | ||
| * - Uses native os.tmpdir on Node 0.10+ | ||
| * - Falls back to os-shim on Node 0.8 | ||
| */ var hasTmpdir = typeof os.tmpdir === 'function'; | ||
| export function tmpdir() { | ||
| if (hasTmpdir) { | ||
| return os.tmpdir(); | ||
| } | ||
| var osShim = require('os-shim'); | ||
| return osShim.tmpdir(); | ||
| } |
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport os from 'os';\n\n/**\n * os.tmpdir wrapper for Node.js 0.8+\n * - Uses native os.tmpdir on Node 0.10+\n * - Falls back to os-shim on Node 0.8\n */\nvar hasTmpdir = typeof os.tmpdir === 'function';\n\nexport function tmpdir(): string {\n if (hasTmpdir) {\n return os.tmpdir();\n }\n var osShim = require('os-shim');\n return osShim.tmpdir();\n}\n"],"names":["os","hasTmpdir","tmpdir","osShim","require"],"mappings":"AAAA;;;CAGC,GACD,OAAOA,QAAQ,KAAK;AAEpB;;;;CAIC,GACD,IAAIC,YAAY,OAAOD,GAAGE,MAAM,KAAK;AAErC,OAAO,SAASA;IACd,IAAID,WAAW;QACb,OAAOD,GAAGE,MAAM;IAClB;IACA,IAAIC,SAASC,QAAQ;IACrB,OAAOD,OAAOD,MAAM;AACtB"} |
@@ -14,4 +14,2 @@ "use strict"; | ||
| var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic")); | ||
| var _os = /*#__PURE__*/ _interop_require_default(require("os")); | ||
| var _osshim = /*#__PURE__*/ _interop_require_default(require("os-shim")); | ||
| var _path = /*#__PURE__*/ _interop_require_default(require("path")); | ||
@@ -22,2 +20,3 @@ var _shorthash = /*#__PURE__*/ _interop_require_default(require("short-hash")); | ||
| var _url = /*#__PURE__*/ _interop_require_default(require("url")); | ||
| var _compatts = require("./compat.js"); | ||
| var _serializejavascriptcjs = /*#__PURE__*/ _interop_require_default(require("./serialize-javascript.cjs")); | ||
@@ -58,3 +57,2 @@ var _unlinkSafets = /*#__PURE__*/ _interop_require_default(require("./unlinkSafe.js")); | ||
| } | ||
| var tmpdir = _os.default.tmpdir || _osshim.default.tmpdir; | ||
| var DEFAULT_SLEEP_MS = 100; | ||
@@ -98,3 +96,3 @@ var NODES = [ | ||
| var name = options.name === undefined ? 'function-exec-sync' : options.name; | ||
| var temp = _path.default.join(tmpdir(), name, (0, _shorthash.default)(workerData.cwd)); | ||
| var temp = _path.default.join((0, _compatts.tmpdir)(), name, (0, _shorthash.default)(workerData.cwd)); | ||
| var input = _path.default.join(temp, (0, _tempsuffix.default)('input')); | ||
@@ -101,0 +99,0 @@ var output = _path.default.join(temp, (0, _tempsuffix.default)('output')); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/index.ts"],"sourcesContent":["import cp from 'child_process';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os';\nimport osShim from 'os-shim';\nimport path from 'path';\nimport shortHash from 'short-hash';\nimport suffix from 'temp-suffix';\nimport sleep from 'thread-sleep-compat';\nimport url from 'url';\nimport serialize from './serialize-javascript.cjs';\n\nconst tmpdir = os.tmpdir || osShim.tmpdir;\n\nconst DEFAULT_SLEEP_MS = 100;\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst worker = path.join(__dirname, 'workers', 'runFunction.cjs');\n\nimport unlinkSafe from './unlinkSafe.ts';\n\nconst existsSync = (test: string): boolean => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nimport type { ExecWorkerOptions } from './types.ts';\n\ninterface NodeJSEnv extends NodeJS.ProcessEnv {\n NODE_OPTIONS: string;\n}\n\nexport type * from './types.ts';\nexport default function functionExecSync(filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions, filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions | string, filePath?: string | unknown[], ...args: unknown[]): unknown {\n if (typeof options === 'string') {\n args.unshift(filePath);\n filePath = options;\n options = null;\n }\n if (!filePath) throw new Error('function-exec-sync missing file');\n options = (options || {}) as ExecWorkerOptions;\n\n const env = { ...(options.env || process.env) } as NodeJSEnv;\n delete env.NODE_OPTIONS;\n const workerData = {\n filePath,\n args,\n callbacks: options.callbacks === undefined ? false : options.callbacks,\n env,\n cwd: options.cwd === undefined ? process.cwd() : options.cwd,\n };\n\n const name = options.name === undefined ? 'function-exec-sync' : options.name;\n const temp = path.join(tmpdir(), name, shortHash(workerData.cwd));\n const input = path.join(temp, suffix('input'));\n const output = path.join(temp, suffix('output'));\n const done = path.join(temp, suffix('done'));\n\n // store data to a file\n mkdirp.sync(path.dirname(input));\n fs.writeFileSync(input, serialize(workerData), 'utf8');\n unlinkSafe(output);\n\n // call the function\n const execPath = options.execPath || process.execPath;\n\n // only node\n if (NODES.indexOf(path.basename(execPath).toLowerCase()) < 0) throw new Error(`Expecting node executable. Received: ${path.basename(execPath)}`);\n\n // exec and start polling\n if (!cp.execFileSync) {\n const sleepMS = options.sleep === undefined ? DEFAULT_SLEEP_MS : options.sleep;\n let cmd = `\"${execPath}\" \"${worker}\" \"${input}\" \"${output}\"`;\n cmd += `${isWindows ? ' & ' : '; '}echo \"done\" > \"${done}\"`;\n cp.exec(cmd, { env });\n while (!existsSync(done)) {\n sleep(sleepMS);\n }\n } else {\n cp.execFileSync(execPath, [worker, input, output], { env });\n }\n unlinkSafe(input);\n unlinkSafe(done);\n\n // get data and clean up\n let res: { error?: Error; value: unknown };\n try {\n // biome-ignore lint/security/noGlobalEval: Serialize\n res = eval(`(${fs.readFileSync(output, 'utf8')})`);\n unlinkSafe(output);\n } catch (err) {\n throw new Error(`function-exec-sync: Error: ${err.message}. Function: ${filePath}. Exec path: ${execPath}`);\n }\n\n // throw error from the worker\n if (res.error) {\n const error = new Error(res.error.message);\n for (const key in res.error) error[key] = res.error[key];\n throw error;\n }\n // return the result\n return res.value;\n}\n"],"names":["functionExecSync","tmpdir","os","osShim","DEFAULT_SLEEP_MS","NODES","isWindows","process","platform","test","env","OSTYPE","__dirname","path","dirname","__filename","url","fileURLToPath","worker","join","existsSync","fs","accessSync","statSync","_","options","filePath","args","unshift","Error","NODE_OPTIONS","workerData","callbacks","undefined","cwd","name","temp","shortHash","input","suffix","output","done","mkdirp","sync","writeFileSync","serialize","unlinkSafe","execPath","indexOf","basename","toLowerCase","cp","execFileSync","sleepMS","sleep","cmd","exec","res","eval","readFileSync","err","message","error","key","value"],"mappings":";;;;+BAwCA;;;eAAwBA;;;oEAxCT;yDACA;oEACI;yDACJ;6DACI;2DACF;gEACK;iEACH;wEACD;0DACF;6EACM;mEAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AARvB,IAAMC,SAASC,WAAE,CAACD,MAAM,IAAIE,eAAM,CAACF,MAAM;AAEzC,IAAMG,mBAAmB;AACzB,IAAMC,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAC9C,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uD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AC/CM,IAAAA,qBAAU,EAACN;IACb,EAAE,OAAOoB,KAAK;QACZ,MAAM,IAAI/B,MAAM,AAAC,8BAAuDH,OAA1BkC,IAAIC,OAAO,EAAC,gBAAsCd,OAAxBrB,UAAS,iBAAwB,OAATqB;IAClG;IAEA,8BAA8B;IAC9B,IAAIU,IAAIK,KAAK,EAAE;QACb,IAAMA,QAAQ,IAAIjC,MAAM4B,IAAIK,KAAK,CAACD,OAAO;QACzC,IAAK,IAAME,OAAON,IAAIK,KAAK,CAAEA,KAAK,CAACC,IAAI,GAAGN,IAAIK,KAAK,CAACC,IAAI;QACxD,MAAMD;IACR;IACA,oBAAoB;IACpB,OAAOL,IAAIO,KAAK;AAClB"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/index.ts"],"sourcesContent":["import cp from 'child_process';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport shortHash from 'short-hash';\nimport suffix from 'temp-suffix';\nimport sleep from 'thread-sleep-compat';\nimport url from 'url';\nimport { tmpdir } from './compat.ts';\nimport serialize from './serialize-javascript.cjs';\n\nconst DEFAULT_SLEEP_MS = 100;\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst worker = path.join(__dirname, 'workers', 'runFunction.cjs');\n\nimport unlinkSafe from './unlinkSafe.ts';\n\nconst existsSync = (test: string): boolean => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nimport type { ExecWorkerOptions } from './types.ts';\n\ninterface NodeJSEnv extends NodeJS.ProcessEnv {\n NODE_OPTIONS: string;\n}\n\nexport type * from './types.ts';\nexport default function functionExecSync(filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions, filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions | string, filePath?: string | unknown[], ...args: unknown[]): unknown {\n if (typeof options === 'string') {\n args.unshift(filePath);\n filePath = options;\n options = null;\n }\n if (!filePath) throw new Error('function-exec-sync missing file');\n options = (options || {}) as ExecWorkerOptions;\n\n const env = { ...(options.env || process.env) } as NodeJSEnv;\n delete env.NODE_OPTIONS;\n const workerData = {\n filePath,\n args,\n callbacks: options.callbacks === undefined ? false : options.callbacks,\n env,\n cwd: options.cwd === undefined ? process.cwd() : options.cwd,\n };\n\n const name = options.name === undefined ? 'function-exec-sync' : options.name;\n const temp = path.join(tmpdir(), name, shortHash(workerData.cwd));\n const input = path.join(temp, suffix('input'));\n const output = path.join(temp, suffix('output'));\n const done = path.join(temp, suffix('done'));\n\n // store data to a file\n mkdirp.sync(path.dirname(input));\n fs.writeFileSync(input, serialize(workerData), 'utf8');\n unlinkSafe(output);\n\n // call the function\n const execPath = options.execPath || process.execPath;\n\n // only node\n if (NODES.indexOf(path.basename(execPath).toLowerCase()) < 0) throw new Error(`Expecting node executable. Received: ${path.basename(execPath)}`);\n\n // exec and start polling\n if (!cp.execFileSync) {\n const sleepMS = options.sleep === undefined ? DEFAULT_SLEEP_MS : options.sleep;\n let cmd = `\"${execPath}\" \"${worker}\" \"${input}\" \"${output}\"`;\n cmd += `${isWindows ? ' & ' : '; '}echo \"done\" > \"${done}\"`;\n cp.exec(cmd, { env });\n while (!existsSync(done)) {\n sleep(sleepMS);\n }\n } else {\n cp.execFileSync(execPath, [worker, input, output], { env });\n }\n unlinkSafe(input);\n unlinkSafe(done);\n\n // get data and clean up\n let res: { error?: Error; value: unknown };\n try {\n // biome-ignore lint/security/noGlobalEval: Serialize\n res = eval(`(${fs.readFileSync(output, 'utf8')})`);\n unlinkSafe(output);\n } catch (err) {\n throw new Error(`function-exec-sync: Error: ${err.message}. Function: ${filePath}. Exec path: ${execPath}`);\n }\n\n // throw error from the worker\n if (res.error) {\n const error = new Error(res.error.message);\n for (const key in res.error) error[key] = res.error[key];\n throw error;\n }\n // return the result\n return res.value;\n}\n"],"names":["functionExecSync","DEFAULT_SLEEP_MS","NODES","isWindows","process","platform","test","env","OSTYPE","__dirname","path","dirname","__filename","url","fileURLToPath","worker","join","existsSync","fs","accessSync","statSync","_","options","filePath","args","unshift","Error","NODE_OPTIONS","workerData","callbacks","undefined","cwd","name","temp","tmpdir","shortHash","input","suffix","output","done","mkdirp","sync","writeFileSync","serialize","unlinkSafe","execPath","indexOf","basename","toLowerCase","cp","execFileSync","sleepMS","sleep","cmd","exec","res","eval","readFileSync","err","message","error","key","value"],"mappings":";;;;+BAqCA;;;eAAwBA;;;oEArCT;yDACA;oEACI;2DACF;gEACK;iEACH;wEACD;0DACF;wBACO;6EACD;mEAQC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANvB,IAAMC,mBAAmB;AACzB,IAAMC,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAC9C,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,SAASL,aAAI,CAACM,IAAI,CAACP,WAAW,WAAW;AAI/C,IAAMQ,aAAa,SAACX;IAClB,IAAI;QACDY,CAAAA,WAAE,CAACC,UAAU,IAAID,WAAE,CAACE,QAAQ,AAAD,EAAGd;QAC/B,OAAO;IACT,EAAE,OAAOe,GAAG;QACV,OAAO;IACT;AACF;AAWe,SAASrB,iBAAiBsB,OAAmC,EAAEC,QAA6B;IAAE,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,OAAH,UAAA,OAAA,IAAA,OAAA,QAAA,OAAA,GAAA,OAAA,MAAA;QAAGA,KAAH,OAAA,KAAA,SAAA,CAAA,KAAkB;;IAC7H,IAAI,OAAOF,YAAY,UAAU;QAC/B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from 'child_process'; | ||
| import fs from 'fs'; | ||
| import mkdirp from 'mkdirp-classic'; | ||
| import os from 'os'; | ||
| import osShim from 'os-shim'; | ||
| import path from 'path'; | ||
@@ -11,4 +9,4 @@ import shortHash from 'short-hash'; | ||
| import url from 'url'; | ||
| import { tmpdir } from './compat.js'; | ||
| import serialize from './serialize-javascript.cjs'; | ||
| const tmpdir = os.tmpdir || osShim.tmpdir; | ||
| const DEFAULT_SLEEP_MS = 100; | ||
@@ -15,0 +13,0 @@ const NODES = [ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/index.ts"],"sourcesContent":["import cp from 'child_process';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os';\nimport osShim from 'os-shim';\nimport path from 'path';\nimport shortHash from 'short-hash';\nimport suffix from 'temp-suffix';\nimport sleep from 'thread-sleep-compat';\nimport url from 'url';\nimport serialize from './serialize-javascript.cjs';\n\nconst tmpdir = os.tmpdir || osShim.tmpdir;\n\nconst DEFAULT_SLEEP_MS = 100;\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst worker = path.join(__dirname, 'workers', 'runFunction.cjs');\n\nimport unlinkSafe from './unlinkSafe.ts';\n\nconst existsSync = (test: string): boolean => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nimport type { ExecWorkerOptions } from './types.ts';\n\ninterface NodeJSEnv extends NodeJS.ProcessEnv {\n NODE_OPTIONS: string;\n}\n\nexport type * from './types.ts';\nexport default function functionExecSync(filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions, filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions | string, filePath?: string | unknown[], ...args: unknown[]): unknown {\n if (typeof options === 'string') {\n args.unshift(filePath);\n filePath = options;\n options = null;\n }\n if (!filePath) throw new Error('function-exec-sync missing file');\n options = (options || {}) as ExecWorkerOptions;\n\n const env = { ...(options.env || process.env) } as NodeJSEnv;\n delete env.NODE_OPTIONS;\n const workerData = {\n filePath,\n args,\n callbacks: options.callbacks === undefined ? false : options.callbacks,\n env,\n cwd: options.cwd === undefined ? process.cwd() : options.cwd,\n };\n\n const name = options.name === undefined ? 'function-exec-sync' : options.name;\n const temp = path.join(tmpdir(), name, shortHash(workerData.cwd));\n const input = path.join(temp, suffix('input'));\n const output = path.join(temp, suffix('output'));\n const done = path.join(temp, suffix('done'));\n\n // store data to a file\n mkdirp.sync(path.dirname(input));\n fs.writeFileSync(input, serialize(workerData), 'utf8');\n unlinkSafe(output);\n\n // call the function\n const execPath = options.execPath || process.execPath;\n\n // only node\n if (NODES.indexOf(path.basename(execPath).toLowerCase()) < 0) throw new Error(`Expecting node executable. Received: ${path.basename(execPath)}`);\n\n // exec and start polling\n if (!cp.execFileSync) {\n const sleepMS = options.sleep === undefined ? DEFAULT_SLEEP_MS : options.sleep;\n let cmd = `\"${execPath}\" \"${worker}\" \"${input}\" \"${output}\"`;\n cmd += `${isWindows ? ' & ' : '; '}echo \"done\" > \"${done}\"`;\n cp.exec(cmd, { env });\n while (!existsSync(done)) {\n sleep(sleepMS);\n }\n } else {\n cp.execFileSync(execPath, [worker, input, output], { env });\n }\n unlinkSafe(input);\n unlinkSafe(done);\n\n // get data and clean up\n let res: { error?: Error; value: unknown };\n try {\n // biome-ignore lint/security/noGlobalEval: Serialize\n res = eval(`(${fs.readFileSync(output, 'utf8')})`);\n unlinkSafe(output);\n } catch (err) {\n throw new Error(`function-exec-sync: Error: ${err.message}. Function: ${filePath}. Exec path: ${execPath}`);\n }\n\n // throw error from the worker\n if (res.error) {\n const error = new Error(res.error.message);\n for (const key in res.error) error[key] = res.error[key];\n throw error;\n }\n // return the result\n return res.value;\n}\n"],"names":["cp","fs","mkdirp","os","osShim","path","shortHash","suffix","sleep","url","serialize","tmpdir","DEFAULT_SLEEP_MS","NODES","isWindows","process","platform","test","env","OSTYPE","__dirname","dirname","__filename","fileURLToPath","worker","join","unlinkSafe","existsSync","accessSync","statSync","_","functionExecSync","options","filePath","args","unshift","Error","NODE_OPTIONS","workerData","callbacks","undefined","cwd","name","temp","input","output","done","sync","writeFileSync","execPath","indexOf","basename","toLowerCase","execFileSync","sleepMS","cmd","exec","res","eval","readFileSync","err","message","error","key","value"],"mappings":"AAAA,OAAOA,QAAQ,gBAAgB;AAC/B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,UAAU;AAC7B,OAAOC,UAAU,OAAO;AACxB,OAAOC,eAAe,aAAa;AACnC,OAAOC,YAAY,cAAc;AACjC,OAAOC,WAAW,sBAAsB;AACxC,OAAOC,SAAS,MAAM;AACtB,OAAOC,eAAe,6BAA6B;AAEnD,MAAMC,SAASR,GAAGQ,MAAM,IAAIP,OAAOO,MAAM;AAEzC,MAAMC,mBAAmB;AACzB,MAAMC,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAC9C,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,MAAMC,YAAYf,KAAKgB,OAAO,CAAC,OAAOC,eAAe,cAAcb,IAAIc,aAAa,CAAC,YAAYd,GAAG,IAAIa;AACxG,MAAME,SAASnB,KAAKoB,IAAI,CAACL,WAAW,WAAW;AAE/C,OAAOM,gBAAgB,kBAAkB;AAEzC,MAAMC,aAAa,CAACV;IAClB,IAAI;QACDhB,CAAAA,GAAG2B,UAAU,IAAI3B,GAAG4B,QAAQ,AAAD,EAAGZ;QAC/B,OAAO;IACT,EAAE,OAAOa,GAAG;QACV,OAAO;IACT;AACF;AAWA,eAAe,SAASC,iBAAiBC,OAAmC,EAAE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AAY,EAAE;QACpB,MAAMC,UAAUtB,QAAQxB,KAAK,KAAKgC,YAAY5B,mBAAmBoB,QAAQxB,KAAK;QAC9E,IAAI+C,MAAM,CAAC,CAAC,EAAEN,SAAS,GAAG,EAAEzB,OAAO,GAAG,EAAEoB,MAAM,GAAG,EAAEC,OAAO,CAAC,CAAC;QAC5DU,OAAO,GAAGzC,YAAY,QAAQ,KAAK,eAAe,EAAEgC,KAAK,CAAC,CAAC;QAC3D9C,GAAGwD,IAAI,CAACD,KAAK;YAAErC;QAAI;QACnB,MAAO,CAACS,WAAWmB,MAAO;YACxBtC,MAAM8C;QACR;IACF,OAAO;QACLtD,GAAGqD,YAAY,CAACJ,UAAU;YAACzB;YAAQoB;YAAOC;SAAO,EAAE;YAAE3B;QAAI;IAC3D;IACAQ,WAAWkB;IACXlB,WAAWoB;IAEX,wBAAwB;IACxB,IAAIW;IACJ,IAAI;QACF,qDAAqD;QACrDA,MAAMC,KAAK,CAAC,CAAC,EAAEzD,GAAG0D,YAAY,CAACd,QAAQ,QAAQ,CAAC,CAAC;QACjDnB,WAAWmB;IACb,EAAE,OAAOe,KAAK;QACZ,MAAM,IAAIxB,MAAM,CAAC,2BAA2B,EAAEwB,IAAIC,OAAO,CAAC,YAAY,EAAE5B,SAAS,aAAa,EAAEgB,UAAU;IAC5G;IAEA,8BAA8B;IAC9B,IAAIQ,IAAIK,KAAK,EAAE;QACb,MAAMA,QAAQ,IAAI1B,MAAMqB,IAAIK,KAAK,CAACD,OAAO;QACzC,IAAK,MAAME,OAAON,IAAIK,KAAK,CAAEA,KAAK,CAACC,IAAI,GAAGN,IAAIK,KAAK,CAACC,IAAI;QACxD,MAAMD;IACR;IACA,oBAAoB;IACpB,OAAOL,IAAIO,KAAK;AAClB"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/function-exec-sync/src/index.ts"],"sourcesContent":["import cp from 'child_process';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport shortHash from 'short-hash';\nimport suffix from 'temp-suffix';\nimport sleep from 'thread-sleep-compat';\nimport url from 'url';\nimport { tmpdir } from './compat.ts';\nimport serialize from './serialize-javascript.cjs';\n\nconst DEFAULT_SLEEP_MS = 100;\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst worker = path.join(__dirname, 'workers', 'runFunction.cjs');\n\nimport unlinkSafe from './unlinkSafe.ts';\n\nconst existsSync = (test: string): boolean => {\n try {\n (fs.accessSync || fs.statSync)(test);\n return true;\n } catch (_) {\n return false;\n }\n};\n\nimport type { ExecWorkerOptions } from './types.ts';\n\ninterface NodeJSEnv extends NodeJS.ProcessEnv {\n NODE_OPTIONS: string;\n}\n\nexport type * from './types.ts';\nexport default function functionExecSync(filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions, filePath: string, ...args: unknown[]);\nexport default function functionExecSync(options: ExecWorkerOptions | string, filePath?: string | unknown[], ...args: unknown[]): unknown {\n if (typeof options === 'string') {\n args.unshift(filePath);\n filePath = options;\n options = null;\n }\n if (!filePath) throw new Error('function-exec-sync missing file');\n options = (options || {}) as ExecWorkerOptions;\n\n const env = { ...(options.env || process.env) } as NodeJSEnv;\n delete env.NODE_OPTIONS;\n const workerData = {\n filePath,\n args,\n callbacks: options.callbacks === undefined ? false : options.callbacks,\n env,\n cwd: options.cwd === undefined ? process.cwd() : options.cwd,\n };\n\n const name = options.name === undefined ? 'function-exec-sync' : options.name;\n const temp = path.join(tmpdir(), name, shortHash(workerData.cwd));\n const input = path.join(temp, suffix('input'));\n const output = path.join(temp, suffix('output'));\n const done = path.join(temp, suffix('done'));\n\n // store data to a file\n mkdirp.sync(path.dirname(input));\n fs.writeFileSync(input, serialize(workerData), 'utf8');\n unlinkSafe(output);\n\n // call the function\n const execPath = options.execPath || process.execPath;\n\n // only node\n if (NODES.indexOf(path.basename(execPath).toLowerCase()) < 0) throw new Error(`Expecting node executable. Received: ${path.basename(execPath)}`);\n\n // exec and start polling\n if (!cp.execFileSync) {\n const sleepMS = options.sleep === undefined ? DEFAULT_SLEEP_MS : options.sleep;\n let cmd = `\"${execPath}\" \"${worker}\" \"${input}\" \"${output}\"`;\n cmd += `${isWindows ? ' & ' : '; '}echo \"done\" > \"${done}\"`;\n cp.exec(cmd, { env });\n while (!existsSync(done)) {\n sleep(sleepMS);\n }\n } else {\n cp.execFileSync(execPath, [worker, input, output], { env });\n }\n unlinkSafe(input);\n unlinkSafe(done);\n\n // get data and clean up\n let res: { error?: Error; value: unknown };\n try {\n // biome-ignore lint/security/noGlobalEval: Serialize\n res = eval(`(${fs.readFileSync(output, 'utf8')})`);\n unlinkSafe(output);\n } catch (err) {\n throw new Error(`function-exec-sync: Error: ${err.message}. Function: ${filePath}. Exec path: ${execPath}`);\n }\n\n // throw error from the worker\n if (res.error) {\n const error = new Error(res.error.message);\n for (const key in res.error) error[key] = res.error[key];\n throw error;\n }\n // return the result\n return res.value;\n}\n"],"names":["cp","fs","mkdirp","path","shortHash","suffix","sleep","url","tmpdir","serialize","DEFAULT_SLEEP_MS","NODES","isWindows","process","platform","test","env","OSTYPE","__dirname","dirname","__filename","fileURLToPath","worker","join","unlinkSafe","existsSync","accessSync","statSync","_","functionExecSync","options","filePath","args","unshift","Error","NODE_OPTIONS","workerData","callbacks","undefined","cwd","name","temp","input","output","done","sync","writeFileSync","execPath","indexOf","basename","toLowerCase","execFileSync","sleepMS","cmd","exec","res","eval","readFileSync","err","message","error","key","value"],"mappings":"AAAA,OAAOA,QAAQ,gBAAgB;AAC/B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,eAAe,aAAa;AACnC,OAAOC,YAAY,cAAc;AACjC,OAAOC,WAAW,sBAAsB;AACxC,OAAOC,SA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D,GAAGwD,YAAY,CAACd,QAAQ,QAAQ,CAAC,CAAC;QACjDnB,WAAWmB;IACb,EAAE,OAAOe,KAAK;QACZ,MAAM,IAAIxB,MAAM,CAAC,2BAA2B,EAAEwB,IAAIC,OAAO,CAAC,YAAY,EAAE5B,SAAS,aAAa,EAAEgB,UAAU;IAC5G;IAEA,8BAA8B;IAC9B,IAAIQ,IAAIK,KAAK,EAAE;QACb,MAAMA,QAAQ,IAAI1B,MAAMqB,IAAIK,KAAK,CAACD,OAAO;QACzC,IAAK,MAAME,OAAON,IAAIK,KAAK,CAAEA,KAAK,CAACC,IAAI,GAAGN,IAAIK,KAAK,CAACC,IAAI;QACxD,MAAMD;IACR;IACA,oBAAoB;IACpB,OAAOL,IAAIO,KAAK;AAClB"} |
+1
-1
| { | ||
| "name": "function-exec-sync", | ||
| "version": "1.4.11", | ||
| "version": "1.4.12", | ||
| "description": "Run a function in a node process", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
93358
3.24%45
18.42%914
5.18%