mirror of https://github.com/status-im/metro.git
Move Logger to metro-core
Reviewed By: rafeca Differential Revision: D6568129 fbshipit-source-id: fc367c45e22ef58436331e1a6347ec16f1f155a0
This commit is contained in:
parent
1d12090bc3
commit
4586152ebf
|
@ -18,7 +18,26 @@ const {EventEmitter} = require('events');
|
||||||
|
|
||||||
const VERSION = require('../../package.json').version;
|
const VERSION = require('../../package.json').version;
|
||||||
|
|
||||||
import type {ActionLogEntryData, ActionStartLogEntry, LogEntry} from './Types';
|
type ActionLogEntryData = {
|
||||||
|
action_name: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
type ActionStartLogEntry = {
|
||||||
|
action_name?: string,
|
||||||
|
action_phase?: string,
|
||||||
|
log_entry_label: string,
|
||||||
|
log_session?: string,
|
||||||
|
start_timestamp?: [number, number],
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LogEntry = {
|
||||||
|
action_name?: string,
|
||||||
|
action_phase?: string,
|
||||||
|
duration_ms?: number,
|
||||||
|
log_entry_label: string,
|
||||||
|
log_session?: string,
|
||||||
|
start_timestamp?: [number, number],
|
||||||
|
};
|
||||||
|
|
||||||
const log_session = `${os.hostname()}-${Date.now()}`;
|
const log_session = `${os.hostname()}-${Date.now()}`;
|
||||||
const eventEmitter = new EventEmitter();
|
const eventEmitter = new EventEmitter();
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const Logger = require('./Logger');
|
||||||
|
|
||||||
|
export type {LogEntry} from './Logger';
|
||||||
|
|
||||||
|
module.exports = Logger;
|
|
@ -12,11 +12,13 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const Logger = require('./Logger');
|
||||||
const Terminal = require('./Terminal');
|
const Terminal = require('./Terminal');
|
||||||
|
|
||||||
const formatBanner = require('./formatBanner');
|
const formatBanner = require('./formatBanner');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Logger,
|
||||||
Terminal,
|
Terminal,
|
||||||
formatBanner,
|
formatBanner,
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ jest
|
||||||
.mock('../../node-haste/DependencyGraph')
|
.mock('../../node-haste/DependencyGraph')
|
||||||
.mock('../../JSTransformer')
|
.mock('../../JSTransformer')
|
||||||
.mock('../../Resolver')
|
.mock('../../Resolver')
|
||||||
.mock('../../Logger')
|
.mock('metro-core')
|
||||||
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
||||||
|
|
||||||
var Bundler = require('../');
|
var Bundler = require('../');
|
||||||
|
|
|
@ -16,7 +16,7 @@ jest.useRealTimers();
|
||||||
jest
|
jest
|
||||||
.mock('fs')
|
.mock('fs')
|
||||||
.mock('graceful-fs')
|
.mock('graceful-fs')
|
||||||
.mock('../../Logger')
|
.mock('metro-core')
|
||||||
.mock('../../lib/TransformCaching')
|
.mock('../../lib/TransformCaching')
|
||||||
// It's noticeably faster to prevent running watchman from FileWatcher.
|
// It's noticeably faster to prevent running watchman from FileWatcher.
|
||||||
.mock('child_process', () => ({}))
|
.mock('child_process', () => ({}))
|
||||||
|
|
|
@ -19,10 +19,8 @@ const querystring = require('querystring');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
createActionStartEntry,
|
Logger: {createActionStartEntry, createActionEndEntry, log},
|
||||||
createActionEndEntry,
|
} = require('metro-core');
|
||||||
log,
|
|
||||||
} = require('../Logger');
|
|
||||||
|
|
||||||
import type DeltaTransformer from '../DeltaBundler/DeltaTransformer';
|
import type DeltaTransformer from '../DeltaBundler/DeltaTransformer';
|
||||||
import type PackagerServer from '../Server';
|
import type PackagerServer from '../Server';
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Logger = require('../Logger');
|
const {Logger} = require('metro-core');
|
||||||
|
|
||||||
const debug = require('debug')('Metro:JStransformer');
|
const debug = require('debug')('Metro:JStransformer');
|
||||||
const Worker = require('jest-worker').default;
|
const Worker = require('jest-worker').default;
|
||||||
|
|
|
@ -26,7 +26,7 @@ const path = require('path');
|
||||||
|
|
||||||
const {compactMapping} = require('metro-source-map');
|
const {compactMapping} = require('metro-source-map');
|
||||||
|
|
||||||
import type {LogEntry} from '../../Logger/Types';
|
import type {LogEntry} from 'metro-core/src/Logger';
|
||||||
import type {CompactRawMappings, MappingsMap} from '../../lib/SourceMap';
|
import type {CompactRawMappings, MappingsMap} from '../../lib/SourceMap';
|
||||||
import type {LocalPath} from '../../node-haste/lib/toLocalPath';
|
import type {LocalPath} from '../../node-haste/lib/toLocalPath';
|
||||||
import type {ResultWithMap} from './minify';
|
import type {ResultWithMap} from './minify';
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) 2015-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*
|
|
||||||
* @flow
|
|
||||||
* @format
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export type ActionLogEntryData = {
|
|
||||||
action_name: string,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ActionStartLogEntry = {
|
|
||||||
action_name?: string,
|
|
||||||
action_phase?: string,
|
|
||||||
log_entry_label: string,
|
|
||||||
log_session?: string,
|
|
||||||
start_timestamp?: [number, number],
|
|
||||||
};
|
|
||||||
|
|
||||||
export type LogEntry = {
|
|
||||||
action_name?: string,
|
|
||||||
action_phase?: string,
|
|
||||||
duration_ms?: number,
|
|
||||||
log_entry_label: string,
|
|
||||||
log_session?: string,
|
|
||||||
start_timestamp?: [number, number],
|
|
||||||
};
|
|
|
@ -22,7 +22,7 @@ jest
|
||||||
.mock('../../Bundler')
|
.mock('../../Bundler')
|
||||||
.mock('../../Assets')
|
.mock('../../Assets')
|
||||||
.mock('../../node-haste/DependencyGraph')
|
.mock('../../node-haste/DependencyGraph')
|
||||||
.mock('../../Logger')
|
.mock('metro-core/src/Logger')
|
||||||
.mock('../../lib/GlobalTransformCache')
|
.mock('../../lib/GlobalTransformCache')
|
||||||
.mock('../../DeltaBundler/Serializers');
|
.mock('../../DeltaBundler/Serializers');
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,8 @@ import type {AssetData} from '../Assets';
|
||||||
import type {RamBundleInfo} from '../DeltaBundler/Serializers';
|
import type {RamBundleInfo} from '../DeltaBundler/Serializers';
|
||||||
import type {PostProcessModules} from '../DeltaBundler';
|
import type {PostProcessModules} from '../DeltaBundler';
|
||||||
const {
|
const {
|
||||||
createActionStartEntry,
|
Logger: {createActionStartEntry, createActionEndEntry, log},
|
||||||
createActionEndEntry,
|
} = require('metro-core');
|
||||||
log,
|
|
||||||
} = require('../Logger');
|
|
||||||
|
|
||||||
function debounceAndBatch(fn, delay) {
|
function debounceAndBatch(fn, delay) {
|
||||||
let args = [];
|
let args = [];
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Logger = require('./Logger');
|
|
||||||
const TransformCaching = require('./lib/TransformCaching');
|
const TransformCaching = require('./lib/TransformCaching');
|
||||||
|
|
||||||
const blacklist = require('./blacklist');
|
const blacklist = require('./blacklist');
|
||||||
const debug = require('debug');
|
const debug = require('debug');
|
||||||
const invariant = require('fbjs/lib/invariant');
|
const invariant = require('fbjs/lib/invariant');
|
||||||
|
|
||||||
|
const {Logger} = require('metro-core');
|
||||||
const {fromRawMappings, compactMapping} = require('metro-source-map');
|
const {fromRawMappings, compactMapping} = require('metro-source-map');
|
||||||
|
|
||||||
import type {ConfigT as MetroConfig} from './Config';
|
import type {ConfigT as MetroConfig} from './Config';
|
||||||
|
|
|
@ -26,13 +26,11 @@ const parsePlatformFilePath = require('./lib/parsePlatformFilePath');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
const {
|
|
||||||
createActionEndEntry,
|
|
||||||
createActionStartEntry,
|
|
||||||
log,
|
|
||||||
} = require('../Logger');
|
|
||||||
const {ModuleResolver} = require('./DependencyGraph/ModuleResolution');
|
const {ModuleResolver} = require('./DependencyGraph/ModuleResolution');
|
||||||
const {EventEmitter} = require('events');
|
const {EventEmitter} = require('events');
|
||||||
|
const {
|
||||||
|
Logger: {createActionStartEntry, createActionEndEntry, log},
|
||||||
|
} = require('metro-core');
|
||||||
|
|
||||||
import type {Options as JSTransformerOptions} from '../JSTransformer/worker';
|
import type {Options as JSTransformerOptions} from '../JSTransformer/worker';
|
||||||
import type {GlobalTransformCache} from '../lib/GlobalTransformCache';
|
import type {GlobalTransformCache} from '../lib/GlobalTransformCache';
|
||||||
|
|
Loading…
Reference in New Issue