added doga

This commit is contained in:
szabomarton
2025-02-25 09:55:29 +01:00
parent 5174ab4cc4
commit 13254e5623
1149 changed files with 80161 additions and 0 deletions

2
25_02_24/node_modules/eta/dist/browser.module.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
25_02_24/node_modules/eta/dist/browser.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
25_02_24/node_modules/eta/dist/browser.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

656
25_02_24/node_modules/eta/dist/eta.module.mjs generated vendored Normal file
View File

@@ -0,0 +1,656 @@
import * as path from 'node:path';
import * as fs from 'node:fs';
/**
* Handles storage and accessing of values
*
* In this case, we use it to store compiled template functions
* Indexed by their `name` or `filename`
*/
class Cacher {
constructor(cache) {
this.cache = void 0;
this.cache = cache;
}
define(key, val) {
this.cache[key] = val;
}
get(key) {
return this.cache[key];
}
remove(key) {
delete this.cache[key];
}
reset() {
this.cache = {};
}
load(cacheObj) {
this.cache = {
...this.cache,
...cacheObj
};
}
}
class EtaError extends Error {
constructor(message) {
super(message);
this.name = "Eta Error";
}
}
class EtaParseError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaParser Error";
}
}
class EtaRuntimeError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaRuntime Error";
}
}
class EtaFileResolutionError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaFileResolution Error";
}
}
class EtaNameResolutionError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaNameResolution Error";
}
}
/**
* Throws an EtaError with a nicely formatted error and message showing where in the template the error occurred.
*/
function ParseErr(message, str, indx) {
const whitespace = str.slice(0, indx).split(/\n/);
const lineNo = whitespace.length;
const colNo = whitespace[lineNo - 1].length + 1;
message += " at line " + lineNo + " col " + colNo + ":\n\n" + " " + str.split(/\n/)[lineNo - 1] + "\n" + " " + Array(colNo).join(" ") + "^";
throw new EtaParseError(message);
}
function RuntimeErr(originalError, str, lineNo, path) {
// code gratefully taken from https://github.com/mde/ejs and adapted
const lines = str.split("\n");
const start = Math.max(lineNo - 3, 0);
const end = Math.min(lines.length, lineNo + 3);
const filename = path;
// Error context
const context = lines.slice(start, end).map(function (line, i) {
const curr = i + start + 1;
return (curr == lineNo ? " >> " : " ") + curr + "| " + line;
}).join("\n");
const header = filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n";
const err = new EtaRuntimeError(header + context + "\n\n" + originalError.message);
err.name = originalError.name; // the original name (e.g. ReferenceError) may be useful
throw err;
}
/* END TYPES */
/* istanbul ignore next */
const AsyncFunction = async function () {}.constructor; // eslint-disable-line @typescript-eslint/no-empty-function
/**
* Takes a template string and returns a template function that can be called with (data, config)
*
* @param str - The template string
* @param config - A custom configuration object (optional)
*/
function compile(str, options) {
const config = this.config;
/* ASYNC HANDLING */
// code gratefully taken from https://github.com/mde/ejs and adapted
const ctor = options && options.async ? AsyncFunction : Function;
/* END ASYNC HANDLING */
try {
return new ctor(config.varName, "options", this.compileToString.call(this, str, options)); // eslint-disable-line no-new-func
} catch (e) {
if (e instanceof SyntaxError) {
throw new EtaParseError("Bad template syntax\n\n" + e.message + "\n" + Array(e.message.length + 1).join("=") + "\n" + this.compileToString.call(this, str, options) + "\n");
} else {
throw e;
}
}
}
/* TYPES */
/* END TYPES */
/**
* Compiles a template string to a function string. Most often users just use `compile()`, which calls `compileToString` and creates a new function using the result
*/
function compileToString(str, options) {
const config = this.config;
const isAsync = options && options.async;
const compileBody = this.compileBody;
const buffer = this.parse.call(this, str);
// note: when the include function passes through options, the only parameter that matters is the filepath parameter
let res = `${config.functionHeader}
let include = (template, data) => this.render(template, data, options);
let includeAsync = (template, data) => this.renderAsync(template, data, options);
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${config.debug ? ', line: 1, templateStr: "' + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + '"' : ""}};
function layout(path, data) {
__eta.layout = path;
__eta.layoutData = data;
}${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
${compileBody.call(this, buffer)}
if (__eta.layout) {
__eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData});
}
${config.useWith ? "}" : ""}${config.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
return __eta.res;
`;
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processFnString) {
res = plugin.processFnString(res, config);
}
}
}
return res;
}
/**
* Loops through the AST generated by `parse` and transform each item into JS calls
*
* **Example**
*
* ```js
* let templateAST = ['Hi ', { val: 'it.name', t: 'i' }]
* compileBody.call(Eta, templateAST)
* // => "__eta.res+='Hi '\n__eta.res+=__eta.e(it.name)\n"
* ```
*/
function compileBody(buff) {
const config = this.config;
let i = 0;
const buffLength = buff.length;
let returnStr = "";
for (i; i < buffLength; i++) {
const currentBlock = buff[i];
if (typeof currentBlock === "string") {
const str = currentBlock;
// we know string exists
returnStr += "__eta.res+='" + str + "'\n";
} else {
const type = currentBlock.t; // "r", "e", or "i"
let content = currentBlock.val || "";
if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
if (type === "r") {
// raw
if (config.autoFilter) {
content = "__eta.f(" + content + ")";
}
returnStr += "__eta.res+=" + content + "\n";
} else if (type === "i") {
// interpolate
if (config.autoFilter) {
content = "__eta.f(" + content + ")";
}
if (config.autoEscape) {
content = "__eta.e(" + content + ")";
}
returnStr += "__eta.res+=" + content + "\n";
} else if (type === "e") {
// execute
returnStr += content + "\n";
}
}
}
return returnStr;
}
/**
* Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`
*/
function trimWS(str, config, wsLeft, wsRight) {
let leftTrim;
let rightTrim;
if (Array.isArray(config.autoTrim)) {
// Slightly confusing,
// but _}} will trim the left side of the following string
leftTrim = config.autoTrim[1];
rightTrim = config.autoTrim[0];
} else {
leftTrim = rightTrim = config.autoTrim;
}
if (wsLeft || wsLeft === false) {
leftTrim = wsLeft;
}
if (wsRight || wsRight === false) {
rightTrim = wsRight;
}
if (!rightTrim && !leftTrim) {
return str;
}
if (leftTrim === "slurp" && rightTrim === "slurp") {
return str.trim();
}
if (leftTrim === "_" || leftTrim === "slurp") {
// full slurp
str = str.trimStart();
} else if (leftTrim === "-" || leftTrim === "nl") {
// nl trim
str = str.replace(/^(?:\r\n|\n|\r)/, "");
}
if (rightTrim === "_" || rightTrim === "slurp") {
// full slurp
str = str.trimEnd();
} else if (rightTrim === "-" || rightTrim === "nl") {
// nl trim
str = str.replace(/(?:\r\n|\n|\r)$/, "");
}
return str;
}
/**
* A map of special HTML characters to their XML-escaped equivalents
*/
const escMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;"
};
function replaceChar(s) {
return escMap[s];
}
/**
* XML-escapes an input value after converting it to a string
*
* @param str - Input value (usually a string)
* @returns XML-escaped string
*/
function XMLEscape(str) {
// To deal with XSS. Based on Escape implementations of Mustache.JS and Marko, then customized.
const newStr = String(str);
if (/[&<>"']/.test(newStr)) {
return newStr.replace(/[&<>"']/g, replaceChar);
} else {
return newStr;
}
}
/* END TYPES */
/** Eta's base (global) configuration */
const defaultConfig = {
autoEscape: true,
autoFilter: false,
autoTrim: [false, "nl"],
cache: false,
cacheFilepaths: true,
debug: false,
escapeFunction: XMLEscape,
// default filter function (not used unless enables) just stringifies the input
filterFunction: val => String(val),
functionHeader: "",
parse: {
exec: "",
interpolate: "=",
raw: "~"
},
plugins: [],
rmWhitespace: false,
tags: ["<%", "%>"],
useWith: false,
varName: "it",
defaultExtension: ".eta"
};
/* END TYPES */
const templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;
const singleQuoteReg = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;
const doubleQuoteReg = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
/** Escape special regular expression characters inside a string */
function escapeRegExp(string) {
// From MDN
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
}
function getLineNo(str, index) {
return str.slice(0, index).split("\n").length;
}
function parse(str) {
const config = this.config;
let buffer = [];
let trimLeftOfNextStr = false;
let lastIndex = 0;
const parseOptions = config.parse;
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processTemplate) {
str = plugin.processTemplate(str, config);
}
}
}
/* Adding for EJS compatibility */
if (config.rmWhitespace) {
// Code taken directly from EJS
// Have to use two separate replaces here as `^` and `$` operators don't
// work well with `\r` and empty lines don't work well with the `m` flag.
// Essentially, this replaces the whitespace at the beginning and end of
// each line and removes multiple newlines.
str = str.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
}
/* End rmWhitespace option */
templateLitReg.lastIndex = 0;
singleQuoteReg.lastIndex = 0;
doubleQuoteReg.lastIndex = 0;
function pushString(strng, shouldTrimRightOfString) {
if (strng) {
// if string is truthy it must be of type 'string'
strng = trimWS(strng, config, trimLeftOfNextStr,
// this will only be false on the first str, the next ones will be null or undefined
shouldTrimRightOfString);
if (strng) {
// replace \ with \\, ' with \'
// we're going to convert all CRLF to LF so it doesn't take more than one replace
strng = strng.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n");
buffer.push(strng);
}
}
}
const prefixes = [parseOptions.exec, parseOptions.interpolate, parseOptions.raw].reduce(function (accumulator, prefix) {
if (accumulator && prefix) {
return accumulator + "|" + escapeRegExp(prefix);
} else if (prefix) {
// accumulator is falsy
return escapeRegExp(prefix);
} else {
// prefix and accumulator are both falsy
return accumulator;
}
}, "");
const parseOpenReg = new RegExp(escapeRegExp(config.tags[0]) + "(-|_)?\\s*(" + prefixes + ")?\\s*", "g");
const parseCloseReg = new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + escapeRegExp(config.tags[1]) + ")", "g");
let m;
while (m = parseOpenReg.exec(str)) {
const precedingString = str.slice(lastIndex, m.index);
lastIndex = m[0].length + m.index;
const wsLeft = m[1];
const prefix = m[2] || ""; // by default either ~, =, or empty
pushString(precedingString, wsLeft);
parseCloseReg.lastIndex = lastIndex;
let closeTag;
let currentObj = false;
while (closeTag = parseCloseReg.exec(str)) {
if (closeTag[1]) {
const content = str.slice(lastIndex, closeTag.index);
parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;
trimLeftOfNextStr = closeTag[2];
const currentType = prefix === parseOptions.exec ? "e" : prefix === parseOptions.raw ? "r" : prefix === parseOptions.interpolate ? "i" : "";
currentObj = {
t: currentType,
val: content
};
break;
} else {
const char = closeTag[0];
if (char === "/*") {
const commentCloseInd = str.indexOf("*/", parseCloseReg.lastIndex);
if (commentCloseInd === -1) {
ParseErr("unclosed comment", str, closeTag.index);
}
parseCloseReg.lastIndex = commentCloseInd;
} else if (char === "'") {
singleQuoteReg.lastIndex = closeTag.index;
const singleQuoteMatch = singleQuoteReg.exec(str);
if (singleQuoteMatch) {
parseCloseReg.lastIndex = singleQuoteReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
} else if (char === '"') {
doubleQuoteReg.lastIndex = closeTag.index;
const doubleQuoteMatch = doubleQuoteReg.exec(str);
if (doubleQuoteMatch) {
parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
} else if (char === "`") {
templateLitReg.lastIndex = closeTag.index;
const templateLitMatch = templateLitReg.exec(str);
if (templateLitMatch) {
parseCloseReg.lastIndex = templateLitReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
}
}
}
if (currentObj) {
if (config.debug) {
currentObj.lineNo = getLineNo(str, m.index);
}
buffer.push(currentObj);
} else {
ParseErr("unclosed tag", str, m.index);
}
}
pushString(str.slice(lastIndex, str.length), false);
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processAST) {
buffer = plugin.processAST(buffer, config);
}
}
}
return buffer;
}
/* END TYPES */
function handleCache(template, options) {
const templateStore = options && options.async ? this.templatesAsync : this.templatesSync;
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
const templatePath = options.filepath;
const cachedTemplate = templateStore.get(templatePath);
if (this.config.cache && cachedTemplate) {
return cachedTemplate;
} else {
const templateString = this.readFile(templatePath);
const templateFn = this.compile(templateString, options);
if (this.config.cache) templateStore.define(templatePath, templateFn);
return templateFn;
}
} else {
const cachedTemplate = templateStore.get(template);
if (cachedTemplate) {
return cachedTemplate;
} else {
throw new EtaNameResolutionError("Failed to get template '" + template + "'");
}
}
}
function render(template,
// template name or template function
data, meta) {
let templateFn;
const options = {
...meta,
async: false
};
if (typeof template === "string") {
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
options.filepath = this.resolvePath(template, options);
}
templateFn = handleCache.call(this, template, options);
} else {
templateFn = template;
}
const res = templateFn.call(this, data, options);
return res;
}
function renderAsync(template,
// template name or template function
data, meta) {
let templateFn;
const options = {
...meta,
async: true
};
if (typeof template === "string") {
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
options.filepath = this.resolvePath(template, options);
}
templateFn = handleCache.call(this, template, options);
} else {
templateFn = template;
}
const res = templateFn.call(this, data, options);
// Return a promise
return Promise.resolve(res);
}
function renderString(template, data) {
const templateFn = this.compile(template, {
async: false
});
return render.call(this, templateFn, data);
}
function renderStringAsync(template, data) {
const templateFn = this.compile(template, {
async: true
});
return renderAsync.call(this, templateFn, data);
}
/* END TYPES */
class Eta$1 {
constructor(customConfig) {
this.config = void 0;
this.RuntimeErr = RuntimeErr;
this.compile = compile;
this.compileToString = compileToString;
this.compileBody = compileBody;
this.parse = parse;
this.render = render;
this.renderAsync = renderAsync;
this.renderString = renderString;
this.renderStringAsync = renderStringAsync;
this.filepathCache = {};
this.templatesSync = new Cacher({});
this.templatesAsync = new Cacher({});
// resolvePath takes a relative path from the "views" directory
this.resolvePath = null;
this.readFile = null;
if (customConfig) {
this.config = {
...defaultConfig,
...customConfig
};
} else {
this.config = {
...defaultConfig
};
}
}
// METHODS
configure(customConfig) {
this.config = {
...this.config,
...customConfig
};
}
withConfig(customConfig) {
return {
...this,
config: {
...this.config,
...customConfig
}
};
}
loadTemplate(name, template,
// template string or template function
options) {
if (typeof template === "string") {
const templates = options && options.async ? this.templatesAsync : this.templatesSync;
templates.define(name, this.compile(template, options));
} else {
let templates = this.templatesSync;
if (template.constructor.name === "AsyncFunction" || options && options.async) {
templates = this.templatesAsync;
}
templates.define(name, template);
}
}
}
/* END TYPES */
function readFile(path) {
let res = "";
try {
res = fs.readFileSync(path, "utf8");
// eslint-disable-line @typescript-eslint/no-explicit-any
} catch (err) {
if ((err == null ? void 0 : err.code) === "ENOENT") {
throw new EtaFileResolutionError(`Could not find template: ${path}`);
} else {
throw err;
}
}
return res;
}
function resolvePath(templatePath, options) {
let resolvedFilePath = "";
const views = this.config.views;
if (!views) {
throw new EtaFileResolutionError("Views directory is not defined");
}
const baseFilePath = options && options.filepath;
const defaultExtension = this.config.defaultExtension === undefined ? ".eta" : this.config.defaultExtension;
// how we index cached template paths
const cacheIndex = JSON.stringify({
filename: baseFilePath,
path: templatePath,
views: this.config.views
});
templatePath += path.extname(templatePath) ? "" : defaultExtension;
// if the file was included from another template
if (baseFilePath) {
// check the cache
if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) {
return this.filepathCache[cacheIndex];
}
const absolutePathTest = absolutePathRegExp.exec(templatePath);
if (absolutePathTest && absolutePathTest.length) {
const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
resolvedFilePath = path.join(views, formattedPath);
} else {
resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);
}
} else {
resolvedFilePath = path.join(views, templatePath);
}
if (dirIsChild(views, resolvedFilePath)) {
// add resolved path to the cache
if (baseFilePath && this.config.cacheFilepaths) {
this.filepathCache[cacheIndex] = resolvedFilePath;
}
return resolvedFilePath;
} else {
throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
}
}
function dirIsChild(parent, dir) {
const relative = path.relative(parent, dir);
return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
}
const absolutePathRegExp = /^\\|^\//;
class Eta extends Eta$1 {
constructor(...args) {
super(...args);
this.readFile = readFile;
this.resolvePath = resolvePath;
}
}
export { Eta, EtaError, EtaFileResolutionError, EtaNameResolutionError, EtaParseError, EtaRuntimeError };
//# sourceMappingURL=eta.module.mjs.map

1
25_02_24/node_modules/eta/dist/eta.module.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

686
25_02_24/node_modules/eta/dist/eta.umd.js generated vendored Normal file
View File

@@ -0,0 +1,686 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:path'), require('node:fs')) :
typeof define === 'function' && define.amd ? define(['exports', 'node:path', 'node:fs'], factory) :
(global = global || self, factory(global.eta = {}, global.path, global.fs));
})(this, (function (exports, path, fs) {
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return n;
}
var path__namespace = /*#__PURE__*/_interopNamespace(path);
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
/**
* Handles storage and accessing of values
*
* In this case, we use it to store compiled template functions
* Indexed by their `name` or `filename`
*/
class Cacher {
constructor(cache) {
this.cache = void 0;
this.cache = cache;
}
define(key, val) {
this.cache[key] = val;
}
get(key) {
return this.cache[key];
}
remove(key) {
delete this.cache[key];
}
reset() {
this.cache = {};
}
load(cacheObj) {
this.cache = {
...this.cache,
...cacheObj
};
}
}
class EtaError extends Error {
constructor(message) {
super(message);
this.name = "Eta Error";
}
}
class EtaParseError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaParser Error";
}
}
class EtaRuntimeError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaRuntime Error";
}
}
class EtaFileResolutionError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaFileResolution Error";
}
}
class EtaNameResolutionError extends EtaError {
constructor(message) {
super(message);
this.name = "EtaNameResolution Error";
}
}
/**
* Throws an EtaError with a nicely formatted error and message showing where in the template the error occurred.
*/
function ParseErr(message, str, indx) {
const whitespace = str.slice(0, indx).split(/\n/);
const lineNo = whitespace.length;
const colNo = whitespace[lineNo - 1].length + 1;
message += " at line " + lineNo + " col " + colNo + ":\n\n" + " " + str.split(/\n/)[lineNo - 1] + "\n" + " " + Array(colNo).join(" ") + "^";
throw new EtaParseError(message);
}
function RuntimeErr(originalError, str, lineNo, path) {
// code gratefully taken from https://github.com/mde/ejs and adapted
const lines = str.split("\n");
const start = Math.max(lineNo - 3, 0);
const end = Math.min(lines.length, lineNo + 3);
const filename = path;
// Error context
const context = lines.slice(start, end).map(function (line, i) {
const curr = i + start + 1;
return (curr == lineNo ? " >> " : " ") + curr + "| " + line;
}).join("\n");
const header = filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n";
const err = new EtaRuntimeError(header + context + "\n\n" + originalError.message);
err.name = originalError.name; // the original name (e.g. ReferenceError) may be useful
throw err;
}
/* END TYPES */
/* istanbul ignore next */
const AsyncFunction = async function () {}.constructor; // eslint-disable-line @typescript-eslint/no-empty-function
/**
* Takes a template string and returns a template function that can be called with (data, config)
*
* @param str - The template string
* @param config - A custom configuration object (optional)
*/
function compile(str, options) {
const config = this.config;
/* ASYNC HANDLING */
// code gratefully taken from https://github.com/mde/ejs and adapted
const ctor = options && options.async ? AsyncFunction : Function;
/* END ASYNC HANDLING */
try {
return new ctor(config.varName, "options", this.compileToString.call(this, str, options)); // eslint-disable-line no-new-func
} catch (e) {
if (e instanceof SyntaxError) {
throw new EtaParseError("Bad template syntax\n\n" + e.message + "\n" + Array(e.message.length + 1).join("=") + "\n" + this.compileToString.call(this, str, options) + "\n");
} else {
throw e;
}
}
}
/* TYPES */
/* END TYPES */
/**
* Compiles a template string to a function string. Most often users just use `compile()`, which calls `compileToString` and creates a new function using the result
*/
function compileToString(str, options) {
const config = this.config;
const isAsync = options && options.async;
const compileBody = this.compileBody;
const buffer = this.parse.call(this, str);
// note: when the include function passes through options, the only parameter that matters is the filepath parameter
let res = `${config.functionHeader}
let include = (template, data) => this.render(template, data, options);
let includeAsync = (template, data) => this.renderAsync(template, data, options);
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${config.debug ? ', line: 1, templateStr: "' + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + '"' : ""}};
function layout(path, data) {
__eta.layout = path;
__eta.layoutData = data;
}${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
${compileBody.call(this, buffer)}
if (__eta.layout) {
__eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData});
}
${config.useWith ? "}" : ""}${config.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
return __eta.res;
`;
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processFnString) {
res = plugin.processFnString(res, config);
}
}
}
return res;
}
/**
* Loops through the AST generated by `parse` and transform each item into JS calls
*
* **Example**
*
* ```js
* let templateAST = ['Hi ', { val: 'it.name', t: 'i' }]
* compileBody.call(Eta, templateAST)
* // => "__eta.res+='Hi '\n__eta.res+=__eta.e(it.name)\n"
* ```
*/
function compileBody(buff) {
const config = this.config;
let i = 0;
const buffLength = buff.length;
let returnStr = "";
for (i; i < buffLength; i++) {
const currentBlock = buff[i];
if (typeof currentBlock === "string") {
const str = currentBlock;
// we know string exists
returnStr += "__eta.res+='" + str + "'\n";
} else {
const type = currentBlock.t; // "r", "e", or "i"
let content = currentBlock.val || "";
if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
if (type === "r") {
// raw
if (config.autoFilter) {
content = "__eta.f(" + content + ")";
}
returnStr += "__eta.res+=" + content + "\n";
} else if (type === "i") {
// interpolate
if (config.autoFilter) {
content = "__eta.f(" + content + ")";
}
if (config.autoEscape) {
content = "__eta.e(" + content + ")";
}
returnStr += "__eta.res+=" + content + "\n";
} else if (type === "e") {
// execute
returnStr += content + "\n";
}
}
}
return returnStr;
}
/**
* Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`
*/
function trimWS(str, config, wsLeft, wsRight) {
let leftTrim;
let rightTrim;
if (Array.isArray(config.autoTrim)) {
// Slightly confusing,
// but _}} will trim the left side of the following string
leftTrim = config.autoTrim[1];
rightTrim = config.autoTrim[0];
} else {
leftTrim = rightTrim = config.autoTrim;
}
if (wsLeft || wsLeft === false) {
leftTrim = wsLeft;
}
if (wsRight || wsRight === false) {
rightTrim = wsRight;
}
if (!rightTrim && !leftTrim) {
return str;
}
if (leftTrim === "slurp" && rightTrim === "slurp") {
return str.trim();
}
if (leftTrim === "_" || leftTrim === "slurp") {
// full slurp
str = str.trimStart();
} else if (leftTrim === "-" || leftTrim === "nl") {
// nl trim
str = str.replace(/^(?:\r\n|\n|\r)/, "");
}
if (rightTrim === "_" || rightTrim === "slurp") {
// full slurp
str = str.trimEnd();
} else if (rightTrim === "-" || rightTrim === "nl") {
// nl trim
str = str.replace(/(?:\r\n|\n|\r)$/, "");
}
return str;
}
/**
* A map of special HTML characters to their XML-escaped equivalents
*/
const escMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;"
};
function replaceChar(s) {
return escMap[s];
}
/**
* XML-escapes an input value after converting it to a string
*
* @param str - Input value (usually a string)
* @returns XML-escaped string
*/
function XMLEscape(str) {
// To deal with XSS. Based on Escape implementations of Mustache.JS and Marko, then customized.
const newStr = String(str);
if (/[&<>"']/.test(newStr)) {
return newStr.replace(/[&<>"']/g, replaceChar);
} else {
return newStr;
}
}
/* END TYPES */
/** Eta's base (global) configuration */
const defaultConfig = {
autoEscape: true,
autoFilter: false,
autoTrim: [false, "nl"],
cache: false,
cacheFilepaths: true,
debug: false,
escapeFunction: XMLEscape,
// default filter function (not used unless enables) just stringifies the input
filterFunction: val => String(val),
functionHeader: "",
parse: {
exec: "",
interpolate: "=",
raw: "~"
},
plugins: [],
rmWhitespace: false,
tags: ["<%", "%>"],
useWith: false,
varName: "it",
defaultExtension: ".eta"
};
/* END TYPES */
const templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;
const singleQuoteReg = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;
const doubleQuoteReg = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
/** Escape special regular expression characters inside a string */
function escapeRegExp(string) {
// From MDN
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
}
function getLineNo(str, index) {
return str.slice(0, index).split("\n").length;
}
function parse(str) {
const config = this.config;
let buffer = [];
let trimLeftOfNextStr = false;
let lastIndex = 0;
const parseOptions = config.parse;
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processTemplate) {
str = plugin.processTemplate(str, config);
}
}
}
/* Adding for EJS compatibility */
if (config.rmWhitespace) {
// Code taken directly from EJS
// Have to use two separate replaces here as `^` and `$` operators don't
// work well with `\r` and empty lines don't work well with the `m` flag.
// Essentially, this replaces the whitespace at the beginning and end of
// each line and removes multiple newlines.
str = str.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
}
/* End rmWhitespace option */
templateLitReg.lastIndex = 0;
singleQuoteReg.lastIndex = 0;
doubleQuoteReg.lastIndex = 0;
function pushString(strng, shouldTrimRightOfString) {
if (strng) {
// if string is truthy it must be of type 'string'
strng = trimWS(strng, config, trimLeftOfNextStr,
// this will only be false on the first str, the next ones will be null or undefined
shouldTrimRightOfString);
if (strng) {
// replace \ with \\, ' with \'
// we're going to convert all CRLF to LF so it doesn't take more than one replace
strng = strng.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n");
buffer.push(strng);
}
}
}
const prefixes = [parseOptions.exec, parseOptions.interpolate, parseOptions.raw].reduce(function (accumulator, prefix) {
if (accumulator && prefix) {
return accumulator + "|" + escapeRegExp(prefix);
} else if (prefix) {
// accumulator is falsy
return escapeRegExp(prefix);
} else {
// prefix and accumulator are both falsy
return accumulator;
}
}, "");
const parseOpenReg = new RegExp(escapeRegExp(config.tags[0]) + "(-|_)?\\s*(" + prefixes + ")?\\s*", "g");
const parseCloseReg = new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + escapeRegExp(config.tags[1]) + ")", "g");
let m;
while (m = parseOpenReg.exec(str)) {
const precedingString = str.slice(lastIndex, m.index);
lastIndex = m[0].length + m.index;
const wsLeft = m[1];
const prefix = m[2] || ""; // by default either ~, =, or empty
pushString(precedingString, wsLeft);
parseCloseReg.lastIndex = lastIndex;
let closeTag;
let currentObj = false;
while (closeTag = parseCloseReg.exec(str)) {
if (closeTag[1]) {
const content = str.slice(lastIndex, closeTag.index);
parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;
trimLeftOfNextStr = closeTag[2];
const currentType = prefix === parseOptions.exec ? "e" : prefix === parseOptions.raw ? "r" : prefix === parseOptions.interpolate ? "i" : "";
currentObj = {
t: currentType,
val: content
};
break;
} else {
const char = closeTag[0];
if (char === "/*") {
const commentCloseInd = str.indexOf("*/", parseCloseReg.lastIndex);
if (commentCloseInd === -1) {
ParseErr("unclosed comment", str, closeTag.index);
}
parseCloseReg.lastIndex = commentCloseInd;
} else if (char === "'") {
singleQuoteReg.lastIndex = closeTag.index;
const singleQuoteMatch = singleQuoteReg.exec(str);
if (singleQuoteMatch) {
parseCloseReg.lastIndex = singleQuoteReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
} else if (char === '"') {
doubleQuoteReg.lastIndex = closeTag.index;
const doubleQuoteMatch = doubleQuoteReg.exec(str);
if (doubleQuoteMatch) {
parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
} else if (char === "`") {
templateLitReg.lastIndex = closeTag.index;
const templateLitMatch = templateLitReg.exec(str);
if (templateLitMatch) {
parseCloseReg.lastIndex = templateLitReg.lastIndex;
} else {
ParseErr("unclosed string", str, closeTag.index);
}
}
}
}
if (currentObj) {
if (config.debug) {
currentObj.lineNo = getLineNo(str, m.index);
}
buffer.push(currentObj);
} else {
ParseErr("unclosed tag", str, m.index);
}
}
pushString(str.slice(lastIndex, str.length), false);
if (config.plugins) {
for (let i = 0; i < config.plugins.length; i++) {
const plugin = config.plugins[i];
if (plugin.processAST) {
buffer = plugin.processAST(buffer, config);
}
}
}
return buffer;
}
/* END TYPES */
function handleCache(template, options) {
const templateStore = options && options.async ? this.templatesAsync : this.templatesSync;
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
const templatePath = options.filepath;
const cachedTemplate = templateStore.get(templatePath);
if (this.config.cache && cachedTemplate) {
return cachedTemplate;
} else {
const templateString = this.readFile(templatePath);
const templateFn = this.compile(templateString, options);
if (this.config.cache) templateStore.define(templatePath, templateFn);
return templateFn;
}
} else {
const cachedTemplate = templateStore.get(template);
if (cachedTemplate) {
return cachedTemplate;
} else {
throw new EtaNameResolutionError("Failed to get template '" + template + "'");
}
}
}
function render(template,
// template name or template function
data, meta) {
let templateFn;
const options = {
...meta,
async: false
};
if (typeof template === "string") {
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
options.filepath = this.resolvePath(template, options);
}
templateFn = handleCache.call(this, template, options);
} else {
templateFn = template;
}
const res = templateFn.call(this, data, options);
return res;
}
function renderAsync(template,
// template name or template function
data, meta) {
let templateFn;
const options = {
...meta,
async: true
};
if (typeof template === "string") {
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
options.filepath = this.resolvePath(template, options);
}
templateFn = handleCache.call(this, template, options);
} else {
templateFn = template;
}
const res = templateFn.call(this, data, options);
// Return a promise
return Promise.resolve(res);
}
function renderString(template, data) {
const templateFn = this.compile(template, {
async: false
});
return render.call(this, templateFn, data);
}
function renderStringAsync(template, data) {
const templateFn = this.compile(template, {
async: true
});
return renderAsync.call(this, templateFn, data);
}
/* END TYPES */
class Eta$1 {
constructor(customConfig) {
this.config = void 0;
this.RuntimeErr = RuntimeErr;
this.compile = compile;
this.compileToString = compileToString;
this.compileBody = compileBody;
this.parse = parse;
this.render = render;
this.renderAsync = renderAsync;
this.renderString = renderString;
this.renderStringAsync = renderStringAsync;
this.filepathCache = {};
this.templatesSync = new Cacher({});
this.templatesAsync = new Cacher({});
// resolvePath takes a relative path from the "views" directory
this.resolvePath = null;
this.readFile = null;
if (customConfig) {
this.config = {
...defaultConfig,
...customConfig
};
} else {
this.config = {
...defaultConfig
};
}
}
// METHODS
configure(customConfig) {
this.config = {
...this.config,
...customConfig
};
}
withConfig(customConfig) {
return {
...this,
config: {
...this.config,
...customConfig
}
};
}
loadTemplate(name, template,
// template string or template function
options) {
if (typeof template === "string") {
const templates = options && options.async ? this.templatesAsync : this.templatesSync;
templates.define(name, this.compile(template, options));
} else {
let templates = this.templatesSync;
if (template.constructor.name === "AsyncFunction" || options && options.async) {
templates = this.templatesAsync;
}
templates.define(name, template);
}
}
}
/* END TYPES */
function readFile(path) {
let res = "";
try {
res = fs__namespace.readFileSync(path, "utf8");
// eslint-disable-line @typescript-eslint/no-explicit-any
} catch (err) {
if ((err == null ? void 0 : err.code) === "ENOENT") {
throw new EtaFileResolutionError(`Could not find template: ${path}`);
} else {
throw err;
}
}
return res;
}
function resolvePath(templatePath, options) {
let resolvedFilePath = "";
const views = this.config.views;
if (!views) {
throw new EtaFileResolutionError("Views directory is not defined");
}
const baseFilePath = options && options.filepath;
const defaultExtension = this.config.defaultExtension === undefined ? ".eta" : this.config.defaultExtension;
// how we index cached template paths
const cacheIndex = JSON.stringify({
filename: baseFilePath,
path: templatePath,
views: this.config.views
});
templatePath += path__namespace.extname(templatePath) ? "" : defaultExtension;
// if the file was included from another template
if (baseFilePath) {
// check the cache
if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) {
return this.filepathCache[cacheIndex];
}
const absolutePathTest = absolutePathRegExp.exec(templatePath);
if (absolutePathTest && absolutePathTest.length) {
const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
resolvedFilePath = path__namespace.join(views, formattedPath);
} else {
resolvedFilePath = path__namespace.join(path__namespace.dirname(baseFilePath), templatePath);
}
} else {
resolvedFilePath = path__namespace.join(views, templatePath);
}
if (dirIsChild(views, resolvedFilePath)) {
// add resolved path to the cache
if (baseFilePath && this.config.cacheFilepaths) {
this.filepathCache[cacheIndex] = resolvedFilePath;
}
return resolvedFilePath;
} else {
throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
}
}
function dirIsChild(parent, dir) {
const relative = path__namespace.relative(parent, dir);
return relative && !relative.startsWith("..") && !path__namespace.isAbsolute(relative);
}
const absolutePathRegExp = /^\\|^\//;
class Eta extends Eta$1 {
constructor(...args) {
super(...args);
this.readFile = readFile;
this.resolvePath = resolvePath;
}
}
exports.Eta = Eta;
exports.EtaError = EtaError;
exports.EtaFileResolutionError = EtaFileResolutionError;
exports.EtaNameResolutionError = EtaNameResolutionError;
exports.EtaParseError = EtaParseError;
exports.EtaRuntimeError = EtaRuntimeError;
}));
//# sourceMappingURL=eta.umd.js.map

1
25_02_24/node_modules/eta/dist/eta.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

4
25_02_24/node_modules/eta/dist/types/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { Eta as EtaCore } from "./core.ts";
export declare class Eta extends EtaCore {
}
//# sourceMappingURL=browser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE3C,qBAAa,GAAI,SAAQ,OAAO;CAAG"}

View File

@@ -0,0 +1,20 @@
import type { Options } from "./config.ts";
import type { AstObject } from "./parse.ts";
import type { Eta } from "./core.ts";
/**
* Compiles a template string to a function string. Most often users just use `compile()`, which calls `compileToString` and creates a new function using the result
*/
export declare function compileToString(this: Eta, str: string, options?: Partial<Options>): string;
/**
* Loops through the AST generated by `parse` and transform each item into JS calls
*
* **Example**
*
* ```js
* let templateAST = ['Hi ', { val: 'it.name', t: 'i' }]
* compileBody.call(Eta, templateAST)
* // => "__eta.res+='Hi '\n__eta.res+=__eta.e(it.name)\n"
* ```
*/
export declare function compileBody(this: Eta, buff: Array<AstObject>): string;
//# sourceMappingURL=compile-string.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"compile-string.d.ts","sourceRoot":"","sources":["../../src/compile-string.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAIrC;;GAEG;AAEH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GACzB,MAAM,CAoDR;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,MAAM,CAgDrE"}

11
25_02_24/node_modules/eta/dist/types/compile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import type { Eta } from "./core.ts";
import type { Options } from "./config.ts";
export type TemplateFunction = (this: Eta, data?: object, options?: Partial<Options>) => string;
/**
* Takes a template string and returns a template function that can be called with (data, config)
*
* @param str - The template string
* @param config - A custom configuration object (optional)
*/
export declare function compile(this: Eta, str: string, options?: Partial<Options>): TemplateFunction;
//# sourceMappingURL=compile.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,GAAG,EACT,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KACvB,MAAM,CAAC;AAMZ;;;;;GAKG;AAEH,wBAAgB,OAAO,CACrB,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GACzB,gBAAgB,CA+BlB"}

58
25_02_24/node_modules/eta/dist/types/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,58 @@
type trimConfig = "nl" | "slurp" | false;
export interface Options {
/** Compile to async function */
async?: boolean;
/** Absolute path to template file */
filepath?: string;
}
export interface EtaConfig {
/** Whether or not to automatically XML-escape interpolations. Default true */
autoEscape: boolean;
/** Apply a filter function defined on the class to every interpolation or raw interpolation */
autoFilter: boolean;
/** Configure automatic whitespace trimming. Default `[false, 'nl']` */
autoTrim: trimConfig | [trimConfig, trimConfig];
/** Whether or not to cache templates if `name` or `filename` is passed */
cache: boolean;
/** Holds cache of resolved filepaths. Set to `false` to disable. */
cacheFilepaths: boolean;
/** Whether to pretty-format error messages (introduces runtime penalties) */
debug: boolean;
/** Function to XML-sanitize interpolations */
escapeFunction: (str: unknown) => string;
/** Function applied to all interpolations when autoFilter is true */
filterFunction: (val: unknown) => string;
/** Raw JS code inserted in the template function. Useful for declaring global variables for user templates */
functionHeader: string;
/** Parsing options */
parse: {
/** Which prefix to use for evaluation. Default `""`, does not support `"-"` or `"_"` */
exec: string;
/** Which prefix to use for interpolation. Default `"="`, does not support `"-"` or `"_"` */
interpolate: string;
/** Which prefix to use for raw interpolation. Default `"~"`, does not support `"-"` or `"_"` */
raw: string;
};
/** Array of plugins */
plugins: Array<{
processFnString?: Function;
processAST?: Function;
processTemplate?: Function;
}>;
/** Remove all safe-to-remove whitespace */
rmWhitespace: boolean;
/** Delimiters: by default `['<%', '%>']` */
tags: [string, string];
/** Make data available on the global object instead of varName */
useWith: boolean;
/** Name of the data object. Default `it` */
varName: string;
/** Directory that contains templates */
views?: string;
/** Control template file extension defaults. Default `.eta` */
defaultExtension?: string;
}
/** Eta's base (global) configuration */
declare const defaultConfig: EtaConfig;
export { defaultConfig };
//# sourceMappingURL=config.d.ts.map

1
25_02_24/node_modules/eta/dist/types/config.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,KAAK,CAAC;AAEzC,MAAM,WAAW,OAAO;IACtB,gCAAgC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAC;IAEpB,+FAA+F;IAC/F,UAAU,EAAE,OAAO,CAAC;IAEpB,uEAAuE;IACvE,QAAQ,EAAE,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEhD,0EAA0E;IAC1E,KAAK,EAAE,OAAO,CAAC;IAEf,oEAAoE;IACpE,cAAc,EAAE,OAAO,CAAC;IAExB,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAC;IAEf,8CAA8C;IAC9C,cAAc,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;IAEzC,qEAAqE;IACrE,cAAc,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;IAEzC,8GAA8G;IAC9G,cAAc,EAAE,MAAM,CAAC;IAEvB,sBAAsB;IACtB,KAAK,EAAE;QACL,wFAAwF;QACxF,IAAI,EAAE,MAAM,CAAC;QAEb,4FAA4F;QAC5F,WAAW,EAAE,MAAM,CAAC;QAEpB,gGAAgG;QAChG,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IAEF,uBAAuB;IACvB,OAAO,EAAE,KAAK,CACZ;QACE,eAAe,CAAC,EAAE,QAAQ,CAAC;QAC3B,UAAU,CAAC,EAAE,QAAQ,CAAC;QACtB,eAAe,CAAC,EAAE,QAAQ,CAAC;KAC5B,CACF,CAAC;IAEF,2CAA2C;IAC3C,YAAY,EAAE,OAAO,CAAC;IAEtB,4CAA4C;IAC5C,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvB,kEAAkE;IAClE,OAAO,EAAE,OAAO,CAAC;IAEjB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAEhB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,wCAAwC;AACxC,QAAA,MAAM,aAAa,EAAE,SAsBpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}

36
25_02_24/node_modules/eta/dist/types/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import { Cacher } from "./storage.ts";
import { compile } from "./compile.ts";
import { compileBody, compileToString } from "./compile-string.ts";
import { parse } from "./parse.ts";
import { render, renderAsync, renderString, renderStringAsync } from "./render.ts";
import { EtaError, RuntimeErr } from "./err.ts";
import { TemplateFunction } from "./compile.ts";
import type { EtaConfig, Options } from "./config.ts";
export declare class Eta {
constructor(customConfig?: Partial<EtaConfig>);
config: EtaConfig;
RuntimeErr: typeof RuntimeErr;
compile: typeof compile;
compileToString: typeof compileToString;
compileBody: typeof compileBody;
parse: typeof parse;
render: typeof render;
renderAsync: typeof renderAsync;
renderString: typeof renderString;
renderStringAsync: typeof renderStringAsync;
filepathCache: Record<string, string>;
templatesSync: Cacher<TemplateFunction>;
templatesAsync: Cacher<TemplateFunction>;
resolvePath: null | ((this: Eta, template: string, options?: Partial<Options>) => string);
readFile: null | ((this: Eta, path: string) => string);
configure(customConfig: Partial<EtaConfig>): void;
withConfig(customConfig: Partial<EtaConfig>): this & {
config: EtaConfig;
};
loadTemplate(name: string, template: string | TemplateFunction, // template string or template function
options?: {
async: boolean;
}): void;
}
export { EtaError };
//# sourceMappingURL=core.d.ts.map

1
25_02_24/node_modules/eta/dist/types/core.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,MAAM,EACN,WAAW,EACX,YAAY,EACZ,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtD,qBAAa,GAAG;gBACF,YAAY,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;IAQ7C,MAAM,EAAE,SAAS,CAAC;IAElB,UAAU,oBAAc;IAExB,OAAO,iBAAW;IAClB,eAAe,yBAAmB;IAClC,WAAW,qBAAe;IAC1B,KAAK,eAAS;IACd,MAAM,gBAAU;IAChB,WAAW,qBAAe;IAC1B,YAAY,sBAAgB;IAC5B,iBAAiB,2BAAqB;IAEtC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC3C,aAAa,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAoC;IAC3E,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAoC;IAG5E,WAAW,EACP,IAAI,GACJ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,CAChE;IACT,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,CAAQ;IAI9D,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC;IAI1C,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG;QAAE,MAAM,EAAE,SAAS,CAAA;KAAE;IAI1E,YAAY,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,uCAAuC;IAC5E,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAC3B,IAAI;CAoBR;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAC"}

21
25_02_24/node_modules/eta/dist/types/err.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export declare class EtaError extends Error {
constructor(message: string);
}
export declare class EtaParseError extends EtaError {
constructor(message: string);
}
export declare class EtaRuntimeError extends EtaError {
constructor(message: string);
}
export declare class EtaFileResolutionError extends EtaError {
constructor(message: string);
}
export declare class EtaNameResolutionError extends EtaError {
constructor(message: string);
}
/**
* Throws an EtaError with a nicely formatted error and message showing where in the template the error occurred.
*/
export declare function ParseErr(message: string, str: string, indx: number): never;
export declare function RuntimeErr(originalError: Error, str: string, lineNo: number, path: string): never;
//# sourceMappingURL=err.d.ts.map

1
25_02_24/node_modules/eta/dist/types/err.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"err.d.ts","sourceRoot":"","sources":["../../src/err.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,sBAAuB,SAAQ,QAAQ;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,sBAAuB,SAAQ,QAAQ;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AAEH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAiB1E;AAED,wBAAgB,UAAU,CACxB,aAAa,EAAE,KAAK,EACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,KAAK,CA2BP"}

View File

@@ -0,0 +1,5 @@
import type { Eta as EtaCore } from "./core.ts";
import type { Options } from "./config.ts";
export declare function readFile(this: EtaCore, path: string): string;
export declare function resolvePath(this: EtaCore, templatePath: string, options?: Partial<Options>): string;
//# sourceMappingURL=file-handling.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"file-handling.d.ts","sourceRoot":"","sources":["../../src/file-handling.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAe5D;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GACzB,MAAM,CAuDR"}

9
25_02_24/node_modules/eta/dist/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { Eta as EtaCore } from "./core.ts";
import { readFile, resolvePath } from "./file-handling.ts";
export { EtaError, EtaFileResolutionError, EtaNameResolutionError, EtaParseError, EtaRuntimeError, } from "./err.ts";
export { type EtaConfig, type Options } from "./config.ts";
export declare class Eta extends EtaCore {
readFile: typeof readFile;
resolvePath: typeof resolvePath;
}
//# sourceMappingURL=index.d.ts.map

1
25_02_24/node_modules/eta/dist/types/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3D,qBAAa,GAAI,SAAQ,OAAO;IAC9B,QAAQ,kBAAY;IAEpB,WAAW,qBAAe;CAC3B"}

10
25_02_24/node_modules/eta/dist/types/parse.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { Eta } from "./core.ts";
export type TagType = "r" | "e" | "i" | "";
export interface TemplateObject {
t: TagType;
val: string;
lineNo?: number;
}
export type AstObject = string | TemplateObject;
export declare function parse(this: Eta, str: string): Array<AstObject>;
//# sourceMappingURL=parse.d.ts.map

1
25_02_24/node_modules/eta/dist/types/parse.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,MAAM,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,OAAO,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,cAAc,CAAC;AAsBhD,wBAAgB,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAiL9D"}

13
25_02_24/node_modules/eta/dist/types/render.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { TemplateFunction } from "./compile.ts";
import type { Eta } from "./core.ts";
export declare function render<T extends object>(this: Eta, template: string | TemplateFunction, // template name or template function
data: T, meta?: {
filepath: string;
}): string;
export declare function renderAsync<T extends object>(this: Eta, template: string | TemplateFunction, // template name or template function
data: T, meta?: {
filepath: string;
}): Promise<string>;
export declare function renderString<T extends object>(this: Eta, template: string, data: T): string;
export declare function renderStringAsync<T extends object>(this: Eta, template: string, data: T): Promise<string>;
//# sourceMappingURL=render.d.ts.map

1
25_02_24/node_modules/eta/dist/types/render.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAyCrC,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EACrC,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,qCAAqC;AAC1E,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1B,MAAM,CAiBR;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,qCAAqC;AAC1E,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1B,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,GACN,MAAM,CAIR;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,GACN,OAAO,CAAC,MAAM,CAAC,CAIjB"}

16
25_02_24/node_modules/eta/dist/types/storage.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* Handles storage and accessing of values
*
* In this case, we use it to store compiled template functions
* Indexed by their `name` or `filename`
*/
export declare class Cacher<T> {
private cache;
constructor(cache: Record<string, T>);
define(key: string, val: T): void;
get(key: string): T;
remove(key: string): void;
reset(): void;
load(cacheObj: Record<string, T>): void;
}
//# sourceMappingURL=storage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,MAAM,CAAC,CAAC;IACP,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI;IAGjC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC;IAGnB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAGzB,KAAK,IAAI,IAAI;IAGb,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI;CAGxC"}

13
25_02_24/node_modules/eta/dist/types/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { EtaConfig } from "./config.ts";
/**
* Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`
*/
export declare function trimWS(str: string, config: EtaConfig, wsLeft: string | false, wsRight?: string | false): string;
/**
* XML-escapes an input value after converting it to a string
*
* @param str - Input value (usually a string)
* @returns XML-escaped string
*/
export declare function XMLEscape(str: unknown): string;
//# sourceMappingURL=utils.d.ts.map

1
25_02_24/node_modules/eta/dist/types/utils.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AAEH,wBAAgB,MAAM,CACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,GAAG,KAAK,EACtB,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GACvB,MAAM,CA8CR;AAkBD;;;;;GAKG;AAEH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQ9C"}