webpack/lib/Dependency.js

52 lines
938 B
JavaScript
Raw Normal View History

2013-01-31 01:49:25 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
2018-04-04 15:17:10 +08:00
const compareLocations = require("./compareLocations");
2018-04-04 15:17:10 +08:00
const DependencyReference = require("./dependencies/DependencyReference");
class Dependency {
constructor() {
this.module = null;
2017-08-08 15:28:34 +08:00
this.weak = false;
this.optional = false;
2018-03-28 13:27:05 +08:00
this.loc = undefined;
}
2013-01-31 01:49:25 +08:00
getResourceIdentifier() {
return null;
}
2013-01-31 01:49:25 +08:00
// Returns the referenced module and export
getReference() {
2018-02-25 09:00:20 +08:00
if (!this.module) return null;
2018-04-04 15:17:10 +08:00
return new DependencyReference(this.module, true, this.weak);
}
// Returns the exported names
getExports() {
return null;
}
getWarnings() {
return null;
}
getErrors() {
return null;
}
updateHash(hash) {
hash.update((this.module && this.module.id) + "");
}
2013-01-31 01:49:25 +08:00
disconnect() {
this.module = null;
}
}
Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
module.exports = Dependency;