Simplify the inlineRequires transform option on incremental builds

Reviewed By: davidaurelio

Differential Revision: D6533845

fbshipit-source-id: ae38defafe70344d0bb0b80d2266dff0e9b273b1
This commit is contained in:
Rafael Oleza 2017-12-11 12:50:22 -08:00 committed by Facebook Github Bot
parent 5e65dfcf81
commit 6f0d786e57
2 changed files with 41 additions and 1 deletions

View File

@ -276,4 +276,44 @@ describe('edge cases', () => {
mockShallowDependencies('/bar', '/foo');
await assertOrder();
});
it('should simplify inlineRequires transform option', async () => {
jest.spyOn(dependencyGraph, 'getShallowDependencies');
const edges = new Map();
const transformOptions = {
inlineRequires: {
blacklist: {
'/baz': true,
},
},
};
await initialTraverseDependencies(
'/bundle',
dependencyGraph,
transformOptions,
edges,
);
expect(dependencyGraph.getShallowDependencies.mock.calls).toEqual([
['/bundle', {inlineRequires: true}],
['/foo', {inlineRequires: true}],
['/bar', {inlineRequires: true}],
['/baz', {inlineRequires: false}],
]);
dependencyGraph.getShallowDependencies.mockClear();
await traverseDependencies(
['/foo'],
dependencyGraph,
transformOptions,
edges,
);
expect(dependencyGraph.getShallowDependencies.mock.calls).toEqual([
['/foo', {inlineRequires: true}],
]);
});
});

View File

@ -112,7 +112,7 @@ async function traverseDependenciesForSingleFile(
const shallow = await dependencyGraph.getShallowDependencies(
path,
transformOptions,
removeInlineRequiresBlacklistFromOptions(path, transformOptions),
);
// Get the absolute path of all sub-dependencies (some of them could have been