Comparing version 5.3.1 to 5.3.2
@@ -93,3 +93,3 @@ "use strict"; | ||
: utils_1.lodash.merge({}, mergeProps, this.all()); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
return (0, Template_1.safeValue)((0, stringify_attributes_1.default)(this.mergeClassAttributes(attributes))); | ||
} | ||
@@ -106,3 +106,3 @@ /** | ||
: utils_1.lodash.merge({}, mergeProps, this.only(keys)); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
return (0, Template_1.safeValue)((0, stringify_attributes_1.default)(this.mergeClassAttributes(attributes))); | ||
} | ||
@@ -119,5 +119,5 @@ /** | ||
: utils_1.lodash.merge({}, mergeProps, this.except(keys)); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
return (0, Template_1.safeValue)((0, stringify_attributes_1.default)(this.mergeClassAttributes(attributes))); | ||
} | ||
} | ||
exports.Props = Props; |
@@ -197,3 +197,3 @@ /** | ||
*/ | ||
escape<T>(input: T): T; | ||
escape(input: any): string; | ||
/** | ||
@@ -200,0 +200,0 @@ * Rethrow exceptions by pointing back to edge source file and line number |
@@ -33,3 +33,3 @@ "use strict"; | ||
inspect: (value) => { | ||
return Template_1.safeValue(require('@poppinss/inspect').string.html(value)); | ||
return (0, Template_1.safeValue)(require('@poppinss/inspect').string.html(value)); | ||
}, | ||
@@ -36,0 +36,0 @@ /** |
@@ -38,3 +38,3 @@ "use strict"; | ||
try { | ||
return fs_1.readFileSync(absPath, 'utf-8'); | ||
return (0, fs_1.readFileSync)(absPath, 'utf-8'); | ||
} | ||
@@ -166,3 +166,3 @@ catch (error) { | ||
*/ | ||
if (path_1.isAbsolute(templatePath)) { | ||
if ((0, path_1.isAbsolute)(templatePath)) { | ||
return templatePath; | ||
@@ -181,3 +181,3 @@ } | ||
} | ||
return path_1.join(mountedDir, template); | ||
return (0, path_1.join)(mountedDir, template); | ||
} | ||
@@ -206,3 +206,3 @@ /** | ||
*/ | ||
templatePath = path_1.isAbsolute(templatePath) ? templatePath : this.makePath(templatePath); | ||
templatePath = (0, path_1.isAbsolute)(templatePath) ? templatePath : this.makePath(templatePath); | ||
return { | ||
@@ -209,0 +209,0 @@ template: this.readTemplateContents(templatePath), |
@@ -48,4 +48,4 @@ "use strict"; | ||
*/ | ||
utils_1.isSubsetOf(name, ALLOWED_EXPRESSION_FOR_COMPONENT_NAME, () => { | ||
utils_1.unallowedExpression(`"${parser.utils.stringify(name)}" is not a valid argument for component name`, filename, parser.utils.getExpressionLoc(name)); | ||
(0, utils_1.isSubsetOf)(name, ALLOWED_EXPRESSION_FOR_COMPONENT_NAME, () => { | ||
(0, utils_1.unallowedExpression)(`"${parser.utils.stringify(name)}" is not a valid argument for component name`, filename, parser.utils.getExpressionLoc(name)); | ||
}); | ||
@@ -85,4 +85,4 @@ /** | ||
const parsed = parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename).expression; | ||
utils_1.isSubsetOf(parsed, [edge_parser_1.expressions.Literal, edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isSubsetOf)(parsed, [edge_parser_1.expressions.Literal, edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -102,4 +102,4 @@ /** | ||
*/ | ||
utils_1.isSubsetOf(name, [edge_parser_1.expressions.Literal], () => { | ||
utils_1.unallowedExpression('slot name must be a valid string literal', token.filename, parser.utils.getExpressionLoc(name)); | ||
(0, utils_1.isSubsetOf)(name, [edge_parser_1.expressions.Literal], () => { | ||
(0, utils_1.unallowedExpression)('slot name must be a valid string literal', token.filename, parser.utils.getExpressionLoc(name)); | ||
}); | ||
@@ -124,4 +124,4 @@ /** | ||
} | ||
utils_1.isSubsetOf(parsed.expressions[1], [edge_parser_1.expressions.Identifier], () => { | ||
utils_1.unallowedExpression(`"${parser.utils.stringify(parsed.expressions[1])}" is not valid prop identifier for @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed.expressions[1])); | ||
(0, utils_1.isSubsetOf)(parsed.expressions[1], [edge_parser_1.expressions.Identifier], () => { | ||
(0, utils_1.unallowedExpression)(`"${parser.utils.stringify(parsed.expressions[1])}" is not valid prop identifier for @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed.expressions[1])); | ||
}); | ||
@@ -144,8 +144,8 @@ /** | ||
const awaitKeyword = parser.asyncMode ? 'await ' : ''; | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* Check component jsProps for allowed expressions | ||
*/ | ||
utils_1.isSubsetOf(parsed, ALLOWED_EXPRESSION_FOR_COMPONENT_NAME.concat(edge_parser_1.expressions.SequenceExpression), () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @component tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isSubsetOf)(parsed, ALLOWED_EXPRESSION_FOR_COMPONENT_NAME.concat(edge_parser_1.expressions.SequenceExpression), () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @component tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -152,0 +152,0 @@ /** |
@@ -35,4 +35,4 @@ "use strict"; | ||
*/ | ||
utils_2.isSubsetOf(lhsExpression, [edge_parser_1.expressions.SequenceExpression, edge_parser_1.expressions.Identifier], () => { | ||
utils_2.unallowedExpression(`invalid left hand side "${lhsExpression.type}" expression for the @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression)); | ||
(0, utils_2.isSubsetOf)(lhsExpression, [edge_parser_1.expressions.SequenceExpression, edge_parser_1.expressions.Identifier], () => { | ||
(0, utils_2.unallowedExpression)(`invalid left hand side "${lhsExpression.type}" expression for the @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression)); | ||
}); | ||
@@ -46,4 +46,4 @@ /** | ||
*/ | ||
utils_2.isSubsetOf(lhsExpression.expressions[0], [edge_parser_1.expressions.Identifier], () => { | ||
utils_2.unallowedExpression(`"${lhsExpression.expressions[0]}.type" is not allowed as value identifier for @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression.expressions[0])); | ||
(0, utils_2.isSubsetOf)(lhsExpression.expressions[0], [edge_parser_1.expressions.Identifier], () => { | ||
(0, utils_2.unallowedExpression)(`"${lhsExpression.expressions[0]}.type" is not allowed as value identifier for @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression.expressions[0])); | ||
}); | ||
@@ -53,4 +53,4 @@ /** | ||
*/ | ||
utils_2.isSubsetOf(lhsExpression.expressions[1], [edge_parser_1.expressions.Identifier], () => { | ||
utils_2.unallowedExpression(`"${lhsExpression.expressions[1]}.type" is not allowed as key identifier for @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression.expressions[1])); | ||
(0, utils_2.isSubsetOf)(lhsExpression.expressions[1], [edge_parser_1.expressions.Identifier], () => { | ||
(0, utils_2.unallowedExpression)(`"${lhsExpression.expressions[1]}.type" is not allowed as key identifier for @each tag`, filename, parser.utils.getExpressionLoc(lhsExpression.expressions[1])); | ||
}); | ||
@@ -92,4 +92,4 @@ return [lhsExpression.expressions[0].name, lhsExpression.expressions[1].name]; | ||
*/ | ||
utils_2.isSubsetOf(expression, [edge_parser_1.expressions.BinaryExpression], () => { | ||
utils_2.unallowedExpression(`"${token.properties.jsArg}" is not valid expression for the @each tag`, token.filename, parser.utils.getExpressionLoc(expression)); | ||
(0, utils_2.isSubsetOf)(expression, [edge_parser_1.expressions.BinaryExpression], () => { | ||
(0, utils_2.unallowedExpression)(`"${token.properties.jsArg}" is not valid expression for the @each tag`, token.filename, parser.utils.getExpressionLoc(expression)); | ||
}); | ||
@@ -96,0 +96,0 @@ /** |
@@ -27,8 +27,8 @@ "use strict"; | ||
compile(parser, buffer, token) { | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* Disallow sequence expressions | ||
*/ | ||
utils_1.isNotSubsetOf(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`{${token.properties.jsArg}} is not a valid argument type for the @elseif tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isNotSubsetOf)(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`{${token.properties.jsArg}} is not a valid argument type for the @elseif tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -35,0 +35,0 @@ /** |
@@ -25,8 +25,8 @@ "use strict"; | ||
compile(parser, buffer, token) { | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* Disallow sequence expressions | ||
*/ | ||
utils_1.isNotSubsetOf(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @if tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isNotSubsetOf)(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @if tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -33,0 +33,0 @@ /** |
@@ -69,8 +69,8 @@ "use strict"; | ||
const awaitKeyword = parser.asyncMode ? 'await ' : ''; | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* Only mentioned expressions are allowed inside `@include` tag | ||
*/ | ||
utils_1.isSubsetOf(parsed, exports.ALLOWED_EXPRESSION, () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @include tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isSubsetOf)(parsed, exports.ALLOWED_EXPRESSION, () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @include tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -77,0 +77,0 @@ buffer.outputExpression(`${awaitKeyword}${getRenderExpression(parser, parsed)}`, token.filename, token.loc.start.line, false); |
@@ -33,8 +33,8 @@ "use strict"; | ||
const awaitKeyword = parser.asyncMode ? 'await ' : ''; | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* The include if only accepts the sequence expression | ||
*/ | ||
utils_1.isSubsetOf(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isSubsetOf)(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -52,12 +52,12 @@ /** | ||
const [conditional, include] = parsed.expressions; | ||
utils_1.isNotSubsetOf(conditional, [edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`"${conditional.type}" is not a valid 1st argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(conditional)); | ||
(0, utils_1.isNotSubsetOf)(conditional, [edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`"${conditional.type}" is not a valid 1st argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(conditional)); | ||
}); | ||
utils_1.isSubsetOf(include, Include_1.ALLOWED_EXPRESSION, () => { | ||
utils_1.unallowedExpression(`"${include.type}" is not a valid 2nd argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(include)); | ||
(0, utils_1.isSubsetOf)(include, Include_1.ALLOWED_EXPRESSION, () => { | ||
(0, utils_1.unallowedExpression)(`"${include.type}" is not a valid 2nd argument type for the @includeIf tag`, token.filename, parser.utils.getExpressionLoc(include)); | ||
}); | ||
buffer.writeStatement(`if (${parser.utils.stringify(conditional)}) {`, token.filename, token.loc.start.line); | ||
buffer.outputExpression(`${awaitKeyword}${Include_1.getRenderExpression(parser, include)}`, token.filename, token.loc.start.line, false); | ||
buffer.outputExpression(`${awaitKeyword}${(0, Include_1.getRenderExpression)(parser, include)}`, token.filename, token.loc.start.line, false); | ||
buffer.writeStatement('}', token.filename, -1); | ||
}, | ||
}; |
@@ -25,8 +25,8 @@ "use strict"; | ||
token.properties.jsArg = `(${token.properties.jsArg})`; | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* The inject tag only accepts an object expression. | ||
*/ | ||
utils_1.isSubsetOf(parsed, [edge_parser_1.expressions.ObjectExpression, edge_parser_1.expressions.Identifier], () => { | ||
throw utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid key-value pair for the @inject tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isSubsetOf)(parsed, [edge_parser_1.expressions.ObjectExpression, edge_parser_1.expressions.Identifier], () => { | ||
throw (0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid key-value pair for the @inject tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -33,0 +33,0 @@ /** |
@@ -24,3 +24,3 @@ "use strict"; | ||
compile(parser, buffer, token) { | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
let message = ''; | ||
@@ -27,0 +27,0 @@ let line = token.loc.start.line; |
@@ -43,8 +43,8 @@ "use strict"; | ||
compile(parser, buffer, token) { | ||
const parsed = utils_2.parseJsArg(parser, token); | ||
const parsed = (0, utils_2.parseJsArg)(parser, token); | ||
/** | ||
* The set tag only accepts a sequence expression. | ||
*/ | ||
utils_2.isSubsetOf(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
throw utils_2.unallowedExpression(`"${token.properties.jsArg}" is not a valid key-value pair for the @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_2.isSubsetOf)(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
throw (0, utils_2.unallowedExpression)(`"${token.properties.jsArg}" is not a valid key-value pair for the @slot tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -79,4 +79,4 @@ /** | ||
*/ | ||
utils_2.isSubsetOf(key, [edge_parser_1.expressions.Literal], () => { | ||
throw utils_2.unallowedExpression(`The ${collection ? 'second' : 'first'} argument for @set tag must be a string literal`, token.filename, parser.utils.getExpressionLoc(key)); | ||
(0, utils_2.isSubsetOf)(key, [edge_parser_1.expressions.Literal], () => { | ||
throw (0, utils_2.unallowedExpression)(`The ${collection ? 'second' : 'first'} argument for @set tag must be a string literal`, token.filename, parser.utils.getExpressionLoc(key)); | ||
}); | ||
@@ -83,0 +83,0 @@ /** |
@@ -32,8 +32,8 @@ "use strict"; | ||
compile(parser, buffer, token) { | ||
const parsed = utils_1.parseJsArg(parser, token); | ||
const parsed = (0, utils_1.parseJsArg)(parser, token); | ||
/** | ||
* Disallow sequence expressions | ||
*/ | ||
utils_1.isNotSubsetOf(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
utils_1.unallowedExpression(`"${token.properties.jsArg}" is not a valid argument type for the @unless tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
(0, utils_1.isNotSubsetOf)(parsed, [edge_parser_1.expressions.SequenceExpression], () => { | ||
(0, utils_1.unallowedExpression)(`"${token.properties.jsArg}" is not a valid argument type for the @unless tag`, token.filename, parser.utils.getExpressionLoc(parsed)); | ||
}); | ||
@@ -40,0 +40,0 @@ /** |
@@ -16,3 +16,3 @@ import { Macroable } from 'macroable'; | ||
*/ | ||
export declare function escape<T>(input: T): T extends SafeValue ? T['value'] : T; | ||
export declare function escape(input: any): string; | ||
/** | ||
@@ -107,3 +107,3 @@ * Mark value as safe and not to be escaped | ||
*/ | ||
escape<T>(input: T): T extends SafeValue ? T['value'] : T; | ||
escape(input: any): string; | ||
/** | ||
@@ -110,0 +110,0 @@ * Raise an error |
@@ -32,7 +32,3 @@ "use strict"; | ||
function escape(input) { | ||
return typeof input === 'string' | ||
? helpers_1.string.escapeHTML(input) | ||
: input instanceof SafeValue | ||
? input.value | ||
: input; | ||
return input instanceof SafeValue ? input.value : helpers_1.string.escapeHTML(String(input)); | ||
} | ||
@@ -39,0 +35,0 @@ exports.escape = escape; |
{ | ||
"name": "edge.js", | ||
"version": "5.3.1", | ||
"version": "5.3.2", | ||
"description": "Template engine", | ||
@@ -39,19 +39,19 @@ "main": "build/index.js", | ||
"@adonisjs/mrm-preset": "^4.1.2", | ||
"@adonisjs/require-ts": "^2.0.7", | ||
"@adonisjs/require-ts": "^2.0.8", | ||
"@poppinss/dev-utils": "^1.1.5", | ||
"@types/node": "^16.3.3", | ||
"@types/node": "^16.7.10", | ||
"dedent-js": "^1.0.1", | ||
"del-cli": "^4.0.1", | ||
"doctoc": "^2.0.1", | ||
"eslint": "^7.31.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-adonis": "^1.3.3", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"github-label-sync": "^2.0.1", | ||
"husky": "^7.0.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"github-label-sync": "^2.0.2", | ||
"husky": "^7.0.2", | ||
"japa": "^3.1.1", | ||
"mrm": "^3.0.2", | ||
"mrm": "^3.0.8", | ||
"np": "^7.5.0", | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.4.0-dev.20210515" | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -73,6 +73,6 @@ "config": { | ||
"@poppinss/inspect": "^1.0.1", | ||
"@poppinss/utils": "^3.1.4", | ||
"edge-error": "^2.0.5", | ||
"edge-lexer": "^4.0.7", | ||
"edge-parser": "^8.0.10", | ||
"@poppinss/utils": "^3.2.0", | ||
"edge-error": "^2.0.6", | ||
"edge-lexer": "^4.0.8", | ||
"edge-parser": "^8.0.11", | ||
"js-stringify": "^1.0.2", | ||
@@ -79,0 +79,0 @@ "macroable": "^5.1.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
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
140323
4086
Updated@poppinss/utils@^3.2.0
Updatededge-error@^2.0.6
Updatededge-lexer@^4.0.8
Updatededge-parser@^8.0.11