UNPKG

1.03 kBJavaScriptView Raw
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5'use strict';
6const compareLocations = require('./compareLocations');
7
8class Dependency {
9 constructor() {
10 this.module = null;
11 }
12
13 isEqualResource() {
14 return false;
15 }
16
17 // Returns the referenced module and export
18 getReference() {
19 if (!this.module) return null;
20 return {
21 module: this.module,
22 importedNames: true, // true: full object, false: only sideeffects/no export, array of strings: the exports with this names
23 };
24 }
25
26 // Returns the exported names
27 getExports() {
28 return null;
29 }
30
31 getWarnings() {
32 return null;
33 }
34
35 getErrors() {
36 return null;
37 }
38
39 updateHash(hash) {
40 hash.update((this.module && this.module.id) + '');
41 }
42
43 disconnect() {
44 this.module = null;
45 }
46
47 // TODO: remove in webpack 3
48 compare(a, b) {
49 return compareLocations(a.loc, b.loc);
50 }
51}
52Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
53
54module.exports = Dependency;