Unify file.emptyStub and file.imported === "implicit" as file.implicit.

Note that there was a typo in ResourceSlot#addStylesheet, so
file.emptyStub was never === true before.
This commit is contained in:
Ben Newman
2017-01-04 13:00:14 -05:00
parent be38540ee2
commit 4fb26259b8
2 changed files with 10 additions and 9 deletions

View File

@@ -664,7 +664,7 @@ class ResourceSlot {
// If a compiler plugin calls addJavaScript with the same
// sourcePath, that code should take precedence over this empty
// stub, so this property marks the resource as disposable.
emtpyStub: true,
implicit: true,
lazy: true,
});

View File

@@ -160,14 +160,14 @@ export default class ImportScanner {
if (old) {
// If the old file is just an empty stub, let the new file take
// precedence over it.
if (old.emptyStub === true) {
if (old.implicit === true) {
return this.absPathToOutputIndex[absPath] = file;
}
// If the new file is just an empty stub, pretend the _addFile
// succeeded by returning the old file, so that we won't try to call
// _combineFiles needlessly.
if (file.emptyStub === true) {
if (file.implicit === true) {
return old;
}
@@ -507,11 +507,11 @@ export default class ImportScanner {
if (depFile) {
// If the module was imported implicitly before, update to the
// explicit version now.
if (depFile.imported === "implicit") {
if (depFile.implicit === true) {
const file = this._readModule(absImportedPath);
if (file) {
depFile.implicit = false;
Object.assign(depFile, file);
depFile.imported = true;
}
}
@@ -837,13 +837,14 @@ export default class ImportScanner {
servePath: relPkgJsonPath,
hash: sha1(data),
lazy: true,
imported: true,
// Since _addPkgJsonToOutput is only ever called for package.json
// files that are involved in resolving package directories, and
// pkg is only a subset of the information in the actual
// package.json module, we mark it as being imported implicitly,
// so that the subset can be overridden by the actual module if
// this package.json file is imported explicitly elsewhere.
imported: "implicit",
// package.json module, we mark it as imported implicitly, so that
// the subset can be overridden by the actual module if this
// package.json file is imported explicitly elsewhere.
implicit: true,
};
this._addFile(pkgJsonPath, pkgFile);