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

Deprecate @ember/string when used from ember-source; point users to add the @ember/string addon #20344

Merged
merged 3 commits into from
Jan 5, 2023

Conversation

kategengler
Copy link
Member

  • Duplicate a portion of @ember/string in @ember/-internals/string for internal use by ember-source without triggering deprecations

the `@ember/string` addon

- Duplicate a portion of @ember/string in @ember/-internals/string for
internal use by ember-source without triggering deprecations
Copy link
Member

@wagenet wagenet left a comment

Choose a reason for hiding this comment

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

Looks good. For completeness we possibly should add @ember/-internals/string to the list in publish.mjs, though we probably don't actually need it since its is never re-exported.

- Remove `getString` from string_registry, it was unused internally and
  not exposed publicly.
},
});
Object.defineProperty(Ember.String, 'isHTMLSafe', {
function deprecateStringUseOnEmberModule() {
Copy link
Member Author

Choose a reason for hiding this comment

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

The prior deprecation here would show Importing htmlSafe from '@ember/string' is deprecated. Please import htmlSafe from '@ember/template, but would only show when someone was doing

import Ember from 'ember';
Ember.String.htmlSafe('foo');

Now, they will see 'Using Ember.String is deprecated. Please import methods directly from @ember/string' If they do that with htmlSafe or isHTMLSafe they will then get a deprecation about importing from @ember/template. It's a little annoying but I think it is the cleanest way forward and most projects will have updated the imports already.

enumerable: true,
configurable: true,
get() {
deprecateImportFromString('isHTMLSafe');
return isHTMLSafe;
deprecateStringUseOnEmberModule();
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 deprecation must be here, and not in the definitions of the methods on @ember/string because it only applies when methods are referenced off the Ember module.

@kategengler kategengler merged commit 2fc74e0 into emberjs:master Jan 5, 2023
@kategengler kategengler deleted the kg-ember-string-deprecation branch January 5, 2023 21:59
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