UNPKG

455 BJavaScriptView Raw
1'use strict';
2const arrgv = require('arrgv');
3
4function normalizeNodeArguments(fromConf = [], fromArgv = '') {
5 let parsedArgv = [];
6 if (fromArgv !== '') {
7 try {
8 parsedArgv = arrgv(fromArgv);
9 } catch {
10 throw new Error('Could not parse `--node-arguments` value. Make sure all strings are closed and backslashes are used correctly.');
11 }
12 }
13
14 return [...process.execArgv, ...fromConf, ...parsedArgv];
15}
16
17module.exports = normalizeNodeArguments;