refactor: optimize reactive variable updates and parsing
- Replace `scanDeclareBlocks` with `parseDeclareCsv` in block processor - Add error handling for declare block parsing - Optimize `ReactiveVariableManager` by pre-computing variable keys - Store template text and keys in data attributes for faster updates - Adjust `VariableView` popup width via CSS class
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
import { posix } from "path";
|
||||
import { createHash } from "crypto";
|
||||
import { scanDeclareBlocks, type VarDeclaration, type TagModifier } from "./declare-parser.js";
|
||||
import { parseDeclareCsv, type VarDeclaration, type TagModifier } from "./declare-parser.js";
|
||||
import {
|
||||
FENCED_BLOCK_RE,
|
||||
parseBlockAttrs,
|
||||
@@ -86,9 +86,13 @@ export function processBlocks(
|
||||
// ---- Dispatch by role ----
|
||||
|
||||
if (attrs.role === "declare") {
|
||||
const result = scanDeclareBlocks(_match, fileRelativePath);
|
||||
blocks.declarations.push(...result.variables);
|
||||
blocks.tagModifiers.push(...result.tagModifiers);
|
||||
try {
|
||||
const result = parseDeclareCsv(body, fileRelativePath);
|
||||
blocks.declarations.push(...result.variables);
|
||||
blocks.tagModifiers.push(...result.tagModifiers);
|
||||
} catch (e) {
|
||||
console.warn(`[block-processor] ${fileRelativePath}: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (attrs.role === "file") {
|
||||
|
||||
Reference in New Issue
Block a user