flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

35
VISUALIZACION/node_modules/falafel/test/array.js generated vendored Executable file
View file

@ -0,0 +1,35 @@
var falafel = require('../');
var test = require('tape');
test('array', function (t) {
t.plan(5);
var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
} + ')()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});

42
VISUALIZACION/node_modules/falafel/test/async.js generated vendored Executable file
View file

@ -0,0 +1,42 @@
var falafel = require('../');
var test = require('tape');
test('async', function (t) {
t.plan(5);
var src = '(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()';
var pending = 0;
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
pending ++;
setTimeout(function () {
node.update('fn(' + node.source() + ')');
if (--pending === 0) check();
}, 50 * pending * 2);
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
function check () {
Function([ 'fn', 'g' ], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
}
});

10
VISUALIZACION/node_modules/falafel/test/bin/run.js generated vendored Executable file
View file

@ -0,0 +1,10 @@
var path = require('path');
var glob = require('glob');
for (var i = 2; i < process.argv.length; i++) {
glob(process.argv[i], function (er, files) {
files.forEach(function (file) {
require(path.resolve(process.cwd(), file));
});
});
}

46
VISUALIZACION/node_modules/falafel/test/custom-parser.js generated vendored Executable file
View file

@ -0,0 +1,46 @@
var falafel = require('../');
var test = require('tape');
var semver = require('semver');
// acorn-jsx requires node 4
test('custom parser', { skip: semver.satisfies(process.version, '< 4.0.0') },function (t) {
var acorn = require('acorn');
var jsx = require('acorn-jsx');
var acornWithJsx = acorn.Parser.extend(jsx());
var src = '(function() { var f = {a: "b"}; var a = <div {...f} className="test"></div>; })()';
var nodeTypes = [
'Identifier',
'Identifier',
'Literal',
'Property',
'ObjectExpression',
'VariableDeclarator',
'VariableDeclaration',
'Identifier',
'Identifier',
'JSXSpreadAttribute',
'JSXIdentifier',
'Literal',
'JSXAttribute',
'JSXIdentifier',
'JSXOpeningElement',
'JSXIdentifier',
'JSXClosingElement',
'JSXElement',
'VariableDeclarator',
'VariableDeclaration',
'BlockStatement',
'FunctionExpression',
'CallExpression',
'ExpressionStatement',
'Program'
];
t.plan(nodeTypes.length);
var output = falafel(src, {parser: acornWithJsx, ecmaVersion: 6, plugins: { jsx: true }}, function(node) {
t.equal(node.type, nodeTypes.shift());
});
});

17
VISUALIZACION/node_modules/falafel/test/es6.js generated vendored Executable file
View file

@ -0,0 +1,17 @@
var falafel = require('../');
var test = require('tape');
var semver = require('semver');
// it runs the generator so needs node 4+
test('generators', { skip: semver.satisfies(process.version, '< 4.0.0') }, function (t) {
t.plan(1);
var src = 'console.log((function * () { yield 3 })().next().value)';
var output = falafel(src, { ecmaVersion: 6 }, function (node) {
if (node.type === 'Literal') {
node.update('555');
}
});
Function(['console'],output)({log:log});
function log (n) { t.equal(n, 555) }
});

30
VISUALIZACION/node_modules/falafel/test/for.js generated vendored Executable file
View file

@ -0,0 +1,30 @@
var falafel = require('../');
var test = require('tape');
test('for loop', function (t) {
t.plan(7);
var src = '(function () {'
+ 'var sum = 0;'
+ 'for (var i = 0; i < 10; i++)'
+ 'sum += i;'
+ 'if (true)'
+ 'for (var i = 0; i < 10; i++)'
+ 'sum += i;'
+ 'return sum;'
+ '})()';
var output = falafel(src, function (node) {
if (node.type === 'ForStatement') {
t.equal(node.update.source(), 'i++');
t.equal(node.update.type, "UpdateExpression");
node.update.update('i+=2');
}
if (node.type === 'UpdateExpression') {
t.equal(node.source(), 'i++');
}
});
var res = Function('return ' + output)();
t.equal(res, 2 + 4 + 6 + 8 + 2 + 4 + 6 + 8);
});

38
VISUALIZACION/node_modules/falafel/test/inspect.js generated vendored Executable file
View file

@ -0,0 +1,38 @@
var falafel = require('../');
var test = require('tape');
var util = require('util');
test('inspect', function (t) {
t.plan(7);
var src = '(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
t.equal(output.inspect(), output.toString());
t.equal(util.inspect(output), output.toString());
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});

135
VISUALIZACION/node_modules/falafel/test/opts.js generated vendored Executable file
View file

@ -0,0 +1,135 @@
var falafel = require('../');
var Buffer = require('safe-buffer').Buffer;
var test = require('tape');
test('first opts arg', function (t) {
t.plan(5);
var src = '(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()';
var output = falafel({ source: src }, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});
test('opts.source', function (t) {
t.plan(5);
var src = '(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()';
var output = falafel(undefined, { source: src }, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});
test('Buffer opts.source', function (t) {
t.plan(5);
var src = Buffer.from('(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()');
var output = falafel({ source: src }, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});
test('Buffer source', function (t) {
t.plan(5);
var src = Buffer.from('(function () {'
+ 'var xs = [ 1, 2, [ 3, 4 ] ];'
+ 'var ys = [ 5, 6 ];'
+ 'g([ xs, ys ]);'
+ '})()');
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});

33
VISUALIZACION/node_modules/falafel/test/parent.js generated vendored Executable file
View file

@ -0,0 +1,33 @@
var falafel = require('../');
var test = require('tape');
test('parent', function (t) {
t.plan(5);
var src = '(function () {'
+ 'var xs = [ 1, 2, 3 ];'
+ 'fn(ys);'
+ '})()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
t.equal(node.parent.type, 'VariableDeclarator');
t.equal(
ffBracket(node.parent.source()),
'xs = [ 1, 2, 3 ]'
);
t.equal(node.parent.parent.type, 'VariableDeclaration');
t.equal(
ffBracket(node.parent.parent.source()),
'var xs = [ 1, 2, 3 ];'
);
node.parent.update('ys = 4;');
}
});
Function(['fn'], output)(function (x) { t.equal(x, 4) });
});
function ffBracket (s) {
return s.replace(/\[\s*/, '[ ').replace(/\s*\]/, ' ]');
}