Update npm dependencies
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
18
node_modules/@jqhtml/parser/dist/lexer.js
generated
vendored
18
node_modules/@jqhtml/parser/dist/lexer.js
generated
vendored
@@ -1214,6 +1214,13 @@ export class Lexer {
|
||||
isFirstChar = false;
|
||||
continue;
|
||||
}
|
||||
// Allow - as the first character (for negative numbers)
|
||||
if (isFirstChar && ch === '-') {
|
||||
value += ch;
|
||||
this.advance();
|
||||
isFirstChar = false;
|
||||
continue;
|
||||
}
|
||||
isFirstChar = false;
|
||||
// Check if character is valid for JavaScript identifier/member expression/function call
|
||||
const isValidChar = (ch >= 'a' && ch <= 'z') ||
|
||||
@@ -1255,12 +1262,14 @@ export class Lexer {
|
||||
// - Arrays: [1, 2, 3]
|
||||
// - Ternary: condition ? a : b
|
||||
// Check for disallowed operators
|
||||
if (/[+\-*/%=<>!&|^~?:]/.test(value)) {
|
||||
// Allow - at the start for negative numbers (e.g., -1, -45.67)
|
||||
const valueForOperatorCheck = value.startsWith('-') ? value.slice(1) : value;
|
||||
if (/[+\-*/%=<>!&|^~?:]/.test(valueForOperatorCheck)) {
|
||||
const error = new JQHTMLParseError(`Operators are not allowed in unquoted $ attribute values.\n` +
|
||||
` Found: ${attr_context}${value}`, this.line, this.column, this.input);
|
||||
error.suggestion = `\n\nUnquoted $ attribute values must be simple references or function calls:\n\n` +
|
||||
`✓ Allowed patterns:\n` +
|
||||
` - Literals: $count=42 or $active=true\n` +
|
||||
` - Literals: $count=42 or $active=true or $offset=-1\n` +
|
||||
` - Variables: $data=myVariable\n` +
|
||||
` - Property access: $handler=Controller.method\n` +
|
||||
` - Function calls: $value=getData()\n` +
|
||||
@@ -1332,13 +1341,14 @@ export class Lexer {
|
||||
// Validate the overall pattern using regex
|
||||
// Pattern: identifier(.identifier)*(( args? ))*
|
||||
// This allows: var, obj.prop, func(), obj.method(arg1, arg2).chain().more
|
||||
const pattern = /^!?[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*|\([^)]*\))*$|^(true|false|null|undefined|\d+(\.\d+)?)$/;
|
||||
// Also allows negative numbers: -1, -45.67
|
||||
const pattern = /^!?[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*|\([^)]*\))*$|^(true|false|null|undefined|-?\d+(\.\d+)?)$/;
|
||||
if (!pattern.test(value)) {
|
||||
const error = new JQHTMLParseError(`Invalid syntax in unquoted $ attribute value.\n` +
|
||||
` Found: ${attr_context}${value}`, this.line, this.column, this.input);
|
||||
error.suggestion = `\n\nUnquoted $ attribute values must follow these patterns:\n\n` +
|
||||
`✓ Allowed:\n` +
|
||||
` - Number literals: 42, 3.14\n` +
|
||||
` - Number literals: 42, 3.14, -1, -45.67\n` +
|
||||
` - Boolean literals: true, false\n` +
|
||||
` - Null/undefined: null, undefined\n` +
|
||||
` - Identifiers: myVar, _private, $jQuery\n` +
|
||||
|
||||
Reference in New Issue
Block a user