How to use the metro-source-map.composeSourceMaps function in metro-source-map

To help you get started, we’ve selected a few metro-source-map examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / react-native / scripts / compose-source-maps.js View on Github external
) {
    throw new Error(
      'Random Access Bundle (RAM) format is not supported by this tool; ' +
        'it cannot process the `x_facebook_offsets` field provided ' +
        'in the base and/or target source map(s)',
    );
  }

  if (compilerSourcemap.x_facebook_segments != null) {
    throw new Error(
      'This tool cannot process the `x_facebook_segments` field provided ' +
        'in the target source map.',
    );
  }

  const composedMapJSON = JSON.stringify(composeSourceMaps([packagerSourcemap, compilerSourcemap]));
  if (outputPath) {
    fs.writeFileSync(outputPath, composedMapJSON, 'utf8');
  } else {
    process.stdout.write();
  }
}