utils.js — react Source File
Architecture documentation for utils.js, a javascript file in the react codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 19f40fb1_960e_960b_4570_41c17da62024["utils.js"] aec7978f_0a19_ba93_de9e_ac8cf5ddc74b["types"] 19f40fb1_960e_960b_4570_41c17da62024 --> aec7978f_0a19_ba93_de9e_ac8cf5ddc74b 7a7a2c85_2337_a4ad_6883_71d2c6b4b916["isArray"] 19f40fb1_960e_960b_4570_41c17da62024 --> 7a7a2c85_2337_a4ad_6883_71d2c6b4b916 7dc1582f_e5c4_6fb0_e998_bd2982c8c801["renderer.js"] 7dc1582f_e5c4_6fb0_e998_bd2982c8c801 --> 19f40fb1_960e_960b_4570_41c17da62024 style 19f40fb1_960e_960b_4570_41c17da62024 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* 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
*/
import type {StyleXPlugin} from 'react-devtools-shared/src/frontend/types';
import isArray from 'react-devtools-shared/src/isArray';
const cachedStyleNameToValueMap: Map<string, string> = new Map();
export function getStyleXData(data: any): StyleXPlugin {
const sources = new Set<string>();
const resolvedStyles = {};
crawlData(data, sources, resolvedStyles);
return {
sources: Array.from(sources).sort(),
resolvedStyles,
};
}
export function crawlData(
data: any,
sources: Set<string>,
resolvedStyles: Object,
): void {
if (data == null) {
return;
}
if (isArray(data)) {
data.forEach(entry => {
if (entry == null) {
return;
}
if (isArray(entry)) {
crawlData(entry, sources, resolvedStyles);
} else {
crawlObjectProperties(entry, sources, resolvedStyles);
}
});
} else {
crawlObjectProperties(data, sources, resolvedStyles);
}
resolvedStyles = Object.fromEntries<string, any>(
Object.entries(resolvedStyles).sort(),
);
}
function crawlObjectProperties(
entry: Object,
sources: Set<string>,
resolvedStyles: Object,
// ... (71 more lines)
Domain
Subdomains
Dependencies
- isArray
- types
Source
Frequently Asked Questions
What does utils.js do?
utils.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in utils.js?
utils.js defines 4 function(s): crawlData, crawlObjectProperties, getPropertyValueForStyleName, getStyleXData.
What does utils.js depend on?
utils.js imports 2 module(s): isArray, types.
What files import utils.js?
utils.js is imported by 1 file(s): renderer.js.
Where is utils.js in the architecture?
utils.js is located at packages/react-devtools-shared/src/backend/StyleX/utils.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/StyleX).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free