2013-01-31 01:49:25 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2017-01-08 14:15:46 +08:00
|
|
|
"use strict";
|
|
|
|
const compareLocations = require("./compareLocations");
|
|
|
|
|
|
|
|
class Dependency {
|
|
|
|
constructor() {
|
|
|
|
this.module = null;
|
2017-08-08 15:28:34 +08:00
|
|
|
this.weak = false;
|
2017-11-06 20:02:35 +08:00
|
|
|
this.optional = false;
|
2017-01-08 14:15:46 +08:00
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
isEqualResource() {
|
|
|
|
return false;
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
// Returns the referenced module and export
|
|
|
|
getReference() {
|
|
|
|
if(!this.module) return null;
|
|
|
|
return {
|
|
|
|
module: this.module,
|
2017-08-08 15:28:34 +08:00
|
|
|
weak: this.weak,
|
2017-01-08 14:15:46 +08:00
|
|
|
importedNames: true, // true: full object, false: only sideeffects/no export, array of strings: the exports with this names
|
|
|
|
};
|
2015-10-22 03:05:01 +08:00
|
|
|
}
|
2016-06-24 07:51:52 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
// Returns the exported names
|
|
|
|
getExports() {
|
|
|
|
return null;
|
|
|
|
}
|
2016-09-06 05:41:03 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
getWarnings() {
|
|
|
|
return null;
|
|
|
|
}
|
2015-10-22 03:05:01 +08:00
|
|
|
|
2017-01-10 00:11:34 +08:00
|
|
|
getErrors() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
updateHash(hash) {
|
|
|
|
hash.update((this.module && this.module.id) + "");
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
disconnect() {
|
|
|
|
this.module = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
|
2015-05-11 00:43:47 +08:00
|
|
|
|
2017-01-08 14:15:46 +08:00
|
|
|
module.exports = Dependency;
|