release: WRNexusJS 0.3.0

This commit is contained in:
2026-07-22 17:29:08 +05:30
parent 13dfa31d19
commit 07d8fb59d6
145 changed files with 9664 additions and 3881 deletions
+100 -33
View File
@@ -11,33 +11,34 @@ const VALID_TOP_LEVEL_KINDS = new Set(["page", "component", "layout"]);
const VALID_LIFECYCLE_HOOKS = new Set(["mount", "update", "unmount"]);
const ROOT_MEMBER_NAMES = [
"layout",
"runtime",
"hydrate",
"client",
"types",
"props",
"state",
"computed",
"effect",
"watch",
"lifecycle",
"view",
"seo",
"security",
"load",
"action",
"api",
"ssr",
"realtime",
"style",
"functions",
];
const VALID_MEMBERS = {
page: new Set([
"layout",
"state",
"types",
"view",
"seo",
"style",
"functions",
"api",
"ssr",
"client",
"realtime",
]),
component: new Set([
"types",
"props",
"state",
"view",
"style",
"functions",
"lifecycle",
"watch",
]),
layout: new Set(["types", "props", "state", "view", "style", "functions", "lifecycle", "watch"]),
page: new Set(ROOT_MEMBER_NAMES),
component: new Set(ROOT_MEMBER_NAMES),
layout: new Set(ROOT_MEMBER_NAMES),
};
function createDiagnostic(
@@ -544,21 +545,87 @@ function findRootMembers(source, bodyStart, bodyEnd) {
end: identifier.end,
});
if (identifier.name === "state" || identifier.name === "layout") {
const assignmentMembers = new Set(["layout", "runtime", "hydrate", "state"]);
if (assignmentMembers.has(identifier.name)) {
skipLine();
continue;
}
if (identifier.name === "watch") {
index = skipWhitespace(source, index, bodyEnd);
if (identifier.name === "client") {
const next = skipWhitespace(source, index, bodyEnd);
const watchedState = readIdentifier(source, index, bodyEnd);
if (watchedState) {
index = watchedState.end;
if (source[next] === "=") {
skipLine();
continue;
}
}
const blockMembers = new Set([
"types",
"props",
"computed",
"effect",
"watch",
"lifecycle",
"view",
"seo",
"security",
"load",
"action",
"api",
"ssr",
"client",
"realtime",
"style",
"functions",
]);
if (blockMembers.has(identifier.name)) {
let cursor = index;
let parenthesisDepth = 0;
let bracketDepth = 0;
let memberQuote = null;
let memberEscaped = false;
while (cursor < bodyEnd) {
const current = source[cursor];
if (memberQuote !== null) {
if (memberEscaped) {
memberEscaped = false;
} else if (current === "\\") {
memberEscaped = true;
} else if (current === memberQuote) {
memberQuote = null;
}
cursor += 1;
continue;
}
if (current === '"' || current === "'") {
memberQuote = current;
cursor += 1;
continue;
}
if (current === "(") parenthesisDepth += 1;
if (current === ")") parenthesisDepth = Math.max(0, parenthesisDepth - 1);
if (current === "[") bracketDepth += 1;
if (current === "]") bracketDepth = Math.max(0, bracketDepth - 1);
if (current === "{" && parenthesisDepth === 0 && bracketDepth === 0) {
index = cursor;
break;
}
cursor += 1;
}
if (cursor >= bodyEnd) index = bodyEnd;
}
continue;
}