Skip to content

Commit 2733348

Browse files
Bump nuxt from 3.0.0-rc.6 to 3.0.0-rc.8 (#1304)
Bumps [nuxt](https://github.com/nuxt/nuxt.js) from 3.0.0-rc.6 to 3.0.0-rc.8. - [Release notes](https://github.com/nuxt/nuxt.js/releases) - [Changelog](https://github.com/nuxt/nuxt.js/blob/dev/RELEASE_PLAN.md) - [Commits](https://github.com/nuxt/nuxt.js/commits) --- updated-dependencies: - dependency-name: nuxt dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 1e5ffcb commit 2733348

File tree

5 files changed

+786
-498
lines changed

5 files changed

+786
-498
lines changed

modules/graphql.mjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { defineNuxtModule } from '@nuxt/kit'
2+
import { printSchema } from 'graphql'
3+
import { loadSchema as loadGraphqlSchema } from '@graphql-tools/load'
4+
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
5+
6+
// WARNING: This is a duplicate of the function with the same name defined in server/schema
7+
// Due to how nuxt/kit works, we have to define the module as a mjs file instead of ts (otherwise it resolves imports as cjs)
8+
// And thus we cannot reuse a ts file here
9+
/**
10+
* Loads the schema from the GraphQL files.
11+
* This method should not be used in production, since the graphql files are not deployed.
12+
* @returns the GraphQL schema
13+
*/
14+
export async function loadSchemaFromFiles()/*: Promise<GraphQLSchema>*/ {
15+
return await loadGraphqlSchema('./server/**/*.graphql', {
16+
loaders: [new GraphQLFileLoader()],
17+
})
18+
}
19+
20+
export default defineNuxtModule({
21+
setup(options, nuxt) {
22+
nuxt.hook('nitro:config', async (nitroConfig) => {
23+
// Register #graphql/schema virtual module
24+
nitroConfig.virtual = nitroConfig.virtual || {}
25+
nitroConfig.virtual['#graphql/schema'] = async () => {
26+
const schema = await loadSchemaFromFiles()
27+
return `
28+
import { loadSchemaSync } from '@graphql-tools/load'
29+
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
30+
export const schema = loadSchemaSync(\`${printSchema(schema)}\`, {
31+
loaders: [new GraphQLFileLoader()]
32+
})
33+
`
34+
}
35+
})
36+
},
37+
})

nuxt.config.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { defineNuxtConfig } from 'nuxt'
2-
import type { NitroConfig } from 'nitropack'
3-
import { printSchema } from 'graphql'
42
import { constructConfig } from './config'
5-
import { loadSchemaFromFiles } from './server/schema'
63

74
export default defineNuxtConfig({
85
/*
@@ -67,6 +64,8 @@ export default defineNuxtConfig({
6764
'@pinia/nuxt',
6865
// Add storybook support
6966
'./modules/storybook',
67+
// Add graphql support
68+
'./modules/graphql',
7069
// Add vue runtime compiler as temporary workaround for https://github.com/nuxt/framework/issues/4661
7170
'nuxt3-runtime-compiler-module',
7271
],
@@ -94,27 +93,6 @@ export default defineNuxtConfig({
9493
*/
9594
storybook: {},
9695

97-
/**
98-
* Register custom (build) event listener
99-
* See https://v3.nuxtjs.org/api/configuration/nuxt.config#hooks
100-
*/
101-
hooks: {
102-
'nitro:config'(nitroConfig: NitroConfig) {
103-
// Register #graphql/schema virtual module
104-
nitroConfig.virtual = nitroConfig.virtual || {}
105-
nitroConfig.virtual['#graphql/schema'] = async () => {
106-
const schema = await loadSchemaFromFiles()
107-
return `
108-
import { loadSchemaSync } from '@graphql-tools/load'
109-
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
110-
export const schema = loadSchemaSync(\`${printSchema(schema)}\`, {
111-
loaders: [new GraphQLFileLoader()]
112-
})
113-
`
114-
}
115-
},
116-
},
117-
11896
vite: {
11997
server: {
12098
// Configure vite for HMR with Gitpod

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"storybook": "start-storybook -p 6006 --preview-url=http://localhost:3000/_storybook/external-iframe --no-manager-cache",
2727
"storybook:build": "build-storybook",
2828
"storybook:publish": "chromatic --exit-zero-on-changes --build-script-name storybook:build",
29-
"graphql:generate": "graphql-codegen",
30-
"graphql:generate:watch": "graphql-codegen --watch",
29+
"graphql:generate": "graphql-codegen-esm",
30+
"graphql:generate:watch": "graphql-codegen-esm --watch",
3131
"graphql:validate": "graphql-inspector validate --apollo '{pages,components}/**/*.vue' 'server/**/*.graphql'",
3232
"docker:redis": "docker run -d --rm --name JabRefRedis -p 6380:6379 redis --requirepass jabref",
3333
"lint": "yarn lint:js && yarn lint:graphql",
@@ -134,7 +134,7 @@
134134
"jest-mock-extended": "^2.0.7",
135135
"mount-vue-component": "^0.10.2",
136136
"newman": "^5.3.2",
137-
"nuxt": "^3.0.0-rc.6",
137+
"nuxt": "^3.0.0-rc.8",
138138
"nuxt3-runtime-compiler-module": "^1.0.4",
139139
"patch-package": "^6.4.7",
140140
"postcss-custom-properties": "^12.1.7",
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
diff --git a/node_modules/h3/dist/index.cjs b/node_modules/h3/dist/index.cjs
2-
index 44af08c..1c74a78 100644
2+
index e72fc41..e8dec25 100644
33
--- a/node_modules/h3/dist/index.cjs
44
+++ b/node_modules/h3/dist/index.cjs
5-
@@ -193,7 +193,8 @@ function createError(input) {
6-
if (input instanceof H3Error) {
5+
@@ -243,7 +243,8 @@ function createError(input) {
6+
if (isError(input)) {
77
return input;
88
}
99
- const err = new H3Error(input.message ?? input.statusMessage, input.cause ? { cause: input.cause } : void 0);
1010
+ // CHANGED: Workaround for https://github.com/nuxt-community/storybook/issues/377
1111
+ const err = new H3Error(input.message !== null ? input.message : input.statusMessage, input.cause ? { cause: input.cause } : void 0);
12-
if (input.statusCode) {
13-
err.statusCode = input.statusCode;
14-
}
12+
if ("stack" in input) {
13+
try {
14+
Object.defineProperty(err, "stack", { get() {

0 commit comments

Comments
 (0)