global.js — react Source File
Architecture documentation for global.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
'use strict';
// This is a server to host CDN distributed resources like module source files and SSR
const path = require('path');
const url = require('url');
const fs = require('fs').promises;
const compress = require('compression');
const chalk = require('chalk');
const express = require('express');
const http = require('http');
const React = require('react');
const {renderToPipeableStream} = require('react-dom/server');
const {createFromNodeStream} = require('react-server-dom-esm/client');
const moduleBasePath = new URL('../src', url.pathToFileURL(__filename)).href;
const app = express();
app.use(compress());
function request(options, body) {
return new Promise((resolve, reject) => {
const req = http.request(options, res => {
resolve(res);
});
req.on('error', e => {
reject(e);
});
body.pipe(req);
});
}
app.all('/', async function (req, res, next) {
// Proxy the request to the regional server.
const proxiedHeaders = {
'X-Forwarded-Host': req.hostname,
'X-Forwarded-For': req.ips,
'X-Forwarded-Port': 3000,
'X-Forwarded-Proto': req.protocol,
};
// Proxy other headers as desired.
if (req.get('rsc-action')) {
proxiedHeaders['Content-type'] = req.get('Content-type');
proxiedHeaders['rsc-action'] = req.get('rsc-action');
} else if (req.get('Content-type')) {
proxiedHeaders['Content-type'] = req.get('Content-type');
}
const promiseForData = request(
{
host: '127.0.0.1',
port: 3001,
method: req.method,
path: '/',
headers: proxiedHeaders,
},
req
// ... (135 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does global.js do?
global.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in global.js?
global.js defines 1 function(s): request.
Where is global.js in the architecture?
global.js is located at fixtures/flight-esm/server/global.js (domain: BabelCompiler, subdomain: Optimization, 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