server.js — react Source File
Architecture documentation for server.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2147ecb6_7b0c_5060_7d10_643cc38d3dff["server.js"] 102f7d62_f771_0080_dd43_d867f5a8bd55["core"] 2147ecb6_7b0c_5060_7d10_643cc38d3dff --> 102f7d62_f771_0080_dd43_d867f5a8bd55 style 2147ecb6_7b0c_5060_7d10_643cc38d3dff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import babel from '@babel/core';
const babelOptions = {
babelrc: false,
ignore: [/\/(build|node_modules)\//],
plugins: [
'@babel/plugin-syntax-import-meta',
'@babel/plugin-transform-react-jsx',
],
};
export async function load(url, context, defaultLoad) {
if (url.endsWith('.css')) {
return {source: 'export default {}', format: 'module', shortCircuit: true};
}
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);
}
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);
}
export const transformSource =
process.version < 'v16' ? babelTransformSource : undefined;
Domain
Subdomains
Functions
Dependencies
- core
Source
Frequently Asked Questions
What does server.js do?
server.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 server.js?
server.js defines 2 function(s): babelTransformSource, load.
What does server.js depend on?
server.js imports 1 module(s): core.
Where is server.js in the architecture?
server.js is located at fixtures/view-transition/loader/server.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/view-transition/loader).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free