@stonecrop/nuxt-grafserv 0.18.0 → 0.20.0
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.json +1 -1
- package/dist/module.mjs +29 -2
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -51,7 +51,25 @@ const module$1 = defineNuxtModule({
|
|
|
51
51
|
validateConfig(options);
|
|
52
52
|
const graphiqlEnabled = options.graphiql ?? nuxt.options.dev;
|
|
53
53
|
const { resolve } = createResolver(import.meta.url);
|
|
54
|
-
const
|
|
54
|
+
const selfRequire = createRequire(import.meta.url);
|
|
55
|
+
const hostRequire = createRequire(join(nuxt.options.rootDir, "package.json"));
|
|
56
|
+
let postgraphileRequire;
|
|
57
|
+
try {
|
|
58
|
+
postgraphileRequire = createRequire(hostRequire.resolve("postgraphile"));
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
const resolveOneInstance = (specifier) => {
|
|
62
|
+
for (const from of [postgraphileRequire, hostRequire, selfRequire]) {
|
|
63
|
+
if (!from) continue;
|
|
64
|
+
try {
|
|
65
|
+
return from.resolve(specifier);
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
throw new Error(
|
|
70
|
+
`[@stonecrop/nuxt-grafserv] Could not resolve '${specifier}' from PostGraphile, from the app at ${nuxt.options.rootDir}, or from this module's own dependencies.`
|
|
71
|
+
);
|
|
72
|
+
};
|
|
55
73
|
nuxt.hook("nitro:config", (config) => {
|
|
56
74
|
config.alias = config.alias || {};
|
|
57
75
|
config.alias["#grafserv-server"] = join(nuxt.options.rootDir, "server");
|
|
@@ -226,7 +244,10 @@ export default {
|
|
|
226
244
|
...config.externals?.external ?? [],
|
|
227
245
|
"graphql",
|
|
228
246
|
"grafast",
|
|
247
|
+
"grafserv",
|
|
229
248
|
"postgraphile",
|
|
249
|
+
"postgraphile/graphql",
|
|
250
|
+
"postgraphile/grafast",
|
|
230
251
|
"graphile-config",
|
|
231
252
|
"graphile-build",
|
|
232
253
|
"@dataplan/pg",
|
|
@@ -235,9 +256,15 @@ export default {
|
|
|
235
256
|
"@graphql-tools/graphql-file-loader"
|
|
236
257
|
]
|
|
237
258
|
};
|
|
238
|
-
const grafastPath = require.resolve("grafast");
|
|
239
259
|
config.alias = config.alias || {};
|
|
260
|
+
const grafastPath = resolveOneInstance("grafast");
|
|
261
|
+
const graphqlPath = resolveOneInstance("graphql");
|
|
240
262
|
config.alias["grafast"] = grafastPath;
|
|
263
|
+
config.alias["graphql"] = graphqlPath;
|
|
264
|
+
if (postgraphileRequire) {
|
|
265
|
+
config.alias["postgraphile/grafast"] = grafastPath;
|
|
266
|
+
config.alias["postgraphile/graphql"] = graphqlPath;
|
|
267
|
+
}
|
|
241
268
|
config.typescript = config.typescript || {};
|
|
242
269
|
config.typescript.tsConfig = config.typescript.tsConfig || {};
|
|
243
270
|
config.typescript.tsConfig.compilerOptions = config.typescript.tsConfig.compilerOptions || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/nuxt-grafserv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Pluggable Grafserv GraphQL server as Nuxt Module",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/agritheory/stonecrop/issues"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"grafserv": "^1.0.0",
|
|
45
45
|
"graphql": "^16.14.0",
|
|
46
46
|
"postgraphile": "^5.0.3",
|
|
47
|
-
"@stonecrop/graphql-middleware": "0.
|
|
47
|
+
"@stonecrop/graphql-middleware": "0.20.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@eslint/js": "^10.0.1",
|