Skip to content

Commit c3e20f1

Browse files
authored
Add Relay specific React Native build of Flight (#20149)
This adds a new dimension similar to dom-relay. It's different from "native" which would be Flight for RN without Relay. This has some copy-pasta that's the same between the two Relay builds but the key difference will be Metro and we're not quite sure what other differences there will be yet.
1 parent 454c221 commit c3e20f1

24 files changed

+711
-2
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ jobs:
242242
- RELEASE_CHANNEL
243243
- facebook-www
244244
- facebook-react-native
245+
- facebook-relay
245246
- node_modules
246247
- react-native
247248
- dist
@@ -268,6 +269,7 @@ jobs:
268269
- RELEASE_CHANNEL
269270
- facebook-www
270271
- facebook-react-native
272+
- facebook-relay
271273
- node_modules
272274
- react-native
273275
- dist

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ module.exports = {
188188
},
189189
},
190190
{
191-
files: ['packages/react-native-renderer/**/*.js'],
191+
files: [
192+
'packages/react-native-renderer/**/*.js',
193+
'packages/react-transport-native-relay/**/*.js'
194+
],
192195
globals: {
193196
nativeFabricUIManager: true,
194197
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from 'react-transport-native-relay/src/ReactFlightNativeRelayClientHostConfig';
11+
export * from '../ReactFlightClientHostConfigNoStream';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from 'react-native-renderer/src/ReactFabricHostConfig';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
import {convertStringToBuffer} from 'react-server/src/ReactServerStreamConfig';
11+
12+
export function formatChunkAsString(type: string, props: Object): string {
13+
let str = '<' + type + '>';
14+
if (typeof props.children === 'string') {
15+
str += props.children;
16+
}
17+
str += '</' + type + '>';
18+
return str;
19+
}
20+
21+
export function formatChunk(type: string, props: Object): Uint8Array {
22+
return convertStringToBuffer(formatChunkAsString(type, props));
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from 'react-transport-native-relay/src/ReactFlightNativeRelayServerHostConfig';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from '../ReactNativeServerFormatConfig';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from '../ReactServerStreamConfigNode';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export * from './src/ReactFlightNativeRelayClient';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "react-transport-native-relay",
3+
"version": "0.1.0",
4+
"private": true,
5+
"repository": {
6+
"type" : "git",
7+
"url" : "https://github.com/facebook/react.git",
8+
"directory": "packages/react-transport-native-relay"
9+
},
10+
"dependencies": {
11+
"object-assign": "^4.1.1",
12+
"scheduler": "^0.11.0"
13+
},
14+
"peerDependencies": {
15+
"react": "^17.0.0",
16+
"react-native-renderer": "^17.0.0"
17+
}
18+
}

0 commit comments

Comments
 (0)