From 9485a37fe0de878752d42dcdde53628d21d66074 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Fri, 15 Dec 2017 06:21:11 -0800 Subject: [PATCH] Move formatBanner to metro-core Reviewed By: rafeca Differential Revision: D6555773 fbshipit-source-id: 9d10a3d03c88eeaa2d6845518da3dacab8b556b0 --- .../src/formatBanner}/formatBanner.js | 4 ++++ packages/metro-core/src/formatBanner/index.js | 17 +++++++++++++++++ packages/metro-core/src/index.js | 7 ++++++- packages/metro/src/lib/TerminalReporter.js | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) rename packages/{metro/src/lib => metro-core/src/formatBanner}/formatBanner.js (93%) create mode 100644 packages/metro-core/src/formatBanner/index.js diff --git a/packages/metro/src/lib/formatBanner.js b/packages/metro-core/src/formatBanner/formatBanner.js similarity index 93% rename from packages/metro/src/lib/formatBanner.js rename to packages/metro-core/src/formatBanner/formatBanner.js index 3553572a..e11bacbc 100644 --- a/packages/metro/src/lib/formatBanner.js +++ b/packages/metro-core/src/formatBanner/formatBanner.js @@ -6,6 +6,7 @@ * 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. * + * Note: This file runs BEFORE transforms so DO NOT ADD ES6 or Flow in code! * @format */ @@ -44,6 +45,9 @@ var BOTTOM_RIGHT = '\u2518'; * // Space between the right banner border and the text (default = 2) * paddingRight: number; * }; + * + * @PrettierFixMe can't use comment-style flow syntax because prettier strips it + * https://github.com/prettier/prettier/issues/204 */ function formatBanner(message, options) { options = options || {}; diff --git a/packages/metro-core/src/formatBanner/index.js b/packages/metro-core/src/formatBanner/index.js new file mode 100644 index 00000000..9c38f7cc --- /dev/null +++ b/packages/metro-core/src/formatBanner/index.js @@ -0,0 +1,17 @@ +/** + * 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 formatBanner = require('./formatBanner'); + +module.exports = formatBanner; diff --git a/packages/metro-core/src/index.js b/packages/metro-core/src/index.js index aff856bf..f0cb2763 100644 --- a/packages/metro-core/src/index.js +++ b/packages/metro-core/src/index.js @@ -14,4 +14,9 @@ const Terminal = require('./Terminal'); -module.exports = {Terminal}; +const formatBanner = require('./formatBanner'); + +module.exports = { + Terminal, + formatBanner, +}; diff --git a/packages/metro/src/lib/TerminalReporter.js b/packages/metro/src/lib/TerminalReporter.js index f80ffeee..66dbdfdb 100644 --- a/packages/metro/src/lib/TerminalReporter.js +++ b/packages/metro/src/lib/TerminalReporter.js @@ -13,7 +13,6 @@ 'use strict'; const chalk = require('chalk'); -const formatBanner = require('./formatBanner'); const path = require('path'); const reporting = require('./reporting'); const throttle = require('lodash/throttle'); @@ -21,6 +20,7 @@ const throttle = require('lodash/throttle'); const { AmbiguousModuleResolutionError, } = require('../node-haste/DependencyGraph/ResolutionRequest'); +const {formatBanner} = require('metro-core'); import type {BundleOptions} from '../shared/types.flow'; import type {ReportableEvent, GlobalCacheDisabledReason} from './reporting';