ember-cli-htmlbars
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -0,1 +1,17 @@ | ||
## v4.0.6 (2019-10-17) | ||
#### :rocket: Enhancement | ||
* [#334](https://github.com/ember-cli/ember-cli-htmlbars/pull/334) Add parent's name to logging output. ([@rwjblue](https://github.com/rwjblue)) | ||
#### :bug: Bug Fix | ||
* [#333](https://github.com/ember-cli/ember-cli-htmlbars/pull/333) Enable colocated component classes to be TypeScript ([@rwjblue](https://github.com/rwjblue)) | ||
* [#332](https://github.com/ember-cli/ember-cli-htmlbars/pull/332) Ensure "pods style" templates are compiled properly. ([@rwjblue](https://github.com/rwjblue)) | ||
#### :house: Internal | ||
* [#125](https://github.com/ember-cli/ember-cli-htmlbars/pull/125) Add more tests using AST plugins (inline and standalone) ([@stefanpenner](https://github.com/stefanpenner)) | ||
#### Committers: 2 | ||
- Robert Jackson ([@rwjblue](https://github.com/rwjblue)) | ||
- Stefan Penner ([@stefanpenner](https://github.com/stefanpenner)) | ||
## v4.0.5 (2019-10-04) | ||
@@ -2,0 +18,0 @@ |
@@ -71,11 +71,21 @@ 'use strict'; | ||
// TODO: deal with alternate extensions (e.g. ts) | ||
let possibleJSPath = path.join(filePathParts.dir, filePathParts.name + '.js'); | ||
let hasJSFile = fs.existsSync(path.join(this.inputPaths[0], possibleJSPath)); | ||
if (filePathParts.name === 'template') { | ||
// TODO: maybe warn? | ||
filesToCopy.push(filePath); | ||
return; | ||
} | ||
let hasBackingClass = false; | ||
let backingClassPath = path.join(filePathParts.dir, filePathParts.name); | ||
if (fs.existsSync(path.join(this.inputPaths[0], backingClassPath + '.js'))) { | ||
backingClassPath += '.js'; | ||
hasBackingClass = true; | ||
} else if (fs.existsSync(path.join(this.inputPaths[0], backingClassPath + '.ts'))) { | ||
backingClassPath += '.ts'; | ||
hasBackingClass = true; | ||
} else { | ||
backingClassPath += '.js'; | ||
hasBackingClass = false; | ||
} | ||
let templateContents = fs.readFileSync(inputPath, { encoding: 'utf8' }); | ||
@@ -96,8 +106,10 @@ let jsContents = null; | ||
logger.debug(`processing colocated template: ${filePath} (template-only: ${hasJSFile})`); | ||
logger.debug( | ||
`processing colocated template: ${filePath} (template-only: ${hasBackingClass})` | ||
); | ||
if (hasJSFile) { | ||
if (hasBackingClass) { | ||
// add the template, call setComponentTemplate | ||
jsContents = fs.readFileSync(path.join(this.inputPaths[0], possibleJSPath), { | ||
jsContents = fs.readFileSync(path.join(this.inputPaths[0], backingClassPath), { | ||
encoding: 'utf8', | ||
@@ -119,3 +131,3 @@ }); | ||
let outputPath = path.join(this.outputPath, possibleJSPath); | ||
let outputPath = path.join(this.outputPath, backingClassPath); | ||
@@ -122,0 +134,0 @@ // TODO: don't speculatively mkdirSync (likely do in a try/catch with ENOENT) |
@@ -5,3 +5,2 @@ 'use strict'; | ||
const utils = require('./utils'); | ||
const logger = require('heimdalljs-logger')('ember-cli-htmlbars:addon'); | ||
const hasEdition = require('@ember/edition-utils').has; | ||
@@ -16,2 +15,10 @@ | ||
init() { | ||
this._super.init.apply(this, arguments); | ||
let parentName = typeof this.parent.name === 'function' ? this.parent.name() : this.parent.name; | ||
this.logger = require('heimdalljs-logger')('ember-cli-htmlbars:addon:' + parentName); | ||
}, | ||
_shouldColocateTemplates() { | ||
@@ -41,5 +48,4 @@ if (this._cachedShouldColocateTemplates) { | ||
logger.info( | ||
`Colocation processing: ${this._cachedShouldColocateTemplates} (hasOctane: ${hasOctane}; hasValidEmberCLIVersion: ${hasValidEmberCLIVersion}; hasVali | ||
dBabelVersion: ${hasValidBabelVersion};` | ||
this.logger.info( | ||
`Colocation processing: ${this._cachedShouldColocateTemplates} (hasOctane: ${hasOctane}; hasValidEmberCLIVersion: ${hasValidEmberCLIVersion}; hasValidBabelVersion: ${hasValidBabelVersion};` | ||
); | ||
@@ -146,3 +152,3 @@ | ||
if (pluginInfo.canParallelize) { | ||
logger.debug('using parallel API with for babel inline precompilation plugin'); | ||
this.logger.debug('using parallel API with for babel inline precompilation plugin'); | ||
@@ -156,4 +162,4 @@ let htmlbarsInlinePrecompilePlugin = utils.buildParalleizedBabelPlugin( | ||
} else { | ||
logger.debug('NOT using parallel API with for babel inline precompilation plugin'); | ||
logger.debug('Prevented by these plugins: ' + pluginInfo.unparallelizableWrappers); | ||
this.logger.debug('NOT using parallel API with for babel inline precompilation plugin'); | ||
this.logger.debug('Prevented by these plugins: ' + pluginInfo.unparallelizableWrappers); | ||
@@ -160,0 +166,0 @@ let htmlBarsPlugin = utils.setup(pluginInfo, { |
{ | ||
"name": "ember-cli-htmlbars", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"description": "A library for adding htmlbars to ember CLI", | ||
@@ -73,3 +73,3 @@ "keywords": [ | ||
"eslint": "^6.5.1", | ||
"eslint-config-prettier": "^6.3.0", | ||
"eslint-config-prettier": "^6.4.0", | ||
"eslint-plugin-ember": "^7.1.0", | ||
@@ -76,0 +76,0 @@ "eslint-plugin-mocha": "^6.1.1", |
42803
796