Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
130
node_modules/@jqhtml/parser/dist/lexer.js
generated
vendored
130
node_modules/@jqhtml/parser/dist/lexer.js
generated
vendored
@@ -221,9 +221,54 @@ export class Lexer {
|
||||
// Count newlines in the expression
|
||||
const newlineCount = (exprContent.match(/\n/g) || []).length;
|
||||
if (newlineCount > 0) {
|
||||
// Strip line comments BEFORE collapsing to avoid breaking parser
|
||||
let processedExpr = exprContent;
|
||||
// Replace // comments with spaces (preserve length for sourcemaps)
|
||||
let cleaned = '';
|
||||
let inString = false;
|
||||
let stringDelim = '';
|
||||
let escaped = false;
|
||||
for (let i = 0; i < processedExpr.length; i++) {
|
||||
const ch = processedExpr[i];
|
||||
const next = processedExpr[i + 1] || '';
|
||||
// Handle escape sequences
|
||||
if (escaped) {
|
||||
cleaned += ch;
|
||||
escaped = false;
|
||||
continue;
|
||||
}
|
||||
if (ch === '\\' && inString) {
|
||||
cleaned += ch;
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
// Track strings
|
||||
if (!inString && (ch === '"' || ch === "'" || ch === '`')) {
|
||||
inString = true;
|
||||
stringDelim = ch;
|
||||
cleaned += ch;
|
||||
}
|
||||
else if (inString && ch === stringDelim) {
|
||||
inString = false;
|
||||
cleaned += ch;
|
||||
}
|
||||
else if (!inString && ch === '/' && next === '/') {
|
||||
// Found line comment - replace with spaces until newline
|
||||
cleaned += ' ';
|
||||
i++; // skip second /
|
||||
cleaned += ' ';
|
||||
while (i + 1 < processedExpr.length && processedExpr[i + 1] !== '\n') {
|
||||
i++;
|
||||
cleaned += ' ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
cleaned += ch;
|
||||
}
|
||||
}
|
||||
// Collapse multi-line expression to single line
|
||||
// Replace all newlines with spaces to preserve token separation
|
||||
const collapsedExpr = exprContent.replace(/\n/g, ' ');
|
||||
const collapsedExpr = cleaned.replace(/\n/g, ' ');
|
||||
// Add trailing newlines after the expression
|
||||
const trailingNewlines = '\n'.repeat(newlineCount);
|
||||
// Reconstruct with collapsed expression and trailing newlines
|
||||
@@ -346,6 +391,18 @@ export class Lexer {
|
||||
const start_column = this.column;
|
||||
// Check for JQHTML tags first
|
||||
// Comments are now preprocessed out, so we don't need to check for them
|
||||
// Check for invalid <%== syntax (common mistake)
|
||||
if (this.match_sequence('<%==')) {
|
||||
const error = new JQHTMLParseError('Invalid expression syntax: <%== is not valid JQHTML syntax', this.line, this.column - 4, // Point to the start of <%==
|
||||
this.input);
|
||||
error.suggestion = '\n\nValid expression syntax:\n' +
|
||||
' <%= expr %> - Escaped output (safe, default)\n' +
|
||||
' <%!= expr %> - Unescaped HTML output (raw)\n\n' +
|
||||
'Did you mean:\n' +
|
||||
' <%= ... %> for escaped output, or\n' +
|
||||
' <%!= ... %> for unescaped/raw HTML output?';
|
||||
throw error;
|
||||
}
|
||||
if (this.match_sequence('<%!=')) {
|
||||
this.add_token(TokenType.EXPRESSION_UNESCAPED, '<%!=', start, this.position);
|
||||
this.scan_expression();
|
||||
@@ -592,9 +649,10 @@ export class Lexer {
|
||||
}
|
||||
scan_expression() {
|
||||
// After <%=, scan JavaScript until %>
|
||||
this.scan_javascript();
|
||||
// Strip line comments from interpolation blocks to avoid breaking parser
|
||||
this.scan_javascript(true);
|
||||
}
|
||||
scan_javascript() {
|
||||
scan_javascript(strip_line_comments = false) {
|
||||
const start = this.position;
|
||||
let code = '';
|
||||
let in_string = false;
|
||||
@@ -625,6 +683,46 @@ export class Lexer {
|
||||
in_string = false;
|
||||
string_delimiter = '';
|
||||
}
|
||||
// Strip line comments in interpolation blocks (outside strings)
|
||||
if (strip_line_comments && !in_string && char === '/' && this.peek_ahead(1) === '/') {
|
||||
// Replace EVERY character from // up to (but not including) newline with = for debugging
|
||||
// This maintains exact position alignment for sourcemaps
|
||||
// Replace first /
|
||||
code += ' ';
|
||||
this.advance();
|
||||
// Replace second /
|
||||
code += ' ';
|
||||
this.advance();
|
||||
// Replace all comment text with spaces until we hit newline or %>
|
||||
while (this.position < this.input.length) {
|
||||
const next = this.current_char();
|
||||
// Found newline - preserve it and stop
|
||||
if (next === '\n') {
|
||||
code += next;
|
||||
this.advance();
|
||||
break;
|
||||
}
|
||||
// Handle \r\n or \r
|
||||
if (next === '\r') {
|
||||
code += next;
|
||||
this.advance();
|
||||
// Check for \n following \r
|
||||
if (this.current_char() === '\n') {
|
||||
code += '\n';
|
||||
this.advance();
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Found closing %> - stop (don't consume it)
|
||||
if (next === '%' && this.peek_ahead(1) === '>') {
|
||||
break;
|
||||
}
|
||||
// Replace this comment character with space
|
||||
code += ' ';
|
||||
this.advance();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Only look for %> when not inside a string
|
||||
if (!in_string && char === '%' && this.peek_ahead(1) === '>') {
|
||||
break;
|
||||
@@ -632,8 +730,10 @@ export class Lexer {
|
||||
code += char;
|
||||
this.advance();
|
||||
}
|
||||
if (code.trim().length > 0) {
|
||||
this.add_token(TokenType.JAVASCRIPT, code.trim(), start, this.position);
|
||||
// Don't trim when stripping comments - preserve whitespace for proper parsing
|
||||
const finalCode = strip_line_comments ? code : code.trim();
|
||||
if (finalCode.trim().length > 0) {
|
||||
this.add_token(TokenType.JAVASCRIPT, finalCode, start, this.position);
|
||||
}
|
||||
}
|
||||
scan_component_name() {
|
||||
@@ -932,6 +1032,23 @@ export class Lexer {
|
||||
this.add_token(TokenType.GT, '>', gt_start, this.position);
|
||||
return;
|
||||
}
|
||||
// Check for <% (conditional attribute start)
|
||||
if (char === '<' && this.peek_ahead(1) === '%') {
|
||||
const start = this.position;
|
||||
this.advance(); // <
|
||||
this.advance(); // %
|
||||
this.add_token(TokenType.CODE_START, '<%', start, this.position);
|
||||
this.scan_code_block();
|
||||
// Consume the %> that scan_code_block left behind
|
||||
if (this.current_char() === '%' && this.peek_ahead(1) === '>') {
|
||||
const tag_end_start = this.position;
|
||||
this.advance(); // %
|
||||
this.advance(); // >
|
||||
this.add_token(TokenType.TAG_END, '%>', tag_end_start, this.position);
|
||||
}
|
||||
// Continue scanning attributes - DO NOT return
|
||||
continue;
|
||||
}
|
||||
// Must be an attribute
|
||||
if (this.is_attribute_start_char(char)) {
|
||||
this.scan_attribute();
|
||||
@@ -986,7 +1103,8 @@ export class Lexer {
|
||||
const char = this.current_char();
|
||||
if (char === '=' || char === ' ' || char === '\t' ||
|
||||
char === '\n' || char === '\r' || char === '>' ||
|
||||
(char === '/' && this.peek_ahead(1) === '>')) {
|
||||
(char === '/' && this.peek_ahead(1) === '>') ||
|
||||
(char === '<' && this.peek_ahead(1) === '%')) {
|
||||
break;
|
||||
}
|
||||
name += char;
|
||||
|
||||
Reference in New Issue
Block a user