flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
7
VISUALIZACION/node_modules/static-module/.travis.yml
generated
vendored
Executable file
7
VISUALIZACION/node_modules/static-module/.travis.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 9
|
||||
- 8
|
||||
- 6
|
||||
- 4
|
||||
- "0.10"
|
||||
18
VISUALIZACION/node_modules/static-module/LICENSE
generated
vendored
Executable file
18
VISUALIZACION/node_modules/static-module/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
12
VISUALIZACION/node_modules/static-module/example/brfs.js
generated
vendored
Executable file
12
VISUALIZACION/node_modules/static-module/example/brfs.js
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
var staticModule = require('../');
|
||||
var quote = require('quote-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: __dirname + '/brfs' } });
|
||||
process.stdin.pipe(sm).pipe(process.stdout);
|
||||
3
VISUALIZACION/node_modules/static-module/example/brfs/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/example/brfs/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/x.txt');
|
||||
console.log(src);
|
||||
1
VISUALIZACION/node_modules/static-module/example/brfs/x.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/example/brfs/x.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
beep boop
|
||||
21
VISUALIZACION/node_modules/static-module/example/fs.js
generated
vendored
Executable file
21
VISUALIZACION/node_modules/static-module/example/fs.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
var staticModule = require('../');
|
||||
var quote = require('quote-stream');
|
||||
var through = require('through2');
|
||||
var fs = require('fs');
|
||||
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
var stream = through(write, end);
|
||||
stream.push('process.nextTick(function(){(' + cb + ')(null,');
|
||||
return fs.createReadStream(file).pipe(quote()).pipe(stream);
|
||||
|
||||
function write (buf, enc, next) { this.push(buf); next() }
|
||||
function end (next) { this.push(')})'); this.push(null); next() }
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: __dirname + '/fs' } });
|
||||
process.stdin.pipe(sm).pipe(process.stdout);
|
||||
4
VISUALIZACION/node_modules/static-module/example/fs/source.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/example/fs/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var fs = require('fs')
|
||||
fs.readFile(__dirname + '/x.txt', function (err, src) {
|
||||
console.log(src);
|
||||
});
|
||||
1
VISUALIZACION/node_modules/static-module/example/fs/x.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/example/fs/x.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
beep boop
|
||||
441
VISUALIZACION/node_modules/static-module/index.js
generated
vendored
Executable file
441
VISUALIZACION/node_modules/static-module/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,441 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var through = require('through2');
|
||||
var Readable = require('readable-stream').Readable;
|
||||
|
||||
var concat = require('concat-stream');
|
||||
var duplexer = require('duplexer2');
|
||||
var falafel = require('falafel');
|
||||
var unparse = require('escodegen').generate;
|
||||
var inspect = require('object-inspect');
|
||||
var evaluate = require('static-eval');
|
||||
var copy = require('shallow-copy');
|
||||
var has = require('has');
|
||||
var MagicString = require('magic-string');
|
||||
var convertSourceMap = require('convert-source-map');
|
||||
var mergeSourceMap = require('merge-source-map');
|
||||
|
||||
module.exports = function parse (modules, opts) {
|
||||
if (!opts) opts = {};
|
||||
var vars = opts.vars || {};
|
||||
var varNames = opts.varNames || {};
|
||||
var varModules = opts.varModules || {};
|
||||
var skip = opts.skip || {};
|
||||
var skipOffset = opts.skipOffset || 0;
|
||||
var parserOpts = opts.parserOpts || { ecmaVersion: 8 };
|
||||
var updates = [];
|
||||
var sourcemapper;
|
||||
var inputMap;
|
||||
|
||||
var output = through();
|
||||
var body;
|
||||
return duplexer(concat({ encoding: 'buffer' }, function (buf) {
|
||||
try {
|
||||
body = buf.toString('utf8').replace(/^#!/, '//#!');
|
||||
var matches = false;
|
||||
for (var key in modules) {
|
||||
if (body.indexOf(key) !== -1) {
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matches) {
|
||||
// just pass it through
|
||||
output.end(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (opts.sourceMap) {
|
||||
inputMap = convertSourceMap.fromSource(body);
|
||||
if (inputMap) inputMap = inputMap.toObject();
|
||||
body = convertSourceMap.removeComments(body);
|
||||
sourcemapper = new MagicString(body);
|
||||
}
|
||||
|
||||
falafel(body, parserOpts, walk);
|
||||
}
|
||||
catch (err) { return error(err) }
|
||||
finish(body);
|
||||
}), output);
|
||||
|
||||
function finish (src) {
|
||||
var pos = 0;
|
||||
src = String(src);
|
||||
|
||||
(function next () {
|
||||
if (updates.length === 0) return done();
|
||||
var s = updates.shift();
|
||||
|
||||
output.write(src.slice(pos, s.start));
|
||||
pos = s.start + s.offset;
|
||||
|
||||
s.stream.pipe(output, { end: false });
|
||||
if (opts.sourceMap) {
|
||||
s.stream.pipe(concat({ encoding: 'string' }, function (chunk) {
|
||||
// We have to give magic-string the replacement string,
|
||||
// so it can calculate the amount of lines and columns.
|
||||
if (s.offset === 0) {
|
||||
sourcemapper.appendRight(s.start, chunk);
|
||||
} else {
|
||||
sourcemapper.overwrite(s.start, s.start + s.offset, chunk);
|
||||
}
|
||||
})).on('finish', next);
|
||||
} else {
|
||||
s.stream.on('end', next);
|
||||
}
|
||||
})();
|
||||
|
||||
function done () {
|
||||
output.write(src.slice(pos));
|
||||
if (opts.sourceMap) {
|
||||
var map = sourcemapper.generateMap({
|
||||
source: opts.inputFilename || 'input.js',
|
||||
includeContent: true
|
||||
});
|
||||
if (inputMap) {
|
||||
var merged = mergeSourceMap(inputMap, map);
|
||||
output.write('\n' + convertSourceMap.fromObject(merged).toComment() + '\n');
|
||||
} else {
|
||||
output.write('\n//# sourceMappingURL=' + map.toUrl() + '\n');
|
||||
}
|
||||
}
|
||||
output.end();
|
||||
}
|
||||
}
|
||||
|
||||
function error (msg) {
|
||||
var err = typeof msg === 'string' ? new Error(msg) : msg;
|
||||
output.emit('error', err);
|
||||
}
|
||||
|
||||
function walk (node) {
|
||||
if (opts.sourceMap) {
|
||||
sourcemapper.addSourcemapLocation(node.start);
|
||||
sourcemapper.addSourcemapLocation(node.end);
|
||||
}
|
||||
|
||||
var isreq = isRequire(node);
|
||||
var isreqm = false, isreqv = false, reqid;
|
||||
if (isreq) {
|
||||
reqid = node.arguments[0].value;
|
||||
isreqm = has(modules, reqid);
|
||||
isreqv = has(varModules, reqid);
|
||||
}
|
||||
|
||||
if (isreqv && node.parent.type === 'VariableDeclarator'
|
||||
&& node.parent.id.type === 'Identifier') {
|
||||
vars[node.parent.id.name] = varModules[reqid];
|
||||
}
|
||||
else if (isreqv && node.parent.type === 'AssignmentExpression'
|
||||
&& node.parent.left.type === 'Identifier') {
|
||||
vars[node.parent.left.name] = varModules[reqid];
|
||||
}
|
||||
else if (isreqv && node.parent.type === 'MemberExpression'
|
||||
&& isStaticProperty(node.parent.property)
|
||||
&& node.parent.parent.type === 'VariableDeclarator'
|
||||
&& node.parent.parent.id.type === 'Identifier') {
|
||||
var v = varModules[reqid][resolveProperty(node.parent.property)];
|
||||
vars[node.parent.parent.id.name] = v;
|
||||
}
|
||||
else if (isreqv && node.parent.type === 'MemberExpression'
|
||||
&& node.parent.property.type === 'Identifier') {
|
||||
//vars[node.parent.parent.id.name] = varModules[reqid];
|
||||
}
|
||||
else if (isreqv && node.parent.type === 'CallExpression') {
|
||||
//
|
||||
}
|
||||
|
||||
if (isreqm && node.parent.type === 'VariableDeclarator'
|
||||
&& node.parent.id.type === 'Identifier') {
|
||||
varNames[node.parent.id.name] = reqid;
|
||||
var decs = node.parent.parent.declarations;
|
||||
var ix = decs.indexOf(node.parent);
|
||||
var dec;
|
||||
if (ix >= 0) {
|
||||
dec = decs[ix];
|
||||
decs.splice(ix, 1);
|
||||
}
|
||||
|
||||
if (decs.length) {
|
||||
var src = unparse(node.parent.parent);
|
||||
updates.push({
|
||||
start: node.parent.parent.start,
|
||||
offset: node.parent.parent.end - node.parent.parent.start,
|
||||
stream: st('var ')
|
||||
});
|
||||
decs.forEach(function (d, i) {
|
||||
var key = (d.start + skipOffset)
|
||||
+ ',' + (d.end + skipOffset)
|
||||
;
|
||||
skip[key] = true;
|
||||
|
||||
var s = parse(modules, {
|
||||
skip: skip,
|
||||
skipOffset: skipOffset + (d.init ? d.init.start : 0),
|
||||
vars: vars,
|
||||
varNames: varNames
|
||||
});
|
||||
var up = {
|
||||
start: node.parent.parent.end,
|
||||
offset: 0,
|
||||
stream: s
|
||||
};
|
||||
updates.push(up);
|
||||
if (i < decs.length - 1) {
|
||||
var comma;
|
||||
if (i === ix - 1) {
|
||||
comma = body.slice(d.end, dec.start);
|
||||
}
|
||||
else comma = body.slice(d.end, decs[i+1].start);
|
||||
updates.push({
|
||||
start: node.parent.parent.end,
|
||||
offset: 0,
|
||||
stream: st(comma)
|
||||
});
|
||||
}
|
||||
else {
|
||||
updates.push({
|
||||
start: node.parent.parent.end,
|
||||
offset: 0,
|
||||
stream: st(';')
|
||||
});
|
||||
}
|
||||
s.end(unparse(d));
|
||||
});
|
||||
}
|
||||
else {
|
||||
updates.push({
|
||||
start: node.parent.parent.start,
|
||||
offset: node.parent.parent.end - node.parent.parent.start,
|
||||
stream: st()
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (isreqm && node.parent.type === 'AssignmentExpression'
|
||||
&& node.parent.left.type === 'Identifier') {
|
||||
varNames[node.parent.left.name] = reqid;
|
||||
var cur = node.parent.parent;
|
||||
if (cur.type === 'SequenceExpression') {
|
||||
var ex = cur.expressions;
|
||||
var ix = ex.indexOf(node.parent);
|
||||
if (ix >= 0) ex.splice(ix, 1);
|
||||
updates.push({
|
||||
start: node.parent.parent.start,
|
||||
offset: node.parent.parent.end - node.parent.parent.start,
|
||||
stream: st(unparse(node.parent.parent))
|
||||
});
|
||||
}
|
||||
else {
|
||||
updates.push({
|
||||
start: node.parent.parent.start,
|
||||
offset: node.parent.parent.end - node.parent.parent.start,
|
||||
stream: st()
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (isreqm && node.parent.type === 'MemberExpression'
|
||||
&& isStaticProperty(node.parent.property)
|
||||
&& node.parent.parent.type === 'VariableDeclarator'
|
||||
&& node.parent.parent.id.type === 'Identifier') {
|
||||
varNames[node.parent.parent.id.name] = [
|
||||
reqid, resolveProperty(node.parent.property)
|
||||
];
|
||||
var decNode = node.parent.parent.parent;
|
||||
var decs = decNode.declarations;
|
||||
var ix = decs.indexOf(node.parent.parent);
|
||||
if (ix >= 0) decs.splice(ix, 1);
|
||||
|
||||
updates.push({
|
||||
start: decNode.start,
|
||||
offset: decNode.end - decNode.start,
|
||||
stream: decs.length ? st(unparse(decNode)) : st()
|
||||
});
|
||||
}
|
||||
else if (isreqm && node.parent.type === 'MemberExpression'
|
||||
&& isStaticProperty(node.parent.property)) {
|
||||
var name = resolveProperty(node.parent.property);
|
||||
var cur = copy(node.parent.parent);
|
||||
cur.callee = copy(node.parent.property);
|
||||
cur.callee.parent = cur;
|
||||
traverse(cur.callee, modules[reqid][name]);
|
||||
}
|
||||
else if (isreqm && node.parent.type === 'CallExpression') {
|
||||
var cur = copy(node.parent);
|
||||
var iname = Math.pow(16,8) * Math.random();
|
||||
cur.callee = {
|
||||
type: 'Identifier',
|
||||
name: '_' + Math.floor(iname).toString(16),
|
||||
parent: cur
|
||||
};
|
||||
traverse(cur.callee, modules[reqid]);
|
||||
}
|
||||
|
||||
if (node.type === 'Identifier' && has(varNames, node.name)) {
|
||||
var vn = varNames[node.name];
|
||||
if (Array.isArray(vn)) {
|
||||
traverse(node, modules[vn[0]][vn[1]]);
|
||||
}
|
||||
else traverse(node, modules[vn]);
|
||||
}
|
||||
}
|
||||
|
||||
function traverse (node, val) {
|
||||
for (var p = node; p; p = p.parent) {
|
||||
if (p.start === undefined || p.end === undefined) continue;
|
||||
var key = (p.start + skipOffset)
|
||||
+ ',' + (p.end + skipOffset)
|
||||
;
|
||||
if (skip[key]) {
|
||||
skip[key] = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip[key]) {
|
||||
skip[key] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.parent.type === 'CallExpression') {
|
||||
if (typeof val !== 'function') {
|
||||
return error(
|
||||
'tried to statically call ' + inspect(val)
|
||||
+ ' as a function'
|
||||
);
|
||||
}
|
||||
|
||||
var xvars = copy(vars);
|
||||
xvars[node.name] = val;
|
||||
|
||||
var res = evaluate(node.parent, xvars);
|
||||
if (res !== undefined) {
|
||||
updates.push({
|
||||
start: node.parent.start,
|
||||
offset: node.parent.end - node.parent.start,
|
||||
stream: isStream(res) ? wrapStream(res) : st(String(res))
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (node.parent.type === 'MemberExpression') {
|
||||
if (!isStaticProperty(node.parent.property)) {
|
||||
return error(
|
||||
'dynamic property in member expression: '
|
||||
+ node.parent.source()
|
||||
);
|
||||
}
|
||||
|
||||
var cur = node.parent.parent;
|
||||
|
||||
if (cur.type === 'MemberExpression') {
|
||||
cur = cur.parent;
|
||||
if (cur.type !== 'CallExpression'
|
||||
&& cur.parent.type === 'CallExpression') {
|
||||
cur = cur.parent;
|
||||
}
|
||||
}
|
||||
if (node.parent.type === 'MemberExpression'
|
||||
&& (cur.type !== 'CallExpression'
|
||||
&& cur.type !== 'MemberExpression')) {
|
||||
cur = node.parent;
|
||||
}
|
||||
|
||||
var xvars = copy(vars);
|
||||
xvars[node.name] = val;
|
||||
|
||||
var res = evaluate(cur, xvars);
|
||||
if (res === undefined && cur.type === 'CallExpression') {
|
||||
// static-eval can't safely evaluate code with callbacks, so do it manually in a safe way
|
||||
var callee = evaluate(cur.callee, xvars);
|
||||
var args = cur.arguments.map(function (arg) {
|
||||
// Return a function stub for callbacks so that `static-module` users
|
||||
// can do `callback.toString()` and get the original source
|
||||
if (arg.type === 'FunctionExpression' || arg.type === 'ArrowFunctionExpression') {
|
||||
var fn = function () {
|
||||
throw new Error('static-module: cannot call callbacks defined inside source code');
|
||||
};
|
||||
fn.toString = function () {
|
||||
return body.slice(arg.start, arg.end);
|
||||
};
|
||||
return fn;
|
||||
}
|
||||
return evaluate(arg, xvars);
|
||||
});
|
||||
|
||||
if (callee !== undefined) {
|
||||
try {
|
||||
res = callee.apply(null, args);
|
||||
} catch (err) {
|
||||
// Evaluate to undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (res !== undefined) {
|
||||
updates.push({
|
||||
start: cur.start,
|
||||
offset: cur.end - cur.start,
|
||||
stream: isStream(res) ? wrapStream(res) : st(String(res))
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (node.parent.type === 'UnaryExpression') {
|
||||
var xvars = copy(vars);
|
||||
xvars[node.name] = val;
|
||||
|
||||
var res = evaluate(node.parent, xvars);
|
||||
if (res !== undefined) {
|
||||
updates.push({
|
||||
start: node.parent.start,
|
||||
offset: node.parent.end - node.parent.start,
|
||||
stream: isStream(res) ? wrapStream(res) : st(String(res))
|
||||
});
|
||||
} else {
|
||||
output.emit('error', new Error(
|
||||
'unsupported unary operator: ' + node.parent.operator
|
||||
));
|
||||
}
|
||||
}
|
||||
else {
|
||||
output.emit('error', new Error(
|
||||
'unsupported type for static module: ' + node.parent.type
|
||||
+ '\nat expression:\n\n ' + unparse(node.parent) + '\n'
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isRequire (node) {
|
||||
var c = node.callee;
|
||||
return c
|
||||
&& node.type === 'CallExpression'
|
||||
&& c.type === 'Identifier'
|
||||
&& c.name === 'require'
|
||||
;
|
||||
}
|
||||
|
||||
function isStream (s) {
|
||||
return s && typeof s === 'object' && typeof s.pipe === 'function';
|
||||
}
|
||||
|
||||
function wrapStream (s) {
|
||||
if (typeof s.read === 'function') return s
|
||||
else return (new Readable).wrap(s)
|
||||
}
|
||||
|
||||
function isStaticProperty(node) {
|
||||
return node.type === 'Identifier' || node.type === 'Literal';
|
||||
}
|
||||
|
||||
function resolveProperty(node) {
|
||||
return node.type === 'Identifier' ? node.name : node.value;
|
||||
}
|
||||
|
||||
function st (msg) {
|
||||
var r = new Readable;
|
||||
r._read = function () {};
|
||||
if (msg != null) r.push(msg);
|
||||
r.push(null);
|
||||
return r;
|
||||
}
|
||||
20
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.editorconfig
generated
vendored
Executable file
20
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.editorconfig
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
4
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.ignored-tmp.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.ignored-tmp.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
require('core-js');
|
||||
var i = require('./');
|
||||
|
||||
console.log(i(new Map([[1, 2]])), i(new Set([[1, 2]])));
|
||||
17
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.nycrc
generated
vendored
Executable file
17
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.nycrc
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"all": true,
|
||||
"check-coverage": true,
|
||||
"instrumentation": false,
|
||||
"sourceMap": false,
|
||||
"reporter": "html",
|
||||
"lines": 96,
|
||||
"statements": 95,
|
||||
"functions": 96,
|
||||
"branches": 92,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"example",
|
||||
"test",
|
||||
"test-core-js.js"
|
||||
]
|
||||
}
|
||||
185
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.travis.yml
generated
vendored
Executable file
185
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/.travis.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,185 @@
|
|||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
node_js:
|
||||
- "9.3"
|
||||
- "8.9"
|
||||
- "7.10"
|
||||
- "6.12"
|
||||
- "5.12"
|
||||
- "4.8"
|
||||
- "iojs-v3.3"
|
||||
- "iojs-v2.5"
|
||||
- "iojs-v1.8"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
before_install:
|
||||
- 'nvm install-latest-npm'
|
||||
install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
|
||||
script:
|
||||
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
|
||||
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
|
||||
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
|
||||
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
|
||||
sudo: false
|
||||
env:
|
||||
- TEST=true
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "node"
|
||||
env: COVERAGE=true
|
||||
- node_js: "9.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
allow_failures:
|
||||
- os: osx
|
||||
- env: TEST=true ALLOW_FAILURE=true
|
||||
- env: COVERAGE=true
|
||||
235
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/1.out
generated
vendored
Executable file
235
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/1.out
generated
vendored
Executable file
|
|
@ -0,0 +1,235 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var hasMap = typeof Map === 'function' && Map.prototype;
|
||||
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
||||
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
||||
var mapForEach = hasMap && Map.prototype.forEach;
|
||||
var hasSet = typeof Set === 'function' && Set.prototype;
|
||||
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
||||
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
||||
var setForEach = hasSet && Set.prototype.forEach;
|
||||
var booleanValueOf = Boolean.prototype.valueOf;
|
||||
var objectToString = Object.prototype.toString;
|
||||
|
||||
module.exports = function inspect_ (obj, opts, depth, seen) {
|
||||
if (typeof obj === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (typeof obj === 'boolean') {
|
||||
return obj ? 'true' : 'false';
|
||||
}
|
||||
if (typeof obj === 'string') {
|
||||
return inspectString(obj);
|
||||
}
|
||||
if (typeof obj === 'number') {
|
||||
if (obj === 0) {
|
||||
return Infinity / obj > 0 ? '0' : '-0';
|
||||
}
|
||||
return String(obj);
|
||||
}
|
||||
|
||||
if (!opts) opts = {};
|
||||
|
||||
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
||||
if (typeof depth === 'undefined') depth = 0;
|
||||
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
||||
return '[Object]';
|
||||
}
|
||||
|
||||
if (typeof seen === 'undefined') seen = [];
|
||||
else if (indexOf(seen, obj) >= 0) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
function inspect (value, from) {
|
||||
if (from) {
|
||||
seen = seen.slice();
|
||||
seen.push(from);
|
||||
}
|
||||
return inspect_(value, opts, depth + 1, seen);
|
||||
}
|
||||
|
||||
if (typeof obj === 'function') {
|
||||
var name = nameOf(obj);
|
||||
return '[Function' + (name ? ': ' + name : '') + ']';
|
||||
}
|
||||
if (isSymbol(obj)) {
|
||||
var symString = Symbol.prototype.toString.call(obj);
|
||||
return typeof obj === 'object' ? markBoxed(symString) : symString;
|
||||
}
|
||||
if (isElement(obj)) {
|
||||
var s = '<' + String(obj.nodeName).toLowerCase();
|
||||
var attrs = obj.attributes || [];
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
|
||||
}
|
||||
s += '>';
|
||||
if (obj.childNodes && obj.childNodes.length) s += '...';
|
||||
s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
||||
return s;
|
||||
}
|
||||
if (isArray(obj)) {
|
||||
if (obj.length === 0) return '[]';
|
||||
return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';
|
||||
}
|
||||
if (isError(obj)) {
|
||||
var parts = arrObjKeys(obj, inspect);
|
||||
if (parts.length === 0) return '[' + String(obj) + ']';
|
||||
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
||||
}
|
||||
if (typeof obj === 'object' && typeof obj.inspect === 'function') {
|
||||
return obj.inspect();
|
||||
}
|
||||
if (isMap(obj)) {
|
||||
var parts = [];
|
||||
mapForEach.call(obj, function (value, key) {
|
||||
parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Map', mapSize.call(obj), parts);
|
||||
}
|
||||
if (isSet(obj)) {
|
||||
var parts = [];
|
||||
setForEach.call(obj, function (value ) {
|
||||
parts.push(inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Set', setSize.call(obj), parts);
|
||||
}
|
||||
if (isNumber(obj)) {
|
||||
return markBoxed(Number(obj));
|
||||
}
|
||||
if (isBoolean(obj)) {
|
||||
return markBoxed(booleanValueOf.call(obj));
|
||||
}
|
||||
if (isString(obj)) {
|
||||
return markBoxed(inspect(String(obj)));
|
||||
}
|
||||
if (!isDate(obj) && !isRegExp(obj)) {
|
||||
var xs = arrObjKeys(obj, inspect);
|
||||
if (xs.length === 0) return '{}';
|
||||
return '{ ' + xs.join(', ') + ' }';
|
||||
}
|
||||
return String(obj);
|
||||
};
|
||||
|
||||
function quote (s) {
|
||||
return String(s).replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function isArray (obj) { return toStr(obj) === '[object Array]' }
|
||||
function isDate (obj) { return toStr(obj) === '[object Date]' }
|
||||
function isRegExp (obj) { return toStr(obj) === '[object RegExp]' }
|
||||
function isError (obj) { return toStr(obj) === '[object Error]' }
|
||||
function isSymbol (obj) { return toStr(obj) === '[object Symbol]' }
|
||||
function isString (obj) { return toStr(obj) === '[object String]' }
|
||||
function isNumber (obj) { return toStr(obj) === '[object Number]' }
|
||||
function isBoolean (obj) { return toStr(obj) === '[object Boolean]' }
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
||||
function has (obj, key) {
|
||||
return hasOwn.call(obj, key);
|
||||
}
|
||||
|
||||
function toStr (obj) {
|
||||
return objectToString.call(obj);
|
||||
}
|
||||
|
||||
function nameOf (f) {
|
||||
if (f.name) return f.name;
|
||||
var m = String(f).match(/^function\s*([\w$]+)/);
|
||||
if (m) return m[1];
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
if (xs.indexOf) return xs.indexOf(x);
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function isMap (x) {
|
||||
if (!mapSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
mapSize.call(x);
|
||||
try {
|
||||
setSize.call(x);
|
||||
} catch (s) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSet (x) {
|
||||
if (!setSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
setSize.call(x);
|
||||
try {
|
||||
mapSize.call(x);
|
||||
} catch (m) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isElement (x) {
|
||||
if (!x || typeof x !== 'object') return false;
|
||||
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
||||
return true;
|
||||
}
|
||||
return typeof x.nodeName === 'string'
|
||||
&& typeof x.getAttribute === 'function'
|
||||
;
|
||||
}
|
||||
|
||||
function inspectString (str) {
|
||||
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
||||
return "'" + s + "'";
|
||||
}
|
||||
|
||||
function lowbyte (c) {
|
||||
var n = c.charCodeAt(0);
|
||||
var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
|
||||
if (x) return '\\' + x;
|
||||
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
|
||||
}
|
||||
|
||||
function markBoxed (str) {
|
||||
return 'Object(' + str + ')';
|
||||
}
|
||||
|
||||
function collectionOf (type, size, entries) {
|
||||
return type + ' (' + size + ') {' + entries.join(', ') + '}';
|
||||
}
|
||||
|
||||
function arrObjKeys (obj, inspect) {
|
||||
var isArr = isArray(obj);
|
||||
var xs = [];
|
||||
if (isArr) {
|
||||
xs.length = obj.length;
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
||||
}
|
||||
}
|
||||
for (var key in obj) {
|
||||
if (!has(obj, key)) continue;
|
||||
if (isArr && String(Number(key)) === key && key < obj.length) continue;
|
||||
if (/[^\w$]/.test(key)) {
|
||||
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
||||
} else {
|
||||
xs.push(key + ': ' + inspect(obj[key], obj));
|
||||
}
|
||||
}
|
||||
return xs;
|
||||
}
|
||||
|
||||
},{}]},{},[1]);
|
||||
1050
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/2.out
generated
vendored
Executable file
1050
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/2.out
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
244
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/3.out
generated
vendored
Executable file
244
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/3.out
generated
vendored
Executable file
|
|
@ -0,0 +1,244 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
var hasMap = typeof Map === 'function' && Map.prototype;
|
||||
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
||||
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
||||
var mapForEach = hasMap && Map.prototype.forEach;
|
||||
var hasSet = typeof Set === 'function' && Set.prototype;
|
||||
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
||||
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
||||
var setForEach = hasSet && Set.prototype.forEach;
|
||||
var booleanValueOf = Boolean.prototype.valueOf;
|
||||
var objectToString = Object.prototype.toString;
|
||||
|
||||
var inspectCustom = require('./util.inspect').custom;
|
||||
var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null;
|
||||
|
||||
module.exports = function inspect_ (obj, opts, depth, seen) {
|
||||
if (typeof obj === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (typeof obj === 'boolean') {
|
||||
return obj ? 'true' : 'false';
|
||||
}
|
||||
if (typeof obj === 'string') {
|
||||
return inspectString(obj);
|
||||
}
|
||||
if (typeof obj === 'number') {
|
||||
if (obj === 0) {
|
||||
return Infinity / obj > 0 ? '0' : '-0';
|
||||
}
|
||||
return String(obj);
|
||||
}
|
||||
|
||||
if (!opts) opts = {};
|
||||
|
||||
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
||||
if (typeof depth === 'undefined') depth = 0;
|
||||
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
||||
return '[Object]';
|
||||
}
|
||||
|
||||
if (typeof seen === 'undefined') seen = [];
|
||||
else if (indexOf(seen, obj) >= 0) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
function inspect (value, from) {
|
||||
if (from) {
|
||||
seen = seen.slice();
|
||||
seen.push(from);
|
||||
}
|
||||
return inspect_(value, opts, depth + 1, seen);
|
||||
}
|
||||
|
||||
if (typeof obj === 'function') {
|
||||
var name = nameOf(obj);
|
||||
return '[Function' + (name ? ': ' + name : '') + ']';
|
||||
}
|
||||
if (isSymbol(obj)) {
|
||||
var symString = Symbol.prototype.toString.call(obj);
|
||||
return typeof obj === 'object' ? markBoxed(symString) : symString;
|
||||
}
|
||||
if (isElement(obj)) {
|
||||
var s = '<' + String(obj.nodeName).toLowerCase();
|
||||
var attrs = obj.attributes || [];
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
|
||||
}
|
||||
s += '>';
|
||||
if (obj.childNodes && obj.childNodes.length) s += '...';
|
||||
s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
||||
return s;
|
||||
}
|
||||
if (isArray(obj)) {
|
||||
if (obj.length === 0) return '[]';
|
||||
return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';
|
||||
}
|
||||
if (isError(obj)) {
|
||||
var parts = arrObjKeys(obj, inspect);
|
||||
if (parts.length === 0) return '[' + String(obj) + ']';
|
||||
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
||||
}
|
||||
if (typeof obj === 'object') {
|
||||
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
||||
return obj[inspectSymbol]();
|
||||
} else if (typeof obj.inspect === 'function') {
|
||||
return obj.inspect();
|
||||
}
|
||||
}
|
||||
if (isMap(obj)) {
|
||||
var parts = [];
|
||||
mapForEach.call(obj, function (value, key) {
|
||||
parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Map', mapSize.call(obj), parts);
|
||||
}
|
||||
if (isSet(obj)) {
|
||||
var parts = [];
|
||||
setForEach.call(obj, function (value ) {
|
||||
parts.push(inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Set', setSize.call(obj), parts);
|
||||
}
|
||||
if (isNumber(obj)) {
|
||||
return markBoxed(Number(obj));
|
||||
}
|
||||
if (isBoolean(obj)) {
|
||||
return markBoxed(booleanValueOf.call(obj));
|
||||
}
|
||||
if (isString(obj)) {
|
||||
return markBoxed(inspect(String(obj)));
|
||||
}
|
||||
if (!isDate(obj) && !isRegExp(obj)) {
|
||||
var xs = arrObjKeys(obj, inspect);
|
||||
if (xs.length === 0) return '{}';
|
||||
return '{ ' + xs.join(', ') + ' }';
|
||||
}
|
||||
return String(obj);
|
||||
};
|
||||
|
||||
function quote (s) {
|
||||
return String(s).replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function isArray (obj) { return toStr(obj) === '[object Array]' }
|
||||
function isDate (obj) { return toStr(obj) === '[object Date]' }
|
||||
function isRegExp (obj) { return toStr(obj) === '[object RegExp]' }
|
||||
function isError (obj) { return toStr(obj) === '[object Error]' }
|
||||
function isSymbol (obj) { return toStr(obj) === '[object Symbol]' }
|
||||
function isString (obj) { return toStr(obj) === '[object String]' }
|
||||
function isNumber (obj) { return toStr(obj) === '[object Number]' }
|
||||
function isBoolean (obj) { return toStr(obj) === '[object Boolean]' }
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
||||
function has (obj, key) {
|
||||
return hasOwn.call(obj, key);
|
||||
}
|
||||
|
||||
function toStr (obj) {
|
||||
return objectToString.call(obj);
|
||||
}
|
||||
|
||||
function nameOf (f) {
|
||||
if (f.name) return f.name;
|
||||
var m = String(f).match(/^function\s*([\w$]+)/);
|
||||
if (m) return m[1];
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
if (xs.indexOf) return xs.indexOf(x);
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function isMap (x) {
|
||||
if (!mapSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
mapSize.call(x);
|
||||
try {
|
||||
setSize.call(x);
|
||||
} catch (s) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSet (x) {
|
||||
if (!setSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
setSize.call(x);
|
||||
try {
|
||||
mapSize.call(x);
|
||||
} catch (m) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isElement (x) {
|
||||
if (!x || typeof x !== 'object') return false;
|
||||
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
||||
return true;
|
||||
}
|
||||
return typeof x.nodeName === 'string'
|
||||
&& typeof x.getAttribute === 'function'
|
||||
;
|
||||
}
|
||||
|
||||
function inspectString (str) {
|
||||
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
||||
return "'" + s + "'";
|
||||
}
|
||||
|
||||
function lowbyte (c) {
|
||||
var n = c.charCodeAt(0);
|
||||
var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
|
||||
if (x) return '\\' + x;
|
||||
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
|
||||
}
|
||||
|
||||
function markBoxed (str) {
|
||||
return 'Object(' + str + ')';
|
||||
}
|
||||
|
||||
function collectionOf (type, size, entries) {
|
||||
return type + ' (' + size + ') {' + entries.join(', ') + '}';
|
||||
}
|
||||
|
||||
function arrObjKeys (obj, inspect) {
|
||||
var isArr = isArray(obj);
|
||||
var xs = [];
|
||||
if (isArr) {
|
||||
xs.length = obj.length;
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
||||
}
|
||||
}
|
||||
for (var key in obj) {
|
||||
if (!has(obj, key)) continue;
|
||||
if (isArr && String(Number(key)) === key && key < obj.length) continue;
|
||||
if (/[^\w$]/.test(key)) {
|
||||
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
||||
} else {
|
||||
xs.push(key + ': ' + inspect(obj[key], obj));
|
||||
}
|
||||
}
|
||||
return xs;
|
||||
}
|
||||
|
||||
},{"./util.inspect":1}]},{},[2]);
|
||||
18
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/LICENSE
generated
vendored
Executable file
18
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
17
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/all.js
generated
vendored
Executable file
17
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/all.js
generated
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
var inspect = require('../');
|
||||
var holes = [ 'a', 'b' ];
|
||||
holes[4] = 'e', holes[6] = 'g';
|
||||
var obj = {
|
||||
a: 1,
|
||||
b: [ 3, 4, undefined, null ],
|
||||
c: undefined,
|
||||
d: null,
|
||||
e: {
|
||||
regex: /^x/i,
|
||||
buf: new Buffer('abc'),
|
||||
holes: holes
|
||||
},
|
||||
now: new Date
|
||||
};
|
||||
obj.self = obj;
|
||||
console.log(inspect(obj));
|
||||
4
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/circular.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/circular.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var inspect = require('../');
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
console.log(inspect(obj));
|
||||
3
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/fn.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/fn.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var inspect = require('../');
|
||||
var obj = [ 1, 2, function f (n) { return n + 5 }, 4 ];
|
||||
console.log(inspect(obj));
|
||||
7
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/inspect.js
generated
vendored
Executable file
7
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/example/inspect.js
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
var inspect = require('../');
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
|
||||
239
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/index.js
generated
vendored
Executable file
239
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,239 @@
|
|||
var hasMap = typeof Map === 'function' && Map.prototype;
|
||||
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
||||
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
||||
var mapForEach = hasMap && Map.prototype.forEach;
|
||||
var hasSet = typeof Set === 'function' && Set.prototype;
|
||||
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
||||
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
||||
var setForEach = hasSet && Set.prototype.forEach;
|
||||
var booleanValueOf = Boolean.prototype.valueOf;
|
||||
var objectToString = Object.prototype.toString;
|
||||
|
||||
var inspectCustom = require('./util.inspect').custom;
|
||||
var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null;
|
||||
|
||||
module.exports = function inspect_ (obj, opts, depth, seen) {
|
||||
if (typeof obj === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (typeof obj === 'boolean') {
|
||||
return obj ? 'true' : 'false';
|
||||
}
|
||||
if (typeof obj === 'string') {
|
||||
return inspectString(obj);
|
||||
}
|
||||
if (typeof obj === 'number') {
|
||||
if (obj === 0) {
|
||||
return Infinity / obj > 0 ? '0' : '-0';
|
||||
}
|
||||
return String(obj);
|
||||
}
|
||||
|
||||
if (!opts) opts = {};
|
||||
|
||||
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
||||
if (typeof depth === 'undefined') depth = 0;
|
||||
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
||||
return '[Object]';
|
||||
}
|
||||
|
||||
if (typeof seen === 'undefined') seen = [];
|
||||
else if (indexOf(seen, obj) >= 0) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
function inspect (value, from) {
|
||||
if (from) {
|
||||
seen = seen.slice();
|
||||
seen.push(from);
|
||||
}
|
||||
return inspect_(value, opts, depth + 1, seen);
|
||||
}
|
||||
|
||||
if (typeof obj === 'function') {
|
||||
var name = nameOf(obj);
|
||||
return '[Function' + (name ? ': ' + name : '') + ']';
|
||||
}
|
||||
if (isSymbol(obj)) {
|
||||
var symString = Symbol.prototype.toString.call(obj);
|
||||
return typeof obj === 'object' ? markBoxed(symString) : symString;
|
||||
}
|
||||
if (isElement(obj)) {
|
||||
var s = '<' + String(obj.nodeName).toLowerCase();
|
||||
var attrs = obj.attributes || [];
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
|
||||
}
|
||||
s += '>';
|
||||
if (obj.childNodes && obj.childNodes.length) s += '...';
|
||||
s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
||||
return s;
|
||||
}
|
||||
if (isArray(obj)) {
|
||||
if (obj.length === 0) return '[]';
|
||||
return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';
|
||||
}
|
||||
if (isError(obj)) {
|
||||
var parts = arrObjKeys(obj, inspect);
|
||||
if (parts.length === 0) return '[' + String(obj) + ']';
|
||||
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
||||
}
|
||||
if (typeof obj === 'object') {
|
||||
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
||||
return obj[inspectSymbol]();
|
||||
} else if (typeof obj.inspect === 'function') {
|
||||
return obj.inspect();
|
||||
}
|
||||
}
|
||||
if (isMap(obj)) {
|
||||
var parts = [];
|
||||
mapForEach.call(obj, function (value, key) {
|
||||
parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Map', mapSize.call(obj), parts);
|
||||
}
|
||||
if (isSet(obj)) {
|
||||
var parts = [];
|
||||
setForEach.call(obj, function (value ) {
|
||||
parts.push(inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Set', setSize.call(obj), parts);
|
||||
}
|
||||
if (isNumber(obj)) {
|
||||
return markBoxed(inspect(Number(obj)));
|
||||
}
|
||||
if (isBoolean(obj)) {
|
||||
return markBoxed(booleanValueOf.call(obj));
|
||||
}
|
||||
if (isString(obj)) {
|
||||
return markBoxed(inspect(String(obj)));
|
||||
}
|
||||
if (!isDate(obj) && !isRegExp(obj)) {
|
||||
var xs = arrObjKeys(obj, inspect);
|
||||
if (xs.length === 0) return '{}';
|
||||
return '{ ' + xs.join(', ') + ' }';
|
||||
}
|
||||
return String(obj);
|
||||
};
|
||||
|
||||
function quote (s) {
|
||||
return String(s).replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function isArray (obj) { return toStr(obj) === '[object Array]' }
|
||||
function isDate (obj) { return toStr(obj) === '[object Date]' }
|
||||
function isRegExp (obj) { return toStr(obj) === '[object RegExp]' }
|
||||
function isError (obj) { return toStr(obj) === '[object Error]' }
|
||||
function isSymbol (obj) { return toStr(obj) === '[object Symbol]' }
|
||||
function isString (obj) { return toStr(obj) === '[object String]' }
|
||||
function isNumber (obj) { return toStr(obj) === '[object Number]' }
|
||||
function isBoolean (obj) { return toStr(obj) === '[object Boolean]' }
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
||||
function has (obj, key) {
|
||||
return hasOwn.call(obj, key);
|
||||
}
|
||||
|
||||
function toStr (obj) {
|
||||
return objectToString.call(obj);
|
||||
}
|
||||
|
||||
function nameOf (f) {
|
||||
if (f.name) return f.name;
|
||||
var m = String(f).match(/^function\s*([\w$]+)/);
|
||||
if (m) return m[1];
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
if (xs.indexOf) return xs.indexOf(x);
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function isMap (x) {
|
||||
if (!mapSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
mapSize.call(x);
|
||||
try {
|
||||
setSize.call(x);
|
||||
} catch (s) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSet (x) {
|
||||
if (!setSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
setSize.call(x);
|
||||
try {
|
||||
mapSize.call(x);
|
||||
} catch (m) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isElement (x) {
|
||||
if (!x || typeof x !== 'object') return false;
|
||||
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
||||
return true;
|
||||
}
|
||||
return typeof x.nodeName === 'string'
|
||||
&& typeof x.getAttribute === 'function'
|
||||
;
|
||||
}
|
||||
|
||||
function inspectString (str) {
|
||||
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
||||
return "'" + s + "'";
|
||||
}
|
||||
|
||||
function lowbyte (c) {
|
||||
var n = c.charCodeAt(0);
|
||||
var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
|
||||
if (x) return '\\' + x;
|
||||
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
|
||||
}
|
||||
|
||||
function markBoxed (str) {
|
||||
return 'Object(' + str + ')';
|
||||
}
|
||||
|
||||
function collectionOf (type, size, entries) {
|
||||
return type + ' (' + size + ') {' + entries.join(', ') + '}';
|
||||
}
|
||||
|
||||
function arrObjKeys (obj, inspect) {
|
||||
var isArr = isArray(obj);
|
||||
var xs = [];
|
||||
if (isArr) {
|
||||
xs.length = obj.length;
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
||||
}
|
||||
}
|
||||
for (var key in obj) {
|
||||
if (!has(obj, key)) continue;
|
||||
if (isArr && String(Number(key)) === key && key < obj.length) continue;
|
||||
if (/[^\w$]/.test(key)) {
|
||||
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
||||
} else {
|
||||
xs.push(key + ': ' + inspect(obj[key], obj));
|
||||
}
|
||||
}
|
||||
return xs;
|
||||
}
|
||||
54
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/package.json
generated
vendored
Executable file
54
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "object-inspect",
|
||||
"version": "1.4.1",
|
||||
"description": "string representations of objects in node and the browser",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"core-js": "^2.5.1",
|
||||
"nyc": "^10.3.2",
|
||||
"tape": "^4.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run tests-only",
|
||||
"pretests-only": "node test-core-js",
|
||||
"tests-only": "tape test/*.js",
|
||||
"coverage": "nyc npm run tests-only"
|
||||
},
|
||||
"testling": {
|
||||
"files": [
|
||||
"test/*.js",
|
||||
"test/browser/*.js"
|
||||
],
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"chrome/latest",
|
||||
"firefox/latest",
|
||||
"safari/latest",
|
||||
"opera/latest",
|
||||
"iphone/latest",
|
||||
"ipad/latest",
|
||||
"android/latest"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/object-inspect.git"
|
||||
},
|
||||
"homepage": "https://github.com/substack/object-inspect",
|
||||
"keywords": [
|
||||
"inspect",
|
||||
"util.inspect",
|
||||
"object",
|
||||
"stringify",
|
||||
"pretty"
|
||||
],
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"license": "MIT",
|
||||
"browser": {
|
||||
"./util.inspect.js": false
|
||||
}
|
||||
}
|
||||
59
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/readme.markdown
generated
vendored
Executable file
59
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/readme.markdown
generated
vendored
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
# object-inspect
|
||||
|
||||
string representations of objects in node and the browser
|
||||
|
||||
[](https://ci.testling.com/substack/object-inspect)
|
||||
|
||||
[](http://travis-ci.org/substack/object-inspect)
|
||||
|
||||
# example
|
||||
|
||||
## circular
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect');
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
console.log(inspect(obj));
|
||||
```
|
||||
|
||||
## dom element
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect')
|
||||
```
|
||||
|
||||
## var s = inspect(obj, opts={})
|
||||
|
||||
Return a string `s` with the string representation of `obj` up to a depth of
|
||||
`opts.depth`.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install object-inspect
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
16
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test-core-js.js
generated
vendored
Executable file
16
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test-core-js.js
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
require('core-js');
|
||||
|
||||
var inspect = require('./');
|
||||
var test = require('tape');
|
||||
|
||||
test('Maps', function (t) {
|
||||
t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Sets', function (t) {
|
||||
t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}');
|
||||
t.end();
|
||||
});
|
||||
15
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/browser/dom.js
generated
vendored
Executable file
15
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/browser/dom.js
generated
vendored
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
var inspect = require('../../');
|
||||
var test = require('tape');
|
||||
|
||||
test('dom element', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
t.equal(
|
||||
inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]),
|
||||
'[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]'
|
||||
);
|
||||
});
|
||||
9
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/circular.js
generated
vendored
Executable file
9
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/circular.js
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('circular', function (t) {
|
||||
t.plan(1);
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
|
||||
});
|
||||
9
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/deep.js
generated
vendored
Executable file
9
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/deep.js
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('deep', function (t) {
|
||||
t.plan(2);
|
||||
var obj = [ [ [ [ [ [ 500 ] ] ] ] ] ];
|
||||
t.equal(inspect(obj), '[ [ [ [ [ [Object] ] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 2 }), '[ [ [Object] ] ]');
|
||||
});
|
||||
51
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/element.js
generated
vendored
Executable file
51
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/element.js
generated
vendored
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('element', function (t) {
|
||||
t.plan(1);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
attributes: [ { name: 'class', value: 'row' } ],
|
||||
getAttribute: function (key) {},
|
||||
childNodes: []
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element no attr', function (t) {
|
||||
t.plan(1);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
getAttribute: function (key) {},
|
||||
childNodes: []
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element with contents', function (t) {
|
||||
t.plan(1);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
getAttribute: function (key) {},
|
||||
childNodes: [ { nodeName: 'b' } ]
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div>...</div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element instance', function (t) {
|
||||
t.plan(1);
|
||||
var h = global.HTMLElement;
|
||||
global.HTMLElement = function (name, attr) {
|
||||
this.nodeName = name;
|
||||
this.attributes = attr;
|
||||
};
|
||||
global.HTMLElement.prototype.getAttribute = function () {};
|
||||
|
||||
var elem = new(global.HTMLElement)('div', []);
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
||||
global.HTMLElement = h;
|
||||
});
|
||||
29
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/err.js
generated
vendored
Executable file
29
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/err.js
generated
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('type error', function (t) {
|
||||
t.plan(1);
|
||||
var aerr = new TypeError;
|
||||
aerr.foo = 555;
|
||||
aerr.bar = [1,2,3];
|
||||
|
||||
var berr = new TypeError('tuv');
|
||||
berr.baz = 555;
|
||||
|
||||
var cerr = new SyntaxError;
|
||||
cerr.message = 'whoa';
|
||||
cerr['a-b'] = 5;
|
||||
|
||||
var obj = [
|
||||
new TypeError,
|
||||
new TypeError('xxx'),
|
||||
aerr, berr, cerr
|
||||
];
|
||||
t.equal(inspect(obj), '[ ' + [
|
||||
'[TypeError]',
|
||||
'[TypeError: xxx]',
|
||||
'{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }',
|
||||
'{ [TypeError: tuv] baz: 555 }',
|
||||
'{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }'
|
||||
].join(', ') + ' ]');
|
||||
});
|
||||
18
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/fn.js
generated
vendored
Executable file
18
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/fn.js
generated
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('function', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ 1, 2, function f (n) {}, 4 ];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
|
||||
});
|
||||
|
||||
test('function name', function (t) {
|
||||
t.plan(1);
|
||||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
f.toString = function () { return 'function xxx () {}' };
|
||||
var obj = [ 1, 2, f, 4 ];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]');
|
||||
});
|
||||
31
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/has.js
generated
vendored
Executable file
31
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/has.js
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
var withoutProperty = function (object, property, fn) {
|
||||
var original;
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
original = Object.getOwnPropertyDescriptor(object, property);
|
||||
} else {
|
||||
original = object[property];
|
||||
}
|
||||
delete object[property];
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
Object.defineProperty(object, property, original);
|
||||
} else {
|
||||
object[property] = original;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
test('when Object#hasOwnProperty is deleted', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [1, , 3];
|
||||
Array.prototype[1] = 2; // this is needed to account for "in" vs "hasOwnProperty"
|
||||
withoutProperty(Object.prototype, 'hasOwnProperty', function () {
|
||||
t.equal(inspect(arr), '[ 1, , 3 ]');
|
||||
});
|
||||
delete Array.prototype[1];
|
||||
});
|
||||
15
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/holes.js
generated
vendored
Executable file
15
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/holes.js
generated
vendored
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var xs = [ 'a', 'b' ];
|
||||
xs[5] = 'f';
|
||||
xs[7] = 'j';
|
||||
xs[8] = 'k';
|
||||
|
||||
test('holes', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(xs),
|
||||
"[ 'a', 'b', , , , 'f', , 'j', 'k' ]"
|
||||
);
|
||||
});
|
||||
8
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/inspect.js
generated
vendored
Executable file
8
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/inspect.js
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('inspect', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ { inspect: function () { return '!XYZ¡' } }, [] ];
|
||||
t.equal(inspect(obj), '[ !XYZ¡, [] ]');
|
||||
});
|
||||
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/lowbyte.js
generated
vendored
Executable file
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/lowbyte.js
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var obj = { x: 'a\r\nb', y: '\5! \x1f \022' };
|
||||
|
||||
test('interpolate low bytes', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(obj),
|
||||
"{ x: 'a\\r\\nb', y: '\\x05! \\x1f \\x12' }"
|
||||
);
|
||||
});
|
||||
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/number.js
generated
vendored
Executable file
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/number.js
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('negative zero', function (t) {
|
||||
t.equal(inspect(0), '0', 'inspect(0) === "0"');
|
||||
t.equal(inspect(Object(0)), 'Object(0)', 'inspect(Object(0)) === "Object(0)"');
|
||||
|
||||
t.equal(inspect(-0), '-0', 'inspect(-0) === "-0"');
|
||||
t.equal(inspect(Object(-0)), 'Object(-0)', 'inspect(Object(-0)) === "Object(-0)"');
|
||||
|
||||
t.end();
|
||||
});
|
||||
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/undef.js
generated
vendored
Executable file
12
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/undef.js
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var obj = { a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null };
|
||||
|
||||
test('undef and null', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(obj),
|
||||
'{ a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }'
|
||||
);
|
||||
});
|
||||
132
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/values.js
generated
vendored
Executable file
132
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/test/values.js
generated
vendored
Executable file
|
|
@ -0,0 +1,132 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('values', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ {}, [], { 'a-b': 5 } ];
|
||||
t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]');
|
||||
});
|
||||
|
||||
test('arrays with properties', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [3];
|
||||
arr.foo = 'bar';
|
||||
var obj = [1, 2, arr];
|
||||
obj.baz = 'quux';
|
||||
obj.index = -1;
|
||||
t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]');
|
||||
});
|
||||
|
||||
test('has', function (t) {
|
||||
t.plan(1);
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
delete Object.prototype.hasOwnProperty;
|
||||
t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }');
|
||||
Object.prototype.hasOwnProperty = has;
|
||||
});
|
||||
|
||||
test('indexOf seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3, {} ];
|
||||
xs.push(xs);
|
||||
|
||||
var seen = [];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[ 1, 2, 3, {}, [Circular] ]'
|
||||
);
|
||||
});
|
||||
|
||||
test('seen seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3 ];
|
||||
|
||||
var seen = [ xs ];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[Circular]'
|
||||
);
|
||||
});
|
||||
|
||||
test('seen seen seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3 ];
|
||||
|
||||
var seen = [ 5, xs ];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[Circular]'
|
||||
);
|
||||
});
|
||||
|
||||
test('symbols', { skip: typeof Symbol !== 'function' }, function (t) {
|
||||
var sym = Symbol('foo');
|
||||
t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"');
|
||||
t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Map', { skip: typeof Map !== 'function' }, function (t) {
|
||||
var map = new Map();
|
||||
map.set({ a: 1 }, ['b']);
|
||||
map.set(3, NaN);
|
||||
var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}';
|
||||
t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents');
|
||||
t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty');
|
||||
|
||||
var nestedMap = new Map();
|
||||
nestedMap.set(nestedMap, map);
|
||||
t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Set', { skip: typeof Set !== 'function' }, function (t) {
|
||||
var set = new Set();
|
||||
set.add({ a: 1 });
|
||||
set.add(['b']);
|
||||
var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}';
|
||||
t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents');
|
||||
t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty');
|
||||
|
||||
var nestedSet = new Set();
|
||||
nestedSet.add(set);
|
||||
nestedSet.add(nestedSet);
|
||||
t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Strings', function (t) {
|
||||
var str = 'abc';
|
||||
|
||||
t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such');
|
||||
t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Numbers', function (t) {
|
||||
var num = 42;
|
||||
|
||||
t.equal(inspect(num), String(num), 'primitive number shows as such');
|
||||
t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Booleans', function (t) {
|
||||
t.equal(inspect(true), String(true), 'primitive true shows as such');
|
||||
t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such');
|
||||
|
||||
t.equal(inspect(false), String(false), 'primitive false shows as such');
|
||||
t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such');
|
||||
|
||||
t.end();
|
||||
});
|
||||
1
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/util.inspect.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/node_modules/object-inspect/util.inspect.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('util').inspect;
|
||||
51
VISUALIZACION/node_modules/static-module/package.json
generated
vendored
Executable file
51
VISUALIZACION/node_modules/static-module/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "static-module",
|
||||
"version": "2.2.5",
|
||||
"description": "convert module usage to inline expressions",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"concat-stream": "~1.6.0",
|
||||
"convert-source-map": "^1.5.1",
|
||||
"duplexer2": "~0.1.4",
|
||||
"escodegen": "~1.9.0",
|
||||
"falafel": "^2.1.0",
|
||||
"has": "^1.0.1",
|
||||
"magic-string": "^0.22.4",
|
||||
"merge-source-map": "1.0.4",
|
||||
"object-inspect": "~1.4.0",
|
||||
"quote-stream": "~1.0.2",
|
||||
"readable-stream": "~2.3.3",
|
||||
"shallow-copy": "~0.0.1",
|
||||
"static-eval": "^2.0.0",
|
||||
"through2": "~2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"from2-string": "^1.1.0",
|
||||
"resolve": "^1.5.0",
|
||||
"source-map": "^0.6.1",
|
||||
"tape": "^4.8.0",
|
||||
"uglify-js": "3.3.12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/static-module.git"
|
||||
},
|
||||
"homepage": "https://github.com/substack/static-module",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"static",
|
||||
"analysis",
|
||||
"esprima",
|
||||
"syntax",
|
||||
"tree"
|
||||
],
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
117
VISUALIZACION/node_modules/static-module/readme.markdown
generated
vendored
Executable file
117
VISUALIZACION/node_modules/static-module/readme.markdown
generated
vendored
Executable file
|
|
@ -0,0 +1,117 @@
|
|||
# static-module
|
||||
|
||||
convert module usage to inline expressions
|
||||
|
||||
# example
|
||||
|
||||
Here's a simplified version of the [brfs](https://npmjs.org/package/brfs) module
|
||||
using static-module.
|
||||
|
||||
brfs converts `fs.readFileSync(file)` calls to inline strings with the contents
|
||||
of `file` included in-place.
|
||||
|
||||
``` js
|
||||
var staticModule = require('static-module');
|
||||
var quote = require('quote-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: __dirname + '/brfs' } });
|
||||
process.stdin.pipe(sm).pipe(process.stdout);
|
||||
```
|
||||
|
||||
input:
|
||||
|
||||
```
|
||||
$ cat brfs/source.js
|
||||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/x.txt');
|
||||
console.log(src);
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
$ node brfs.js < brfs/source.js
|
||||
|
||||
var src = "beep boop\n";
|
||||
console.log(src);
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var staticModule = require('static-module')
|
||||
```
|
||||
|
||||
## var sm = staticModule(modules, opts={})
|
||||
|
||||
Return a transform stream `sm` that transforms javascript source input to
|
||||
javascript source output with each property in the `modules` object expanded in
|
||||
inline form.
|
||||
|
||||
Properties in the `modules` object can be ordinary values that will be included
|
||||
directly or functions that will be executed with the [statically
|
||||
evaluated](https://npmjs.org/package/static-eval) arguments from the source
|
||||
under an optional set of `opts.vars` variables.
|
||||
|
||||
Property functions can return streams, in which case their contents will be
|
||||
piped directly into the source output.
|
||||
|
||||
Otherwise, the return values of functions will be inlined into the source in
|
||||
place as strings.
|
||||
|
||||
Use `opts.varModules` to map whitelisted module names to definitions that can be
|
||||
declared in client code with `var` and will appear in static expressions like
|
||||
`opts.vars`.
|
||||
|
||||
For example, to make this code with `path.join()` work:
|
||||
|
||||
``` js
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var src = fs.readFileSync(path.join(__dirname, 'x.txt'), 'utf8');
|
||||
console.log(src);
|
||||
```
|
||||
|
||||
you can do:
|
||||
|
||||
``` js
|
||||
var staticModule = require('static-module');
|
||||
var quote = require('quote-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
},
|
||||
varMods: { path: require('path') }
|
||||
}, { vars: { __dirname: __dirname + '/brfs' } });
|
||||
process.stdin.pipe(sm).pipe(process.stdout);
|
||||
```
|
||||
|
||||
Use `opts.parserOpts` to set additional options for the
|
||||
[acorn](https://github.com/acornjs/acorn) parser.
|
||||
|
||||
Set `opts.sourceMap` to `true` to generate a source map and add it as an inline
|
||||
comment. You can add `opts.inputFilename` to configure the original file name
|
||||
that will be listed in the source map.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install static-module
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
44
VISUALIZACION/node_modules/static-module/test/assign.js
generated
vendored
Executable file
44
VISUALIZACION/node_modules/static-module/test/assign.js
generated
vendored
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('assign', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var expected = [ 12, 555 ];
|
||||
var sm = staticModule({
|
||||
beep: { x: 4, f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'\nconsole.log(4 * 3);'
|
||||
+ '\nconsole.log(555);\n'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('assign comma', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var expected = [ 12, 555 ];
|
||||
var sm = staticModule({
|
||||
beep: { x: 4, f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('comma.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'x = 5;\n'
|
||||
+ 'console.log(4 * 3);\n'
|
||||
+ 'console.log(555);\n'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'assign', file));
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/assign/comma.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/assign/comma.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
x = 5, b = require('beep');
|
||||
console.log(b.x * 3);
|
||||
console.log(b.f(5));
|
||||
3
VISUALIZACION/node_modules/static-module/test/assign/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/assign/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
b = require('beep');
|
||||
console.log(b.x * 3);
|
||||
console.log(b.f(5));
|
||||
198
VISUALIZACION/node_modules/static-module/test/brfs.js
generated
vendored
Executable file
198
VISUALIZACION/node_modules/static-module/test/brfs.js
generated
vendored
Executable file
|
|
@ -0,0 +1,198 @@
|
|||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var vm = require('vm');
|
||||
|
||||
test('readFileSync', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync empty', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('empty.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'), '');
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('attribute.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute with multiple vars', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('attribute_vars.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'var x = 5, y = 2;'
|
||||
+ '\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute with multiple require vars', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('multi_require.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'var x = 5;'
|
||||
+ '\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute with multiple require vars including an uninitalized var', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('multi_require_with_uninitialized.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'var x;'
|
||||
+ '\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute with multiple require vars x5', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('x5.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8').replace(/;/g,''),
|
||||
'var a = 1, b = 2, c = 3, d = 4, '
|
||||
+ 'src = "beep boop\\n",\n'
|
||||
+ ' e = 5\n'
|
||||
+ 'console.log(src)\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync with bracket notation', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('brackets.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('readFileSync attribute bracket notation', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: {
|
||||
readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('attribute_brackets.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'\nvar src = "beep boop\\n";'
|
||||
+ '\nconsole.log(src);\n'
|
||||
);
|
||||
vm.runInNewContext(body.toString('utf8'), {
|
||||
console: { log: log }
|
||||
});
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'brfs', file));
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var f = require('fs').readFileSync;
|
||||
var src = f(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute_brackets.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute_brackets.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var f = require('fs')["readFileSync"];
|
||||
var src = f(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute_vars.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/attribute_vars.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var x = 5, f = require('fs').readFileSync, y = 2;
|
||||
var src = f(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/brackets.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/brackets.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs');
|
||||
var src = fs["readFileSync"](__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
0
VISUALIZACION/node_modules/static-module/test/brfs/empty.js
generated
vendored
Executable file
0
VISUALIZACION/node_modules/static-module/test/brfs/empty.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/multi_require.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/multi_require.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs'), x = 5;
|
||||
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/multi_require_with_uninitialized.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/multi_require_with_uninitialized.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs'), x;
|
||||
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
3
VISUALIZACION/node_modules/static-module/test/brfs/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/brfs/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(src);
|
||||
1
VISUALIZACION/node_modules/static-module/test/brfs/x.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/brfs/x.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
beep boop
|
||||
5
VISUALIZACION/node_modules/static-module/test/brfs/x5.js
generated
vendored
Executable file
5
VISUALIZACION/node_modules/static-module/test/brfs/x5.js
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
var a = 1, b = 2, fs = require('fs'),
|
||||
c = 3, d = 4, src = fs.readFileSync(__dirname + '/x.txt', 'utf8'),
|
||||
e = 5
|
||||
;
|
||||
console.log(src);
|
||||
19
VISUALIZACION/node_modules/static-module/test/fn.js
generated
vendored
Executable file
19
VISUALIZACION/node_modules/static-module/test/fn.js
generated
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('function', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var sm = staticModule({ beep: function (n) { return n * 111 } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 555) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'fn', file));
|
||||
}
|
||||
2
VISUALIZACION/node_modules/static-module/test/fn/source.js
generated
vendored
Executable file
2
VISUALIZACION/node_modules/static-module/test/fn/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
var b = require('beep');
|
||||
console.log(b(5));
|
||||
55
VISUALIZACION/node_modules/static-module/test/fs.js
generated
vendored
Executable file
55
VISUALIZACION/node_modules/static-module/test/fs.js
generated
vendored
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var through = require('through2');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('fs.readFile', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: { readFile: readFile }
|
||||
}, { vars: { __dirname: __dirname + '/fs' } });
|
||||
readStream('readfile.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8').replace(/;/g,'').trim(),
|
||||
'process.nextTick(function(){(function (err, src) {\n'
|
||||
+ ' console.log(src)\n'
|
||||
+ '})(null,"beep boop\\n")})'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 'beep boop\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('fs.readFileSync', function (t) {
|
||||
t.plan(2);
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: readFileSync }
|
||||
}, { vars: { __dirname: __dirname + '/fs' } });
|
||||
readStream('html.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'var html = "EXTERMINATE\\n";\n'
|
||||
+ 'console.log(html);\n'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 'EXTERMINATE\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'fs', file));
|
||||
}
|
||||
|
||||
function readFile (file, cb) {
|
||||
var stream = through(write, end);
|
||||
stream.push('process.nextTick(function(){(' + cb + ')(null,');
|
||||
return fs.createReadStream(file).pipe(quote()).pipe(stream);
|
||||
|
||||
function write (buf, enc, next) { this.push(buf); next() }
|
||||
function end (next) { this.push(')})'); this.push(null); next() }
|
||||
}
|
||||
|
||||
function readFileSync (file, opts) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
2
VISUALIZACION/node_modules/static-module/test/fs/html.js
generated
vendored
Executable file
2
VISUALIZACION/node_modules/static-module/test/fs/html.js
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
var html = require('fs').readFileSync(__dirname + '/robot.html', 'utf8');
|
||||
console.log(html);
|
||||
4
VISUALIZACION/node_modules/static-module/test/fs/readfile.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/test/fs/readfile.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var fs = require('fs')
|
||||
fs.readFile(__dirname + '/x.txt', function (err, src) {
|
||||
console.log(src);
|
||||
});
|
||||
1
VISUALIZACION/node_modules/static-module/test/fs/robot.html
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/fs/robot.html
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
EXTERMINATE
|
||||
1
VISUALIZACION/node_modules/static-module/test/fs/x.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/fs/x.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
beep boop
|
||||
84
VISUALIZACION/node_modules/static-module/test/fs_twice.js
generated
vendored
Executable file
84
VISUALIZACION/node_modules/static-module/test/fs_twice.js
generated
vendored
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var through = require('through2');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('fs.readFileSync twice', function (t) {
|
||||
var expected = [ 'EXTERMINATE\n', 'beep boop\n' ];
|
||||
t.plan(expected.length + 1);
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: readFileSync }
|
||||
}, { vars: { __dirname: __dirname + '/fs_twice' } });
|
||||
readStream('html.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'),
|
||||
'var a = "EXTERMINATE\\n";\n'
|
||||
+ 'var b = "beep boop\\n";\n'
|
||||
+ 'console.log(a);\n'
|
||||
+ 'console.log(b);\n'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('fs.readFileSync twice in vars', function (t) {
|
||||
var expected = [ 'EXTERMINATE\n', 'beep boop\n' ];
|
||||
t.plan(expected.length + 1);
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: readFileSync }
|
||||
}, { vars: { __dirname: __dirname + '/fs_twice' } });
|
||||
readStream('vars.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8').trim(),
|
||||
'var a = "EXTERMINATE\\n",\n'
|
||||
+ ' b = "beep boop\\n";\n'
|
||||
+ 'console.log(a);\n'
|
||||
+ 'console.log(b);'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('fs.readFileSync 4x', function (t) {
|
||||
var expected = [
|
||||
'EXTERMINATE\n', 'beep boop\n', 'EXTERMINATE\n', 'beep boop\n'
|
||||
];
|
||||
t.plan(expected.length + 1);
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: readFileSync }
|
||||
}, { vars: { __dirname: __dirname + '/fs_twice' } });
|
||||
readStream('4x.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8').trim(),
|
||||
'var a = "EXTERMINATE\\n";\n'
|
||||
+ 'var b = "beep boop\\n";\n'
|
||||
+ 'var c = "EXTERMINATE\\n";\n'
|
||||
+ 'var d = "beep boop\\n";\n'
|
||||
+ 'console.log(a);\n'
|
||||
+ 'console.log(b);\n'
|
||||
+ 'console.log(c);\n'
|
||||
+ 'console.log(d);'
|
||||
);
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'fs_twice', file));
|
||||
}
|
||||
|
||||
function readFile (file, cb) {
|
||||
var stream = through(write, end);
|
||||
stream.push('process.nextTick(function(){(' + cb + ')(null,');
|
||||
return fs.createReadStream(file).pipe(quote()).pipe(stream);
|
||||
|
||||
function write (buf, enc, next) { this.push(buf); next() }
|
||||
function end (next) { this.push(')})'); this.push(null); next() }
|
||||
}
|
||||
|
||||
function readFileSync (file, opts) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
9
VISUALIZACION/node_modules/static-module/test/fs_twice/4x.js
generated
vendored
Executable file
9
VISUALIZACION/node_modules/static-module/test/fs_twice/4x.js
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
var fs = require('fs');
|
||||
var a = fs.readFileSync(__dirname + '/robot.html', 'utf8');
|
||||
var b = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
var c = fs.readFileSync(__dirname + '/robot.html', 'utf8');
|
||||
var d = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
console.log(c);
|
||||
console.log(d);
|
||||
4
VISUALIZACION/node_modules/static-module/test/fs_twice/html.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/test/fs_twice/html.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var a = require('fs').readFileSync(__dirname + '/robot.html', 'utf8');
|
||||
var b = require('fs').readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
4
VISUALIZACION/node_modules/static-module/test/fs_twice/readfile.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/test/fs_twice/readfile.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var fs = require('fs')
|
||||
fs.readFile(__dirname + '/x.txt', function (err, src) {
|
||||
console.log(src);
|
||||
});
|
||||
1
VISUALIZACION/node_modules/static-module/test/fs_twice/robot.html
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/fs_twice/robot.html
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
EXTERMINATE
|
||||
5
VISUALIZACION/node_modules/static-module/test/fs_twice/vars.js
generated
vendored
Executable file
5
VISUALIZACION/node_modules/static-module/test/fs_twice/vars.js
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
var fs = require('fs');
|
||||
var a = fs.readFileSync(__dirname + '/robot.html', 'utf8'),
|
||||
b = fs.readFileSync(__dirname + '/x.txt', 'utf8');
|
||||
console.log(a);
|
||||
console.log(b);
|
||||
1
VISUALIZACION/node_modules/static-module/test/fs_twice/x.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/fs_twice/x.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
beep boop
|
||||
75
VISUALIZACION/node_modules/static-module/test/inline.js
generated
vendored
Executable file
75
VISUALIZACION/node_modules/static-module/test/inline.js
generated
vendored
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('inline object', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: { f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('obj.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 555) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('inline object call', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: { f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('obj_call.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 555) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('inline object expression', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: { f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('obj_expr.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 1110) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('inline function', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: function (n) { return n * 111 }
|
||||
});
|
||||
readStream('fn.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 555) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('inline function call', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: function (n) { return n * 111 }
|
||||
});
|
||||
readStream('fn_call.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 555) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('inline function expression', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: function (n) { return n * 111 }
|
||||
});
|
||||
readStream('fn_expr.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 1665) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'inline', file));
|
||||
}
|
||||
2
VISUALIZACION/node_modules/static-module/test/inline/fn.js
generated
vendored
Executable file
2
VISUALIZACION/node_modules/static-module/test/inline/fn.js
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
var x = require('beep')(5);
|
||||
console.log(x);
|
||||
1
VISUALIZACION/node_modules/static-module/test/inline/fn_call.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/inline/fn_call.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
console.log(require('beep')(5));
|
||||
1
VISUALIZACION/node_modules/static-module/test/inline/fn_expr.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/inline/fn_expr.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
console.log(require('beep')(5) * 3);
|
||||
2
VISUALIZACION/node_modules/static-module/test/inline/obj.js
generated
vendored
Executable file
2
VISUALIZACION/node_modules/static-module/test/inline/obj.js
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
var x = require('beep').f(5);
|
||||
console.log(x);
|
||||
1
VISUALIZACION/node_modules/static-module/test/inline/obj_call.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/inline/obj_call.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
console.log(require('beep').f(5));
|
||||
1
VISUALIZACION/node_modules/static-module/test/inline/obj_expr.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/inline/obj_expr.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
console.log(require('beep').f(5) * 2);
|
||||
23
VISUALIZACION/node_modules/static-module/test/limit-parsing.js
generated
vendored
Executable file
23
VISUALIZACION/node_modules/static-module/test/limit-parsing.js
generated
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
var concat = require('concat-stream');
|
||||
var from = require('from2-string');
|
||||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('limit parsing to files including a target module', function (t) {
|
||||
var passInput = 'THIS WILL NOT PARSE';
|
||||
var failInput = passInput + '; require("fs")';
|
||||
|
||||
t.plan(2);
|
||||
|
||||
from(passInput)
|
||||
.pipe(staticModule({ fs: require('fs') }))
|
||||
.pipe(concat(function (passOutput) {
|
||||
t.equal(passInput, String(passOutput), 'does not parse');
|
||||
}));
|
||||
|
||||
from(failInput)
|
||||
.pipe(staticModule({ fs: require('fs') }))
|
||||
.once('error', function () {
|
||||
t.pass('parses if module is included');
|
||||
});
|
||||
});
|
||||
45
VISUALIZACION/node_modules/static-module/test/log.js
generated
vendored
Executable file
45
VISUALIZACION/node_modules/static-module/test/log.js
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('stream into a console.log', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: function () {
|
||||
var q = quote();
|
||||
q.end('eek');
|
||||
return q;
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'), 'console.log("eek");\n');
|
||||
}));
|
||||
});
|
||||
|
||||
test('trickle stream into a console.log', function (t) {
|
||||
t.plan(1);
|
||||
var sm = staticModule({
|
||||
beep: function () {
|
||||
var q = quote();
|
||||
var chunks = [ 'beep', ' boop', ' robots' ];
|
||||
var iv = setInterval(function () {
|
||||
if (chunks.length === 0) {
|
||||
clearInterval(iv);
|
||||
q.end();
|
||||
}
|
||||
else q.write(chunks.shift());
|
||||
}, 10);
|
||||
return q;
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'brfs') } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
t.equal(body.toString('utf8'), 'console.log("beep boop robots");\n');
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'log', file));
|
||||
}
|
||||
1
VISUALIZACION/node_modules/static-module/test/log/source.js
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/log/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
console.log(require('beep')());
|
||||
74
VISUALIZACION/node_modules/static-module/test/many.js
generated
vendored
Executable file
74
VISUALIZACION/node_modules/static-module/test/many.js
generated
vendored
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('many instances', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
} }
|
||||
}, { vars: { __dirname: path.join(__dirname, 'many') } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8'),
|
||||
'\nvar a = "A!\\n";\n'
|
||||
+ 'var b = "B!\\n";\n'
|
||||
+ 'var c = "C!\\n";\n'
|
||||
+ 'console.log(a + b + c);\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, 'A!\nB!\nC!\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('expansions inline', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
} }
|
||||
}, { vars: { __dirname: path.join(__dirname, 'many') } });
|
||||
readStream('inline.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8'),
|
||||
'\nvar a = "A!\\n",\n'
|
||||
+ ' b = "B!\\n",\n'
|
||||
+ ' c = "C!\\n"\n'
|
||||
+ ';\n'
|
||||
+ 'console.log(a + b + c);\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, 'A!\nB!\nC!\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
test('all inline', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
} }
|
||||
}, { vars: { __dirname: path.join(__dirname, 'many') } });
|
||||
readStream('all_inline.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8').replace(/;/g,''),
|
||||
'var a = "A!\\n",\n'
|
||||
+ ' b = "B!\\n",\n'
|
||||
+ ' c = "C!\\n"\n'
|
||||
+ 'console.log(a + b + c)\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, 'A!\nB!\nC!\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'many', file));
|
||||
}
|
||||
1
VISUALIZACION/node_modules/static-module/test/many/a.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/many/a.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
A!
|
||||
6
VISUALIZACION/node_modules/static-module/test/many/all_inline.js
generated
vendored
Executable file
6
VISUALIZACION/node_modules/static-module/test/many/all_inline.js
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
var fs = require('fs'),
|
||||
a = fs.readFileSync(__dirname + '/a.txt', 'utf8'),
|
||||
b = fs.readFileSync(__dirname + '/b.txt', 'utf8'),
|
||||
c = fs.readFileSync(__dirname + '/c.txt', 'utf8')
|
||||
;
|
||||
console.log(a + b + c);
|
||||
1
VISUALIZACION/node_modules/static-module/test/many/b.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/many/b.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
B!
|
||||
1
VISUALIZACION/node_modules/static-module/test/many/c.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/many/c.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
C!
|
||||
6
VISUALIZACION/node_modules/static-module/test/many/inline.js
generated
vendored
Executable file
6
VISUALIZACION/node_modules/static-module/test/many/inline.js
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
var fs = require('fs');
|
||||
var a = fs.readFileSync(__dirname + '/a.txt', 'utf8'),
|
||||
b = fs.readFileSync(__dirname + '/b.txt', 'utf8'),
|
||||
c = fs.readFileSync(__dirname + '/c.txt', 'utf8')
|
||||
;
|
||||
console.log(a + b + c);
|
||||
5
VISUALIZACION/node_modules/static-module/test/many/source.js
generated
vendored
Executable file
5
VISUALIZACION/node_modules/static-module/test/many/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
var fs = require('fs');
|
||||
var a = fs.readFileSync(__dirname + '/a.txt', 'utf8');
|
||||
var b = fs.readFileSync(__dirname + '/b.txt', 'utf8');
|
||||
var c = fs.readFileSync(__dirname + '/c.txt', 'utf8');
|
||||
console.log(a + b + c);
|
||||
62
VISUALIZACION/node_modules/static-module/test/mixed.js
generated
vendored
Executable file
62
VISUALIZACION/node_modules/static-module/test/mixed.js
generated
vendored
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('mixed nested objects and streams', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var expected = [ 12, 'oh hello\n', 555 ];
|
||||
var sm = staticModule({
|
||||
beep: {
|
||||
x: { y: { z: 4 } },
|
||||
quote: {
|
||||
read: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
},
|
||||
f: { g: { h: function (n) { return n * 111 } } }
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'mixed') } });
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8'),
|
||||
'\nconsole.log(4 * 3);'
|
||||
+ '\nconsole.log("oh hello\\n");'
|
||||
+ '\nconsole.log(555);\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
test('mixed objects and streams', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var expected = [ 12, 'oh hello\n', 555 ];
|
||||
var sm = staticModule({
|
||||
beep: {
|
||||
x: 4,
|
||||
quote: function (file) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
},
|
||||
f: function (n) { return n * 111 }
|
||||
}
|
||||
}, { vars: { __dirname: path.join(__dirname, 'mixed') } });
|
||||
readStream('unmixed.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8'),
|
||||
'\nconsole.log(4 * 3);'
|
||||
+ '\nconsole.log("oh hello\\n");'
|
||||
+ '\nconsole.log(555);\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'mixed', file));
|
||||
}
|
||||
4
VISUALIZACION/node_modules/static-module/test/mixed/source.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/test/mixed/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var b = require('beep');
|
||||
console.log(b.x.y.z * 3);
|
||||
console.log(b.quote.read(__dirname + '/xyz.txt'));
|
||||
console.log(b.f.g.h(5));
|
||||
4
VISUALIZACION/node_modules/static-module/test/mixed/unmixed.js
generated
vendored
Executable file
4
VISUALIZACION/node_modules/static-module/test/mixed/unmixed.js
generated
vendored
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
var b = require('beep');
|
||||
console.log(b.x * 3);
|
||||
console.log(b.quote(__dirname + '/xyz.txt'));
|
||||
console.log(b.f(5));
|
||||
1
VISUALIZACION/node_modules/static-module/test/mixed/xyz.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/mixed/xyz.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
oh hello
|
||||
29
VISUALIZACION/node_modules/static-module/test/nested.js
generated
vendored
Executable file
29
VISUALIZACION/node_modules/static-module/test/nested.js
generated
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('nested object', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var expected = [ 12, 555 ];
|
||||
var sm = staticModule({
|
||||
beep: {
|
||||
x: { y: { z: 4 } },
|
||||
f: { g: { h: function (n) { return n * 111 } } }
|
||||
}
|
||||
});
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
t.equal(
|
||||
body.toString('utf8'),
|
||||
'\nconsole.log(4 * 3);\nconsole.log(555);\n'
|
||||
);
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'nested', file));
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/nested/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/nested/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var b = require('beep');
|
||||
console.log(b.x.y.z * 3);
|
||||
console.log(b.f.g.h(5));
|
||||
22
VISUALIZACION/node_modules/static-module/test/obj.js
generated
vendored
Executable file
22
VISUALIZACION/node_modules/static-module/test/obj.js
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('object', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var expected = [ 12, 555 ];
|
||||
var sm = staticModule({
|
||||
beep: { x: 4, f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'obj', file));
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/obj/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/obj/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var b = require('beep');
|
||||
console.log(b.x * 3);
|
||||
console.log(b.f(5));
|
||||
21
VISUALIZACION/node_modules/static-module/test/prop.js
generated
vendored
Executable file
21
VISUALIZACION/node_modules/static-module/test/prop.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('property', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var sm = staticModule({
|
||||
fff: function (n) { return '[' + (n * 111) + ']' }
|
||||
});
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.deepEqual(msg, '[object Array]') }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'prop', file));
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/prop/source.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/prop/source.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var f = require('fff');
|
||||
var toString = Object.prototype.toString;
|
||||
console.log(toString.call(f(5)));
|
||||
34
VISUALIZACION/node_modules/static-module/test/readfile_resolve.js
generated
vendored
Executable file
34
VISUALIZACION/node_modules/static-module/test/readfile_resolve.js
generated
vendored
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
var staticModule = require('../');
|
||||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var quote = require('quote-stream');
|
||||
var through = require('through2');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var resolve = require('resolve');
|
||||
|
||||
test('readFileSync of require.resolve()', function (t) {
|
||||
t.plan(1);
|
||||
var dir = __dirname + '/readfile_resolve';
|
||||
function rres (p) { return resolve.sync(p, { basedir: dir }) }
|
||||
|
||||
var vars = {
|
||||
__dirname: dir,
|
||||
require: { resolve: rres }
|
||||
};
|
||||
var sm = staticModule({
|
||||
fs: { readFileSync: readFileSync }
|
||||
}, { vars: vars });
|
||||
readStream('main.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, 'amaze\n') }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'readfile_resolve', file));
|
||||
}
|
||||
|
||||
function readFileSync (file, opts) {
|
||||
return fs.createReadStream(file).pipe(quote());
|
||||
}
|
||||
3
VISUALIZACION/node_modules/static-module/test/readfile_resolve/main.js
generated
vendored
Executable file
3
VISUALIZACION/node_modules/static-module/test/readfile_resolve/main.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
var fs = require('fs')
|
||||
var src = fs.readFileSync(require.resolve('aaa/wow.txt'), 'utf8');
|
||||
console.log(src);
|
||||
1
VISUALIZACION/node_modules/static-module/test/readfile_resolve/node_modules/aaa/wow.txt
generated
vendored
Executable file
1
VISUALIZACION/node_modules/static-module/test/readfile_resolve/node_modules/aaa/wow.txt
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
amaze
|
||||
22
VISUALIZACION/node_modules/static-module/test/shebang.js
generated
vendored
Executable file
22
VISUALIZACION/node_modules/static-module/test/shebang.js
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
var test = require('tape');
|
||||
var concat = require('concat-stream');
|
||||
var staticModule = require('../');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
test('shebang', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var expected = [ 12, 555 ];
|
||||
var sm = staticModule({
|
||||
beep: { x: 4, f: function (n) { return n * 111 } }
|
||||
});
|
||||
readStream('source.js').pipe(sm).pipe(concat(function (body) {
|
||||
Function(['console'],body)({ log: log });
|
||||
function log (msg) { t.equal(msg, expected.shift()) }
|
||||
}));
|
||||
});
|
||||
|
||||
function readStream (file) {
|
||||
return fs.createReadStream(path.join(__dirname, 'shebang', file));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue