Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
1.3 kB · 30 lines
12345678910111213141516171819202122232425262728293031diff --git a/internals/inspect-source.js b/internals/inspect-source.jsindex eb9e80c4213de74e25cf62b8d0bb321f2ee94244..747dc80002c294c4cbaa239072f73e911597523d 100644--- a/internals/inspect-source.js+++ b/internals/inspect-source.js@@ -7,8 +7,24 @@ var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable(store.inspectSource)) {+ // PATCH(blacksky): re-entrancy guard. Under Metro's `inlineRequires`, this+ // module can first execute *after* make-built-in.js has already replaced+ // Function.prototype.toString. `functionToString` then captures the wrapper,+ // and wrapper -> inspectSource -> wrapper recurses until Hermes throws+ // "RangeError: Maximum call stack size exceeded (native stack depth)".+ // The eager `import 'core-js/internals/inspect-source'` in index.js makes+ // the capture happen before any wrap; this guard is the backstop in case+ // that import ever moves or is removed.+ // See https://github.com/zloirock/core-js/issues/1237+ var inspecting = false; store.inspectSource = function (it) {- return functionToString(it);+ if (inspecting) return '';+ inspecting = true;+ try {+ return functionToString(it);+ } finally {+ inspecting = false;+ } }; }