Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rocket.chat/apps-engine

Package Overview
Dependencies
Maintainers
4
Versions
619
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rocket.chat/apps-engine - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

2

package.json
{
"name": "@rocket.chat/apps-engine",
"version": "0.6.4",
"version": "0.6.5",
"description": "The engine code for the Rocket.Chat Apps which manages, runs, translates, coordinates and all of that.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,3 +30,2 @@ import { AppManager } from '../AppManager';

private isValidFile(file);
private buildCustomRequire(files);
}

@@ -13,2 +13,3 @@ "use strict";

const metadata_1 = require("@rocket.chat/apps-ts-definition/metadata");
const Utilities_1 = require("../misc/Utilities");
class AppCompiler {

@@ -121,4 +122,4 @@ constructor() {

// Let's ensure we search for the App's modules first
if (result.files[path.normalize(moduleName).replace(/\.\.\//g, '') + '.ts']) {
resolvedModules.push({ resolvedFileName: path.normalize(moduleName).replace(/\.\.\//g, '') + '.ts' });
if (result.files[Utilities_1.Utilities.transformModuleForCustomRequire(moduleName)]) {
resolvedModules.push({ resolvedFileName: Utilities_1.Utilities.transformModuleForCustomRequire(moduleName) });
}

@@ -224,3 +225,3 @@ else {

}
const customRequire = this.buildCustomRequire(files);
const customRequire = Utilities_1.Utilities.buildCustomRequire(files);
const context = vm.createContext({ require: customRequire, exports, process: {} });

@@ -274,15 +275,2 @@ const script = new vm.Script(files[path.normalize(storage.info.classFile)].compiled);

}
buildCustomRequire(files) {
return function _requirer(mod) {
if (files[path.normalize(mod + '.ts')]) {
const ourExport = {};
const context = vm.createContext({ require, exports: ourExport, process: {} });
vm.runInContext(files[path.normalize(mod + '.ts')].compiled, context);
return ourExport;
}
else {
return require(mod);
}
};
}
}

@@ -289,0 +277,0 @@ exports.AppCompiler = AppCompiler;

@@ -0,1 +1,2 @@

import { ICompilerFile } from '../compiler';
export declare class Utilities {

@@ -5,2 +6,6 @@ static deepClone<T>(item: T): T;

static deepCloneAndFreeze<T>(item: T): T;
static transformModuleForCustomRequire(moduleName: string): string;
static buildCustomRequire(files: {
[s: string]: ICompilerFile;
}): (mod: string) => {};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloneDeep = require("lodash.clonedeep");
const path = require("path");
const vm = require("vm");
class Utilities {

@@ -21,2 +23,22 @@ static deepClone(item) {

}
static transformModuleForCustomRequire(moduleName) {
return path.normalize(moduleName).replace(/\.\.\//g, '') + '.ts';
}
static buildCustomRequire(files) {
return function _requirer(mod) {
if (files[Utilities.transformModuleForCustomRequire(mod)]) {
const ourExport = {};
const context = vm.createContext({
require: Utilities.buildCustomRequire(files),
exports: ourExport,
process: {},
});
vm.runInContext(files[Utilities.transformModuleForCustomRequire(mod)].compiled, context);
return ourExport;
}
else {
return require(mod);
}
};
}
}

@@ -23,0 +45,0 @@ exports.Utilities = Utilities;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc