broccoli-typify
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -6,3 +6,3 @@ /// <reference path="../types/all.d.ts" /> | ||
var path = require('path'); | ||
var debug = require('debug'); | ||
var debugImport = require('debug'); | ||
var ts = require('typescript'); | ||
@@ -13,2 +13,3 @@ var diffing_broccoli_plugin_1 = require('./diffing-broccoli-plugin'); | ||
}; | ||
var debug = debugImport('broccoli-typify:typescript'); | ||
// Sub-directory where the @internal typing files (.d.ts) are stored | ||
@@ -72,5 +73,5 @@ exports.INTERNAL_TYPINGS_PATH = 'internal_typings'; | ||
if (this.rootFilePaths && this.rootFilePaths.length) { | ||
this._debug("CustomLanguageServiceHost rootFilePaths " + this.rootFilePaths.join(";")); | ||
debug("CustomLanguageServiceHost rootFilePaths " + this.rootFilePaths.join(";")); | ||
} | ||
this._debug("CustomLanguageServiceHost inputPath " + this.inputPath); | ||
debug("CustomLanguageServiceHost inputPath " + this.inputPath); | ||
var localTypesFolder = options.localTypesFolder || process.cwd() + "/local-types"; | ||
@@ -80,5 +81,2 @@ this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths, this.fileRegistry, this.inputPath, localTypesFolder); | ||
} | ||
DiffingTSCompiler.prototype._debug = function (message) { | ||
debug('broccoli-typify')("broccoli-typescript " + message); | ||
}; | ||
DiffingTSCompiler.prototype.rebuild = function (treeDiff) { | ||
@@ -331,3 +329,3 @@ var _this = this; | ||
} | ||
debug('broccoli-typify')("resolveModuleNames skipping module '" + name + "'"); | ||
debug("resolveModuleNames skipping module '" + name + "'"); | ||
return undefined; | ||
@@ -334,0 +332,0 @@ }); |
/// <reference path="../types/all.d.ts" /> | ||
"use strict"; | ||
var fs = require('fs'); | ||
var debug = require('debug'); | ||
var debugImport = require('debug'); | ||
var tree_differ_1 = require('./tree-differ'); | ||
@@ -10,2 +10,3 @@ var broccoli_tree_stabilizer_1 = require('./broccoli-tree-stabilizer'); | ||
exports.DiffResult = tree_differ_2.DiffResult; | ||
var debug = debugImport("broccoli-typify:diffing"); | ||
/** | ||
@@ -38,7 +39,10 @@ * Makes writing diffing plugins easy. | ||
this.diffResult = null; | ||
if (Array.isArray(wrappedPluginArguments[0])) { | ||
this.inputTrees = this.stabilizeTrees(wrappedPluginArguments[0]); | ||
var firstArg = wrappedPluginArguments[0]; | ||
if (Array.isArray(firstArg)) { | ||
debug("Constructor " + firstArg.length + " input trees, first " + firstArg[0]); | ||
this.inputTrees = this.stabilizeTrees(firstArg); | ||
} | ||
else { | ||
this.inputTree = this.stabilizeTree(wrappedPluginArguments[0]); | ||
debug("Constructor one input tree " + firstArg + ", stabilized " + this.inputTree.constructor['name']); | ||
} | ||
@@ -79,5 +83,2 @@ this.description = this.pluginClass.name; | ||
}; | ||
DiffingPluginWrapper.prototype._debug = function (message) { | ||
debug("broccoli-typify")(this.description + ": " + message); | ||
}; | ||
DiffingPluginWrapper.prototype.rebuild = function () { | ||
@@ -91,3 +92,3 @@ var _this = this; | ||
if (firstDiff) { | ||
this._debug("diff Result added " + firstDiff.addedPaths.length + ", removed " + firstDiff.removedPaths.length); | ||
debug("rebuild diffResult files added " + firstDiff.addedPaths.length + ", removed " + firstDiff.removedPaths.length); | ||
} | ||
@@ -110,3 +111,3 @@ var result = this.wrappedPlugin.rebuild(diffResult); | ||
e.message = "[" + this.description + "]: " + e.message; | ||
this._debug("exception in rebuild(): " + e.message); | ||
debug("exception in rebuild(): " + e.message); | ||
throw e; | ||
@@ -166,2 +167,3 @@ } | ||
tree['isReadAPICompatTree'] || tree.constructor['name'] === 'Funnel'); | ||
debug("stabilize tree isNewStyleTree " + isNewStyleTree + " " + tree.toString()); | ||
return isNewStyleTree ? tree : broccoli_tree_stabilizer_1.default(tree); | ||
@@ -168,0 +170,0 @@ }; |
/// <reference path="../types/all.d.ts" /> | ||
'use strict'; | ||
var debug = require('debug'); | ||
var debugImport = require('debug'); | ||
var broccoli_typescript_1 = require('./broccoli-typescript'); | ||
@@ -8,2 +8,3 @@ var ts = require('typescript'); | ||
var fs = require('fs'); | ||
var debug = debugImport('broccoli-typify:main'); | ||
/** | ||
@@ -54,5 +55,5 @@ * Convert from a hash (possibly loaded from file) to Typescript Compiler Options. | ||
} | ||
debug('broccoli-typify')("Intializing compiler with " + JSON.stringify(resolvedOptions)); | ||
debug("Initializing compiler with " + JSON.stringify(resolvedOptions)); | ||
return broccoli_typescript_1.Compiler(tree, resolvedOptions); | ||
} | ||
exports.Compiler = Compiler; |
{ | ||
"name": "broccoli-typify", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Provide broccoli building blocks for typescript pipelines.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,3 +6,3 @@ /// <reference path="../types/all.d.ts" /> | ||
import path = require('path'); | ||
import debug = require('debug'); | ||
import debugImport = require('debug'); | ||
import * as ts from 'typescript'; | ||
@@ -17,2 +17,4 @@ import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-broccoli-plugin'; | ||
var debug = debugImport('broccoli-typify:typescript') | ||
// Sub-directory where the @internal typing files (.d.ts) are stored | ||
@@ -97,5 +99,5 @@ export const INTERNAL_TYPINGS_PATH: string = 'internal_typings'; | ||
if (this.rootFilePaths && this.rootFilePaths.length) { | ||
this._debug("CustomLanguageServiceHost rootFilePaths " + this.rootFilePaths.join(";")); | ||
debug("CustomLanguageServiceHost rootFilePaths " + this.rootFilePaths.join(";")); | ||
} | ||
this._debug("CustomLanguageServiceHost inputPath " + this.inputPath); | ||
debug("CustomLanguageServiceHost inputPath " + this.inputPath); | ||
let localTypesFolder = options.localTypesFolder || `${process.cwd()}/local-types`; | ||
@@ -111,7 +113,3 @@ this.tsServiceHost = new CustomLanguageServiceHost( | ||
private _debug(message) { | ||
debug('broccoli-typify')(`broccoli-typescript ${message}`) | ||
} | ||
rebuild(treeDiff: DiffResult) { | ||
@@ -393,3 +391,3 @@ let pathsToEmit: string[] = []; | ||
} | ||
debug('broccoli-typify')(`resolveModuleNames skipping module '${name}'`); | ||
debug(`resolveModuleNames skipping module '${name}'`); | ||
return undefined; | ||
@@ -396,0 +394,0 @@ }); |
@@ -6,3 +6,3 @@ /// <reference path="../types/all.d.ts" /> | ||
import path = require('path'); | ||
import debug = require('debug'); | ||
import debugImport = require('debug'); | ||
import {TreeDiffer, DiffResult} from './tree-differ'; | ||
@@ -16,2 +16,4 @@ import stabilizeTree from './broccoli-tree-stabilizer'; | ||
var debug = debugImport(`broccoli-typify:diffing`) | ||
/** | ||
@@ -38,2 +40,3 @@ * Makes writing diffing plugins easy. | ||
class DiffingPluginWrapper implements BroccoliTree { | ||
@@ -57,6 +60,9 @@ treeDiffer: TreeDiffer = null; | ||
constructor(private pluginClass: PluginClass, private wrappedPluginArguments: IArguments) { | ||
if (Array.isArray(wrappedPluginArguments[0])) { | ||
this.inputTrees = this.stabilizeTrees(wrappedPluginArguments[0]); | ||
let firstArg = wrappedPluginArguments[0]; | ||
if (Array.isArray(firstArg)) { | ||
debug(`Constructor ${firstArg.length} input trees, first ${firstArg[0]}`); | ||
this.inputTrees = this.stabilizeTrees(firstArg); | ||
} else { | ||
this.inputTree = this.stabilizeTree(wrappedPluginArguments[0]); | ||
debug(`Constructor one input tree ${firstArg}, stabilized ${this.inputTree.constructor['name']}`); | ||
} | ||
@@ -97,5 +103,2 @@ | ||
private _debug(message) { | ||
debug(`broccoli-typify`)(`${this.description}: ${message}`); | ||
} | ||
@@ -110,3 +113,3 @@ rebuild(): (Promise<any>|void) { | ||
if (firstDiff) { | ||
this._debug(`diff Result added ${firstDiff.addedPaths.length}, removed ${firstDiff.removedPaths.length}`); | ||
debug(`rebuild diffResult files added ${firstDiff.addedPaths.length}, removed ${firstDiff.removedPaths.length}`); | ||
} | ||
@@ -131,3 +134,3 @@ | ||
e.message = `[${this.description}]: ${e.message}`; | ||
this._debug(`exception in rebuild(): ${e.message}`); | ||
debug(`exception in rebuild(): ${e.message}`); | ||
throw e; | ||
@@ -200,5 +203,5 @@ } | ||
(<any>tree)['isReadAPICompatTree'] || (<any>tree).constructor['name'] === 'Funnel'); | ||
debug(`stabilize tree isNewStyleTree ${isNewStyleTree} ${tree.toString()}`); | ||
return isNewStyleTree ? tree : stabilizeTree(tree); | ||
} | ||
} |
/// <reference path="../types/all.d.ts" /> | ||
'use strict'; | ||
import debug = require('debug'); | ||
import debugImport = require('debug'); | ||
import {Compiler as BroccoliCompiler, DiffingCompilerOptions} from './broccoli-typescript'; | ||
@@ -10,2 +10,4 @@ import * as ts from 'typescript'; | ||
let debug = debugImport('broccoli-typify:main'); | ||
/** | ||
@@ -71,5 +73,5 @@ * Convert from a hash (possibly loaded from file) to Typescript Compiler Options. | ||
} | ||
debug('broccoli-typify')(`Intializing compiler with ${JSON.stringify(resolvedOptions)}`); | ||
debug(`Initializing compiler with ${JSON.stringify(resolvedOptions)}`); | ||
return BroccoliCompiler(tree, resolvedOptions); | ||
} | ||
118257
2664