validateImportSpecifier() — react Function Reference
Architecture documentation for the validateImportSpecifier() function in ValidateNoUntransformedReferences.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD a4f6bed9_c265_4ac2_4912_8b61d4121efb["validateImportSpecifier()"] 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b["ValidateNoUntransformedReferences.ts"] a4f6bed9_c265_4ac2_4912_8b61d4121efb -->|defined in| 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b 6c6008c2_2667_c1e0_d0ae_ea81069aa361["transformProgram()"] 6c6008c2_2667_c1e0_d0ae_ea81069aa361 -->|calls| a4f6bed9_c265_4ac2_4912_8b61d4121efb 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] a4f6bed9_c265_4ac2_4912_8b61d4121efb -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e style a4f6bed9_c265_4ac2_4912_8b61d4121efb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts lines 195–221
function validateImportSpecifier(
specifier: NodePath<t.ImportSpecifier>,
importSpecifierChecks: Map<string, CheckInvalidReferenceFn>,
state: TraversalState,
): void {
const imported = specifier.get('imported');
const specifierName: string =
imported.node.type === 'Identifier'
? imported.node.name
: imported.node.value;
const checkFn = importSpecifierChecks.get(specifierName);
if (checkFn == null) {
return;
}
if (state.shouldInvalidateScopes) {
state.shouldInvalidateScopes = false;
state.program.scope.crawl();
}
const local = specifier.get('local');
const binding = local.scope.getBinding(local.node.name);
CompilerError.invariant(binding != null, {
reason: 'Expected binding to be found for import specifier',
loc: local.node.loc ?? GeneratedSource,
});
checkFn(binding.referencePaths, state);
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does validateImportSpecifier() do?
validateImportSpecifier() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts.
Where is validateImportSpecifier() defined?
validateImportSpecifier() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts at line 195.
What does validateImportSpecifier() call?
validateImportSpecifier() calls 1 function(s): invariant.
What calls validateImportSpecifier()?
validateImportSpecifier() is called by 1 function(s): transformProgram.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free