MCPcopy
hub / github.com/plotly/dash / getComponentFromExport

Function getComponentFromExport

dash/extract-meta.js:209–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 };
208
209 const getComponentFromExport = exp => {
210 const decl = exp.valueDeclaration || exp.declarations[0];
211 const type = checker.getTypeOfSymbolAtLocation(exp, decl);
212 const typeSymbol = type.symbol || type.aliasSymbol;
213
214 if (!typeSymbol) {
215 return exp;
216 }
217
218 const symbolName = typeSymbol.getName();
219
220 if (
221 (symbolName === 'MemoExoticComponent' ||
222 symbolName === 'ForwardRefExoticComponent') &&
223 exp.valueDeclaration &&
224 ts.isExportAssignment(exp.valueDeclaration) &&
225 ts.isCallExpression(exp.valueDeclaration.expression)
226 ) {
227 const component = checker.getSymbolAtLocation(
228 exp.valueDeclaration.expression.arguments[0]
229 );
230
231 if (component) return component;
232 }
233 return exp;
234 };
235
236 const getParent = node => {
237 let parent = node;

Callers 1

gatherComponentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…