Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement react-server-dom-parcel #31725

Merged
merged 25 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
934ce8a
Setup react-server-dom-parcel package
devongovett Jan 28, 2024
4690176
lint
devongovett Jan 28, 2024
409b66d
remove unused file
devongovett Jan 28, 2024
ba0ee14
simplify
devongovett Feb 18, 2024
81dc4d8
no manifest needed
devongovett Feb 18, 2024
b165331
fix server actions
devongovett Feb 22, 2024
35e8e84
Make it possible to import a "use server" module from the client
devongovett Feb 23, 2024
0fe64da
fix
devongovett Feb 24, 2024
0b5ec96
also handle form actions
devongovett Feb 24, 2024
9b00071
use @parcel/intrinsics to load modules
devongovett Mar 10, 2024
b1749d0
fix flow
devongovett Mar 10, 2024
a2528be
flow
devongovett Mar 10, 2024
a6ba47e
closure compiler doesn't like async functions?
devongovett Mar 10, 2024
738906a
Merge branch 'main' into parcel-rsc
devongovett Mar 10, 2024
8d06250
update with latest changes from main
devongovett Mar 11, 2024
eee5772
Use parcelRequire
devongovett Dec 2, 2024
f3df9a3
Merge branch 'main' of github.com:facebook/react into parcel-rsc
devongovett Dec 2, 2024
3cae4dc
Register server references correctly
devongovett Dec 8, 2024
91ca9aa
Merge branch 'main' of github.com:facebook/react into parcel-rsc
devongovett Dec 10, 2024
0eeb255
Use parcelRequire.load
devongovett Dec 10, 2024
68dba2d
prettier
devongovett Dec 10, 2024
de0fe68
Copy examples from https://github.com/parcel-bundler/rsc-examples/blo…
sebmarkbage Dec 12, 2024
e9b6d21
Mark react-server-dom-parcel package as private for now
sebmarkbage Dec 12, 2024
2a8dcc4
Use experimental versions in package.json
sebmarkbage Dec 12, 2024
2bf70e9
Add dev command similar to the other fixtures
sebmarkbage Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ module.exports = {
'packages/react-server-dom-esm/**/*.js',
'packages/react-server-dom-webpack/**/*.js',
'packages/react-server-dom-turbopack/**/*.js',
'packages/react-server-dom-parcel/**/*.js',
'packages/react-server-dom-fb/**/*.js',
'packages/react-test-renderer/**/*.js',
'packages/react-debug-tools/**/*.js',
Expand Down Expand Up @@ -481,6 +482,12 @@ module.exports = {
__turbopack_require__: 'readonly',
},
},
{
files: ['packages/react-server-dom-parcel/**/*.js'],
globals: {
parcelRequire: 'readonly',
},
},
{
files: ['packages/scheduler/**/*.js'],
globals: {
Expand Down
1 change: 1 addition & 0 deletions ReactVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const stablePackages = {
'react-dom': ReactVersion,
'react-server-dom-webpack': ReactVersion,
'react-server-dom-turbopack': ReactVersion,
'react-server-dom-parcel': ReactVersion,
'react-is': ReactVersion,
'react-reconciler': '0.31.0',
'react-refresh': '0.16.0',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-parcel';

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-parcel/src/shared/ReactFlightClientConfigBundlerParcel';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-parcel';

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-parcel/src/shared/ReactFlightClientConfigBundlerParcel';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-parcel';

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-parcel/src/shared/ReactFlightClientConfigBundlerParcel';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
5 changes: 5 additions & 0 deletions packages/react-server-dom-parcel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# react-server-dom-parcel

Experimental React Flight bindings for DOM using Parcel.

**Use it at your own risk.**
10 changes: 10 additions & 0 deletions packages/react-server-dom-parcel/client.browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from './src/client/ReactFlightDOMClientBrowser';
10 changes: 10 additions & 0 deletions packages/react-server-dom-parcel/client.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from './src/client/ReactFlightDOMClientEdge';
10 changes: 10 additions & 0 deletions packages/react-server-dom-parcel/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from './client.browser';
10 changes: 10 additions & 0 deletions packages/react-server-dom-parcel/client.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from './src/client/ReactFlightDOMClientNode';
10 changes: 10 additions & 0 deletions packages/react-server-dom-parcel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

throw new Error('Use react-server-dom-parcel/client instead.');
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/client.browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-client.browser.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-client.browser.development.js');
}
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/client.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-client.edge.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-client.edge.development.js');
}
3 changes: 3 additions & 0 deletions packages/react-server-dom-parcel/npm/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('./client.browser');
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/client.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-client.node.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-client.node.development.js');
}
12 changes: 12 additions & 0 deletions packages/react-server-dom-parcel/npm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

'use strict';

throw new Error('Use react-server-dom-parcel/client instead.');
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/server.browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-server.browser.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-server.browser.development.js');
}
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/server.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-server.edge.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-server.edge.development.js');
}
6 changes: 6 additions & 0 deletions packages/react-server-dom-parcel/npm/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

throw new Error(
'The React Server Writer cannot be used outside a react-server environment. ' +
'You must configure Node.js using the `--conditions react-server` flag.'
);
7 changes: 7 additions & 0 deletions packages/react-server-dom-parcel/npm/server.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-parcel-server.node.production.js');
} else {
module.exports = require('./cjs/react-server-dom-parcel-server.node.development.js');
}
85 changes: 85 additions & 0 deletions packages/react-server-dom-parcel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "react-server-dom-parcel",
"description": "React Server Components bindings for DOM using Parcel. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
"version": "19.0.0",
"keywords": [
"react"
],
"homepage": "https://reactjs.org/",
"bugs": "https://github.com/facebook/react/issues",
"license": "MIT",
"files": [
"LICENSE",
"README.md",
"index.js",
"client.js",
"client.browser.js",
"client.edge.js",
"client.node.js",
"server.js",
"server.browser.js",
"server.edge.js",
"server.node.js",
"static.js",
"static.browser.js",
"static.edge.js",
"static.node.js",
"cjs/"
],
"exports": {
".": "./index.js",
"./client": {
"workerd": "./client.edge.js",
"deno": "./client.edge.js",
"worker": "./client.edge.js",
"node": "./client.node.js",
"edge-light": "./client.edge.js",
"browser": "./client.browser.js",
"default": "./client.browser.js"
},
"./client.browser": "./client.browser.js",
"./client.edge": "./client.edge.js",
"./client.node": "./client.node.js",
"./server": {
"react-server": {
"workerd": "./server.edge.js",
"deno": "./server.browser.js",
"node": "./server.node.js",
"edge-light": "./server.edge.js",
"browser": "./server.browser.js"
},
"default": "./server.js"
},
"./server.browser": "./server.browser.js",
"./server.edge": "./server.edge.js",
"./server.node": "./server.node.js",
"./static": {
"react-server": {
"workerd": "./static.edge.js",
"deno": "./static.browser.js",
"node": "./static.node.js",
"edge-light": "./static.edge.js",
"browser": "./static.browser.js"
},
"default": "./static.js"
},
"./static.browser": "./static.browser.js",
"./static.edge": "./static.edge.js",
"./static.node": "./static.node.js",
"./src/*": "./src/*.js",
"./package.json": "./package.json"
},
"main": "index.js",
"repository": {
"type" : "git",
"url" : "https://github.com/facebook/react.git",
"directory": "packages/react-server-dom-parcel"
},
"engines": {
"node": ">=0.10.0"
},
"peerDependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
}
}
20 changes: 20 additions & 0 deletions packages/react-server-dom-parcel/server.browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {
renderToReadableStream,
decodeReply,
decodeAction,
decodeFormState,
createClientReference,
registerServerReference,
createTemporaryReferenceSet,
registerServerActions,
loadServerAction,
} from './src/server/react-flight-dom-server.browser';
20 changes: 20 additions & 0 deletions packages/react-server-dom-parcel/server.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {
renderToReadableStream,
decodeReply,
decodeAction,
decodeFormState,
createClientReference,
registerServerReference,
createTemporaryReferenceSet,
registerServerActions,
loadServerAction,
} from './src/server/react-flight-dom-server.edge';
13 changes: 13 additions & 0 deletions packages/react-server-dom-parcel/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

throw new Error(
'The React Server cannot be used outside a react-server environment. ' +
'You must configure Node.js using the `--conditions react-server` flag.',
);
21 changes: 21 additions & 0 deletions packages/react-server-dom-parcel/server.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {
renderToPipeableStream,
decodeReplyFromBusboy,
decodeReply,
decodeAction,
decodeFormState,
createClientReference,
registerServerReference,
createTemporaryReferenceSet,
registerServerActions,
loadServerAction,
} from './src/server/react-flight-dom-server.node';
Loading
Loading