Skip to content

Commit 116126b

Browse files
author
Robert Jackson
committed
Add some more helpful debug logging to list AST plugins
Running: ``` DEBUG=ember-cli-htmlbars:* DEBUG_LEVEL=debug ember b ```
1 parent f015291 commit 116126b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lib/ember-addon-main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module.exports = {
8383
inputTree = debugTree(new ColocatedTemplateProcessor(inputTree), '02-colocated-output');
8484
}
8585

86+
this._addon.logger.debug(`setup *.hbs compiler with ${htmlbarsOptions.pluginNames}`);
8687
const TemplateCompiler = require('./template-compiler-plugin');
8788
return debugTree(new TemplateCompiler(inputTree, htmlbarsOptions), '03-output');
8889
},
@@ -152,7 +153,9 @@ module.exports = {
152153
let templateCompilerPath = this.templateCompilerPath();
153154

154155
if (pluginInfo.canParallelize) {
155-
this.logger.debug('using parallel API with for babel inline precompilation plugin');
156+
this.logger.debug(
157+
`using babel inline precompilation plugin (parallelized) with ${pluginInfo.pluginNames}`
158+
);
156159

157160
let htmlbarsInlinePrecompilePlugin = utils.buildParalleizedBabelPlugin(
158161
pluginInfo,
@@ -161,7 +164,9 @@ module.exports = {
161164

162165
babelPlugins.push(htmlbarsInlinePrecompilePlugin);
163166
} else {
164-
this.logger.debug('NOT using parallel API with for babel inline precompilation plugin');
167+
this.logger.debug(
168+
`using babel inline precompilation plugin (NON-parallelized) with ${pluginInfo.pluginNames}`
169+
);
165170
this.logger.debug('Prevented by these plugins: ' + pluginInfo.unparallelizableWrappers);
166171

167172
let htmlBarsPlugin = utils.setup(pluginInfo, {

lib/utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function buildOptions(projectConfig, templateCompilerPath, pluginInfo) {
8585
templateCompiler: require(templateCompilerPath),
8686
templateCompilerPath: templateCompilerPath,
8787

88+
pluginNames: pluginInfo.pluginNames,
8889
plugins: {
8990
ast: pluginInfo.plugins,
9091
},
@@ -220,6 +221,7 @@ function makeCacheKey(templateCompilerPath, pluginInfo, extra) {
220221
function setupPlugins(wrappers) {
221222
let plugins = [];
222223
let cacheKeys = [];
224+
let pluginNames = [];
223225
let parallelConfigs = [];
224226
let unparallelizableWrappers = [];
225227
let dependencyInvalidation = false;
@@ -233,6 +235,8 @@ function setupPlugins(wrappers) {
233235
wrapper = plugin[wrapper.buildUsing](wrapper.params);
234236
}
235237

238+
pluginNames.push(wrapper.name ? wrapper.name : 'unknown plugin');
239+
236240
if (wrapper.parallelBabel) {
237241
parallelConfigs.push(wrapper.parallelBabel);
238242
} else {
@@ -267,6 +271,7 @@ function setupPlugins(wrappers) {
267271

268272
return {
269273
plugins,
274+
pluginNames,
270275
cacheKeys,
271276
parallelConfigs,
272277
canParallelize,

node-tests/utils_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ describe('utils', function () {
4242

4343
assert.deepStrictEqual(actual, {
4444
plugins: [],
45+
pluginNames: [],
4546
cacheKeys: [],
4647
parallelConfigs: [],
4748
canParallelize: true,
@@ -53,13 +54,15 @@ describe('utils', function () {
5354
it('canParallelize for 1+ plugins with "parallelBabel" property', function () {
5455
let pluginWrappers = [
5556
{
57+
name: 'first',
5658
plugin() {},
5759
cacheKey() {
5860
return this.parallelBabel;
5961
},
6062
parallelBabel: 'something',
6163
},
6264
{
65+
name: 'second',
6366
plugin() {},
6467
cacheKey() {
6568
return this.parallelBabel;
@@ -72,6 +75,7 @@ describe('utils', function () {
7275

7376
assert.deepStrictEqual(actual, {
7477
plugins: pluginWrappers.map((w) => w.plugin),
78+
pluginNames: ['first', 'second'],
7579
cacheKeys: ['something', 'something else'],
7680
parallelConfigs: ['something', 'something else'],
7781
canParallelize: true,
@@ -103,6 +107,7 @@ describe('utils', function () {
103107

104108
assert.deepStrictEqual(actual, {
105109
plugins: pluginWrappers.map((w) => w.plugin),
110+
pluginNames: ['first', 'second'],
106111
cacheKeys: ['something', 'something else'],
107112
parallelConfigs: ['something'],
108113
canParallelize: false,

0 commit comments

Comments
 (0)