Deprecate @ember/string when used from ember-source; point users to add the @ember/string addon#20344
Conversation
kategengler
commented
Jan 4, 2023
- 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
wagenet
left a comment
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.
| get() { | ||
| deprecateImportFromString('isHTMLSafe'); | ||
| return isHTMLSafe; | ||
| deprecateStringUseOnEmberModule(); |
There was a problem hiding this comment.
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.