Skip to content

Commit

Permalink
chore(deps): update dependency vite to v3 (master) (#1444)
Browse files Browse the repository at this point in the history
* chore(deps): update actions/checkout action to v3 (#1431)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency ioredis to v5.2.2 (#1450)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Replace cross-undici-fetch with @whatwg-node/fetch

* chore(deps): update dependency vite to v3

* Fix GraphiQL build

* Go

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
  • Loading branch information
renovate[bot] and ardatan committed Jul 24, 2022
1 parent 0afe6d2 commit f6ff0c2
Show file tree
Hide file tree
Showing 32 changed files with 147 additions and 86 deletions.
2 changes: 1 addition & 1 deletion benchmark/hello-world/check-server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('cross-undici-fetch')
require('@whatwg-node/fetch')
.fetch(
`http://localhost:4000/graphql?query=${encodeURIComponent(
'{ greetings }',
Expand Down
2 changes: 1 addition & 1 deletion examples/azure-function/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AzureFunction, Context, HttpRequest } from '@azure/functions'
import { createServer } from '@graphql-yoga/common'
import { Request } from 'cross-undici-fetch'
import { Request } from '@whatwg-node/fetch'

const httpTrigger: AzureFunction = async function (
context: Context,
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudflare-modules/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import worker from '../src/index.js'
import { Request } from 'cross-undici-fetch'
import { Request } from '@whatwg-node/fetch'
import { getIntrospectionQuery } from 'graphql'

test('should render GraphiQL', async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/error-handling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@graphql-yoga/node": "2.13.4",
"cross-undici-fetch": "^0.4.13",
"@whatwg-node/fetch": "^0.0.2",
"graphql": "^16.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/error-handling/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createServer, GraphQLYogaError } from '@graphql-yoga/node'
import { fetch } from 'cross-undici-fetch'
import { fetch } from '@whatwg-node/fetch'

const users = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/redis-pub-sub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@graphql-yoga/node": "2.13.4",
"@graphql-yoga/redis-event-target": "0.1.2",
"graphql": "16.5.0",
"ioredis": "5.2.1"
"ioredis": "5.2.2"
},
"module": "commonjs"
}
2 changes: 1 addition & 1 deletion examples/service-worker/test/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getIntrospectionQuery } from 'graphql'
import { createServer } from '@graphql-yoga/common'
import { Request } from 'cross-undici-fetch'
import { Request } from '@whatwg-node/fetch'

const listenerMap = new Map<string, Set<EventListenerOrEventListenerObject>>()

Expand Down
4 changes: 2 additions & 2 deletions examples/sveltekit/__tests__/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let toSkip = false;

describe('SvelteKit integration', () => {
beforeAll(async () => {
console.time('Setup SvelteKit tests');
// console.time('Setup SvelteKit tests');

const nodeVersion = execSync('node -v').toString();
if (nodeVersion.includes('v12')) {
Expand Down Expand Up @@ -49,7 +49,7 @@ describe('SvelteKit integration', () => {
}

// How long it took?
console.timeEnd('Setup SvelteKit tests');
// console.timeEnd('Setup SvelteKit tests');
}, timings.setup.total);

beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"svelte-preprocess": "4.10.7",
"tslib": "2.4.0",
"typescript": "4.7.4",
"vite": "2.9.14"
"vite": "3.0.2"
},
"dependencies": {
"@envelop/graphql-jit": "4.4.0",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"resolutions": {
"@changesets/apply-release-plan": "6.0.0",
"graphql": "16.5.0",
"cross-undici-fetch": "0.4.14",
"@types/react": "17.0.39",
"@types/react-dom": "17.0.17",
"react": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/__tests__/cors.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request } from 'cross-undici-fetch'
import { Request } from '@whatwg-node/fetch'
import {
getCORSHeadersByRequestAndOptions,
CORSOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@graphql-tools/schema": "^8.5.0",
"@graphql-tools/utils": "^8.8.0",
"@graphql-yoga/subscription": "^2.2.2",
"cross-undici-fetch": "^0.4.13",
"@whatwg-node/fetch": "^0.0.2",
"dset": "^3.1.1",
"tslib": "^2.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/plugins/requestParser/POSTMultipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function parsePOSTMultipartRequest(
try {
requestBody = await request.formData()
} catch (e: unknown) {
// Trick for cross-undici-fetch errors on Node.js
// Trick for @whatwg-node/fetch errors on Node.js
// TODO: This needs a better solution
if (
e instanceof Error &&
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
RequestParser,
ResultProcessor,
} from './plugins/types.js'
import * as crossUndiciFetch from 'cross-undici-fetch'
import * as crossUndiciFetch from '@whatwg-node/fetch'
import { processRequest as processGraphQLParams } from './processRequest.js'
import { defaultYogaLogger, titleBold, YogaLogger } from './logger.js'
import { CORSPluginOptions, useCORS } from './plugins/useCORS.js'
Expand Down
8 changes: 4 additions & 4 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,25 @@ export type FetchEvent = Event & {
export type FetchAPI = {
/**
* WHATWG compliant Request object constructor
* Default: `Request` from `cross-undici-fetch`
* Default: `Request` from `@whatwg-node/fetch`
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request
*/
Request: typeof Request
/**
* WHATWG compliant Response object constructor
* Default: `Response` from `cross-undici-fetch`
* Default: `Response` from `@whatwg-node/fetch`
* @see https://developer.mozilla.org/en-US/docs/Web/API/Response
*/
Response: typeof Response
/**
* WHATWG compliant fetch function
* Default: `fetch` from `cross-undici-fetch`
* Default: `fetch` from `@whatwg-node/fetch`
* @see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
*/
fetch: typeof fetch
/**
* WHATWG compliant ReadableStream object constructor
* Default: `ReadableStream` from `cross-undici-fetch`
* Default: `ReadableStream` from `@whatwg-node/fetch`
* @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
*/
ReadableStream: typeof ReadableStream
Expand Down
2 changes: 1 addition & 1 deletion packages/event-target/redis-event-target/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@types/ioredis-mock": "5.6.0",
"event-target-polyfill": "0.0.3",
"ioredis": "5.2.1",
"ioredis": "5.2.2",
"ioredis-mock": "8.2.2"
},
"type": "module",
Expand Down
4 changes: 3 additions & 1 deletion packages/graphiql/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<script type="module">
import * as yogaGraphiQL from './src/bundle.tsx'
const container = window.document.querySelector('#root')
yogaGraphiQL.renderYogaGraphiQL(container)
yogaGraphiQL.renderYogaGraphiQL(container, {
endpoint: '/graphql',
})
</script>
</body>
</html>
16 changes: 8 additions & 8 deletions packages/graphiql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
"devDependencies": {
"@types/react": "17.0.39",
"@vitejs/plugin-react": "1.3.2",
"vite": "2.9.14"
"vite": "3.0.2"
},
"dependencies": {
"@graphql-tools/url-loader": "^7.11.0",
"copy-to-clipboard": "^3.3.1",
"graphiql": "^1.8.8",
"graphiql-explorer": "^0.9.0",
"graphql": "^16.3.0",
"@graphql-tools/url-loader": "7.13.0",
"copy-to-clipboard": "3.3.1",
"graphiql": "1.8.8",
"graphiql-explorer": "0.9.0",
"graphql": "16.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"use-url-search-params": "^2.5.1",
"json-bigint-patch": "^0.0.8"
"use-url-search-params": "2.5.1",
"json-bigint-patch": "0.0.8"
},
"main": "dist/yoga-graphiql.umd.js",
"module": "dist/yoga-graphiql.es.js",
Expand Down
7 changes: 3 additions & 4 deletions packages/graphiql/src/YogaGraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import 'json-bigint-patch'

const getOperationWithFragments = (
document: DocumentNode,
operationName: string,
operationName?: string,
): DocumentNode => {
const definitions = document.definitions.filter((definition) => {
if (
Expand Down Expand Up @@ -121,12 +121,11 @@ export function YogaGraphiQL(props: YogaGraphiQLProps): React.ReactElement {
return function fetcher(graphQLParams: FetcherParams, opts?: FetcherOpts) {
const document = getOperationWithFragments(
parse(graphQLParams.query),
graphQLParams.operationName,
graphQLParams.operationName ?? undefined,
)

return executor({
document,
operationName: graphQLParams.operationName,
operationName: graphQLParams.operationName ?? undefined,
variables: graphQLParams.variables,
extensions: {
headers: opts?.headers,
Expand Down
4 changes: 4 additions & 0 deletions packages/graphiql/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default defineConfig({
'/graphql': 'http://localhost:4000',
},
},
define: {
'process.env.NODE_ENV': '"production"',
},
build: {
lib: {
entry: path.resolve(__dirname, 'src', 'bundle.tsx'),
Expand All @@ -20,6 +23,7 @@ export default defineConfig({
rollupOptions: {
output: {
/** prevent code-splitting */
inlineDynamicImports: false,
manualChunks: () => '_.js',
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
So Yoga now uses `node-fetch` by default which doesn't affect the existing users. User can configure `cross-undici-fetch` to revert back this behavior;

```ts
import { create } from 'cross-undici-fetch'
import { create } from '@whatwg-node/fetch'

createServer({
fetchAPI: create({ useNodeFetch: false }),
Expand Down
2 changes: 1 addition & 1 deletion packages/node/__tests__/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'json-bigint-patch'
import http from 'http'
import { useLiveQuery } from '@envelop/live-query'
import { InMemoryLiveQueryStore } from '@n1ru4l/in-memory-live-query-store'
import { AbortController, fetch, File, FormData } from 'cross-undici-fetch'
import { AbortController, fetch, File, FormData } from '@whatwg-node/fetch'
import { Plugin } from '@graphql-yoga/common'
import { ExecutionResult } from '@graphql-tools/utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@graphql-tools/utils": "^8.8.0",
"@graphql-yoga/common": "^2.12.3",
"@graphql-yoga/subscription": "^2.2.2",
"cross-undici-fetch": "^0.4.13",
"@whatwg-node/fetch": "^0.0.2",
"tslib": "^2.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getNodeRequest, NodeRequest, sendNodeResponse } from './http-utils.js'
import { YogaServer } from '@graphql-yoga/common'
import type { YogaNodeServerOptions, AddressInfo } from './types.js'
import { platform, release } from 'os'
import { create } from 'cross-undici-fetch'
import { createFetch } from '@whatwg-node/fetch'

class YogaNodeServer<
TServerContext extends Record<string, any>,
Expand All @@ -35,7 +35,7 @@ class YogaNodeServer<
multipart: options?.multipart !== false,
fetchAPI:
options?.fetchAPI ??
create({
createFetch({
useNodeFetch: true,
formDataLimits:
typeof options?.multipart === 'object'
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { YogaServerOptions } from '@graphql-yoga/common'
import type { FormDataLimits } from 'cross-undici-fetch'
import type { FormDataLimits } from '@whatwg-node/fetch'
import type { ServerOptions as HttpsServerOptions } from 'https'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/render-graphiql/scripts/yoga-bundle-string.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fileURLToPath } from 'url'

const directoryName = path.dirname(fileURLToPath(import.meta.url))
const inputPath = path.resolve(directoryName, '..', '..', 'graphiql', 'dist')
const jsFile = path.resolve(inputPath, 'yoga-graphiql.es.js')
const jsFile = path.resolve(inputPath, 'yoga-graphiql.umd.js')
const cssFile = path.resolve(inputPath, 'style.css')

const outFile = path.resolve(directoryName, '..', 'src', 'graphiql.ts')
Expand Down
4 changes: 2 additions & 2 deletions packages/render-graphiql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const renderGraphiQL = (opts?: GraphiQLOptions) => /* HTML */ `
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module">
<script>
${js}
renderYogaGraphiQL(
YogaGraphiQL.renderYogaGraphiQL(
window.document.querySelector('#root'),
${JSON.stringify(opts ?? {})},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js b/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js
index 8c8f6fd..174fd69 100644
index f05ea74..9a0ed16 100644
--- a/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js
+++ b/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js
@@ -130,18 +130,9 @@ function determineDependents({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/@changesets/cli/dist/cli.cjs.dev.js b/node_modules/@changesets/cli/dist/cli.cjs.dev.js
index 129ae05..9b5daeb 100644
index 4b68b5d..55e34bc 100644
--- a/node_modules/@changesets/cli/dist/cli.cjs.dev.js
+++ b/node_modules/@changesets/cli/dist/cli.cjs.dev.js
@@ -639,7 +639,7 @@ const getLastJsonObjectFromString = str => {
@@ -649,7 +649,7 @@ const getLastJsonObjectFromString = str => {
return null;
};

Expand All @@ -12,10 +12,10 @@ index 129ae05..9b5daeb 100644

function jsonParse(input) {
diff --git a/node_modules/@changesets/cli/dist/cli.cjs.prod.js b/node_modules/@changesets/cli/dist/cli.cjs.prod.js
index ee3d78e..dc2a8c7 100644
index 5c4828d..3694ebf 100644
--- a/node_modules/@changesets/cli/dist/cli.cjs.prod.js
+++ b/node_modules/@changesets/cli/dist/cli.cjs.prod.js
@@ -354,7 +354,7 @@ const getLastJsonObjectFromString = str => {
@@ -359,7 +359,7 @@ const getLastJsonObjectFromString = str => {
}
}
return null;
Expand All @@ -25,10 +25,10 @@ index ee3d78e..dc2a8c7 100644
function jsonParse(input) {
try {
diff --git a/node_modules/@changesets/cli/dist/cli.esm.js b/node_modules/@changesets/cli/dist/cli.esm.js
index 19806a8..72859ff 100644
index d715066..bad525f 100644
--- a/node_modules/@changesets/cli/dist/cli.esm.js
+++ b/node_modules/@changesets/cli/dist/cli.esm.js
@@ -616,7 +616,7 @@ const getLastJsonObjectFromString = str => {
@@ -626,7 +626,7 @@ const getLastJsonObjectFromString = str => {
return null;
};

Expand Down
4 changes: 2 additions & 2 deletions website/docs/features/error-masking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Let's setup a simple schema that calls a remote service that is unavailable.

```ts
import { createServer } from '@graphql-yoga/node'
import { fetch } from 'cross-undici-fetch'
import { fetch } from '@whatwg-node/fetch'

// Provide your schema
const server = createServer({
Expand Down Expand Up @@ -99,7 +99,7 @@ node server.js

```ts
import { createServer } from '@graphql-yoga/node'
import { fetch } from 'cross-undici-fetch'
import { fetch } from '@whatwg-node/fetch'

// Provide your schema
const server = createServer({
Expand Down
2 changes: 1 addition & 1 deletion website/docs/integrations/z-other-environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GraphQL Yoga understands [WHATWG `Request` object](https://developer.mozilla.org

```ts
import { createServer } from '@graphql-yoga/common'
import { Request } from 'cross-undici-fetch' // or fetch-like library
import { Request } from '@whatwg-node/fetch' // or fetch-like library
const yoga = createServer<MyRandomCtx>()

Expand Down
Loading

0 comments on commit f6ff0c2

Please sign in to comment.