Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor implementation of colocation feature. #280

Merged
merged 15 commits into from
Sep 14, 2019

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 6, 2019

  • Extracts helper method (to simplify processing of component files with templates)
  • Add guard for when colocation should not be enabled (still somewhat WIP, but the branching is setup).
  • Change the implementation of colocation to rely on hbs (still WIP)

Note: This targets the colocation branch (so that we can avoid breaking folks actively using the @ember/octane-app-blueprint which uses the colocation branch).

@rwjblue rwjblue requested a review from chancancode September 6, 2019 19:17
if (!jsContents.includes('export default')) {
let message = `\`${filePath}\` does not contain a \`default export\`. Did you forget to export the component class?`;
return `${jsContents}\nthrow new Error(${JSON.stringify(message)});`;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably move this check/rewrite to the babel plugin now, for fewer false positives.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@rwjblue
Copy link
Member Author

rwjblue commented Sep 8, 2019

Makes testing easier (at least it makes my mental overhead somewhat less
while testing 😀)
@rwjblue rwjblue force-pushed the colocation-refactor branch from 344f079 to 01ec661 Compare September 9, 2019 01:55
@rwjblue rwjblue force-pushed the colocation-refactor branch from 01ec661 to 5709c0f Compare September 9, 2019 01:57
@rwjblue rwjblue force-pushed the colocation-refactor branch from a34be12 to 9362a4c Compare September 9, 2019 12:45
@rwjblue rwjblue force-pushed the colocation-refactor branch from 3ae00df to 99ac97d Compare September 9, 2019 13:30
const __COLOCATED_TEMPLATE__ = hbs\`{{yield}}\`;
import templateOnly from '@ember/component/template-only';

export default templateOnly();` + '\n',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized we made this function take a string for the moduleName

@rwjblue rwjblue marked this pull request as ready for review September 14, 2019 21:09
@rwjblue rwjblue merged commit 1ef7d42 into ember-cli:colocation Sep 14, 2019
@rwjblue rwjblue deleted the colocation-refactor branch September 14, 2019 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants