@rocket.chat/apps-engine
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "@rocket.chat/apps-ts-definition", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Contains the TypeScript definitions for the Rocket.Chat Applications.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
{ | ||
"name": "@rocket.chat/apps-engine", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "The engine code for the Rocket.Chat Apps which manages, runs, translates, coordinates and all of that.", | ||
@@ -5,0 +5,0 @@ "main": "index", |
@@ -10,3 +10,3 @@ import { ICompilerFile } from '../compiler'; | ||
[s: string]: ICompilerFile; | ||
}): (mod: string) => {}; | ||
}, currentPath?: string): (mod: string) => {}; | ||
} |
@@ -36,3 +36,3 @@ "use strict"; | ||
} | ||
static buildCustomRequire(files) { | ||
static buildCustomRequire(files, currentPath = '.') { | ||
return function _requirer(mod) { | ||
@@ -50,2 +50,8 @@ // Keep compatibility with apps importing apps-ts-definition | ||
} | ||
if (Utilities.allowedInternalModuleRequire(mod)) { | ||
return require(mod); | ||
} | ||
if (currentPath !== '.') { | ||
mod = path.join(currentPath, mod); | ||
} | ||
const transformedModule = Utilities.transformModuleForCustomRequire(mod); | ||
@@ -55,3 +61,3 @@ if (files[transformedModule]) { | ||
const context = vm.createContext({ | ||
require: Utilities.buildCustomRequire(files), | ||
require: Utilities.buildCustomRequire(files, path.dirname(transformedModule) + '/'), | ||
console, | ||
@@ -64,5 +70,2 @@ exports: ourExport, | ||
} | ||
if (Utilities.allowedInternalModuleRequire(mod)) { | ||
return require(mod); | ||
} | ||
}; | ||
@@ -69,0 +72,0 @@ } |
Sorry, the diff of this file is not supported yet
825580
8933