NUEVA BUSQUEDA DE DATOS SRI

This commit is contained in:
2023-04-11 10:50:28 -05:00
parent d9d7eb83cb
commit 6b4b3e263c
612 changed files with 11604 additions and 36692 deletions

82
node_modules/ejs/lib/ejs.js generated vendored
View File

@@ -44,6 +44,7 @@
* @public
*/
var fs = require('fs');
var path = require('path');
var utils = require('./utils');
@@ -64,6 +65,7 @@ var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compi
// so we make an exception for `renderFile`
var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache');
var _BOM = /^\uFEFF/;
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
/**
* EJS template function cache. This can be a LRU object from lru-cache NPM
@@ -127,6 +129,23 @@ exports.resolveInclude = function(name, filename, isDir) {
return includePath;
};
/**
* Try to resolve file path on multiple directories
*
* @param {String} name specified path
* @param {Array<String>} paths list of possible parent directory paths
* @return {String}
*/
function resolvePaths(name, paths) {
var filePath;
if (paths.some(function (v) {
filePath = exports.resolveInclude(name, v, true);
return fs.existsSync(filePath);
})) {
return filePath;
}
}
/**
* Get the path to the included file by Options
*
@@ -142,7 +161,12 @@ function getIncludePath(path, options) {
// Abs path
if (match && match.length) {
includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
path = path.replace(/^\/*/, '');
if (Array.isArray(options.root)) {
includePath = resolvePaths(path, options.root);
} else {
includePath = exports.resolveInclude(path, options.root || '/', true);
}
}
// Relative paths
else {
@@ -154,15 +178,10 @@ function getIncludePath(path, options) {
}
}
// Then look in any views directories
if (!includePath) {
if (Array.isArray(views) && views.some(function (v) {
filePath = exports.resolveInclude(path, v, true);
return fs.existsSync(filePath);
})) {
includePath = filePath;
}
if (!includePath && Array.isArray(views)) {
includePath = resolvePaths(path, views);
}
if (!includePath) {
if (!includePath && typeof options.includer !== 'function') {
throw new Error('Could not find the include file "' +
options.escapeFunction(path) + '"');
}
@@ -288,8 +307,19 @@ function fileLoader(filePath){
*/
function includeFile(path, options) {
var opts = utils.shallowCopy({}, options);
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
opts.filename = getIncludePath(path, opts);
if (typeof options.includer === 'function') {
var includerResult = options.includer(path, opts.filename);
if (includerResult) {
if (includerResult.filename) {
opts.filename = includerResult.filename;
}
if (includerResult.template) {
return handleCache(opts, includerResult.template);
}
}
}
return handleCache(opts);
}
@@ -383,8 +413,8 @@ exports.compile = function compile(template, opts) {
*/
exports.render = function (template, d, o) {
var data = d || {};
var opts = o || {};
var data = d || utils.createNullProtoObjWherePossible();
var opts = o || utils.createNullProtoObjWherePossible();
// No options object -- if there are optiony names
// in the data, copy them to options
@@ -455,7 +485,7 @@ exports.renderFile = function () {
opts.filename = filename;
}
else {
data = {};
data = utils.createNullProtoObjWherePossible();
}
return tryHandleCache(opts, data, cb);
@@ -477,8 +507,8 @@ exports.clearCache = function () {
};
function Template(text, opts) {
opts = opts || {};
var options = {};
opts = opts || utils.createNullProtoObjWherePossible();
var options = utils.createNullProtoObjWherePossible();
this.templateText = text;
/** @type {string | null} */
this.mode = null;
@@ -498,6 +528,7 @@ function Template(text, opts) {
options.cache = opts.cache || false;
options.rmWhitespace = opts.rmWhitespace;
options.root = opts.root;
options.includer = opts.includer;
options.outputFunctionName = opts.outputFunctionName;
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
options.views = opts.views;
@@ -549,6 +580,8 @@ Template.prototype = {
var escapeFn = opts.escapeFunction;
/** @type {FunctionConstructor} */
var ctor;
/** @type {string} */
var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : 'undefined';
if (!this.source) {
this.generateSource();
@@ -556,12 +589,21 @@ Template.prototype = {
' var __output = "";\n' +
' function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
if (opts.outputFunctionName) {
if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) {
throw new Error('outputFunctionName is not a valid JS identifier.');
}
prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n';
}
if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) {
throw new Error('localsName is not a valid JS identifier.');
}
if (opts.destructuredLocals && opts.destructuredLocals.length) {
var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n';
for (var i = 0; i < opts.destructuredLocals.length; i++) {
var name = opts.destructuredLocals[i];
if (!_JS_IDENTIFIER.test(name)) {
throw new Error('destructuredLocals[' + i + '] is not a valid JS identifier.');
}
if (i > 0) {
destructuring += ',\n ';
}
@@ -580,8 +622,7 @@ Template.prototype = {
if (opts.compileDebug) {
src = 'var __line = 1' + '\n'
+ ' , __lines = ' + JSON.stringify(this.templateText) + '\n'
+ ' , __filename = ' + (opts.filename ?
JSON.stringify(opts.filename) : 'undefined') + ';' + '\n'
+ ' , __filename = ' + sanitizedFilename + ';' + '\n'
+ 'try {' + '\n'
+ this.source
+ '} catch (e) {' + '\n'
@@ -607,7 +648,7 @@ Template.prototype = {
}
if (opts.compileDebug && opts.filename) {
src = src + '\n'
+ '//# sourceURL=' + opts.filename + '\n';
+ '//# sourceURL=' + sanitizedFilename + '\n';
}
try {
@@ -653,13 +694,14 @@ Template.prototype = {
// Adds a local `include` function which allows full recursive include
var returnedFn = opts.client ? fn : function anonymous(data) {
var include = function (path, includeData) {
var d = utils.shallowCopy({}, data);
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
if (includeData) {
d = utils.shallowCopy(d, includeData);
}
return includeFile(path, opts)(d);
};
return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]);
return fn.apply(opts.context,
[data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]);
};
if (opts.filename && typeof Object.defineProperty === 'function') {
var filename = opts.filename;

90
node_modules/ejs/lib/utils.js generated vendored
View File

@@ -25,6 +25,8 @@
'use strict';
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); };
/**
* Escape characters reserved in regular expressions.
@@ -97,9 +99,25 @@ exports.escapeXML = function (markup) {
: String(markup)
.replace(_MATCH_HTML, encode_char);
};
exports.escapeXML.toString = function () {
function escapeXMLToString() {
return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr;
};
}
try {
if (typeof Object.defineProperty === 'function') {
// If the Function prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
// cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
// mode, attempting that will be silently ignored.
// However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
Object.defineProperty(exports.escapeXML, 'toString', { value: escapeXMLToString });
} else {
// If Object.defineProperty() doesn't exist, attempt to shadow this property using the assignment operator.
exports.escapeXML.toString = escapeXMLToString;
}
} catch (err) {
console.warn('Unable to set escapeXML.toString (is the Function prototype frozen?)');
}
/**
* Naive copy of properties from one object to another.
@@ -114,8 +132,16 @@ exports.escapeXML.toString = function () {
*/
exports.shallowCopy = function (to, from) {
from = from || {};
for (var p in from) {
to[p] = from[p];
if ((to !== null) && (to !== undefined)) {
for (var p in from) {
if (!hasOwn(from, p)) {
continue;
}
if (p === '__proto__' || p === 'constructor') {
continue;
}
to[p] = from[p];
}
}
return to;
};
@@ -133,10 +159,20 @@ exports.shallowCopy = function (to, from) {
* @private
*/
exports.shallowCopyFromList = function (to, from, list) {
for (var i = 0; i < list.length; i++) {
var p = list[i];
if (typeof from[p] != 'undefined') {
to[p] = from[p];
list = list || [];
from = from || {};
if ((to !== null) && (to !== undefined)) {
for (var i = 0; i < list.length; i++) {
var p = list[i];
if (typeof from[p] != 'undefined') {
if (!hasOwn(from, p)) {
continue;
}
if (p === '__proto__' || p === 'constructor') {
continue;
}
to[p] = from[p];
}
}
}
return to;
@@ -165,3 +201,41 @@ exports.cache = {
this._data = {};
}
};
/**
* Transforms hyphen case variable into camel case.
*
* @param {String} string Hyphen case string
* @return {String} Camel case string
* @static
* @private
*/
exports.hyphenToCamel = function (str) {
return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); });
};
/**
* Returns a null-prototype object in runtimes that support it
*
* @return {Object} Object, prototype will be set to null where possible
* @static
* @private
*/
exports.createNullProtoObjWherePossible = (function () {
if (typeof Object.create == 'function') {
return function () {
return Object.create(null);
};
}
if (!({__proto__: null} instanceof Object)) {
return function () {
return {__proto__: null};
};
}
// Not possible, just pass through
return function () {
return {};
};
})();