Fix code quality violations and enhance ROUTE-EXISTS-01 rule

Implement JQHTML function cache ID system and fix bundle compilation
Implement underscore prefix for system tables
Fix JS syntax linter to support decorators and grant exception to Task system
SPA: Update planning docs and wishlists with remaining features
SPA: Document Navigation API abandonment and future enhancements
Implement SPA browser integration with History API (Phase 1)
Convert contacts view page to SPA action
Convert clients pages to SPA actions and document conversion procedure
SPA: Merge GET parameters and update documentation
Implement SPA route URL generation in JavaScript and PHP
Implement SPA bootstrap controller architecture
Add SPA routing manual page (rsx:man spa)
Add SPA routing documentation to CLAUDE.md
Phase 4 Complete: Client-side SPA routing implementation
Update get_routes() consumers for unified route structure
Complete SPA Phase 3: PHP-side route type detection and is_spa flag
Restore unified routes structure and Manifest_Query class
Refactor route indexing and add SPA infrastructure
Phase 3 Complete: SPA route registration in manifest
Implement SPA Phase 2: Extract router code and test decorators
Rename Jqhtml_Component to Component and complete SPA foundation setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-19 17:48:15 +00:00
parent 77b4d10af8
commit 9ebcc359ae
4360 changed files with 37751 additions and 18578 deletions

View File

@@ -10,13 +10,6 @@ export var TokenType;
TokenType["EXPRESSION_UNESCAPED"] = "EXPRESSION_UNESCAPED";
TokenType["CODE_START"] = "CODE_START";
TokenType["TAG_END"] = "TAG_END";
// Control flow
TokenType["IF"] = "IF";
TokenType["ELSE"] = "ELSE";
TokenType["ELSEIF"] = "ELSEIF";
TokenType["ENDIF"] = "ENDIF";
TokenType["FOR"] = "FOR";
TokenType["ENDFOR"] = "ENDFOR";
// Comments
TokenType["COMMENT"] = "COMMENT";
// Component definition
@@ -59,8 +52,11 @@ export class Lexer {
// Track saved positions for accurate token creation
savedPosition = null;
constructor(input) {
// Preprocess: Normalize all line endings to \n (handles \r\n and \r)
// This ensures the lexer only needs to handle \n throughout
let processed = input.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
// Preprocess: Replace JQHTML comments (<%-- --%) with equivalent newlines to preserve line mapping
let processed = this.preprocessComments(input);
processed = this.preprocessComments(processed);
// Preprocess: Replace HTML comments (<!-- -->) outside Define tags with equivalent newlines
processed = this.preprocessHTMLComments(processed);
// Preprocess: Insert // for empty lines in code blocks to preserve line mapping
@@ -538,56 +534,9 @@ export class Lexer {
// Now skip whitespace to check for keywords
this.skip_whitespace();
const saved_position = this.position;
// Check for control flow keywords only if they have colon syntax
if (this.match_keyword('if') && this.peek_for_colon()) {
// Rewind to capture keyword
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('if'); // consume again
this.add_token(TokenType.IF, 'if', keyword_start, this.position);
this.scan_javascript(); // Scan the condition
}
else if (this.match_keyword('else') &&
(this.peek_for_colon() || this.peek_sequence(':') || this.peek_sequence('%>'))) {
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('else');
this.add_token(TokenType.ELSE, 'else', keyword_start, this.position);
this.scan_javascript(); // Might have trailing code
}
else if (this.match_keyword('elseif') && this.peek_for_colon()) {
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('elseif');
this.add_token(TokenType.ELSEIF, 'elseif', keyword_start, this.position);
this.scan_javascript(); // Scan the condition
}
else if (this.match_keyword('endif')) {
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('endif');
this.add_token(TokenType.ENDIF, 'endif', keyword_start, this.position);
this.scan_javascript(); // Might have semicolon
}
else if (this.match_keyword('for') && this.peek_for_colon()) {
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('for');
this.add_token(TokenType.FOR, 'for', keyword_start, this.position);
this.scan_javascript(); // Scan the loop expression
}
else if (this.match_keyword('endfor')) {
this.position = saved_position;
const keyword_start = this.position;
this.match_keyword('endfor');
this.add_token(TokenType.ENDFOR, 'endfor', keyword_start, this.position);
this.scan_javascript(); // Might have semicolon
}
else {
// It's regular JavaScript code - rewind to include whitespace
this.position = position_with_whitespace;
this.scan_javascript();
}
// It's regular JavaScript code - rewind to include whitespace
this.position = position_with_whitespace;
this.scan_javascript();
}
scan_comment() {
// Scan comment from <%-- to --%>
@@ -1063,38 +1012,6 @@ export class Lexer {
return false;
return this.is_tag_name_char(char) || char === '$' || char === ':' || char === '@';
}
peek_for_colon() {
// Look ahead in the JavaScript to see if there's a colon before %>
let pos = this.position;
// Skip whitespace and look for either : or (condition):
while (pos < this.input.length) {
const char = this.input[pos];
// Found %> before colon
if (pos + 1 < this.input.length &&
this.input[pos] === '%' && this.input[pos + 1] === '>') {
return false;
}
// Found colon
if (char === ':') {
return true;
}
// Skip through parentheses
if (char === '(') {
let depth = 1;
pos++;
while (pos < this.input.length && depth > 0) {
if (this.input[pos] === '(')
depth++;
if (this.input[pos] === ')')
depth--;
pos++;
}
continue;
}
pos++;
}
return false;
}
scan_attribute() {
const start = this.position;
let name = '';