From 8654b558cac4b6c415d9af289ad4ddf1ad680afd Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Tue, 12 Sep 2017 22:31:46 -0700 Subject: [PATCH] fix output path for the UNBUNDLE magic file Summary: Fixed the UNBUNDLE magic file location to match what JniJSModulesUnbundle.cpp expects. Reviewed By: sahrens Differential Revision: D5821637 fbshipit-source-id: 4342e4bb4d139b4eba77dd92a53b1683041fc7e9 --- .../output/__tests__/multiple-files-ram-bundle-test.js | 6 ++++-- .../src/ModuleGraph/output/multiple-files-ram-bundle.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/metro-bundler/src/ModuleGraph/output/__tests__/multiple-files-ram-bundle-test.js b/packages/metro-bundler/src/ModuleGraph/output/__tests__/multiple-files-ram-bundle-test.js index 2cbe51fa..79152eea 100644 --- a/packages/metro-bundler/src/ModuleGraph/output/__tests__/multiple-files-ram-bundle-test.js +++ b/packages/metro-bundler/src/ModuleGraph/output/__tests__/multiple-files-ram-bundle-test.js @@ -70,9 +70,11 @@ it('creates a source map', () => { it('creates a magic file with the number', () => { expect(extraFiles).toBeDefined(); // $FlowFixMe "extraFiles" is always defined at this point. - expect(extraFiles.get('UNBUNDLE')).toBeDefined(); + expect(extraFiles.get('js-modules/UNBUNDLE')).toBeDefined(); // $FlowFixMe "extraFiles" is always defined at this point. - expect(extraFiles.get('UNBUNDLE').readUInt32LE(0)).toBe(0xfb0bd1e5); + expect(extraFiles.get('js-modules/UNBUNDLE').readUInt32LE(0)).toBe( + 0xfb0bd1e5, + ); }); it('bundles each file separately', () => { diff --git a/packages/metro-bundler/src/ModuleGraph/output/multiple-files-ram-bundle.js b/packages/metro-bundler/src/ModuleGraph/output/multiple-files-ram-bundle.js index 8063931d..711067c8 100644 --- a/packages/metro-bundler/src/ModuleGraph/output/multiple-files-ram-bundle.js +++ b/packages/metro-bundler/src/ModuleGraph/output/multiple-files-ram-bundle.js @@ -50,7 +50,10 @@ function asMultipleFilesRamBundle({ // Prepare and write magic number file. magicFileContents.writeUInt32LE(MAGIC_UNBUNDLE_NUMBER, 0); - extraFiles.set(MAGIC_UNBUNDLE_FILENAME, magicFileContents); + extraFiles.set( + path.join(JS_MODULES, MAGIC_UNBUNDLE_FILENAME), + magicFileContents, + ); // Create the source map (with no module groups, as they are ignored). const map = buildSourceMapWithMetaData({