Initial commit

This commit is contained in:
pasketti
2026-04-05 16:14:49 -04:00
commit ebee3a5534
14059 changed files with 2588797 additions and 0 deletions

23
node_modules/prettyjson/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,23 @@
(The MIT License)
Copyright (c) 2011 Rafael de Oleza <rafeca@gmail.com>
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.

50
node_modules/prettyjson/bin/prettyjson generated vendored Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env node
var prettyjson = require('../lib/prettyjson');
var fs = require('fs');
var colors = require('colors/safe');
var argv = require('minimist')(process.argv.slice(2));
var options = {
keysColor: argv.keys || process.env.PRETTYJSON_KEYS,
dashColor: argv.dash || process.env.PRETTYJSON_DASH,
defaultIndentation: argv.indent || process.env.PRETTYJSON_INDENT,
stringColor: argv.string || process.env.PRETTYJSON_STRING,
numberColor: argv.number || process.env.PRETTYJSON_NUMBER,
noColor: argv['nocolor'] || process.env.PRETTYJSON_NOCOLOR,
noAlign: argv['noalign'] || process.env.PRETTYJSON_NOALIGN,
inlineArrays: argv['inline-arrays'] || process.env.PRETTYJSON_INLINE_ARRAYS
};
var renderInputJson = function(input){
console.log(prettyjson.renderString(input, options));
};
if (argv._.length) {
// First parameter is the file to read and parse
var filename = argv._[0];
try {
renderInputJson(fs.readFileSync(filename, 'utf8'));
} catch (e) {
console.error(colors.red('Error: ') + 'File \'' + filename + '\' does not exist');
process.exit(1);
}
} else {
// Read input stream
var streamData = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
if (chunk === '\n') {
renderInputJson(streamData);
streamData = '';
return;
}
streamData += chunk;
});
process.stdin.on('end', function(){
renderInputJson(streamData);
});
}

263
node_modules/prettyjson/lib/prettyjson.js generated vendored Normal file
View File

@@ -0,0 +1,263 @@
'use strict';
// ### Module dependencies
var colors = require('colors/safe');
var Utils = require('./utils');
exports.version = require('../package.json').version;
// Helper function to detect if an object can be directly serializable
var isSerializable = function(input, onlyPrimitives, options) {
if (
typeof input === 'boolean' ||
typeof input === 'number' ||
typeof input === 'function' ||
input === null ||
input instanceof Date
) {
return true;
}
if (typeof input === 'string' && input.indexOf('\n') === -1) {
return true;
}
if (options.inlineArrays && !onlyPrimitives) {
if (Array.isArray(input) && isSerializable(input[0], true, options)) {
return true;
}
}
return false;
};
var addColorToData = function(input, options) {
if (options.noColor) {
return input;
}
if (typeof input === 'string') {
// Print strings in regular terminal color
return options.stringColor ? colors[options.stringColor](input) : input;
}
var sInput = input + '';
if (input === true) {
return colors.green(sInput);
}
if (input === false) {
return colors.red(sInput);
}
if (input === null) {
return colors.grey(sInput);
}
if (typeof input === 'number') {
return colors[options.numberColor](sInput);
}
if (typeof input === 'function') {
return 'function() {}';
}
if (Array.isArray(input)) {
return input.join(', ');
}
return sInput;
};
var indentLines = function(string, spaces){
var lines = string.split('\n');
lines = lines.map(function(line){
return Utils.indent(spaces) + line;
});
return lines.join('\n');
};
var renderToArray = function(data, options, indentation) {
if (isSerializable(data, false, options)) {
return [Utils.indent(indentation) + addColorToData(data, options)];
}
// Unserializable string means it's multiline
if (typeof data === 'string') {
return [
Utils.indent(indentation) + '"""',
indentLines(data, indentation + options.defaultIndentation),
Utils.indent(indentation) + '"""'
];
}
if (Array.isArray(data)) {
// If the array is empty, render the `emptyArrayMsg`
if (data.length === 0) {
return [Utils.indent(indentation) + options.emptyArrayMsg];
}
var outputArray = [];
data.forEach(function(element) {
// Prepend the dash at the begining of each array's element line
var line = '- ';
if (!options.noColor) {
line = colors[options.dashColor](line);
}
line = Utils.indent(indentation) + line;
// If the element of the array is a string, bool, number, or null
// render it in the same line
if (isSerializable(element, false, options)) {
line += renderToArray(element, options, 0)[0];
outputArray.push(line);
// If the element is an array or object, render it in next line
} else {
outputArray.push(line);
outputArray.push.apply(
outputArray,
renderToArray(
element, options, indentation + options.defaultIndentation
)
);
}
});
return outputArray;
}
if (data instanceof Error) {
return renderToArray(
{
message: data.message,
stack: data.stack.split('\n')
},
options,
indentation
);
}
// If values alignment is enabled, get the size of the longest index
// to align all the values
var maxIndexLength = options.noAlign ? 0 : Utils.getMaxIndexLength(data);
var key;
var output = [];
Object.getOwnPropertyNames(data).forEach(function(i) {
// Prepend the index at the beginning of the line
key = (i + ': ');
if (!options.noColor) {
key = colors[options.keysColor](key);
}
key = Utils.indent(indentation) + key;
// Skip `undefined`, it's not a valid JSON value.
if (data[i] === undefined) {
return;
}
// If the value is serializable, render it in the same line
if (isSerializable(data[i], false, options)) {
var nextIndentation = options.noAlign ? 0 : maxIndexLength - i.length;
key += renderToArray(data[i], options, nextIndentation)[0];
output.push(key);
// If the index is an array or object, render it in next line
} else {
output.push(key);
output.push.apply(
output,
renderToArray(
data[i],
options,
indentation + options.defaultIndentation
)
);
}
});
return output;
};
// ### Render function
// *Parameters:*
//
// * **`data`**: Data to render
// * **`options`**: Hash with different options to configure the parser
// * **`indentation`**: Base indentation of the parsed output
//
// *Example of options hash:*
//
// {
// emptyArrayMsg: '(empty)', // Rendered message on empty strings
// keysColor: 'blue', // Color for keys in hashes
// dashColor: 'red', // Color for the dashes in arrays
// stringColor: 'grey', // Color for strings
// defaultIndentation: 2 // Indentation on nested objects
// }
exports.render = function render(data, options, indentation) {
// Default values
indentation = indentation || 0;
options = options || {};
options.emptyArrayMsg = options.emptyArrayMsg || '(empty array)';
options.keysColor = options.keysColor || 'green';
options.dashColor = options.dashColor || 'green';
options.numberColor = options.numberColor || 'blue';
options.defaultIndentation = options.defaultIndentation || 2;
options.noColor = !!options.noColor;
options.noAlign = !!options.noAlign;
options.stringColor = options.stringColor || null;
return renderToArray(data, options, indentation).join('\n');
};
// ### Render from string function
// *Parameters:*
//
// * **`data`**: Data to render as a string
// * **`options`**: Hash with different options to configure the parser
// * **`indentation`**: Base indentation of the parsed output
//
// *Example of options hash:*
//
// {
// emptyArrayMsg: '(empty)', // Rendered message on empty strings
// keysColor: 'blue', // Color for keys in hashes
// dashColor: 'red', // Color for the dashes in arrays
// defaultIndentation: 2 // Indentation on nested objects
// }
exports.renderString = function renderString(data, options, indentation) {
var output = '';
var parsedData;
// If the input is not a string or if it's empty, just return an empty string
if (typeof data !== 'string' || data === '') {
return '';
}
// Remove non-JSON characters from the beginning string
if (data[0] !== '{' && data[0] !== '[') {
var beginingOfJson;
if (data.indexOf('{') === -1) {
beginingOfJson = data.indexOf('[');
} else if (data.indexOf('[') === -1) {
beginingOfJson = data.indexOf('{');
} else if (data.indexOf('{') < data.indexOf('[')) {
beginingOfJson = data.indexOf('{');
} else {
beginingOfJson = data.indexOf('[');
}
output += data.substr(0, beginingOfJson) + '\n';
data = data.substr(beginingOfJson);
}
try {
parsedData = JSON.parse(data);
} catch (e) {
// Return an error in case of an invalid JSON
return colors.red('Error:') + ' Not valid JSON!';
}
// Call the real render() method
output += exports.render(parsedData, options, indentation);
return output;
};

25
node_modules/prettyjson/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
'use strict';
/**
* Creates a string with the same length as `numSpaces` parameter
**/
exports.indent = function indent(numSpaces) {
return new Array(numSpaces+1).join(' ');
};
/**
* Gets the string length of the longer index in a hash
**/
exports.getMaxIndexLength = function(input) {
var maxWidth = 0;
Object.getOwnPropertyNames(input).forEach(function(key) {
// Skip undefined values.
if (input[key] === undefined) {
return;
}
maxWidth = Math.max(maxWidth, key.length);
});
return maxWidth;
};

28
node_modules/prettyjson/package.json generated vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"author": "Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",
"name": "prettyjson",
"description": "Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",
"version": "1.2.1",
"homepage": "http://rafeca.com/prettyjson",
"repository": {
"type": "git",
"url": "https://github.com/rafeca/prettyjson.git"
},
"main": "./lib/prettyjson",
"license": "MIT",
"bin": {
"prettyjson": "./bin/prettyjson"
},
"dependencies": {
"colors": "^1.1.2",
"minimist": "^1.2.0"
},
"devDependencies": {
"coveralls": "^2.11.15",
"istanbul": "^0.4.5",
"jshint": "^2.9.4",
"mocha": "^3.1.2",
"mocha-lcov-reporter": "^1.2.0",
"should": "^11.1.1"
}
}