ember-cli-htmlbars
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -0,1 +1,10 @@ | ||
## v4.0.2 (2019-09-30) | ||
#### :bug: Bug Fix | ||
* [#309](https://github.com/ember-cli/ember-cli-htmlbars/pull/309) Ensure inline precompile and colocated templates run template AST plugins. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#310](https://github.com/ember-cli/ember-cli-htmlbars/pull/310) Fix issues using inline precompilation with JSON.stringify'ed options. ([@rwjblue](https://github.com/rwjblue)) | ||
#### Committers: 1 | ||
- Robert Jackson ([@rwjblue](https://github.com/rwjblue)) | ||
## v4.0.1 (2019-09-25) | ||
@@ -2,0 +11,0 @@ |
@@ -9,2 +9,3 @@ 'use strict'; | ||
const Plugin = require('broccoli-plugin'); | ||
const logger = require('heimdalljs-logger')('ember-cli-htmlbars:colocated-broccoli-plugin'); | ||
@@ -83,5 +84,16 @@ function detectRootName(files) { | ||
// TODO: deal with hygiene? | ||
let prefix = `import { hbs } from 'ember-cli-htmlbars';\nconst __COLOCATED_TEMPLATE__ = hbs\`${templateContents}\`;\n`; | ||
let hbsInvocationOptions = { | ||
contents: templateContents, | ||
moduleName: filePath, | ||
parseOptions: { | ||
srcName: filePath, | ||
}, | ||
}; | ||
let hbsInvocation = `hbs(${JSON.stringify(templateContents)}, ${JSON.stringify( | ||
hbsInvocationOptions | ||
)})`; | ||
let prefix = `import { hbs } from 'ember-cli-htmlbars';\nconst __COLOCATED_TEMPLATE__ = ${hbsInvocation};\n`; | ||
logger.debug(`processing colocated template: ${filePath} (template-only: ${hasJSFile})`); | ||
if (hasJSFile) { | ||
@@ -123,2 +135,4 @@ // add the template, call setComponentTemplate | ||
logger.debug(`copying unchanged file: ${filePath}`); | ||
// TODO: don't speculatively mkdirSync (likely do in a try/catch with ENOENT) | ||
@@ -128,3 +142,5 @@ mkdirp.sync(path.dirname(outputPath)); | ||
}); | ||
logger.info(`copied over (unchanged): ${filesToCopy.length} files`); | ||
} | ||
}; |
@@ -39,2 +39,7 @@ 'use strict'; | ||
logger.info( | ||
`Colocation processing: ${this._cachedShouldColocateTemplates} (hasOctane: ${hasOctane}; hasValidEmberCLIVersion: ${hasValidEmberCLIVersion}; hasVali | ||
dBabelVersion: ${hasValidBabelVersion};` | ||
); | ||
return this._cachedShouldColocateTemplates; | ||
@@ -98,5 +103,4 @@ }, | ||
if (!this._isInlinePrecompileBabelPluginRegistered(babelPlugins)) { | ||
let pluginWrappers = this.astPlugins(); | ||
let pluginInfo = this.astPlugins(); | ||
let templateCompilerPath = this.templateCompilerPath(); | ||
let pluginInfo = utils.setupPlugins(pluginWrappers); | ||
@@ -142,13 +146,4 @@ let modules = { | ||
logger.debug('NOT using parallel API with for babel inline precompilation plugin'); | ||
logger.debug('Prevented by these plugins: ' + pluginInfo.unparallelizableWrappers); | ||
let blockingPlugins = pluginWrappers | ||
.map(wrapper => { | ||
if (wrapper.parallelBabel === undefined) { | ||
return wrapper.name; | ||
} | ||
}) | ||
.filter(Boolean); | ||
logger.debug('Prevented by these plugins: ' + blockingPlugins); | ||
let htmlBarsPlugin = utils.setup(pluginInfo, { | ||
@@ -155,0 +150,0 @@ projectConfig: this.projectConfig(), |
@@ -123,3 +123,2 @@ 'use strict'; | ||
function setup(pluginInfo, options) { | ||
// borrowed from ember-cli-htmlbars http://git.io/vJDrW | ||
let projectConfig = options.projectConfig || {}; | ||
@@ -133,3 +132,5 @@ let templateCompilerPath = options.templateCompilerPath; | ||
registerPlugins(templateCompiler, pluginInfo.plugins); | ||
registerPlugins(templateCompiler, { | ||
ast: pluginInfo.plugins, | ||
}); | ||
@@ -161,2 +162,3 @@ let { precompile } = templateCompiler; | ||
let parallelConfigs = []; | ||
let unparallelizableWrappers = []; | ||
let dependencyInvalidation = false; | ||
@@ -176,2 +178,3 @@ let canParallelize = true; | ||
} else { | ||
unparallelizableWrappers.push(wrapper.name); | ||
canParallelize = false; | ||
@@ -210,2 +213,3 @@ } | ||
canParallelize, | ||
unparallelizableWrappers, | ||
hasDependencyInvalidation: !!dependencyInvalidation, | ||
@@ -212,0 +216,0 @@ }; |
{ | ||
"name": "ember-cli-htmlbars", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "A library for adding htmlbars to ember CLI", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"@ember/edition-utils": "^1.1.1", | ||
"babel-plugin-htmlbars-inline-precompile": "^2.1.0", | ||
"babel-plugin-htmlbars-inline-precompile": "^2.1.1", | ||
"broccoli-debug": "^0.6.5", | ||
@@ -53,6 +53,8 @@ "broccoli-persistent-filter": "^2.3.1", | ||
"@ember/optional-features": "^1.0.0", | ||
"babel-plugin-debug-macros": "^0.3.3", | ||
"broccoli-merge-trees": "^3.0.2", | ||
"broccoli-test-helper": "^2.0.0", | ||
"chai": "^4.2.0", | ||
"co": "^4.6.0", | ||
"ember-cli": "~3.12.0", | ||
"ember-cli": "~3.13.0", | ||
"ember-cli-app-version": "^3.2.0", | ||
@@ -63,2 +65,3 @@ "ember-cli-babel": "^7.11.1", | ||
"ember-cli-template-lint": "^1.0.0-beta.3", | ||
"ember-cli-version-checker": "^3.1.3", | ||
"ember-export-application-global": "^2.0.0", | ||
@@ -69,3 +72,3 @@ "ember-load-initializers": "^2.1.0", | ||
"ember-resolver": "^5.3.0", | ||
"ember-source": "~3.13.0", | ||
"ember-source": "~3.13.2", | ||
"ember-source-channel-url": "^2.0.1", | ||
@@ -82,2 +85,3 @@ "ember-try": "^1.2.1", | ||
"mocha": "^6.2.0", | ||
"module-name-inliner": "link:./tests/dummy/lib/module-name-inliner", | ||
"prettier": "^1.18.2", | ||
@@ -84,0 +88,0 @@ "qunit-dom": "^0.9.0", |
38622
746
35