@lewebsimple/nuxt-graphql 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -2
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { GraphQLCacheConfig } from '../dist/runtime/utils/graphql-cache.js';
|
|
3
|
+
import { CodegenConfig } from '@graphql-codegen/cli';
|
|
3
4
|
|
|
4
5
|
interface ModuleOptions {
|
|
5
6
|
endpoint?: string;
|
|
@@ -12,6 +13,7 @@ interface ModuleOptions {
|
|
|
12
13
|
input: string;
|
|
13
14
|
output: string;
|
|
14
15
|
}>;
|
|
16
|
+
generates?: CodegenConfig["generates"];
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -175,7 +175,7 @@ function formatDefinitions(defs) {
|
|
|
175
175
|
return defs.map((def) => `${colorOf(def)}${def.name}${reset}`).join(`${dim} / ${reset}`);
|
|
176
176
|
}
|
|
177
177
|
async function runCodegen(options) {
|
|
178
|
-
const { sdl, documents, operationsFile, schemasFile, scalars } = options;
|
|
178
|
+
const { sdl, documents, operationsFile, schemasFile, scalars, generates: customGenerates } = options;
|
|
179
179
|
if (documents.length === 0) {
|
|
180
180
|
logger.warn("No GraphQL documents found");
|
|
181
181
|
return;
|
|
@@ -232,6 +232,9 @@ async function runCodegen(options) {
|
|
|
232
232
|
scalarSchemas: zodScalars
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
|
+
if (customGenerates) {
|
|
236
|
+
Object.assign(generates, customGenerates);
|
|
237
|
+
}
|
|
235
238
|
}
|
|
236
239
|
await generate({ schema: sdl, documents, generates, silent: true, errorsOnly: true }, true);
|
|
237
240
|
logger.success(`Generated types for ${documents.length} document(s)`);
|
|
@@ -321,7 +324,8 @@ const module$1 = defineNuxtModule({
|
|
|
321
324
|
documents,
|
|
322
325
|
operationsFile,
|
|
323
326
|
schemasFile,
|
|
324
|
-
scalars: options.codegen?.scalars
|
|
327
|
+
scalars: options.codegen?.scalars,
|
|
328
|
+
generates: options.codegen?.generates
|
|
325
329
|
});
|
|
326
330
|
if (writeFileIfChanged(schemaFile, sdl)) {
|
|
327
331
|
logger.info(`GraphQL schema saved to ${cyan}${schemaOutput}${reset}`);
|