-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conversation
colocated-broccoli-plugin.js
Outdated
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)});`; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
FYI - This is a prototype of the AST transform: |
Makes testing easier (at least it makes my mental overhead somewhat less while testing 😀)
344f079
to
01ec661
Compare
01ec661
to
5709c0f
Compare
This will be done by an AST plugin instead.
a34be12
to
9362a4c
Compare
No need to require / load build related things when not building...
3ae00df
to
99ac97d
Compare
const __COLOCATED_TEMPLATE__ = hbs\`{{yield}}\`; | ||
import templateOnly from '@ember/component/template-only'; | ||
|
||
export default templateOnly();` + '\n', |
There was a problem hiding this comment.
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
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 thecolocation
branch).