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

grasp

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grasp - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0-beta

8

lib/format.js

@@ -1,5 +0,6 @@

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){
var ref$, id, compact, unlines, min, max;
var ref$, id, compact, unlines, min, max, slash;
ref$ = require('prelude-ls'), id = ref$.id, compact = ref$.compact, unlines = ref$.unlines, min = ref$.min, max = ref$.max;
slash = require('slash');
module.exports = {

@@ -69,3 +70,3 @@ formatResult: formatResult,

: color.green(displayStartLine) : '';
separatorString = (multiline ? color.cyan((locationString.length ? ':' : '') + "(multiline)") : '') + "" + (locationString.length || multiline ? color.cyan(':') : '') + "" + (multiline ? '\n' : '');
separatorString = (multiline && options.multilineSeparator ? color.cyan((locationString.length ? ':' : '') + "(multiline)") : '') + "" + (locationString.length || multiline && options.multilineSeparator ? color.cyan(':') : '') + "" + (multiline && (locationString.length || options.multilineSeparator) ? '\n' : '');
nameString = options.displayFilename ? formatName(color, name) + "" + color.cyan(':') : '';

@@ -75,2 +76,3 @@ return nameString + "" + locationString + "" + separatorString + "" + outputString;

function formatName(color, name){
name = process.env.MSYSTEM ? slash(name) : name;
return color.magenta(name);

@@ -77,0 +79,0 @@ }

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

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){

@@ -3,0 +3,0 @@ var ref$, map, flatten, join, lines, unlines, chars, unchars, syntax, syntaxFlat, aliasMap, attrMapInverse, matchesMap, matchesAliasMap, pad, options, generateSyntaxHelp, generateSyntaxHelpForNode, generateCategoryHelp, generateHelpForCategory;

@@ -1,4 +0,4 @@

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){
var path, acorn, squery, equery, async, ref$, min, sortWith, lines, chars, split, join, map, Obj, format, formatResult, formatName, formatCount, replace, parseOptions, generateHelp, generateHelpForOption, help, _console, version, run, getQueryEngine, slice$ = [].slice, toString$ = {}.toString;
var path, acorn, squery, equery, async, minimatch, ref$, min, sortWith, lines, chars, split, join, map, Obj, format, formatResult, formatName, formatCount, replace, parseOptions, generateHelp, generateHelpForOption, help, _console, version, run, getQueryEngine, slice$ = [].slice, toString$ = {}.toString;
path = require('path');

@@ -9,2 +9,3 @@ acorn = require('acorn');

async = require('async');
minimatch = require('minimatch');
ref$ = require('prelude-ls'), min = ref$.min, sortWith = ref$.sortWith, lines = ref$.lines, chars = ref$.chars, split = ref$.split, join = ref$.join, map = ref$.map, Obj = ref$.Obj;

@@ -16,5 +17,5 @@ format = require('./format'), formatResult = format.formatResult, formatName = format.formatName, formatCount = format.formatCount;

_console = console;
version = '0.4.0';
version = require('../package.json').version;
run = function(arg$){
var ref$, args, error, ref1$, callback, exit, data, stdin, fs, textFormat, input, console, options, positional, debug, e, versionString, getHelp, helpString, queryEngine, parser, parserOptions, that, selector, targets, targetsLen, replacement, isDir, color, bold, textFormatFuncs, resultsData, resultsFormat, callCallback, out, parsedSelector, resultsSortFunc, search, processResults, getToMap, end, exts, testExt, targetPaths, searchTarget, cwd;
var ref$, args, error, ref1$, callback, exit, data, stdin, fs, textFormat, input, console, options, positional, debug, e, versionString, getHelp, helpString, queryEngine, parser, parserOptions, that, selector, targets, targetsLen, replacement, isDir, color, bold, textFormatFuncs, resultsData, resultsFormat, callCallback, out, parsedSelector, resultsSortFunc, search, processResults, getToMap, end, exts, testExt, exclude, testExclude, targetPaths, searchTarget, cwd, this$ = this;
ref$ = arg$ != null

@@ -163,3 +164,7 @@ ? arg$

});
bold = textFormat.bold;
bold = options.bold
? textFormat.bold
: function(it){
return it + "";
};
textFormatFuncs = {

@@ -185,3 +190,3 @@ color: color,

console.log('parsed-selector:');
console.log(JSON.stringify(parsedSelector));
console.log(JSON.stringify(parsedSelector, null, 2));
}

@@ -213,2 +218,5 @@ resultsSortFunc = function(a, b){

}
if (options.printAst) {
console.log(JSON.stringify(parsedInput, null, 2));
}
} catch (e$) {

@@ -349,6 +357,18 @@ e = e$;

};
exclude = options.exclude;
testExclude = !exclude || exclude.length === 0
? function(){
return true;
}
: function(file, basePath, upPath){
var filePath;
filePath = path.relative(basePath, path.join(upPath, file));
return exclude.every(function(excludePattern){
return !minimatch(filePath, excludePattern, options.minimatchOptions);
});
};
targetPaths = [];
searchTarget = function(basePath, upPath){
return function(target, done){
var output, targetPath, stat, fileContents, displayPath, e;
var output, targetPath, stat, fileContents, displayPath, e, this$ = this;
try {

@@ -385,3 +405,3 @@ if (target === '-') {

});
} else if (stat.isFile() && testExt(target)) {
} else if (stat.isFile() && testExt(target) && testExclude(target, basePath, upPath)) {
fileContents = fs.readFileSync(targetPath, 'utf8');

@@ -388,0 +408,0 @@ displayPath = path.relative(basePath, targetPath);

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

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){

@@ -27,2 +27,6 @@ var optionator, options, ref$;

}, {
option: 'print-ast',
type: 'Boolean',
description: 'print input AST'
}, {
option: 'extensions',

@@ -42,2 +46,13 @@ alias: 'x',

}, {
option: 'exclude',
type: '[String]',
description: 'comma separated list of exclude patterns',
longDescription: "When recursively searching directories, exclude files matching any of this patterns. Matching is performed using 'minimatch' module. Use --minimatch-options switch to specify custom matching options."
}, {
option: 'minimatch-options',
type: 'Object',
description: 'options for minimatch module used for processing `exclude`',
longDescription: 'Sets the options for the minimatch module. See module documentation for possible options',
'default': '{dot: true}'
}, {
option: 'parser',

@@ -48,3 +63,3 @@ alias: 'p',

longDescription: 'Sets the parser and options for the parser. Argument value is a tuple, with the first item being the require path, and the second an optional object with options for the parser when calling its parse function.',
'default': "(acorn, {locations: true, ecmaVersion: 6, sourceType: 'module', allowHashBang: true})",
'default': "(esprima-fb, {loc: true, sourceType: 'module', range: true})",
hidden: true,

@@ -167,2 +182,12 @@ example: '--parser "(./path/to/esprima, {loc: true})"'

}, {
option: 'bold',
type: 'Boolean',
'default': 'true',
description: 'do not use bold font to highlight matches'
}, {
option: 'multiline-separator',
type: 'Boolean',
'default': 'true',
description: 'do not display \'(multiline)\' keyword for multiline matches'
}, {
option: 'json',

@@ -169,0 +194,0 @@ alias: 'j',

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

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){

@@ -7,7 +7,7 @@ var ref$, lines, unlines, filter, fold, capitalize, camelize, dasherize, levn, getRaw, filterRegex, replacer, getReplacementFunc, replace, slice$ = [].slice, toString$ = {}.toString;

getRaw = function(input, node){
var raw, that;
var raw, that, start, end;
raw = (that = node.raw)
? that
: node.start != null
? input.slice(node.start, node.end)
: node.range != null
? (start = node.range[0], end = node.range[1], input.slice(start, end))
: node.key != null && node.value != null ? input.slice(node.key.start, node.value.end) : '';

@@ -20,3 +20,3 @@ node.raw = raw;

return function(arg$, replacementArg){
var origResults, ref$, filters, selector, that, e, results, rawPrepend, rawAppend, join, textOperations, filterName, argsStr, args, ref1$, pre, post, i$, len$, arg, result, n, len, rawResults, res$, outputString;
var origResults, ref$, filters, selector, that, e, results, rawPrepend, rawAppend, join, textOperations, filterName, argsStr, args, ref1$, pre, post, i$, len$, arg, result, n, len, rawResults, res$, outputString, this$ = this;
if (/^\s*\|\s+/.test(replacementArg)) {

@@ -204,2 +204,3 @@ origResults = [node];

function fn$(args){
var this$ = this;
textOperations.push(function(it){

@@ -222,2 +223,3 @@ return it.replace(args[0], args[1]);

function fn5$(args){
var this$ = this;
textOperations.push(function(it){

@@ -228,2 +230,3 @@ return it.substring(args[0], args[1]);

function fn6$(args){
var this$ = this;
textOperations.push(function(it){

@@ -234,2 +237,3 @@ return it.substr(args[0], args[1]);

function fn7$(args){
var this$ = this;
textOperations.push(function(it){

@@ -261,3 +265,3 @@ return it.slice(args[0], args[1]);

replace = function(replacement, input, nodes, queryEngine){
var inputLines, colOffset, lineOffset, lastLine, prevNode, replaceNode, i$, len$, node, ref$, start, end, startLineNum, endLineNum, numberOfLines, startCol, endCol, replaceLines, startLine, endLine, startContext, endContext, replaceLast, endLen;
var inputLines, colOffset, lineOffset, lastLine, prevNode, replaceNode, i$, len$, node, ref$, ref1$, ref2$, start, end, startLineNum, endLineNum, numberOfLines, startCol, endCol, replaceLines, startLine, endLine, startContext, endContext, replaceLast, endLen;
inputLines = lines(input);

@@ -268,3 +272,3 @@ colOffset = 0;

prevNode = {
end: 0
range: [0, 0]
};

@@ -274,6 +278,6 @@ replaceNode = getReplacementFunc(replacement, input, queryEngine);

node = nodes[i$];
if (node.start < prevNode.end) {
if (((ref$ = node.range) != null ? ref$[0] : void 8) < ((ref1$ = prevNode.range) != null ? ref1$[1] : void 8)) {
continue;
}
ref$ = node.loc, start = ref$.start, end = ref$.end;
ref2$ = node.loc, start = ref2$.start, end = ref2$.end;
startLineNum = start.line - 1 + lineOffset;

@@ -290,3 +294,3 @@ endLineNum = end.line - 1 + lineOffset;

endContext = endLine.slice(endCol);
replaceLines[0] = startContext + "" + ((ref$ = replaceLines[0]) != null ? ref$ : '');
replaceLines[0] = startContext + "" + ((ref2$ = replaceLines[0]) != null ? ref2$ : '');
replaceLast = replaceLines[replaceLines.length - 1];

@@ -293,0 +297,0 @@ endLen = replaceLast.length;

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

// Generated by LiveScript 1.4.0
// Generated by LiveScript 1.5.0
(function(){

@@ -3,0 +3,0 @@ var pad;

{
"name": "grasp",
"author": "George Zahariev",
"version": "0.4.0",
"version": "0.5.0-beta",
"homepage": "http://graspjs.com",

@@ -39,3 +39,3 @@ "description": "JavaScript structural search, replace, and refactor",

"dependencies": {
"acorn": "^2.6.4",
"esprima-fb": "^15001.1001.0-dev-harmony-fb",
"prelude-ls": "^1.1.2",

@@ -48,6 +48,8 @@ "cli-color": "^1.1.0",

"grasp-syntax-javascript": "^0.2.0",
"levn": "^0.3.0"
"levn": "^0.3.0",
"minimatch": "^3.0.3",
"slash": "^1.0.0"
},
"devDependencies": {
"livescript": "^1.4.0",
"livescript": "^1.5.0",
"mocha": "^2.3.4",

@@ -54,0 +56,0 @@ "istanbul": "^0.4.1"

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