001-drive-proxy-adapter #1
@@ -56,8 +56,16 @@ function loadGlobalVariables() {
|
|||||||
const code = readFileSync(join(globalDir, file), "utf-8");
|
const code = readFileSync(join(globalDir, file), "utf-8");
|
||||||
const script = new vm.Script(code, { filename: file });
|
const script = new vm.Script(code, { filename: file });
|
||||||
const context = vm.createContext({ ...globalVMContext, ...globalVariableContext });
|
const context = vm.createContext({ ...globalVMContext, ...globalVariableContext });
|
||||||
globalVariableContext[varName] = script.runInContext(context);
|
|
||||||
logger.info(`Loaded global functions: ${varName}`);
|
// Execute script and capture returned object
|
||||||
|
const returnedObject = script.runInContext(context);
|
||||||
|
globalVariableContext[varName] = returnedObject;
|
||||||
|
|
||||||
|
logger.info(`Loaded global functions: ${varName}`, {
|
||||||
|
type: typeof returnedObject,
|
||||||
|
isObject: typeof returnedObject === 'object' && returnedObject !== null,
|
||||||
|
keys: returnedObject ? Object.keys(returnedObject).length : 0
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`Loaded ${jsonFiles.length + jsFiles.length} global variables`,
|
logger.info(`Loaded ${jsonFiles.length + jsFiles.length} global variables`,
|
||||||
|
|||||||
Reference in New Issue
Block a user