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

[BUGFIX beta] Deprecate {{view "string"}} and special case {{view "select"}} #11418

Merged
merged 1 commit into from
Jun 12, 2015

Conversation

bantic
Copy link
Member

@bantic bantic commented Jun 11, 2015

Use a template-compiler plugin to detect {{view "string"}} at compile-time
and issue a deprecation with location information. Has a special case
deprecation when the string === "select".

Removes a test from the view helper tests that was checking for the
deprecation at runtime (and removes the associated code in
the ember-htmlbars package's keywords/view).

Note: This does not catch a deprecation when the path is not a string,
e.g., {{view view.someProperty}}, however #11401 would catch and issue
a deprecation message for that case (at runtime).

Other changes:

  • document id param to Ember.deprecate
  • include deprecation id in log/error message
  • Use dot-namespaced deprecation ids (more similar to how instrument works and paves the way to in the future changing deprecation log levels by paths ie "view.*")
  • globally silence view-related deprecations in tests to avoid overflowing travis ci's log
  • update ember-dev dep in bower (pr: Properly expectDeprecation when test parameter is a function ember-dev#153) to a064f0cd2f4c225ffd023b63d4cb31a79db04aaf
  • change the view-and-controller-path template compiler plugin to always deprecate {{controller}}
  • change the view-and-controller-path template compiler plugin to skip deprecating {{view}} when Ember.ENV._ENABLE_LEGACY_VIW_SUPPORT is true

refs #11377

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2015

Looks like this needs a rebase.

@rwjblue rwjblue added this to the 1.13.0 milestone Jun 12, 2015
@bantic bantic force-pushed the deprecate-ember-view-select branch 2 times, most recently from 4559b82 to 7d9d02b Compare June 12, 2015 16:04
@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

@rwjblue Rebased and made a few changes. Updated the description above with notes.

Because the {{view "string"}} deprecations happen at compile-time we do not have a simple way to silence them in ember-legacy-views addon unless we can ensure that the addon's ember env gets merged/passed to the template compiler.

@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

cc @mixonic

@@ -55,7 +55,7 @@ function deprecatePaths(moduleName, node, paths) {
}

function deprecatePath(moduleName, node, path) {
Ember.deprecate(`Using \`{{${path && path.type === 'PathExpression' && path.parts[0]}}}\` or any path based on it ${calculateLocationDisplay(moduleName, node.loc)}has been deprecated.`, !(path && path.type === 'PathExpression' && (path.parts[0] === 'view' || path.parts[0] === 'controller')), { url: 'http://emberjs.com/deprecations/v1.x#toc_view-and-controller-template-keywords', id: 'view-controller-keyword' });
Ember.deprecate(`Using \`{{${path && path.type === 'PathExpression' && path.parts[0]}}}\` or any path based on it ${calculateLocationDisplay(moduleName, node.loc)}has been deprecated.`, !(path && path.type === 'PathExpression' && (path.parts[0] === 'view' || path.parts[0] === 'controller')), { url: 'http://emberjs.com/deprecations/v1.x#toc_view-and-controller-template-keywords', id: (path.parts && path.parts[0] === 'view' ? 'view.keyword.view' : 'view.keyword.controller') });
Copy link
Member Author

Choose a reason for hiding this comment

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

this ensures that {{view}} keyword gets a deprecation id of view.keyword.view and {{controller}} keyword gets a different deprecation id of view.keyword.controller.

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2015

we can ensure that the addon's ember env gets merged/passed to the template compiler

I am working on this...

@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

after discussion with @mixonic I am going to make a quick change to make it so _ENABLE_LEGACY_VIEW_SUPPORT only affects the {{view}} keyword and not the {{controller}} (i.e. don't provide a way to stop {{controller}} from issuing a deprecation warning)

@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

waiting on emberjs/ember-dev#153

@bantic bantic force-pushed the deprecate-ember-view-select branch from 7d9d02b to 267d6b9 Compare June 12, 2015 17:11
@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

And this is now ready to go. It updates the bower dep to point at updated ember-dev (see emberjs/ember-dev#153), which was needed to properly expectDeprecation when the test param is a function (which I did in this PR).

cc @rwjblue thanks for your patience

}

return noDeprecate;
}, { url: 'http://emberjs.com/deprecations/v1.x#toc_view-and-controller-template-keywords', id: (path.parts && path.parts[0] === 'view' ? 'view.keyword.view' : 'view.keyword.controller') });
Copy link
Member Author

Choose a reason for hiding this comment

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

being able to expectDeprecation with this function is the part that needed this update to ember-dev

…lect"}}

Use a template-compiler plugin to detect `{{view "string"}}` at compile-time
and issue a deprecation with location information. Has a special case
deprecation when the string === "select".

Removes a test from the view helper tests that was checking for the
deprecation at runtime (and removes the associated code in
the ember-htmlbars package's `keywords/view`).

Note: This does not catch a deprecation when the path is not a string,
e.g., `{{view view.someProperty}}`, however emberjs#11401 would catch and issue
a deprecation message for that case (at runtime).

Also a few changes to deprecations:

  * document `id` param to `Ember.deprecate`
  * include deprecation id in log/error message
  * Use dot-namespaced deprecation ids (more similar to how `instrument` works and paves the way to in the future changing deprecation log levels by paths ie `"view.*"`)
  * globally silence view-related deprecations in tests to avoid overflowing travis ci's log
  * update ember-dev dep in bower (pr: emberjs/ember-dev#153) to `a064f0cd2f4c225ffd023b63d4cb31a79db04aaf`
  * change the view-and-controller-path template compiler plugin to always deprecate `{{controller}}`
  * change the view-and-controller-path template compiler plugin to skip deprecating `{{view}}` when `Ember.ENV._ENABLE_LEGACY_VIW_SUPPORT` is true

refs emberjs#11377
@bantic bantic force-pushed the deprecate-ember-view-select branch from 267d6b9 to c2bcc86 Compare June 12, 2015 19:21
mixonic added a commit that referenced this pull request Jun 12, 2015
[BUGFIX beta] Deprecate {{view "string"}} and special case {{view "select"}}
@mixonic mixonic merged commit e651706 into emberjs:master Jun 12, 2015
@mixonic mixonic deleted the deprecate-ember-view-select branch June 12, 2015 19:56
@mixonic
Copy link
Member

mixonic commented Jun 12, 2015

🎉

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2015

ember-cli-htmlbars@0.7.9 has been published with the required ability to propagate EmberENV values to the template compiler. Anyone using ember-legacy-views will want ember-cli-htmlbars@0.7.9+ to stop console deprecations during the build.

@bantic
Copy link
Member Author

bantic commented Jun 12, 2015

thanks! Added an issue to update ember-legacy-views to mention this

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.

3 participants