packager: fix lint

Reviewed By: matryoshcow

Differential Revision: D4160163

fbshipit-source-id: 8eeb7dd83c0d80c1c62b760039615ce97782bd3e
This commit is contained in:
Jean Lauliac 2016-11-11 05:22:28 -08:00 committed by Facebook Github Bot
parent f13c4e3d78
commit cedf70f702
4 changed files with 20 additions and 14 deletions

View File

@ -327,7 +327,7 @@ class Bundler {
response.dependencies = moduleSystemDeps.concat(response.dependencies);
}
};
const finalizeBundle = ({bundle, transformedModules, response, modulesByName}: {
const finalizeBundle = ({bundle: finalBundle, transformedModules, response, modulesByName}: {
bundle: Bundle,
transformedModules: Array<{module: Module, transformed: {}}>,
response: ResolutionResponse,
@ -335,7 +335,7 @@ class Bundler {
}) =>
Promise.all(
transformedModules.map(({module, transformed}) =>
bundle.addModule(this._resolver, response, module, transformed)
finalBundle.addModule(this._resolver, response, module, transformed)
)
).then(() => {
const runBeforeMainModuleIds = Array.isArray(runBeforeMainModule)
@ -347,12 +347,12 @@ class Bundler {
.map(response.getModuleId)
: undefined;
bundle.finalize({
finalBundle.finalize({
runMainModule,
runBeforeMainModule: runBeforeMainModuleIds,
allowUpdates: this._opts.allowBundleUpdates,
});
return bundle;
return finalBundle;
});
return this._buildBundle({

View File

@ -251,8 +251,14 @@ function readMetadataFileSync(
if (
typeof cachedResultHash !== 'number' ||
typeof cachedSourceHash !== 'number' ||
!(Array.isArray(dependencies) && dependencies.every(dep => typeof dep === 'string')) ||
!(Array.isArray(dependencyOffsets) && dependencyOffsets.every(offset => typeof offset === 'number')) ||
!(
Array.isArray(dependencies) &&
dependencies.every(dep => typeof dep === 'string')
) ||
!(
Array.isArray(dependencyOffsets) &&
dependencyOffsets.every(offset => typeof offset === 'number')
) ||
!(sourceMap == null || typeof sourceMap === 'object')
) {
return null;

View File

@ -6189,7 +6189,7 @@ describe('DependencyGraph', function() {
main.resolve();
return dependenciesPromise;
}).then(result => {
const names = result.map(({path}) => path.split('/').pop());
const names = result.map(({path: resultPath}) => resultPath.split('/').pop());
expect(names).toEqual([
'index.js',
'a.js',
@ -6214,7 +6214,7 @@ describe('DependencyGraph', function() {
main.resolve();
return dependenciesPromise;
}).then(result => {
const names = result.map(({path}) => path.split('/').pop());
const names = result.map(({path: resultPath}) => resultPath.split('/').pop());
expect(names).toEqual([
'index.js',
'a.js',

View File

@ -260,14 +260,14 @@ describe('Module', () => {
pit('passes the module and file contents to the transform if the file is annotated with @extern', () => {
const module = createModule({transformCode});
const fileContents = `
const customFileContents = `
/**
* @extern
*/
`;
mockIndexFile(fileContents);
mockIndexFile(customFileContents);
return module.read().then(() => {
expect(transformCode).toBeCalledWith(module, fileContents, {extern: true});
expect(transformCode).toBeCalledWith(module, customFileContents, {extern: true});
});
});
@ -281,17 +281,17 @@ describe('Module', () => {
pit('does not extend the passed options object if the file is annotated with @extern', () => {
const module = createModule({transformCode});
const fileContents = `
const customFileContents = `
/**
* @extern
*/
`;
mockIndexFile(fileContents);
mockIndexFile(customFileContents);
const options = {arbitrary: 'foo'};
return module.read(options).then(() => {
expect(options).not.toEqual(jasmine.objectContaining({extern: true}));
expect(transformCode)
.toBeCalledWith(module, fileContents, {...options, extern: true});
.toBeCalledWith(module, customFileContents, {...options, extern: true});
});
});