diff --git a/packages/metro-bundler/src/ModuleGraph/ModuleGraph.js b/packages/metro-bundler/src/ModuleGraph/ModuleGraph.js index 2c6c905e..4518ca50 100644 --- a/packages/metro-bundler/src/ModuleGraph/ModuleGraph.js +++ b/packages/metro-bundler/src/ModuleGraph/ModuleGraph.js @@ -92,7 +92,7 @@ exports.createBuildSetup = ( const prependedScripts = [preludeScript, ...moduleSystem, ...polyfills]; callback(null, { entryModules, - modules: concat(prependedScripts, modules), + modules: prependedScripts.concat(modules), prependedScripts, }); }); diff --git a/packages/metro-bundler/src/ModuleGraph/__tests__/ModuleGraph-test.js b/packages/metro-bundler/src/ModuleGraph/__tests__/ModuleGraph-test.js index 352e3e2f..9607ae20 100644 --- a/packages/metro-bundler/src/ModuleGraph/__tests__/ModuleGraph-test.js +++ b/packages/metro-bundler/src/ModuleGraph/__tests__/ModuleGraph-test.js @@ -68,7 +68,7 @@ describe('build setup', () => { it('places polyfills after the module system', done => { buildSetup(noEntryPoints, polyfillOptions, (error, result) => { const list = polyfillOptions.getPolyfills(); - const polyfills = Array.from(result.modules).slice(2, list.length + 2); + const polyfills = result.modules.slice(2, list.length + 2); expect(polyfills).toEqual(list.map(moduleFromPath)); done(); }); @@ -77,7 +77,7 @@ describe('build setup', () => { it('places all entry points and dependencies at the end, post-processed', done => { const entryPoints = ['b', 'c', 'd']; buildSetup(entryPoints, noOptions, (error, result) => { - expect(Array.from(result.modules).slice(-4)) + expect(result.modules.slice(-4)) .toEqual(['a', 'b', 'c', 'd'].map(moduleFromPath)); done(); }); diff --git a/packages/metro-bundler/src/ModuleGraph/types.flow.js b/packages/metro-bundler/src/ModuleGraph/types.flow.js index 6db31c26..12496a74 100644 --- a/packages/metro-bundler/src/ModuleGraph/types.flow.js +++ b/packages/metro-bundler/src/ModuleGraph/types.flow.js @@ -52,8 +52,8 @@ type GraphOptions = {| |}; export type GraphResult = {| - entryModules: Iterable, - modules: Iterable, + entryModules: $ReadOnlyArray, + modules: $ReadOnlyArray, |}; export type IdForPathFn = {path: string} => number; @@ -163,7 +163,11 @@ export type LibraryOptions = {| |}; export type Base64Content = string; -export type AssetContentsByPath = {[destFilePath: string]: Base64Content}; +export type AssetContents = { + +data: Base64Content, + +outputPath: string, +}; +export type AssetContentsByPath = {+[moduleFilePath: string]: $ReadOnlyArray}; export type Library = {| +files: Array,