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

pogo

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pogo - npm Package Compare versions

Comparing version 0.8.0-beta7 to 0.8.0

182

lib/optionParser.js
(function() {
var self = this;
var $class, BooleanOption, OptionParser;
var $class, BooleanOption, StringOption, camelCaseName, string, boolean, parsers, OptionParser;
$class = require("./class").class;

@@ -13,17 +13,6 @@ BooleanOption = $class({

self.shortName = shortName;
self.name = self._camelCaseName(longName);
self.name = camelCaseName(longName);
self.longName = longName;
return self.description = description;
},
_camelCaseName: function(longName) {
var self = this;
var segments, name, n, segment;
segments = longName.split(/-/);
name = segments[0];
for (n = 1; n < segments.length; ++n) {
segment = segments[n];
name = name + (segment[0].toUpperCase() + segment.substring(1));
}
return name;
},
init: function(options) {

@@ -54,2 +43,74 @@ var self = this;

});
StringOption = $class({
constructor: function(gen2_options) {
var self = this;
var shortName, longName, description;
shortName = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "shortName") && gen2_options.shortName !== void 0 ? gen2_options.shortName : void 0;
longName = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "longName") && gen2_options.longName !== void 0 ? gen2_options.longName : void 0;
description = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "description") && gen2_options.description !== void 0 ? gen2_options.description : void 0;
self.shortName = shortName;
self.name = camelCaseName(longName);
self.longName = longName;
return self.description = description;
},
init: function(options) {
var self = this;
return options[self.name] = void 0;
},
set: function(options, arguments) {
var self = this;
return options[self.name] = arguments.shift();
},
toString: function() {
var self = this;
var switches;
switches = [ function() {
if (self.shortName) {
return "-" + self.shortName;
}
}(), function() {
if (self.longName) {
return "--" + self.longName;
}
}() ].filter(function(s) {
return s;
}).join(", ");
return " " + switches + "\n\n " + self.description + "\n";
}
});
camelCaseName = function(longName) {
var segments, name, n, segment;
segments = longName.split(/-/);
name = segments[0];
for (n = 1; n < segments.length; ++n) {
segment = segments[n];
name = name + (segment[0].toUpperCase() + segment.substring(1));
}
return name;
};
parsers = [ string = function(description) {
var match, shortName, longName;
match = /(-([a-z0-9])\s*,\s*)?--([a-z0-9-]+)=<[a-z0-9-]+>\s*(.*)/i.exec(description);
if (match) {
shortName = match[2];
longName = match[3];
return new StringOption({
shortName: shortName,
longName: longName,
description: match[4]
});
}
}, boolean = function(description) {
var match, shortName, longName;
match = /(-([a-z0-9])\s*,\s*)?--([a-z0-9-]*)\s*(.*)/i.exec(description);
if (match) {
shortName = match[2];
longName = match[3];
return new BooleanOption({
shortName: shortName,
longName: longName,
description: match[4]
});
}
} ];
OptionParser = $class({

@@ -64,15 +125,24 @@ constructor: function() {

var self = this;
var match, shortName, longName, option;
match = /(-([a-z0-9])\s*,\s*)?--([a-z0-9-]*)\s*(.*)/i.exec(description);
if (!match) {
throw new Error("expected option be of the form '[-x, ]--xxxx some description of xxxx'");
var option;
option = function() {
var gen3_results, gen4_items, gen5_i, parser;
gen3_results = [];
gen4_items = parsers;
for (gen5_i = 0; gen5_i < gen4_items.length; ++gen5_i) {
parser = gen4_items[gen5_i];
(function(parser) {
var option;
option = parser(description);
if (option) {
return gen3_results.push(option);
}
})(parser);
}
return gen3_results;
}()[0];
if (option) {
return self._addOption(option);
} else {
throw new Error("expected option be of the form '[-x, ]--xxxx[=<value>] some description of xxxx'");
}
shortName = match[2];
longName = match[3];
option = new BooleanOption({
shortName: shortName,
longName: longName,
description: match[4]
});
return self._addOption(option);
},

@@ -107,6 +177,6 @@ _addOption: function(option) {

var self = this;
var gen2_items, gen3_i, option;
gen2_items = self._options;
for (gen3_i = 0; gen3_i < gen2_items.length; ++gen3_i) {
option = gen2_items[gen3_i];
var gen6_items, gen7_i, option;
gen6_items = self._options;
for (gen7_i = 0; gen7_i < gen6_items.length; ++gen7_i) {
option = gen6_items[gen7_i];
option.init(options);

@@ -118,3 +188,3 @@ }

var self = this;
var options, n, gen4_forResult;
var options, remainingArguments, arg, longMatch, shortMatch, option, gen8_items, gen9_i, shortOption, gen10_o;
if (!args) {

@@ -127,28 +197,22 @@ args = process.argv;

self._setDefaultOptions(options);
for (n = 0; n < args.length; ++n) {
gen4_forResult = void 0;
if (function(n) {
var arg, longMatch, shortMatch, option, gen5_items, gen6_i, shortOption, gen7_o;
arg = args[n];
longMatch = /^--([a-z0-9-]*)$/.exec(arg);
shortMatch = /^-([a-z0-9-]*)$/.exec(arg);
option = void 0;
if (longMatch) {
option = self._findLongOption(longMatch[1]);
option.set(options);
} else if (shortMatch) {
gen5_items = shortMatch[1];
for (gen6_i = 0; gen6_i < gen5_items.length; ++gen6_i) {
shortOption = gen5_items[gen6_i];
option = self._findShortOption(shortOption);
option.set(options);
}
} else {
gen7_o = options._;
gen7_o.push.apply(gen7_o, args.slice(n));
gen4_forResult = options;
return true;
remainingArguments = args.slice();
while (remainingArguments.length > 0) {
arg = remainingArguments.shift();
longMatch = /^--([a-z0-9-]*)$/.exec(arg);
shortMatch = /^-([a-z0-9-]*)$/.exec(arg);
option = void 0;
if (longMatch) {
option = self._findLongOption(longMatch[1]);
option.set(options, remainingArguments);
} else if (shortMatch) {
gen8_items = shortMatch[1];
for (gen9_i = 0; gen9_i < gen8_items.length; ++gen9_i) {
shortOption = gen8_items[gen9_i];
option = self._findShortOption(shortOption);
option.set(options, remainingArguments);
}
}(n)) {
return gen4_forResult;
} else {
gen10_o = options._;
gen10_o.push.apply(gen10_o, [ arg ].concat(remainingArguments.slice()));
return options;
}

@@ -160,7 +224,7 @@ }

var self = this;
var gen8_items, gen9_i, option;
var gen11_items, gen12_i, option;
process.stdout.write("usage:\n\n pogo [debug] script.pogo [script options]\n pogo [options] scripts ...\n\noptions:\n\n");
gen8_items = self._options;
for (gen9_i = 0; gen9_i < gen8_items.length; ++gen9_i) {
option = gen8_items[gen9_i];
gen11_items = self._options;
for (gen12_i = 0; gen12_i < gen11_items.length; ++gen12_i) {
option = gen11_items[gen12_i];
process.stdout.write(option + "\n");

@@ -167,0 +231,0 @@ }

var cg = require('../codeGenerator');
exports.codeGenerator = function () {
exports.codeGenerator = function (options) {
var codegen = {};

@@ -110,2 +110,3 @@

codegen.closureParameterStrategies = require('../terms/closureParameterStrategies')(codegen);
codegen.promisesModule = promisesModule(options);

@@ -115,2 +116,12 @@ return codegen;

function promisesModule(options) {
var moduleName = (options && options.promises) || 'bluebird';
if (moduleName === 'none') {
return undefined;
} else {
return moduleName;
}
}
var loc = function (term, location) {

@@ -117,0 +128,0 @@ var loc = {

@@ -11,5 +11,3 @@ (function() {

compiler = require("./compiler");
createTerms = function() {
return require("./codeGenerator").codeGenerator();
};
createTerms = require("./codeGenerator").codeGenerator;
runningOnNodeOrHigher = function(version) {

@@ -19,4 +17,5 @@ return !versions.isLessThan(process.version, version);

exports.compileFile = compileFile = function(filename, gen1_options) {
var ugly;
var ugly, promises;
ugly = gen1_options !== void 0 && Object.prototype.hasOwnProperty.call(gen1_options, "ugly") && gen1_options.ugly !== void 0 ? gen1_options.ugly : false;
promises = gen1_options !== void 0 && Object.prototype.hasOwnProperty.call(gen1_options, "promises") && gen1_options.promises !== void 0 ? gen1_options.promises : void 0;
var fullFilename, jsFilename, js;

@@ -27,2 +26,3 @@ fullFilename = fs.realpathSync(filename);

ugly: ugly,
promises: promises,
outputFilename: jsFilename

@@ -88,9 +88,9 @@ });

};
exports.runFileInModule = function(filename, module) {
exports.runFileInModule = function(filename, module, options) {
var self = this;
var js;
js = compileFromFile(filename);
js = compileFromFile(filename, options);
return module._compile(js, filename);
};
exports.runMain = function(filename) {
exports.runMain = function(filename, options) {
var self = this;

@@ -107,7 +107,9 @@ var fullFilename, module;

module.paths = Module._nodeModulePaths(path.dirname(fullFilename));
exports.runFileInModule(fullFilename, module);
exports.runFileInModule(fullFilename, module, options);
return module.loaded = true;
};
exports.repl = function() {
exports.repl = function(gen4_options) {
var self = this;
var promises;
promises = gen4_options !== void 0 && Object.prototype.hasOwnProperty.call(gen4_options, "promises") && gen4_options.promises !== void 0 ? gen4_options.promises : void 0;
var compilePogo, evalPogo;

@@ -127,3 +129,5 @@ compilePogo = function(source, filename, terms) {

source = sourceWithParens.replace(/^\(((.|[\r\n])*)\)$/gm, "$1");
terms = createTerms();
terms = createTerms({
promises: promises
});
terms.moduleConstants.onEachNewDefinition(function(d) {

@@ -166,6 +170,7 @@ var definitionJs;

};
compileFromFile = function(filename, gen4_options) {
var ugly, outputFilename;
ugly = gen4_options !== void 0 && Object.prototype.hasOwnProperty.call(gen4_options, "ugly") && gen4_options.ugly !== void 0 ? gen4_options.ugly : false;
outputFilename = gen4_options !== void 0 && Object.prototype.hasOwnProperty.call(gen4_options, "outputFilename") && gen4_options.outputFilename !== void 0 ? gen4_options.outputFilename : void 0;
compileFromFile = function(filename, gen5_options) {
var ugly, outputFilename, promises;
ugly = gen5_options !== void 0 && Object.prototype.hasOwnProperty.call(gen5_options, "ugly") && gen5_options.ugly !== void 0 ? gen5_options.ugly : false;
outputFilename = gen5_options !== void 0 && Object.prototype.hasOwnProperty.call(gen5_options, "outputFilename") && gen5_options.outputFilename !== void 0 ? gen5_options.outputFilename : void 0;
promises = gen5_options !== void 0 && Object.prototype.hasOwnProperty.call(gen5_options, "promises") && gen5_options.promises !== void 0 ? gen5_options.promises : void 0;
var contents;

@@ -176,3 +181,4 @@ contents = fs.readFileSync(filename, "utf-8");

ugly: ugly,
outputFilename: outputFilename
outputFilename: outputFilename,
promises: promises
});

@@ -179,0 +185,0 @@ };

@@ -6,5 +6,3 @@ (function() {

createParser = require("./parser").createParser;
createTerms = function() {
return require("./codeGenerator").codeGenerator();
};
createTerms = require("./codeGenerator").codeGenerator;
object = require("./runtime").object;

@@ -54,3 +52,3 @@ sm = require("source-map");

var self = this;
var filename, inScope, ugly, global, returnResult, async, terms, outputFilename, sourceMap;
var filename, inScope, ugly, global, returnResult, async, outputFilename, sourceMap, promises, terms;
filename = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "filename") && gen2_options.filename !== void 0 ? gen2_options.filename : void 0;

@@ -62,5 +60,8 @@ inScope = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "inScope") && gen2_options.inScope !== void 0 ? gen2_options.inScope : true;

async = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "async") && gen2_options.async !== void 0 ? gen2_options.async : false;
terms = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "terms") && gen2_options.terms !== void 0 ? gen2_options.terms : createTerms();
outputFilename = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "outputFilename") && gen2_options.outputFilename !== void 0 ? gen2_options.outputFilename : void 0;
sourceMap = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "sourceMap") && gen2_options.sourceMap !== void 0 ? gen2_options.sourceMap : false;
promises = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "promises") && gen2_options.promises !== void 0 ? gen2_options.promises : void 0;
terms = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "terms") && gen2_options.terms !== void 0 ? gen2_options.terms : createTerms({
promises: promises
});
var parser, statements, output, memoryStream, error;

@@ -129,3 +130,5 @@ parser = createParser({

name = gen5_items[gen6_i];
gen4_results.push(definitions[name]);
(function(name) {
return gen4_results.push(definitions[name]);
})(name);
}

@@ -132,0 +135,0 @@ return gen4_results;

@@ -5,8 +5,16 @@ (function() {

var self = this;
var promisesModule, js;
return function() {
return terms.moduleConstants.defineAs([ "Promise" ], terms.javascript('require("bluebird")'), {
generated: false
});
var promisesModule, js;
if (terms.promisesModule) {
promisesModule = JSON.stringify(terms.promisesModule);
js = "require(" + promisesModule + ")";
return terms.moduleConstants.defineAs([ "Promise" ], terms.javascript(js), {
generated: false
});
} else {
return terms.javascript("Promise");
}
};
};
}).call(this);
{
"name": "pogo",
"version": "0.8.0-beta7",
"version": "0.8.0",
"description": "A readable, DSL friendly programming language that compiles to JavaScript",

@@ -5,0 +5,0 @@ "author": "Tim Macfarlane <timmacfarlane@gmail.com>",

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

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