region.js — react Source File
Architecture documentation for region.js, a javascript file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9880abca_4eaa_66fe_8026_b2b3f05215a1["region.js"] f70dbff2_d827_49dd_5a40_ec9717f4c008["node-loader"] 9880abca_4eaa_66fe_8026_b2b3f05215a1 --> f70dbff2_d827_49dd_5a40_ec9717f4c008 102f7d62_f771_0080_dd43_d867f5a8bd55["core"] 9880abca_4eaa_66fe_8026_b2b3f05215a1 --> 102f7d62_f771_0080_dd43_d867f5a8bd55 style 9880abca_4eaa_66fe_8026_b2b3f05215a1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import {
resolve,
load as reactLoad,
getSource as getSourceImpl,
transformSource as reactTransformSource,
} from 'react-server-dom-unbundled/node-loader';
export {resolve};
import babel from '@babel/core';
const babelOptions = {
babelrc: false,
ignore: [/\/(build|node_modules)\//],
plugins: [
'@babel/plugin-syntax-import-meta',
['@babel/plugin-transform-react-jsx', {runtime: 'automatic'}],
],
sourceMaps: process.env.NODE_ENV === 'development' ? 'inline' : false,
};
async function babelLoad(url, context, defaultLoad) {
const {format} = context;
const result = await defaultLoad(url, context, defaultLoad);
if (result.format === 'module') {
const opt = Object.assign({filename: url}, babelOptions);
const newResult = await babel.transformAsync(result.source, opt);
if (!newResult) {
if (typeof result.source === 'string') {
return result;
}
return {
source: Buffer.from(result.source).toString('utf8'),
format: 'module',
};
}
return {source: newResult.code, format: 'module'};
}
return defaultLoad(url, context, defaultLoad);
}
export async function load(url, context, defaultLoad) {
return await reactLoad(url, context, (u, c) => {
return babelLoad(u, c, defaultLoad);
});
}
async function babelTransformSource(source, context, defaultTransformSource) {
const {format} = context;
if (format === 'module') {
const opt = Object.assign({filename: context.url}, babelOptions);
const newResult = await babel.transformAsync(source, opt);
if (!newResult) {
if (typeof source === 'string') {
return {source};
}
return {
source: Buffer.from(source).toString('utf8'),
};
}
return {source: newResult.code};
}
return defaultTransformSource(source, context, defaultTransformSource);
}
async function transformSourceImpl(source, context, defaultTransformSource) {
return await reactTransformSource(source, context, (s, c) => {
return babelTransformSource(s, c, defaultTransformSource);
});
}
export const transformSource =
process.version < 'v16' ? transformSourceImpl : undefined;
export const getSource = process.version < 'v16' ? getSourceImpl : undefined;
Domain
Subdomains
Dependencies
- core
- node-loader
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 4 function(s): babelLoad, babelTransformSource, load, transformSourceImpl.
What does region.js depend on?
region.js imports 2 module(s): core, node-loader.
Where is region.js in the architecture?
region.js is located at fixtures/flight/loader/region.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/flight/loader).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free