mirror of https://github.com/status-im/metro.git
Simplify the inlineRequires transform option on incremental builds
Reviewed By: davidaurelio Differential Revision: D6533845 fbshipit-source-id: ae38defafe70344d0bb0b80d2266dff0e9b273b1
This commit is contained in:
parent
5e65dfcf81
commit
6f0d786e57
|
@ -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}],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue