New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@remixproject/engine

Package Overview
Dependencies
Maintainers
4
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remixproject/engine - npm Package Compare versions

Comparing version

to
0.3.0-beta.12

4

lib/abstract.d.ts

@@ -26,4 +26,4 @@ import type { Api, EventKey, EventParams, MethodKey, MethodParams, EventCallback, ApiMap, Profile, PluginRequest, PluginApi, PluginBase, IPluginService } from '@remixproject/plugin-utils';

set methods(methods: Extract<keyof T['methods'], string>[]);
activate(): void;
deactivate(): void;
activate(): any | Promise<any>;
deactivate(): any | Promise<any>;
setOptions(options?: Partial<PluginOptions>): void;

@@ -30,0 +30,0 @@ /** Call a method from this plugin */

@@ -31,7 +31,7 @@ import type { ExternalProfile, Profile, Message } from '@remixproject/plugin-utils';

*/
protected abstract connect(url: string): void;
protected abstract connect(url: string): any | Promise<any>;
/** Close connection with the plugin */
protected abstract disconnect(): void;
activate(): void;
deactivate(): void;
protected abstract disconnect(): any | Promise<any>;
activate(): Promise<any>;
deactivate(): Promise<any>;
/** Set options for an external plugin */

@@ -38,0 +38,0 @@ setOptions(options?: Partial<PluginConnectorOptions>): void;

@@ -24,12 +24,22 @@ "use strict";

activate() {
const url = this.options.transformUrl
? this.options.transformUrl(this.profile)
: transformUrl(this.profile);
this.connect(url);
super.activate();
const _super = Object.create(null, {
activate: { get: () => super.activate }
});
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const url = this.options.transformUrl
? this.options.transformUrl(this.profile)
: transformUrl(this.profile);
yield this.connect(url);
return _super.activate.call(this);
});
}
deactivate() {
this.loaded = false;
this.disconnect();
super.deactivate();
const _super = Object.create(null, {
deactivate: { get: () => super.deactivate }
});
return tslib_1.__awaiter(this, void 0, void 0, function* () {
this.loaded = false;
yield this.disconnect();
return _super.deactivate.call(this);
});
}

@@ -60,3 +70,3 @@ /** Set options for an external plugin */

}
this.call('manager', 'updateProfile', this.profile);
yield this.call('manager', 'updateProfile', this.profile);
this.loaded = true;

@@ -63,0 +73,0 @@ }

@@ -14,3 +14,2 @@ import type { Profile } from '@remixproject/plugin-utils';

} & Plugin;
export declare const managerMethods: string[];
interface ManagerProfile extends Profile {

@@ -26,3 +25,2 @@ name: 'manager';

protected actives: string[];
methods: string[];
protected onPluginActivated?(profile: Profile): any;

@@ -61,3 +59,3 @@ protected onPluginDeactivated?(profile: Profile): any;

*/
activatePlugin(names: string | string[]): Promise<void | void[]>;
activatePlugin(names: string | string[]): Promise<unknown>;
/**

@@ -67,3 +65,3 @@ * Check if caller can deactivate plugin and deactivate it if authorized

*/
deactivatePlugin(names: string | string[]): Promise<void | void[]>;
deactivatePlugin(names: string | string[]): Promise<unknown>;
/**

@@ -70,0 +68,0 @@ * Activate or deactivate by bypassing permission

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginManager = exports.managerMethods = void 0;
exports.PluginManager = void 0;
const tslib_1 = require("tslib");
const plugin_api_1 = require("@remixproject/plugin-api");
const abstract_1 = require("./abstract");
exports.managerMethods = ['getProfile', 'updateProfile', 'activatePlugin', 'deactivatePlugin', 'isActive', 'canCall'];
/**
* Wait for all promises to settle
* catch if one of them fail
*/
function catchAllPromises(promises) {
return new Promise((res, rej) => {
const resolved = [];
const rejected = [];
let ended = 0;
const settle = (value, err) => {
if (err)
rejected.push(err);
if (value)
resolved.push(value);
if (++ended === promises.length) {
rejected.length ? rej(resolved) : res(rejected);
}
};
for (const promise of promises) {
promise
.then(value => settle(value, null))
.catch(err => settle(null, err));
}
});
}
class PluginManager extends abstract_1.Plugin {

@@ -13,3 +37,2 @@ constructor(profile = plugin_api_1.pluginManagerProfile) {

this.actives = [];
this.methods = exports.managerMethods;
this.profiles[profile.name] = profile; // Initialise with own profile (cannot use addProfile because manager is not activated yet)

@@ -95,3 +118,3 @@ }

});
return Array.isArray(names) ? Promise.all(names.map(activate)) : activate(names);
return Array.isArray(names) ? catchAllPromises(names.map(activate)) : activate(names);
});

@@ -121,3 +144,3 @@ }

});
return Array.isArray(names) ? Promise.all(names.map(deactivate)) : deactivate(names);
return Array.isArray(names) ? catchAllPromises(names.map(deactivate)) : deactivate(names);
});

@@ -124,0 +147,0 @@ }

{
"name": "@remixproject/engine",
"version": "0.3.0-beta.11",
"version": "0.3.0-beta.12",
"homepage": "https://github.com/ethereum/remix-plugin/tree/master/packages/engine/core#readme",

@@ -24,8 +24,9 @@ "repository": {

"gitHead": "ca5c69be64ec4eaf7fe5d1d362726e75cb3b5726",
"main": "index.js",
"typings": "index.d.ts",
"main": "src\\index.js",
"typings": "src\\index.d.ts",
"dependencies": {
"@remixproject/plugin-utils": "0.3.0-beta.11",
"@remixproject/plugin-api": "0.3.0-beta.11"
}
"@remixproject/plugin-utils": "0.3.0-beta.12",
"@remixproject/plugin-api": "0.3.0-beta.12"
},
"peerDependencies": {}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet