Skip to content

Commit

Permalink
Move deprecation to avoid circular module imports
Browse files Browse the repository at this point in the history
(cherry picked from commit 1e686b7)
  • Loading branch information
simonihmig authored and kategengler committed Jun 17, 2024
1 parent ce2a1cd commit 45ce7c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 11 additions & 0 deletions packages/@ember/-internals/deprecations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,14 @@ export function deprecateUntil(message: string, deprecation: DeprecationObject)
}
deprecate(message, deprecation.test, options);
}

const { EXTEND_PROTOTYPES } = ENV as {
EXTEND_PROTOTYPES: { Array?: boolean };
};

if (EXTEND_PROTOTYPES.Array !== false) {
deprecateUntil(
'Array prototype extensions are deprecated. Follow the deprecation guide for migration instructions, and set EmberENV.EXTEND_PROTOTYPES to false in your config/environment.js',
DEPRECATIONS.DEPRECATE_ARRAY_PROTOTYPE_EXTENSIONS
);
}
9 changes: 0 additions & 9 deletions packages/@ember/-internals/environment/lib/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DEPRECATIONS, deprecateUntil } from '@ember/-internals/deprecations';
import { DEBUG } from '@glimmer/env';
import global from './global';

Expand Down Expand Up @@ -203,14 +202,6 @@ export const ENV = {
}

let { EXTEND_PROTOTYPES } = EmberENV;

if (EXTEND_PROTOTYPES !== false) {
deprecateUntil(
'Array prototype extensions are deprecated. Follow the deprecation guide for migration instructions, and set EmberENV.EXTEND_PROTOTYPES to false in your config/environment.js',
DEPRECATIONS.DEPRECATE_ARRAY_PROTOTYPE_EXTENSIONS
);
}

if (EXTEND_PROTOTYPES !== undefined) {
if (typeof EXTEND_PROTOTYPES === 'object' && EXTEND_PROTOTYPES !== null) {
ENV.EXTEND_PROTOTYPES.Array = EXTEND_PROTOTYPES.Array !== false;
Expand Down

0 comments on commit 45ce7c4

Please sign in to comment.