From efaf56c6de048a62edd9c54bc46d27cf6377de1c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 29 Jan 2015 09:03:30 +1100 Subject: [PATCH] add debug messages --- lib/6to5/file.js | 2 ++ lib/6to5/transformation/transformer-pass.js | 3 +++ lib/6to5/util.js | 3 +++ package.json | 1 + 4 files changed, 9 insertions(+) diff --git a/lib/6to5/file.js b/lib/6to5/file.js index f6b2286ee9..1edb6f1045 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -323,6 +323,8 @@ File.prototype.parse = function (code) { File.prototype.transform = function (ast) { var self = this; + util.debug(this.opts.filename); + this.ast = ast; this.lastStatements = t.getLastStatements(ast.program); this.scope = new Scope(ast.program, ast, null, this); diff --git a/lib/6to5/transformation/transformer-pass.js b/lib/6to5/transformation/transformer-pass.js index f1ac51d489..dc7ed07622 100644 --- a/lib/6to5/transformation/transformer-pass.js +++ b/lib/6to5/transformation/transformer-pass.js @@ -1,6 +1,7 @@ module.exports = TransformerPass; var traverse = require("../traverse"); +var util = require("../util"); var _ = require("lodash"); /** @@ -60,6 +61,8 @@ var transformVisitor = { TransformerPass.prototype.transform = function () { var file = this.file; + util.debug(file.opts.filename + ": Running transformer " + this.transformer.key); + this.astRun("before"); var state = { file: file, handlers: this.handlers, pass: this }; diff --git a/lib/6to5/util.js b/lib/6to5/util.js index fb448fcc53..2c64d4e86a 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -5,6 +5,7 @@ require("./patch"); var estraverse = require("estraverse"); var codeFrame = require("./helpers/code-frame"); var traverse = require("./traverse"); +var debug = require("debug"); var acorn = require("acorn-6to5"); var path = require("path"); var util = require("util"); @@ -14,6 +15,8 @@ var _ = require("lodash"); exports.inherits = util.inherits; +exports.debug = debug("6to5"); + exports.canCompile = function (filename, altExts) { var exts = altExts || exports.canCompile.EXTENSIONS; var ext = path.extname(filename); diff --git a/package.json b/package.json index 195705571c..cc94865c48 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "chokidar": "0.12.6", "commander": "2.6.0", "core-js": "^0.4.9", + "debug": "^2.1.1", "detect-indent": "3.0.0", "estraverse": "1.9.1", "esutils": "1.1.6",