MCPcopy Index your code
hub / github.com/ptmt/react-native-macos / saveBundleAndMap

Function saveBundleAndMap

local-cli/bundle/output/bundle.js:43–79  ·  view source on GitHub ↗
(
  bundle: Bundle,
  options: OutputOptions,
  log: (x: string) => {},
)

Source from the content-addressed store, hash-verified

41}
42
43function saveBundleAndMap(
44 bundle: Bundle,
45 options: OutputOptions,
46 log: (x: string) => {},
47): Promise<> {
48 const {
49 bundleOutput,
50 bundleEncoding: encoding,
51 dev,
52 sourcemapOutput,
53 sourcemapSourcesRoot
54 } = options;
55
56 log('start');
57 const codeWithMap = createCodeWithMap(bundle, !!dev, sourcemapSourcesRoot);
58 log('finish');
59
60 log('Writing bundle output to:', bundleOutput);
61
62 const {code} = codeWithMap;
63 const writeBundle = writeFile(bundleOutput, code, encoding);
64 const writeMetadata = writeFile(
65 bundleOutput + '.meta',
66 meta(code, encoding),
67 'binary');
68 Promise.all([writeBundle, writeMetadata])
69 .then(() => log('Done writing bundle output'));
70
71 if (sourcemapOutput) {
72 log('Writing sourcemap output to:', sourcemapOutput);
73 const writeMap = writeFile(sourcemapOutput, codeWithMap.map, null);
74 writeMap.then(() => log('Done writing sourcemap output'));
75 return Promise.all([writeBundle, writeMetadata, writeMap]);
76 } else {
77 return writeBundle;
78 }
79}
80
81exports.build = buildBundle;
82exports.save = saveBundleAndMap;

Callers

nothing calls this directly

Calls 3

createCodeWithMapFunction · 0.85
logFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…