Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -1,39 +1,21 @@
'use strict';
var _types = require('../types');
function _types() {
const data = require('../types');
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
_types = function () {
return data;
};
return data;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
let file = null;
let setupArgs = [];
let initialized = false;
@@ -51,20 +33,20 @@ let initialized = false;
* non-zero exit code.
*/
process.on('message', request => {
const messageListener = request => {
switch (request[0]) {
case _types.CHILD_MESSAGE_INITIALIZE:
case _types().CHILD_MESSAGE_INITIALIZE:
const init = request;
file = init[2];
setupArgs = request[3];
break;
case _types.CHILD_MESSAGE_CALL:
case _types().CHILD_MESSAGE_CALL:
const call = request;
execMethod(call[2], call[3]);
break;
case _types.CHILD_MESSAGE_END:
case _types().CHILD_MESSAGE_END:
end();
break;
@@ -73,22 +55,24 @@ process.on('message', request => {
'Unexpected request from parent process: ' + request[0]
);
}
});
};
process.on('message', messageListener);
function reportSuccess(result) {
if (!process || !process.send) {
throw new Error('Child can only be used on a forked process');
}
process.send([_types.PARENT_MESSAGE_OK, result]);
process.send([_types().PARENT_MESSAGE_OK, result]);
}
function reportClientError(error) {
return reportError(error, _types.PARENT_MESSAGE_CLIENT_ERROR);
return reportError(error, _types().PARENT_MESSAGE_CLIENT_ERROR);
}
function reportInitializeError(error) {
return reportError(error, _types.PARENT_MESSAGE_SETUP_ERROR);
return reportError(error, _types().PARENT_MESSAGE_SETUP_ERROR);
}
function reportError(error, type) {
@@ -105,7 +89,7 @@ function reportError(error, type) {
error.constructor && error.constructor.name,
error.message,
error.stack,
typeof error === 'object' ? _objectSpread({}, error) : error
typeof error === 'object' ? {...error} : error
]);
}
@@ -121,7 +105,8 @@ function end() {
}
function exitProcess() {
process.exit(0);
// Clean up open handles so the process ideally exits gracefully
process.removeListener('message', messageListener);
}
function execMethod(method, args) {
@@ -148,6 +133,11 @@ function execMethod(method, args) {
execFunction(main.setup, main, setupArgs, execHelper, reportInitializeError);
}
const isPromise = obj =>
!!obj &&
(typeof obj === 'object' || typeof obj === 'function') &&
typeof obj.then === 'function';
function execFunction(fn, ctx, args, onResult, onError) {
let result;
@@ -158,7 +148,7 @@ function execFunction(fn, ctx, args, onResult, onError) {
return;
}
if (result && typeof result.then === 'function') {
if (isPromise(result)) {
result.then(onResult, onError);
} else {
onResult(result);