region.js — react Source File
Architecture documentation for region.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
'use strict';
// This is a server to host data-local resources like databases and RSC
const path = require('path');
const url = require('url');
if (typeof fetch === 'undefined') {
// Patch fetch for earlier Node versions.
global.fetch = require('undici').fetch;
}
const express = require('express');
const bodyParser = require('body-parser');
const busboy = require('busboy');
const app = express();
const compress = require('compression');
const {Readable} = require('node:stream');
const nodeModule = require('node:module');
app.use(compress());
// Application
const {readFile} = require('fs').promises;
const React = require('react');
const moduleBasePath = new URL('../src', url.pathToFileURL(__filename)).href;
async function renderApp(res, returnValue) {
const {renderToPipeableStream} = await import('react-server-dom-esm/server');
const m = await import('../src/App.js');
const App = m.default;
const root = React.createElement(App);
// For client-invoked server actions we refresh the tree and return a return value.
const payload = returnValue ? {returnValue, root} : root;
const {pipe} = renderToPipeableStream(payload, moduleBasePath);
pipe(res);
}
app.get('/', async function (req, res) {
await renderApp(res, null);
});
app.post('/', bodyParser.text(), async function (req, res) {
const {
renderToPipeableStream,
decodeReply,
decodeReplyFromBusboy,
decodeAction,
} = await import('react-server-dom-esm/server');
const serverReference = req.get('rsc-action');
if (serverReference) {
// This is the client-side case
const [filepath, name] = serverReference.split('#');
const action = (await import(filepath))[name];
// Validate that this is actually a function we intended to expose and
// ... (165 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does region.js do?
region.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in region.js?
region.js defines 1 function(s): renderApp.
Where is region.js in the architecture?
region.js is located at fixtures/flight-esm/server/region.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/flight-esm/server).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free