release: WRNexusJS 0.2.43

This commit is contained in:
2026-07-15 18:41:55 +05:30
parent 9070a1ef9c
commit 9aa13fb4db
55 changed files with 534 additions and 120 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ai",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"description": "Zero-dependency Claude (Anthropic) client for WrNexus apps.",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/authz",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/cli",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+9
View File
@@ -456,6 +456,15 @@ const MIGRATIONS: Migration[] = [
// No generated application files require automatic migration.
},
},
{
version: "0.2.43",
id: "conditions-bug",
description:
"Adds server-rendered component each/if blocks and fixes dynamic component rendering.",
apply() {
// No generated application files require automatic migration.
},
},
];
/** Release tooling uses this to require an explicit migration entry per version. */
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/compiler",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/core",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/csr",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+440 -35
View File
@@ -139,9 +139,40 @@ export const REACTIVE_RUNTIME = String.raw`
}
if (ch === "(" || ch === "[" || ch === "{") depth++;
else if (ch === ")" || ch === "]" || ch === "}") depth--;
else if ((ch === ";" || ch === "\n" || ch === "\r") && depth === 0) {
var part = input.slice(start, i).trim();
if (part) parts.push(part);
else if (
(
ch === ";" ||
ch === "\n" ||
ch === "\r"
) &&
depth === 0
) {
var nextIndex = i + 1;
while (
nextIndex < input.length &&
/\s/.test(input[nextIndex])
) {
nextIndex++;
}
if (
input.slice(
nextIndex,
nextIndex + 4,
) === "else"
) {
continue;
}
var part = input
.slice(start, i)
.trim();
if (part) {
parts.push(part);
}
start = i + 1;
}
}
@@ -387,34 +418,98 @@ export const REACTIVE_RUNTIME = String.raw`
});
}
function runStmt(stmt, locals) {
splitStatements(stmt).forEach(function (part) {
runStatement(
part,
function (expression) { return evalExpr(expression, locals); },
function runStmt(
source,
locals,
) {
var statements =
splitStatements(source);
for (
var statementIndex = 0;
statementIndex <
statements.length;
statementIndex++
) {
var result = runStatement(
statements[statementIndex],
function (expression) {
return evalExpr(
expression,
locals,
);
},
function (name) {
if (locals && Object.prototype.hasOwnProperty.call(locals, name)) return locals[name];
if (
locals &&
Object.prototype
.hasOwnProperty.call(
locals,
name,
)
) {
return locals[name];
}
return peekScope(name);
},
function (name, value) {
if (locals && Object.prototype.hasOwnProperty.call(locals, name)) {
if (
locals &&
Object.prototype
.hasOwnProperty.call(
locals,
name,
)
) {
locals[name] = value;
} else {
writeScope(name, value);
}
},
function (body) {
return runStmt(
body,
locals,
);
},
);
});
if (result.returned) {
return result;
}
}
return {
returned: false,
value: undefined,
};
}
function installBehaviorFunctions(source) {
extractBehaviorFunctions(source || "").forEach(function (definition) {
behaviorFunctions[definition.name] = function () {
behaviorFunctions[
definition.name
] = function () {
var locals = {};
for (var i = 0; i < definition.args.length; i++) {
locals[definition.args[i]] = arguments[i];
for (
var i = 0;
i < definition.args.length;
i++
) {
locals[definition.args[i]] =
arguments[i];
}
runStmt(definition.body, locals);
var result = runStmt(
definition.body,
locals,
);
return result.returned
? result.value
: undefined;
};
});
}
@@ -780,32 +875,342 @@ export const REACTIVE_RUNTIME = String.raw`
return initial;
}
function runStatement(stmt, evalExpr, read, write) {
function skipStatementWhitespace(
source,
index,
) {
while (
index < source.length &&
/\s/.test(source[index])
) {
index++;
}
return index;
}
function findClosingDelimiter(
source,
start,
opening,
closing,
) {
if (source[start] !== opening) {
return -1;
}
var depth = 1;
var quote = "";
var escaped = false;
for (
var index = start + 1;
index < source.length;
index++
) {
var character = source[index];
if (quote) {
if (escaped) {
escaped = false;
continue;
}
if (character === "\\") {
escaped = true;
continue;
}
if (character === quote) {
quote = "";
}
continue;
}
if (
character === '"' ||
character === "'" ||
character === "\`"
) {
quote = character;
continue;
}
if (character === opening) {
depth++;
continue;
}
if (character === closing) {
depth--;
if (depth === 0) {
return index;
}
}
}
return -1;
}
function parseIfStatement(source) {
source = String(source || "").trim();
if (
source.slice(0, 2) !== "if" ||
/[A-Za-z0-9_$]/.test(
source.charAt(2),
)
) {
return null;
}
var branches = [];
var index = 0;
while (index < source.length) {
index = skipStatementWhitespace(
source,
index,
);
var condition = null;
if (
source.slice(index, index + 2) ===
"if"
) {
index += 2;
} else if (
source.slice(index, index + 7) ===
"else if"
) {
index += 7;
} else if (
source.slice(index, index + 4) ===
"else"
) {
index += 4;
condition = null;
} else {
break;
}
index = skipStatementWhitespace(
source,
index,
);
if (
condition !== null ||
source.slice(
index - 4,
index,
) !== "else"
) {
if (source[index] !== "(") {
throw new Error(
"Expected '(' after if",
);
}
var conditionEnd =
findClosingDelimiter(
source,
index,
"(",
")",
);
if (conditionEnd < 0) {
throw new Error(
"Unclosed if condition",
);
}
condition = source
.slice(index + 1, conditionEnd)
.trim();
index = skipStatementWhitespace(
source,
conditionEnd + 1,
);
}
if (source[index] !== "{") {
throw new Error(
"Expected '{' after if condition",
);
}
var bodyEnd =
findClosingDelimiter(
source,
index,
"{",
"}",
);
if (bodyEnd < 0) {
throw new Error(
"Unclosed if body",
);
}
branches.push({
condition: condition,
body: source.slice(
index + 1,
bodyEnd,
),
});
index = skipStatementWhitespace(
source,
bodyEnd + 1,
);
if (
source.slice(index, index + 7) ===
"else if" ||
source.slice(index, index + 4) ===
"else"
) {
continue;
}
break;
}
return branches.length > 0
? branches
: null;
}
function runStatement(
stmt,
evalExpr,
read,
write,
runBlock,
) {
stmt = String(stmt || "").trim();
if (!stmt) return;
var inc = stmt.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*(\+\+|--)$/);
if (inc) {
write(inc[1], Number(read(inc[1]) || 0) + (inc[2] === "++" ? 1 : -1));
return;
if (!stmt) {
return {
returned: false,
value: undefined,
};
}
var assign = stmt.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*(\+=|-=|\*=|\/=|%=|=)\s*([\s\S]+)$/);
if (!assign) {
evalExpr(stmt); // bare expression statement (e.g. a method/function call)
return;
var returnMatch =
/^return(?:\s+([\s\S]+))?$/.exec(
stmt,
);
if (returnMatch) {
return {
returned: true,
value: returnMatch[1]
? evalExpr(returnMatch[1])
: undefined,
};
}
var name = assign[1];
var op = assign[2];
var next = evalExpr(assign[3]);
var current = read(name);
if (op === "+=") next = current + next;
else if (op === "-=") next = Number(current || 0) - Number(next || 0);
else if (op === "*=") next = Number(current || 0) * Number(next || 0);
else if (op === "/=") next = Number(current || 0) / Number(next || 0);
else if (op === "%=") next = Number(current || 0) % Number(next || 0);
write(name, next);
var ifBranches =
parseIfStatement(stmt);
if (ifBranches) {
for (
var branchIndex = 0;
branchIndex < ifBranches.length;
branchIndex++
) {
var branch =
ifBranches[branchIndex];
if (
branch.condition === null ||
!!evalExpr(branch.condition)
) {
return runBlock(branch.body);
}
}
return {
returned: false,
value: undefined,
};
}
var increment = stmt.match(
/^([A-Za-z_$][A-Za-z0-9_$]*)\s*(\+\+|--)$/,
);
if (increment) {
write(
increment[1],
Number(read(increment[1]) || 0) +
(increment[2] === "++"
? 1
: -1),
);
return {
returned: false,
value: undefined,
};
}
var assignment = stmt.match(
/^([A-Za-z_$][A-Za-z0-9_$]*)\s*(\+=|-=|\*=|\/=|%=|=)\s*([\s\S]+)$/,
);
if (!assignment) {
evalExpr(stmt);
return {
returned: false,
value: undefined,
};
}
var name = assignment[1];
var operator = assignment[2];
var nextValue =
evalExpr(assignment[3]);
var currentValue = read(name);
if (operator === "+=") {
nextValue =
currentValue + nextValue;
} else if (operator === "-=") {
nextValue =
Number(currentValue || 0) -
Number(nextValue || 0);
} else if (operator === "*=") {
nextValue =
Number(currentValue || 0) *
Number(nextValue || 0);
} else if (operator === "/=") {
nextValue =
Number(currentValue || 0) /
Number(nextValue || 0);
} else if (operator === "%=") {
nextValue =
Number(currentValue || 0) %
Number(nextValue || 0);
}
write(name, nextValue);
return {
returned: false,
value: nextValue,
};
}
function evaluateSpecialExpression(
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/db",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/dev-server",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/encryption",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/helpers",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"description": "Safe convenience helpers for WrNexus request contexts and common application flows.",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/i18n",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/jwt",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/mobile",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/native",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/oauth",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/pubsub",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/queue",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/reactive",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/router",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ssr",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/styles",
"version": "0.2.42",
"version": "0.2.43",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/test",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/tracking",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ui",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/uploader",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/validation",
"version": "0.2.42",
"version": "0.2.43",
"private": true,
"type": "module",
"main": "src/index.ts",