release: WRNexusJS 0.2.40

This commit is contained in:
2026-07-15 14:02:27 +05:30
parent 7dfca4a190
commit 0006aef2c4
56 changed files with 203 additions and 150 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ai",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "Zero-dependency Claude (Anthropic) client for WrNexus apps.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/authz",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/authz — part of the WrNexus framework.",
"license": "MIT",
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/cli",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/cli — part of the WrNexus framework.",
"license": "MIT",
@@ -28,16 +28,16 @@
"wrnexus": "./dist/index.js"
},
"dependencies": {
"@wrnexus/core": "^0.2.39",
"@wrnexus/router": "^0.2.39",
"@wrnexus/csr": "^0.2.39",
"@wrnexus/compiler": "^0.2.39",
"@wrnexus/styles": "^0.2.39",
"@wrnexus/dev-server": "^0.2.39",
"@wrnexus/ui": "^0.2.39",
"@wrnexus/validation": "^0.2.39",
"@wrnexus/i18n": "^0.2.39",
"@wrnexus/db": "^0.2.39"
"@wrnexus/core": "^0.2.40",
"@wrnexus/router": "^0.2.40",
"@wrnexus/csr": "^0.2.40",
"@wrnexus/compiler": "^0.2.40",
"@wrnexus/styles": "^0.2.40",
"@wrnexus/dev-server": "^0.2.40",
"@wrnexus/ui": "^0.2.40",
"@wrnexus/validation": "^0.2.40",
"@wrnexus/i18n": "^0.2.40",
"@wrnexus/db": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/compiler",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/compiler — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/core",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/core — part of the WrNexus framework.",
"license": "MIT",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/csr",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/csr — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/db",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/db — part of the WrNexus framework.",
"license": "MIT",
+13 -13
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/dev-server",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/dev-server — part of the WrNexus framework.",
"license": "MIT",
@@ -25,18 +25,18 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39",
"@wrnexus/router": "^0.2.39",
"@wrnexus/ssr": "^0.2.39",
"@wrnexus/csr": "^0.2.39",
"@wrnexus/compiler": "^0.2.39",
"@wrnexus/styles": "^0.2.39",
"@wrnexus/ui": "^0.2.39",
"@wrnexus/validation": "^0.2.39",
"@wrnexus/i18n": "^0.2.39",
"@wrnexus/db": "^0.2.39",
"@wrnexus/pubsub": "^0.2.39",
"@wrnexus/uploader": "^0.2.39"
"@wrnexus/core": "^0.2.40",
"@wrnexus/router": "^0.2.40",
"@wrnexus/ssr": "^0.2.40",
"@wrnexus/csr": "^0.2.40",
"@wrnexus/compiler": "^0.2.40",
"@wrnexus/styles": "^0.2.40",
"@wrnexus/ui": "^0.2.40",
"@wrnexus/validation": "^0.2.40",
"@wrnexus/i18n": "^0.2.40",
"@wrnexus/db": "^0.2.40",
"@wrnexus/pubsub": "^0.2.40",
"@wrnexus/uploader": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/encryption",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/encryption — part of the WrNexus framework.",
"license": "MIT",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/helpers",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "Safe convenience helpers for WrNexus request contexts and common application flows.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/i18n",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/i18n — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/jwt",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/jwt — part of the WrNexus framework.",
"license": "MIT",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/mobile",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/mobile — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/native": "^0.2.39"
"@wrnexus/native": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/native",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/native — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/oauth",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/oauth — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/pubsub",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/pubsub — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/queue",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/queue — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/reactive",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/reactive — part of the WrNexus framework.",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/router",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/router — part of the WrNexus framework.",
"license": "MIT",
@@ -21,8 +21,8 @@
}
},
"dependencies": {
"@wrnexus/compiler": "^0.2.39",
"@wrnexus/core": "^0.2.39"
"@wrnexus/compiler": "^0.2.40",
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ssr",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/ssr — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/styles",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/styles — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/uploader": "^0.2.39"
"@wrnexus/uploader": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/test",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/test — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/tracking",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/tracking — part of the WrNexus framework.",
"license": "MIT",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ui",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/ui — part of the WrNexus framework.",
"license": "MIT",
@@ -22,7 +22,7 @@
"./ui.css": "./ui.css"
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/uploader",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/uploader — part of the WrNexus framework.",
"license": "MIT",
@@ -21,7 +21,7 @@
}
},
"dependencies": {
"@wrnexus/core": "^0.2.39"
"@wrnexus/core": "^0.2.40"
},
"files": [
"dist"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/validation",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"description": "@wrnexus/validation — part of the WrNexus framework.",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ai",
"version": "0.2.39",
"version": "0.2.40",
"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.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/cli",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/compiler",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/core",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/csr",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+75 -65
View File
@@ -816,35 +816,44 @@ export const REACTIVE_RUNTIME = String.raw`
expression || "",
).trim();
// Array literals containing spread:
//
// [...items, value]
// [first, ...others]
//
/*
* Array spread:
*
* [...openIndexes, index]
*/
if (
source.charAt(0) === "[" &&
source.charAt(source.length - 1) === "]" &&
source.charAt(
source.length - 1,
) === "]" &&
source.indexOf("...") !== -1
) {
var inner = source.slice(1, -1);
var parts = splitTopLevel(inner, ",");
var result = [];
var parts = splitTopLevel(
inner,
",",
);
var values = [];
parts.forEach(function (part) {
var valueSource = part.trim();
var item = part.trim();
if (
valueSource.indexOf("...") === 0
item.slice(0, 3) === "..."
) {
var spreadValue =
evaluateExpression(
valueSource.slice(3),
item.slice(3),
read,
);
if (Array.isArray(spreadValue)) {
if (
Array.isArray(spreadValue)
) {
Array.prototype.push.apply(
result,
values,
spreadValue,
);
}
@@ -852,9 +861,9 @@ export const REACTIVE_RUNTIME = String.raw`
return;
}
result.push(
values.push(
evaluateExpression(
valueSource,
item,
read,
),
);
@@ -862,71 +871,60 @@ export const REACTIVE_RUNTIME = String.raw`
return {
matched: true,
value: result,
value: values,
};
}
// Array callback methods:
//
// items.filter((item) => item !== value)
// items.map((item, index) => item.title)
// items.some((item) => item.active)
//
/*
* Array methods with expression callbacks:
*
* list.filter((item) => item !== value)
* list.map((item, index) => item.title)
*/
var callbackMatch =
/^([\s\S]+)\.(filter|map|some|every|find|findIndex)\(\s*\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*(?:,\s*([A-Za-z_$][A-Za-z0-9_$]*))?\s*\)\s*=>\s*([\s\S]+)\s*\)$/.exec(
/^([\s\S]+)\.(filter|map|some|every|find|findIndex)\(\s*(?:\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*(?:,\s*([A-Za-z_$][A-Za-z0-9_$]*))?\s*\)|([A-Za-z_$][A-Za-z0-9_$]*))\s*=>\s*([\s\S]+)\)$/.exec(
source,
);
if (!callbackMatch) {
callbackMatch =
/^([\s\S]+)\.(filter|map|some|every|find|findIndex)\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*=>\s*([\s\S]+)\s*\)$/.exec(
source,
);
if (callbackMatch) {
callbackMatch = [
callbackMatch[0],
callbackMatch[1],
callbackMatch[2],
callbackMatch[3],
undefined,
callbackMatch[4],
];
}
}
if (callbackMatch) {
var collection =
evaluateExpression(
callbackMatch[1],
callbackMatch[1].trim(),
read,
);
var method = callbackMatch[2];
var itemName = callbackMatch[3];
var indexName = callbackMatch[4];
var body = callbackMatch[5];
var itemName =
callbackMatch[3] ||
callbackMatch[5];
var indexName =
callbackMatch[4];
var callbackBody =
callbackMatch[6].trim();
if (!Array.isArray(collection)) {
collection = [];
}
var callback = function (
item,
index,
itemValue,
itemIndex,
) {
return evaluateExpression(
body,
callbackBody,
function (name) {
if (name === itemName) {
return item;
return itemValue;
}
if (
indexName &&
name === indexName
) {
return index;
return itemIndex;
}
return read(name);
@@ -934,22 +932,31 @@ export const REACTIVE_RUNTIME = String.raw`
);
};
var result;
if (method === "filter") {
result =
collection.filter(callback);
} else if (method === "map") {
result =
collection.map(callback);
} else if (method === "some") {
result =
collection.some(callback);
} else if (method === "every") {
result =
collection.every(callback);
} else if (method === "find") {
result =
collection.find(callback);
} else {
result =
collection.findIndex(callback);
}
return {
matched: true,
value:
method === "filter"
? collection.filter(callback)
: method === "map"
? collection.map(callback)
: method === "some"
? collection.some(callback)
: method === "every"
? collection.every(callback)
: method === "find"
? collection.find(callback)
: collection.findIndex(
callback,
),
value: result,
};
}
@@ -963,7 +970,10 @@ export const REACTIVE_RUNTIME = String.raw`
// 'unsafe-eval'). Supports: literals, identifiers, member access (a.b, a[b]),
// function/method calls, arrays, objects, arithmetic, comparison, equality,
// logical (&& ||), unary (! - +), and the ternary operator.
function evaluateExpression(expr, read) {
function evaluateExpression(
expr,
read,
) {
expr = String(expr || "").trim();
var special =
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/db",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/dev-server",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+36
View File
@@ -0,0 +1,36 @@
import { existsSync, rmSync } from "node:fs";
import { resolve } from "node:path";
export interface ResetDevCacheOptions {
rootDir?: string;
cacheDir?: string;
enabled?: boolean;
}
export function resetDevCache(options: ResetDevCacheOptions = {}): string {
const rootDir = resolve(options.rootDir ?? process.cwd());
const cacheDir = resolve(rootDir, options.cacheDir ?? ".wrnexus");
if (options.enabled === false) {
return cacheDir;
}
// Safety: never allow deleting the project root.
if (cacheDir === rootDir) {
throw new Error("Refusing to remove the project root as the WRNexus cache directory.");
}
if (existsSync(cacheDir)) {
rmSync(cacheDir, {
recursive: true,
force: true,
maxRetries: 3,
retryDelay: 100,
});
console.log(`[wrnexus] cleared generated cache: ${cacheDir}`);
}
return cacheDir;
}
+7
View File
@@ -29,6 +29,7 @@ import { createDevAssetServer } from "./assets.ts";
import { HmrHub } from "./hmr.ts";
import { startWatcher } from "./watch.ts";
export { RESTART_EXIT_CODE } from "./restart.ts";
import { resetDevCache } from "./cache.ts";
export interface ServeOptions {
appDir: string;
@@ -122,6 +123,12 @@ export async function startServer(opts: ServeOptions): Promise<RunningServer> {
const router = buildRouter(appDir, { componentDirs: [uiComponentsDir()] });
const styleEntry = opts.styleEntry ?? null;
const appRoot = dirname(appDir);
resetDevCache({
rootDir: appRoot,
enabled: process.env.WRNEXUS_PRESERVE_CACHE !== "1",
});
// Compile every `.wrn` into ONE cache dir at the project root, instead of a
// `.wrnexus/` next to each source file (and inside node_modules UI dirs).
setCompileCacheDir(join(appRoot, ".wrnexus"));
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/encryption",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/helpers",
"version": "0.2.39",
"version": "0.2.40",
"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.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/jwt",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/mobile",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/native",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/oauth",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/pubsub",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/queue",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/reactive",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/router",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ssr",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/styles",
"version": "0.2.39",
"version": "0.2.40",
"type": "module",
"main": "src/index.ts",
"exports": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/test",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/tracking",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/ui",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/uploader",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/validation",
"version": "0.2.39",
"version": "0.2.40",
"private": true,
"type": "module",
"main": "src/index.ts",
+1 -1
View File
@@ -1,7 +1,7 @@
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const version = "0.2.39";
const version = "0.2.40";
const dependencyGroups = [
"dependencies",