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:
13
node_modules/@jqhtml/parser/dist/ast.d.ts
generated
vendored
13
node_modules/@jqhtml/parser/dist/ast.d.ts
generated
vendored
@@ -10,7 +10,8 @@ export declare enum NodeType {
|
||||
FOR_STATEMENT = "ForStatement",
|
||||
CODE_BLOCK = "CodeBlock",
|
||||
FRAGMENT = "Fragment",
|
||||
SLOT = "Slot"
|
||||
SLOT = "Slot",// v2 slot syntax
|
||||
CONDITIONAL_ATTRIBUTE = "ConditionalAttribute"
|
||||
}
|
||||
export interface BaseNode {
|
||||
type: NodeType;
|
||||
@@ -63,6 +64,11 @@ export interface CodeBlockNode extends BaseNode {
|
||||
}>;
|
||||
code?: string;
|
||||
}
|
||||
export interface ConditionalAttributeNode extends BaseNode {
|
||||
type: NodeType.CONDITIONAL_ATTRIBUTE;
|
||||
condition: string;
|
||||
attributes: Record<string, any>;
|
||||
}
|
||||
export interface FragmentNode extends BaseNode {
|
||||
type: NodeType.FRAGMENT;
|
||||
children: ASTNode[];
|
||||
@@ -78,6 +84,7 @@ export interface ComponentInvocationNode extends BaseNode {
|
||||
type: NodeType.COMPONENT_INVOCATION;
|
||||
name: string;
|
||||
attributes: Record<string, any>;
|
||||
conditionalAttributes?: ConditionalAttributeNode[];
|
||||
children: ASTNode[];
|
||||
selfClosing: boolean;
|
||||
}
|
||||
@@ -85,9 +92,11 @@ export interface HtmlTagNode extends BaseNode {
|
||||
type: NodeType.HTML_TAG;
|
||||
name: string;
|
||||
attributes: Record<string, any>;
|
||||
conditionalAttributes?: ConditionalAttributeNode[];
|
||||
children: ASTNode[];
|
||||
selfClosing: boolean;
|
||||
preserveWhitespace?: boolean;
|
||||
}
|
||||
export type ASTNode = ProgramNode | ComponentDefinitionNode | ComponentInvocationNode | HtmlTagNode | TextNode | ExpressionNode | IfStatementNode | ForStatementNode | CodeBlockNode | FragmentNode | SlotNode;
|
||||
export type ASTNode = ProgramNode | ComponentDefinitionNode | ComponentInvocationNode | HtmlTagNode | TextNode | ExpressionNode | IfStatementNode | ForStatementNode | CodeBlockNode | FragmentNode | SlotNode | ConditionalAttributeNode;
|
||||
export declare function createNode<T extends ASTNode>(type: T['type'], props: Omit<T, 'type' | keyof BaseNode>, start: number, end: number, line: number, column: number, loc?: SourceLocation): T;
|
||||
//# sourceMappingURL=ast.d.ts.map
|
||||
2
node_modules/@jqhtml/parser/dist/ast.d.ts.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/ast.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,oBAAoB,wBAAwB;IAC5C,oBAAoB,wBAAwB;IAC5C,QAAQ,YAAY;IACpB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,YAAY,gBAAgB;IAC5B,aAAa,i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,EAAE,GAAG,CAAC,CAAC;IAChC,qBAAqB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnD,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAGD,MAAM,MAAM,OAAO,GACf,WAAW,GACX,uBAAuB,GACvB,uBAAuB,GACvB,WAAW,GACX,QAAQ,GACR,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,wBAAwB,CAAC;AAG7B,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EACf,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,QAAQ,CAAC,EACvC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,cAAc,GACnB,CAAC,CAUH"}
|
||||
3
node_modules/@jqhtml/parser/dist/ast.js
generated
vendored
3
node_modules/@jqhtml/parser/dist/ast.js
generated
vendored
@@ -12,7 +12,8 @@ export var NodeType;
|
||||
NodeType["FOR_STATEMENT"] = "ForStatement";
|
||||
NodeType["CODE_BLOCK"] = "CodeBlock";
|
||||
NodeType["FRAGMENT"] = "Fragment";
|
||||
NodeType["SLOT"] = "Slot"; // v2 slot syntax
|
||||
NodeType["SLOT"] = "Slot";
|
||||
NodeType["CONDITIONAL_ATTRIBUTE"] = "ConditionalAttribute"; // Conditional attribute: <% if (cond) { %>attr="val"<% } %>
|
||||
})(NodeType || (NodeType = {}));
|
||||
// Helper to create nodes with common properties
|
||||
export function createNode(type, props, start, end, line, column, loc) {
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/ast.js.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/ast.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AAIpD,MAAM,CAAN,IAAY,QAYX;AAZD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,wDAA4C,CAAA;IAC5C,wDAA4C,CAAA;IAC5C,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,wCAA4B,CAAA;IAC5B,0CAA8B,CAAA;IAC9B,oCAAwB,CAAA;IACxB,iCAAqB,CAAA;IACrB,yBAAa,CAAA,CAAE,iBAAiB;AAClC,CAAC,EAZW,QAAQ,KAAR,QAAQ,QAYnB;AAiHD,gDAAgD;AAChD,MAAM,UAAU,UAAU,CACxB,IAAe,EACf,KAAuC,EACvC,KAAa,EACb,GAAW,EACX,IAAY,EACZ,MAAc,EACd,GAAoB;IAEpB,OAAO;QACL,IAAI;QACJ,KAAK;QACL,GAAG;QACH,IAAI;QACJ,MAAM;QACN,GAAG;QACH,GAAG,KAAK;KACJ,CAAC;AACT,CAAC"}
|
||||
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AAIpD,MAAM,CAAN,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,wDAA4C,CAAA;IAC5C,wDAA4C,CAAA;IAC5C,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,wCAA4B,CAAA;IAC5B,0CAA8B,CAAA;IAC9B,oCAAwB,CAAA;IACxB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,0DAA8C,CAAA,CAAE,4DAA4D;AAC9G,CAAC,EAbW,QAAQ,KAAR,QAAQ,QAanB;AA4HD,gDAAgD;AAChD,MAAM,UAAU,UAAU,CACxB,IAAe,EACf,KAAuC,EACvC,KAAa,EACb,GAAW,EACX,IAAY,EACZ,MAAc,EACd,GAAoB;IAEpB,OAAO;QACL,IAAI;QACJ,KAAK;QACL,GAAG;QACH,IAAI;QACJ,MAAM;QACN,GAAG;QACH,GAAG,KAAK;KACJ,CAAC;AACT,CAAC"}
|
||||
11
node_modules/@jqhtml/parser/dist/codegen.d.ts
generated
vendored
11
node_modules/@jqhtml/parser/dist/codegen.d.ts
generated
vendored
@@ -20,6 +20,7 @@ export declare class CodeGenerator {
|
||||
private current_component;
|
||||
private in_slot;
|
||||
private tag_depth;
|
||||
private lastOutput;
|
||||
private outputLine;
|
||||
private outputColumn;
|
||||
private sourceMapGenerator?;
|
||||
@@ -46,6 +47,15 @@ export declare class CodeGenerator {
|
||||
*/
|
||||
private generate_function_body_1to1;
|
||||
private generate_node;
|
||||
/**
|
||||
* Padded trim: Collapse internal whitespace but preserve leading/trailing space
|
||||
* Examples:
|
||||
* " hello " → " hello "
|
||||
* "hello" → "hello"
|
||||
* " " → " "
|
||||
* "\n\n \n" → " "
|
||||
*/
|
||||
private padded_trim;
|
||||
private generate_text;
|
||||
private generate_expression;
|
||||
private generate_if;
|
||||
@@ -55,6 +65,7 @@ export declare class CodeGenerator {
|
||||
private generate_html_tag;
|
||||
private generate_component_invocation;
|
||||
private parse_attributes;
|
||||
private generate_attributes_with_conditionals;
|
||||
private generate_attributes_object;
|
||||
private is_self_closing_tag;
|
||||
private compile_interpolated_value;
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/codegen.d.ts.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/codegen.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,WAAW,EAUZ,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,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U,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,CAGrG"}
|
||||
270
node_modules/@jqhtml/parser/dist/codegen.js
generated
vendored
270
node_modules/@jqhtml/parser/dist/codegen.js
generated
vendored
@@ -10,6 +10,7 @@ export class CodeGenerator {
|
||||
current_component = null;
|
||||
in_slot = false;
|
||||
tag_depth = 0;
|
||||
lastOutput = ''; // Track last generated output for deduplication
|
||||
// Position tracking for source maps
|
||||
outputLine = 1;
|
||||
outputColumn = 0;
|
||||
@@ -178,6 +179,7 @@ export class CodeGenerator {
|
||||
}
|
||||
generate_component(node) {
|
||||
this.current_component = node.name;
|
||||
this.lastOutput = ''; // Reset output tracking for each component
|
||||
const dependencies = new Set();
|
||||
// Always use 1:1 line mapping for proper sourcemaps
|
||||
// Even when using SourceMapGenerator, we need the line structure
|
||||
@@ -234,8 +236,11 @@ export class CodeGenerator {
|
||||
slots[slotNode.name] = slotNode;
|
||||
}
|
||||
}
|
||||
// Filter out TEXT nodes (whitespace) from slot-only templates
|
||||
// TEXT nodes cause _output.push() calls which are invalid in slot-only context
|
||||
const slotsOnly = node.body.filter(child => child.type === NodeType.SLOT);
|
||||
// Use 1:1 line mapping for slot-only templates
|
||||
const bodyLines = this.generate_function_body_1to1(node.body);
|
||||
const bodyLines = this.generate_function_body_1to1(slotsOnly);
|
||||
// Build the render function with line preservation
|
||||
const lines = [];
|
||||
// Line 1: function declaration returning slots object
|
||||
@@ -387,39 +392,89 @@ export class CodeGenerator {
|
||||
// Generate code based on node type
|
||||
switch (node.type) {
|
||||
case NodeType.HTML_TAG: {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
const tag = node;
|
||||
// Opening tag goes on its line
|
||||
const openTag = this.generate_tag_open(tag);
|
||||
if (openTag) {
|
||||
lines[lineIndex] = (lines[lineIndex] || '') + openTag;
|
||||
// Check if this is a raw content tag (textarea, pre)
|
||||
if (tag.preserveWhitespace && !tag.selfClosing && tag.children && tag.children.length > 0) {
|
||||
// Validate: only TEXT, EXPRESSION, and CODE_BLOCK children allowed in raw content tags
|
||||
// HTML tags and components are not allowed (they would break whitespace preservation)
|
||||
for (const child of tag.children) {
|
||||
if (child.type !== NodeType.TEXT &&
|
||||
child.type !== NodeType.EXPRESSION &&
|
||||
child.type !== NodeType.CODE_BLOCK) {
|
||||
const error = new JQHTMLParseError(`Invalid content in <${tag.name}> tag`, tag.line, tag.column || 0, this.sourceContent, this.sourceFile);
|
||||
error.suggestion =
|
||||
`\n\nAll content within <textarea> and <pre> tags must be plain text or expressions.\n` +
|
||||
`HTML tags and components are not allowed.\n\n` +
|
||||
`Allowed:\n` +
|
||||
` <textarea><%= this.data.value %></textarea> ← expressions OK\n` +
|
||||
` <textarea>plain text</textarea> ← plain text OK\n\n` +
|
||||
`Not allowed:\n` +
|
||||
` <textarea><div>content</div></textarea> ← HTML tags not OK\n` +
|
||||
` <textarea><MyComponent /></textarea> ← components not OK\n\n` +
|
||||
`This ensures proper whitespace preservation.`;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Generate rawtag instruction with raw content
|
||||
const attrs_obj = this.generate_attributes_with_conditionals(tag.attributes, tag.conditionalAttributes);
|
||||
// Collect raw content from children (all validated as TEXT)
|
||||
let rawContent = '';
|
||||
for (const child of tag.children) {
|
||||
rawContent += child.content;
|
||||
}
|
||||
// Escape the raw content for JavaScript string
|
||||
const escapedContent = this.escape_string(rawContent);
|
||||
const rawtagInstruction = `_output.push({rawtag: ["${tag.name}", ${attrs_obj}, ${escapedContent}]});`;
|
||||
lines[lineIndex] = (lines[lineIndex] || '') + rawtagInstruction;
|
||||
}
|
||||
// Process children
|
||||
if (tag.children) {
|
||||
tag.children.forEach(processNodeForLine);
|
||||
}
|
||||
// Closing tag might be on a different line
|
||||
const closeTag = `_output.push("</${tag.name}>");`;
|
||||
// For simplicity, put closing tag on the last child's line or same line
|
||||
const closeLine = tag.children && tag.children.length > 0
|
||||
? (tag.children[tag.children.length - 1].line || node.line)
|
||||
: node.line;
|
||||
const closeIndex = closeLine - 2;
|
||||
if (closeIndex >= 0 && closeIndex < lines.length) {
|
||||
lines[closeIndex] = (lines[closeIndex] || '') + ' ' + closeTag;
|
||||
else {
|
||||
// Normal HTML tag processing
|
||||
// Opening tag goes on its line
|
||||
const openTag = this.generate_tag_open(tag);
|
||||
if (openTag) {
|
||||
lines[lineIndex] = (lines[lineIndex] || '') + openTag;
|
||||
}
|
||||
// Process children
|
||||
if (tag.children) {
|
||||
tag.children.forEach(processNodeForLine);
|
||||
}
|
||||
// Closing tag might be on a different line
|
||||
const closeTag = `_output.push("</${tag.name}>");`;
|
||||
// For simplicity, put closing tag on the last child's line or same line
|
||||
const closeLine = tag.children && tag.children.length > 0
|
||||
? (tag.children[tag.children.length - 1].line || node.line)
|
||||
: node.line;
|
||||
const closeIndex = closeLine - 2;
|
||||
if (closeIndex >= 0 && closeIndex < lines.length) {
|
||||
lines[closeIndex] = (lines[closeIndex] || '') + ' ' + closeTag;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NodeType.TEXT: {
|
||||
const text = node;
|
||||
// Only generate code for non-whitespace text
|
||||
if (text.content.trim()) {
|
||||
const code = `_output.push(${this.escape_string(text.content)});`;
|
||||
// Apply padded trim to preserve intentional whitespace
|
||||
const processed = this.padded_trim(text.content);
|
||||
if (processed) {
|
||||
const code = `_output.push(${this.escape_string(processed)});`;
|
||||
// Optimization: skip consecutive identical space pushes
|
||||
if (code === '_output.push(" ");' && this.lastOutput === '_output.push(" ");') {
|
||||
// Skip duplicate - don't add to output
|
||||
break;
|
||||
}
|
||||
this.lastOutput = code; // Track for next comparison
|
||||
lines[lineIndex] = (lines[lineIndex] || '') + ' ' + code;
|
||||
}
|
||||
// Whitespace-only text nodes don't generate code but preserve line positioning
|
||||
else {
|
||||
// Empty text resets tracking so next space won't be skipped
|
||||
this.lastOutput = '';
|
||||
}
|
||||
// Empty after processing: skip (no code generated)
|
||||
break;
|
||||
}
|
||||
case NodeType.CODE_BLOCK: {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
const codeBlock = node;
|
||||
const code = this.generate_code_block(codeBlock);
|
||||
if (code) {
|
||||
@@ -440,11 +495,16 @@ export class CodeGenerator {
|
||||
break;
|
||||
}
|
||||
case NodeType.EXPRESSION: {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
const expr = node;
|
||||
// Generate the expression wrapper on a single line
|
||||
let code;
|
||||
// Special handling for content() calls
|
||||
const trimmedCode = expr.code.trim();
|
||||
// Strip trailing semicolon if present (optional in <%= %> blocks)
|
||||
let trimmedCode = expr.code.trim();
|
||||
if (trimmedCode.endsWith(';')) {
|
||||
trimmedCode = trimmedCode.slice(0, -1).trim();
|
||||
}
|
||||
if (trimmedCode === 'content()') {
|
||||
// Default slot/content - check _inner_html first
|
||||
code = `(() => { if (this.args._inner_html) { _output.push(this.args._inner_html); } else if (typeof content === 'function') { const [contentInstructions] = content.call(this); _output.push(['_content', contentInstructions]); } })();`;
|
||||
@@ -456,17 +516,8 @@ export class CodeGenerator {
|
||||
}
|
||||
else if (trimmedCode.match(/^content\s*\(\s*['"]([^'"]+)['"]\s*(?:,\s*(.+?))?\s*\)$/)) {
|
||||
// Named slot: content('header') or content('header', data) (function call with string parameter and optional data)
|
||||
const match = trimmedCode.match(/^content\s*\(\s*['"]([^'"]+)['"]\s*(?:,\s*(.+?))?\s*\)$/);
|
||||
const slotName = match[1];
|
||||
const dataParam = match[2];
|
||||
if (dataParam) {
|
||||
// With data parameter: content('row', record) -> pass data to slot function
|
||||
code = `(() => { if (typeof content === 'object' && typeof content.${slotName} === 'function') { const [contentInstructions] = content.${slotName}.call(this, ${dataParam}); _output.push(['_content', contentInstructions]); } })();`;
|
||||
}
|
||||
else {
|
||||
// Without data parameter: content('header') -> pass undefined
|
||||
code = `(() => { if (typeof content === 'object' && typeof content.${slotName} === 'function') { const [contentInstructions] = content.${slotName}.call(this); _output.push(['_content', contentInstructions]); } })();`;
|
||||
}
|
||||
// Use the standard result pattern for proper handling
|
||||
code = `(() => { const result = ${trimmedCode};; if (Array.isArray(result)) { if (result.length === 2 && Array.isArray(result[0])) { _output.push(...result[0]); } else { _output.push(...result); } } else { _output.push(jqhtml.escape_html(result)); } })();`;
|
||||
}
|
||||
else if (expr.escaped) {
|
||||
code = `(() => { const result = ${expr.code}; if (Array.isArray(result)) { if (result.length === 2 && Array.isArray(result[0])) { _output.push(...result[0]); } else { _output.push(...result); } } else { _output.push(jqhtml.escape_html(result)); } })();`;
|
||||
@@ -481,9 +532,10 @@ export class CodeGenerator {
|
||||
break;
|
||||
}
|
||||
case NodeType.COMPONENT_INVOCATION: {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
const comp = node;
|
||||
// For 1:1 mapping, generate compact component invocations
|
||||
const attrs = this.generate_attributes_object(comp.attributes);
|
||||
const attrs = this.generate_attributes_with_conditionals(comp.attributes, comp.conditionalAttributes);
|
||||
if (comp.selfClosing || comp.children.length === 0) {
|
||||
// Simple component without children
|
||||
const code = `_output.push({comp: ["${comp.name}", ${attrs}]});`;
|
||||
@@ -621,15 +673,44 @@ export class CodeGenerator {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Padded trim: Collapse internal whitespace but preserve leading/trailing space
|
||||
* Examples:
|
||||
* " hello " → " hello "
|
||||
* "hello" → "hello"
|
||||
* " " → " "
|
||||
* "\n\n \n" → " "
|
||||
*/
|
||||
padded_trim(text) {
|
||||
const has_leading_space = /^\s/.test(text);
|
||||
const has_trailing_space = /\s$/.test(text);
|
||||
// Trim the text
|
||||
let result = text.trim();
|
||||
// Add back single space if original had leading/trailing whitespace
|
||||
if (has_leading_space)
|
||||
result = ' ' + result;
|
||||
if (has_trailing_space)
|
||||
result = result + ' ';
|
||||
// Final pass: collapse all whitespace sequences to single space
|
||||
return result.replace(/\s+/g, ' ');
|
||||
}
|
||||
generate_text(node) {
|
||||
const content = node.content;
|
||||
// Skip empty text nodes (just whitespace)
|
||||
if (content.trim() === '') {
|
||||
// Apply padded trim to preserve intentional whitespace
|
||||
const processed = this.padded_trim(content);
|
||||
// Skip if empty after processing
|
||||
if (!processed) {
|
||||
return '';
|
||||
}
|
||||
// Plain text - escape for JavaScript string
|
||||
const escaped = this.escape_string(content);
|
||||
// Generate output code
|
||||
const escaped = this.escape_string(processed);
|
||||
const output = `_output.push(${escaped});`;
|
||||
// Optimization: skip consecutive identical space pushes (but never skip newlines)
|
||||
if (output === '_output.push(" ");' && this.lastOutput === '_output.push(" ");') {
|
||||
return ''; // Skip duplicate space push
|
||||
}
|
||||
// Track this output for next comparison
|
||||
this.lastOutput = output;
|
||||
// Track the emitted position with source mapping
|
||||
if (this.enablePositionTracking) {
|
||||
this.emit(output, node);
|
||||
@@ -637,9 +718,14 @@ export class CodeGenerator {
|
||||
return output;
|
||||
}
|
||||
generate_expression(node) {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
let output;
|
||||
// Special handling for content() calls
|
||||
const trimmedCode = node.code.trim();
|
||||
// Strip trailing semicolon if present (optional in <%= %> blocks)
|
||||
let trimmedCode = node.code.trim();
|
||||
if (trimmedCode.endsWith(';')) {
|
||||
trimmedCode = trimmedCode.slice(0, -1).trim();
|
||||
}
|
||||
if (trimmedCode === 'content()') {
|
||||
// Default slot/content - check _inner_html first
|
||||
output = `(() => { if (this.args._inner_html) { _output.push(this.args._inner_html); } else if (typeof content === 'function') { const [contentInstructions] = content.call(this); _output.push(['_content', contentInstructions]); } })();`;
|
||||
@@ -651,17 +737,8 @@ export class CodeGenerator {
|
||||
}
|
||||
else if (trimmedCode.match(/^content\s*\(\s*['"]([^'"]+)['"]\s*(?:,\s*(.+?))?\s*\)$/)) {
|
||||
// Named slot: content('header') or content('header', data) (function call with string parameter and optional data)
|
||||
const match = trimmedCode.match(/^content\s*\(\s*['"]([^'"]+)['"]\s*(?:,\s*(.+?))?\s*\)$/);
|
||||
const slotName = match[1];
|
||||
const dataParam = match[2];
|
||||
if (dataParam) {
|
||||
// With data parameter: content('row', record) -> pass data to slot function
|
||||
output = `(() => { if (typeof content === 'object' && typeof content.${slotName} === 'function') { const [contentInstructions] = content.${slotName}.call(this, ${dataParam}); _output.push(['_content', contentInstructions]); } })();`;
|
||||
}
|
||||
else {
|
||||
// Without data parameter: content('header') -> pass undefined
|
||||
output = `(() => { if (typeof content === 'object' && typeof content.${slotName} === 'function') { const [contentInstructions] = content.${slotName}.call(this); _output.push(['_content', contentInstructions]); } })();`;
|
||||
}
|
||||
// Use the standard result pattern for proper handling
|
||||
output = `(() => { const result = ${trimmedCode};; if (Array.isArray(result)) { if (result.length === 2 && Array.isArray(result[0])) { _output.push(...result[0]); } else { _output.push(...result); } } else { _output.push(jqhtml.escape_html(result)); } })();`;
|
||||
}
|
||||
else if (node.escaped) {
|
||||
// Single-line expression handler for escaped output
|
||||
@@ -819,15 +896,48 @@ export class CodeGenerator {
|
||||
}
|
||||
generate_tag_open(node) {
|
||||
// Generate just the opening tag
|
||||
const attrs = this.generate_attributes_object(node.attributes);
|
||||
const attrs = this.generate_attributes_with_conditionals(node.attributes, node.conditionalAttributes);
|
||||
return `_output.push({tag: ["${node.name}", ${attrs}, ${node.selfClosing || false}]});`;
|
||||
}
|
||||
generate_html_tag(node) {
|
||||
// Generate opening tag, children, and closing tag on same line
|
||||
// This keeps related content together
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
// Check if this tag needs raw content preservation
|
||||
if (node.preserveWhitespace && !node.selfClosing && node.children.length > 0) {
|
||||
// Validate: only TEXT, EXPRESSION, and CODE_BLOCK children allowed in raw content tags
|
||||
// HTML tags and components are not allowed (they would break whitespace preservation)
|
||||
for (const child of node.children) {
|
||||
if (child.type !== NodeType.TEXT &&
|
||||
child.type !== NodeType.EXPRESSION &&
|
||||
child.type !== NodeType.CODE_BLOCK) {
|
||||
const error = new JQHTMLParseError(`Invalid content in <${node.name}> tag`, node.line, node.column || 0, this.sourceContent, this.sourceFile);
|
||||
error.suggestion =
|
||||
`\n\nAll content within <textarea> and <pre> tags must be plain text or expressions.\n` +
|
||||
`HTML tags and components are not allowed.\n\n` +
|
||||
`Allowed:\n` +
|
||||
` <textarea><%= this.data.value %></textarea> ← expressions OK\n` +
|
||||
` <textarea>plain text</textarea> ← plain text OK\n\n` +
|
||||
`Not allowed:\n` +
|
||||
` <textarea><div>content</div></textarea> ← HTML tags not OK\n` +
|
||||
` <textarea><MyComponent /></textarea> ← components not OK\n\n` +
|
||||
`This ensures proper whitespace preservation.`;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Generate rawtag instruction with raw content
|
||||
const attrs_obj = this.generate_attributes_with_conditionals(node.attributes, node.conditionalAttributes);
|
||||
// Collect raw content from children (all validated as TEXT)
|
||||
let rawContent = '';
|
||||
for (const child of node.children) {
|
||||
rawContent += child.content;
|
||||
}
|
||||
// Escape the raw content for JavaScript string
|
||||
const escapedContent = this.escape_string(rawContent);
|
||||
return `_output.push({rawtag: ["${node.name}", ${attrs_obj}, ${escapedContent}]});`;
|
||||
}
|
||||
// Normal tag generation
|
||||
const parts = [];
|
||||
// Generate opening tag instruction
|
||||
const attrs_obj = this.generate_attributes_object(node.attributes);
|
||||
const attrs_obj = this.generate_attributes_with_conditionals(node.attributes, node.conditionalAttributes);
|
||||
parts.push(`_output.push({tag: ["${node.name}", ${attrs_obj}, ${node.selfClosing}]});`);
|
||||
if (!node.selfClosing) {
|
||||
// Generate children inline
|
||||
@@ -849,8 +959,9 @@ export class CodeGenerator {
|
||||
return parts.join(' ');
|
||||
}
|
||||
generate_component_invocation(node) {
|
||||
this.lastOutput = ''; // Reset for non-text output
|
||||
const instructions = [];
|
||||
const attrs_obj = this.generate_attributes_object(node.attributes);
|
||||
const attrs_obj = this.generate_attributes_with_conditionals(node.attributes, node.conditionalAttributes);
|
||||
if (node.selfClosing || node.children.length === 0) {
|
||||
// Simple component without children
|
||||
const componentCall = `_output.push({comp: ["${node.name}", ${attrs_obj}]});`;
|
||||
@@ -902,6 +1013,23 @@ export class CodeGenerator {
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
// Generate attribute object including conditional attributes
|
||||
generate_attributes_with_conditionals(attrs, conditionalAttrs) {
|
||||
// If no conditional attributes, use simple object
|
||||
if (!conditionalAttrs || conditionalAttrs.length === 0) {
|
||||
return this.generate_attributes_object(attrs);
|
||||
}
|
||||
// We have conditional attributes - need to merge them at runtime
|
||||
const baseAttrs = this.generate_attributes_object(attrs);
|
||||
// Generate code that conditionally adds attributes
|
||||
let result = baseAttrs;
|
||||
for (const condAttr of conditionalAttrs) {
|
||||
const condAttrsObj = this.generate_attributes_object(condAttr.attributes);
|
||||
// Use Object.assign to merge conditional attributes
|
||||
result = `Object.assign({}, ${result}, (${condAttr.condition}) ? ${condAttrsObj} : {})`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
generate_attributes_object(attrs) {
|
||||
if (Object.keys(attrs).length === 0) {
|
||||
return '{}';
|
||||
@@ -909,11 +1037,14 @@ export class CodeGenerator {
|
||||
const entries = Object.entries(attrs).flatMap(([key, value]) => {
|
||||
// Convert 'tag' to '_tag' for component invocations
|
||||
const attrKey = key === 'tag' ? '_tag' : key;
|
||||
// Special handling for id attribute - append _cid for scoping
|
||||
if (key === 'id') {
|
||||
// Special handling for data-id attribute (from $id) - create scoped id
|
||||
// NOTE: Parser converts $id="foo" → data-id="foo" so we can distinguish from regular id
|
||||
// This generates: id="foo:PARENT_CID" data-id="foo"
|
||||
// The :PARENT_CID scoping happens at runtime in instruction-processor.ts
|
||||
if (key === 'data-id') {
|
||||
const id_entries = [];
|
||||
if (value && typeof value === 'object' && value.interpolated) {
|
||||
// Interpolated ID like id="user<%= index %>"
|
||||
// Interpolated $id like $id="user<%= index %>"
|
||||
const parts = value.parts.map((part) => {
|
||||
if (part.type === 'text') {
|
||||
return this.escape_string(part.value);
|
||||
@@ -927,19 +1058,29 @@ export class CodeGenerator {
|
||||
id_entries.push(`"data-id": ${base_id}`);
|
||||
}
|
||||
else if (value && typeof value === 'object' && value.quoted) {
|
||||
// Quoted ID like $id="static"
|
||||
// Quoted $id like $id="static"
|
||||
const base_id = this.escape_string(value.value);
|
||||
id_entries.push(`"id": ${base_id} + ":" + this._cid`);
|
||||
id_entries.push(`"data-id": ${base_id}`);
|
||||
}
|
||||
else {
|
||||
// Simple ID like id="username" or expression like $id=someVar
|
||||
// Simple $id like $id="username" or expression like $id=someVar
|
||||
const base_id = this.escape_string(String(value));
|
||||
id_entries.push(`"id": ${base_id} + ":" + this._cid`);
|
||||
id_entries.push(`"data-id": ${base_id}`);
|
||||
}
|
||||
return id_entries;
|
||||
}
|
||||
// Regular id attribute - pass through unchanged
|
||||
// id="foo" remains id="foo" (no scoping)
|
||||
if (key === 'id') {
|
||||
if (value && typeof value === 'object' && value.quoted) {
|
||||
return `"id": ${this.escape_string(value.value)}`;
|
||||
}
|
||||
else {
|
||||
return `"id": ${this.escape_string(String(value))}`;
|
||||
}
|
||||
}
|
||||
// Check if this is an interpolated attribute value
|
||||
if (value && typeof value === 'object' && value.interpolated) {
|
||||
// Build concatenation expression
|
||||
@@ -948,8 +1089,9 @@ export class CodeGenerator {
|
||||
return this.escape_string(part.value);
|
||||
}
|
||||
else {
|
||||
// Expression - no escaping in attributes
|
||||
return part.value;
|
||||
// Expression - wrap in parentheses to preserve operator precedence
|
||||
// This ensures "a" + (x ? 'b' : 'c') instead of "a" + x ? 'b' : 'c'
|
||||
return `(${part.value})`;
|
||||
}
|
||||
});
|
||||
return `"${attrKey}": ${parts.join(' + ')}`;
|
||||
@@ -1201,7 +1343,7 @@ export class CodeGenerator {
|
||||
for (const [name, component] of this.components) {
|
||||
code += `// Component: ${name}\n`;
|
||||
code += `jqhtml_components.set('${name}', {\n`;
|
||||
code += ` _jqhtml_version: '2.2.142',\n`; // Version will be replaced during build
|
||||
code += ` _jqhtml_version: '2.2.171',\n`; // Version will be replaced during build
|
||||
code += ` name: '${name}',\n`;
|
||||
code += ` tag: '${component.tagName}',\n`;
|
||||
code += ` defaultAttributes: ${this.serializeAttributeObject(component.defaultAttributes)},\n`;
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/codegen.js.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/codegen.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@jqhtml/parser/dist/errors.d.ts.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/errors.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAiB,SAAQ,KAAK;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAW;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM;IAgBnB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,cAAc;CAiCvB;AAGD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAQlB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAQlB;AAED,wBAAgB,WAAW,CACzB,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AAgB,CAQlB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAQlB;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAQlB;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiCnD;AAGD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,SAAS,CAAc;gBAEnB,SAAS,GAAE,MAAW;IAIlC,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAMlC,SAAS,IAAI,OAAO;IAIpB,SAAS,IAAI,gBAAgB,EAAE;IAI/B,aAAa,IAAI,IAAI;CAmBtB"}
|
||||
16
node_modules/@jqhtml/parser/dist/errors.js
generated
vendored
16
node_modules/@jqhtml/parser/dist/errors.js
generated
vendored
@@ -23,16 +23,14 @@ export class JQHTMLParseError extends Error {
|
||||
}
|
||||
buildErrorMessage(message) {
|
||||
let result = message;
|
||||
// Add suggestion if available
|
||||
if (this.suggestion) {
|
||||
result += this.suggestion;
|
||||
}
|
||||
// Add location info
|
||||
// Add location info IMMEDIATELY after message (required for RSpade parsing)
|
||||
// Format: "at filename:line:column" (RSpade regex: /at [^:]+:(\d+):(\d+)/i)
|
||||
if (this.filename) {
|
||||
result += `\n at ${this.filename}:${this.line}:${this.column}`;
|
||||
result += `\nat ${this.filename}:${this.line}:${this.column}`;
|
||||
}
|
||||
else {
|
||||
result += `\n at line ${this.line}, column ${this.column}`;
|
||||
// Fallback to generic format if no filename
|
||||
result += `\nat <unknown>:${this.line}:${this.column}`;
|
||||
}
|
||||
// Add code snippet if source is available
|
||||
if (this.source) {
|
||||
@@ -41,6 +39,10 @@ export class JQHTMLParseError extends Error {
|
||||
result += '\n\n' + snippet;
|
||||
}
|
||||
}
|
||||
// Add suggestion AFTER code snippet (don't interfere with parsing)
|
||||
if (this.suggestion) {
|
||||
result += this.suggestion;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getCodeSnippet() {
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/errors.js.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/errors.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,oDAAoD;AAEpD,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAClC,IAAI,CAAS;IACb,MAAM,CAAS;IACf,OAAO,CAAU;IACjB,SAAS,CAAU;IACnB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,QAAQ,GAAwB,OAAO,CAAC;IACxC,UAAU,CAAU;IAE3B,YACE,OAAe,EACf,IAAY,EACZ,MAAc,EACd,MAAe,EACf,QAAiB;QAEjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,uBAAuB;QACvB,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;QAEzC,4CAA4C;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAEO,iBAAiB,CAAC,OAAe;QACvC,IAAI,MAAM,GAAG,OAAO,CAAC;QA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C,SAAS,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAErC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QAED,8CAA8C;QAC9C,IAAI,OAAO,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,cAAc,CAAC;QAExD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACnC,OAAO,IAAI,SAAS,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,IAAI,CAAC;YACpD,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,IAAI,IAAI,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
||||
2
node_modules/@jqhtml/parser/dist/lexer.d.ts.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/lexer.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../src/lexer.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS;IAEnB,IAAI,SAAS;IAGb,gBAAgB,qBAAqB,CAAM,MAAM;IACjD,oBAAoB,yBAAyB,CAAE,OAAO;IACtD,UAAU,eAAe,CAAkB,KAAK;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AAC,cAAc;IA0CtB,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,SAAS;IA+CjB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,eAAe;IA6DvB,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,oBAAoB;IA2M5B,OAAO,CAAC,uBAAuB;IAuJ/B,OAAO,CAAC,6BAA6B;IAkBrC,OAAO,CAAC,4BAA4B;IAcpC,OAAO,CAAC,iCAAiC;CA+D1C"}
|
||||
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;
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/lexer.js.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/lexer.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5
node_modules/@jqhtml/parser/dist/parser.d.ts
generated
vendored
5
node_modules/@jqhtml/parser/dist/parser.d.ts
generated
vendored
@@ -7,6 +7,10 @@ export declare class Parser {
|
||||
private filename?;
|
||||
private static readonly VOID_ELEMENTS;
|
||||
constructor(tokens: Token[], source?: string, filename?: string);
|
||||
/**
|
||||
* Validate JavaScript code for common mistakes
|
||||
*/
|
||||
private validate_javascript_code;
|
||||
parse(): ProgramNode;
|
||||
private parse_top_level;
|
||||
private parse_component_definition;
|
||||
@@ -19,6 +23,7 @@ export declare class Parser {
|
||||
private parse_slot;
|
||||
private parse_tag;
|
||||
private parse_attributes;
|
||||
private parse_conditional_attribute;
|
||||
private parse_attribute_value;
|
||||
private check_closing_tag;
|
||||
private match;
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/parser.d.ts.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/parser.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAA6B,MAAM,YAAY,CAAC;AAC9D,OAAO,EAGL,WAAW,EASZ,MAAM,UAAU,CAAC;AAUlB,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAS;IAI1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAGlC;gBAES,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAO/D,KAAK,IAAI,WAAW;IA0EpB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,0BAA0B;IAqNlC,OAAO,CAAC,aAAa;IA6DrB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,kBAAkB;IA+G1B,OAAO,CAAC,mBAAmB;IAsD3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAW9C;IAGH,OAAO,CAAC,UAAU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,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,0BAA0B;IAqNlC,OAAO,CAAC,aAAa;IA6DrB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,gBAAgB;IAyCxB,OAAO,CAAC,kBAAkB;IA+G1B,OAAO,CAAC,mBAAmB;IAsD3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAW9C;IAGH,OAAO,CAAC,UAAU;IAmGlB,OAAO,CAAC,SAAS;IAgNjB,OAAO,CAAC,gBAAgB;IA6ExB,OAAO,CAAC,2BAA2B;IAqGnC,OAAO,CAAC,qBAAqB;IAuE7B,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAItB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,OAAO;IA4Cf,OAAO,CAAC,2BAA2B;IA+BnC;;;OAGG;IACH,OAAO,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE;CAkC7G"}
|
||||
147
node_modules/@jqhtml/parser/dist/parser.js
generated
vendored
147
node_modules/@jqhtml/parser/dist/parser.js
generated
vendored
@@ -2,7 +2,7 @@
|
||||
// Simple recursive descent parser, no complex libraries
|
||||
import { TokenType } from './lexer.js';
|
||||
import { NodeType, createNode } from './ast.js';
|
||||
import { unclosedError, mismatchedTagError, syntaxError, getSuggestion } from './errors.js';
|
||||
import { JQHTMLParseError, unclosedError, mismatchedTagError, syntaxError, getSuggestion } from './errors.js';
|
||||
import { CodeGenerator } from './codegen.js';
|
||||
export class Parser {
|
||||
tokens;
|
||||
@@ -20,6 +20,28 @@ export class Parser {
|
||||
this.source = source;
|
||||
this.filename = filename;
|
||||
}
|
||||
/**
|
||||
* Validate JavaScript code for common mistakes
|
||||
*/
|
||||
validate_javascript_code(code, token) {
|
||||
// Check for this.innerHTML usage (should use content() function instead)
|
||||
if (/\bthis\.innerHTML\b/.test(code)) {
|
||||
const error = new JQHTMLParseError(`Invalid usage: this.innerHTML is not available in JQHTML templates.\n` +
|
||||
`Did you mean to use the content() function instead?`, token.line, token.column, this.source);
|
||||
error.suggestion =
|
||||
`\nJQHTML uses content() to render child elements, not this.innerHTML:\n\n` +
|
||||
` ❌ Wrong: <%= this.innerHTML %>\n` +
|
||||
` ✓ Correct: <%= content() %>\n\n` +
|
||||
` ❌ Wrong: <% if (condition) { %> this.innerHTML <% } %>\n` +
|
||||
` ✓ Correct: <% if (condition) { %> <%= content() %> <% } %>\n\n` +
|
||||
`Why content() instead of this.innerHTML?\n` +
|
||||
`- content() is a function that returns the rendered child content\n` +
|
||||
`- this.innerHTML is a DOM property, not available during template compilation\n` +
|
||||
`- content() supports named slots: content('slot_name')\n` +
|
||||
`- content() can pass data: content('row', rowData)`;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Main entry point - parse tokens into AST
|
||||
parse() {
|
||||
const body = [];
|
||||
@@ -252,6 +274,8 @@ export class Parser {
|
||||
parse_expression() {
|
||||
const start_token = this.previous(); // EXPRESSION_START or EXPRESSION_UNESCAPED
|
||||
const code_token = this.consume(TokenType.JAVASCRIPT, 'Expected JavaScript code');
|
||||
// Validate JavaScript code for common mistakes
|
||||
this.validate_javascript_code(code_token.value, code_token);
|
||||
const end_token = this.consume(TokenType.TAG_END, 'Expected %>');
|
||||
return createNode(NodeType.EXPRESSION, {
|
||||
code: code_token.value,
|
||||
@@ -268,6 +292,10 @@ export class Parser {
|
||||
throw syntaxError('Unterminated code block - expected %>', start_token.line, start_token.column, this.source, this.filename);
|
||||
}
|
||||
const token = this.advance();
|
||||
// Validate JavaScript tokens for common mistakes
|
||||
if (token.type === TokenType.JAVASCRIPT) {
|
||||
this.validate_javascript_code(token.value, token);
|
||||
}
|
||||
tokens.push({ type: token.type, value: token.value });
|
||||
}
|
||||
const end_token = this.consume(TokenType.TAG_END, 'Expected %>');
|
||||
@@ -461,7 +489,7 @@ export class Parser {
|
||||
// Check if this is an HTML5 void element (only for HTML tags, not components)
|
||||
const is_void_element = !is_component && Parser.VOID_ELEMENTS.has(tag_lower);
|
||||
// Parse attributes
|
||||
const attributes = this.parse_attributes();
|
||||
const { attributes, conditionalAttributes } = this.parse_attributes();
|
||||
// Check for $redrawable attribute transformation
|
||||
// Transform <div $redrawable> to <Redrawable tag="div">
|
||||
if (attributes['$redrawable'] !== undefined || attributes['data-redrawable'] !== undefined) {
|
||||
@@ -471,7 +499,7 @@ export class Parser {
|
||||
// Store original tag name for closing tag matching
|
||||
original_tag_name = tag_name;
|
||||
// Add tag="original_tag_name" attribute
|
||||
attributes['data-tag'] = { quoted: true, value: tag_name };
|
||||
attributes['tag'] = { quoted: true, value: tag_name };
|
||||
// Transform tag name to Redrawable (reserved component name)
|
||||
tag_name = 'Redrawable';
|
||||
is_component = true; // Now it's a component
|
||||
@@ -483,6 +511,7 @@ export class Parser {
|
||||
return createNode(NodeType.COMPONENT_INVOCATION, {
|
||||
name: tag_name,
|
||||
attributes,
|
||||
conditionalAttributes: conditionalAttributes.length > 0 ? conditionalAttributes : undefined,
|
||||
children: [],
|
||||
selfClosing: true
|
||||
}, start_token.start, end_token.end, start_token.line, start_token.column, this.create_location(start_token, end_token));
|
||||
@@ -491,6 +520,7 @@ export class Parser {
|
||||
return createNode(NodeType.HTML_TAG, {
|
||||
name: tag_name,
|
||||
attributes,
|
||||
conditionalAttributes: conditionalAttributes.length > 0 ? conditionalAttributes : undefined,
|
||||
children: [],
|
||||
selfClosing: true
|
||||
}, start_token.start, end_token.end, start_token.line, start_token.column, this.create_location(start_token, end_token));
|
||||
@@ -508,6 +538,7 @@ export class Parser {
|
||||
return createNode(NodeType.HTML_TAG, {
|
||||
name: tag_name,
|
||||
attributes,
|
||||
conditionalAttributes: conditionalAttributes.length > 0 ? conditionalAttributes : undefined,
|
||||
children: [],
|
||||
selfClosing: true
|
||||
}, start_token.start, end_token.end, start_token.line, start_token.column, this.create_location(start_token, end_token));
|
||||
@@ -549,27 +580,54 @@ export class Parser {
|
||||
return createNode(NodeType.COMPONENT_INVOCATION, {
|
||||
name: tag_name,
|
||||
attributes,
|
||||
conditionalAttributes: conditionalAttributes.length > 0 ? conditionalAttributes : undefined,
|
||||
children,
|
||||
selfClosing: false
|
||||
}, start_token.start, end_token.end, start_token.line, start_token.column, this.create_location(start_token, end_token));
|
||||
}
|
||||
else {
|
||||
// Check if this tag needs whitespace preservation
|
||||
const tag_lower = tag_name.toLowerCase();
|
||||
const preserveWhitespace = tag_lower === 'textarea' || tag_lower === 'pre';
|
||||
return createNode(NodeType.HTML_TAG, {
|
||||
name: tag_name,
|
||||
attributes,
|
||||
conditionalAttributes: conditionalAttributes.length > 0 ? conditionalAttributes : undefined,
|
||||
children,
|
||||
selfClosing: false
|
||||
selfClosing: false,
|
||||
preserveWhitespace
|
||||
}, start_token.start, end_token.end, start_token.line, start_token.column, this.create_location(start_token, end_token));
|
||||
}
|
||||
}
|
||||
// Parse attributes from tokens
|
||||
parse_attributes() {
|
||||
const attributes = {};
|
||||
const conditionalAttributes = [];
|
||||
// Skip any leading newlines
|
||||
while (this.match(TokenType.NEWLINE)) {
|
||||
// Skip
|
||||
}
|
||||
while (this.check(TokenType.ATTR_NAME)) {
|
||||
while (this.check(TokenType.ATTR_NAME) || this.check(TokenType.CODE_START)) {
|
||||
// Check for conditional attribute: <% if (condition) { %>
|
||||
if (this.check(TokenType.CODE_START)) {
|
||||
// Check if this is a closing brace <% } %> - if so, stop parsing attributes
|
||||
// Peek ahead to see if the next token after CODE_START is a closing brace
|
||||
const peek_next = this.tokens[this.current + 1];
|
||||
if (peek_next && peek_next.type === TokenType.JAVASCRIPT && peek_next.value.trim() === '}') {
|
||||
// This is a closing brace, not a new conditional attribute
|
||||
// Stop parsing and return control to the caller
|
||||
break;
|
||||
}
|
||||
const condAttr = this.parse_conditional_attribute();
|
||||
if (condAttr) {
|
||||
conditionalAttributes.push(condAttr);
|
||||
}
|
||||
// Skip newlines after conditional attribute
|
||||
while (this.match(TokenType.NEWLINE)) {
|
||||
// Skip
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const name_token = this.advance();
|
||||
let name = name_token.value;
|
||||
let value = true; // Default for boolean attributes
|
||||
@@ -584,15 +642,11 @@ export class Parser {
|
||||
}
|
||||
// Handle special attribute prefixes
|
||||
if (name.startsWith('$')) {
|
||||
if (name === '$id') {
|
||||
// Special case: $id becomes regular id (will be scoped in codegen)
|
||||
name = 'id';
|
||||
}
|
||||
else {
|
||||
// General case: $property becomes data-property
|
||||
name = 'data-' + name.substring(1);
|
||||
// Keep the value object intact to preserve quoted/unquoted distinction
|
||||
}
|
||||
// General case: $property becomes data-property
|
||||
// This includes $id → data-id (for scoped IDs)
|
||||
// The distinction between data-id (scoped) and id (pass-through) is preserved
|
||||
name = 'data-' + name.substring(1);
|
||||
// Keep the value object intact to preserve quoted/unquoted distinction
|
||||
}
|
||||
else if (name.startsWith(':')) {
|
||||
// Property binding: :prop="value" becomes data-bind-prop
|
||||
@@ -612,7 +666,63 @@ export class Parser {
|
||||
// Skip
|
||||
}
|
||||
}
|
||||
return attributes;
|
||||
return { attributes, conditionalAttributes };
|
||||
}
|
||||
// Parse conditional attribute: <% if (condition) { %>attr="value"<% } %>
|
||||
parse_conditional_attribute() {
|
||||
const start_token = this.peek();
|
||||
// Consume <%
|
||||
this.consume(TokenType.CODE_START, 'Expected <%');
|
||||
let condition;
|
||||
// Two possibilities:
|
||||
// 1. Brace style: CODE_START → JAVASCRIPT "if (condition) {" → TAG_END
|
||||
// 2. Colon style: CODE_START → IF → JAVASCRIPT "(condition)" → TAG_END
|
||||
if (this.check(TokenType.JAVASCRIPT)) {
|
||||
// Brace style
|
||||
const jsToken = this.consume(TokenType.JAVASCRIPT, 'Expected if statement');
|
||||
const jsCode = jsToken.value.trim();
|
||||
// Verify it starts with 'if' and contains both ( and {
|
||||
if (!jsCode.startsWith('if')) {
|
||||
throw syntaxError('Only if statements are allowed in attribute context. Use <% if (condition) { %>attr="value"<% } %>', jsToken.line, jsToken.column, this.source);
|
||||
}
|
||||
// Extract condition from: if (condition) {
|
||||
const openParen = jsCode.indexOf('(');
|
||||
const closeBrace = jsCode.lastIndexOf('{');
|
||||
if (openParen === -1 || closeBrace === -1) {
|
||||
throw syntaxError('Expected format: <% if (condition) { %>', jsToken.line, jsToken.column, this.source);
|
||||
}
|
||||
// Extract just the condition part (between parens, including parens)
|
||||
condition = jsCode.substring(openParen, closeBrace).trim();
|
||||
}
|
||||
else if (this.check(TokenType.IF)) {
|
||||
// Colon style
|
||||
this.advance(); // consume 'if'
|
||||
const jsToken = this.consume(TokenType.JAVASCRIPT, 'Expected condition after if');
|
||||
condition = jsToken.value.trim();
|
||||
}
|
||||
else {
|
||||
// Not an if statement
|
||||
throw syntaxError('Only if statements are allowed in attribute context. Use <% if (condition) { %>attr="value"<% } %>', this.peek().line, this.peek().column, this.source);
|
||||
}
|
||||
// Consume %>
|
||||
this.consume(TokenType.TAG_END, 'Expected %>');
|
||||
// Now parse the attributes inside the conditional
|
||||
const innerAttrs = this.parse_attributes();
|
||||
// These should be plain attributes only (no nested conditionals)
|
||||
if (innerAttrs.conditionalAttributes.length > 0) {
|
||||
throw syntaxError('Nested conditional attributes are not supported', start_token.line, start_token.column, this.source);
|
||||
}
|
||||
// Consume <% } %>
|
||||
this.consume(TokenType.CODE_START, 'Expected <% to close conditional attribute');
|
||||
const closeToken = this.consume(TokenType.JAVASCRIPT, 'Expected }');
|
||||
if (closeToken.value.trim() !== '}') {
|
||||
throw syntaxError('Expected } to close if statement', closeToken.line, closeToken.column, this.source);
|
||||
}
|
||||
this.consume(TokenType.TAG_END, 'Expected %>');
|
||||
return createNode(NodeType.CONDITIONAL_ATTRIBUTE, {
|
||||
condition,
|
||||
attributes: innerAttrs.attributes
|
||||
}, start_token.start, this.previous().end, start_token.line, start_token.column);
|
||||
}
|
||||
// Parse potentially compound attribute value
|
||||
parse_attribute_value() {
|
||||
@@ -662,6 +772,13 @@ export class Parser {
|
||||
// Return as an identifier expression
|
||||
return { identifier: true, value: value };
|
||||
}
|
||||
// Check if it contains function calls (parentheses)
|
||||
// If the lexer allowed it (passed validation), treat it as an identifier/expression
|
||||
// Examples: getData(), obj.method(arg), rsx.route('A','B').url(123)
|
||||
if (value.includes('(') || value.includes(')')) {
|
||||
// Return as an identifier expression (function call chain)
|
||||
return { identifier: true, value: value };
|
||||
}
|
||||
// Otherwise, treat as a literal string value
|
||||
return value;
|
||||
}
|
||||
|
||||
2
node_modules/@jqhtml/parser/dist/parser.js.map
generated
vendored
2
node_modules/@jqhtml/parser/dist/parser.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@jqhtml/parser/package.json
generated
vendored
2
node_modules/@jqhtml/parser/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@jqhtml/parser",
|
||||
"version": "2.2.142",
|
||||
"version": "2.2.171",
|
||||
"description": "JQHTML template parser - converts templates to JavaScript",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
Reference in New Issue
Block a user