import t from"node:path";import{existsSync as m}from"node:fs";import{readFile as h}from"node:fs/promises";import{buildSchema as e}from"graphql";import{PUBLIC_API_DEFINITIONS_FOLDER as n}from"../../../../../constants/common.js";import{findGraphqlSchemaByName as f}from"./utils.js";async function w(r,a){const o=f(a.graphqlDescriptions,r);if(!o)throw new Error(`No GraphQL schema found matching "${r}".`);const i=t.join(a.outdir||"",n,o.relativePath);if(!m(i))throw new Error(`No GraphQL schema found matching "${r}".`);return{name:o.name,schema:e(await h(i,"utf-8"))}}export{w as loadGraphqlSchema};
