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

sf-sketch-rpc

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sf-sketch-rpc - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

13

lib/scripts.js

@@ -6,7 +6,2 @@ Object.defineProperty(exports, "__esModule", {

var _templateObject = _taggedTemplateLiteral([''], ['']),
_templateObject2 = _taggedTemplateLiteral(['\n(function (bundlePath, bundleId) {\n var commandDescriptors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n\n\n // Embedded Utils.\n var _isBoxedObject = function _isBoxedObject(obj) {\n return toString.call(obj) == \'[object MOBoxedObject]\';\n };\n\n var _isArray = function _isArray(obj) {\n return Array.isArray(obj);\n };\n\n var _each = function _each(collection) {\n var iteratee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n\n if (_isBoxedObject(collection) && collection.className() == \'NSArray\') {\n var count = collection.count();\n for (var i = 0; i < count; i++) {\n iteratee(collection.objectAtIndex(i), i);\n }\n } else if (_isArray(collection)) {\n for (var _i = 0; _i < collection.length; _i++) {\n iteratee(collection[_i], _i);\n }\n }\n };\n\n var _ = {\n isBoxedObject: _isBoxedObject,\n isArray: _isArray,\n each: _each\n };\n\n // Bootstrapper logic.\n var appController = NSApp.delegate();\n var pluginsManager = appController.pluginManager();\n\n var allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands, function (command) {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n var plugins = pluginsManager.plugins();\n\n var url = NSURL.fileURLWithPath(bundlePath);\n var bundle = MSPluginBundle.pluginBundleWithURL(url);\n\n var findPluginsMenu = function findPluginsMenu() {\n var mainMenu = NSApp.mainMenu();\n var pluginsMenuItem = mainMenu.itemWithTitle(\'Plugins\');\n\n var menu = pluginsMenuItem.submenu();\n return menu;\n };\n\n var pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n // Inserting menu item.\n var menu = findPluginsMenu();\n\n var customMenu = NSMenu.alloc().init();\n pluginsManager.addCommands_toMenu_fromDescription_selector(bundle.commands(), customMenu, bundle.menuDescription(), NSSelectorFromString(\'runPlugin:\'));\n\n var menuItem = NSMenuItem.alloc().init();\n menuItem.title = bundle.name() + " (dev)";\n menuItem.submenu = customMenu;\n\n menu.insertItem_atIndex(menuItem, 0);\n menu.insertItem_atIndex(NSMenuItem.separatorItem(), 1);\n\n // Execute commands\n _.each(commandDescriptors, function (descriptor) {\n var command = bundle.commands()[descriptor.identifier];\n\n var context = MSDocument.currentDocument().pluginContext();\n var cmdContext = command.fullContextFromContext_url(context, bundle.url());\n cmdContext.remoteContext = descriptor.context;\n command.run_manager(cmdContext, pluginsManager);\n });\n})("<<\'{{{pluginBundlePath}}}\'>>", "<<\'{{{bundleID}}}\'>>", "<<{{{commandDescriptors}}}>>");\n'], ['\n(function (bundlePath, bundleId) {\n var commandDescriptors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n\n\n // Embedded Utils.\n var _isBoxedObject = function _isBoxedObject(obj) {\n return toString.call(obj) == \'[object MOBoxedObject]\';\n };\n\n var _isArray = function _isArray(obj) {\n return Array.isArray(obj);\n };\n\n var _each = function _each(collection) {\n var iteratee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n\n if (_isBoxedObject(collection) && collection.className() == \'NSArray\') {\n var count = collection.count();\n for (var i = 0; i < count; i++) {\n iteratee(collection.objectAtIndex(i), i);\n }\n } else if (_isArray(collection)) {\n for (var _i = 0; _i < collection.length; _i++) {\n iteratee(collection[_i], _i);\n }\n }\n };\n\n var _ = {\n isBoxedObject: _isBoxedObject,\n isArray: _isArray,\n each: _each\n };\n\n // Bootstrapper logic.\n var appController = NSApp.delegate();\n var pluginsManager = appController.pluginManager();\n\n var allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands, function (command) {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n var plugins = pluginsManager.plugins();\n\n var url = NSURL.fileURLWithPath(bundlePath);\n var bundle = MSPluginBundle.pluginBundleWithURL(url);\n\n var findPluginsMenu = function findPluginsMenu() {\n var mainMenu = NSApp.mainMenu();\n var pluginsMenuItem = mainMenu.itemWithTitle(\'Plugins\');\n\n var menu = pluginsMenuItem.submenu();\n return menu;\n };\n\n var pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n // Inserting menu item.\n var menu = findPluginsMenu();\n\n var customMenu = NSMenu.alloc().init();\n pluginsManager.addCommands_toMenu_fromDescription_selector(bundle.commands(), customMenu, bundle.menuDescription(), NSSelectorFromString(\'runPlugin:\'));\n\n var menuItem = NSMenuItem.alloc().init();\n menuItem.title = bundle.name() + " (dev)";\n menuItem.submenu = customMenu;\n\n menu.insertItem_atIndex(menuItem, 0);\n menu.insertItem_atIndex(NSMenuItem.separatorItem(), 1);\n\n // Execute commands\n _.each(commandDescriptors, function (descriptor) {\n var command = bundle.commands()[descriptor.identifier];\n\n var context = MSDocument.currentDocument().pluginContext();\n var cmdContext = command.fullContextFromContext_url(context, bundle.url());\n cmdContext.remoteContext = descriptor.context;\n command.run_manager(cmdContext, pluginsManager);\n });\n})("<<\'{{{pluginBundlePath}}}\'>>", "<<\'{{{bundleID}}}\'>>", "<<{{{commandDescriptors}}}>>");\n']),
_templateObject3 = _taggedTemplateLiteral(['\nconst app = COScript.app(\'{{{appName}}}\');\napp.delegate().runPluginScript_name("<<\'{{{script}}}\'>>","<<\'FusionLauncher\'>>");\n'], ['\nconst app = COScript.app(\'{{{appName}}}\');\napp.delegate().runPluginScript_name("<<\'{{{script}}}\'>>","<<\'FusionLauncher\'>>");\n']),
_templateObject4 = _taggedTemplateLiteral(['\n(function(options){\n const appController = NSApp.delegate();\n const pluginsManager = appController.pluginManager();\n\n const allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands,(command) => {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n const plugins = pluginsManager.plugins();\n\n const url = NSURL.fileURLWithPath(bundlePath);\n const bundle = MSPluginBundle.pluginBundleWithURL(url);\n const pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n})("<<{{{options}}}\'>>")\n'], ['\n(function(options){\n const appController = NSApp.delegate();\n const pluginsManager = appController.pluginManager();\n\n const allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands,(command) => {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n const plugins = pluginsManager.plugins();\n\n const url = NSURL.fileURLWithPath(bundlePath);\n const bundle = MSPluginBundle.pluginBundleWithURL(url);\n const pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n})("<<{{{options}}}\'>>")\n']);
var _lodash = require('lodash');

@@ -34,4 +29,2 @@

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
/*

@@ -46,7 +39,7 @@ const readTemplateNamed = (name) => {

templates['bootstrap-plugin-instance'] = ''(_templateObject2)(_templateObject);
templates['bootstrap-plugin-instance'] = '(function (bundlePath, bundleId) {\n var commandDescriptors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n\n\n // Embedded Utils.\n var _isBoxedObject = function _isBoxedObject(obj) {\n return toString.call(obj) == \'[object MOBoxedObject]\';\n };\n\n var _isArray = function _isArray(obj) {\n return Array.isArray(obj);\n };\n\n var _each = function _each(collection) {\n var iteratee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n\n if (_isBoxedObject(collection) && collection.className() == \'NSArray\') {\n var count = collection.count();\n for (var i = 0; i < count; i++) {\n iteratee(collection.objectAtIndex(i), i);\n }\n } else if (_isArray(collection)) {\n for (var _i = 0; _i < collection.length; _i++) {\n iteratee(collection[_i], _i);\n }\n }\n };\n\n var _ = {\n isBoxedObject: _isBoxedObject,\n isArray: _isArray,\n each: _each\n };\n\n // Bootstrapper logic.\n var appController = NSApp.delegate();\n var pluginsManager = appController.pluginManager();\n\n var allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands, function (command) {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n var plugins = pluginsManager.plugins();\n\n var url = NSURL.fileURLWithPath(bundlePath);\n var bundle = MSPluginBundle.pluginBundleWithURL(url);\n\n var findPluginsMenu = function findPluginsMenu() {\n var mainMenu = NSApp.mainMenu();\n var pluginsMenuItem = mainMenu.itemWithTitle(\'Plugins\');\n\n var menu = pluginsMenuItem.submenu();\n return menu;\n };\n\n var pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n // Inserting menu item.\n var menu = findPluginsMenu();\n\n var customMenu = NSMenu.alloc().init();\n pluginsManager.addCommands_toMenu_fromDescription_selector(bundle.commands(), customMenu, bundle.menuDescription(), NSSelectorFromString(\'runPlugin:\'));\n\n var menuItem = NSMenuItem.alloc().init();\n menuItem.title = bundle.name() + " (dev)";\n menuItem.submenu = customMenu;\n\n menu.insertItem_atIndex(menuItem, 0);\n menu.insertItem_atIndex(NSMenuItem.separatorItem(), 1);\n\n // Execute commands\n _.each(commandDescriptors, function (descriptor) {\n var command = bundle.commands()[descriptor.identifier];\n\n var context = MSDocument.currentDocument().pluginContext();\n var cmdContext = command.fullContextFromContext_url(context, bundle.url());\n cmdContext.remoteContext = descriptor.context;\n command.run_manager(cmdContext, pluginsManager);\n });\n})("<<\'{{{pluginBundlePath}}}\'>>", "<<\'{{{bundleID}}}\'>>", "<<{{{commandDescriptors}}}>>");\n';
templates['coscript-executor'] = ''(_templateObject3)(_templateObject);
templates['coscript-executor'] = 'const app = COScript.app(\'{{{appName}}}\');\napp.delegate().runPluginScript_name("<<\'{{{script}}}\'>>","<<\'FusionLauncher\'>>");\n';
templates['plugin-command-executor'] = ''(_templateObject4)(_templateObject);
templates['plugin-command-executor'] = '(function(options){\n const appController = NSApp.delegate();\n const pluginsManager = appController.pluginManager();\n\n const allRunningCommands = pluginsManager.runningCommands().allValues();\n _.each(allRunningCommands,(command) => {\n if (command.pluginBundle().identifier() == bundleId) {\n print(\'Tearing down sessions for command: \' + command.identifier());\n command.tearDownSession();\n }\n });\n\n pluginsManager.cleanupFinishedCommands();\n\n const plugins = pluginsManager.plugins();\n\n const url = NSURL.fileURLWithPath(bundlePath);\n const bundle = MSPluginBundle.pluginBundleWithURL(url);\n const pls = NSMutableDictionary.dictionaryWithDictionary(plugins);\n pls[bundle.identifier()] = bundle;\n pluginsManager.plugins = NSDictionary.dictionaryWithDictionary(pls);\n\n})("<<{{{options}}}\'>>")';

@@ -53,0 +46,0 @@ var readTemplateNamed = function readTemplateNamed(name) {

{
"name": "sf-sketch-rpc",
"version": "1.0.5",
"version": "1.0.6",
"description": "RPC module based on `coscript` cli for running scripts in Sketch runtime on node.js platform",

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

@@ -17,4 +17,3 @@

templates['bootstrap-plugin-instance'] = ```
(function (bundlePath, bundleId) {
templates['bootstrap-plugin-instance'] = `(function (bundlePath, bundleId) {
var commandDescriptors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];

@@ -107,11 +106,9 @@

})("<<'{{{pluginBundlePath}}}'>>", "<<'{{{bundleID}}}'>>", "<<{{{commandDescriptors}}}>>");
```;
`;
templates['coscript-executor'] = ```
const app = COScript.app('{{{appName}}}');
templates['coscript-executor'] = `const app = COScript.app('{{{appName}}}');
app.delegate().runPluginScript_name("<<'{{{script}}}'>>","<<'FusionLauncher'>>");
```;
`;
templates['plugin-command-executor'] = ```
(function(options){
templates['plugin-command-executor'] = `(function(options){
const appController = NSApp.delegate();

@@ -138,4 +135,3 @@ const pluginsManager = appController.pluginManager();

})("<<{{{options}}}'>>")
```;
})("<<{{{options}}}'>>")`;

@@ -142,0 +138,0 @@ const readTemplateNamed = (name) => {

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