Make the module ids deterministic between runs

Reviewed By: Hypuk

Differential Revision: D6082114

fbshipit-source-id: fd43b64818a1da192c9252a9d2aed918a130517c
This commit is contained in:
Rafael Oleza 2017-10-18 11:56:25 -07:00 committed by Facebook Github Bot
parent 86ffdae347
commit e9d2575b26
1 changed files with 6 additions and 1 deletions

View File

@ -182,9 +182,14 @@ class DeltaTransformer extends EventEmitter {
const transformerOptions = await this._deltaCalculator.getTransformerOptions();
const dependencyEdges = this._deltaCalculator.getDependencyEdges();
// Precalculate all module ids sequentially. We do this to be sure that the
// mapping between module -> moduleId is deterministic between runs.
const modules = Array.from(modified.values());
modules.forEach(module => this._getModuleId(module));
// Get the transformed source code of each modified/added module.
const modifiedDelta = await this._transformModules(
Array.from(modified.values()),
modules,
transformerOptions,
dependencyEdges,
);