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

@remixproject/plugin-utils

Package Overview
Dependencies
Maintainers
4
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remixproject/plugin-utils - npm Package Compare versions

Comparing version 0.3.0-beta.7 to 0.3.0-beta.8

21

index.js

@@ -1,10 +0,13 @@

export * from './lib/tools/event-name';
export * from './lib/tools/method-path';
export * from './lib/tools/service';
export * from './lib/types/api';
export * from './lib/types/message';
export * from './lib/types/plugin';
export * from './lib/types/profile';
export * from './lib/types/service';
export * from './lib/types/status';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./lib/tools/event-name"), exports);
tslib_1.__exportStar(require("./lib/tools/method-path"), exports);
tslib_1.__exportStar(require("./lib/tools/service"), exports);
tslib_1.__exportStar(require("./lib/types/api"), exports);
tslib_1.__exportStar(require("./lib/types/message"), exports);
tslib_1.__exportStar(require("./lib/types/plugin"), exports);
tslib_1.__exportStar(require("./lib/types/profile"), exports);
tslib_1.__exportStar(require("./lib/types/service"), exports);
tslib_1.__exportStar(require("./lib/types/status"), exports);
//# sourceMappingURL=index.js.map

@@ -0,9 +1,14 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.listenEvent = exports.callEvent = void 0;
/** Create the name of the event for a call */
export function callEvent(name, key, id) {
function callEvent(name, key, id) {
return `[${name}] ${key}-${id}`;
}
exports.callEvent = callEvent;
/** Create the name of the event for a listen */
export function listenEvent(name, key) {
function listenEvent(name, key) {
return `[${name}] ${key}`;
}
exports.listenEvent = listenEvent;
//# sourceMappingURL=event-name.js.map

@@ -0,3 +1,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRootPath = exports.getMethodPath = void 0;
/** Create a method path based on the method name and the path */
export function getMethodPath(method, path) {
function getMethodPath(method, path) {
if (!path) {

@@ -11,6 +14,8 @@ return method;

}
exports.getMethodPath = getMethodPath;
/** Get the root name of a path */
export function getRootPath(path) {
function getRootPath(path) {
return path.split('.').shift();
}
exports.getRootPath = getRootPath;
//# sourceMappingURL=method-path.js.map

@@ -1,5 +0,8 @@

import { __awaiter } from "tslib";
import { getRootPath } from './method-path';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginService = exports.activateService = exports.createService = exports.getMethods = exports.isPluginService = void 0;
const tslib_1 = require("tslib");
const method_path_1 = require("./method-path");
/** Check if the plugin is an instance of PluginService */
export const isPluginService = (service) => {
exports.isPluginService = (service) => {
return service instanceof PluginService;

@@ -11,3 +14,3 @@ };

*/
export function getMethods(service) {
function getMethods(service) {
// If service exposes methods, use them

@@ -23,3 +26,3 @@ if (service.methods) {

// Else get the public methods (without "_")
if (isPluginService(service)) {
if (exports.isPluginService(service)) {
const methods = Object.getPrototypeOf(service);

@@ -36,2 +39,3 @@ return Object.getOwnPropertyNames(methods).filter(m => {

}
exports.getMethods = getMethods;
/**

@@ -43,4 +47,4 @@ * Create a plugin service

*/
export function createService(path, service) {
if (service.path && getRootPath(service.path) !== path) {
function createService(path, service) {
if (service.path && method_path_1.getRootPath(service.path) !== path) {
throw new Error(`Service path ${service.path} is different from the one provided: ${path}`);

@@ -54,3 +58,3 @@ }

}
if (isPluginService(service)) {
if (exports.isPluginService(service)) {
if (!service.methods) {

@@ -65,2 +69,3 @@ service.methods = methods;

}
exports.createService = createService;
/**

@@ -71,3 +76,3 @@ * Connect the service to the plugin client

*/
export function activateService(client, service) {
function activateService(client, service) {
client.methods = [

@@ -83,6 +88,7 @@ ...(client.methods || []),

}
exports.activateService = activateService;
/**
* A node that forward the call to the right path
*/
export class PluginService {
class PluginService {
emit(key, ...payload) {

@@ -97,3 +103,3 @@ this.plugin.emit(key, ...payload);

createService(name, service) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (this.methods.includes(name)) {

@@ -119,3 +125,3 @@ throw new Error('A service cannot have the same name as an exposed method');

const path = `${this.path}.${name}`;
this.plugin.activateService[path] = () => __awaiter(this, void 0, void 0, function* () {
this.plugin.activateService[path] = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
const service = factory();

@@ -129,2 +135,3 @@ const _service = createService(path, service);

}
exports.PluginService = PluginService;
//# sourceMappingURL=service.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=api.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=message.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=plugin.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=profile.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=service.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=status.js.map
{
"name": "@remixproject/plugin-utils",
"version": "0.3.0-beta.7",
"version": "0.3.0-beta.8",
"dependencies": {
"tslib": "2.0.1"
},
"homepage": "https://github.com/ethereum/remix-plugin/tree/master/packages/utils#readme",

@@ -5,0 +8,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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