mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 12:33:47 +08:00
Rollup-plugin-terser dropped Node <10 and Rollup <2 support (https://github.com/TrySound/rollup-plugin-terser/releases/tag/v6.0.0) and upgraded to Terser 5 (https://github.com/TrySound/rollup-plugin-terser/releases/tag/v7.0.0) DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Change-Id: Ifa0085fe5daa052bdfea40720d1852549f4bf316 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2537956 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
function _types() {
|
|
const data = require('../types');
|
|
|
|
_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.
|
|
*/
|
|
const isWorkerThread = () => {
|
|
try {
|
|
// `Require` here to support Node v10
|
|
const {isMainThread, parentPort} = require('worker_threads');
|
|
|
|
return !isMainThread && parentPort;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
const messageParent = (message, parentProcess = process) => {
|
|
try {
|
|
if (isWorkerThread()) {
|
|
// `Require` here to support Node v10
|
|
const {parentPort} = require('worker_threads');
|
|
|
|
parentPort.postMessage([_types().PARENT_MESSAGE_CUSTOM, message]);
|
|
} else if (typeof parentProcess.send === 'function') {
|
|
parentProcess.send([_types().PARENT_MESSAGE_CUSTOM, message]);
|
|
}
|
|
} catch {
|
|
throw new Error('"messageParent" can only be used inside a worker');
|
|
}
|
|
};
|
|
|
|
var _default = messageParent;
|
|
exports.default = _default;
|