From 893db5d4e352f3aee2e7988e8a56d0fa19d3dd89 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 13 Dec 2023 12:36:07 -0500 Subject: [PATCH 1/2] Drop prerelease from version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3ca7324..1dd6918 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reflect-metadata", - "version": "0.2.0-pre.0", + "version": "0.2.0", "description": "Polyfill for Metadata Reflection API", "type": "commonjs", "main": "Reflect.js", From 85d168f9f05976e2102bfaea062a66b412610ef8 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 13 Dec 2023 13:51:57 -0500 Subject: [PATCH 2/2] Remove dynamic execution from lite-mode --- ReflectLite.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ReflectLite.ts b/ReflectLite.ts index 81f71e8..d1f0d0f 100644 --- a/ReflectLite.ts +++ b/ReflectLite.ts @@ -571,16 +571,8 @@ namespace Reflect { }; } - function functionThis() { - try { return Function("return this;")(); } catch (_) { } - } - - function indirectEvalThis() { - try { return (void 0, eval)("(function() { return this; })()"); } catch (_) { } - } - - function sloppyModeThis() { - return functionThis() || indirectEvalThis(); + function sloppyModeThis(): never { + throw new ReferenceError("globalThis could not be found. Please polyfill globalThis before loading this module."); } }) (function (exporter, root) {