Support relative paths in haste map
Summary: Since all paths are relative when building with the new Buck integration, `HasteMap` needed support for these. Reviewed By: cpojer Differential Revision: D4265888 fbshipit-source-id: 2d454bfd3866028d8d2c268c0fd318b148951dc9
This commit is contained in:
parent
c74f00e78c
commit
6c65cda628
|
@ -20,6 +20,7 @@ const PACKAGE_JSON = path.sep + 'package.json';
|
||||||
|
|
||||||
class HasteMap extends EventEmitter {
|
class HasteMap extends EventEmitter {
|
||||||
constructor({
|
constructor({
|
||||||
|
allowRelativePaths,
|
||||||
extensions,
|
extensions,
|
||||||
files,
|
files,
|
||||||
moduleCache,
|
moduleCache,
|
||||||
|
@ -28,6 +29,7 @@ class HasteMap extends EventEmitter {
|
||||||
platforms,
|
platforms,
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
|
this._allowRelativePaths = allowRelativePaths;
|
||||||
this._extensions = extensions;
|
this._extensions = extensions;
|
||||||
this._files = files;
|
this._files = files;
|
||||||
this._helpers = helpers;
|
this._helpers = helpers;
|
||||||
|
@ -126,7 +128,9 @@ class HasteMap extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
_processHastePackage(file, previousName) {
|
_processHastePackage(file, previousName) {
|
||||||
|
if (!this._allowRelativePaths) {
|
||||||
file = path.resolve(file);
|
file = path.resolve(file);
|
||||||
|
}
|
||||||
const p = this._moduleCache.getPackage(file);
|
const p = this._moduleCache.getPackage(file);
|
||||||
return p.isHaste()
|
return p.isHaste()
|
||||||
.then(isHaste => isHaste && p.getName()
|
.then(isHaste => isHaste && p.getName()
|
||||||
|
|
Loading…
Reference in New Issue