nuxt-graphql-middleware 4.3.0 → 4.3.2
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/681c6bf3-56ef-4ca6-8973-d750fea9d239.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 +43 -22
- 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},1734444332573,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"681c6bf3-56ef-4ca6-8973-d750fea9d239",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},1734444332573,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"681c6bf3-56ef-4ca6-8973-d750fea9d239",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"681c6bf3-56ef-4ca6-8973-d750fea9d239","timestamp":1734444323331}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"681c6bf3-56ef-4ca6-8973-d750fea9d239","timestamp":1734444323331,"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},1734444332573,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"681c6bf3-56ef-4ca6-8973-d750fea9d239",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
|
@@ -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.2";
|
|
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,6 +733,16 @@ 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
|
|
|
737
747
|
const RPC_NAMESPACE = "nuxt-graphql-middleware";
|
|
738
748
|
const module = defineNuxtModule({
|
|
@@ -747,6 +757,9 @@ const module = defineNuxtModule({
|
|
|
747
757
|
defaults: defaultOptions,
|
|
748
758
|
async setup(passedOptions, nuxt) {
|
|
749
759
|
const options = defu({}, passedOptions, defaultOptions);
|
|
760
|
+
function addAlias(name2, aliasPath) {
|
|
761
|
+
nuxt.options.alias[name2] = aliasPath;
|
|
762
|
+
}
|
|
750
763
|
const isModuleBuild = process.env.MODULE_BUILD === "true" && nuxt.options._prepare;
|
|
751
764
|
if (isModuleBuild) {
|
|
752
765
|
options.graphqlEndpoint = "http://localhost";
|
|
@@ -828,14 +841,15 @@ const module = defineNuxtModule({
|
|
|
828
841
|
ctx.templates = templates;
|
|
829
842
|
ctx.documents = documents;
|
|
830
843
|
rpc?.broadcast.documentsUpdated(documents);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
844
|
+
const outputDocumentsPath = await getOutputDocumentsPath(
|
|
845
|
+
options.outputDocuments,
|
|
846
|
+
nuxt.options.buildDir,
|
|
847
|
+
rootResolver.resolvePath
|
|
848
|
+
);
|
|
849
|
+
if (outputDocumentsPath) {
|
|
850
|
+
outputDocuments(outputDocumentsPath, documents);
|
|
837
851
|
if (isFirst) {
|
|
838
|
-
logger.info("Documents generated at " +
|
|
852
|
+
logger.info("Documents generated at " + outputDocumentsPath);
|
|
839
853
|
}
|
|
840
854
|
}
|
|
841
855
|
if (hasErrors) {
|
|
@@ -922,11 +936,11 @@ const module = defineNuxtModule({
|
|
|
922
936
|
}
|
|
923
937
|
});
|
|
924
938
|
if (result.dst.includes(GraphqlMiddlewareTemplate.Documents)) {
|
|
925
|
-
|
|
939
|
+
addAlias("#graphql-documents", result.dst);
|
|
926
940
|
} else if (result.dst.includes(GraphqlMiddlewareTemplate.OperationTypes)) {
|
|
927
|
-
|
|
941
|
+
addAlias("#graphql-operations", result.dst);
|
|
928
942
|
} else if (result.dst.includes(GraphqlMiddlewareTemplate.ComposableContext)) {
|
|
929
|
-
|
|
943
|
+
addAlias("#nuxt-graphql-middleware/generated-types", result.dst);
|
|
930
944
|
}
|
|
931
945
|
});
|
|
932
946
|
addTemplate({
|
|
@@ -998,7 +1012,7 @@ export { serverOptions }
|
|
|
998
1012
|
return `
|
|
999
1013
|
import type { GraphqlMiddlewareServerOptions } from '${moduleTypesPath}'
|
|
1000
1014
|
${serverOptionsLineTypes}
|
|
1001
|
-
import type { GraphqlServerResponse } from '
|
|
1015
|
+
import type { GraphqlServerResponse } from '${runtimeTypesPath}'
|
|
1002
1016
|
import type { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types'
|
|
1003
1017
|
|
|
1004
1018
|
type GraphqlResponseAdditions =
|
|
@@ -1033,31 +1047,38 @@ export { clientOptions }`;
|
|
|
1033
1047
|
return `export const clientOptions = {}`;
|
|
1034
1048
|
}
|
|
1035
1049
|
});
|
|
1050
|
+
const runtimeTypesPath = relative(
|
|
1051
|
+
nuxt.options.buildDir,
|
|
1052
|
+
moduleResolver.resolve("./runtime/types.ts")
|
|
1053
|
+
);
|
|
1036
1054
|
addTemplate({
|
|
1037
1055
|
filename: "graphqlMiddleware.clientOptions.d.ts",
|
|
1038
1056
|
write: true,
|
|
1039
1057
|
getContents: () => {
|
|
1040
1058
|
if (clientOptionsImport) {
|
|
1041
|
-
return `import { GraphqlClientOptions } from '
|
|
1059
|
+
return `import type { GraphqlClientOptions } from '${runtimeTypesPath}'
|
|
1042
1060
|
${clientOptionsImport}
|
|
1043
1061
|
|
|
1044
1062
|
export type GraphqlClientContext = typeof clientOptions extends GraphqlClientOptions<infer R> ? R : {}
|
|
1045
1063
|
|
|
1046
1064
|
export { clientOptions }`;
|
|
1047
1065
|
}
|
|
1048
|
-
return `import { GraphqlClientOptions } from '
|
|
1066
|
+
return `import type { GraphqlClientOptions } from '${runtimeTypesPath}'
|
|
1049
1067
|
export const clientOptions: GraphqlClientOptions
|
|
1050
1068
|
|
|
1051
1069
|
export type GraphqlClientContext = {}
|
|
1052
1070
|
`;
|
|
1053
1071
|
}
|
|
1054
1072
|
});
|
|
1055
|
-
|
|
1073
|
+
addAlias("#graphql-middleware-client-options", clientOptionsTemplate.dst);
|
|
1056
1074
|
nuxt.options.nitro.externals = nuxt.options.nitro.externals || {};
|
|
1057
1075
|
nuxt.options.nitro.externals.inline = nuxt.options.nitro.externals.inline || [];
|
|
1058
1076
|
nuxt.options.nitro.externals.inline.push(template.dst);
|
|
1059
|
-
|
|
1060
|
-
|
|
1077
|
+
addAlias("#graphql-middleware-server-options-build", template.dst);
|
|
1078
|
+
addAlias(
|
|
1079
|
+
"#graphql-middleware/types",
|
|
1080
|
+
moduleResolver.resolve("./runtime/types.ts")
|
|
1081
|
+
);
|
|
1061
1082
|
addServerHandler({
|
|
1062
1083
|
handler: moduleResolver.resolve("./runtime/serverHandler/index"),
|
|
1063
1084
|
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":[]}
|