Skip to content

Commit b00fbb3

Browse files
committed
Deprecate import Ember from 'ember'
RFC: emberjs/rfcs#1003 Guide: ember-learn/deprecation-app#1381 Advancement: emberjs/rfcs#1015
1 parent 3f2f2ef commit b00fbb3

File tree

8 files changed

+891
-819
lines changed

8 files changed

+891
-819
lines changed

packages/@ember/-internals/deprecations/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { DeprecationOptions } from '@ember/debug/lib/deprecate';
22
import { ENV } from '@ember/-internals/environment';
33
import { VERSION } from '@ember/version';
44
import { deprecate, assert } from '@ember/debug';
5+
import { dasherize } from '../string/index';
56

67
function isEnabled(options: DeprecationOptions) {
78
return Object.hasOwnProperty.call(options.since, 'enabled') || ENV._ALL_DEPRECATIONS_ENABLED;
@@ -90,6 +91,17 @@ function deprecation(options: DeprecationOptions) {
9091
test the behavior without encountering the deprecated feature, just as users would.
9192
*/
9293
export const DEPRECATIONS = {
94+
DEPRECATE_IMPORT_EMBER(importName: string) {
95+
return deprecation({
96+
id: `deprecate-import-${dasherize(importName).toLowerCase()}-from-ember`,
97+
for: 'ember-source',
98+
since: { available: '5.9.0' },
99+
until: '6.0.0',
100+
url: `https://deprecations.emberjs.com/id/import-${dasherize(
101+
importName
102+
).toLowerCase()}-from-ember`,
103+
});
104+
},
93105
DEPRECATE_IMPLICIT_ROUTE_MODEL: deprecation({
94106
id: 'deprecate-implicit-route-model',
95107
for: 'ember-source',

packages/ember-testing/tests/reexports_test.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import Ember from 'ember';
2-
import { confirmExport } from 'internal-test-helpers';
2+
import { confirmExport, testUnless } from 'internal-test-helpers';
33
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
44
import * as emberTesting from 'ember-testing';
5+
import { DEPRECATIONS } from '@ember/-internals/deprecations';
56

67
class ReexportsTestCase extends AbstractTestCase {}
78

@@ -19,7 +20,15 @@ class ReexportsTestCase extends AbstractTestCase {}
1920
exportName = path;
2021
}
2122

22-
ReexportsTestCase.prototype[`@test Ember.${path} exports correctly`] = function (assert) {
23+
ReexportsTestCase.prototype[
24+
`${testUnless(
25+
DEPRECATIONS.DEPRECATE_IMPORT_EMBER(path).isRemoved
26+
)} Ember.${path} exports correctly`
27+
] = function (assert) {
28+
expectDeprecation(
29+
/'ember' barrel file is deprecated/,
30+
DEPRECATIONS.DEPRECATE_IMPORT_EMBER(path || exportName).isEnabled
31+
);
2332
confirmExport(Ember, assert, path, moduleId, exportName, emberTesting);
2433
};
2534
});

0 commit comments

Comments
 (0)