packager: remove unused imurmurhash

Summary: This is not used by live code anymore.

Reviewed By: cpojer

Differential Revision: D5029114

fbshipit-source-id: 9ab9f6075407623debfe23bc121cc48ae8903917
This commit is contained in:
Jean Lauliac 2017-05-10 03:44:54 -07:00 committed by Facebook Github Bot
parent 89822280cb
commit 99661854de
4 changed files with 10 additions and 11 deletions

View File

@ -10,7 +10,7 @@
jest jest
.unmock('stream') .unmock('stream')
.unmock('imurmurhash') .unmock('crypto')
.unmock('../../lib/ModuleTransport') .unmock('../../lib/ModuleTransport')
.unmock('../'); .unmock('../');

View File

@ -9,7 +9,7 @@
'use strict'; 'use strict';
const imurmurhash = require('imurmurhash'); const crypto = require('crypto');
const jsonStableStringify = require('json-stable-stringify'); const jsonStableStringify = require('json-stable-stringify');
const transformCache = new Map(); const transformCache = new Map();
@ -23,10 +23,11 @@ const mock = {
}; };
const transformCacheKeyOf = props => const transformCacheKeyOf = props =>
props.filePath + '-' + imurmurhash(props.sourceCode) props.filePath + '-' + crypto.createHash('md5')
.hash(props.getTransformCacheKey(props.sourceCode, props.filePath, props.transformOptions)) .update(props.sourceCode)
.hash(jsonStableStringify(props.transformOptions || {})) .update(props.getTransformCacheKey(props.sourceCode, props.filePath, props.transformOptions))
.result().toString(16); .update(jsonStableStringify(props.transformOptions || {}))
.digest('hex');
function writeSync(props) { function writeSync(props) {
transformCache.set(transformCacheKeyOf(props), props.result); transformCache.set(transformCacheKeyOf(props), props.result);

View File

@ -10,14 +10,12 @@
'use strict'; 'use strict';
jest jest
.dontMock('imurmurhash')
.dontMock('json-stable-stringify') .dontMock('json-stable-stringify')
.dontMock('../TransformCache') .dontMock('../TransformCache')
.dontMock('left-pad') .dontMock('left-pad')
.dontMock('lodash/throttle') .dontMock('lodash/throttle')
.dontMock('crypto'); .dontMock('crypto');
const imurmurhash = require('imurmurhash');
const crypto = require('crypto'); const crypto = require('crypto');
const jsonStableStringify = require('json-stable-stringify'); const jsonStableStringify = require('json-stable-stringify');
@ -73,7 +71,7 @@ describe('TransformCache', () => {
result: { result: {
code: `/* result for ${key} */`, code: `/* result for ${key} */`,
dependencies: ['foo', `dep of ${key}`], dependencies: ['foo', `dep of ${key}`],
dependencyOffsets: [12, imurmurhash('dep' + key).result()], dependencyOffsets: [12, 34],
map: {desc: `source map for ${key}`}, map: {desc: `source map for ${key}`},
}, },
}; };
@ -108,7 +106,7 @@ describe('TransformCache', () => {
result: { result: {
code: `/* result for ${key} */`, code: `/* result for ${key} */`,
dependencies: ['foo', 'bar'], dependencies: ['foo', 'bar'],
dependencyOffsets: [12, imurmurhash('dep' + key).result()], dependencyOffsets: [12, 34],
map: {desc: `source map for ${key}`}, map: {desc: `source map for ${key}`},
}, },
}; };

View File

@ -11,7 +11,7 @@
jest jest
.dontMock('absolute-path') .dontMock('absolute-path')
.dontMock('json-stable-stringify') .dontMock('json-stable-stringify')
.dontMock('imurmurhash') .dontMock('crypto')
.dontMock('../lib/replacePatterns') .dontMock('../lib/replacePatterns')
.dontMock('../DependencyGraph/docblock') .dontMock('../DependencyGraph/docblock')
.dontMock('../Module'); .dontMock('../Module');