release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+8 -4
View File
@@ -1,5 +1,5 @@
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
import { basename, join } from "node:path";
import { join } from "node:path";
const uiRoot = join(import.meta.dirname, "..", "packages", "ui");
const componentsDir = join(uiRoot, "components");
@@ -45,10 +45,13 @@ function words(name) {
const components = readdirSync(componentsDir)
.filter((file) => file.endsWith(".wrn"))
.sort((a, b) => a.localeCompare(b))
.map((file) => {
const name = basename(file, ".wrn");
const source = readFileSync(join(componentsDir, file), "utf8");
const declaration = /^\s*component\s+([A-Za-z][A-Za-z0-9_]*)\b/m.exec(source);
if (!declaration) {
throw new Error(`UI component source does not declare a component: ${file}`);
}
const name = declaration[1];
const entry = metadata.get(name);
const slots = [...source.matchAll(/<slot(?:\s+name="([^"]+)")?/g)].map(
(match) => match[1] ?? "default",
@@ -78,7 +81,8 @@ const components = readdirSync(componentsDir)
events,
source: `components/${file}`,
};
});
})
.sort((left, right) => left.name.localeCompare(right.name));
writeFileSync(
join(uiRoot, "component-reference.json"),