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

7
25_02_24/node_modules/eta/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2023 Ben Gubler <nebrelbug@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.

211
25_02_24/node_modules/eta/README.md generated vendored Normal file
View File

@@ -0,0 +1,211 @@
<p align="center">
<img align="center" width="50%" src="https://github.com/eta-dev/eta/assets/25597854/041dbe34-883b-459b-8607-c787815c441a">
</p>
<h1 align="center" style="text-align: center; width: fit-content; margin-left: auto; margin-right: auto;">eta (η)</h1>
<p align="center">
<a href="https://eta.js.org">Documentation</a> -
<a href="https://discord.gg/27gGncJYE2">Chat</a> -
<a href="https://runkit.com/nebrelbug/eta-v3">RunKit Demo</a> -
<a href="https://eta.js.org/playground">Playground</a>
</p>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[logo]: https://img.shields.io/badge/all_contributors-10-orange.svg "Number of contributors on All-Contributors"
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<span align="center">
[![GitHub package.json version (main)](https://img.shields.io/github/package-json/v/eta-dev/eta/main?label=current%20version)](https://www.npmjs.com/package/eta)
[![GitHub Actions Status](https://github.com/eta-dev/eta/actions/workflows/test.yml/badge.svg)](https://github.com/eta-dev/eta/actions)
[![All Contributors][logo]](#contributors-)
[![Coveralls](https://img.shields.io/coveralls/eta-dev/eta.svg?branch=main)](https://coveralls.io/github/eta-dev/eta?branch=main)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://paypal.me/bengubler)
</span>
<span align="center">
**You're viewing the source for Eta v3, which we just released! For v2, visit [the old branch](https://github.com/eta-dev/eta/tree/v2).**
</span>
## Summary
Eta is a lightweight and blazing fast embedded JS templating engine that works inside Node, Deno, and the browser. It's written in TypeScript and emphasizes great performance, configurability, and small bundle size.
### 🌟 Features
- 📦 0 dependencies
- 💡 Only ~3.5 KB minzipped
- ⚡️ Written in TypeScript
- ✨ Deno support (+ Node and browser)
- 🚀 Super Fast
- 🔧 Configurable
- Plugins, custom delimiters, caching
- 🔨 Powerful
- Precompilation, partials, async
- **Layout support**!
- 🔥 Reliable
- Better quotes/comments support
- _ex._ `<%= someval + "string %>" %>` compiles correctly, while it fails with doT or EJS
- Great error reporting
- ⚡️ Exports ES Modules as well as UMD
- 📝 Easy template syntax
## Get Started
_For more thorough documentation, visit [https://eta.js.org](https://eta.js.org)_
Install Eta
```bash
npm install eta
```
In the root of your project, create `templates/simple.eta`
```eta
Hi <%= it.name %>!
```
Then, in your JS file:
```js
import { Eta } from "eta";
// import { Eta } from "https://deno.land/x/eta@v3.1.0/src/index.ts";
const eta = new Eta({ views: path.join(__dirname, "templates") });
// Render a template
const res = eta.render("./simple", { name: "Ben" });
console.log(res); // Hi Ben!
```
## FAQs
<details>
<summary>
<b>Where did Eta's name come from?</b>
</summary>
"Eta" means tiny in Esperanto. Plus, it can be used as an acronym for all sorts of cool phrases: "ECMAScript Template Awesomeness", "Embedded Templating Alternative", etc....
Additionally, Eta is a letter of the Greek alphabet (it stands for all sorts of cool things in various mathematical fields, including efficiency) and is three letters long (perfect for a file extension).
</details>
<br />
## Integrations
<details>
<summary>
<b>Visual Studio Code</b>
</summary>
[@shadowtime2000](https://github.com/shadowtime2000) created [eta-vscode](https://marketplace.visualstudio.com/items?itemName=shadowtime2000.eta-vscode).
</details>
<details>
<summary>
<b>ESLint</b>
</summary>
[eslint-plugin-eta](https://github.com/eta-dev/eslint-plugin-eta) was created to provide an ESLint processor so you can lint your Eta templates.
</details>
<details>
<summary>
<b>Webpack</b>
</summary>
Currently there is no official Webpack integration but [@clshortfuse](https://github.com/clshortfuse) shared the loader he uses:
```javascript
{
loader: 'html-loader',
options: {
preprocessor(content, loaderContext) {
return eta.render(content, {}, { filename: loaderContext.resourcePath });
},
},
}
```
</details>
<details>
<summary>
<b>Node-RED</b>
</summary>
To operate with Eta templates in Node-RED: [@ralphwetzel/node-red-contrib-eta](https://flows.nodered.org/node/@ralphwetzel/node-red-contrib-eta)
<img width="150" alt="image" src="https://user-images.githubusercontent.com/16342003/160198427-2a69ff10-e8bf-4873-9d99-2929a584ccc8.png">
</details>
<details>
<summary>
<b>Koa</b>
</summary>
To render Eta templates in [Koa](https://koajs.com) web framework: [@cedx/koa-eta](https://github.com/cedx/koa-eta/wiki)
</details>
<br />
## Projects using `eta`
- [Docusaurus v2](https://v2.docusaurus.io): open-source documentation framework that uses Eta to generate a SSR build
- [swagger-typescript-api](https://github.com/acacode/swagger-typescript-api): Open source typescript api codegenerator from Swagger. Uses Eta as codegenerator by templates
- [html-bundler-webpack-plugin](https://github.com/webdiscus/html-bundler-webpack-plugin): Webpack plugin make easily to bundle HTML pages from templates, source styles and scripts
- [SmartDeno](https://github.com/guildenstern70/SmartDeno): SmartDeno is an easy to setup web template using Deno & Oak
- [stc](https://github.com/long-woo/stc): OpenAPI (Swagger) and Apifox documentation converted to api. Use eta templates to generate code.
- [Add yours!](https://github.com/eta-dev/eta/edit/master/README.md)
## Contributors
Made with ❤ by [@nebrelbug](https://github.com/eta-dev) and all these wonderful contributors ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://www.bengubler.com"><img src="https://avatars3.githubusercontent.com/u/25597854?v=4?s=100" width="100px;" alt="Ben Gubler"/><br /><sub><b>Ben Gubler</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=nebrelbug" title="Code">💻</a> <a href="#question-nebrelbug" title="Answering Questions">💬</a> <a href="https://github.com/eta-dev/eta/commits?author=nebrelbug" title="Documentation">📖</a> <a href="https://github.com/eta-dev/eta/commits?author=nebrelbug" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/clitetailor"><img src="https://avatars1.githubusercontent.com/u/16368559?v=4?s=100" width="100px;" alt="Clite Tailor"/><br /><sub><b>Clite Tailor</b></sub></a><br /><a href="#ideas-clitetailor" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/eta-dev/eta/commits?author=clitetailor" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/ioan_chiriac"><img src="https://avatars2.githubusercontent.com/u/173203?v=4?s=100" width="100px;" alt="Ioan CHIRIAC"/><br /><sub><b>Ioan CHIRIAC</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=ichiriac" title="Code">💻</a> <a href="#ideas-ichiriac" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/craig-morten/"><img src="https://avatars1.githubusercontent.com/u/46491566?v=4?s=100" width="100px;" alt="Craig Morten"/><br /><sub><b>Craig Morten</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=asos-craigmorten" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/trojanh"><img src="https://avatars0.githubusercontent.com/u/22974490?v=4?s=100" width="100px;" alt="Rajan Tiwari"/><br /><sub><b>Rajan Tiwari</b></sub></a><br /><a href="#example-trojanh" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://shadowtime2000.github.io"><img src="https://avatars1.githubusercontent.com/u/66655515?v=4?s=100" width="100px;" alt="shadowtime2000"/><br /><sub><b>shadowtime2000</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=shadowtime2000" title="Code">💻</a> <a href="#ideas-shadowtime2000" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/eta-dev/eta/commits?author=shadowtime2000" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://hamidihamza.com"><img src="https://avatars0.githubusercontent.com/u/22576950?v=4?s=100" width="100px;" alt="Hamza Hamidi"/><br /><sub><b>Hamza Hamidi</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=hamzahamidi" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://calumk.com"><img src="https://avatars1.githubusercontent.com/u/1183991?v=4?s=100" width="100px;" alt="Calum Knott"/><br /><sub><b>Calum Knott</b></sub></a><br /><a href="#ideas-calumk" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nhaef"><img src="https://avatars.githubusercontent.com/u/16443053?v=4?s=100" width="100px;" alt="nhaef"/><br /><sub><b>nhaef</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=nhaef" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://heyhey.to/Gün"><img src="https://avatars.githubusercontent.com/u/74139498?v=4?s=100" width="100px;" alt="Gün"/><br /><sub><b>Gün</b></sub></a><br /><a href="https://github.com/eta-dev/eta/commits?author=gurgunday" title="Code">💻</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!
## Credits
- Async support, file handling, and error formatting were based on code from [EJS](https://github.com/mde/ejs), which is licensed under the Apache-2.0 license. Code was modified and refactored to some extent.
- Syntax and some parts of compilation are heavily based off EJS, Nunjucks, and doT.

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"}

146
25_02_24/node_modules/eta/package.json generated vendored Normal file
View File

@@ -0,0 +1,146 @@
{
"name": "eta",
"version": "3.5.0",
"description": "Lightweight, fast, and powerful embedded JS template engine",
"keywords": [
"handlebars",
"ejs",
"eta",
"template engine",
"embedded template engine",
"layouts",
"partials",
"typescript types"
],
"homepage": "https://eta.js.org",
"type": "commonjs",
"main": "./dist/eta.umd.js",
"umd:main": "./dist/eta.umd.js",
"unpkg": "./dist/browser.umd.js",
"module": "./dist/eta.module.mjs",
"types": "./dist/types/index.d.ts",
"source": "src/index.ts",
"exports": {
"types": "./dist/types/index.d.ts",
"browser": "./dist/browser.umd.js",
"import": "./dist/eta.module.mjs",
"require": "./dist/eta.umd.js",
"default": "./dist/eta.umd.js"
},
"sideEffects": false,
"files": [
"dist"
],
"author": "Ben Gubler <nebrelbug@gmail.com>",
"funding": "https://github.com/eta-dev/eta?sponsor=1",
"repository": {
"type": "git",
"url": "git+https://github.com/eta-dev/eta.git"
},
"bugs": {
"url": "https://github.com/eta-dev/eta/issues"
},
"license": "MIT",
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"build:node": "microbundle src/index.ts --target node --format esm && microbundle src/index.ts --target node --format umd",
"build:browser": "microbundle src/browser.ts --target web --format umd,modern --output dist/browser.js",
"build": "npm run build:node && npm run build:browser",
"commit": "git-cz",
"format": "prettier --write '{src,test}/**/**.ts'",
"lint": "eslint src/*.ts test/*.spec.ts --ext .js,.ts",
"prebuild": "rimraf dist",
"release": "npm run build && np && npx jsr publish",
"postversion": "node ./jsr.release.js",
"size": "size-limit",
"start": "microbundle watch",
"test": "jest --coverage && npm run size",
"test:prod": "npm run lint && npm run test -- --no-cache",
"test:watch": "jest --coverage --watch"
},
"size-limit": [
{
"path": "dist/browser.umd.js",
"limit": "3.5 KB"
}
],
"lint-staged": {
"{src,test}/**/**.ts": [
"eslint"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"jest": {
"transform": {
".(ts)": "ts-jest"
},
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"testEnvironment": "node",
"testRegex": "\\/test\\/.*(\\.spec\\.ts)$",
"moduleFileExtensions": [
"ts",
"js"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
],
"coverageThreshold": {
"global": {
"branches": 85,
"functions": 95,
"lines": 95,
"statements": 95
}
},
"collectCoverageFrom": [
"src/!(browser).ts"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@size-limit/preset-small-lib": "^8.2.4",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"commitizen": "^4.3.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"husky": "^4.3.8",
"jest": "^29.4.3",
"lint-staged": "^13.1.2",
"microbundle": "^0.15.1",
"np": "^7.6.3",
"prettier": "^2.8.4",
"rimraf": "^4.1.2",
"shelljs": "^0.8.5",
"size-limit": "^8.2.4",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.1.3"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}