How to use the metro-source-map.toSegmentTuple 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 Marwan01 / food-converter / node_modules / metro / src / JSTransformer / worker.js View on Github external
const inlineRequiresPlugin = require("babel-preset-fbjs/plugins/inline-requires");

const normalizePseudoglobals = require("./worker/normalizePseudoglobals");

const _require = require("@babel/core"),
  transformFromAstSync = _require.transformFromAstSync;

const _require2 = require("metro-cache"),
  stableHash = _require2.stableHash;

const types = require("@babel/types");

const _require3 = require("metro-source-map"),
  fromRawMappings = _require3.fromRawMappings,
  toBabelSegments = _require3.toBabelSegments,
  toSegmentTuple = _require3.toSegmentTuple;

function getDynamicDepsBehavior(inPackages, filename) {
  switch (inPackages) {
    case "reject":
      return "reject";

    case "throwAtRuntime":
      const isPackage = /(?:^|[/\\])node_modules[/\\]/.test(filename);
      return isPackage ? inPackages : "reject";

    default:
      inPackages;
      throw new Error(
        `invalid value for dynamic deps behavior: \`${inPackages}\``
      );
  }
github Marwan01 / food-converter / node_modules / metro / src / legacy.js View on Github external
} else {
    obj[key] = value;
  }
  return obj;
}

const blacklist = require("metro-config/src/defaults/blacklist");

const invariant = require("invariant");

const _require = require("metro-core"),
  Logger = _require.Logger;

const _require2 = require("metro-source-map"),
  fromRawMappings = _require2.fromRawMappings,
  toSegmentTuple = _require2.toSegmentTuple;

exports.createBlacklist = blacklist;
exports.sourceMaps = {
  fromRawMappings,
  compactMapping: toSegmentTuple
};
exports.createServer = createServer;
exports.Logger = Logger;

/**
 * This is a public API, so we don't trust the value and purposefully downgrade
 * it as `mixed`. Because it understands `invariant`, Flow ensure that we
 * refine these values completely.
 */
function assertPublicBundleOptions(bo) {
  invariant(