nitro-graphql 0.0.3 → 0.0.5
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/_virtual/rolldown_runtime.js +37 -0
- package/dist/client-codegen.js +50 -15
- package/dist/codegen.d.ts +2 -8
- package/dist/codegen.js +2 -1
- package/dist/ecosystem/nuxt.d.ts +7 -0
- package/dist/ecosystem/nuxt.js +29 -0
- package/dist/graphql.d.ts +13 -0
- package/dist/index.d.ts +2 -11
- package/dist/index.js +75 -128
- package/dist/internal/create-merged-schema.d.ts +7 -0
- package/dist/internal/create-merged-schema.js +23 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +3 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_add@3.2.3_graphql@16.11.0/node_modules/@graphql-codegen/add/esm/config.js +9 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_add@3.2.3_graphql@16.11.0/node_modules/@graphql-codegen/add/esm/index.js +17 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_import-types-preset@3.0.1_graphql@16.11.0/node_modules/@graphql-codegen/import-types-preset/esm/index.js +38 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/federation.js +22 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/getCachedDocumentNodeFromSchema.js +6 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/helpers.js +79 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/index.js +6 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/oldVisit.js +1 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/resolve-external-module-and-fn.js +7 -0
- package/dist/node_modules/.pnpm/@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/utils.js +13 -0
- package/dist/node_modules/.pnpm/camel-case@4.1.2/node_modules/camel-case/dist/index.js +33 -0
- package/dist/node_modules/.pnpm/capital-case@1.0.4/node_modules/capital-case/dist/index.js +32 -0
- package/dist/node_modules/.pnpm/change-case-all@1.0.15/node_modules/change-case-all/dist/index.js +56 -0
- package/dist/node_modules/.pnpm/change-case@4.1.2/node_modules/change-case/dist/index.js +37 -0
- package/dist/node_modules/.pnpm/constant-case@3.0.4/node_modules/constant-case/dist/index.js +28 -0
- package/dist/node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/header-case@2.0.4/node_modules/header-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/is-lower-case@2.0.2/node_modules/is-lower-case/dist/index.js +21 -0
- package/dist/node_modules/.pnpm/is-upper-case@2.0.2/node_modules/is-upper-case/dist/index.js +21 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js +37 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js +37 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js +37 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js +34 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js +30 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignMergeValue.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js +32 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js +31 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseCreate.js +34 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFor.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +30 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +44 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsTypedArray.js +32 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeysIn.js +32 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMerge.js +42 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMergeDeep.js +75 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js +31 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUnary.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneArrayBuffer.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneBuffer.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneTypedArray.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyArray.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyObject.js +37 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createAssigner.js +37 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createBaseFor.js +28 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js +20 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +13 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +43 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js +22 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js +36 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js +30 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js +31 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_initCloneObject.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js +28 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js +32 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js +22 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js +28 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +22 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +26 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +31 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +30 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +27 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +29 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +14 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeysIn.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nodeUtil.js +29 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +29 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +17 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_safeGet.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js +34 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js +42 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js +33 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js +46 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js +30 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js +43 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js +35 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js +42 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLikeObject.js +42 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js +41 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js +38 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js +42 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +40 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +38 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js +60 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js +34 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keysIn.js +41 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/merge.js +48 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js +27 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPlainObject.js +41 -0
- package/dist/node_modules/.pnpm/lower-case-first@2.0.2/node_modules/lower-case-first/dist/index.js +21 -0
- package/dist/node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist/index.js +64 -0
- package/dist/node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist/index.js +41 -0
- package/dist/node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/pascal-case@3.1.2/node_modules/pascal-case/dist/index.js +37 -0
- package/dist/node_modules/.pnpm/path-case@3.0.4/node_modules/path-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/sentence-case@3.0.4/node_modules/sentence-case/dist/index.js +34 -0
- package/dist/node_modules/.pnpm/snake-case@3.0.4/node_modules/snake-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/sponge-case@1.0.1/node_modules/sponge-case/dist/index.js +20 -0
- package/dist/node_modules/.pnpm/swap-case@2.0.2/node_modules/swap-case/dist/index.js +23 -0
- package/dist/node_modules/.pnpm/title-case@3.0.3/node_modules/title-case/dist/index.js +35 -0
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +547 -0
- package/dist/node_modules/.pnpm/upper-case-first@2.0.2/node_modules/upper-case-first/dist/index.js +21 -0
- package/dist/node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js +56 -0
- package/dist/rollup.js +84 -0
- package/dist/routes/graphql.d.ts +6 -0
- package/dist/routes/graphql.js +54 -0
- package/dist/types.d.ts +37 -2
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.js +72 -0
- package/dist/utils/server-type-generation.js +52 -0
- package/package.json +20 -8
- package/dist/client-watcher.d.ts +0 -7
- package/dist/client-watcher.js +0 -100
- package/dist/dev.js +0 -95
- package/dist/prerender.js +0 -279
- package/dist/scanner.js +0 -118
- package/dist/utils.d.ts +0 -13
- package/dist/utils.js +0 -23
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all) __defProp(target, name, {
|
|
16
|
+
get: all[name],
|
|
17
|
+
enumerable: true
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
+
key = keys[i];
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
24
|
+
get: ((k) => from[k]).bind(null, key),
|
|
25
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
31
|
+
value: mod,
|
|
32
|
+
enumerable: true
|
|
33
|
+
}) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { __commonJS, __esm, __export, __toCommonJS, __toESM };
|
package/dist/client-codegen.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { preset } from "./node_modules/.pnpm/@graphql-codegen_import-types-preset@3.0.1_graphql@16.11.0/node_modules/@graphql-codegen/import-types-preset/esm/index.js";
|
|
2
2
|
import { codegen } from "@graphql-codegen/core";
|
|
3
3
|
import { plugin } from "@graphql-codegen/typescript";
|
|
4
4
|
import { printSchemaWithDirectives } from "@graphql-tools/utils";
|
|
5
|
+
import { consola as consola$1 } from "consola";
|
|
5
6
|
import { defu } from "defu";
|
|
6
7
|
import { parse } from "graphql";
|
|
7
|
-
import { plugin as plugin$1 } from "@graphql-codegen/typescript-
|
|
8
|
-
import { plugin as plugin$2 } from "@graphql-codegen/typescript-
|
|
8
|
+
import { plugin as plugin$1 } from "@graphql-codegen/typescript-operations";
|
|
9
|
+
import { plugin as plugin$2 } from "@graphql-codegen/typescript-generic-sdk";
|
|
9
10
|
import { GraphQLFileLoader } from "@graphql-tools/graphql-file-loader";
|
|
10
11
|
import { loadDocuments } from "@graphql-tools/load";
|
|
11
12
|
|
|
@@ -31,13 +32,12 @@ async function loadGraphQLDocuments(patterns) {
|
|
|
31
32
|
else throw e;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
async function generateClientTypes(schema,
|
|
35
|
-
const docs = await loadGraphQLDocuments(patterns);
|
|
35
|
+
async function generateClientTypes(schema, docs, config = {}, outputPath) {
|
|
36
36
|
if (docs.length === 0) {
|
|
37
|
-
consola.info("[graphql] No client GraphQL files found. Skipping client type generation.");
|
|
38
|
-
return
|
|
37
|
+
consola$1.info("[graphql] No client GraphQL files found. Skipping client type generation.");
|
|
38
|
+
return false;
|
|
39
39
|
}
|
|
40
|
-
consola.info(`[graphql] Found ${docs.length} client GraphQL documents`);
|
|
40
|
+
consola$1.info(`[graphql] Found ${docs.length} client GraphQL documents`);
|
|
41
41
|
const defaultConfig = {
|
|
42
42
|
documentMode: "string",
|
|
43
43
|
emitLegacyCommonJSImports: false,
|
|
@@ -64,22 +64,57 @@ async function generateClientTypes(schema, patterns, config = {}, outputPath) {
|
|
|
64
64
|
plugins: [
|
|
65
65
|
{ pluginContent: {} },
|
|
66
66
|
{ typescript: {} },
|
|
67
|
+
{ typescriptOperations: {} }
|
|
68
|
+
],
|
|
69
|
+
pluginMap: {
|
|
70
|
+
pluginContent: { plugin: pluginContent },
|
|
71
|
+
typescript: { plugin },
|
|
72
|
+
typescriptOperations: { plugin: plugin$1 }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const sdkOutput = await preset.buildGeneratesSection({
|
|
76
|
+
baseOutputDir: outputPath || "client-types.generated.ts",
|
|
77
|
+
schema: parse(printSchemaWithDirectives(schema)),
|
|
78
|
+
documents: [...docs],
|
|
79
|
+
config: {
|
|
80
|
+
documentMode: "string",
|
|
81
|
+
pureMagicComment: true,
|
|
82
|
+
strictScalars: true,
|
|
83
|
+
scalars: {
|
|
84
|
+
DateTime: "Date",
|
|
85
|
+
JSON: "any",
|
|
86
|
+
UUID: "string",
|
|
87
|
+
NonEmptyString: "string",
|
|
88
|
+
Currency: "string"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
presetConfig: { typesPath: "#graphql/client" },
|
|
92
|
+
plugins: [
|
|
93
|
+
{ pluginContent: {} },
|
|
67
94
|
{ typescriptOperations: {} },
|
|
68
95
|
{ typescriptGenericSdk: { rawRequest: false } }
|
|
69
96
|
],
|
|
70
97
|
pluginMap: {
|
|
71
98
|
pluginContent: { plugin: pluginContent },
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
typescriptGenericSdk: { plugin: plugin$1 }
|
|
99
|
+
typescriptOperations: { plugin: plugin$1 },
|
|
100
|
+
typescriptGenericSdk: { plugin: plugin$2 }
|
|
75
101
|
}
|
|
76
102
|
});
|
|
77
|
-
|
|
103
|
+
const results = await Promise.all(sdkOutput.map(async (config$1) => {
|
|
104
|
+
return {
|
|
105
|
+
file: config$1.filename,
|
|
106
|
+
content: await codegen(config$1)
|
|
107
|
+
};
|
|
108
|
+
}));
|
|
109
|
+
return {
|
|
110
|
+
types: output,
|
|
111
|
+
sdk: results[0]?.content || ""
|
|
112
|
+
};
|
|
78
113
|
} catch (error) {
|
|
79
|
-
consola.warn("[graphql] Client type generation failed:", error);
|
|
80
|
-
return
|
|
114
|
+
consola$1.warn("[graphql] Client type generation failed:", error);
|
|
115
|
+
return false;
|
|
81
116
|
}
|
|
82
117
|
}
|
|
83
118
|
|
|
84
119
|
//#endregion
|
|
85
|
-
export { generateClientTypes };
|
|
120
|
+
export { generateClientTypes, loadGraphQLDocuments };
|
package/dist/codegen.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { CodegenServerConfig } from "./types.js";
|
|
1
2
|
import { GraphQLSchema } from "graphql";
|
|
2
3
|
|
|
3
4
|
//#region src/codegen.d.ts
|
|
4
|
-
interface CodegenServerConfig {
|
|
5
|
-
contextType?: string;
|
|
6
|
-
scalars?: Record<string, any>;
|
|
7
|
-
defaultMapper?: string;
|
|
8
|
-
mapperTypeSuffix?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
5
|
declare function generateTypes(schema: GraphQLSchema, config?: CodegenServerConfig, outputPath?: string): Promise<string>;
|
|
12
6
|
//#endregion
|
|
13
|
-
export {
|
|
7
|
+
export { generateTypes };
|
package/dist/codegen.js
CHANGED
|
@@ -2,6 +2,7 @@ import { codegen } from "@graphql-codegen/core";
|
|
|
2
2
|
import * as typescriptPlugin from "@graphql-codegen/typescript";
|
|
3
3
|
import * as typescriptResolversPlugin from "@graphql-codegen/typescript-resolvers";
|
|
4
4
|
import { printSchemaWithDirectives } from "@graphql-tools/utils";
|
|
5
|
+
import consola from "consola";
|
|
5
6
|
import { defu } from "defu";
|
|
6
7
|
import { parse } from "graphql";
|
|
7
8
|
import { CurrencyResolver, DateTimeResolver, JSONResolver, NonEmptyStringResolver, UUIDResolver } from "graphql-scalars";
|
|
@@ -99,7 +100,7 @@ type ResolverReturnTypeObject<T extends object> = {
|
|
|
99
100
|
typescriptResolvers: typescriptResolversPlugin
|
|
100
101
|
}
|
|
101
102
|
}).catch((e) => {
|
|
102
|
-
|
|
103
|
+
consola.withTag("graphql").error("Error generating types:", e);
|
|
103
104
|
return "";
|
|
104
105
|
});
|
|
105
106
|
return output;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { join } from "pathe";
|
|
2
|
+
import { addImportsDir, defineNuxtModule } from "@nuxt/kit";
|
|
3
|
+
|
|
4
|
+
//#region src/ecosystem/nuxt.ts
|
|
5
|
+
var nuxt_default = defineNuxtModule({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "nitro-graphql-nuxt",
|
|
8
|
+
configKey: "nitro-graphql-nuxt",
|
|
9
|
+
compatibility: { nuxt: ">=3.16.0" }
|
|
10
|
+
},
|
|
11
|
+
defaults: {},
|
|
12
|
+
setup: (options, nuxt) => {
|
|
13
|
+
nuxt.hooks.hook("prepare:types", (options$1) => {
|
|
14
|
+
options$1.references.push({ path: "types/nitro-graphql-client.d.ts" });
|
|
15
|
+
options$1.tsConfig ??= {};
|
|
16
|
+
options$1.tsConfig.compilerOptions ??= {};
|
|
17
|
+
options$1.tsConfig.compilerOptions.paths ??= {};
|
|
18
|
+
options$1.tsConfig.compilerOptions.paths["#graphql/client"] = ["./types/nitro-graphql-client.d.ts"];
|
|
19
|
+
options$1.tsConfig.include = options$1.tsConfig.include || [];
|
|
20
|
+
options$1.tsConfig.include.push("./types/nitro-graphql-client.d.ts");
|
|
21
|
+
});
|
|
22
|
+
nuxt.options.alias = nuxt.options.alias || {};
|
|
23
|
+
nuxt.options.alias["#graphql/client"] = join(nuxt.options.buildDir, "types/nitro-graphql-client.d.ts");
|
|
24
|
+
addImportsDir(join(nuxt.options.srcDir, "graphql"));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { nuxt_default as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NitroGraphQLOptions } from "./types.js";
|
|
2
|
+
import { NitroConfig } from "nitropack";
|
|
3
|
+
|
|
4
|
+
//#region src/graphql.d.ts
|
|
5
|
+
declare module 'nitropack' {
|
|
6
|
+
interface NitroRuntimeHooks {}
|
|
7
|
+
interface NitroRuntimeConfig {}
|
|
8
|
+
}
|
|
9
|
+
declare module 'nitropack/config' {
|
|
10
|
+
function defineNitroConfig(config: NitroConfig & {
|
|
11
|
+
graphql?: NitroGraphQLOptions;
|
|
12
|
+
}): NitroConfig;
|
|
13
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as nitropack1 from "nitropack";
|
|
1
|
+
import * as nitropack5 from "nitropack";
|
|
3
2
|
|
|
4
3
|
//#region src/index.d.ts
|
|
5
|
-
declare
|
|
6
|
-
interface NitroOptions {
|
|
7
|
-
graphqlYoga?: NitroGraphQLOptions;
|
|
8
|
-
}
|
|
9
|
-
interface NitroRuntimeConfig {
|
|
10
|
-
graphqlYoga?: NitroGraphQLOptions;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
declare const _default: nitropack1.NitroModule;
|
|
4
|
+
declare const _default: nitropack5.NitroModule;
|
|
14
5
|
//#endregion
|
|
15
6
|
export { _default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,159 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { relativeWithDot, scanDefs, scanResolvers } from "./utils/index.js";
|
|
2
|
+
import { clientTypeGeneration, serverTypeGeneration } from "./utils/server-type-generation.js";
|
|
3
|
+
import { rollupConfig } from "./rollup.js";
|
|
4
|
+
import { writeFileSync } from "node:fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { watch } from "chokidar";
|
|
4
7
|
import { defineNitroModule } from "nitropack/kit";
|
|
8
|
+
import { dirname, join, resolve } from "pathe";
|
|
5
9
|
|
|
6
10
|
//#region src/index.ts
|
|
7
11
|
var src_default = defineNitroModule({
|
|
8
|
-
name: "nitro
|
|
12
|
+
name: "nitro-graphql",
|
|
9
13
|
async setup(nitro) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const originalExternal = nitro.options.rollupConfig.external;
|
|
15
|
-
nitro.options.rollupConfig.external = (id, parentId, isResolved) => {
|
|
16
|
-
if (id.startsWith("./dev")) return true;
|
|
17
|
-
if (id.startsWith("./prerender") && !nitro.options.prerender) return true;
|
|
18
|
-
if (typeof originalExternal === "function") return originalExternal(id, parentId, isResolved);
|
|
19
|
-
if (Array.isArray(originalExternal)) return originalExternal.includes(id);
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const options = {
|
|
25
|
-
endpoint: "/api/graphql",
|
|
26
|
-
playground: true,
|
|
27
|
-
cors: false,
|
|
28
|
-
cacheHeaders: {
|
|
29
|
-
enabled: true,
|
|
30
|
-
maxAge: 604800
|
|
31
|
-
},
|
|
32
|
-
client: {
|
|
33
|
-
enabled: nitro.options.framework?.name === "nuxt",
|
|
34
|
-
outputPath: void 0,
|
|
35
|
-
watchPatterns: void 0,
|
|
36
|
-
config: {
|
|
37
|
-
documentMode: "string",
|
|
38
|
-
emitLegacyCommonJSImports: false,
|
|
39
|
-
useTypeImports: true,
|
|
40
|
-
enumsAsTypes: true
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
...nitro.options.graphqlYoga,
|
|
44
|
-
...nitro.options.runtimeConfig?.graphqlYoga
|
|
14
|
+
nitro.graphql ||= {
|
|
15
|
+
buildDir: "",
|
|
16
|
+
watchDirs: [],
|
|
17
|
+
clientDir: ""
|
|
45
18
|
};
|
|
46
|
-
|
|
47
|
-
nitro.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
await prerender(nitro, options);
|
|
19
|
+
const graphqlBuildDir = resolve(nitro.options.buildDir, "graphql");
|
|
20
|
+
nitro.graphql.buildDir = graphqlBuildDir;
|
|
21
|
+
const watchDirs = [];
|
|
22
|
+
switch (nitro.options.framework.name) {
|
|
23
|
+
case "nuxt":
|
|
24
|
+
watchDirs.push(join(nitro.options.rootDir, "app", "graphql"));
|
|
25
|
+
nitro.graphql.clientDir = resolve(nitro.options.rootDir, "app", "graphql");
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
56
28
|
}
|
|
29
|
+
watch(watchDirs, {
|
|
30
|
+
persistent: true,
|
|
31
|
+
ignoreInitial: true,
|
|
32
|
+
ignored: nitro.options.ignore
|
|
33
|
+
}).on("all", async (event, path) => {
|
|
34
|
+
if (path.endsWith(".graphql") || path.endsWith(".gql")) await clientTypeGeneration(nitro, path);
|
|
35
|
+
});
|
|
36
|
+
const tsConfigPath = resolve(nitro.options.buildDir, nitro.options.typescript.tsconfigPath);
|
|
37
|
+
const tsconfigDir = dirname(tsConfigPath);
|
|
38
|
+
const typesDir = resolve(nitro.options.buildDir, "types");
|
|
39
|
+
const defs = await scanDefs(nitro);
|
|
40
|
+
nitro.scanDefs = defs;
|
|
41
|
+
const resolvers = await scanResolvers(nitro);
|
|
42
|
+
nitro.scanResolvers = resolvers;
|
|
43
|
+
nitro.hooks.hook("dev:start", async () => {
|
|
44
|
+
const defs$1 = await scanDefs(nitro);
|
|
45
|
+
nitro.scanDefs = defs$1;
|
|
46
|
+
const resolvers$1 = await scanResolvers(nitro);
|
|
47
|
+
nitro.scanResolvers = resolvers$1;
|
|
48
|
+
});
|
|
49
|
+
await rollupConfig(nitro);
|
|
50
|
+
await serverTypeGeneration(nitro);
|
|
51
|
+
await clientTypeGeneration(nitro, nitro.graphql.clientDir);
|
|
52
|
+
const endpoint = "/api/graphql";
|
|
53
|
+
const runtime = fileURLToPath(new URL("routes", import.meta.url));
|
|
57
54
|
nitro.options.handlers.push({
|
|
58
55
|
route: endpoint,
|
|
59
|
-
handler: "
|
|
56
|
+
handler: join(runtime, "graphql"),
|
|
60
57
|
method: "get"
|
|
61
58
|
});
|
|
62
59
|
nitro.options.handlers.push({
|
|
63
60
|
route: endpoint,
|
|
64
|
-
handler: "
|
|
61
|
+
handler: join(runtime, "graphql"),
|
|
65
62
|
method: "post"
|
|
66
63
|
});
|
|
67
64
|
nitro.options.handlers.push({
|
|
68
65
|
route: endpoint,
|
|
69
|
-
handler: "
|
|
66
|
+
handler: join(runtime, "graphql"),
|
|
70
67
|
method: "options"
|
|
71
68
|
});
|
|
72
|
-
nitro.options.handlers.push({
|
|
73
|
-
route: `${endpoint}/health`,
|
|
74
|
-
handler: "#nitro-graphql/health",
|
|
75
|
-
method: "get"
|
|
76
|
-
});
|
|
77
|
-
nitro.options.virtual["#nitro-graphql/health"] = () => `
|
|
78
|
-
import { defineEventHandler, setResponseStatus } from 'h3'
|
|
79
|
-
|
|
80
|
-
export default defineEventHandler(async (event) => {
|
|
81
|
-
try {
|
|
82
|
-
const response = await $fetch('${endpoint}', {
|
|
83
|
-
method: 'POST',
|
|
84
|
-
body: {
|
|
85
|
-
query: 'query Health { __typename }',
|
|
86
|
-
operationName: 'Health',
|
|
87
|
-
},
|
|
88
|
-
headers: {
|
|
89
|
-
'Content-Type': 'application/json',
|
|
90
|
-
'Accept': 'application/json',
|
|
91
|
-
},
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
if (response && typeof response === 'object' && 'data' in response) {
|
|
95
|
-
return {
|
|
96
|
-
status: 'healthy',
|
|
97
|
-
message: 'GraphQL server is running',
|
|
98
|
-
timestamp: new Date().toISOString(),
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
throw new Error('Invalid response from GraphQL server')
|
|
103
|
-
} catch (error) {
|
|
104
|
-
setResponseStatus(event, 503)
|
|
105
|
-
return {
|
|
106
|
-
status: 'unhealthy',
|
|
107
|
-
message: error.message || 'GraphQL server is not responding',
|
|
108
|
-
timestamp: new Date().toISOString(),
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
`;
|
|
113
69
|
if (nitro.options.imports) nitro.options.imports.presets.push({
|
|
114
70
|
from: "nitro-graphql/utils",
|
|
115
71
|
imports: ["defineResolver", "defineYogaConfig"]
|
|
116
72
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
73
|
+
nitro.hooks.hook("rollup:before", (nitro$1, rollupConfig$1) => {
|
|
74
|
+
const manualChunks = rollupConfig$1.output?.manualChunks;
|
|
75
|
+
const chunkFiles = rollupConfig$1.output?.chunkFileNames;
|
|
76
|
+
if (!rollupConfig$1.output.inlineDynamicImports) rollupConfig$1.output.manualChunks = (id, meta) => {
|
|
77
|
+
if (id.endsWith(".graphql") || id.endsWith(".gql")) return "schemas";
|
|
78
|
+
if (id.endsWith(".resolver.ts")) return "resolvers";
|
|
79
|
+
if (typeof manualChunks === "function") return manualChunks(id, meta);
|
|
80
|
+
return void 0;
|
|
81
|
+
};
|
|
82
|
+
rollupConfig$1.output.chunkFileNames = (chunkInfo) => {
|
|
83
|
+
if (chunkInfo.moduleIds && chunkInfo.moduleIds.some((id) => id.includes("/graphql/") || id.includes(".graphql") || id.includes(".resolver.ts") || id.includes(".gql"))) return `chunks/graphql/[name].mjs`;
|
|
84
|
+
if (typeof chunkFiles === "function") return chunkFiles(chunkInfo);
|
|
85
|
+
return `chunks/_/[name].mjs`;
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const graphqlDtsContent = `// Auto-generated by nitro-graphql
|
|
89
|
+
import type { Resolvers as Test } from './nitro-graphql-server.d.ts'
|
|
90
|
+
|
|
91
|
+
declare module 'nitro-graphql/types' {
|
|
92
|
+
interface Resolvers extends Test {}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
writeFileSync(join(typesDir, "graphql.d.ts"), graphqlDtsContent);
|
|
120
96
|
nitro.hooks.hook("types:extend", (types) => {
|
|
121
97
|
types.tsConfig ||= {};
|
|
122
98
|
types.tsConfig.compilerOptions ??= {};
|
|
123
99
|
types.tsConfig.compilerOptions.paths ??= {};
|
|
124
|
-
types.tsConfig.compilerOptions.paths["#graphql/server"] = [relativeWithDot(tsconfigDir, join(typesDir, "graphql-
|
|
125
|
-
types.tsConfig.compilerOptions.paths["#graphql/client"] = [relativeWithDot(tsconfigDir, join(typesDir, "graphql-client.
|
|
100
|
+
types.tsConfig.compilerOptions.paths["#graphql/server"] = [relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-server.d.ts"))];
|
|
101
|
+
types.tsConfig.compilerOptions.paths["#graphql/client"] = [relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-client.d.ts"))];
|
|
126
102
|
types.tsConfig.include = types.tsConfig.include || [];
|
|
127
|
-
types.tsConfig.include.push(relativeWithDot(tsconfigDir, join(typesDir, "graphql-
|
|
128
|
-
});
|
|
129
|
-
const graphqlPath = join(nitro.options.srcDir, "graphql");
|
|
130
|
-
nitro.hooks.hook("rollup:before", (nitro$1, rollupConfig) => {
|
|
131
|
-
rollupConfig.external = rollupConfig.external || [];
|
|
132
|
-
const codegenExternals = [
|
|
133
|
-
"@graphql-codegen/core",
|
|
134
|
-
"@graphql-codegen/typescript",
|
|
135
|
-
"@graphql-codegen/typescript-resolvers",
|
|
136
|
-
"@graphql-codegen/typescript-operations",
|
|
137
|
-
"@graphql-codegen/typescript-generic-sdk",
|
|
138
|
-
"@graphql-tools/graphql-file-loader",
|
|
139
|
-
"@graphql-tools/load"
|
|
140
|
-
];
|
|
141
|
-
if (Array.isArray(rollupConfig.external)) rollupConfig.external.push(...codegenExternals);
|
|
142
|
-
else if (typeof rollupConfig.external === "function") {
|
|
143
|
-
const originalExternal = rollupConfig.external;
|
|
144
|
-
rollupConfig.external = (id, parent, isResolved) => {
|
|
145
|
-
if (codegenExternals.some((external) => id.includes(external))) return true;
|
|
146
|
-
return originalExternal(id, parent, isResolved);
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
const originalChunkFileNames = rollupConfig.output.chunkFileNames;
|
|
150
|
-
rollupConfig.output.chunkFileNames = (chunk) => {
|
|
151
|
-
const allIds = chunk.moduleIds || [];
|
|
152
|
-
const hasGraphQLResolverFile = allIds.some((id) => id.includes(graphqlPath) && !id.includes("node_modules") && !id.includes("#nitro-graphql") && (id.endsWith(".ts") || id.endsWith(".js") || id.endsWith(".mjs")));
|
|
153
|
-
if (hasGraphQLResolverFile) return `chunks/graphql/[name].mjs`;
|
|
154
|
-
if (typeof originalChunkFileNames === "function") return originalChunkFileNames(chunk);
|
|
155
|
-
return originalChunkFileNames || "chunks/_/[name].mjs";
|
|
156
|
-
};
|
|
103
|
+
types.tsConfig.include.push(relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-server.d.ts")), relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-client.d.ts")), relativeWithDot(tsconfigDir, join(typesDir, "graphql.d.ts")));
|
|
157
104
|
});
|
|
158
105
|
}
|
|
159
106
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as graphql8 from "graphql";
|
|
2
|
+
import * as graphql_yoga9 from "graphql-yoga";
|
|
3
|
+
|
|
4
|
+
//#region src/internal/create-merged-schema.d.ts
|
|
5
|
+
declare function createMergedSchema(): graphql_yoga9.GraphQLSchemaWithContext<graphql8.GraphQLResolveInfo & graphql_yoga9.YogaInitialContext>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createMergedSchema };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createSchema } from "graphql-yoga";
|
|
2
|
+
import { mergeResolvers, mergeTypeDefs } from "@graphql-tools/merge";
|
|
3
|
+
import { defs } from "#nitro-internal-virtual/server-defs";
|
|
4
|
+
import { resolvers } from "#nitro-internal-virtual/server-resolvers";
|
|
5
|
+
|
|
6
|
+
//#region src/internal/create-merged-schema.ts
|
|
7
|
+
function createMergedSchema() {
|
|
8
|
+
try {
|
|
9
|
+
const mergedDefs = defs.map((schema) => schema.def).join("\n\n");
|
|
10
|
+
const typeDefs = mergeTypeDefs([mergedDefs]);
|
|
11
|
+
const mergedResolvers = mergeResolvers(resolvers.map((r) => r.resolver));
|
|
12
|
+
return createSchema({
|
|
13
|
+
typeDefs,
|
|
14
|
+
resolvers: mergedResolvers
|
|
15
|
+
});
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error("Schema merge error:", error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { createMergedSchema };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VALID_PLACEMENTS } from "./config.js";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/@graphql-codegen+add@3.2.3_graphql@16.11.0/node_modules/@graphql-codegen/add/esm/index.js
|
|
4
|
+
const plugin = async (schema, documents, config) => {
|
|
5
|
+
const placement = config.placement || "prepend";
|
|
6
|
+
const { content } = config;
|
|
7
|
+
if (!VALID_PLACEMENTS.includes(placement)) throw Error(`Configuration provided for 'add' plugin is invalid: value of 'placement' field is not valid (valid values are: ${VALID_PLACEMENTS.join(", ")})`);
|
|
8
|
+
if (!content) throw Error(`Configuration provided for 'add' plugin is invalid: "content" is missing!`);
|
|
9
|
+
return {
|
|
10
|
+
content: null,
|
|
11
|
+
[placement]: Array.isArray(content) ? content : [content]
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
var esm_default = { plugin };
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { esm_default as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import esm_default from "../../../../../@graphql-codegen_add@3.2.3_graphql@16.11.0/node_modules/@graphql-codegen/add/esm/index.js";
|
|
2
|
+
import { isUsingTypes } from "../../../../../@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/helpers.js";
|
|
3
|
+
import "../../../../../@graphql-codegen_plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/index.js";
|
|
4
|
+
|
|
5
|
+
//#region node_modules/.pnpm/@graphql-codegen+import-types-preset@3.0.1_graphql@16.11.0/node_modules/@graphql-codegen/import-types-preset/esm/index.js
|
|
6
|
+
const preset = { buildGeneratesSection: (options) => {
|
|
7
|
+
if (!options.presetConfig.typesPath) throw new Error(`Preset "import-types" requires you to specify "typesPath" configuration and point it to your base types file (generated by "typescript" plugin)!`);
|
|
8
|
+
const importTypesNamespace = options.presetConfig.importTypesNamespace || "Types";
|
|
9
|
+
const pluginMap = {
|
|
10
|
+
...options.pluginMap,
|
|
11
|
+
add: esm_default
|
|
12
|
+
};
|
|
13
|
+
const plugins = [...options.plugins];
|
|
14
|
+
const config = {
|
|
15
|
+
...options.config,
|
|
16
|
+
namespacedImportName: importTypesNamespace,
|
|
17
|
+
importOperationTypesFrom: importTypesNamespace,
|
|
18
|
+
externalFragments: []
|
|
19
|
+
};
|
|
20
|
+
options.documents.map((documentFile) => {
|
|
21
|
+
if (isUsingTypes(documentFile.document, config.externalFragments.map((m) => m.name), options.schemaAst)) {
|
|
22
|
+
const importType = options.config.useTypeImports ? "import type" : "import";
|
|
23
|
+
plugins.unshift({ add: { content: `${importType} * as ${importTypesNamespace} from '${options.presetConfig.typesPath}';\n` } });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return [{
|
|
27
|
+
filename: options.baseOutputDir,
|
|
28
|
+
plugins,
|
|
29
|
+
pluginMap,
|
|
30
|
+
config,
|
|
31
|
+
schema: options.schema,
|
|
32
|
+
schemaAst: options.schemaAst,
|
|
33
|
+
documents: options.documents
|
|
34
|
+
}];
|
|
35
|
+
} };
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { preset };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __toESM } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import "./utils.js";
|
|
3
|
+
import { require_merge } from "../../../../../lodash@4.17.21/node_modules/lodash/merge.js";
|
|
4
|
+
import "./index.js";
|
|
5
|
+
import "@graphql-tools/utils";
|
|
6
|
+
import { isObjectType, parse } from "graphql";
|
|
7
|
+
|
|
8
|
+
//#region node_modules/.pnpm/@graphql-codegen+plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/federation.js
|
|
9
|
+
var import_merge = __toESM(require_merge(), 1);
|
|
10
|
+
/**
|
|
11
|
+
* Federation Spec
|
|
12
|
+
*/
|
|
13
|
+
const federationSpec = parse(`
|
|
14
|
+
scalar _FieldSet
|
|
15
|
+
|
|
16
|
+
directive @external on FIELD_DEFINITION
|
|
17
|
+
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
|
|
18
|
+
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
|
|
19
|
+
directive @key(fields: _FieldSet!) on OBJECT | INTERFACE
|
|
20
|
+
`);
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getDocumentNodeFromSchema, memoize1 } from "@graphql-tools/utils";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/@graphql-codegen+plugin-helpers@3.1.2_graphql@16.11.0/node_modules/@graphql-codegen/plugin-helpers/esm/getCachedDocumentNodeFromSchema.js
|
|
4
|
+
const getCachedDocumentNodeFromSchema = memoize1(getDocumentNodeFromSchema);
|
|
5
|
+
|
|
6
|
+
//#endregion
|