How to use the metro-source-map.toRawMappings 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 / metro / packages / metro / src / Resolver / index.js View on Github external
async minifyModule(
    path: string,
    code: string,
    map: CompactRawMappings,
  ): Promise<{code: string, map: CompactRawMappings}> {
    const sourceMap = fromRawMappings([{code, source: code, map, path}]).toMap(
      undefined,
      {},
    );

    const minified = await this._minifyCode(path, code, sourceMap);
    const result = await this._postMinifyProcess({...minified});

    return {
      code: result.code,
      map: result.map ? toRawMappings(result.map).map(compactMapping) : [],
    };
  }