How to use the metro-core.Logger function in metro-core

To help you get started, we’ve selected a few metro-core 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 alan-ai / alan-sdk-reactnative / testtools / node_modules / metro / src / node-haste / DependencyGraph.js View on Github external
const ModuleCache = require("./ModuleCache");

const ResolutionRequest = require("./DependencyGraph/ResolutionRequest");

const fs = require("fs");

const path = require("path");

const _require = require("./DependencyGraph/ModuleResolution"),
  ModuleResolver = _require.ModuleResolver;

const _require2 = require("events"),
  EventEmitter = _require2.EventEmitter;

const _require3 = require("metro-core"),
  _require3$Logger = _require3.Logger,
  createActionStartEntry = _require3$Logger.createActionStartEntry,
  createActionEndEntry = _require3$Logger.createActionEndEntry,
  log = _require3$Logger.log;

const JEST_HASTE_MAP_CACHE_BREAKER = 4;

class DependencyGraph extends EventEmitter {
  constructor(_ref) {
    let config = _ref.config,
      haste = _ref.haste,
      initialHasteFS = _ref.initialHasteFS,
      initialModuleMap = _ref.initialModuleMap;
    super();

    _defineProperty(this, "_doesFileExist", filePath => {
      return this._hasteFS.exists(filePath);
github alan-ai / alan-sdk-reactnative / testtools / node_modules / metro / src / HmrServer.js View on Github external
const hmrJSBundle = require("./DeltaBundler/Serializers/hmrJSBundle");

const logToConsole = require("./lib/logToConsole");

const nullthrows = require("nullthrows");

const parseOptionsFromUrl = require("./lib/parseOptionsFromUrl");

const splitBundleOptions = require("./lib/splitBundleOptions");

const transformHelpers = require("./lib/transformHelpers");

const url = require("url");

const _require = require("metro-core"),
  _require$Logger = _require.Logger,
  createActionStartEntry = _require$Logger.createActionStartEntry,
  createActionEndEntry = _require$Logger.createActionEndEntry,
  log = _require$Logger.log;

function send(sendFns, message) {
  const strMessage = JSON.stringify(message);
  sendFns.forEach(sendFn => sendFn(strMessage));
}
/**
 * The HmrServer (Hot Module Reloading) implements a lightweight interface
 * to communicate easily to the logic in the React Native repository (which
 * is the one that handles the Web Socket connections).
 *
 * This interface allows the HmrServer to hook its own logic to WS clients
 * getting connected, disconnected or having errors (through the
 * `onClientConnect`, `onClientDisconnect` and `onClientError` methods).
github alan-ai / alan-sdk-reactnative / testtools / node_modules / metro / src / DeltaBundler / WorkerFarm.js View on Github external
var gen = fn.apply(self, args);
      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }
      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }
      _next(undefined);
    });
  };
}

const chalk = require("chalk");

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

const JestWorker = require("jest-worker").default;

class WorkerFarm {
  constructor(config, transformerConfig) {
    this._config = config;
    this._transformerConfig = transformerConfig;

    if (this._config.maxWorkers > 1) {
      const worker = this._makeFarm(
        this._config.transformer.workerPath,
        ["transform"],
        this._config.maxWorkers
      );

      worker.getStdout().on("data", chunk => {
github alan-ai / alan-sdk-reactnative / testtools / node_modules / metro / src / Server.js View on Github external
const url = require("url");

const ResourceNotFoundError = require("./IncrementalBundler/ResourceNotFoundError");

const RevisionNotFoundError = require("./IncrementalBundler/RevisionNotFoundError");

const _require = require("./Assets"),
  getAsset = _require.getAsset;

const _require2 = require("./DeltaBundler/Serializers/getExplodedSourceMap"),
  getExplodedSourceMap = _require2.getExplodedSourceMap;

const _require3 = require("metro-core"),
  Logger = _require3.Logger,
  _require3$Logger = _require3.Logger,
  createActionStartEntry = _require3$Logger.createActionStartEntry,
  createActionEndEntry = _require3$Logger.createActionEndEntry,
  log = _require3$Logger.log;

function debounceAndBatch(fn, delay) {
  let timeout;
  return () => {
    clearTimeout(timeout);
    timeout = setTimeout(fn, delay);
  };
}

const DELTA_ID_HEADER = "X-Metro-Delta-ID";
const FILES_CHANGED_COUNT_HEADER = "X-Metro-Files-Changed-Count";

class Server {
github Marwan01 / food-converter / node_modules / metro / src / legacy.js View on Github external
enumerable: true,
      configurable: true,
      writable: true
    });
  } 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
github Marwan01 / food-converter / node_modules / metro / src / Server.js View on Github external
const serializeDeltaJSBundle = require("./DeltaBundler/Serializers/helpers/serializeDeltaJSBundle");

const symbolicate = require("./Server/symbolicate/symbolicate");

const url = require("url");

const ResourceNotFoundError = require("./IncrementalBundler/ResourceNotFoundError");

const RevisionNotFoundError = require("./IncrementalBundler/RevisionNotFoundError");

const _require = require("./Assets"),
  getAsset = _require.getAsset;

const _require2 = require("metro-core"),
  Logger = _require2.Logger,
  _require2$Logger = _require2.Logger,
  createActionStartEntry = _require2$Logger.createActionStartEntry,
  createActionEndEntry = _require2$Logger.createActionEndEntry,
  log = _require2$Logger.log;

function debounceAndBatch(fn, delay) {
  let timeout;
  return () => {
    clearTimeout(timeout);
    timeout = setTimeout(fn, delay);
  };
}

const DELTA_ID_HEADER = "X-Metro-Delta-ID";
const FILES_CHANGED_COUNT_HEADER = "X-Metro-Files-Changed-Count";
github Marwan01 / food-converter / node_modules / metro / src / Server.js View on Github external
const serializeDeltaJSBundle = require("./DeltaBundler/Serializers/helpers/serializeDeltaJSBundle");

const symbolicate = require("./Server/symbolicate/symbolicate");

const url = require("url");

const ResourceNotFoundError = require("./IncrementalBundler/ResourceNotFoundError");

const RevisionNotFoundError = require("./IncrementalBundler/RevisionNotFoundError");

const _require = require("./Assets"),
  getAsset = _require.getAsset;

const _require2 = require("metro-core"),
  Logger = _require2.Logger,
  _require2$Logger = _require2.Logger,
  createActionStartEntry = _require2$Logger.createActionStartEntry,
  createActionEndEntry = _require2$Logger.createActionEndEntry,
  log = _require2$Logger.log;

function debounceAndBatch(fn, delay) {
  let timeout;
  return () => {
    clearTimeout(timeout);
    timeout = setTimeout(fn, delay);
  };
}

const DELTA_ID_HEADER = "X-Metro-Delta-ID";
const FILES_CHANGED_COUNT_HEADER = "X-Metro-Files-Changed-Count";

class Server {
github Marwan01 / food-converter / node_modules / metro-cache / src / Cache.js View on Github external
args = arguments;
    return new Promise(function(resolve, reject) {
      var gen = fn.apply(self, args);
      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }
      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }
      _next(undefined);
    });
  };
}

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

/**
 * Main cache class. Receives an array of cache instances, and sequentially
 * traverses them to return a previously stored value. It also ensures setting
 * the value in all instances.
 *
 * All get/set operations are logged via Metro's logger.
 */
class Cache {
  constructor(stores) {
    this._hits = new WeakMap();
    this._stores = stores;
  }

  get(key) {
    var _this = this;
github Marwan01 / food-converter / node_modules / metro / src / node-haste / DependencyGraph.js View on Github external
const ModuleCache = require("./ModuleCache");

const ResolutionRequest = require("./DependencyGraph/ResolutionRequest");

const fs = require("fs");

const path = require("path");

const _require = require("./DependencyGraph/ModuleResolution"),
  ModuleResolver = _require.ModuleResolver;

const _require2 = require("events"),
  EventEmitter = _require2.EventEmitter;

const _require3 = require("metro-core"),
  _require3$Logger = _require3.Logger,
  createActionStartEntry = _require3$Logger.createActionStartEntry,
  createActionEndEntry = _require3$Logger.createActionEndEntry,
  log = _require3$Logger.log;

const JEST_HASTE_MAP_CACHE_BREAKER = 4;

class DependencyGraph extends EventEmitter {
  constructor(_ref) {
    let config = _ref.config,
      haste = _ref.haste,
      initialHasteFS = _ref.initialHasteFS,
      initialModuleMap = _ref.initialModuleMap;
    super();

    _defineProperty(this, "_doesFileExist", filePath => {
      return this._hasteFS.exists(filePath);
github Marwan01 / food-converter / node_modules / metro / src / HmrServer.js View on Github external
const getGraphId = require("./lib/getGraphId");

const hmrJSBundle = require("./DeltaBundler/Serializers/hmrJSBundle");

const nullthrows = require("nullthrows");

const parseOptionsFromUrl = require("./lib/parseOptionsFromUrl");

const splitBundleOptions = require("./lib/splitBundleOptions");

const transformHelpers = require("./lib/transformHelpers");

const url = require("url");

const _require = require("metro-core"),
  _require$Logger = _require.Logger,
  createActionStartEntry = _require$Logger.createActionStartEntry,
  createActionEndEntry = _require$Logger.createActionEndEntry,
  log = _require$Logger.log;

function send(sendFns, message) {
  const strMessage = JSON.stringify(message);
  sendFns.forEach(sendFn => sendFn(strMessage));
}
/**
 * The HmrServer (Hot Module Reloading) implements a lightweight interface
 * to communicate easily to the logic in the React Native repository (which
 * is the one that handles the Web Socket connections).
 *
 * This interface allows the HmrServer to hook its own logic to WS clients
 * getting connected, disconnected or having errors (through the
 * `onClientConnect`, `onClientDisconnect` and `onClientError` methods).