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,GAEL,CAEI,QAAQ,OAAS,QACnB","file":"/npm/7ohm@1.0.5/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/7ohm@1.0.5/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\nconst { spawn } = require('child_process')\nconst { name, version } = require('../package.json')\n\nconst PM_SCRIPTS_SHORTCUT_REGEX = /^(npm|pnpm|yarn):\\w+$/\nconst PM_SCRIPT_DIVIDER = ':'\n\n/**\n * @param {*} commands - list of commands to execute\n * @param {*} onComplete - called when all commands exited by themselves\n * @returns a function that kills all running processes regardless of their state\n */\nfunction executeCommands(commands, onComplete) {\n  let nRunning = commands.length\n\n  const processes = commands.map((command) => {\n    const [ executable, ...options ] = expandCommand(command).split(' ').map(c => c.trim())\n    const cmd = spawn(executable, options, { shell: true, stdio: 'inherit' })\n    cmd.on('close', (code) => {\n      console.log(`${command} exited with code ${code}`);\n      if(--nRunning < 1) onComplete()\n    })\n    return cmd\n  })\n\n  return (signal) => processes.forEach((p) => p.kill(signal))\n}\n\nfunction expandCommand(command) {\n  const trimmed = command.trim()\n  if (!trimmed.match(PM_SCRIPTS_SHORTCUT_REGEX)) return trimmed;\n\n  const [pm, script] = trimmed.split(PM_SCRIPT_DIVIDER);\n  return `${pm} run ${script}`;\n}\n\nmodule.exports = executeCommands\n\n/* Command line execution code */\nconst HELP_TEXT = `${name} (v: ${version}) usage: ${name}  command1 command2 ...`\nconst HELP_TRIGGERS = ['-h', '--help']\nconst TERMINATE_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP']\n\nfunction main() {\n  const commands = process.argv.slice(2);\n\n  if (commands.length === 0 || commands.some((cmd) => HELP_TRIGGERS.includes(cmd))) {\n    console.log(HELP_TEXT)\n    process.exit()\n  }\n\n  const cmdText = commands.map((cmd) => `\\`${cmd}'`).join(', ')\n\n  console.log(`\\n[${name}: executing listed commands]:`, cmdText, '\\n')\n\n  const terminate = executeCommands(commands, () => {\n    console.log(`\\n[${name}: all commands finished execution, exiting]`)\n    process.exit()\n  })\n\n  TERMINATE_SIGNALS.forEach((signal) => {\n    process.on(signal, () => {\n      terminate(signal)\n      process.exit()\n    })\n  })\n}\n\nif (require.main === module) {\n  main()\n}\n"]}