Files
WRNexusJS/packages/graphql/src/plugin.ts
T
Clintchiz 586a6db8ff
Quality / quality (ubuntu-latest) (push) Failing after 21s
Quality / quality (windows-latest) (push) Canceled after 0s
release: WRNexusJS 0.8.0
2026-08-02 23:18:51 +05:30

25 lines
800 B
TypeScript

import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import type { WrnexusPlugin } from "@wrnexus/plugin";
import { createGraphqlHandler, type GraphqlOptions } from "./index.ts";
export function graphqlPlugin(options: GraphqlOptions & { path?: string }): WrnexusPlugin {
return {
name: "@wrnexus/graphql",
version: "0.8.0",
setup() {
(globalThis as any).__wrnexusGraphqlHandler = createGraphqlHandler(options);
},
routeEntries: [
{
kind: "api",
path: options.path ?? "/api/graphql",
entry: join(dirname(fileURLToPath(import.meta.url)), "route.ts"),
},
],
documentation: ["packages/graphql/README.md"],
typeDefinitions: ["packages/graphql/src/index.ts"],
};
}
export default graphqlPlugin;