Skip to content

Commit d79113d

Browse files
committed
Implements react-server-dom-turbopack
1 parent 701ac2e commit d79113d

File tree

68 files changed

+6733
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+6733
-21
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ module.exports = {
326326
'packages/react-refresh/**/*.js',
327327
'packages/react-server-dom-esm/**/*.js',
328328
'packages/react-server-dom-webpack/**/*.js',
329+
'packages/react-server-dom-turbopack/**/*.js',
329330
'packages/react-test-renderer/**/*.js',
330331
'packages/react-debug-tools/**/*.js',
331332
'packages/react-devtools-extensions/**/*.js',
@@ -427,6 +428,13 @@ module.exports = {
427428
__webpack_require__: 'readonly',
428429
},
429430
},
431+
{
432+
files: ['packages/react-server-dom-turbopack/**/*.js'],
433+
globals: {
434+
__turbopack_load__: 'readonly',
435+
__turbopack_require__: 'readonly',
436+
},
437+
},
430438
{
431439
files: ['packages/scheduler/**/*.js'],
432440
globals: {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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-client/src/ReactFlightClientConfigBrowser';
11+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
12+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackBrowser';
13+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackBrowser';
14+
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
15+
export const usedWithSSR = false;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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-client/src/ReactFlightClientConfigBrowser';
11+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
12+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackServer';
13+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
14+
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
15+
export const usedWithSSR = true;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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-client/src/ReactFlightClientConfigNode';
11+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
12+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackServer';
13+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
14+
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
15+
export const usedWithSSR = true;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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-client/src/ReactFlightClientConfigNode';
11+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerNode';
12+
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
13+
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
14+
export const usedWithSSR = true;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# react-server-dom-turbopack
2+
3+
Experimental React Flight bindings for DOM using Turbopack.
4+
5+
**Use it at your own risk.**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMClientBrowser';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMClientEdge';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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 './client.browser';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMClientNode';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMClientNode';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightTurbopackNodeLoader.js';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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+
throw new Error('Use react-server-dom-turbopack/client instead.');
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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+
module.exports = require('./src/ReactFlightTurbopackNodeRegister');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-client.browser.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-client.browser.development.js');
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-client.edge.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-client.edge.development.js');
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('./client.browser');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-client.node.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-client.node.development.js');
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-client.node.unbundled.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-client.node.unbundled.development.js');
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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+
'use strict';
11+
12+
throw new Error('Use react-server-dom-turbopack/client instead.');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('./cjs/react-server-dom-turbopack-node-register.js');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-server.browser.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-server.browser.development.js');
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-server.edge.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-server.edge.development.js');
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
throw new Error(
4+
'The React Server Writer cannot be used outside a react-server environment. ' +
5+
'You must configure Node.js using the `--conditions react-server` flag.'
6+
);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-server.node.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-server.node.development.js');
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-server-dom-turbopack-server.node.unbundled.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-server-dom-turbopack-server.node.unbundled.development.js');
7+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"name": "react-server-dom-turbopack",
3+
"description": "React Server Components bindings for DOM using Turbopack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4+
"version": "18.2.0",
5+
"keywords": [
6+
"react"
7+
],
8+
"homepage": "https://reactjs.org/",
9+
"bugs": "https://github.com/facebook/react/issues",
10+
"license": "MIT",
11+
"files": [
12+
"LICENSE",
13+
"README.md",
14+
"index.js",
15+
"client.js",
16+
"client.browser.js",
17+
"client.edge.js",
18+
"client.node.js",
19+
"client.node.unbundled.js",
20+
"server.js",
21+
"server.browser.js",
22+
"server.edge.js",
23+
"server.node.js",
24+
"server.node.unbundled.js",
25+
"node-register.js",
26+
"cjs/",
27+
"umd/",
28+
"esm/"
29+
],
30+
"exports": {
31+
".": "./index.js",
32+
"./client": {
33+
"workerd": "./client.edge.js",
34+
"deno": "./client.edge.js",
35+
"worker": "./client.edge.js",
36+
"node": {
37+
"turbopack": "./client.node.js",
38+
"webpack": "./client.node.js",
39+
"default": "./client.node.unbundled.js"
40+
},
41+
"edge-light": "./client.edge.js",
42+
"browser": "./client.browser.js",
43+
"default": "./client.browser.js"
44+
},
45+
"./client.browser": "./client.browser.js",
46+
"./client.edge": "./client.edge.js",
47+
"./client.node": "./client.node.js",
48+
"./client.node.unbundled": "./client.node.unbundled.js",
49+
"./server": {
50+
"react-server": {
51+
"workerd": "./server.edge.js",
52+
"deno": "./server.browser.js",
53+
"node": {
54+
"turbopack": "./server.node.js",
55+
"webpack": "./server.node.js",
56+
"default": "./server.node.unbundled.js"
57+
},
58+
"edge-light": "./server.edge.js",
59+
"browser": "./server.browser.js"
60+
},
61+
"default": "./server.js"
62+
},
63+
"./server.browser": "./server.browser.js",
64+
"./server.edge": "./server.edge.js",
65+
"./server.node": "./server.node.js",
66+
"./server.node.unbundled": "./server.node.unbundled.js",
67+
"./node-loader": "./esm/react-server-dom-turbopack-node-loader.production.min.js",
68+
"./node-register": "./node-register.js",
69+
"./src/*": "./src/*.js",
70+
"./package.json": "./package.json"
71+
},
72+
"main": "index.js",
73+
"repository": {
74+
"type" : "git",
75+
"url" : "https://github.com/facebook/react.git",
76+
"directory": "packages/react-server-dom-turbopack"
77+
},
78+
"engines": {
79+
"node": ">=0.10.0"
80+
},
81+
"peerDependencies": {
82+
"react": "^18.2.0",
83+
"react-dom": "^18.2.0"
84+
},
85+
"dependencies": {
86+
"acorn-loose": "^8.3.0",
87+
"neo-async": "^2.6.1",
88+
"loose-envify": "^1.1.0"
89+
},
90+
"browserify": {
91+
"transform": [
92+
"loose-envify"
93+
]
94+
}
95+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMServerBrowser';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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/ReactFlightDOMServerEdge';

0 commit comments

Comments
 (0)