MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / readCommonJsExport

Function readCommonJsExport

src/lib/prettierFormatter.js:369–378  ·  view source on GitHub ↗
(statement, scope)

Source from the content-addressed store, hash-verified

367}
368
369function readCommonJsExport(statement, scope) {
370 if (statement?.type !== "ExpressionStatement") return undefined;
371 const expr = statement.expression;
372 if (expr?.type !== "AssignmentExpression" || expr.operator !== "=") {
373 return undefined;
374 }
375
376 if (!isModuleExports(expr.left)) return undefined;
377 return evaluateNode(expr.right, scope);
378}
379
380function readEsmExport(statement, scope) {
381 if (statement?.type !== "ExportDefaultDeclaration") return undefined;

Callers 1

extractConfigFromProgramFunction · 0.85

Calls 2

isModuleExportsFunction · 0.85
evaluateNodeFunction · 0.85

Tested by

no test coverage detected