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.5.0-beta2 to 0.5.0

6

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

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

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

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

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

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

// Generated by LiveScript 1.5.0
(function(){
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;
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;
path = require('path');

@@ -9,3 +9,2 @@ 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;

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

_console = console;
version = require('../package.json').version;
version = '0.4.0';
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, exclude, testExclude, targetPaths, searchTarget, cwd, this$ = this;
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, this$ = this;
ref$ = arg$ != null

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

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

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

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

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

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

@@ -357,14 +349,2 @@ 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 = [];

@@ -405,3 +385,3 @@ searchTarget = function(basePath, upPath){

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

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

@@ -27,6 +27,2 @@ // Generated by LiveScript 1.5.0

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

@@ -46,13 +42,2 @@ 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',

@@ -63,3 +48,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': "(flow-parser, {loc: true, sourceType: 'module', range: true})",
'default': "(acorn, {locations: true, ecmaVersion: 6, sourceType: 'module', allowHashBang: true})",
hidden: true,

@@ -182,12 +167,2 @@ 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',

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

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

// Generated by LiveScript 1.5.0
// Generated by LiveScript 1.4.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, start, end;
var raw, that;
raw = (that = node.raw)
? that
: node.range != null
? (start = node.range[0], end = node.range[1], input.slice(start, end))
: node.start != null
? input.slice(node.start, node.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, this$ = this;
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;
if (/^\s*\|\s+/.test(replacementArg)) {

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

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

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

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

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

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

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

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

@@ -265,3 +261,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$, ref1$, ref2$, 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$, start, end, startLineNum, endLineNum, numberOfLines, startCol, endCol, replaceLines, startLine, endLine, startContext, endContext, replaceLast, endLen;
inputLines = lines(input);

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

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

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

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

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

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

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

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

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

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

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

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

"dependencies": {
"flow-parser": "^0.*",
"acorn": "^2.6.4",
"prelude-ls": "^1.1.2",

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

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

@@ -56,0 +54,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