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

Avoid assuming ember-template-compiler result is JSON #216

Merged
merged 1 commit into from
May 7, 2020

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented May 7, 2020

It is fundamentally invalid to assume that require(emberTemplateCompilerPath).precompile('{{something}}') returns a JSON.parseable value.

New template features (strict mode, template imports, etc) will require the precompiled template to actually be a function (older Ember versions (prior to 2.10) also used functions).

It is fundamentally invalid to assume that
`require(emberTemplateCompilerPath).precompile('{{something}}')` returns
a `JSON.parse`able value.

New template features (strict mode, template imports, etc) will require
the precompiled template to actually be a function (older Ember versions
(prior to 2.10) also used functions).
Copy link
Member

@mmun mmun left a comment

Choose a reason for hiding this comment

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

LGTM

function buildArrayExpression(array) {
return t.arrayExpression(array.map((i) => buildExpression(i)));
}
const parsePrecompiledTemplate = babel.template('PRECOMPILED');
Copy link
Member

Choose a reason for hiding this comment

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

yay ✂️ ✂️

@mmun
Copy link
Member

mmun commented May 7, 2020

This should probably be notarized as a bug fix for older Embers.

@rwjblue
Copy link
Member Author

rwjblue commented May 7, 2020

This should probably be notarized as a bug fix for older Embers.

Ya, agreed

@rwjblue rwjblue added the bug label May 7, 2020
@rwjblue rwjblue merged commit c1006b6 into master May 7, 2020
@rwjblue rwjblue deleted the do-not-assume-json-precompile-result branch May 7, 2020 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants