Skip to content

Commit

Permalink
Deprecate array prototype extensions
Browse files Browse the repository at this point in the history
(cherry picked from commit 18c65f2)
  • Loading branch information
simonihmig authored and kategengler committed Jun 17, 2024
1 parent 2ec6ed3 commit ce2a1cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/@ember/-internals/deprecations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ export const DEPRECATIONS = {
enabled: '5.10.0',
},
}),
DEPRECATE_ARRAY_PROTOTYPE_EXTENSIONS: deprecation({
id: 'deprecate-array-prototype-extensions',
url: 'https://deprecations.emberjs.com/id/deprecate-deprecate-array-prototype-extensions',
until: '6.0.0',
for: 'ember-source',
since: {
available: '5.10.0',
enabled: '5.10.0',
},
}),
};

export function deprecateUntil(message: string, deprecation: DeprecationObject) {
Expand Down
9 changes: 9 additions & 0 deletions packages/@ember/-internals/environment/lib/env.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DEPRECATIONS, deprecateUntil } from '@ember/-internals/deprecations';
import { DEBUG } from '@glimmer/env';
import global from './global';

Expand Down Expand Up @@ -202,6 +203,14 @@ 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 ce2a1cd

Please sign in to comment.