From 252716ec716779af8484bcdc13e7cce951c65ee4 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 11 Jan 2019 22:27:27 +0800 Subject: [PATCH] Revert "lib: remove unused NativeModule/NativeModule wraps" This reverts commit 0cde1a4fdcd35724eb7e0f1408b199b7b30e070f. PR-URL: https://github.com/nodejs/node/pull/25446 Reviewed-By: Anna Henningsen --- lib/internal/bootstrap/loaders.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 2d197c768c7107..48d83f12e12186 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -252,6 +252,15 @@ return NativeModule._source[id]; }; + NativeModule.wrap = function(script) { + return NativeModule.wrapper[0] + script + NativeModule.wrapper[1]; + }; + + NativeModule.wrapper = [ + '(function (exports, require, module, process, internalBinding) {', + '\n});' + ]; + const getOwn = (target, property, receiver) => { return ReflectApply(ObjectHasOwnProperty, target, [property]) ? ReflectGet(target, property, receiver) :