ember-cli-htmlbars
Advanced tools
Comparing version 4.0.6 to 4.0.7
@@ -0,1 +1,13 @@ | ||
## v4.0.7 (2019-10-18) | ||
#### :bug: Bug Fix | ||
* [#336](https://github.com/ember-cli/ember-cli-htmlbars/pull/336) Support `as default` exports with template colocation ([@dfreeman](https://github.com/dfreeman)) | ||
#### :house: Internal | ||
* [#335](https://github.com/ember-cli/ember-cli-htmlbars/pull/335) Add additional tests for Colocated Components ([@camerondubas](https://github.com/camerondubas)) | ||
#### Committers: 2 | ||
- Cameron Dubas ([@camerondubas](https://github.com/camerondubas)) | ||
- Dan Freeman ([@dfreeman](https://github.com/dfreeman)) | ||
## v4.0.6 (2019-10-17) | ||
@@ -2,0 +14,0 @@ |
@@ -6,2 +6,10 @@ // For ease of debuggin / tweaking: | ||
function makeSetComponentTemplateMemberExpression() { | ||
return t.memberExpression(t.identifier('Ember'), t.identifier('_setComponentTemplate')); | ||
} | ||
function makeColocatedTemplateIdentifier() { | ||
return t.identifier('__COLOCATED_TEMPLATE__'); | ||
} | ||
return { | ||
@@ -23,7 +31,4 @@ name: 'ember-cli-htmlbars-colocation-template', | ||
let defaultExportDeclaration = path.node.declaration; | ||
let setComponentTemplateMemberExpression = t.memberExpression( | ||
t.identifier('Ember'), | ||
t.identifier('_setComponentTemplate') | ||
); | ||
let colocatedTemplateIdentifier = t.identifier('__COLOCATED_TEMPLATE__'); | ||
let setComponentTemplateMemberExpression = makeSetComponentTemplateMemberExpression(); | ||
let colocatedTemplateIdentifier = makeColocatedTemplateIdentifier(); | ||
@@ -61,4 +66,22 @@ if (defaultExportDeclaration.type === 'ClassDeclaration') { | ||
}, | ||
ExportNamedDeclaration(path, state) { | ||
if (!state.colocatedTemplateFound) { | ||
return; | ||
} | ||
let defaultSpecifier = path.node.specifiers.find(spec => spec.exported.name === 'default'); | ||
if (defaultSpecifier) { | ||
path.parent.body.push( | ||
t.expressionStatement( | ||
t.callExpression(makeSetComponentTemplateMemberExpression(), [ | ||
makeColocatedTemplateIdentifier(), | ||
defaultSpecifier.local, | ||
]) | ||
) | ||
); | ||
} | ||
}, | ||
}, | ||
}; | ||
}; |
{ | ||
"name": "ember-cli-htmlbars", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"description": "A library for adding htmlbars to ember CLI", | ||
@@ -51,2 +51,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "^7.6.4", | ||
"@ember/optional-features": "^1.0.0", | ||
@@ -53,0 +54,0 @@ "babel-plugin-debug-macros": "^0.3.3", |
44105
815
36