Output `.meta` files for plain bundles

Summary: Outputs `.meta` files for plain text bundles just like “old packager” did.

Reviewed By: jeanlauliac, cpojer

Differential Revision: D5077649

fbshipit-source-id: eb87999dd899066adeb9756333adb4d79ce04832
This commit is contained in:
David Aurelio 2017-05-17 07:16:21 -07:00 committed by Facebook Github Bot
parent b512cf62af
commit 9ffddb1b32
2 changed files with 9 additions and 2 deletions

View File

@ -10,6 +10,8 @@
*/ */
'use strict'; 'use strict';
const meta = require('../../../../local-cli/bundle/output/meta');
const {createIndexMap} = require('./source-map'); const {createIndexMap} = require('./source-map');
const {addModuleIdsToModuleWrapper} = require('./util'); const {addModuleIdsToModuleWrapper} = require('./util');
@ -41,7 +43,11 @@ module.exports = (
code += `/*# sourceMappingURL=${sourceMapPath}*/`; code += `/*# sourceMappingURL=${sourceMapPath}*/`;
} }
return {code, map: createIndexMap({file: filename, sections})}; return {
code,
extraFiles: [[`${filename}.meta`, meta(code)]],
map: createIndexMap({file: filename, sections}),
};
}: OutputFn); }: OutputFn);
const reLine = /^/gm; const reLine = /^/gm;

View File

@ -78,7 +78,8 @@ export type OutputFn = (
) => OutputResult; ) => OutputResult;
type OutputResult = {| type OutputResult = {|
code: string, code: string | Buffer,
extraFiles: Iterable<[string, string | Buffer]>,
map: SourceMap, map: SourceMap,
|}; |};