Summary:
## Overview
This diff adds flow parser support for number unions as Int32Enums
The following will be supported as an Int32 enum:
```
interval?: WithDefault<0 | 15 | 30 | 60, 0>,
```
## Number type issues
We assume that all number enums are ints (so far there's not been a valid use case for unions of floats).
If we think there would be a use case for float unions we would need to update this to something like:
```
// Int32
intervalInt?: WithDefault<Int32Enum<0 | 15 | 30 | 60>, 0>,
// Float
intervalInt?: WithDefault<FloatEnum<0.0 | 15.1 | 30.2 | 60.3>, 0.0>,
```
My recommendation is that we default number unions to ints and if a use case arises later for floats, we would add the Float support as:
```
// Int32
intervalInt?: WithDefault<0 | 15 | 30 | 60, 0>,
// Float
intervalInt?: WithDefault<FloatEnum<0.0 | 15.1 | 30.2 | 60.3>, 0.0>,
```
Reviewed By: JoshuaGross
Differential Revision: D17161701
fbshipit-source-id: 4b016eee45bf28bf505afd14a6c1aeea6ca8c04f
Summary: This diff adds more advanced support for Int32 enums by allowing them as object properties in props
Reviewed By: JoshuaGross
Differential Revision: D17161656
fbshipit-source-id: d4377d95961554c83b60ed929f6279291c2d1104
Summary: This diff adds the snapshots for the new Int32 fixture and renames the ENUM_ fixture to STRING_ENUM
Reviewed By: JoshuaGross
Differential Revision: D17158033
fbshipit-source-id: 405b1da5ede16410434a9097ef256f99e4115533
Summary:
Adds schema to allow for Int32Enums in the codegen.
All of the non-schema updates here are flow fixes, the code there is implemented in the next diffs
Reviewed By: JoshuaGross
Differential Revision: D17158026
fbshipit-source-id: b5a6871225771c3c97a43a901d5f8e51c44f35c8
Summary:
Fix flow test case input in react-native-codegen package that has syntax errors.
Missing ";" after export type,
Missing ";" or "," after interface/object type member signature,
Missing ":" in method signature,
etc
## Changelog
[General] [Fixed] - Fix flow test case input in react-native-codegen package
Pull Request resolved: https://github.com/facebook/react-native/pull/26316
Test Plan: Parsed files using flow parser, but some test cases are intended to have syntax error, in this case I fixed unexpected ones.
Reviewed By: rickhanlonii
Differential Revision: D17194969
Pulled By: osdnk
fbshipit-source-id: 262d0af4d9e7e74f7ba3eb30c4fd9753c08f3bf7
Summary:
Our JS codegen assumes that all Android view managers extend `BaseViewManager` which allows generated delegates to set base view props using `BaseViewManagerDelegate`, see and example of the generated delegate for `FbReactTTRCStepRenderFlagManager`:
```
public class TTRCStepRenderFlagManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & TTRCStepRenderFlagManagerInterface<T>>{
public TTRCStepRenderFlagManagerDelegate(U viewManager) {
super(viewManager);
}
Override
public void setProperty(T view, String propName, Nullable Object value) {
switch (propName) {
case "traceId":
mViewManager.setTraceId(view, value == null ? null : (String) value);
break;
case "stepName":
mViewManager.setStepName(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
```
The problem is that `FbReactTTRCStepRenderFlagManager` doesn't extend `BaseViewManager`, but `ViewManager`, which means that we cannot use it with the generated delegate. We cannot use `ViewManager` instead of `BaseViewManager` in our JS codegen either, otherwise we will not be able to set base view props.
This diff makes it possible for delegates generated by JS to be used by Android view managers that do not extend `BaseViewManager`. By having a `BaseViewManagerInterface` we will be able to introduce a no-op base view manager implementation and wrap our original view manager in it so that we can pass as a constructor parameter to `BaseViewManagerDelegate`.
See an example of this approach for `FbReactTTRCStepRenderFlagManager`:
```
public class FbReactTTRCStepRenderFlagManager extends ViewManager<FbReactTTRCStepRenderFlag, ReactShadowNodeImpl> implements TTRCStepRenderFlagManagerInterface<FbReactTTRCStepRenderFlag> {
private final ViewManagerDelegate<FbReactTTRCStepRenderFlag> mDelegate;
public FbReactTTRCStepRenderFlagManager() {
mDelegate = new TTRCStepRenderFlagManagerDelegate<>(new ViewManagerWrapper(this));
}
...
private static class ViewManagerWrapper extends BaseViewManagerAdapter<FbReactTTRCStepRenderFlag> implements TTRCStepRenderFlagManagerInterface<FbReactTTRCStepRenderFlag> {
private final TTRCStepRenderFlagManagerInterface<FbReactTTRCStepRenderFlag> mViewManager;
private FbReactTTRCStepRenderFlagManagerAdapter(TTRCStepRenderFlagManagerInterface<FbReactTTRCStepRenderFlag> viewManager) {
mViewManager = viewManager;
}
Override
public void setTraceId(FbReactTTRCStepRenderFlag view, Nullable String traceId) {
mViewManager.setTraceId(view, traceId);
}
Override
public void setStepName(FbReactTTRCStepRenderFlag view, Nullable String stepName) {
mViewManager.setStepName(view, stepName);
}
}
}
```
Reviewed By: mdvacca
Differential Revision: D16984121
fbshipit-source-id: ea2761dda68a96ff3ba6ac64153bc4e56e396774
Summary: This diff removes the 'RCT' prefix (if it's present) from the names of the generated Java classes. The motivation is that we don't want to have any Java files having this prefix in the RN Android codebase.
Reviewed By: JoshuaGross
Differential Revision: D17123804
fbshipit-source-id: 31905d3141e0f58ea47cdbdb0cf77d2d105de9a9
Summary:
** Summary of failures encountered during the build **
Rule //fbandroid/java/com/facebook/catalyst/launcher:app_prod_debug FAILED because Command failed with exit code 1.
stderr: /java/InterfaceOnlyNativeComponentViewManagerDelegate.java:18: error: reference to setAccessibilityHint is ambiguous
mViewManager.setAccessibilityHint(view, value == null ? "" : (String) value);
^
both method setAccessibilityHint(T,java.lang.String) in com.facebook.react.uimanager.BaseViewManagerInterface and method setAccessibilityHint(T,java.lang.String) in com.facebook.react.viewmanagers.InterfaceOnlyNativeComponentViewManagerInterface match
/java/StringPropNativeComponentViewManagerDelegate.java:18: error: reference to setAccessibilityHint is ambiguous
mViewManager.setAccessibilityHint(view, value == null ? "" : (String) value);
^
both method setAccessibilityHint(T,java.lang.String) in com.facebook.react.uimanager.BaseViewManagerInterface and method setAccessibilityHint(T,java.lang.String) in com.facebook.react.viewmanagers.StringPropNativeComponentViewManagerInterface match
/java/StringPropNativeComponentViewManagerDelegate.java:21: error: reference to setAccessibilityRole is ambiguous
mViewManager.setAccessibilityRole(view, value == null ? null : (String) value);
^
both method setAccessibilityRole(T,java.lang.String) in com.facebook.react.uimanager.BaseViewManagerInterface and method setAccessibilityRole(T,java.lang.String) in com.facebook.react.viewmanagers.StringPropNativeComponentViewManagerInterface match
Errors: 3. Warnings: 0.
When running <javac_jar>.
When building rule //xplat/js/react-native-github/packages/react-native-codegen:generated_components_java-codegen_testsAndroid.
```
Reviewed By: mdvacca
Differential Revision: D17107929
fbshipit-source-id: 32bc553d450628c530e22cb13f305e3a3e0f45cd
Summary: This diff adds a missing copyright header and the `generated` annotation to the Java files generated by the JS codegen. Since we are going to check in the generated classes for the OSS components, we need to make sure the Lint formatter doesn't complain about formatting issues in those files.
Reviewed By: fkgozali
Differential Revision: D17101946
fbshipit-source-id: 1361a294b8c1538c0ea346b43ef623e843d7038d
Summary:
This one is fun.
# What?
Previously, the codegen'd constructor for a prop value in CPP was defined like so: `value(convertRawProp(rawProps, "value", sourceProps.value, value))`.
The fourth argument there is the default value of the result of `convertRawProps`. What that is saying is: the default value of `value` is `value` - the default value is itself.
The assumption was that because value is defined as `T value{someDefaultValue}` in the struct, in other words, because it has a default value in the `.h` file, that it will /start out/ being equal to `someDefaultValue`, and then be overridden later optionally, or be set to itself, which should be `someDefaultValue`.
However, that is not how initialization of class members in C++ constructors work. If a class member is in the member initializer list, [then the default value is not set](https://en.cppreference.com/w/cpp/language/initializer_list). That means that if the `defaultValue` as passed is /ever/ used, we incur undefined behavior.
# When is the defaultValue used?
The defaultValue is only used when no prop or a null value is sent from JS to C++: https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactCommon/fabric/core/propsConversions.h?commit=becfded106d706e6028e705d7883483051061e9f&lines=60
In most cases, the `sourceProps.value` is actually used as a fallback (the previous props value). The first time props are ever constructed, `sourceProps` should have valid values since it goes through a different path where only the defaultValues from props.h are used.
# Why wasn't this crashing before?
Most codegen'd properties are ints, floats, doubles, and bools. They might get wacky values, but they won't crash. I wouldn't be surprised if this diff solves some subtle visual or layout bugs, but I have no evidence of this yet.
# How do non-codegen'd props.cpp initialize default values?
Same as this diff does: defaultValue should be explicit everywhere: https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp?commit=2813789c292dfdf1220b88f203af6b33ba9e42de&lines=51
# So... what have we learned?
C++ is tricky!
Reviewed By: yungsters, shergin
Differential Revision: D16955421
fbshipit-source-id: 75bb3f22822299e17df1c36abecdb6ce49012406
Summary:
The types we were using before weren't very strict and it had been on my list to fix this. I *think* this is the right type. With Flow's type first project having these exported types will be necessary anyways so we can just use that for the ref.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D16930573
fbshipit-source-id: 05c1e097794633a2cefa7384c9d81ab15a63d8af
Summary:
add script which proves that new codegen gives a similar code as old one.
How it works?
While creating a rule, it generates file which is bash script returning 1 or 0 depending if result of new and old codegen are the same (it's done by redirecting output of buck's cmd).
How js script works:
1. remove empty lines
2. remove comments
3. remove imports
4. sort lines (cause order of structs might be different so let's sort everything!)
5. remove namespaces (I grouped them in new codegen)
Reviewed By: RSNara
Differential Revision: D16827988
fbshipit-source-id: 0432144161e2dcf8ed4cbe2eeea712d062e3721d
Summary: This catches some errors about hooks being used at the top level in a module
Reviewed By: gaearon
Differential Revision: D16945591
fbshipit-source-id: 116ed24b4394b1f516a2ebcd75977d2ba5c57afb
Summary:
Updates the babel parser to support exports that include flow types
Changelog:
[Internal]
Reviewed By: cpojer
Differential Revision: D16927086
fbshipit-source-id: 526efd911c2492a67f618d2d8ad199a7a5a235ff
Summary: Give a more explicit message about why `number` isn't supported
Reviewed By: rickhanlonii
Differential Revision: D16926698
fbshipit-source-id: 292cb13aa11205e1350209178bde1977a2a7ad4c
Summary: Fixes an issue where we weren't traversing all the way into object properties to find imports we may need
Reviewed By: TheSavior
Differential Revision: D16896674
fbshipit-source-id: f95a4f84e51265962ddfd2aeea9da717df033879
Summary: Adds support for generating structs for object properties that are objects or arrays
Reviewed By: TheSavior
Differential Revision: D16896143
fbshipit-source-id: 6682d047e218fc774c8d0593dc2c66fe73615be7
Summary: Adds a broken fixture for arrays nested inside of objects (fixed in the next diffs)
Reviewed By: TheSavior
Differential Revision: D16896138
fbshipit-source-id: 355a71352a78ca076c1de56304908e664772c200
Summary: Adds a fixture for generating nested array objects (fix is on the next diff)
Reviewed By: TheSavior
Differential Revision: D16858626
fbshipit-source-id: c9543f4f8ecc073fd840edd94d47bdc911eaa69e
Summary: ReadableArray doesn't have a .getFloat, so casting double to floats instead. This is consistent with how the prop conversion happens as well.
Reviewed By: makovkastar
Differential Revision: D16897600
fbshipit-source-id: e8c76558f030d291960b5790a262fa49a9f358e7
Summary: Adding this fixture in a standalone diff so it is easier to see the change on the next one.
Reviewed By: JoshuaGross
Differential Revision: D16852439
fbshipit-source-id: 3f167509b78ebb95f31e44fbf40e9551d4a5500b
Summary: The codegen has a bug with arrays that have objects that contain native primitives. This diff adds a fixture to demonstrate that bug. I don't change any behavior in this diff. This is just to make the change in the next diff easier to read.
Reviewed By: JoshuaGross
Differential Revision: D16846290
fbshipit-source-id: 06f477b9e3b77cbc1faee11c78d031b45c094d31
Summary: We weren't adding the local imports recursively as well. This is a similar change as was made when creating the CppHelpers.getImports in D16759170.
Reviewed By: rickhanlonii, JoshuaGross
Differential Revision: D16840667
fbshipit-source-id: 1090a774c9e96798d5900bc0b4bf1be29b3ba090
Summary: The new support for ReadOnlyArray needs to call this new function for spreads too.
Reviewed By: JoshuaGross
Differential Revision: D16823796
fbshipit-source-id: 9de94b41cdead7ce5238c77a9e39b5daf760dfe2
Summary: I realized my previous diff was incomplete. Adding parsing and generation code for Double for props, commands, and events.
Reviewed By: rickhanlonii
Differential Revision: D16823540
fbshipit-source-id: fbed9897bb84b789c502cf4153e81060590152b8
Summary: Split buck rules for component and modules for our further convenience
Reviewed By: rickhanlonii
Differential Revision: D16803703
fbshipit-source-id: c01fb97875b43be4020edd054cad538ec8ed6861
Summary:
We're currently not supporting this kind of params
```
+sample(string):void
````
and here's special exception for it.
Reviewed By: RSNara
Differential Revision: D16708583
fbshipit-source-id: 809f9808b77108857c8363536b896089e9cb957f
Summary: Adds e2e tests for the array of object prop types in the codegen
Reviewed By: rubennorte, motiz88
Differential Revision: D16814301
fbshipit-source-id: 613f32a888451c0c1b7359133b7bf88878e36916
Summary: This diff adds a super call to `BaseViewManagerDelegate` if the current delegate doesn't have any props. We still want to set base view props, so we need `BaseViewManagerDelegate` to take care of this.
Reviewed By: rickhanlonii
Differential Revision: D16806648
fbshipit-source-id: 61963f2211cc7b2e7f5822c48bb0a7f50d909221
Summary: There are a couple of cases where props can conflict which would cause undefined behavior. We'll throw to protect against that. Now that we support type spread this is more possible without someone realizing.
Reviewed By: JoshuaGross
Differential Revision: D16813884
fbshipit-source-id: 1a8fce365ab315198abdff0de6006cfe34e84fb9
Summary: Apparently I missed one more edge case. Thanks Josh for flagging!
Reviewed By: JoshuaGross
Differential Revision: D16813354
fbshipit-source-id: 6b59bc7b18184e3aa437c3b038ffd22b0fc0ba6a
Summary: We want to be able to spread props at any level, not just the top level
Reviewed By: JoshuaGross
Differential Revision: D16812884
fbshipit-source-id: 2e710141f833a7cc7ea25a91a1523a5c43b4e02c
Summary: We want to be able to spread types that are defined in the same file.
Reviewed By: JoshuaGross
Differential Revision: D16812171
fbshipit-source-id: 7cda9869ea25f0357b3f8a3b28443407b219f04b
Summary: Support a prop-type `Double`, in addition to `Float`, for flow typing and codegen of components.
Reviewed By: TheSavior
Differential Revision: D16812812
fbshipit-source-id: b5588b3218636283a4e9c5d17212dd0b92986eb9
Summary: Old codegen was omitting `getConstants` if it was empty. So do our. There's no point in providing this getter in this case.
Reviewed By: RSNara
Differential Revision: D16762230
fbshipit-source-id: 721df13a00848d23108329b152115c0f0aee8eb9
Summary: `setMethodArgConversionSelector` is method for provinding generated structs for methods' params. It was exactly how in old codegen.
Reviewed By: RSNara
Differential Revision: D16784403
fbshipit-source-id: d35bc8160be62385527299a6b8e68c1159002853
Summary: It was a mistake. We should obtain value by proper key always. Previously by a mistake I hardcoded 'a'. I wasn't break anything because it wasn't used in Internationalization. However, it was a bug
Reviewed By: RSNara
Differential Revision: D16782132
fbshipit-source-id: 59f7910f2be7753c07f16f00a201de856d57e29e
Summary:
It was mistake which I fix here. Type of param in protocols should be generated struct.
See generated struct in snap. It's exactly how it was in previous codegen
Reviewed By: RSNara
Differential Revision: D16770579
fbshipit-source-id: dac9c15c5d91a41ab2d06aea416f64bd7deb4476
Summary: Property should be marked as optional not only when value is optional, but also key.
Reviewed By: RSNara
Differential Revision: D16764332
fbshipit-source-id: d56944ef263da3aa1fce3482151c761574a83be6
Summary: RTCConvert was previously imported on each protocol. It was redundant. It's enough to import it once per file
Reviewed By: RSNara
Differential Revision: D16764834
fbshipit-source-id: 9e5dcd52e38dfefa675e3e2c9f2a8f414da1a02c
Summary: Param of function can be optional and it should have impact on native code. Inspired by old codegen
Reviewed By: RSNara
Differential Revision: D16763884
fbshipit-source-id: dab50275f902dbe4af25824bb6128d3b37fc43cd
Summary:
This diff adds support to the flow parser to parse object props to the codegen schema
This handles required and optional props, as well as required and optional object properties, WithDefault, enums, etc. Basically everything is supported that is supported at the top level
Reviewed By: TheSavior, osdnk
Differential Revision: D16759198
fbshipit-source-id: 6f501f4738f84f20a940235ba74f7bae93e64eef
Summary: We'll need this helper in the prop files now so let's move it over to the generic cpp helpers
Reviewed By: TheSavior
Differential Revision: D16759164
fbshipit-source-id: 8765ffee3bd8219b5f0dc8677362ec45f0a8e2c5
Summary:
This diff adds snapshot updates for the new object props test fixtures whose implementation does not need to change (e.g. event emitter files will not change when object props are implemented). This is for easier reviewability in later diffs.
Notes that in the files that will change, we're temporarily filtering the OBJECT_PROPS test fixture
Reviewed By: TheSavior
Differential Revision: D16759124
fbshipit-source-id: 8aae063614f762c8bd7bf092b0d274804c38dd14
Summary: This diff adds ObjectTypeAnnotation to the codegen schema, throwing for the missing implementation sites added in the next diffs for easier review-ability. Also adds a schema fixture that is flow checked for review, but does not export it because the tests would fail
Reviewed By: TheSavior
Differential Revision: D16759109
fbshipit-source-id: 75c93623e8c1ae2003c7cc638e8e3447f0e7aa38
Summary:
This diff introduces an interface `ViewManagerDelegate` and its base implementation `BaseViewManagerDelegate`, which is used as a parent class for all view manager delegates generated by the JS codegen. Before the changes in this diff, generated delegates didn't support setting the base view properties such as background color, rotation, opacity, etc. Now it's possible to do by using `BaseViewManagerDelegate.setProperty(...)`, and since all generated delegates extend BaseViewManagerDelegate, they can just call `super.setProperty(...)` for properties they don't want to handle.
This diff also introduced a new method `ViewManager.getDelegate()`. This will allow view managers to return an instance of the delegate generated by JS and ensure that the view properties are set in a type-safe manner. If this method returns null (it does by default), we fall back to the default implementation of setting view properties using Java-generated `$$PropsSetter`
classes.
This is an example of an interface class generated by JS:
```
public interface RCTAxialGradientViewViewManagerInterface<T extends View> {
void setColors(T view, Nullable ReadableArray value);
void setLocations(T view, Nullable ReadableArray value);
void setEndX(T view, Float value);
void setEndY(T view, Float value);
void setStartX(T view, Float value);
void setStartY(T view, Float value);
}
```
This is an example of a delegate class generated by JS:
```
public class RCTAxialGradientViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RCTAxialGradientViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RCTAxialGradientViewManagerDelegate(U viewManager) {
super(viewManager);
}
Override
public void setProperty(T view, String propName, Nullable Object value) {
switch (propName) {
case "colors":
mViewManager.setColors(view, (ReadableArray) value);
break;
case "locations":
mViewManager.setLocations(view, (ReadableArray) value);
break;
case "endX":
mViewManager.setEndX(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "endY":
mViewManager.setEndY(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "startX":
mViewManager.setStartX(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "startY":
mViewManager.setStartY(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}
```
NOTE: What if a view manager, for instance ReactAxialGradientManager, wanted to add support for the borderRadius prop? In the old Java codegen, it would just need to create a method and annotate it with ReactProp (name = ViewProps.BORDER_RADIUS) and $$PropsSetter would call this method when a property with this name must be set. With the new JS codegen, borderRadius is a part of the basic view props, so setBorderRadius is not generated as a part of the ViewManagerInterface, so it’s not possible to set this value. I see two options: 1) add a method boolean setProperty (String propName, Object value) and let the view manager handle it in a non-type safe way (return true if it’s been handled). 2) Generate BaseViewManagerInterface which will include all basic view props and make BaseViewManager implement this interface, leaving all methods empty so that it stays compatible with the current implementation. Override these methods in a view manager that needs to handle a specific property in a custom way (so we would override setBorderRadius in ReactAxialGradientManager).
Reviewed By: mdvacca
Differential Revision: D16667686
fbshipit-source-id: 06a15a92f8af55640b7a53c5a34f40366d1be2a8
Summary:
Need to add explicit type annotations in these areas to unblock types-first architecture for Flow. These are locations the codemod could not automatically handle.
I'll call out areas I need a close eye on in the comments.
Reviewed By: panagosg7
Differential Revision: D16659053
fbshipit-source-id: 167dd2abe093019b128676426374c1c62cf71e7f
Summary:
I created a new test project today using RN 0.60.3 and saw that prettier is now used with eslint. After looking at the `react-native-community` eslint config, I notice that it wasn't using the [recommended configuration](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) of `eslint-plugin-prettier`
This PR adds the `eslint-config-prettier` to avoid conflicts between eslint and prettier, it also adds the `prettier/react` config to avoid problems with the `eslint-plugin-react`.
## Changelog
[General] [Changed] - Use eslint-plugin-prettier recommended config
Pull Request resolved: https://github.com/facebook/react-native/pull/25674
Test Plan: - ✅ Ensure there is no difference on this repo (no ESLint errors, same number of warnings, and no changes when running prettier).
Differential Revision: D16666178
Pulled By: cpojer
fbshipit-source-id: 70f81db793866acc88388b7b00a496aab5e0b156
Summary:
If was breaking in cases like
```
export { x as default }
```
Reviewed By: RSNara
Differential Revision: D16689606
fbshipit-source-id: 2583c73c5ac06ea0fa8666d219e739e68fc75b12
Summary: It should always be a pointer, sorry!
Reviewed By: RSNara
Differential Revision: D16689608
fbshipit-source-id: f67d2606b5bdc169d312c1c75748c390ee5e56ed
Summary:
Following our internal discussion we want to change previously used name convention.
Now it looks like:
```
#import <FBReactNativeTestSpec/FBReactNativeTestSpec.h>
```
Name is a param of `rn_codegen` and `rn_library`. Also, I found it the easiest to move replacing `::_IMPORT_::` into buck rule
Reviewed By: fkgozali
Differential Revision: D16646616
fbshipit-source-id: 2c33c5b4d1c42b0e6f5a42d9a318bd8bda9745f4
Summary:
We don't want to make our codegen breaking if type is not existing. In order to it we can always fallback to Object. That's how it currently works in old codegen
#Facebook
Thare're few places in our internal code where we use `Map` or tuple in these cases
Reviewed By: RSNara
Differential Revision: D16687360
fbshipit-source-id: bf8aafd3254fc7e18ad0d58ad1a29e2beeb15bf0
Summary: Retuned value can be nullable and it need to be handled
Reviewed By: RSNara
Differential Revision: D16687359
fbshipit-source-id: 7869c4e2b1da69b680b6eade3c88e0558077b705
Summary: Add handling of `$ReadOnly`, $ReadOnlyArray`. Drop handling of params for callback (does not impact native generated node) and promises' types (does not impact native generated node). Remove typo from native codegen.
Reviewed By: RSNara
Differential Revision: D16686886
fbshipit-source-id: 26345978bbbba0cee14d00e7b5b9e5017c89a46c
Summary:
This will provide consistency with the rest of ObjC/ObjC++ files throughout RN codebase, which is also part of the iOS engineering practice to have a prefix.
Highlights:
* This only affects the `protocol` and extern C functions, and the .h output file name
* Other C++ only file/classes are not affected
* The assumption is that the RCT prefix is only for iOS specific files/names. The JS component name should **NOT** have any prefix in the long term (some of them still have RCT prefix in the name, which was an artifact of legacy inconsistency).
* The RCT prefix is not relevant to Java/JNI code, since they have their own convention
Reviewed By: TheSavior, mdvacca
Differential Revision: D16661286
fbshipit-source-id: b8dd75fa7f176d6658183f225b27db017b4b55e7
Summary:
ErrorUtils is giving an error by eslint. ('ErrorUtils is not defined').
## Changelog
[General] [Fixed] - Add ErrorUtils to eslint globals
Pull Request resolved: https://github.com/facebook/react-native/pull/25947
Test Plan: Run eslint on a react native project using ErrorUtils. Eslint verification should pass.
Differential Revision: D16666163
Pulled By: cpojer
fbshipit-source-id: c20c4e21fe06c6863dcfc167d6d03c6217ae1235
Summary:
This uses a new helper called `dispatchCommand` that now exists on the renderer. This was added to the renderer here: https://github.com/facebook/react/pull/16085
In Paper it calls UIManager.dispatchViewManagerCommand and in Fabric it calls the c++ Fabric UIManager
Reviewed By: rickhanlonii
Differential Revision: D16578708
fbshipit-source-id: 30f9468a7fd48afb506c0ee49a460b949bc863a1
Summary: This gives a better error message when people use nullable refs for the flow type.
Reviewed By: mdvacca
Differential Revision: D16627409
fbshipit-source-id: 9ab1533b41a5a21e7557c0836feefff680e8018c
Summary: Cpp and Objcpp should not be in the same rules since codegen has different purposes. I split them into into two rules and update tests for new names.
Reviewed By: TheSavior
Differential Revision: D16599257
fbshipit-source-id: 3a8be8c0e289825f9d5db831cc2eec3d2bf9728d
Summary: In this diff I add handling optional values in constants object. Behaviour is slightly different when it comes to string, objects etc., so I add tests for every of these cases.
Reviewed By: RSNara
Differential Revision: D16599254
fbshipit-source-id: 380c5235fefeb70a521733369011e0051e18859a
Summary:
Original commit changeset: 34a8f8395ca7
The problem with the original commit was the usage of optional chaining. This diff removes the usage of optional chaining with good old fashioned null checks.
Reviewed By: rickhanlonii
Differential Revision: D16593623
fbshipit-source-id: d24cc40c85de9a2e712e5de19e9deb196003ccf2
Summary:
This diff contains bunch of minor and straightforward fixes which need to be shipped together. They are all related to integrating objCpp codegen and compiling examples.
#Facebook
I explain in comments my thoughts
Reviewed By: RSNara
Differential Revision: D16520560
fbshipit-source-id: 15392017a92f5a7ec5da71b552ec6c6904625a86
Summary: This test didn't get updated to run over all the fixtures like the others
Reviewed By: JoshuaGross
Differential Revision: D16501494
fbshipit-source-id: 4a68d60819701a9de7f1da22a66ccf807cc4490f
Summary:
We want to enable codegenNativeCommands to have a runtime fallback that will work if the babel transform is not enabled. For example, in open source until we turn it on everywhere. By listing the supported commands, we can create the necessary functions at runtime to support what we need.
A follow up diff will add that runtime behavior to codegenNativeCommands.
Reviewed By: JoshuaGross
Differential Revision: D16573450
fbshipit-source-id: 189754a567a3a5ccd34629a8dfedf808e6824e82
Summary: This name was incorrect and didn't exist
Reviewed By: JoshuaGross
Differential Revision: D16528973
fbshipit-source-id: 92b874a2b023ff89ddc4312477ab8c91c0ef2cf6
Summary: Add a test to ensure that the generated code is syntactically valid and compiles.
Reviewed By: JoshuaGross, osdnk
Differential Revision: D16518542
fbshipit-source-id: d4fadaeb29194ca38c8a99874ab304a464632894
Summary: Support command arguments that are strings
Reviewed By: JoshuaGross
Differential Revision: D16509728
fbshipit-source-id: 003aba66231d204071d043c01cb0781150d0edb9
Summary: I want a fixture with all the types, so refactoring this so future diffs in the stack are cleaner
Reviewed By: JoshuaGross
Differential Revision: D16509803
fbshipit-source-id: 1f4873701a8ff842f50976377003e1abff187278
Summary:
These functions will be called by components like this:
```
- (void)handleCommand:(NSString const *)commandName args:(NSArray const *)args
{
ViewNativeComponentHandleCommand(self, commandName, args);
}
```
Codegen currently supports commands with ints and bools as arguments. Will add more types in follow up diffs.
Reviewed By: JoshuaGross
Differential Revision: D16509123
fbshipit-source-id: c3071ce3b5da215bb8747216e57026a69a89eff0
Summary: We will be generating protocols for every component even if there are no commands. This is for consistency and our ability to add to them later without changing every native component that doesn't currently have a command. JoshuaGross and I figure this is okay as it appears that empty protocols are very cheap on app size
Reviewed By: zackargyle, JoshuaGross
Differential Revision: D16503773
fbshipit-source-id: 11b78fcd33b68926def909d3ce42f58b9bbee96a
Summary:
Changelog:
[General] [Changed] - Include only Java classes in zip archive of generated files for JS codegen
This diff adds one more Buck rule to copy only Java files to a temporary dir, so that the zip_rule will only package the Java classes and skip C++ files. It makes the generated code more organized and decreases the time to create the ZIP-archive.
Reviewed By: rickhanlonii
Differential Revision: D16540781
fbshipit-source-id: cbc99b5fe28b6af5375a88652cefb30e672ed527
Summary: In this this diff I follow with codegening constants structs.
Reviewed By: RSNara
Differential Revision: D16496128
fbshipit-source-id: e4140d97b378985502911b8dcd1723f153dabf00
Summary:
The `__mocks__` directories should be treated the same as `__tests__`
for the purpose of linting. See https://jestjs.io/docs/en/manual-mocks
## Changelog
[Internal] [Changed] - eslint: allow jest globals in `__mocks__` directories
Pull Request resolved: https://github.com/facebook/react-native/pull/25738
Test Plan:
I installed the updated package locally in my project and verified
that the `no-undef` rule no longer fires for references to `jest` in
`__mocks__` directories.
Differential Revision: D16515546
Pulled By: osdnk
fbshipit-source-id: ae78b95d33d1b48ffa4aafa7a53c83e152d176b2
Summary: Adding support for receiving commands and calling methods defined on the interface in c7ee38149d
Reviewed By: JoshuaGross
Differential Revision: D16434402
fbshipit-source-id: a539050a1a2b2a67f9ba7145ed789de700461589
Summary:
Changes the java props class and file names to include "ViewManager" as in:
- ExampleViewManagerInterface
- ExampleViewManagerDelegate
Reviewed By: JoshuaGross, makovkastar
Differential Revision: D16418965
fbshipit-source-id: f8b2f8fe4145c0ada9dc7c5234fcc41935783374
Summary: Don't generate the switch statement if there are no props
Reviewed By: JoshuaGross
Differential Revision: D16417803
fbshipit-source-id: 87eda785c836f5e406e27d3c2990ec7f69422bdb
Summary: In this diff I add generetion of bindings for objcpp TM.
Reviewed By: RSNara
Differential Revision: D16438572
fbshipit-source-id: e92163b1b42306eec931e465b89b176f0fd8a658
Summary: In this diff I add generator for Objcpp headers
Reviewed By: RSNara
Differential Revision: D16438346
fbshipit-source-id: 63a632d4bf40811a8838f3dcd2a92b2f7cf3ce3a
Summary: Because of namespace conflicts I add `Cxx` suffix for generated names of modules.
Reviewed By: RSNara
Differential Revision: D16437997
fbshipit-source-id: ef9dbf1a5df9658365546be13f902d2fce5b57d7
Summary: These methods will be called when commands are dispatched.
Reviewed By: JoshuaGross
Differential Revision: D16388806
fbshipit-source-id: a09d257474aa3306b99f8dcdfdd23808f60eb4bd
Summary: This diff adds some basic tests that ensure all of the e2e test components can compile with the interface is implemented (we also have these tests for cxx)
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D16378756
fbshipit-source-id: d0c6dc976c74f6a388068e66b9a2135bc4ce4652
Summary: Adds GeneratePropsJavaInterface to the codegen to init open sourcing the Java codegen
Reviewed By: mdvacca, makovkastar
Differential Revision: D16280966
fbshipit-source-id: e3428285562329a22c1710cc7347c31f7c01d9c0
Summary:
Previously we accepted only very limited set of types for schema parser. However, in many cases we want to provide more specific typings e.g. accept enum or touple.
Currently, we don't take any advantages for codegen from specifying type of elements for object or array. All of them fallback to the same cpp code.
That's why I decided not to throw exception if types of arrays' and objects' elements are different than currently supported. Then I want to fallback to `undefined`.
Reviewed By: rickhanlonii
Differential Revision: D16325028
fbshipit-source-id: 3d7990ca0207c31f0ed522e7316a9cb17b6b1bcb
Summary: Currently codegen for components supposts stringish. I add it also for components. It fallbacks to StringTypeAnnotation (like in codegen for components).
Reviewed By: rickhanlonii
Differential Revision: D16284381
fbshipit-source-id: 8f03cb79d7e2e1dabbdf4f9353d18dd1daf739fd
Summary: By my mistake previosly it was not poossible to return object defined somewhere in file or return promise containing that object. I changed it to consider value which might be takes from `types` object.
Reviewed By: rickhanlonii
Differential Revision: D16283800
fbshipit-source-id: e9b0ad85b921022732ea0a11db9b58115e87aaa5
Summary: NativeUIManager and NativeAnimatedModule are using nullable args. I believe we may teporarly don't care about that
Reviewed By: RSNara
Differential Revision: D16282683
fbshipit-source-id: 8071a9446c0e1e437391db17c16f82e131094c81
Summary: In this diff I handle the case where the key of an object may be nullable. To do that, I added a nullable param to the schema.
Reviewed By: rickhanlonii
Differential Revision: D16282081
fbshipit-source-id: cb7668d754e2ff30aef22df582351a512c988016
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25680
This diff's adding real e2e tests for skeleton added in previous diff.
It verifies many cases for codegen, which should generate cpp code.
Reviewed By: rickhanlonii
Differential Revision: D16279810
fbshipit-source-id: 4441dd0ed4d95476e4071fbd654ebfb8a47ecbfc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25673
This diff add e2e code generator validation. I added proper buck rule which compiles cpp code and test if it really compiles.
While testing I faced few minor issues:
- `getBool` and `getNumber` shouldn't have `rt` param.
- Generators now start considering whole module name instead of sliced part of their name.
- Fixed import structure in generated cpp.
- renamed `jsireact` to `ReactCommon` following D16231697
Reviewed By: rickhanlonii
Differential Revision: D16221277
fbshipit-source-id: aff4011ad52dd5e16546ffdb709d6a751ebfaced
Summary:
This diff allows for parsing more flexible AST format.
Reusing logic used for methods, I add similar support for props and commands in components. Now it's possible to define separated type for props and commands in another part of the file.
Also, extracted this method to another file for reusing purposes.
Added tests.
Reviewed By: rickhanlonii
Differential Revision: D16221445
fbshipit-source-id: 21553bf5ade66588dd7dc0320d25333260b0ada9
Summary:
Following out internal communication we decided to change logic of current parser to consider types which extend 'TurboModule' instead of looking at default exports.
It also cassed for minor changes in testing logic and updating snapshots.
Reviewed By: rickhanlonii
Differential Revision: D16205707
fbshipit-source-id: c75cd4febf773ba5101e6b60ed1a921773246009
Summary: Code generators for modules and components don't have a lot of in common so there's no point to keepo them in the same directory and mix their files.
Reviewed By: rickhanlonii
Differential Revision: D16183434
fbshipit-source-id: b6ee32c6b223e8d6e4bc843b2e111598bee94dc5
Summary:
Add generating cpp files following NativeModuleSpec.
We still need to figure out how to deal with module names, so I currently made in workable by extracting `Sample` from `SampleNativeModule` and filing into proper places, but it's a temporary solution.
Reviewed By: rickhanlonii
Differential Revision: D16181292
fbshipit-source-id: 0f50352d7610f99f0228045ae78309383d3e8bfa
Summary:
Add basic Native Module header generator
We still need to figure out how to deal with module names, so I currently made in workable by extracting `Sample` from `SampleNativeModule` and filing into proper places, but it's a temporary solution.
Reviewed By: rickhanlonii
Differential Revision: D16180561
fbshipit-source-id: bb27592d565ae439707d781fb2650f2bdb140146
Summary: I this diff I include basic codegen skeleton. It does not work yet, but I'd like to consider it as kind of playgroud for further changes. I have splited tests for component generation from test for module generation.
Reviewed By: rickhanlonii
Differential Revision: D16161909
fbshipit-source-id: a0ecb81898810fe6aa09f76238c433894c731b73
Summary:
Following out internal communication we decided to change logic of current parser to consider types which extend 'TurboModule' instead of looking at default exports.
It also cassed for minor changes i n testing logic and updating snapshots.
Reviewed By: rickhanlonii
Differential Revision: D16200939
fbshipit-source-id: a21cbfc461647df2b9210c0eca4c2c95c285dfe1
Summary: Int32 and Float can be represented on native site in a different after cpp code generation. Inspired by component codegen.
Reviewed By: rickhanlonii
Differential Revision: D16201358
fbshipit-source-id: a5c6c449d69f162ad9cd2a998d57e9c65bc17706
Summary:
This diff includes minor codestyle changes.
All these fixes was discussed with Rick.
Reviewed By: rickhanlonii
Differential Revision: D16169332
fbshipit-source-id: e561e2f2b116b6fdf8434c3dfc20c3e610d7ecad
Summary: It's pointless to handle non optional key if value has withDefaul so I'm adding a rule into parser preventing from such cases
Reviewed By: lunaleaps
Differential Revision: D16166709
fbshipit-source-id: 38cef522b217917a3a4886d857720932f2ebb475
Summary: This part of writing codegen was straightforward. I've added check for 'FunctionTypeAnnotation' and then reuse exisiting methods' parser for generating schema for callback.
Reviewed By: TheSavior
Differential Revision: D16131213
fbshipit-source-id: 2ec0e241f2174dee3a93857563db0626013d004e
Summary:
I'm not very confident with this part, but actually in existing codegen we wrap param into another object marked as `NullableTypeAnnotion`. It makes logic a little more complicated. Also it allows for multiple `?` before type which is useless in code generation as well as nullable types inside arrays which also does not have impact on a final code generation.
I suggest adding `nullable` field into param which covers all existing cases (and probably all cases needed).
Reviewed By: TheSavior
Differential Revision: D16121609
fbshipit-source-id: 6e086d4d26bbd0aab3015ec7ecae106ebbaa5a2c
Summary: Add support for Object reusing mostly the code for arrays
Reviewed By: TheSavior
Differential Revision: D16122314
fbshipit-source-id: c1b201c659e6fdc98bed553fb16280ed5ce9e647
Summary: This implementation is a bit different than current one since previously object annotation was always wrapped into `GenericTypeAnnotation` object which is not needed in every of current use cases.
Reviewed By: TheSavior
Differential Revision: D16121727
fbshipit-source-id: e0de1852e13c66f459efd7a3bcde449e412d8b95
Summary: Now `Array<T>` is supported as a returning values or a param of function's definition. Also, Array of Array is allowed.
Reviewed By: TheSavior
Differential Revision: D16121246
fbshipit-source-id: 59c484120c4025a152e3ba8044eecf11dbbea1f7
Summary: While working on D16090949 I discovered that the code being generated for an array of enums was not correctly converted to mask. The type that holds the mask can't be enum class but other container type, I used `uint32_t`.
Reviewed By: shergin
Differential Revision: D16109338
fbshipit-source-id: 237077adaafe631eda973bc76cefa49035bbcd66
Summary: This diff a adds generic mechansm for extracting types from types' difinitions defined in other part of the file.
Reviewed By: TheSavior
Differential Revision: D16131742
fbshipit-source-id: 006b6980fa9f6a064d5bb8734ba2740b802b6989
Summary:
In this I add support for primitive types as return
- String
- Number
- Boolean
- Any
- Void
Reviewed By: TheSavior
Differential Revision: D16108273
fbshipit-source-id: 2dbd1d5a852a8cf5baf378a73d860492fe2f87cb
Summary: It's a skeleton for preparing schema json from native modules. Right not it does nothing, but it should considered as a kind of workplace for further work
Reviewed By: TheSavior, cpojer, RSNara
Differential Revision: D16107216
fbshipit-source-id: 12717d015e7409d980ef16cccd81330fa978b0b1
Summary:
`WithDefault` appears not to be required to be prefixed with `?` because it's option value per se.
Fixed tests, removed `?` where needed, updated snapshots and review them. Added mechanism fro throwing error when `?WithDefault` found. Add tests for it.
Reviewed By: rubennorte
Differential Revision: D16048463
fbshipit-source-id: f55ed7454aacf0b8c42944a9b5c1037ad1b360fe
Summary:
It's not needed to keep required providing default values even if they are not actually relevant.
Here I add a support for `null`, `0` of `false` instead by default and remove throwing errors if no other default value provided.
Reviewed By: rubennorte
Differential Revision: D16049047
fbshipit-source-id: bc4961af3873190568f2753fc4ec975354896df5
Summary:
It appears that `(e: BubblingEvent<T>) = mixed` exists only in given context and it's pointless to keep in this way. It could be simplified to `BubblingEventHandler<T>` without any negative consequences and that's the motivation of this diff.
The only tradeoff of this decision is leaving an opportunity to declare Bubbling/Direct event in the top of the file bc then analysing the code becomes much more difficult. However, it's not used anywhere so it's not a problem now and probably any time.
Also, changes the names to `DirectEventHandler` and `BubblingEventHandler` which are more related to current state. The names were updated in many places in code.
Reviewed By: rubennorte
Differential Revision: D16054571
fbshipit-source-id: 741d075eb46b80bac8eb73a6b30fc0b448cb3902
Summary:
This diff adds a way for the codegen to handle view configs with non-standard top event names by adding a `paperTopLevelNameDeprecated` field to events in the schema.
## The problem
The problem this is solving is that Android host components build their own options for event settings in the view config. So instead of enforcing `onChange` to use the top level event name `topChange` like iOS does, Android can use `change` or `forbarChange` or anything the person adding the component wanted at the time:
```
// Expected
topChange: {
registrationName: 'onChange',
},
// Android
bringBackStargateYouCowards: {
registrationName: 'onChange',
},
```
This is possible because of the way Android builds these settings
```
// On iOS, notice that there's no option to change the top level name:
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTDirectEventBlock);
// On Android, you provide the top level event name
Override
public Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
"bringBackStargateYouCowards",
MapBuilder.of("registrationName", "onChange"));
}
```
Since the codegen does not allow us to specify the top level event name (similar to iOS), we don't have a way to customize the names to support android
## The solution
To fix this, we're adding an extra option the event flow types:
```
onBubblingChange: (event: BubblingEvent<Event, 'customBubblingName'>) => void,
onDirectChange: (event: DirectEvent<Event, 'customDirectName'>) => void,
```
These will register **both** top level names in the view config:
```
{
directEventTypes: {
// Notice the same registration name is configured for different top level events
topChange: {
registrationName: 'onChange',
},
bringBackStargateYouCowards: {
registrationName: 'onChange',
},
}
}
```
This means when either `topChange` or `bringBackStargateYouCowards` fires it will call the onChange listener. **This gives us the flexibility to rename the native event name without breaking backwards compatibility.** Old apps will work when `bringBackStargateYouCowards` is fired, and new apps with an update will work when `topChange` fires.
Note: only the correct name will be generated for Fabric so technically we don't even really need to migrate the paper names and this prop can be deleted when paper is gone.
Reviewed By: cpojer
Differential Revision: D16042065
fbshipit-source-id: 40d076b43ffbbfc6c65c3c19de481d922a2add62
Summary:
This diff switches the native codegen over to the flow parser
It does this by:
- Creating a new e2e directory
- Migrating the schema.js fixtures to flow types in e2e/
- Updating the buck tests to use the flow type fixtures
- Finally, updating the rest of rn_codegen to use *NativeComponent instead of *Schema.js
Removing all of the schemas in the next diff to keep this one clean
Reviewed By: cpojer
Differential Revision: D15960603
fbshipit-source-id: 3df28b31e618491301578ab7f6e28a80f55404b2
Summary: The schema for these view commands is lifted wholesale from the schema for TurboModules: P67239314
Reviewed By: rickhanlonii
Differential Revision: D15943109
fbshipit-source-id: a0ccd4e47067b62970218df6a32527c15868c4a5
Summary: Fixes an issue with the native output of components without props and events (a trailing comma)
Reviewed By: cpojer
Differential Revision: D15960962
fbshipit-source-id: 315276ef01484546da43954e6fd879350e214006
Summary:
This diff removes an option from the codegen and replaces it with two new options
Removes:
- `isDeprecatedPaperComponentNameRCT`
Adds:
- `paperComponentName`: a better version of the removed option that allows more than just adding RCT
- `paperComponentNameDeprecated`: a new option that allows migrating native code to a new name
```
// Use for components with no current paper rename in progress
// Does not check for new name
paperComponentName?: string,
// Use for components currently being renamed in paper
// Will use new name if it is available and fallback to this name
paperComponentNameDeprecated?: string,
```
For example, Slider uses `paperComponentName: 'RCTSlider'` because it has a different name in fabric but is not currently being migrated to a new name. Because of other work in progress, we don't want to use UIManager check if we don't need to
Reviewed By: shergin
Differential Revision: D15857629
fbshipit-source-id: ca0d3b7dc4a75e00d136ae1f5c84f7423960399d
Summary:
## Context
At the moment, the codegen process does not expect any types defined in a native component (*NativeComponent.js) to be exported. For example, the `NativeProps` type may be defined as:
```
// RCTSegmentedControlNativeComponent.js
type NativeProps = $ReadOnly<{|
...
onChange?: ?(event: BubblingEvent<Event>) => mixed,
|}>;
```
However, it would be helpful to be able to reuse `NativeProps` in the user facing component:
```
// SegmentedControlIOS.js
type Props = $ReadOnly<{|
...NativeProps
onValueChange?: ?(value: number) => mixed,
|}>;
```
## Changes
- updates the `getTypes` function to unwrap the type declaration inside exported declarations
- add test to verify that exported types are parsed as expected
Reviewed By: rickhanlonii
Differential Revision: D15851693
fbshipit-source-id: a9cd375c69cbb8fe9a38be3d2a681227444fb33d
Summary: `Stringish` is commonly used in components to accept either strings or values coming from Fbt tags. The codegen should support them as they can be used transparently as strings.
Reviewed By: rickhanlonii
Differential Revision: D15821882
fbshipit-source-id: fb94f702d82820677c5a737325b7b46ff4c88151
Summary:
This diff reimplements the prop parsing infrastructure in a part where it interacts with RawProps value.
Local synthetic tests show that the new way is 3x faster but the actual production result is quite unpredictable. MobileLab tests show some improvements about 10-20 ms on iPhone 6.
In short, the new way is faster because it inverts the lookup order and heavily relies on actual data types (and their properties) that we use. The old approach required about 130 hash-map lookups (where the key is `std::string`) to parse a single *Props object.
The new approach prepares concrete-props-specific tables with indexes of coming values ahead of time, iterates over raw data and puts it into those tables, and then performs a lookup in a very efficient manner.
Reviewed By: JoshuaGross
Differential Revision: D15752968
fbshipit-source-id: 847106e652eb7fc7ef7b99884a6f819ea3b9fd06
Summary:
This diff adds codegen support for flow types such as:
```
type ModuleProps = $ReadOnly<{|
size: $ReadOnlyArray<('small', 'large')>
|}>
```
These array enums are codegen'd as bitmaps in c++
Reviewed By: sammy-SC
Differential Revision: D15766763
fbshipit-source-id: 8c55303fb3a0ab151eae2b441119ab078e2c5d3d
Summary:
This diff adds support for:
```
propName: WithDefault<string, null>,
```
It will throw if null is used for any other type like boolean
Reviewed By: TheSavior, cpojer
Differential Revision: D15748556
fbshipit-source-id: 925457ca1739bfad08e4776ecb47c0beb3acacf5
Summary:
This diff adds a testing screen dev route to the facebook app for testing generated view configs
It's not pretty (i have 0 tetra experiance) but it gets the job done
There are three cases handled:
- No generated config �
- Invalid generated config (useful for dev) �
- Valid generated config �
On the description page we:
- Redbox it it's invalid (this could be used to redbox test all host components)
- Show diffs of the view config properties
- List all of the generated config properties
- List all of the native config properties
Using this tool, it's easy to see what the current config on native is, add correct flow types for the generated config, and validate the generated config
Coming later: adding all of the native configs to the list (will probably need filtering)
Reviewed By: cpojer
Differential Revision: D15683033
fbshipit-source-id: 5a566a56bef4f3f0bac3ea581c2e6acb2b9984e3
Summary:
Now that we have the babel plugin, we can remove the checked in view configs
Note that this requires switching the old NativeComponent.js files back to `requireNativeComponent` for open source support (until the babel plugin and codegen are published to a package)
The babel plugin replaces this export with the inline view config
Reviewed By: cpojer
Differential Revision: D15524779
fbshipit-source-id: ab819ce6f24cb2f15a1897ed6d510a0db6aff3a1
Summary:
This diff updated the codegen flow types syntax replacing:
```
type Options = {
isDeprecatedPaperComponentNameRCT: true,
};
type ActivityIndicatorNativeType = CodegenNativeComponent<
'ActivityIndicatorView',
NativeProps,
Options,
>;
module.exports = ((requireNativeComponent(
'RCTActivityIndicatorView',
): any): ActivityIndicatorNativeType);
```
with:
```
export default codegenNativeComponent<NativeProps>('ActivityIndicatorView', {
isDeprecatedPaperComponentNameRCT: true,
});
```
This is from Tim's comment in the [View Config Codegen Quip](https://fb.quip.com/jR2aASHad4Se):
> What it CodegenNativeComponent were instead `NativeComponent.fromFlow<T>('…')` that returned `'...'`?
>And the Babel plugin swapped it for NativeComponent.fromSchema('...', {…}) which would both register and return '...'?
I went with `codegenNativeComponent` because it has nice parity with `requireNativeComponent`
I also didn't update the babel output here (we can update that whenever) because I think `registerGeneratedViewConfig` is more clear for what it's doing
Reviewed By: cpojer
Differential Revision: D15602077
fbshipit-source-id: 2d24dc32136ba6d31724f8c929b51417ba625a58
Summary:
This diff adds a babel plugin for the generated view configs which will inline them in the file instead of needing to check the view configs in (fb only)
The way it works is:
- babel reads the code
- looks for type alias `CodegenNativeComponent` in `*NativeComponet.js` files
- run the flow parser on the file source to create a schema
- run the schema into codegen to get the view config source code
- inject the generated source code back into the NativeComponent.js file
- remove the original export
- profit
After this diff we will remove the `js1 build viewconfigs` command and the checked-in NativeViewConfig.js files
Note: since this plugin is not published to open source, for now OSS will continue using the `requireNativeComponent` function
Reviewed By: cpojer
Differential Revision: D15516062
fbshipit-source-id: a8efb077773e04fd9753a7036682eeaae9175e09
Summary:
This diff updated the format of generated view configs so that they don't need to spread View props into every config, by adding a new registerGeneratedConfig function which will spread them instead
This is a bit of a cleanup of the generated output but is primarily so that the view config babel plugin will not need to rely on object spreading or object.assigns
Reviewed By: TheSavior, cpojer
Differential Revision: D15517199
fbshipit-source-id: 08e575578177bad12d40ee3dcad9381974b6466d
Summary:
First of all, seems it's the right thing to do. Fabric C++ code is cross-platfrom and should run on *all* platforms including Windows, Linux, and Mac.
While we don't have a real *production* use cases where we need compilation for desktops, having CXX target is really handy for two reasons:
* It simplifies local test running process. Instead of going to `/fbandroid/` and executing something like `buck test fbsource//xplat/js/react-native-github/ReactCommon/fabric/core:coreAndroid` (note the suffix). We can just do `buck test fbsource//xplat/js/react-native-github/ReactCommon/fabric/core:core` everywhere and it works now out of the box. Running tests with "Apple" flavor never worked for me.
* It allows creating synthetic benchmark tests (using Google Benchmark) that can be used as a rough approximation of code micro-optimizations.
Reviewed By: JoshuaGross
Differential Revision: D15608678
fbshipit-source-id: d2449035685dbca6ab983480f5334ec4ac11cd35
Summary: This diff adds support for ColorArrayValue in the flow parser
Reviewed By: cpojer
Differential Revision: D15502923
fbshipit-source-id: 6a906b6d609168378fabeb49d0080de011a34d78
Summary:
This is an ESLint plugin that infers whether an import looks like a Haste module name. To keep the linter fast and simple, it does not look in the Haste map. Instead, it looks for uppercase characters in single-name import paths, since npm has disallowed uppercase letters in package names for a long time. There are some false negatives (e.g. "merge" is a Haste module and this linter rule would not pick it up) but those are about 1.1% of the module names in the RN repo, and unit tests and integration tests will fail anyway once Haste is turned off.
You can disable the lint rule on varying granular levels with ESLint's normal disabling/enabling mechanisms.
Also rewrote more Haste imports so that the linter passes (i.e. fixed lint errors as part of this PR).
## Changelog
[General] [Changed] - Add a lint rule to disallow Haste imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25058
Differential Revision: D15515826
Pulled By: cpojer
fbshipit-source-id: d58a3c30dfe0887f8a530e3393af4af5a1ec1cac
Summary: Reverting the generated view configs due to a potential issue
Reviewed By: mdvacca
Differential Revision: D15539319
fbshipit-source-id: bddf923dcfda18bd074196f06610fea8bb4561b4
Summary:
Adds the generated view config for PullToRefresh
Note: we're not using this view config yet, the component is in the process of being renamed (see TODO)
Reviewed By: rubennorte
Differential Revision: D15485870
fbshipit-source-id: a163ac371181dcc990093e3cd995d7dd9058b26a
Summary:
This diff integrates the new flow parser into `js1 build viewconfig` so that we're generating the view config from actual source
Note: see next diff for usage
Reviewed By: mdvacca
Differential Revision: D15452255
fbshipit-source-id: db04cb1c7adffaf3167a49c2260cae8fd365f50b
Summary:
This diff initializes the codegen flow parser using a proposal for some new syntaxes in flow file to handle missing information like:
- Float vs Int32
- Bubbling Events vs Direct Events
- Default props
- Codegen options
- Specifying the component name
For a deep dive on the proposal see: https://fb.quip.com/kPYJAjCHxlgO
Note: there are still some todos to follow up with:
- Array props
- Enum props
- Object event arguments
Note also: the parser code is a little rough, I didn't want spend too much time cleaning it up before we agreed on the format
[General][Added] Add codegen flow parser
Reviewed By: cpojer
Differential Revision: D15417733
fbshipit-source-id: dd80887c0b2ac46fdc3da203214775facd204e28
Summary:
This diff reorganizes some of the code in react-native-codegen as requested in T44120025
There are two new dirs: `scr/cli` and `src/parsers`
```
buck_tests/
src/
cli/
generators/
parsers/
```
We moved anything cli-ish from `buck_tests` to the `src/cli` directory:
```
src/
cli/
combine/
combine_js_to_schema.sh
combine_js_to_schema-cli.js
combine_js_to_schema.js
viewconfigs/
generate-view-configs-cli.js
generate-view-configs.js
generate-view-configs.sh
```
And we created a new `src/parsers` directory that will contain the flow parser and the current schema parser:
```
src/
parsers/
flow/
index.js
schema/
index.js
```
This should organize the code a little better and make it easier to contribute 👍
Reviewed By: cpojer
Differential Revision: D15414264
fbshipit-source-id: 376af2e91def033855f6ed72a9a9cc4369c33c7d
Summary:
This diff allows generating native events without any arguments with an event like:
```
{
name: 'onEnd',
optional: true,
bubblingType: 'bubble',
typeAnnotation: {
type: 'EventTypeAnnotation',
// note: no argument key
},
},
```
See the snapshot updates in the diff for the native code that will be generated �
Reviewed By: shergin
Differential Revision: D15403791
fbshipit-source-id: 925a49bb477eebb234e181df681f0d6b1d4e8cf1
Summary:
This diff adds a new `--test` option to `js1 build viewconfigs` which will only check that the configs have not changed instead of writing the new/updated files. This will allow us to run sandcastle checks on the view configs
I also improved the output of the script to give better feedback during normal runs including an additional message and a summary of generated files
Reviewed By: TheSavior
Differential Revision: D15372843
fbshipit-source-id: 4988fc2405cc03137b540817e08d4365cb31fc34
Summary: Fixes a flow failure in the generated output and adds trailing commas to pass linting
Reviewed By: yungsters
Differential Revision: D15354725
fbshipit-source-id: 1eac27fa753af595a9a2787426b147e5f49a4e1d
Summary: After reading the native code, all bubbling and direct events need to start with "top", but we were only doing this for bubbling in the view config. Updated and added comments pointing to native behaviors
Reviewed By: TheSavior
Differential Revision: D15336080
fbshipit-source-id: d8f883f5fd41bb7856a334849dc7fce0c8922872
Summary: We're going to be incrementally adding these view configs and enforcing that they're up to date in react-native-sanity-test so we need to limit them to what's supported (which is just Slider for now)
Reviewed By: TheSavior
Differential Revision: D15321950
fbshipit-source-id: 22b014db1d9b58553237f571b438c82948f19634
Summary:
In order to generate the view configs, we need to know the name of the component used in:
```
ReactNativeViewConfigRegistry.register(
'RCTNativeComponent', // <------- this name
() => BooleanPropNativeComponentViewConfig,
);
```
For this, we'll use `component.name` in the schema (see fixture updates). Doing this would break the native code we generate though, since that code has the RCT stripped.
So this diff adds support to mirror the native stripping of 'RCT' for generated native code
Reviewed By: TheSavior
Differential Revision: D15320422
fbshipit-source-id: be1ab9964078df2c7bc6e41462776f00b94b104f
Summary: This diff adds a line to the codegen'd view configs which will check that all of the properties in the native view config are also in the JS view config we generate (note that the JS view config may have more properties than one native platform because it includes a union of both platforms)
Reviewed By: TheSavior
Differential Revision: D15278478
fbshipit-source-id: 0fef20c12265b952c69aca4e4c070a7d036db05a
Summary: This diff inserts the differs for color/image/point inline into the generated viewconfigs
Reviewed By: TheSavior
Differential Revision: D15258752
fbshipit-source-id: 0e93dc6abc186851b411dfd6864d5b4ca005885b
Summary:
This diff adds a new `js1` script `js1 build viewconfigs` which will generate the view configs for generated components in xplat/js
Note that the view configs are not currently valid so I'm not checking them in or adding them to a test, that work will follow
Reviewed By: TheSavior
Differential Revision: D15239656
fbshipit-source-id: d15776f36a7d7684f50beafd783bccb02352afc0
Summary: This diff adds support for kebab-case enum properties by transforming them to KebabCase in cpp
Reviewed By: mdvacca
Differential Revision: D15218781
fbshipit-source-id: 0ec6d28f3ca0e5b8187fc7026e12a8d76be73a7c
Summary:
This diff adds generated c++ tests for all generated components
There is a test for every prop based on type, and in the case of enums every allowed value
Reviewed By: shergin
Differential Revision: D15147126
fbshipit-source-id: b4f88d2dab825e41754a880081d86b3cd12274ee
Summary:
Bump the `react-native-community/eslint-config` version so we can release it.
[General] [Changed] - Bumped react-native-community/eslint-config version
Pull Request resolved: https://github.com/facebook/react-native/pull/24650
Differential Revision: D15146456
Pulled By: cpojer
fbshipit-source-id: 9a6767f502f1b5dcd49cf55b4e35c0d851f33222
Summary:
This fixes an issue where the Prettier config was set to the `fb` (Facebook) values for all users of the `react-native-community/eslint-config` package. This was due to [this line](8f186b84ae/packages/eslint-config-react-native-community/index.js (L219)) in the config file.
It was causing issues like these:
* Errors when using newer versions of `eslint-plugin-prettier` (you had to use a version that was >1 year old): https://github.com/facebook/react-native/issues/24564
* Errors due to the Prettier parser being forced to be `flow` when using Typescript: https://github.com/typescript-eslint/typescript-eslint/issues/481
This PR:
* Changes that line to remove the explicit `fb` config so users can set their own.
* Moves the React Native Prettier config to `.prettierrc` so ESLint, Prettier, and code editors can all read from the same place.
* Upgrades both `prettier` and the `eslint-plugin-prettier` to the latest versions.
[General] [Fixed] - Stopped the Prettier config being set for all users of react-native-community/eslint-config
Pull Request resolved: https://github.com/facebook/react-native/pull/24635
Differential Revision: D15122200
Pulled By: cpojer
fbshipit-source-id: 56bae8a7f2d8e133b1d808091a6b73302b94d2ed
Summary:
To ensure greater type safety, we want to generate some cpp tests for the fromRawValue conversions
This diff adds support to generate Tests.cpp along with the `buck test` targets itegrated into the rn_codegen rule automatically. The tests just `assert(true, true)` as a starting point
Reviewed By: fkgozali
Differential Revision: D14739493
fbshipit-source-id: fc9dea64ea31e6af7d997aebc54cfd459d48bf4f
Summary: Looks like there are already a bunch of issues in the codebase because this wasn't on.
Reviewed By: cpojer
Differential Revision: D14701084
fbshipit-source-id: 09ff8e0d905b81fbe08c41d4f58758479b38187b
Summary:
This adds TypeScript support to the community ESLint config. Our babel preset supports TypeScript by default, so it's nice to have TypeScript support pre-configured in the ESLint config too.
Note: Users need to install `typescript` in their project for linting to work for TypeScript files.
[General] [Added] - Add TypeScript support to the ESLint config
Pull Request resolved: https://github.com/facebook/react-native/pull/24100
Differential Revision: D14597127
Pulled By: cpojer
fbshipit-source-id: dfbf1b97061ed6e8c46aa49adb21630f5acdb5d1
Summary:
Existing glob might not work very well with `spec.js` and `test.js` files unless they're placed in `__tests__` directory. This PR aims to bring back the support of `jest` globals in these files, even if they're outside of `__tests__` directory.
[General] [Fixed] - Fixed globs for `spec.js` and `test.js` files.
Pull Request resolved: https://github.com/facebook/react-native/pull/24088
Differential Revision: D14562085
Pulled By: cpojer
fbshipit-source-id: 543d67e3f8a154256f454b34ccc68bb070197a75
Summary:
The goal of this PR is to enable eslint checks in the projects generated by `react-native init` command. I added `template/_eslintrc` file, that would be replaced in an initialized project with `.eslintrc` file. This PR comes in parallel with https://github.com/react-native-community/react-native-cli/pull/229
[General] [Added] - Added `.eslintrc` file to generated template.
Pull Request resolved: https://github.com/facebook/react-native/pull/23901
Differential Revision: D14561084
Pulled By: cpojer
fbshipit-source-id: 6eb717bf03c45d83ae8a393e6a0abb79e1e2f915
Summary:
I was annoyed by warnings from yarn/npm about eslint peer dependencies not being met, so I dived in to try and get rid of some of them. Sometimes it meant bumping a plugin, but then that plugin needed a newer babel-eslint, so it was a dance.
Some we can't easily update to latest (eslint-plugin-prettier) because the rule format has changed a bit. Happy to do that in this PR if folks think its a good idea. eslint-config-fbjs itself needs to be updated and republished to eliminate the last few warnings.
There are a few new warnings (the repo wasn't linting cleanly for me from the start). I can fix those in this PR, or a separate one, based on people's preferences.
[internal] [chore] - Eliminate some peer dependency warnings and bump some eslint packages to latest.
Pull Request resolved: https://github.com/facebook/react-native/pull/23969
Differential Revision: D14519076
Pulled By: cpojer
fbshipit-source-id: aa44cfd05814d7b79069414aa78d089e448c2235
Summary: Adds support for the native type Point to the rn codegen
Reviewed By: TheSavior
Differential Revision: D14462164
fbshipit-source-id: 942b5697d616c6aa6289d01bb56382fd7adac203
Summary:
Landing D14472633 again which failed because of a metro-buck issue.
Latest CLI requires `reactNativePath` to be explicitly set when `react-native` is not present under `node_modules` (which is the case when running from source).
Fixes#23936
This PR also updates CLI to latest version and removes private calls to `findPlugins` (it's now exposed under public interface).
We also remove custom `rn-cli.config.js` options that are no longer needed that we have `--reactNativePath`. I added them a month ago as a temporary workaround.
[GENERAL] [FIXED] - Internal - Update to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23940
Reviewed By: rickhanlonii
Differential Revision: D14501686
Pulled By: cpojer
fbshipit-source-id: c8dac71b3806d81c9d18b6d4a7e92d82962791f9
Summary:
Latest CLI requires `reactNativePath` to be explicitly set when `react-native` is not present under `node_modules` (which is the case when running from source).
Fixes#23936
This PR also updates CLI to latest version and removes private calls to `findPlugins` (it's now exposed under public interface).
We also remove custom `rn-cli.config.js` options that are no longer needed that we have `--reactNativePath`. I added them a month ago as a temporary workaround.
[GENERAL] [FIXED] - Internal - Update to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23940
Differential Revision: D14472633
Pulled By: cpojer
fbshipit-source-id: b7ea92ee130da6730aa0093265958aa1b8c2ab97
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.
Reviewed By: mjesun
Differential Revision: D14454893
fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
Summary: Change the codegen `srcs` to match any `**/*Schema.js`
Reviewed By: TheSavior
Differential Revision: D14401232
fbshipit-source-id: 61e60b1c9ca2f33efacc5caa1903b02a93cc644e
Summary:
I moved `devDependencies` to `dependencies` section of `packages/eslint-config-react-native-community`, to avoid the need for installation of them in the main projects. Now the installation should match the guide, from https://github.com/facebook/react-native/tree/master/packages/eslint-config-react-native-community
[General] [Changed] - Moved `devDependencies` of eslint config to `dependencies` section.
Pull Request resolved: https://github.com/facebook/react-native/pull/23766
Differential Revision: D14436081
Pulled By: cpojer
fbshipit-source-id: 770110eb4b2b6dfbbb7456fd1b69e20a8473a4e2
Summary:
This was an idea to check by Joshua Gross
Changelog:
[General][Internal] Codegen: Adding test for negative zero floats
Reviewed By: JoshuaGross
Differential Revision: D14378418
fbshipit-source-id: 4d18eea18143c501d3f2e7ba334f35ec1dd140e6
Summary: We need this in the Props.h files
Reviewed By: TheSavior
Differential Revision: D14307476
fbshipit-source-id: 34a86ced30e04bfb6d7f85dc292e43d2a1a0ac3e
Summary: In some cases the implementation for native modules are more advanced and we cannot currently generate some of the files. We've decided in these cases to only generate the props + events for now, so this flag `interfaceOnly` will only generate those files 👍
Reviewed By: TheSavior
Differential Revision: D14295980
fbshipit-source-id: 1790825143206a84469015e08958bf6f00ffde52
Summary:
Renamed `eslint-config-react-native` to `eslint-config-react-native-community`, due to the fact, that initial name is already taken on `npm`. Additionally, I added very simple `README.md` file, to prepare the package to be published.
[General] [Changed] - Changed `eslint-config-react-native` name to `eslint-config-react-native-community`
Pull Request resolved: https://github.com/facebook/react-native/pull/23718
Differential Revision: D14298553
Pulled By: cpojer
fbshipit-source-id: bad5a42502ccdebf5f95d8217187be23bbf8f26c
Summary: Re-enables the disabled codegens on android by renaming the test fixtures to something shorter
Reviewed By: TheSavior
Differential Revision: D14258414
fbshipit-source-id: 912c12df039930ec492b5bafc69bc298f913bdcc
Summary: It was weird that the default values for enums did not match the casing for the enum options
Reviewed By: TheSavior
Differential Revision: D14258101
fbshipit-source-id: f601e50390a6c67f20e7a18aa94b377597a831cc
Summary:
Basing on discussion from this issue - https://github.com/react-native-community/discussions-and-proposals/issues/65 we moved ESLint/Prettier config to its own package inside packages directory.
At this moment we had to left all `eslint` dependencies in root `package.json` since `eslint-config-react-native` is not published yet.
[General] [Changed] - Move eslint/prettier config to packages/eslint-config-react-native
Pull Request resolved: https://github.com/facebook/react-native/pull/23688
Differential Revision: D14277068
Pulled By: cpojer
fbshipit-source-id: ef2d0b33210418318cc8324f15fedd84df0ef64d
Summary:
@public
Previously open-sourced as `react-native-symbolicate`, this package is more closely coupled with Metro and should therefore be part of the latter.
Reviewed By: cpojer
Differential Revision: D14208031
fbshipit-source-id: 8bae2100149142394e12d499dc4b8a256f07647e
Summary:
`react-native-symbolicate` usage output claim to work with 4 arguments, though the code supports 3. Furthermore, `Symbolication.parseFileName` is getting a lineNumber argument instead of fileName. Described issues disable usage of sectioned source map symbolication, which was discussed in https://github.com/getsentry/sentry-cli/issues/408.
Duplicate of https://github.com/facebook/react-native/pull/23514 without modified commit history
[General] [Fixed] - enable symbolicate for sectioned/indexed/segmented source maps
Pull Request resolved: https://github.com/facebook/react-native/pull/23572
Differential Revision: D14179787
Pulled By: cpojer
fbshipit-source-id: 15f983c285fc6ac5570d01550fc939b975375bfa
Summary:
People in open source are now contributing to our symbolication code. They cannot figure out how to run buck for their tests so I instead converted them to Jest tests. See https://github.com/facebook/react-native/pull/23514 for an example contribution where people are struggling.
This PR:
* Changes the stdin reading mechanism to also work inside of a forked child process
* I manually verified that the previous BUCK tests were all passing after my modifications to the main script
* I rewrote each test using Jest
* I then switched the passing tests over to use snapshots
As a result, there are now a few fewer files and they all run inside of Jest. The code being tested is identical and keeps working.
Reviewed By: davidaurelio
Differential Revision: D14147615
fbshipit-source-id: 699044a579278f6451bb9d26a05712f00e4b7c04
Summary: Use the new copyright header format used elsewhere in the React Native repository.
Reviewed By: shergin
Differential Revision: D14091706
fbshipit-source-id: b27b8e6bcdf2f3d9402886dbc6b68c305150b7d5
Summary: This will allow publishing the package to npm.
Reviewed By: davidaurelio
Differential Revision: D14083973
fbshipit-source-id: b5f68b87b82a3b6bc644727de403bd449ec17239
Summary: This moves the internal symbolication code out to open source so that people can look up source locations for stack traces in RAM bundles. Wix needs this, and there is no reason to keep this code internal.
Reviewed By: bthood
Differential Revision: D14083307
fbshipit-source-id: afd2435c1b549b04ae7a04340ceeac1c5e4c99f0
Summary:
Turn off translations in fbandroid to mitigate the parse time regression. Translate the remaining `xplat//` to `fbsource//xplat/` to do so
run_all_tests
Reviewed By: scottrice
Differential Revision: D14041085
fbshipit-source-id: 9d3bc493c6662c03c4028aaebfbec58d145e8c6b
Summary:
Updates the combine-js-to-schema to expose a cli and combine all passed files into a single schema output
Note: as far as I could tell, there isn't a way for buck to pass a glob of directories, so instead of accepting a dir and crawling it, this update accepts a list of files and combines them. Which makes sense, since buck is good at crawling already
Reviewed By: TheSavior
Differential Revision: D14007193
fbshipit-source-id: dbc209bb8d1cadd381269e9f70dc71a90f77878e
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.
Reviewed By: rickhanlonii, TheSavior
Differential Revision: D13974180
fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299