-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use npm graphql (16) instead of deno (15)
- Loading branch information
v1rtl
committed
Jan 28, 2023
1 parent
ce66467
commit 6ffc513
Showing
6 changed files
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"deno.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ Create a GraphQL schema AST from template literal. | |
## Example | ||
|
||
```ts | ||
import { buildASTSchema, graphql } from 'https://deno.land/x/[email protected]/mod.ts' | ||
import { buildASTSchema, graphql } from 'https://esm.sh/[email protected]' | ||
import { gql } from 'https://deno.land/x/graphql_tag/mod.ts' | ||
|
||
const typeDefs = gql` | ||
|
@@ -32,7 +32,7 @@ console.log(await graphql(schema, query, resolvers)) | |
[docs-badge]: https://img.shields.io/github/v/release/deno-libs/graphql-tag?color=yellow&label=Documentation&logo=deno&style=flat-square | ||
[docs]: https://doc.deno.land/https/deno.land/x/graphql_tag/mod.ts | ||
[releases-page]: https://github.com/deno-libs/graphql-tag/releases | ||
[gh-actions-img]: https://img.shields.io/github/workflow/status/deno-libs/graphql-tag/CI?style=flat-square | ||
[codecov]: https://codecov.io/gh/deno-libs/graphql-tag | ||
[gh-actions-img]: https://img.shields.io/github/actions/workflow/status/deno-libs/graphql-tag/main.yml?branch=master&style=flat-square | ||
[codecov]: https://codecov.io/gh/deno-libs/graphql_tag | ||
[github-actions]: https://github.com/deno-libs/graphql-tag/actions | ||
[codecov-badge]: https://img.shields.io/codecov/c/gh/deno-libs/graphql-tag?style=flat-square | ||
[codecov-badge]: https://img.shields.io/codecov/c/gh/deno-libs/graphql_tag?style=flat-square |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { parse } from 'https://esm.sh/[email protected]/language/parser' | ||
export type { Location, DefinitionNode, DocumentNode } from 'https://esm.sh/[email protected]/language/ast' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { buildASTSchema, graphql } from 'https://deno.land/x/[email protected]/mod.ts' | ||
import { buildASTSchema, graphql } from 'https://esm.sh/[email protected]' | ||
import { gql } from './mod.ts' | ||
|
||
const typeDefs = gql` | ||
|
@@ -19,4 +19,4 @@ const resolvers = { | |
|
||
const schema = buildASTSchema(typeDefs) | ||
|
||
console.log(await graphql(schema, query, resolvers)) | ||
console.log(await graphql({ schema, source: query, rootValue: resolvers })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import { parse, DocumentNode, DefinitionNode, Location } from 'https://deno.land/x/[email protected]/mod.ts' | ||
|
||
import { parse, Location, DefinitionNode, DocumentNode } from './deps.ts' | ||
// A map docString -> graphql document | ||
const docCache = new Map<string, DocumentNode>() | ||
|
||
// A map fragmentName -> [normalized source] | ||
const fragmentSourceMap = new Map<string, Set<string>>() | ||
|
||
let printFragmentWarnings = true | ||
let experimentalFragmentVariables = false | ||
let allowLegacyFragmentVariables = false | ||
|
||
// Strip insignificant whitespace | ||
// Note that this could do a lot more, such as reorder fields etc. | ||
|
@@ -92,7 +91,7 @@ function parseDocument(source: string) { | |
var cacheKey = normalize(source) | ||
if (!docCache.has(cacheKey)) { | ||
const parsed = parse(source, { | ||
experimentalFragmentVariables | ||
allowLegacyFragmentVariables | ||
}) | ||
if (!parsed || parsed.kind !== 'Document') { | ||
throw new Error('Not a valid GraphQL document.') | ||
|
@@ -159,9 +158,9 @@ export function disableFragmentWarnings() { | |
} | ||
|
||
export function enableExperimentalFragmentVariables() { | ||
experimentalFragmentVariables = true | ||
allowLegacyFragmentVariables = true | ||
} | ||
|
||
export function disableExperimentalFragmentVariables() { | ||
experimentalFragmentVariables = false | ||
allowLegacyFragmentVariables = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { buildASTSchema, isSchema } from 'https://deno.land/x/[email protected]/mod.ts' | ||
import { buildASTSchema, isSchema } from 'https://esm.sh/[email protected]' | ||
import { it, expect, run } from 'https://deno.land/x/[email protected]/mod.ts' | ||
import { gql } from './mod.ts' | ||
|
||
|