mirror of https://github.com/status-im/metro.git
Remove .meta files generation from metro
Reviewed By: davidaurelio Differential Revision: D7347623 fbshipit-source-id: 29c8b79771566178ea8f720a93bd73df678c7807
This commit is contained in:
parent
b05f9692e7
commit
c35f1a2c01
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
const Server = require('../../Server');
|
const Server = require('../../Server');
|
||||||
|
|
||||||
const meta = require('./meta');
|
|
||||||
const relativizeSourceMapInline = require('../../lib/relativizeSourceMap');
|
const relativizeSourceMapInline = require('../../lib/relativizeSourceMap');
|
||||||
const writeFile = require('./writeFile');
|
const writeFile = require('./writeFile');
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ function relativateSerializedMap(
|
||||||
return JSON.stringify(sourceMap);
|
return JSON.stringify(sourceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveBundleAndMap(
|
async function saveBundleAndMap(
|
||||||
bundle: {code: string, map: string},
|
bundle: {code: string, map: string},
|
||||||
options: OutputOptions,
|
options: OutputOptions,
|
||||||
log: (...args: Array<string>) => void,
|
log: (...args: Array<string>) => void,
|
||||||
|
@ -51,18 +50,13 @@ function saveBundleAndMap(
|
||||||
sourcemapSourcesRoot,
|
sourcemapSourcesRoot,
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
log('Writing bundle output to:', bundleOutput);
|
const writeFns = [];
|
||||||
|
|
||||||
const {code} = bundle;
|
writeFns.push(async () => {
|
||||||
const writeBundle = writeFile(bundleOutput, code, encoding);
|
log('Writing bundle output to:', bundleOutput);
|
||||||
const writeMetadata = writeFile(
|
await writeFile(bundleOutput, bundle.code, encoding);
|
||||||
bundleOutput + '.meta',
|
log('Done writing bundle output');
|
||||||
meta(code, encoding),
|
});
|
||||||
'binary',
|
|
||||||
);
|
|
||||||
Promise.all([writeBundle, writeMetadata]).then(() =>
|
|
||||||
log('Done writing bundle output'),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
let {map} = bundle;
|
let {map} = bundle;
|
||||||
|
@ -72,13 +66,15 @@ function saveBundleAndMap(
|
||||||
log('finished relativating');
|
log('finished relativating');
|
||||||
}
|
}
|
||||||
|
|
||||||
log('Writing sourcemap output to:', sourcemapOutput);
|
writeFns.push(async () => {
|
||||||
const writeMap = writeFile(sourcemapOutput, map, null);
|
log('Writing sourcemap output to:', sourcemapOutput);
|
||||||
writeMap.then(() => log('Done writing sourcemap output'));
|
await writeFile(sourcemapOutput, map, null);
|
||||||
return Promise.all([writeBundle, writeMetadata, writeMap]);
|
log('Done writing sourcemap output');
|
||||||
} else {
|
});
|
||||||
return writeBundle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait until everything is written to disk.
|
||||||
|
await Promise.all(writeFns.map(cb => cb()));
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.build = buildBundle;
|
exports.build = buildBundle;
|
||||||
|
|
Loading…
Reference in New Issue