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
+18
View File
@@ -0,0 +1,18 @@
import type { PluginInput, WrnexusPlugin } from "./types.ts";
export function definePlugin(plugin: WrnexusPlugin): WrnexusPlugin {
if (!plugin?.name || !/^[a-z0-9@][a-z0-9@/._-]*$/i.test(plugin.name)) {
throw new Error("WRN-PLUGIN-NAME: plugins require a stable package-style name.");
}
return plugin;
}
export function flattenPlugins(input: PluginInput, output: WrnexusPlugin[] = []): WrnexusPlugin[] {
if (!input) return output;
if (Array.isArray(input)) {
for (const entry of input) flattenPlugins(entry, output);
} else {
output.push(definePlugin(input));
}
return output;
}