Comparing version 1.2.11 to 1.2.12
@@ -39,2 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadAndRender = exports.render = exports.loadAndParse = exports.parse = exports.config = void 0; | ||
var compiler_1 = require("./compiler"); | ||
@@ -66,6 +67,6 @@ var context_1 = require("./context"); | ||
ctx = new context_1.AtatContext(options); | ||
return [4 /*yield*/, compiler_1.compile(input, ctx)]; | ||
return [4 /*yield*/, (0, compiler_1.compile)(input, ctx)]; | ||
case 1: | ||
output = _a.sent(); | ||
result = new Function(ctx.options.it + ", " + ctx.options.$ + ", body", output + "\nreturn this.output;"); | ||
result = new Function("".concat(ctx.options.it, ", ").concat(ctx.options.$, ", body"), "".concat(output, "\nreturn this.output;")); | ||
template = function (model) { | ||
@@ -72,0 +73,0 @@ ctx.output = ''; |
@@ -39,2 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.outputCallHelper = exports.outputSection = exports.compilePartial = exports.compileLayout = exports.outputAsHtml = exports.outputAsText = exports.compileWhile = exports.compileSection = exports.compileIf = exports.compileFunction = exports.compileFor = exports.compileCode = exports.compileInline = exports.compile = exports.tags = exports.helpers = void 0; | ||
var atat_1 = require("./atat"); | ||
@@ -81,3 +82,3 @@ var types_1 = require("./types"); | ||
var item = exports.tags.compilers[i]; | ||
if (utils_1.regexpTest(str, item.regexp)) { | ||
if ((0, utils_1.regexpTest)(str, item.regexp)) { | ||
return item.compiler; | ||
@@ -98,4 +99,4 @@ } | ||
} | ||
blocks = utils_1.matchRecursive(input, exports.tags.open, exports.tags.close); | ||
return [4 /*yield*/, utils_1.loopAsync(blocks, function (block) { return __awaiter(_this, void 0, void 0, function () { | ||
blocks = (0, utils_1.matchRecursive)(input, exports.tags.open, exports.tags.close); | ||
return [4 /*yield*/, (0, utils_1.loopAsync)(blocks, function (block) { return __awaiter(_this, void 0, void 0, function () { | ||
var left, compiler, result; | ||
@@ -109,3 +110,3 @@ return __generator(this, function (_a) { | ||
} | ||
return [4 /*yield*/, compileInline(utils_1.trimLines(block.value), ctx)]; | ||
return [4 /*yield*/, compileInline((0, utils_1.trimLines)(block.value), ctx)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -137,4 +138,4 @@ case 2: | ||
case 0: | ||
blocks = utils_1.matchInline(input, exports.tags.inline); | ||
return [4 /*yield*/, utils_1.loopAsync(blocks, function (block) { return __awaiter(_this, void 0, void 0, function () { | ||
blocks = (0, utils_1.matchInline)(input, exports.tags.inline); | ||
return [4 /*yield*/, (0, utils_1.loopAsync)(blocks, function (block) { return __awaiter(_this, void 0, void 0, function () { | ||
var left, value, right, compiler, result; | ||
@@ -146,3 +147,3 @@ return __generator(this, function (_a) { | ||
ctx.parts.push(block.value); | ||
return [2 /*return*/, " this.output += this.parts[" + (ctx.parts.length - 1) + "];"]; | ||
return [2 /*return*/, " this.output += this.parts[".concat(ctx.parts.length - 1, "];")]; | ||
} | ||
@@ -184,4 +185,4 @@ left = block.left, value = block.value, right = block.right; | ||
case 0: | ||
code = "for(" + inside.value + "}"; | ||
_a = utils_1.matchRecursive(code, /\{/g, /\}/g), value1 = _a[0].value, value2 = _a[1].value; | ||
code = "for(".concat(inside.value, "}"); | ||
_a = (0, utils_1.matchRecursive)(code, /\{/g, /\}/g), value1 = _a[0].value, value2 = _a[1].value; | ||
out = value1.trim(); | ||
@@ -205,3 +206,3 @@ out += '{'; | ||
left = inside.left.value.trim().substring(1); | ||
return [2 /*return*/, "" + left + inside.value + "}\n"]; | ||
return [2 /*return*/, "".concat(left).concat(inside.value, "}\n")]; | ||
}); | ||
@@ -218,5 +219,5 @@ }); | ||
case 0: | ||
code = "if(" + inside.value + "}"; | ||
blocks = utils_1.matchRecursive(code, /\{/g, /\}/g); | ||
return [4 /*yield*/, utils_1.loopAsync(blocks, function (block, i) { return __awaiter(_this, void 0, void 0, function () { | ||
code = "if(".concat(inside.value, "}"); | ||
blocks = (0, utils_1.matchRecursive)(code, /\{/g, /\}/g); | ||
return [4 /*yield*/, (0, utils_1.loopAsync)(blocks, function (block, i) { return __awaiter(_this, void 0, void 0, function () { | ||
var result; | ||
@@ -256,3 +257,3 @@ return __generator(this, function (_a) { | ||
regName = /^@section\s+([a-zA-Z_$]{1}[a-zA-Z_$0-9]*)+\s*\{/g; | ||
match = utils_1.regexpExec(value, regName); | ||
match = (0, utils_1.regexpExec)(value, regName); | ||
if (!match || match.length > 2) { | ||
@@ -262,7 +263,7 @@ throw new Error('Section name is not specified'); | ||
name = match[1].trim(); | ||
return [4 /*yield*/, atat_1.parse(block, ctx.options)]; | ||
return [4 /*yield*/, (0, atat_1.parse)(block, ctx.options)]; | ||
case 1: | ||
template = _a.sent(); | ||
if (ctx.sections.has(name)) { | ||
throw new Error("The section \"" + name + "\" is already specified"); | ||
throw new Error("The section \"".concat(name, "\" is already specified")); | ||
} | ||
@@ -283,4 +284,4 @@ template.context.parent = ctx; | ||
case 0: | ||
code = "while(" + inside.value + "}"; | ||
_a = utils_1.matchRecursive(code, /\{/g, /\}/g), value1 = _a[0].value, value2 = _a[1].value; | ||
code = "while(".concat(inside.value, "}"); | ||
_a = (0, utils_1.matchRecursive)(code, /\{/g, /\}/g), value1 = _a[0].value, value2 = _a[1].value; | ||
out = value1.trim(); | ||
@@ -303,3 +304,3 @@ out += '{'; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, " this.output += this.helper('encode')(" + inside.value.trim() + ");"]; | ||
return [2 /*return*/, " this.output += this.helper('encode')(".concat(inside.value.trim(), ");")]; | ||
}); | ||
@@ -312,3 +313,3 @@ }); | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, " this.output += String(" + inside.value.trim() + ");"]; | ||
return [2 /*return*/, " this.output += String(".concat(inside.value.trim(), ");")]; | ||
}); | ||
@@ -323,3 +324,3 @@ }); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, atat_1.loadAndParse(utils_1.escapeQuotes(inside.value), ctx.options)]; | ||
case 0: return [4 /*yield*/, (0, atat_1.loadAndParse)((0, utils_1.escapeQuotes)(inside.value), ctx.options)]; | ||
case 1: | ||
@@ -346,4 +347,4 @@ template = _a.sent(); | ||
args = value.split(/\s*,\s*/g); | ||
uri = utils_1.escapeQuotes(args.shift() || ''); | ||
return [4 /*yield*/, atat_1.loadAndParse(uri, ctx.options)]; | ||
uri = (0, utils_1.escapeQuotes)(args.shift() || ''); | ||
return [4 /*yield*/, (0, atat_1.loadAndParse)(uri, ctx.options)]; | ||
case 1: | ||
@@ -353,4 +354,4 @@ template = _a.sent(); | ||
template.context.parent = ctx; | ||
output = " this.output += this.partials[" + (ctx.partials.length - | ||
1) + "](" + args + ");"; | ||
output = " this.output += this.partials[".concat(ctx.partials.length - | ||
1, "](").concat(args, ");"); | ||
return [2 /*return*/, output]; | ||
@@ -366,4 +367,4 @@ } | ||
return __generator(this, function (_a) { | ||
name = utils_1.escapeQuotes(inside.value); | ||
output = " this.output += this.section('" + name + "')(" + ctx.options.it + ", " + ctx.options.$ + ");"; | ||
name = (0, utils_1.escapeQuotes)(inside.value); | ||
output = " this.output += this.section('".concat(name, "')(").concat(ctx.options.it, ", ").concat(ctx.options.$, ");"); | ||
return [2 /*return*/, output]; | ||
@@ -380,3 +381,3 @@ }); | ||
name = left.value.substring(1, left.value.length - 1); | ||
return [2 /*return*/, " this.output += this.helper('" + name + "')(" + value.trim() + ");"]; | ||
return [2 /*return*/, " this.output += this.helper('".concat(name, "')(").concat(value.trim(), ");")]; | ||
}); | ||
@@ -383,0 +384,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MATCH_HTML = exports.CLEAR_TAGS = exports.HTML_RULES = void 0; | ||
exports.HTML_RULES = { | ||
@@ -4,0 +5,0 @@ '"': '"', |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AtatContext = void 0; | ||
var compiler_1 = require("./compiler"); | ||
@@ -17,5 +18,5 @@ var options_1 = require("./options"); | ||
this.layout = null; | ||
var _a = utils_1.merge(options_1.DEFAULT_OPTIONS, options), it = _a.it, $ = _a.$, loader = _a.loader; | ||
var _a = (0, utils_1.merge)(options_1.DEFAULT_OPTIONS, options), it = _a.it, $ = _a.$, loader = _a.loader; | ||
this.options = { it: it, $: $, loader: loader, helpers: {} }; | ||
utils_1.loopByObject(utils_1.merge(compiler_1.helpers, options.helpers), function (helper, name) { | ||
(0, utils_1.loopByObject)((0, utils_1.merge)(compiler_1.helpers, options.helpers), function (helper, name) { | ||
_this.helpers.set(name, helper); | ||
@@ -44,3 +45,3 @@ _this.options.helpers[name] = helper; | ||
else { | ||
throw new Error("Helper \"" + name + "\" is not declarated"); | ||
throw new Error("Helper \"".concat(name, "\" is not declarated")); | ||
} | ||
@@ -47,0 +48,0 @@ }; |
@@ -39,2 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.__express = void 0; | ||
var atat_1 = require("./atat"); | ||
@@ -49,3 +50,3 @@ function __express(path, model, callback) { | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, atat_1.loadAndRender(path, model)]; | ||
return [4 /*yield*/, (0, atat_1.loadAndRender)(path, model)]; | ||
case 1: | ||
@@ -52,0 +53,0 @@ result = _a.sent(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.__express = exports.DEFAULT_LOADER = exports.FETCH_LOADER = exports.render = exports.parse = exports.loadAndRender = exports.loadAndParse = exports.config = void 0; | ||
var atat_1 = require("./atat"); | ||
exports.config = atat_1.config; | ||
exports.loadAndParse = atat_1.loadAndParse; | ||
exports.loadAndRender = atat_1.loadAndRender; | ||
exports.parse = atat_1.parse; | ||
exports.render = atat_1.render; | ||
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return atat_1.config; } }); | ||
Object.defineProperty(exports, "loadAndParse", { enumerable: true, get: function () { return atat_1.loadAndParse; } }); | ||
Object.defineProperty(exports, "loadAndRender", { enumerable: true, get: function () { return atat_1.loadAndRender; } }); | ||
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return atat_1.parse; } }); | ||
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return atat_1.render; } }); | ||
var express_1 = require("./express"); | ||
exports.__express = express_1.__express; | ||
Object.defineProperty(exports, "__express", { enumerable: true, get: function () { return express_1.__express; } }); | ||
var loaders_1 = require("./loaders"); | ||
exports.DEFAULT_LOADER = loaders_1.DEFAULT_LOADER; | ||
exports.FETCH_LOADER = loaders_1.FETCH_LOADER; | ||
Object.defineProperty(exports, "DEFAULT_LOADER", { enumerable: true, get: function () { return loaders_1.DEFAULT_LOADER; } }); | ||
Object.defineProperty(exports, "FETCH_LOADER", { enumerable: true, get: function () { return loaders_1.FETCH_LOADER; } }); | ||
exports.default = { | ||
@@ -15,0 +16,0 @@ config: atat_1.config, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_LOADER = function (path) { | ||
exports.DEFAULT_LOADER = void 0; | ||
var DEFAULT_LOADER = function (path) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -11,1 +12,2 @@ var fs = require('fs'); | ||
}; | ||
exports.DEFAULT_LOADER = DEFAULT_LOADER; |
@@ -39,3 +39,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FETCH_LOADER = function (path) { return __awaiter(void 0, void 0, void 0, function () { | ||
exports.FETCH_LOADER = void 0; | ||
var FETCH_LOADER = function (path) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res, text; | ||
@@ -54,1 +55,2 @@ return __generator(this, function (_a) { | ||
}); }; | ||
exports.FETCH_LOADER = FETCH_LOADER; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FETCH_LOADER = exports.DEFAULT_LOADER = void 0; | ||
var default_1 = require("./default"); | ||
exports.DEFAULT_LOADER = default_1.DEFAULT_LOADER; | ||
Object.defineProperty(exports, "DEFAULT_LOADER", { enumerable: true, get: function () { return default_1.DEFAULT_LOADER; } }); | ||
var fetch_1 = require("./fetch"); | ||
exports.FETCH_LOADER = fetch_1.FETCH_LOADER; | ||
Object.defineProperty(exports, "FETCH_LOADER", { enumerable: true, get: function () { return fetch_1.FETCH_LOADER; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_OPTIONS = void 0; | ||
var loaders_1 = require("./loaders"); | ||
@@ -4,0 +5,0 @@ exports.DEFAULT_OPTIONS = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MuchResultTypes = void 0; | ||
var MuchResultTypes; | ||
@@ -4,0 +5,0 @@ (function (MuchResultTypes) { |
@@ -39,2 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.matchInline = exports.cleanArray = exports.regexpExec = exports.regexpTest = exports.matchRecursive = exports.lowercaseHelper = exports.uppercaseHelper = exports.joinHelper = exports.jsonStringify = exports.escapeQuotes = exports.encodeHtml = exports.loopAsync = exports.loopByObject = exports.merge = exports.toString = exports.trimLines = exports.noop = void 0; | ||
var contants_1 = require("./contants"); | ||
@@ -216,6 +217,6 @@ var types_1 = require("./types"); | ||
if (rightMatch !== null) { | ||
throw new SyntaxError("Unbalanced delimiter \"" + rightMatch + "\" was found in the template\n" + str + "\n" + ' '.repeat(rightMatch.index) + '^'.repeat(toString(rightMatch).length)); | ||
throw new SyntaxError("Unbalanced delimiter \"".concat(rightMatch, "\" was found in the template\n").concat(str, "\n").concat(' '.repeat(rightMatch.index)).concat('^'.repeat(toString(rightMatch).length))); | ||
} | ||
else { | ||
throw new SyntaxError("Unbalanced delimiter found in the template\n" + str); | ||
throw new SyntaxError("Unbalanced delimiter found in the template\n".concat(str)); | ||
} | ||
@@ -222,0 +223,0 @@ } |
{ | ||
"name": "atat", | ||
"version": "1.2.11", | ||
"version": "1.2.12", | ||
"author": "Sergey Golub", | ||
@@ -60,17 +60,17 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/jest": "^24.0.20", | ||
"@types/node": "^12.11.7", | ||
"@typescript-eslint/eslint-plugin": "^2.6.0", | ||
"@typescript-eslint/parser": "^2.6.0", | ||
"eslint": "^6.6.0", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.0.9", | ||
"jest": "^24.9.0", | ||
"jshint": "^2.10.2", | ||
"prettier": "^1.18.2", | ||
"ts-jest": "^24.1.0", | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.6.4" | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^17.0.5", | ||
"@typescript-eslint/eslint-plugin": "^5.8.0", | ||
"@typescript-eslint/parser": "^5.8.0", | ||
"eslint": "^8.5.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^27.4.5", | ||
"jshint": "^2.13.1", | ||
"prettier": "^2.5.1", | ||
"ts-jest": "^27.1.2", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
69641
1285