mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-03-01 12:44:28 +00:00
16 lines
382 B
TypeScript
16 lines
382 B
TypeScript
import { parse } from 'graphql'
|
|
|
|
export default {
|
|
process(sourceText: string, sourcePath: string) {
|
|
try {
|
|
return {
|
|
code: `module.exports = ${JSON.stringify(parse(sourceText))};`,
|
|
}
|
|
} catch (error: unknown) {
|
|
throw new Error(
|
|
`Failed to parse ${sourcePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
)
|
|
}
|
|
},
|
|
}
|