From ca53eed62839e3104e503d03b848d83ff2ad6987 Mon Sep 17 00:00:00 2001 From: Beddu Impossibile Date: Tue, 19 May 2020 22:55:08 +0200 Subject: [PATCH 1/2] colocated templates after default export --- lib/colocated-babel-plugin.js | 16 +++++- lib/colocated-broccoli-plugin.js | 6 ++- node-tests/colocated-broccoli-plugin-test.js | 55 ++++++++------------ node-tests/colocated-test.js | 15 +++--- 4 files changed, 47 insertions(+), 45 deletions(-) diff --git a/lib/colocated-babel-plugin.js b/lib/colocated-babel-plugin.js index 221128ff..9c710919 100644 --- a/lib/colocated-babel-plugin.js +++ b/lib/colocated-babel-plugin.js @@ -23,7 +23,21 @@ module.exports = function (babel) { ExportDefaultDeclaration(path, state) { if (state.colocatedTemplateFound !== true || state.setComponentTemplateInjected === true) { - return; + let colocatedFlagIndex = path.parent.body.findIndex( (node) => { + + if(node.type === "VariableDeclaration") + { + if(node.declarations.findIndex( (declaration) => { + + if(declaration.id.name === '__COLOCATED_TEMPLATE__') return true; + return false; + + }) >= 0) return true; + return false; + } + + }); + if (colocatedFlagIndex < 0) return; } state.setComponentTemplateInjected = true; diff --git a/lib/colocated-broccoli-plugin.js b/lib/colocated-broccoli-plugin.js index 41a110ea..7e44553d 100644 --- a/lib/colocated-broccoli-plugin.js +++ b/lib/colocated-broccoli-plugin.js @@ -155,13 +155,15 @@ module.exports = class ColocatedTemplateProcessor extends Plugin { jsContents = `${jsContents}\nthrow new Error(${JSON.stringify(message)});`; prefix = ''; } + else if(hasTemplate) jsContents = jsContents + `\n${prefix}`; + } else { // create JS file, use null component pattern - jsContents = `import templateOnly from '@ember/component/template-only';\n\nexport default templateOnly();\n`; + jsContents = prefix + `import templateOnly from '@ember/component/template-only';\n\nexport default templateOnly();\n`; } - jsContents = prefix + jsContents; + //jsContents = prefix + jsContents; let jsOutputPath = path.join(this.outputPath, backingClassPath); diff --git a/node-tests/colocated-broccoli-plugin-test.js b/node-tests/colocated-broccoli-plugin-test.js index 4b888db0..c4b735b5 100644 --- a/node-tests/colocated-broccoli-plugin-test.js +++ b/node-tests/colocated-broccoli-plugin-test.js @@ -105,12 +105,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -212,12 +211,11 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { components: { 'foo.ts': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -255,11 +253,10 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { components: { 'foo.coffee': stripIndent` - import { hbs } from 'ember-cli-htmlbars' - __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}) import Component from '@ember/component' export default class extends Component - `, + import { hbs } from 'ember-cli-htmlbars' + __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}})` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -344,12 +341,11 @@ describe('ColocatedTemplateCompiler', function () { 'addon-name-here': { components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"@scope-name/addon-name-here/components/foo.hbs","parseOptions":{"srcName":"@scope-name/addon-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"@scope-name/addon-name-here/components/foo.hbs","parseOptions":{"srcName":"@scope-name/addon-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -585,12 +581,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -670,12 +665,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -937,12 +931,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -979,12 +972,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("whoops!", {"contents":"whoops!","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("whoops!", {"contents":"whoops!","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1025,12 +1017,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1065,12 +1056,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooBarComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1117,12 +1107,11 @@ describe('ColocatedTemplateCompiler', function () { 'router.js': '// stuff here', components: { 'foo.js': stripIndent` - import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}}); import Component from '@glimmer/component'; export default class FooComponent extends Component {} - `, + import { hbs } from 'ember-cli-htmlbars'; + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', }, templates: { 'application.hbs': '{{outlet}}', diff --git a/node-tests/colocated-test.js b/node-tests/colocated-test.js index 18949b3b..665d1ebe 100644 --- a/node-tests/colocated-test.js +++ b/node-tests/colocated-test.js @@ -131,6 +131,8 @@ describe('Colocation - Broccoli + Babel Integration', function () { 'app-name-here': { components: { 'foo.js': stripIndent` + import Component from '@glimmer/component'; + export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", { @@ -141,9 +143,6 @@ describe('Colocation - Broccoli + Babel Integration', function () { } }); - import Component from '@glimmer/component'; - export default class FooComponent extends Component {} - Ember._setComponentTemplate(__COLOCATED_TEMPLATE__, FooComponent); `, }, @@ -179,6 +178,8 @@ describe('Colocation - Broccoli + Babel Integration', function () { 'app-name-here': { components: { 'foo.js': stripIndent` + import Component from '@glimmer/component'; + export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", { @@ -189,9 +190,6 @@ describe('Colocation - Broccoli + Babel Integration', function () { } }); - import Component from '@glimmer/component'; - export default class FooComponent extends Component {} - Ember._setComponentTemplate(__COLOCATED_TEMPLATE__, FooComponent); `, }, @@ -274,6 +272,8 @@ describe('Colocation - Broccoli + Babel Integration', function () { 'addon-name-here': { components: { 'foo.js': stripIndent` + import Component from '@glimmer/component'; + export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", { @@ -284,9 +284,6 @@ describe('Colocation - Broccoli + Babel Integration', function () { } }); - import Component from '@glimmer/component'; - export default class FooComponent extends Component {} - Ember._setComponentTemplate(__COLOCATED_TEMPLATE__, FooComponent); `, }, From dee429b0c352b98019df34ef1909d7c8ed15072c Mon Sep 17 00:00:00 2001 From: Beddu Impossibile Date: Wed, 20 May 2020 11:09:45 +0200 Subject: [PATCH 2/2] correct linting errors --- lib/colocated-babel-plugin.js | 20 +++--- lib/colocated-broccoli-plugin.js | 8 +-- node-tests/colocated-broccoli-plugin-test.js | 66 +++++++++++++------- 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/lib/colocated-babel-plugin.js b/lib/colocated-babel-plugin.js index 9c710919..2867e0d1 100644 --- a/lib/colocated-babel-plugin.js +++ b/lib/colocated-babel-plugin.js @@ -23,19 +23,17 @@ module.exports = function (babel) { ExportDefaultDeclaration(path, state) { if (state.colocatedTemplateFound !== true || state.setComponentTemplateInjected === true) { - let colocatedFlagIndex = path.parent.body.findIndex( (node) => { - - if(node.type === "VariableDeclaration") - { - if(node.declarations.findIndex( (declaration) => { - - if(declaration.id.name === '__COLOCATED_TEMPLATE__') return true; - return false; - - }) >= 0) return true; + let colocatedFlagIndex = path.parent.body.findIndex((node) => { + if (node.type === 'VariableDeclaration') { + if ( + node.declarations.findIndex((declaration) => { + if (declaration.id.name === '__COLOCATED_TEMPLATE__') return true; + return false; + }) >= 0 + ) + return true; return false; } - }); if (colocatedFlagIndex < 0) return; } diff --git a/lib/colocated-broccoli-plugin.js b/lib/colocated-broccoli-plugin.js index 7e44553d..b934d2cc 100644 --- a/lib/colocated-broccoli-plugin.js +++ b/lib/colocated-broccoli-plugin.js @@ -154,13 +154,13 @@ module.exports = class ColocatedTemplateProcessor extends Plugin { let message = `\`${relativePath}\` does not contain a \`default export\`. Did you forget to export the component class?`; jsContents = `${jsContents}\nthrow new Error(${JSON.stringify(message)});`; prefix = ''; - } - else if(hasTemplate) jsContents = jsContents + `\n${prefix}`; - + } else if (hasTemplate) jsContents = jsContents + `\n${prefix}`; } else { // create JS file, use null component pattern - jsContents = prefix + `import templateOnly from '@ember/component/template-only';\n\nexport default templateOnly();\n`; + jsContents = + prefix + + `import templateOnly from '@ember/component/template-only';\n\nexport default templateOnly();\n`; } //jsContents = prefix + jsContents; diff --git a/node-tests/colocated-broccoli-plugin-test.js b/node-tests/colocated-broccoli-plugin-test.js index c4b735b5..84f06834 100644 --- a/node-tests/colocated-broccoli-plugin-test.js +++ b/node-tests/colocated-broccoli-plugin-test.js @@ -104,12 +104,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -210,12 +212,14 @@ describe('ColocatedTemplateCompiler', function () { assert.deepStrictEqual(output.read(), { 'app-name-here': { components: { - 'foo.ts': stripIndent` + 'foo.ts': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -252,11 +256,13 @@ describe('ColocatedTemplateCompiler', function () { assert.deepStrictEqual(output.read(), { 'app-name-here': { components: { - 'foo.coffee': stripIndent` + 'foo.coffee': + stripIndent` import Component from '@ember/component' export default class extends Component import { hbs } from 'ember-cli-htmlbars' - __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}})` + '\n', + __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}})` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -340,12 +346,14 @@ describe('ColocatedTemplateCompiler', function () { '@scope-name': { 'addon-name-here': { components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"@scope-name/addon-name-here/components/foo.hbs","parseOptions":{"srcName":"@scope-name/addon-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"@scope-name/addon-name-here/components/foo.hbs","parseOptions":{"srcName":"@scope-name/addon-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -580,12 +588,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -664,12 +674,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -930,12 +942,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -971,12 +985,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("whoops!", {"contents":"whoops!","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("whoops!", {"contents":"whoops!","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1016,12 +1032,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1055,12 +1073,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooBarComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}', @@ -1106,12 +1126,14 @@ describe('ColocatedTemplateCompiler', function () { 'app-name-here': { 'router.js': '// stuff here', components: { - 'foo.js': stripIndent` + 'foo.js': + stripIndent` import Component from '@glimmer/component'; export default class FooComponent extends Component {} import { hbs } from 'ember-cli-htmlbars'; - const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + '\n', + const __COLOCATED_TEMPLATE__ = hbs("{{yield}}", {"contents":"{{yield}}","moduleName":"app-name-here/components/foo.hbs","parseOptions":{"srcName":"app-name-here/components/foo.hbs"}});` + + '\n', }, templates: { 'application.hbs': '{{outlet}}',