nuxt-graphql-middleware 4.3.0 → 4.3.1
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/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/08eb555c-2460-4359-b00b-ff7301e8150d.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.d.mts +2 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +48 -23
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/172a2fbf-9aed-4d11-81c4-ac46ab9b664c.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/B4FhP7a6.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.Bkv_zTjr.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CPd6XBwJ.js">
|
|
10
|
-
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"
|
|
10
|
+
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1732095345137,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"08eb555c-2460-4359-b00b-ff7301e8150d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/B4FhP7a6.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.Bkv_zTjr.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CPd6XBwJ.js">
|
|
10
|
-
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"
|
|
10
|
+
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1732095345137,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"08eb555c-2460-4359-b00b-ff7301e8150d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"08eb555c-2460-4359-b00b-ff7301e8150d","timestamp":1732095335584}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"08eb555c-2460-4359-b00b-ff7301e8150d","timestamp":1732095335584,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/B4FhP7a6.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.Bkv_zTjr.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CPd6XBwJ.js">
|
|
10
|
-
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"
|
|
10
|
+
<script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1732095345137,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"08eb555c-2460-4359-b00b-ff7301e8150d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -353,8 +353,9 @@ interface ModuleOptions {
|
|
|
353
353
|
/**
|
|
354
354
|
* Set to true if you want to output each compiled query and mutation in the
|
|
355
355
|
* .nuxt folder.
|
|
356
|
+
* Set to a path to output to a custom path.
|
|
356
357
|
*/
|
|
357
|
-
outputDocuments?: boolean;
|
|
358
|
+
outputDocuments?: boolean | string;
|
|
358
359
|
/**
|
|
359
360
|
* Enable Nuxt DevTools integration.
|
|
360
361
|
*/
|
package/dist/module.d.ts
CHANGED
|
@@ -353,8 +353,9 @@ interface ModuleOptions {
|
|
|
353
353
|
/**
|
|
354
354
|
* Set to true if you want to output each compiled query and mutation in the
|
|
355
355
|
* .nuxt folder.
|
|
356
|
+
* Set to a path to output to a custom path.
|
|
356
357
|
*/
|
|
357
|
-
outputDocuments?: boolean;
|
|
358
|
+
outputDocuments?: boolean | string;
|
|
358
359
|
/**
|
|
359
360
|
* Enable Nuxt DevTools integration.
|
|
360
361
|
*/
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { dirname, resolve, relative } from 'pathe';
|
|
2
|
+
import { dirname, resolve, relative, parse as parse$1, join } from 'pathe';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
import { useLogger, resolveAlias, resolveFiles, defineNuxtModule, createResolver, addImports, addServerImports, addTemplate, addServerHandler, addPlugin, updateTemplates } from '@nuxt/kit';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
@@ -21,7 +21,7 @@ import { pascalCase } from 'change-case-all';
|
|
|
21
21
|
import colors from 'picocolors';
|
|
22
22
|
|
|
23
23
|
const name = "nuxt-graphql-middleware";
|
|
24
|
-
const version = "4.3.
|
|
24
|
+
const version = "4.3.1";
|
|
25
25
|
|
|
26
26
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-graphql-middleware";
|
|
27
27
|
const DEVTOOLS_UI_LOCAL_PORT = 3300;
|
|
@@ -386,7 +386,7 @@ function logDocuments(logger, documents, logEverything) {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
const logger = useLogger(
|
|
389
|
+
const logger = useLogger(name);
|
|
390
390
|
const defaultOptions = {
|
|
391
391
|
codegenConfig: {
|
|
392
392
|
exportFragmentSpreadSubTypes: true,
|
|
@@ -542,11 +542,11 @@ async function buildDocuments(providedDocuments = [], autoImportPatterns, resolv
|
|
|
542
542
|
return documents;
|
|
543
543
|
}
|
|
544
544
|
function parseDocument(document, rootDir) {
|
|
545
|
-
let
|
|
546
|
-
if (
|
|
547
|
-
|
|
545
|
+
let name2 = document.filename ? document.filename.replace(rootDir, "") : "";
|
|
546
|
+
if (name2.charAt(0) === "/") {
|
|
547
|
+
name2 = name2.slice(1);
|
|
548
548
|
}
|
|
549
|
-
const source = new Source(document.content,
|
|
549
|
+
const source = new Source(document.content, name2);
|
|
550
550
|
return parse(source);
|
|
551
551
|
}
|
|
552
552
|
function validateDocuments(schema, documents, rootDir) {
|
|
@@ -733,7 +733,21 @@ async function outputDocuments(outputPath, documents) {
|
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
}
|
|
736
|
+
async function getOutputDocumentsPath(optionsOutputDocuments, nuxtBuildDir, resolvePath) {
|
|
737
|
+
if (!optionsOutputDocuments) {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
if (typeof optionsOutputDocuments === "boolean") {
|
|
741
|
+
return resolve(nuxtBuildDir, `${name}/documents`);
|
|
742
|
+
} else {
|
|
743
|
+
return await resolvePath(optionsOutputDocuments);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
736
746
|
|
|
747
|
+
function pathWithoutExtension(fullPath) {
|
|
748
|
+
const parsed = parse$1(fullPath);
|
|
749
|
+
return join(parsed.dir, parsed.name);
|
|
750
|
+
}
|
|
737
751
|
const RPC_NAMESPACE = "nuxt-graphql-middleware";
|
|
738
752
|
const module = defineNuxtModule({
|
|
739
753
|
meta: {
|
|
@@ -828,14 +842,15 @@ const module = defineNuxtModule({
|
|
|
828
842
|
ctx.templates = templates;
|
|
829
843
|
ctx.documents = documents;
|
|
830
844
|
rpc?.broadcast.documentsUpdated(documents);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
845
|
+
const outputDocumentsPath = await getOutputDocumentsPath(
|
|
846
|
+
options.outputDocuments,
|
|
847
|
+
nuxt.options.buildDir,
|
|
848
|
+
rootResolver.resolvePath
|
|
849
|
+
);
|
|
850
|
+
if (outputDocumentsPath) {
|
|
851
|
+
outputDocuments(outputDocumentsPath, documents);
|
|
837
852
|
if (isFirst) {
|
|
838
|
-
logger.info("Documents generated at " +
|
|
853
|
+
logger.info("Documents generated at " + outputDocumentsPath);
|
|
839
854
|
}
|
|
840
855
|
}
|
|
841
856
|
if (hasErrors) {
|
|
@@ -922,11 +937,15 @@ const module = defineNuxtModule({
|
|
|
922
937
|
}
|
|
923
938
|
});
|
|
924
939
|
if (result.dst.includes(GraphqlMiddlewareTemplate.Documents)) {
|
|
925
|
-
nuxt.options.alias["#graphql-documents"] =
|
|
940
|
+
nuxt.options.alias["#graphql-documents"] = pathWithoutExtension(
|
|
941
|
+
result.dst
|
|
942
|
+
);
|
|
926
943
|
} else if (result.dst.includes(GraphqlMiddlewareTemplate.OperationTypes)) {
|
|
927
|
-
nuxt.options.alias["#graphql-operations"] =
|
|
944
|
+
nuxt.options.alias["#graphql-operations"] = pathWithoutExtension(
|
|
945
|
+
result.dst
|
|
946
|
+
);
|
|
928
947
|
} else if (result.dst.includes(GraphqlMiddlewareTemplate.ComposableContext)) {
|
|
929
|
-
nuxt.options.alias["#nuxt-graphql-middleware/generated-types"] = result.dst;
|
|
948
|
+
nuxt.options.alias["#nuxt-graphql-middleware/generated-types"] = pathWithoutExtension(result.dst);
|
|
930
949
|
}
|
|
931
950
|
});
|
|
932
951
|
addTemplate({
|
|
@@ -998,7 +1017,7 @@ export { serverOptions }
|
|
|
998
1017
|
return `
|
|
999
1018
|
import type { GraphqlMiddlewareServerOptions } from '${moduleTypesPath}'
|
|
1000
1019
|
${serverOptionsLineTypes}
|
|
1001
|
-
import type { GraphqlServerResponse } from '
|
|
1020
|
+
import type { GraphqlServerResponse } from '${runtimeTypesPath}'
|
|
1002
1021
|
import type { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types'
|
|
1003
1022
|
|
|
1004
1023
|
type GraphqlResponseAdditions =
|
|
@@ -1033,31 +1052,37 @@ export { clientOptions }`;
|
|
|
1033
1052
|
return `export const clientOptions = {}`;
|
|
1034
1053
|
}
|
|
1035
1054
|
});
|
|
1055
|
+
const runtimeTypesPath = relative(
|
|
1056
|
+
nuxt.options.buildDir,
|
|
1057
|
+
moduleResolver.resolve("./runtime/types.ts")
|
|
1058
|
+
);
|
|
1036
1059
|
addTemplate({
|
|
1037
1060
|
filename: "graphqlMiddleware.clientOptions.d.ts",
|
|
1038
1061
|
write: true,
|
|
1039
1062
|
getContents: () => {
|
|
1040
1063
|
if (clientOptionsImport) {
|
|
1041
|
-
return `import { GraphqlClientOptions } from '
|
|
1064
|
+
return `import type { GraphqlClientOptions } from '${runtimeTypesPath}'
|
|
1042
1065
|
${clientOptionsImport}
|
|
1043
1066
|
|
|
1044
1067
|
export type GraphqlClientContext = typeof clientOptions extends GraphqlClientOptions<infer R> ? R : {}
|
|
1045
1068
|
|
|
1046
1069
|
export { clientOptions }`;
|
|
1047
1070
|
}
|
|
1048
|
-
return `import { GraphqlClientOptions } from '
|
|
1071
|
+
return `import type { GraphqlClientOptions } from '${runtimeTypesPath}'
|
|
1049
1072
|
export const clientOptions: GraphqlClientOptions
|
|
1050
1073
|
|
|
1051
1074
|
export type GraphqlClientContext = {}
|
|
1052
1075
|
`;
|
|
1053
1076
|
}
|
|
1054
1077
|
});
|
|
1055
|
-
nuxt.options.alias["#graphql-middleware-client-options"] = clientOptionsTemplate.dst;
|
|
1078
|
+
nuxt.options.alias["#graphql-middleware-client-options"] = pathWithoutExtension(clientOptionsTemplate.dst);
|
|
1056
1079
|
nuxt.options.nitro.externals = nuxt.options.nitro.externals || {};
|
|
1057
1080
|
nuxt.options.nitro.externals.inline = nuxt.options.nitro.externals.inline || [];
|
|
1058
1081
|
nuxt.options.nitro.externals.inline.push(template.dst);
|
|
1059
|
-
nuxt.options.alias["#graphql-middleware-server-options-build"] = template.dst;
|
|
1060
|
-
nuxt.options.alias["#graphql-middleware/types"] =
|
|
1082
|
+
nuxt.options.alias["#graphql-middleware-server-options-build"] = pathWithoutExtension(template.dst);
|
|
1083
|
+
nuxt.options.alias["#graphql-middleware/types"] = pathWithoutExtension(
|
|
1084
|
+
moduleResolver.resolve("./runtime/types.ts")
|
|
1085
|
+
);
|
|
1061
1086
|
addServerHandler({
|
|
1062
1087
|
handler: moduleResolver.resolve("./runtime/serverHandler/index"),
|
|
1063
1088
|
route: options.serverApiPrefix + "/:operation/:name"
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"172a2fbf-9aed-4d11-81c4-ac46ab9b664c","timestamp":1731677992311,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|