Fix source map generation with experimental caches

Summary: Fixes a typo with a property name that flow did not catch.

Reviewed By: mjesun

Differential Revision: D7582300

fbshipit-source-id: 039550dffb0f22ed8d2820e7fdcbe35c1d012c68
This commit is contained in:
David Aurelio 2018-04-10 21:42:50 -07:00 committed by Facebook Github Bot
parent 11d36cd985
commit 1c3adf5d21
1 changed files with 15 additions and 11 deletions

View File

@ -304,18 +304,22 @@ class Module {
// TODO: T26134860 Cache layer lives inside the transformer now; just call
// the transform method.
if (this._experimentalCaches) {
// Source code is read on the worker.
const data = {
...(await this._transformCode(this, null, transformOptions)),
const result: TransformedCode = await this._transformCode(
this,
null, // Source code is read on the worker
transformOptions,
);
const module = this;
return {
code: result.code,
dependencies: result.dependencies,
map: result.map,
get source() {
return module._readSourceCode();
},
};
// eslint-disable-next-line lint/flow-no-fixme
// $FlowFixMe: Flow wants "value" here, where the get is for AVOIDING it.
Object.defineProperty(data, 'sourceCode', {
get: () => this._readSourceCode.bind(this),
});
return data;
}
const cached = this.readCached(transformOptions);