release: WRNexusJS 0.8.0
Quality / quality (ubuntu-latest) (push) Failing after 21s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-02 23:18:51 +05:30
parent 87507edf59
commit 586a6db8ff
625 changed files with 243608 additions and 11210 deletions
+40
View File
@@ -4,10 +4,41 @@ import { buildRouter, createRouteManifest, nameRoutes } from "@wrnexus/router";
import { createPluginRunner, discoverPlugins } from "@wrnexus/plugin";
import { loadAppConfig } from "@wrnexus/styles";
import { uiComponentsDir } from "@wrnexus/ui";
import { parse } from "@wrnexus/syntax";
export type InspectTarget =
"packages" | "plugins" | "routes" | "assets" | "runtimes" | "styles" | "migrations" | "bundle";
export function inspectComponent(appRoot: string, requestedName: string): unknown {
const root = resolve(appRoot);
const router = buildRouter(join(root, "app"), { componentDirs: [uiComponentsDir()] });
const component = router.components.find(
(candidate) => candidate.name.toLowerCase() === requestedName.toLowerCase(),
);
if (!component) throw new Error(`Component not found: ${requestedName}`);
const ast = parse(readFileSync(component.file, "utf8"));
return {
name: ast.name,
file: relative(root, component.file).replace(/\\/g, "/"),
props: ast.props.map(({ name, valueType, required, default: defaultValue }) => ({
name,
type: valueType ?? "unknown",
required,
...(defaultValue === undefined || defaultValue === "undefined"
? {}
: { default: defaultValue }),
})),
outputs: ast.outputs.map(({ name, payload }) => ({ name, payload: payload ?? null })),
functions: ast.runtimeFunctions.map(({ name, runtime, async, parameters, returnType }) => ({
name,
runtime,
async,
parameters,
returnType: returnType ?? "unknown",
})),
};
}
function json(path: string): Record<string, any> | null {
try {
return JSON.parse(readFileSync(path, "utf8")) as Record<string, any>;
@@ -158,3 +189,12 @@ export async function runInspect(
);
else console.log(JSON.stringify(value, null, 2));
}
export function runInspectComponent(appRoot: string, name: string, args: string[] = []): void {
const value = inspectComponent(appRoot, name);
if (args.includes("--json")) console.log(JSON.stringify(value, null, 2));
else {
console.log(`WRNexus component ${name}\n`);
console.log(JSON.stringify(value, null, 2));
}
}