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

@@ -3,47 +3,29 @@
function _worker_threads() {
const data = require('worker_threads');
_worker_threads = function _worker_threads() {
_worker_threads = function () {
return data;
};
return data;
}
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;
@@ -61,20 +43,20 @@ let initialized = false;
* non-zero exit code.
*/
_worker_threads().parentPort.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;
@@ -83,22 +65,27 @@ _worker_threads().parentPort.on('message', request => {
'Unexpected request from parent process: ' + request[0]
);
}
});
};
_worker_threads().parentPort.on('message', messageListener);
function reportSuccess(result) {
if (_worker_threads().isMainThread) {
throw new Error('Child can only be used on a forked process');
}
_worker_threads().parentPort.postMessage([_types.PARENT_MESSAGE_OK, result]);
_worker_threads().parentPort.postMessage([
_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) {
@@ -115,7 +102,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
]);
}
@@ -131,7 +118,8 @@ function end() {
}
function exitProcess() {
process.exit(0);
// Clean up open handles so the worker ideally exits gracefully
_worker_threads().parentPort.removeListener('message', messageListener);
}
function execMethod(method, args) {
@@ -158,6 +146,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;
@@ -168,7 +161,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);