validateNamespacedImport() — react Function Reference
Architecture documentation for the validateNamespacedImport() function in ValidateNoUntransformedReferences.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 7ba64864_37b8_333a_82c1_22a93c4b5c66["validateNamespacedImport()"] 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b["ValidateNoUntransformedReferences.ts"] 7ba64864_37b8_333a_82c1_22a93c4b5c66 -->|defined in| 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b 6c6008c2_2667_c1e0_d0ae_ea81069aa361["transformProgram()"] 6c6008c2_2667_c1e0_d0ae_ea81069aa361 -->|calls| 7ba64864_37b8_333a_82c1_22a93c4b5c66 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] 7ba64864_37b8_333a_82c1_22a93c4b5c66 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e 4663af75_e270_25e3_3415_1230be609d66["getOrInsertWith()"] 7ba64864_37b8_333a_82c1_22a93c4b5c66 -->|calls| 4663af75_e270_25e3_3415_1230be609d66 073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"] 7ba64864_37b8_333a_82c1_22a93c4b5c66 -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83 style 7ba64864_37b8_333a_82c1_22a93c4b5c66 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts lines 223–269
function validateNamespacedImport(
specifier: NodePath<t.ImportNamespaceSpecifier | t.ImportDefaultSpecifier>,
importSpecifierChecks: Map<string, CheckInvalidReferenceFn>,
state: TraversalState,
): void {
if (state.shouldInvalidateScopes) {
state.shouldInvalidateScopes = false;
state.program.scope.crawl();
}
const local = specifier.get('local');
const binding = local.scope.getBinding(local.node.name);
const defaultCheckFn = importSpecifierChecks.get(DEFAULT_EXPORT);
CompilerError.invariant(binding != null, {
reason: 'Expected binding to be found for import specifier',
loc: local.node.loc ?? GeneratedSource,
});
const filteredReferences = new Map<
CheckInvalidReferenceFn,
Array<NodePath<t.Node>>
>();
for (const reference of binding.referencePaths) {
if (defaultCheckFn != null) {
getOrInsertWith(filteredReferences, defaultCheckFn, () => []).push(
reference,
);
}
const parent = reference.parentPath;
if (
parent != null &&
parent.isMemberExpression() &&
parent.get('object') === reference
) {
if (parent.node.computed || parent.node.property.type !== 'Identifier') {
continue;
}
const checkFn = importSpecifierChecks.get(parent.node.property.name);
if (checkFn != null) {
getOrInsertWith(filteredReferences, checkFn, () => []).push(parent);
}
}
}
for (const [checkFn, references] of filteredReferences) {
checkFn(references, state);
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does validateNamespacedImport() do?
validateNamespacedImport() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts.
Where is validateNamespacedImport() defined?
validateNamespacedImport() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts at line 223.
What does validateNamespacedImport() call?
validateNamespacedImport() calls 3 function(s): getOrInsertWith, invariant, push.
What calls validateNamespacedImport()?
validateNamespacedImport() 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