diff --git a/lib/internal/process.js b/lib/internal/process.js index 3de3ae1603deb5..f3bbd8d0b3c922 100644 --- a/lib/internal/process.js +++ b/lib/internal/process.js @@ -122,16 +122,9 @@ function setupMemoryUsage() { function setupConfig(_source) { // NativeModule._source // used for `process.config`, but not a real module - var config = _source.config; + const config = _source.config; delete _source.config; - // strip the gyp comment line at the beginning - config = config.split('\n') - .slice(1) - .join('\n') - .replace(/"/g, '\\"') - .replace(/'/g, '"'); - process.config = JSON.parse(config, function(key, value) { if (value === 'true') return true; if (value === 'false') return false; diff --git a/tools/js2c.py b/tools/js2c.py index 75c74f22cebe66..553615a4661d4d 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -288,6 +288,11 @@ def JS2C(source, target): split = split[1:] name = '/'.join(split) + # if its a gypi file we're going to want it as json + # later on anyway, so get it out of the way now + if name.endswith(".gypi"): + lines = re.sub(r'#.*?\n', '', lines) + lines = re.sub(r'\'', '"', lines) name = name.split('.', 1)[0] var = name.replace('-', '_').replace('/', '_') key = '%s_key' % var