module() — react Function Reference
Architecture documentation for the module() function in transform-object-assign.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD b3bc4e95_ec99_0ca6_4f66_f87ff1822afd["module()"] 2cdc6d20_af43_f3f1_403a_fd6bc32674d2["transform-object-assign.js"] b3bc4e95_ec99_0ca6_4f66_f87ff1822afd -->|defined in| 2cdc6d20_af43_f3f1_403a_fd6bc32674d2 style b3bc4e95_ec99_0ca6_4f66_f87ff1822afd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/babel/transform-object-assign.js lines 12–54
module.exports = function autoImporter(babel) {
function getAssignIdent(path, file, state) {
if (state.id) {
return state.id;
}
state.id = helperModuleImports.addDefault(path, 'shared/assign', {
nameHint: 'assign',
});
return state.id;
}
return {
pre: function () {
// map from module to generated identifier
this.id = null;
},
visitor: {
CallExpression: function (path, file) {
if (/shared(\/|\\)assign/.test(file.filename)) {
// Don't replace Object.assign if we're transforming shared/assign
return;
}
if (path.get('callee').matchesPattern('Object.assign')) {
// generate identifier and require if it hasn't been already
const id = getAssignIdent(path, file, this);
path.node.callee = id;
}
},
MemberExpression: function (path, file) {
if (/shared(\/|\\)assign/.test(file.filename)) {
// Don't replace Object.assign if we're transforming shared/assign
return;
}
if (path.matchesPattern('Object.assign')) {
const id = getAssignIdent(path, file, this);
path.replaceWith(id);
}
},
},
};
};
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does module() do?
module() is a function in the react codebase, defined in scripts/babel/transform-object-assign.js.
Where is module() defined?
module() is defined in scripts/babel/transform-object-assign.js at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free