From 1c53c9b20f83deb943599fe0b40db7620696ad05 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 18 Apr 2017 09:26:58 -0700 Subject: [PATCH] packager: Module: remove dead cacheTransformResults option Reviewed By: davidaurelio Differential Revision: D4884343 fbshipit-source-id: ae29757690d9b56d6f166bc86573aca9b1b6b65c --- packager/src/Resolver/index.js | 1 - packager/src/node-haste/Module.js | 14 ++--------- .../__tests__/DependencyGraph-test.js | 2 +- .../src/node-haste/__tests__/Module-test.js | 24 +------------------ 4 files changed, 4 insertions(+), 37 deletions(-) diff --git a/packager/src/Resolver/index.js b/packager/src/Resolver/index.js index fac3b892d..8b10acba0 100644 --- a/packager/src/Resolver/index.js +++ b/packager/src/Resolver/index.js @@ -69,7 +69,6 @@ class Resolver { (opts.blacklistRE != null && opts.blacklistRE.test(filepath)); }, moduleOptions: { - cacheTransformResults: true, hasteImpl: opts.hasteImpl, resetCache: opts.resetCache, }, diff --git a/packager/src/node-haste/Module.js b/packager/src/node-haste/Module.js index 4b13979dd..2a5a7957d 100644 --- a/packager/src/node-haste/Module.js +++ b/packager/src/node-haste/Module.js @@ -61,7 +61,6 @@ export type HasteImpl = { }; export type Options = { - cacheTransformResults?: boolean, hasteImpl?: HasteImpl, resetCache?: boolean, }; @@ -246,17 +245,8 @@ class Module { /** * To what we read from the cache or worker, we need to add id and source. */ - _finalizeReadResult( - source: string, - result: TransformedCode, - ): ReadResult { - const id = this._getHasteName(); - if (this._options.cacheTransformResults === false) { - const {dependencies} = result; - /* $FlowFixMe: this code path is dead, remove. */ - return {dependencies}; - } - return {...result, id, source}; + _finalizeReadResult(source: string, result: TransformedCode): ReadResult { + return {...result, id: this._getHasteName(), source}; } _transformCodeForCallback( diff --git a/packager/src/node-haste/__tests__/DependencyGraph-test.js b/packager/src/node-haste/__tests__/DependencyGraph-test.js index 569c23f9e..23629ee00 100644 --- a/packager/src/node-haste/__tests__/DependencyGraph-test.js +++ b/packager/src/node-haste/__tests__/DependencyGraph-test.js @@ -76,7 +76,7 @@ describe('DependencyGraph', function() { useWatchman: false, ignoreFilePath: () => false, maxWorkerCount: 1, - moduleOptions: {cacheTransformResults: true}, + moduleOptions: {}, resetCache: true, transformCode: (module, sourceCode, transformOptions) => { return new Promise(resolve => { diff --git a/packager/src/node-haste/__tests__/Module-test.js b/packager/src/node-haste/__tests__/Module-test.js index 78b475d5d..e4aca77e1 100644 --- a/packager/src/node-haste/__tests__/Module-test.js +++ b/packager/src/node-haste/__tests__/Module-test.js @@ -60,9 +60,7 @@ describe('Module', () => { let transformCacheKey; const createModule = options => new Module({ - options: { - cacheTransformResults: true, - }, + options: {}, transformCode: (module, sourceCode, transformOptions) => { return Promise.resolve({code: sourceCode}); }, @@ -258,26 +256,6 @@ describe('Module', () => { }); }); - it('only stores dependencies if `cacheTransformResults` option is disabled', () => { - transformResult = { - code: exampleCode, - arbitrary: 'arbitrary', - dependencies: ['foo', 'bar'], - dependencyOffsets: [12, 764], - map: {version: 3}, - subObject: {foo: 'bar'}, - }; - const module = createModule({transformCode, options: { - cacheTransformResults: false, - }}); - - return module.read().then(result => { - expect(result).toEqual({ - dependencies: ['foo', 'bar'], - }); - }); - }); - it('stores all things if options is undefined', () => { transformResult = { code: exampleCode,