-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[DEPRECATION canary] Deprecate Ember.String and prototype extension #15739
Conversation
04075a9
to
37a06d4
Compare
@locks any update on this? |
4abca4f
to
e27061b
Compare
restarting job. Seemed a problem with yarn. |
Passing. |
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.
Looking really good! Only a few small questions/adjustments that I commented on inline...
{ | ||
id: 'ember-glimmer.ember-string-html-safe', | ||
until: '3.5.0', | ||
url: '' |
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.
Do we know the URL's for these deprecations? I vaguely recall that there was already an open website PR for them...
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.
Adding the URL from https://github.com/emberjs/website/pull/2995/files
|
||
const StringPrototype = String.prototype; | ||
|
||
function deprecateEmberStringExtension(fn, opts = {}) { | ||
let { name } = fn; |
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 don't think we can rely on Function.name
(AFAIK it isn't supported on all platforms, which would make this fail in production).
Checkout https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name for a decent compat table (it isn't supported on IE at all)...
@@ -115,6 +115,22 @@ function capitalize(str) { | |||
return CAPITALIZE_CACHE.get(str); | |||
} | |||
|
|||
function deprecateEmberStringUtil(fn, opts = {}) { |
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.
This seems roughly like the same function in the other file, can we share between the two and only have one implementation?
@@ -115,6 +115,22 @@ function capitalize(str) { | |||
return CAPITALIZE_CACHE.get(str); | |||
} | |||
|
|||
function deprecateEmberStringUtil(fn, opts = {}) { | |||
let { name } = fn; |
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.
Same concern as above RE: Function.name
packages/ember/lib/index.js
Outdated
@type Object | ||
@private | ||
*/ | ||
Ember.Template = { |
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.
Lets underscore this, I'd hate for folks to start using it ....
Addressed your suggestions. Thanks for the review! |
e6c86fc
to
cf9e15b
Compare
c257d81
to
e0c7a5f
Compare
Rebased and squashed. |
e0c7a5f
to
f7e9fca
Compare
fe778f1
to
a672acb
Compare
a672acb
to
e9a150c
Compare
Having lots of timeouts while doing |
Yay! I got tests passing after restarting some jobs several times. |
e9a150c
to
5b80853
Compare
@rwjblue should we merge this? |
@mmun negatory, sir. we need to publish the deprecation guides and release the addon before. |
5b80853
to
c034404
Compare
Rebased! |
I will rebase this at some point, quite likely, next Friday. Would that be ok, @locks ? |
c034404
to
d874956
Compare
I redid the whole PR because this rebase was going to be harder than redoing everything. |
This PR deprecates the use of String prototype extension and Ember.String namespace. Methods coming from ember-runtime --- A new `StringUtils` object is added, to be used internally by Ember instead of using the same object being exposed as `Ember.String`. This simplifies testing and the changes required in the rest of the code. Also, dropping the deprecated code will be much simpler. Methods coming from ember-glimmer --- Deprecated versions are being added and reexported as the same global the non-deprecated versions were. Besides, the non-deprecated version is being exported under the new global `Ember.Template`. The `Ember.Template` is just a placeholder until the final global is chosen.
d874956
to
4fc3dd5
Compare
Green again. |
Closing this. Sorry, I cannot keep rebasing this. |
Sorry 😢I'll wait for #16530. |
This PR deprecates the use of String prototype extension and
Ember.String namespace.
Methods coming from ember-runtime
A new
StringUtils
object is added, to be used internally by Emberinstead of using the same object being exposed as
Ember.String
. Thissimplifies testing and the changes required in the rest of the code.
Also, dropping the deprecated code will be much simpler.
Methods coming from ember-glimmer
Deprecated versions are being added and reexported as the same global
the non-deprecated versions were. Besides, the non-deprecated version is
being exported under the new global
Ember.Template
.The
Ember.Template
is just a placeholder until the final global is chosen.