webpack/lib/Dependency.js

53 lines
955 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";
const compareLocations = require("./compareLocations");
class Dependency {
constructor() {
this.module = null;
2017-08-08 15:28:34 +08:00
this.weak = false;
this.optional = false;
}
2013-01-31 01:49:25 +08:00
isEqualResource() {
return false;
}
2013-01-31 01:49:25 +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,
importedNames: true, // true: full object, false: only sideeffects/no export, array of strings: the exports with this names
};
}
// 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;