mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-11 14:46:37 +03:00
a10ac631b4
Summary: Release Notes: none I made more files flow strict, to move forward on https://github.com/facebook/prepack/issues/1941. I'm using `/* flow strict-local */` to avoid the problem with importing non-strict files for now. I created a small utility to check for an undefined type or null value, but am wondering if it is a bit pointless. Would like some feedback on that. Thanks! Closes https://github.com/facebook/prepack/pull/2048 Differential Revision: D8225232 Pulled By: hermanventer fbshipit-source-id: b4d29d170722a6652f0c3428949b296273a9d953
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
/* @flow strict-local */
|
|
|
|
import type { Realm } from "./realm.js";
|
|
import initializePrepackGlobals from "./intrinsics/prepack/global.js";
|
|
import initializeDOMGlobals from "./intrinsics/dom/global.js";
|
|
import initializeReactNativeGlobals from "./intrinsics/react-native/global.js";
|
|
import initializeReactMocks from "./intrinsics/fb-www/global.js";
|
|
|
|
export default function(realm: Realm): Realm {
|
|
initializePrepackGlobals(realm);
|
|
if (realm.isCompatibleWith("browser")) {
|
|
initializeDOMGlobals(realm);
|
|
}
|
|
if (realm.isCompatibleWith("fb-www") || realm.isCompatibleWith("node-react")) {
|
|
initializeDOMGlobals(realm);
|
|
initializeReactMocks(realm);
|
|
}
|
|
if (realm.isCompatibleWith(realm.MOBILE_JSC_VERSION) || realm.isCompatibleWith("mobile")) {
|
|
initializeReactNativeGlobals(realm);
|
|
}
|
|
return realm;
|
|
}
|