From d9c7205e17638b06acdfc9aa52eb9513f371e8da Mon Sep 17 00:00:00 2001 From: Amjad Masad Date: Tue, 29 Sep 2015 16:06:42 -0700 Subject: [PATCH] Fix debug namespaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: @​public Have a top-level debug namespace: `ReactNativePackager` And add a couple of debugs in the transformer. This is ground work for adding a verbose option. Reviewed By: @DmitrySoshnikov Differential Revision: D2489960 --- .../DependencyResolver/DependencyGraph/DeprecatedAssetMap.js | 2 +- .../DependencyResolver/DependencyGraph/ResolutionRequest.js | 2 +- react-packager/src/DependencyResolver/crawlers/node.js | 2 +- react-packager/src/JSTransformer/index.js | 5 +++++ react-packager/src/SocketInterface/SocketClient.js | 2 +- react-packager/src/SocketInterface/SocketServer.js | 2 +- react-packager/src/SocketInterface/index.js | 4 ++-- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/react-packager/src/DependencyResolver/DependencyGraph/DeprecatedAssetMap.js b/react-packager/src/DependencyResolver/DependencyGraph/DeprecatedAssetMap.js index d4900b80..ca537078 100644 --- a/react-packager/src/DependencyResolver/DependencyGraph/DeprecatedAssetMap.js +++ b/react-packager/src/DependencyResolver/DependencyGraph/DeprecatedAssetMap.js @@ -11,7 +11,7 @@ const Activity = require('../../Activity'); const AssetModule_DEPRECATED = require('../AssetModule_DEPRECATED'); const Fastfs = require('../fastfs'); -const debug = require('debug')('ReactPackager:DependencyGraph'); +const debug = require('debug')('ReactNativePackager:DependencyGraph'); const path = require('path'); class DeprecatedAssetMap { diff --git a/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js b/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js index 2ed0dc9f..f3a75537 100644 --- a/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js +++ b/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js @@ -8,7 +8,7 @@ */ 'use strict'; -const debug = require('debug')('ReactPackager:DependencyGraph'); +const debug = require('debug')('ReactNativePackager:DependencyGraph'); const util = require('util'); const path = require('path'); const isAbsolutePath = require('absolute-path'); diff --git a/react-packager/src/DependencyResolver/crawlers/node.js b/react-packager/src/DependencyResolver/crawlers/node.js index 72030905..528cd5e7 100644 --- a/react-packager/src/DependencyResolver/crawlers/node.js +++ b/react-packager/src/DependencyResolver/crawlers/node.js @@ -1,7 +1,7 @@ 'use strict'; const Promise = require('promise'); -const debug = require('debug')('DependencyGraph'); +const debug = require('debug')('ReactNativePackager:DependencyGraph'); const fs = require('fs'); const path = require('path'); diff --git a/react-packager/src/JSTransformer/index.js b/react-packager/src/JSTransformer/index.js index 9bf19139..5c819381 100644 --- a/react-packager/src/JSTransformer/index.js +++ b/react-packager/src/JSTransformer/index.js @@ -14,6 +14,7 @@ const declareOpts = require('../lib/declareOpts'); const fs = require('fs'); const util = require('util'); const workerFarm = require('worker-farm'); +const debug = require('debug')('ReactNativePackager:JStransformer'); const readFile = Promise.denodeify(fs.readFile); @@ -86,6 +87,8 @@ class Transformer { return Promise.reject(new Error('No transfrom module')); } + debug('transforming file', filePath); + return this._cache.get( filePath, 'transformedSource', @@ -107,6 +110,8 @@ class Transformer { throw formatError(res.error, filePath); } + debug('done transforming file', filePath); + return new ModuleTransport({ code: res.code, map: res.map, diff --git a/react-packager/src/SocketInterface/SocketClient.js b/react-packager/src/SocketInterface/SocketClient.js index 2a353f27..b89f5cca 100644 --- a/react-packager/src/SocketInterface/SocketClient.js +++ b/react-packager/src/SocketInterface/SocketClient.js @@ -11,7 +11,7 @@ const Bundle = require('../Bundler/Bundle'); const Promise = require('promise'); const bser = require('bser'); -const debug = require('debug')('ReactPackager:SocketClient'); +const debug = require('debug')('ReactNativePackager:SocketClient'); const fs = require('fs'); const net = require('net'); const path = require('path'); diff --git a/react-packager/src/SocketInterface/SocketServer.js b/react-packager/src/SocketInterface/SocketServer.js index 3d8e3a33..5098ea87 100644 --- a/react-packager/src/SocketInterface/SocketServer.js +++ b/react-packager/src/SocketInterface/SocketServer.js @@ -11,7 +11,7 @@ const Promise = require('promise'); const Server = require('../Server'); const bser = require('bser'); -const debug = require('debug')('ReactPackager:SocketServer'); +const debug = require('debug')('ReactNativePackager:SocketServer'); const fs = require('fs'); const net = require('net'); diff --git a/react-packager/src/SocketInterface/index.js b/react-packager/src/SocketInterface/index.js index eab83fa4..2a885b1c 100644 --- a/react-packager/src/SocketInterface/index.js +++ b/react-packager/src/SocketInterface/index.js @@ -13,7 +13,7 @@ const SocketClient = require('./SocketClient'); const SocketServer = require('./SocketServer'); const _ = require('underscore'); const crypto = require('crypto'); -const debug = require('debug')('ReactPackager:SocketInterface'); +const debug = require('debug')('ReactNativePackager:SocketInterface'); const fs = require('fs'); const net = require('net'); const path = require('path'); @@ -90,7 +90,7 @@ function createServer(resolve, reject, options, sockPath) { // Enable server debugging by default since it's going to a log file. const env = _.clone(process.env); - env.DEBUG = 'ReactPackager:SocketServer'; + env.DEBUG = 'ReactNativePackager:SocketServer'; // We have to go through the main entry point to make sure // we go through the babel require hook.