001-drive-proxy-adapter #1

Merged
Peter.Morton merged 25 commits from 001-drive-proxy-adapter into main 2026-03-07 12:45:57 -06:00
Showing only changes of commit 6df1d49e9a - Show all commits

View File

@@ -89,12 +89,13 @@ function loadGlobalVariableFunctions() {
const code = readFileSync(filePath, "utf-8"); const code = readFileSync(filePath, "utf-8");
const script = new vm.Script(code, { filename: file }); const script = new vm.Script(code, { filename: file });
// Execute in context with crypto and console // Execute in context with all VM globals and previously loaded variables
// Expects file to return an object via IIFE // Allows function modules to access same dependencies as proxy.js
const tempContext = vm.createContext({ const tempContext = vm.createContext({
crypto, ...globalVMContext,
console: logger, ...globalVariableContext,
}); });
const exportedObject = script.runInContext(tempContext); const exportedObject = script.runInContext(tempContext);
globalVariableContext[functionName] = exportedObject; globalVariableContext[functionName] = exportedObject;