MCPcopy
hub / github.com/rollup/rollup / getExportedVariablesByName

Method getExportedVariablesByName

src/Module.ts:497–544  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

495 }
496
497 getExportedVariablesByName(): Map<string, Variable> {
498 if (this.exportedVariablesByName) {
499 return this.exportedVariablesByName;
500 }
501 const exportedVariablesByName = (this.exportedVariablesByName = new Map<string, Variable>());
502 for (const name of this.exportDescriptions.keys()) {
503 // We do not count the synthetic namespace as a regular export to hide it
504 // from entry signatures and namespace objects
505 if (name !== this.info.syntheticNamedExports) {
506 const [exportedVariable] = this.getVariableForExportName(name);
507 if (exportedVariable) {
508 exportedVariablesByName.set(name, exportedVariable);
509 } else {
510 return error(logMissingEntryExport(name, this.id));
511 }
512 }
513 }
514 for (const name of this.reexportDescriptions.keys()) {
515 const [exportedVariable] = this.getVariableForExportName(name);
516 if (exportedVariable) {
517 exportedVariablesByName.set(name, exportedVariable);
518 }
519 }
520 for (const module of this.exportAllModules) {
521 if (module instanceof ExternalModule) {
522 exportedVariablesByName.set(
523 `*${module.id}`,
524 module.getVariableForExportName('*', {
525 importChain: [this.id]
526 })[0]
527 );
528 continue;
529 }
530
531 for (const name of module.getExportedVariablesByName().keys()) {
532 if (name !== 'default' && !exportedVariablesByName.has(name)) {
533 const [exportedVariable] = this.getVariableForExportName(name);
534 if (exportedVariable) {
535 exportedVariablesByName.set(name, exportedVariable);
536 }
537 }
538 }
539 }
540
541 return (this.exportedVariablesByName = new Map(
542 [...exportedVariablesByName].sort(sortExportedVariables)
543 ));
544 }
545
546 getExportNamesByVariable(): Map<Variable, string[]> {
547 if (this.exportNamesByVariable) {

Calls 5

errorFunction · 0.90
logMissingEntryExportFunction · 0.90
setMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected