UNPKG

730 BJavaScriptView Raw
1import { blank } from './utils/object';
2
3export default class ExternalModule {
4 constructor ( id ) {
5 this.id = id;
6 this.name = null;
7
8 this.isExternal = true;
9 this.importedByBundle = [];
10
11 this.suggestedNames = blank();
12
13 this.needsDefault = false;
14
15 // Invariant: needsNamed and needsAll are never both true at once.
16 // Because an import with both a namespace and named import is invalid:
17 //
18 // import * as ns, { a } from '...'
19 //
20 this.needsNamed = false;
21 this.needsAll = false;
22 }
23
24 findDefiningStatement () {
25 return null;
26 }
27
28 rename () {
29 // noop
30 }
31
32 suggestName ( exportName, suggestion ) {
33 if ( !this.suggestedNames[ exportName ] ) {
34 this.suggestedNames[ exportName ] = suggestion;
35 }
36 }
37}