Remove redundant calls for addModuleIdsToModuleWrapper

Reviewed By: davidaurelio

Differential Revision: D5526561

fbshipit-source-id: e3452899062587d3b4b5f87a7de01cb0be7a3cb9
This commit is contained in:
Miguel Jimenez Esun 2017-08-01 09:45:33 -07:00 committed by Facebook Github Bot
parent 35e5b486c3
commit 38fce3a7fb
3 changed files with 7 additions and 18 deletions

View File

@ -13,7 +13,8 @@
declare var jest: any; declare var jest: any;
const indexedRamBundle = require('../indexed-ram-bundle'); const indexedRamBundle = require('../indexed-ram-bundle');
const {addModuleIdsToModuleWrapper} = require('../util');
const {getModuleCode} = require('../util');
declare var describe: any; declare var describe: any;
declare var expect: any; declare var expect: any;
@ -240,10 +241,7 @@ function makeDependency(name) {
} }
function expectedCode(module) { function expectedCode(module) {
const {file} = module; return getModuleCode(module, idForPath);
return file.type === 'module'
? addModuleIdsToModuleWrapper(module, idForPath)
: file.code;
} }
function getId(path) { function getId(path) {

View File

@ -14,7 +14,7 @@ declare var jest: any;
const multipleFilesRamBundle = require('../multiple-files-ram-bundle'); const multipleFilesRamBundle = require('../multiple-files-ram-bundle');
const {addModuleIdsToModuleWrapper} = require('../util'); const {getModuleCode} = require('../util');
declare var describe: any; declare var describe: any;
declare var expect: any; declare var expect: any;
@ -76,7 +76,7 @@ it('bundles each file separately', () => {
modules.forEach((module, i) => { modules.forEach((module, i) => {
// $FlowFixMe "extraFiles" is always defined at this point. // $FlowFixMe "extraFiles" is always defined at this point.
expect(extraFiles.get(`js-modules/${i}.js`).toString()) expect(extraFiles.get(`js-modules/${i}.js`).toString())
.toBe(expectedCode(modules[i])); .toBe(getModuleCode(modules[i], idForPath));
}); });
}); });
@ -132,13 +132,6 @@ function makeDependency(name) {
}; };
} }
function expectedCode(module) {
const {file} = module;
return file.type === 'module'
? addModuleIdsToModuleWrapper(module, idForPath)
: file.code;
}
function getId(path) { function getId(path) {
if (path === requireCall.file.path) { if (path === requireCall.file.path) {
return -1; return -1;

View File

@ -13,7 +13,7 @@
const meta = require('../../shared/output/meta'); const meta = require('../../shared/output/meta');
const {createIndexMap} = require('./source-map'); const {createIndexMap} = require('./source-map');
const {addModuleIdsToModuleWrapper, concat} = require('./util'); const {getModuleCode, concat} = require('./util');
import type {OutputFn} from '../types.flow'; import type {OutputFn} from '../types.flow';
@ -30,9 +30,7 @@ function asPlainBundle({
for (const module of concat(modules, requireCalls)) { for (const module of concat(modules, requireCalls)) {
const {file} = module; const {file} = module;
const moduleCode = file.type === 'module' const moduleCode = getModuleCode(module, idForPath);
? addModuleIdsToModuleWrapper(module, idForPath)
: file.code;
code += moduleCode + '\n'; code += moduleCode + '\n';
if (file.map) { if (file.map) {