mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-08-17 02:20:31 +03:00
Add "node-react" compatibility mode
Summary: Release notes: adds "node-react" compatibility mode Adds the "node-react" compatibility mode, which is like "fb-www", but doesn't contain the internal FB mocks. This mode is ideal for library authors who might want to experiment with the features of the React compiler in an environment that has basic React/Relay mocks as well as `require` and `module.exports` partial support. I'll be adding relevant documentation for this on the wiki too. Closes https://github.com/facebook/prepack/pull/1528 Differential Revision: D7149660 Pulled By: trueadm fbshipit-source-id: 3f00fa01bb881722b270393a27f817911c5a5256
This commit is contained in:
parent
afb0a9e9cb
commit
245a7ad7c9
@ -20,7 +20,7 @@ export default function(realm: Realm): Realm {
|
||||
if (realm.isCompatibleWith("browser")) {
|
||||
initializeDOMGlobals(realm);
|
||||
}
|
||||
if (realm.isCompatibleWith("fb-www")) {
|
||||
if (realm.isCompatibleWith("fb-www") || realm.isCompatibleWith("node-react")) {
|
||||
initializeDOMGlobals(realm);
|
||||
initializeReactMocks(realm);
|
||||
}
|
||||
|
@ -86,5 +86,7 @@ export default function(realm: Realm): void {
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
createFbMocks(realm, global);
|
||||
if (realm.isCompatibleWith("fb-www")) {
|
||||
createFbMocks(realm, global);
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,23 @@
|
||||
|
||||
import type { ErrorHandler } from "./errors.js";
|
||||
|
||||
export type Compatibility = "browser" | "jsc-600-1-4-17" | "mobile" | "node-source-maps" | "node-cli" | "fb-www";
|
||||
export const CompatibilityValues = ["browser", "jsc-600-1-4-17", "mobile", "node-source-maps", "node-cli", "fb-www"];
|
||||
export type Compatibility =
|
||||
| "browser"
|
||||
| "jsc-600-1-4-17"
|
||||
| "mobile"
|
||||
| "node-source-maps"
|
||||
| "node-cli"
|
||||
| "fb-www"
|
||||
| "node-react";
|
||||
export const CompatibilityValues = [
|
||||
"browser",
|
||||
"jsc-600-1-4-17",
|
||||
"mobile",
|
||||
"node-source-maps",
|
||||
"node-cli",
|
||||
"fb-www",
|
||||
"node-react",
|
||||
];
|
||||
|
||||
export type ReactOutputTypes = "create-element" | "jsx" | "bytecode";
|
||||
export const ReactOutputValues = ["create-element", "jsx", "bytecode"];
|
||||
|
@ -40,8 +40,8 @@ var optionsConfig = [
|
||||
{
|
||||
type: "choice",
|
||||
name: "compatibility",
|
||||
choices: ["browser", "jsc-600-1-4-17", "node-source-maps", "node-cli", "fb-wwww"],
|
||||
defaultVal: "browser",
|
||||
choices: ["browser", "jsc-600-1-4-17", "node-source-maps", "node-cli", "node-react"],
|
||||
defaultVal: "node-react",
|
||||
description: "The target environment for Prepack"
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user