Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 0f02a27

Browse files
Chore: Removing module resolution log (#551)
1 parent cc757c9 commit 0f02a27

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/server/runtime/AppsEngineVM2Runtime.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class AppsEngineVM2Runtime extends AppsEngineRuntime {
2525
timeout: options?.timeout,
2626
sandbox: {
2727
...AppsEngineVM2Runtime.defaultNodeVMOptions.sandbox,
28-
...sandbox || {},
28+
...(sandbox || {}),
2929
},
3030
};
3131

@@ -35,7 +35,6 @@ export class AppsEngineVM2Runtime extends AppsEngineRuntime {
3535
external: ['@rocket.chat/apps-engine', 'uuid'],
3636
builtin: ['path', 'url', 'crypto', 'buffer', 'stream', 'net', 'http', 'https', 'zlib', 'util', 'punycode', 'os', 'querystring'],
3737
resolve: (moduleName, p) => {
38-
console.log('Resolving '.concat(moduleName, ' from ').concat(p));
3938
return path.resolve(p + '/npm/node_modules/' + moduleName);
4039
},
4140
context: 'sandbox',
@@ -45,10 +44,10 @@ export class AppsEngineVM2Runtime extends AppsEngineRuntime {
4544
}
4645
const vm = new NodeVM(vmOptions);
4746

48-
const app = (vm.run(code, {
47+
const app = vm.run(code, {
4948
filename: options?.filename || 'app.js',
5049
require: (mod: string) => resolve(mod, vm.require.bind(vm)),
51-
} as any));
50+
} as any);
5251
// Get first exported object, vm2 does not return the last value when it's an assignment as intern vm
5352
// so we use the first exported value as the class.
5453
return options?.returnAllExports ? app : app && app[Object.keys(app)[0]];
@@ -75,11 +74,13 @@ export class AppsEngineVM2Runtime extends AppsEngineRuntime {
7574
});
7675

7776
// Clean up the sandbox after the code has run
78-
this.vm.setGlobals(Object.keys(sandbox).reduce((acc, key) => {
79-
acc[key] = undefined;
77+
this.vm.setGlobals(
78+
Object.keys(sandbox).reduce((acc, key) => {
79+
acc[key] = undefined;
8080

81-
return acc;
82-
}, {} as typeof sandbox));
81+
return acc;
82+
}, {} as typeof sandbox),
83+
);
8384

8485
return result;
8586
}

0 commit comments

Comments
 (0)