Skip to content

Commit

Permalink
Bump nuxt from 3.0.0-rc.6 to 3.0.0-rc.8 (#1304)
Browse files Browse the repository at this point in the history
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] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] committed Aug 13, 2022
1 parent 1e5ffcb commit 2733348
Show file tree
Hide file tree
Showing 5 changed files with 786 additions and 498 deletions.
37 changes: 37 additions & 0 deletions modules/graphql.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineNuxtModule } from '@nuxt/kit'
import { printSchema } from 'graphql'
import { loadSchema as loadGraphqlSchema } from '@graphql-tools/load'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'

// WARNING: This is a duplicate of the function with the same name defined in server/schema
// 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)
// And thus we cannot reuse a ts file here
/**
* Loads the schema from the GraphQL files.
* This method should not be used in production, since the graphql files are not deployed.
* @returns the GraphQL schema
*/
export async function loadSchemaFromFiles()/*: Promise<GraphQLSchema>*/ {
return await loadGraphqlSchema('./server/**/*.graphql', {
loaders: [new GraphQLFileLoader()],
})
}

export default defineNuxtModule({
setup(options, nuxt) {
nuxt.hook('nitro:config', async (nitroConfig) => {
// Register #graphql/schema virtual module
nitroConfig.virtual = nitroConfig.virtual || {}
nitroConfig.virtual['#graphql/schema'] = async () => {
const schema = await loadSchemaFromFiles()
return `
import { loadSchemaSync } from '@graphql-tools/load'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
export const schema = loadSchemaSync(\`${printSchema(schema)}\`, {
loaders: [new GraphQLFileLoader()]
})
`
}
})
},
})
26 changes: 2 additions & 24 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { defineNuxtConfig } from 'nuxt'
import type { NitroConfig } from 'nitropack'
import { printSchema } from 'graphql'
import { constructConfig } from './config'
import { loadSchemaFromFiles } from './server/schema'

export default defineNuxtConfig({
/*
Expand Down Expand Up @@ -67,6 +64,8 @@ export default defineNuxtConfig({
'@pinia/nuxt',
// Add storybook support
'./modules/storybook',
// Add graphql support
'./modules/graphql',
// Add vue runtime compiler as temporary workaround for https://github.com/nuxt/framework/issues/4661
'nuxt3-runtime-compiler-module',
],
Expand Down Expand Up @@ -94,27 +93,6 @@ export default defineNuxtConfig({
*/
storybook: {},

/**
* Register custom (build) event listener
* See https://v3.nuxtjs.org/api/configuration/nuxt.config#hooks
*/
hooks: {
'nitro:config'(nitroConfig: NitroConfig) {
// Register #graphql/schema virtual module
nitroConfig.virtual = nitroConfig.virtual || {}
nitroConfig.virtual['#graphql/schema'] = async () => {
const schema = await loadSchemaFromFiles()
return `
import { loadSchemaSync } from '@graphql-tools/load'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
export const schema = loadSchemaSync(\`${printSchema(schema)}\`, {
loaders: [new GraphQLFileLoader()]
})
`
}
},
},

vite: {
server: {
// Configure vite for HMR with Gitpod
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"storybook": "start-storybook -p 6006 --preview-url=http://localhost:3000/_storybook/external-iframe --no-manager-cache",
"storybook:build": "build-storybook",
"storybook:publish": "chromatic --exit-zero-on-changes --build-script-name storybook:build",
"graphql:generate": "graphql-codegen",
"graphql:generate:watch": "graphql-codegen --watch",
"graphql:generate": "graphql-codegen-esm",
"graphql:generate:watch": "graphql-codegen-esm --watch",
"graphql:validate": "graphql-inspector validate --apollo '{pages,components}/**/*.vue' 'server/**/*.graphql'",
"docker:redis": "docker run -d --rm --name JabRefRedis -p 6380:6379 redis --requirepass jabref",
"lint": "yarn lint:js && yarn lint:graphql",
Expand Down Expand Up @@ -134,7 +134,7 @@
"jest-mock-extended": "^2.0.7",
"mount-vue-component": "^0.10.2",
"newman": "^5.3.2",
"nuxt": "^3.0.0-rc.6",
"nuxt": "^3.0.0-rc.8",
"nuxt3-runtime-compiler-module": "^1.0.4",
"patch-package": "^6.4.7",
"postcss-custom-properties": "^12.1.7",
Expand Down
12 changes: 6 additions & 6 deletions patches/h3+0.7.10.patch → patches/h3+0.7.15.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
diff --git a/node_modules/h3/dist/index.cjs b/node_modules/h3/dist/index.cjs
index 44af08c..1c74a78 100644
index e72fc41..e8dec25 100644
--- a/node_modules/h3/dist/index.cjs
+++ b/node_modules/h3/dist/index.cjs
@@ -193,7 +193,8 @@ function createError(input) {
if (input instanceof H3Error) {
@@ -243,7 +243,8 @@ function createError(input) {
if (isError(input)) {
return input;
}
- const err = new H3Error(input.message ?? input.statusMessage, input.cause ? { cause: input.cause } : void 0);
+ // CHANGED: Workaround for https://github.com/nuxt-community/storybook/issues/377
+ const err = new H3Error(input.message !== null ? input.message : input.statusMessage, input.cause ? { cause: input.cause } : void 0);
if (input.statusCode) {
err.statusCode = input.statusCode;
}
if ("stack" in input) {
try {
Object.defineProperty(err, "stack", { get() {
Loading

0 comments on commit 2733348

Please sign in to comment.