File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
packages/svelte/src/internal/client/dev Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import { get_proxied_value } from '../proxy.js';
33
44export function init_array_prototype_warnings ( ) {
55 const array_prototype = Array . prototype ;
6+ // The REPL ends up here over and over, and this prevents it from adding more and more patches
7+ // of the same kind to the prototype, which would slow down everything over time.
8+ // @ts -expect-error
9+ const cleanup = Array . __svelte_cleanup ;
10+ if ( cleanup ) {
11+ cleanup ( ) ;
12+ }
13+
614 const { indexOf, lastIndexOf, includes } = array_prototype ;
715
816 array_prototype . indexOf = function ( item , from_index ) {
@@ -55,6 +63,13 @@ export function init_array_prototype_warnings() {
5563
5664 return has ;
5765 } ;
66+
67+ // @ts -expect-error
68+ Array . __svelte_cleanup = ( ) => {
69+ array_prototype . indexOf = indexOf ;
70+ array_prototype . lastIndexOf = lastIndexOf ;
71+ array_prototype . includes = includes ;
72+ } ;
5873}
5974
6075/**
You can’t perform that action at this time.
0 commit comments