diff --git a/examples/apollo-server/Query.ts b/examples/apollo-server/Query.ts index da4db98f..611d5fbd 100644 --- a/examples/apollo-server/Query.ts +++ b/examples/apollo-server/Query.ts @@ -1,5 +1,5 @@ -import IPerson from "./interfaces/IPerson"; -import User from "./models/User"; +import IPerson from "./interfaces/IPerson.js"; +import User from "./models/User.js"; /** @gqlQueryField */ export function person(): IPerson { diff --git a/examples/apollo-server/models/Group.ts b/examples/apollo-server/models/Group.ts index 9e672ad3..083ed7a9 100644 --- a/examples/apollo-server/models/Group.ts +++ b/examples/apollo-server/models/Group.ts @@ -1,4 +1,4 @@ -import User from "./User"; +import User from "./User.js"; /** @gqlType */ export default class Group { diff --git a/examples/apollo-server/models/User.ts b/examples/apollo-server/models/User.ts index e529f742..9528528d 100644 --- a/examples/apollo-server/models/User.ts +++ b/examples/apollo-server/models/User.ts @@ -1,5 +1,5 @@ -import IPerson from "../interfaces/IPerson"; -import Group from "./Group"; +import IPerson from "../interfaces/IPerson.js"; +import Group from "./Group.js"; /** @gqlType User */ export default class UserResolver implements IPerson { diff --git a/examples/apollo-server/package.json b/examples/apollo-server/package.json index 22047c24..3b98cf90 100644 --- a/examples/apollo-server/package.json +++ b/examples/apollo-server/package.json @@ -2,6 +2,7 @@ "name": "grats-example-apollo-server", "version": "0.0.0", "description": "Example server showcasing Grats used with Apollo Server", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -28,7 +29,7 @@ "dependencies": { "@apollo/server": "^5.0.0", "@types/node": "^20.8.10", - "graphql": "16.11.0" + "graphql": "17.0.0-alpha.11" }, "devDependencies": { "grats": "workspace:*", diff --git a/examples/apollo-server/schema.ts b/examples/apollo-server/schema.ts index 0b003593..02f6597b 100644 --- a/examples/apollo-server/schema.ts +++ b/examples/apollo-server/schema.ts @@ -3,11 +3,11 @@ * Do not manually edit. Regenerate by running `npx grats`. */ -import UserClass from "./models/User"; -import queryAllUsersResolver from "./models/User"; -import queryMeResolver from "./models/User"; +import UserClass from "./models/User.js"; +import queryAllUsersResolver from "./models/User.js"; +import queryMeResolver from "./models/User.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLList, GraphQLString, GraphQLInterfaceType } from "graphql"; -import { person as queryPersonResolver } from "./Query"; +import { person as queryPersonResolver } from "./Query.js"; export function getSchema(): GraphQLSchema { const GroupType: GraphQLObjectType = new GraphQLObjectType({ name: "Group", diff --git a/examples/apollo-server/server.ts b/examples/apollo-server/server.ts index a1a80e98..e2276d3d 100644 --- a/examples/apollo-server/server.ts +++ b/examples/apollo-server/server.ts @@ -1,6 +1,6 @@ import { ApolloServer } from "@apollo/server"; import { startStandaloneServer } from "@apollo/server/standalone"; -import { getSchema } from "./schema"; +import { getSchema } from "./schema.js"; async function main() { const server = new ApolloServer({ schema: getSchema() }); diff --git a/examples/express-graphql-http/interfaces/IPerson.ts b/examples/express-graphql-http/interfaces/IPerson.ts index 21cbc43c..1be795f1 100644 --- a/examples/express-graphql-http/interfaces/IPerson.ts +++ b/examples/express-graphql-http/interfaces/IPerson.ts @@ -1,4 +1,4 @@ -import User from "../models/User"; +import User from "../models/User.js"; /** @gqlInterface */ export default interface IPerson { diff --git a/examples/express-graphql-http/models/Group.ts b/examples/express-graphql-http/models/Group.ts index 9e672ad3..083ed7a9 100644 --- a/examples/express-graphql-http/models/Group.ts +++ b/examples/express-graphql-http/models/Group.ts @@ -1,4 +1,4 @@ -import User from "./User"; +import User from "./User.js"; /** @gqlType */ export default class Group { diff --git a/examples/express-graphql-http/models/User.ts b/examples/express-graphql-http/models/User.ts index cea29b75..858b38e5 100644 --- a/examples/express-graphql-http/models/User.ts +++ b/examples/express-graphql-http/models/User.ts @@ -1,5 +1,5 @@ -import IPerson from "../interfaces/IPerson"; -import Group from "./Group"; +import IPerson from "../interfaces/IPerson.js"; +import Group from "./Group.js"; /** @gqlType */ export default class User implements IPerson { diff --git a/examples/express-graphql-http/package.json b/examples/express-graphql-http/package.json index 5fefda47..0f87cbf6 100644 --- a/examples/express-graphql-http/package.json +++ b/examples/express-graphql-http/package.json @@ -2,6 +2,7 @@ "name": "grats-example-express-graphql-http", "version": "0.0.0", "description": "Example server showcasing Grats used with Express and graphql-http ", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -30,7 +31,7 @@ "@types/express": "^4.17.20", "@types/node": "^20.8.10", "express": "^4.18.2", - "graphql": "16.8.1", + "graphql": "17.0.0-alpha.11", "graphql-http": "^1.22.0" }, "devDependencies": { diff --git a/examples/express-graphql-http/schema.ts b/examples/express-graphql-http/schema.ts index c0446b29..ea09bc5e 100644 --- a/examples/express-graphql-http/schema.ts +++ b/examples/express-graphql-http/schema.ts @@ -3,11 +3,11 @@ * Do not manually edit. Regenerate by running `npx grats`. */ -import UserClass from "./models/User"; -import queryAllUsersResolver from "./models/User"; -import queryMeResolver from "./models/User"; +import UserClass from "./models/User.js"; +import queryAllUsersResolver from "./models/User.js"; +import queryMeResolver from "./models/User.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLList, GraphQLString, GraphQLInterfaceType } from "graphql"; -import { person as queryPersonResolver } from "./interfaces/IPerson"; +import { person as queryPersonResolver } from "./interfaces/IPerson.js"; export function getSchema(): GraphQLSchema { const GroupType: GraphQLObjectType = new GraphQLObjectType({ name: "Group", diff --git a/examples/express-graphql-http/server.ts b/examples/express-graphql-http/server.ts index e2d6830e..db9645f3 100644 --- a/examples/express-graphql-http/server.ts +++ b/examples/express-graphql-http/server.ts @@ -1,6 +1,6 @@ -import * as express from "express"; +import express from "express"; import { createHandler } from "graphql-http/lib/use/express"; -import { getSchema } from "./schema"; +import { getSchema } from "./schema.js"; const app = express(); diff --git a/examples/express-graphql-http/tsconfig.json b/examples/express-graphql-http/tsconfig.json index 3b3157a9..7869c561 100644 --- a/examples/express-graphql-http/tsconfig.json +++ b/examples/express-graphql-http/tsconfig.json @@ -1,17 +1,14 @@ { - // Most ts-node options can be specified here using their programmatic names. - "ts-node": { - "files": true, - // It is faster to skip typechecking. - // Remove if you want ts-node to do typechecking. - "transpileOnly": false - }, "grats": { "nullableByDefault": false }, "compilerOptions": { "outDir": "dist", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "esnext", "lib": ["esnext"], - "strict": true + "strict": true, + "skipLibCheck": true } } diff --git a/examples/incremental-migration/package.json b/examples/incremental-migration/package.json index 0ad24d75..c2b36b88 100644 --- a/examples/incremental-migration/package.json +++ b/examples/incremental-migration/package.json @@ -2,6 +2,7 @@ "name": "grats-example-migration", "version": "0.0.0", "description": "Example server showcasing an incremental migration from Pothos to Grats", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -33,7 +34,7 @@ "@faker-js/faker": "^8.4.1", "@graphql-tools/schema": "^10.0.3", "@pothos/core": "^3.41.1", - "graphql": "16.8.1", + "graphql": "17.0.0-alpha.11", "graphql-yoga": "^5.0.0", "typescript": "^5.5.4" }, diff --git a/examples/incremental-migration/schemas/gratsGeneratedSchema.ts b/examples/incremental-migration/schemas/gratsGeneratedSchema.ts index 8f8a52c9..ab41ce35 100644 --- a/examples/incremental-migration/schemas/gratsGeneratedSchema.ts +++ b/examples/incremental-migration/schemas/gratsGeneratedSchema.ts @@ -1,7 +1,7 @@ // DO NOT USE DIRECTLY. Prefer the merged schema in `./mergedSchema.ts`. import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLString, GraphQLID } from "graphql"; -import { user as queryUserResolver } from "./../models"; +import { user as queryUserResolver } from "./../models.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/examples/incremental-migration/schemas/mergedSchema.ts b/examples/incremental-migration/schemas/mergedSchema.ts index 1a28fffc..6ad656e5 100644 --- a/examples/incremental-migration/schemas/mergedSchema.ts +++ b/examples/incremental-migration/schemas/mergedSchema.ts @@ -1,9 +1,13 @@ -import { schema as legacySchema } from "./pothosSchema"; -import { getSchema as getGratsSchema } from "./gratsGeneratedSchema"; +import { schema as legacySchema } from "./pothosSchema.js"; +import { getSchema as getGratsSchema } from "./gratsGeneratedSchema.js"; import { mergeSchemas } from "@graphql-tools/schema"; import { printSchema, lexicographicSortSchema } from "graphql"; import fs from "fs"; import path from "path"; +import { fileURLToPath } from "url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); /** * Merges the Pothos (legacy) and Grats (new) schemas into a single schema for diff --git a/examples/incremental-migration/schemas/pothosSchema.ts b/examples/incremental-migration/schemas/pothosSchema.ts index 91baa0b4..57454492 100644 --- a/examples/incremental-migration/schemas/pothosSchema.ts +++ b/examples/incremental-migration/schemas/pothosSchema.ts @@ -1,4 +1,4 @@ -import { Users, Posts, Comments, User, Post, Comment } from "../models"; +import { Users, Posts, Comments, User, Post, Comment } from "../models.js"; import SchemaBuilder from "@pothos/core"; const builder = new SchemaBuilder({}); diff --git a/examples/incremental-migration/server.ts b/examples/incremental-migration/server.ts index b6c89556..74a0d60e 100644 --- a/examples/incremental-migration/server.ts +++ b/examples/incremental-migration/server.ts @@ -1,6 +1,6 @@ import { createServer } from "node:http"; import { createYoga } from "graphql-yoga"; -import { schema } from "./schemas/mergedSchema"; +import { schema } from "./schemas/mergedSchema.js"; const yoga = createYoga({ schema }); diff --git a/examples/next-js/package.json b/examples/next-js/package.json index c08a13e5..eba76fac 100644 --- a/examples/next-js/package.json +++ b/examples/next-js/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/captbaritone/grats#readme", "dependencies": { - "graphql": "^16.8.1", + "graphql": "17.0.0-alpha.11", "graphql-yoga": "^5.0.0", "next": "14.0.3", "react": "^18", diff --git a/examples/next-js/tsconfig.json b/examples/next-js/tsconfig.json index a1f82ceb..2dc730ae 100644 --- a/examples/next-js/tsconfig.json +++ b/examples/next-js/tsconfig.json @@ -1,6 +1,7 @@ { "grats": { - "nullableByDefault": false + "nullableByDefault": false, + "importModuleSpecifierEnding": "" }, "compilerOptions": { "target": "es5", diff --git a/examples/production-app/Database.ts b/examples/production-app/Database.ts index f5422715..2f94aa71 100644 --- a/examples/production-app/Database.ts +++ b/examples/production-app/Database.ts @@ -1,8 +1,8 @@ -import { PubSub } from "./PubSub"; -import { VC } from "./ViewerContext"; -import { Like } from "./models/Like"; -import { Post } from "./models/Post"; -import { User } from "./models/User"; +import { PubSub } from "./PubSub.js"; +import { VC } from "./ViewerContext.js"; +import { Like } from "./models/Like.js"; +import { Post } from "./models/Post.js"; +import { User } from "./models/User.js"; /** * This module is intended to represent a database. diff --git a/examples/production-app/ViewerContext.ts b/examples/production-app/ViewerContext.ts index 77969684..3fccc2e3 100644 --- a/examples/production-app/ViewerContext.ts +++ b/examples/production-app/ViewerContext.ts @@ -1,9 +1,9 @@ import DataLoader from "dataloader"; -import { getPostsByIds, getUsersByIds, getLikesByIds } from "./Database"; +import { getPostsByIds, getUsersByIds, getLikesByIds } from "./Database.js"; import { YogaInitialContext } from "graphql-yoga"; -import { Post } from "./models/Post"; -import { User } from "./models/User"; -import { Like } from "./models/Like"; +import { Post } from "./models/Post.js"; +import { User } from "./models/User.js"; +import { Like } from "./models/Like.js"; /** * Viewer Context diff --git a/examples/production-app/graphql/CustomScalars.ts b/examples/production-app/graphql/CustomScalars.ts index c6989f3a..21aada62 100644 --- a/examples/production-app/graphql/CustomScalars.ts +++ b/examples/production-app/graphql/CustomScalars.ts @@ -1,5 +1,5 @@ import { Kind } from "graphql"; -import type { SchemaConfig } from "../schema"; +import type { SchemaConfig } from "../schema.js"; // TODO: Consider switching serialization to follow https://ibm.github.io/graphql-specs/custom-scalars/date.html diff --git a/examples/production-app/graphql/Node.ts b/examples/production-app/graphql/Node.ts index 739807dd..602dccf4 100644 --- a/examples/production-app/graphql/Node.ts +++ b/examples/production-app/graphql/Node.ts @@ -1,6 +1,6 @@ import { fromGlobalId, toGlobalId } from "graphql-relay"; import { ID } from "grats"; -import { VC } from "../ViewerContext"; +import { VC } from "../ViewerContext.js"; /** * Converts a globally unique ID into a local ID asserting diff --git a/examples/production-app/graphql/directives.ts b/examples/production-app/graphql/directives.ts index 9778b5ac..2530f56e 100644 --- a/examples/production-app/graphql/directives.ts +++ b/examples/production-app/graphql/directives.ts @@ -1,6 +1,6 @@ import { defaultFieldResolver, GraphQLError, GraphQLSchema } from "graphql"; import { Int } from "grats"; -import { Ctx } from "../ViewerContext"; +import { Ctx } from "../ViewerContext.js"; import { getDirective, MapperKind, mapSchema } from "@graphql-tools/utils"; /** diff --git a/examples/production-app/models/Like.ts b/examples/production-app/models/Like.ts index 8c5f99e7..4f7ae6cd 100644 --- a/examples/production-app/models/Like.ts +++ b/examples/production-app/models/Like.ts @@ -1,11 +1,11 @@ -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { GraphQLNode, getLocalTypeAssert } from "../graphql/Node"; -import { User } from "./User"; -import { Model } from "./Model"; -import { ID } from "../../../dist/src"; -import { GqlDate } from "../graphql/CustomScalars"; -import { Post } from "./Post"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { GraphQLNode, getLocalTypeAssert } from "../graphql/Node.js"; +import { User } from "./User.js"; +import { Model } from "./Model.js"; +import { ID } from "../../../dist/src/index.js"; +import { GqlDate } from "../graphql/CustomScalars.js"; +import { Post } from "./Post.js"; /** * A reaction from a user indicating that they like a post. diff --git a/examples/production-app/models/LikeConnection.ts b/examples/production-app/models/LikeConnection.ts index 0ccf9dae..d34047df 100644 --- a/examples/production-app/models/LikeConnection.ts +++ b/examples/production-app/models/LikeConnection.ts @@ -1,11 +1,11 @@ import { GqlInfo, Int } from "grats"; -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { Like } from "./Like"; -import { PageInfo } from "../graphql/Connection"; -import { PubSub } from "../PubSub"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { Like } from "./Like.js"; +import { PageInfo } from "../graphql/Connection.js"; +import { PubSub } from "../PubSub.js"; import { filter, map, pipe } from "graphql-yoga"; -import { getLocalTypeAssert } from "../graphql/Node"; +import { getLocalTypeAssert } from "../graphql/Node.js"; import { connectionFromSelectOrCount } from "../graphql/gqlUtils.js"; /** @gqlType */ diff --git a/examples/production-app/models/Model.ts b/examples/production-app/models/Model.ts index 71061319..a990f9c9 100644 --- a/examples/production-app/models/Model.ts +++ b/examples/production-app/models/Model.ts @@ -1,4 +1,4 @@ -import { VC } from "../ViewerContext"; +import { VC } from "../ViewerContext.js"; /** * Generic model class built around a database row diff --git a/examples/production-app/models/Post.ts b/examples/production-app/models/Post.ts index f39fa42f..50d1711b 100644 --- a/examples/production-app/models/Post.ts +++ b/examples/production-app/models/Post.ts @@ -1,11 +1,11 @@ -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { GraphQLNode, getLocalTypeAssert } from "../graphql/Node"; -import { User } from "./User"; -import { Model } from "./Model"; -import { GqlInfo, ID, Int } from "../../../dist/src"; -import { GqlDate } from "../graphql/CustomScalars"; -import { LikeConnection } from "./LikeConnection"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { GraphQLNode, getLocalTypeAssert } from "../graphql/Node.js"; +import { User } from "./User.js"; +import { Model } from "./Model.js"; +import { GqlInfo, ID, Int } from "../../../dist/src/index.js"; +import { GqlDate } from "../graphql/CustomScalars.js"; +import { LikeConnection } from "./LikeConnection.js"; import { connectionFromSelectOrCount } from "../graphql/gqlUtils.js"; /** diff --git a/examples/production-app/models/PostConnection.ts b/examples/production-app/models/PostConnection.ts index 8c4db6d7..90f449dc 100644 --- a/examples/production-app/models/PostConnection.ts +++ b/examples/production-app/models/PostConnection.ts @@ -1,8 +1,8 @@ import { GqlInfo, Int } from "grats"; -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { Post } from "./Post"; -import { Connection } from "../graphql/Connection"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { Post } from "./Post.js"; +import { Connection } from "../graphql/Connection.js"; import { connectionFromSelectOrCount } from "../graphql/gqlUtils.js"; /** diff --git a/examples/production-app/models/User.ts b/examples/production-app/models/User.ts index f0f526de..eee087c3 100644 --- a/examples/production-app/models/User.ts +++ b/examples/production-app/models/User.ts @@ -1,9 +1,9 @@ -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { GraphQLNode } from "../graphql/Node"; -import { Model } from "./Model"; -import { Post } from "./Post"; -import { Connection } from "../graphql/Connection"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { GraphQLNode } from "../graphql/Node.js"; +import { Model } from "./Model.js"; +import { Post } from "./Post.js"; +import { Connection } from "../graphql/Connection.js"; import { GqlInfo, Int } from "../../../dist/src/Types.js"; import { connectionFromSelectOrCount } from "../graphql/gqlUtils.js"; diff --git a/examples/production-app/models/UserConnection.ts b/examples/production-app/models/UserConnection.ts index ed4289ba..d5d7b14e 100644 --- a/examples/production-app/models/UserConnection.ts +++ b/examples/production-app/models/UserConnection.ts @@ -1,8 +1,8 @@ import { GqlInfo, Int } from "grats"; -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { User } from "./User"; -import { Connection } from "../graphql/Connection"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { User } from "./User.js"; +import { Connection } from "../graphql/Connection.js"; import { connectionFromSelectOrCount } from "../graphql/gqlUtils.js"; /** diff --git a/examples/production-app/models/Viewer.ts b/examples/production-app/models/Viewer.ts index 95474948..c7162488 100644 --- a/examples/production-app/models/Viewer.ts +++ b/examples/production-app/models/Viewer.ts @@ -1,7 +1,7 @@ -import * as DB from "../Database"; -import { VC } from "../ViewerContext"; -import { Post } from "./Post"; -import { User } from "./User"; +import * as DB from "../Database.js"; +import { VC } from "../ViewerContext.js"; +import { Post } from "./Post.js"; +import { User } from "./User.js"; /** * The currently authenticated viewer. diff --git a/examples/production-app/package.json b/examples/production-app/package.json index e923ea9d..f753300d 100644 --- a/examples/production-app/package.json +++ b/examples/production-app/package.json @@ -2,6 +2,7 @@ "name": "grats-production-app-example", "version": "0.0.0", "description": "Example server showcasing Grats in a feature complete server", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -33,7 +34,7 @@ "@graphql-tools/utils": "^9.2.1", "@graphql-yoga/plugin-defer-stream": "^3.1.1", "dataloader": "^2.2.2", - "graphql": "16.11.0", + "graphql": "17.0.0-alpha.11", "graphql-relay": "^0.10.0", "graphql-yoga": "^5.16.0", "typescript": "^5.5.4" diff --git a/examples/production-app/schema.ts b/examples/production-app/schema.ts index df085a55..b77fe4fb 100644 --- a/examples/production-app/schema.ts +++ b/examples/production-app/schema.ts @@ -4,17 +4,17 @@ */ import type { GqlScalar } from "grats"; -import type { GqlDate as DateInternal } from "./graphql/CustomScalars"; +import type { GqlDate as DateInternal } from "./graphql/CustomScalars.js"; import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLNonNull, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLList, GraphQLString, GraphQLScalarType, GraphQLID, GraphQLInterfaceType, GraphQLBoolean, GraphQLInputObjectType } from "graphql"; -import { id as likeIdResolver, id as userIdResolver, id as postIdResolver, node as queryNodeResolver, nodes as queryNodesResolver } from "./graphql/Node"; -import { nodes as postConnectionNodesResolver, posts as queryPostsResolver } from "./models/PostConnection"; -import { nodes as likeConnectionNodesResolver, likes as queryLikesResolver, postLikes as subscriptionPostLikesResolver } from "./models/LikeConnection"; -import { getVc } from "./ViewerContext"; -import { nodes as userConnectionNodesResolver, users as queryUsersResolver } from "./models/UserConnection"; -import { Viewer as queryViewerResolver } from "./models/Viewer"; -import { createLike as mutationCreateLikeResolver } from "./models/Like"; -import { createPost as mutationCreatePostResolver } from "./models/Post"; -import { createUser as mutationCreateUserResolver } from "./models/User"; +import { id as likeIdResolver, id as userIdResolver, id as postIdResolver, node as queryNodeResolver, nodes as queryNodesResolver } from "./graphql/Node.js"; +import { nodes as postConnectionNodesResolver, posts as queryPostsResolver } from "./models/PostConnection.js"; +import { nodes as likeConnectionNodesResolver, likes as queryLikesResolver, postLikes as subscriptionPostLikesResolver } from "./models/LikeConnection.js"; +import { getVc } from "./ViewerContext.js"; +import { nodes as userConnectionNodesResolver, users as queryUsersResolver } from "./models/UserConnection.js"; +import { Viewer as queryViewerResolver } from "./models/Viewer.js"; +import { createLike as mutationCreateLikeResolver } from "./models/Like.js"; +import { createPost as mutationCreatePostResolver } from "./models/Post.js"; +import { createUser as mutationCreateUserResolver } from "./models/User.js"; export type SchemaConfig = { scalars: { Date: GqlScalar; diff --git a/examples/production-app/server.ts b/examples/production-app/server.ts index aae01e51..39e3ecb8 100644 --- a/examples/production-app/server.ts +++ b/examples/production-app/server.ts @@ -1,10 +1,10 @@ import { createServer } from "node:http"; import { createYoga } from "graphql-yoga"; -import { getSchema } from "./schema"; -import { VC } from "./ViewerContext"; -import { scalarConfig } from "./graphql/CustomScalars"; +import { getSchema } from "./schema.js"; +import { VC } from "./ViewerContext.js"; +import { scalarConfig } from "./graphql/CustomScalars.js"; import { useDeferStream } from "@graphql-yoga/plugin-defer-stream"; -import { applyCreditLimit } from "./graphql/directives"; +import { applyCreditLimit } from "./graphql/directives.js"; let schema = getSchema({ scalars: scalarConfig }); schema = applyCreditLimit(schema); diff --git a/examples/strict-semantic-nullability/interfaces/IPerson.ts b/examples/strict-semantic-nullability/interfaces/IPerson.ts index 21cbc43c..1be795f1 100644 --- a/examples/strict-semantic-nullability/interfaces/IPerson.ts +++ b/examples/strict-semantic-nullability/interfaces/IPerson.ts @@ -1,4 +1,4 @@ -import User from "../models/User"; +import User from "../models/User.js"; /** @gqlInterface */ export default interface IPerson { diff --git a/examples/strict-semantic-nullability/models/Group.ts b/examples/strict-semantic-nullability/models/Group.ts index 9e672ad3..083ed7a9 100644 --- a/examples/strict-semantic-nullability/models/Group.ts +++ b/examples/strict-semantic-nullability/models/Group.ts @@ -1,4 +1,4 @@ -import User from "./User"; +import User from "./User.js"; /** @gqlType */ export default class Group { diff --git a/examples/strict-semantic-nullability/models/User.ts b/examples/strict-semantic-nullability/models/User.ts index 034a09a3..1dde3ed8 100644 --- a/examples/strict-semantic-nullability/models/User.ts +++ b/examples/strict-semantic-nullability/models/User.ts @@ -1,5 +1,5 @@ -import IPerson from "../interfaces/IPerson"; -import Group from "./Group"; +import IPerson from "../interfaces/IPerson.js"; +import Group from "./Group.js"; /** @gqlType User */ export default class User implements IPerson { diff --git a/examples/strict-semantic-nullability/package.json b/examples/strict-semantic-nullability/package.json index 5842fe43..dfcd3984 100644 --- a/examples/strict-semantic-nullability/package.json +++ b/examples/strict-semantic-nullability/package.json @@ -2,6 +2,7 @@ "name": "grats-example-strict-sematic-nullability", "version": "0.0.0", "description": "Example server showcasing Grats' experimental support for strict semantic nullability", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -27,7 +28,7 @@ }, "homepage": "https://github.com/captbaritone/grats#readme", "dependencies": { - "graphql": "16.8.1", + "graphql": "17.0.0-alpha.11", "graphql-yoga": "^5.0.0", "typescript": "^5.5.4" }, diff --git a/examples/strict-semantic-nullability/schema.ts b/examples/strict-semantic-nullability/schema.ts index 6fb799b2..e5948402 100644 --- a/examples/strict-semantic-nullability/schema.ts +++ b/examples/strict-semantic-nullability/schema.ts @@ -3,12 +3,12 @@ * Do not manually edit. Regenerate by running `npx grats`. */ -import UserClass from "./models/User"; -import queryAllUsersResolver from "./models/User"; -import queryMeResolver from "./models/User"; +import UserClass from "./models/User.js"; +import queryAllUsersResolver from "./models/User.js"; +import queryMeResolver from "./models/User.js"; import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLList, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLNonNull, GraphQLString, defaultFieldResolver, GraphQLInterfaceType } from "graphql"; -import { person as queryPersonResolver } from "./interfaces/IPerson"; -import { countdown as subscriptionCountdownResolver, nullItems as subscriptionNullItemsResolver, nullIterable as subscriptionNullIterableResolver } from "./Subscription"; +import { person as queryPersonResolver } from "./interfaces/IPerson.js"; +import { countdown as subscriptionCountdownResolver, nullItems as subscriptionNullItemsResolver, nullIterable as subscriptionNullIterableResolver } from "./Subscription.js"; async function assertNonNull(value: T | Promise): Promise { const awaited = await value; if (awaited == null) diff --git a/examples/strict-semantic-nullability/server.ts b/examples/strict-semantic-nullability/server.ts index 3ffa1c21..7a03bd50 100644 --- a/examples/strict-semantic-nullability/server.ts +++ b/examples/strict-semantic-nullability/server.ts @@ -1,6 +1,6 @@ import { createServer } from "node:http"; import { createYoga } from "graphql-yoga"; -import { getSchema } from "./schema"; +import { getSchema } from "./schema.js"; const yoga = createYoga({ schema: getSchema(), diff --git a/examples/yoga/interfaces/IPerson.ts b/examples/yoga/interfaces/IPerson.ts index 21cbc43c..1be795f1 100644 --- a/examples/yoga/interfaces/IPerson.ts +++ b/examples/yoga/interfaces/IPerson.ts @@ -1,4 +1,4 @@ -import User from "../models/User"; +import User from "../models/User.js"; /** @gqlInterface */ export default interface IPerson { diff --git a/examples/yoga/models/Group.ts b/examples/yoga/models/Group.ts index 9e672ad3..083ed7a9 100644 --- a/examples/yoga/models/Group.ts +++ b/examples/yoga/models/Group.ts @@ -1,4 +1,4 @@ -import User from "./User"; +import User from "./User.js"; /** @gqlType */ export default class Group { diff --git a/examples/yoga/models/User.ts b/examples/yoga/models/User.ts index 6b1d0fa8..6c563b3d 100644 --- a/examples/yoga/models/User.ts +++ b/examples/yoga/models/User.ts @@ -1,5 +1,5 @@ -import IPerson from "../interfaces/IPerson"; -import Group from "./Group"; +import IPerson from "../interfaces/IPerson.js"; +import Group from "./Group.js"; /** @gqlType User */ export default class User implements IPerson { diff --git a/examples/yoga/package.json b/examples/yoga/package.json index 5ca95223..8e70eb27 100644 --- a/examples/yoga/package.json +++ b/examples/yoga/package.json @@ -2,6 +2,7 @@ "name": "grats-example-yoga", "version": "0.0.0", "description": "Example server showcasing Grats used with Yoga", + "type": "module", "main": "index.js", "scripts": { "start": "tsc && node dist/server.js", @@ -27,7 +28,7 @@ }, "homepage": "https://github.com/captbaritone/grats#readme", "dependencies": { - "graphql": "16.8.1", + "graphql": "17.0.0-alpha.11", "graphql-yoga": "^5.0.0", "typescript": "^5.5.4" }, diff --git a/examples/yoga/schema.ts b/examples/yoga/schema.ts index 2d8515bd..ede983c3 100644 --- a/examples/yoga/schema.ts +++ b/examples/yoga/schema.ts @@ -3,12 +3,12 @@ * Do not manually edit. Regenerate by running `npx grats`. */ -import UserClass from "./models/User"; -import queryAllUsersResolver from "./models/User"; -import queryMeResolver from "./models/User"; +import UserClass from "./models/User.js"; +import queryAllUsersResolver from "./models/User.js"; +import queryMeResolver from "./models/User.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLList, GraphQLString, GraphQLInterfaceType, GraphQLInt } from "graphql"; -import { person as queryPersonResolver } from "./interfaces/IPerson"; -import { countdown as subscriptionCountdownResolver } from "./Subscription"; +import { person as queryPersonResolver } from "./interfaces/IPerson.js"; +import { countdown as subscriptionCountdownResolver } from "./Subscription.js"; export function getSchema(): GraphQLSchema { const GroupType: GraphQLObjectType = new GraphQLObjectType({ name: "Group", diff --git a/examples/yoga/server.ts b/examples/yoga/server.ts index 3ffa1c21..7a03bd50 100644 --- a/examples/yoga/server.ts +++ b/examples/yoga/server.ts @@ -1,6 +1,6 @@ import { createServer } from "node:http"; import { createYoga } from "graphql-yoga"; -import { getSchema } from "./schema"; +import { getSchema } from "./schema.js"; const yoga = createYoga({ schema: getSchema(), diff --git a/llm-docs/getting-started/cli.md b/llm-docs/getting-started/cli.md index e1681500..267b019e 100644 --- a/llm-docs/getting-started/cli.md +++ b/llm-docs/getting-started/cli.md @@ -55,30 +55,42 @@ Options: -h, --help display help for command Commands: - locate [options] + locate [options] ``` ## Locate -The `locate` command reports the location (file, line, column) at which a given type or field is defined in your code. `grats locate` can also be invoked by other tools. For example the click-to-definition feature of an GraphQL editor integration could use invoke this command to find the location of a type or field. +The `locate` command reports the location (file, line, column) at which a given schema element is defined in your code. It accepts a [Schema Coordinate](https://spec.graphql.org/draft/#sec-Schema-Coordinates) as its argument. + +`grats locate` can also be invoked by other tools. For example the click-to-definition feature of a GraphQL editor integration could invoke this command to find the location of a type or field. For example, Relay's VSCode Extension is [exploring](https://github.com/facebook/relay/pull/4434) adding the ability to leverage such a tool. ```bash +# Locate a named type +npx grats locate User + # Locate a field npx grats locate User.name -# Locate a named type -npx grats locate User +# Locate a field argument +npx grats locate "Query.user(id:)" + +# Locate an enum value +npx grats locate "MyEnum.VALUE" + +# Locate a directive +npx grats locate @deprecated ``` ### Options ```text -Usage: grats locate [options] +Usage: grats locate [options] Arguments: -ENTITY GraphQL entity to locate. E.g. `User` or `User.id` +COORDINATE Schema coordinate to locate. E.g. `User`, `User.name`, + `Query.user(id:)`, `@deprecated` Options: --tsconfig Path to tsconfig.json. Defaults to auto-detecting based on the current working directory diff --git a/llm-docs/getting-started/configuration.md b/llm-docs/getting-started/configuration.md index 11d2e884..32b4fbd0 100644 --- a/llm-docs/getting-started/configuration.md +++ b/llm-docs/getting-started/configuration.md @@ -122,11 +122,9 @@ Default: ### "importModuleSpecifierEnding": string -This option allows you configure an extension that will be appended to the end of all import paths in the generated TypeScript schema file. +The extension appended to the end of all import paths in the generated TypeScript schema file. Defaults to `.js` which works for both CommonJS and ES module projects. Set to an empty string to omit the extension. -When building a package that uses ES modules, import paths must not omit the file extension. In TypeScript code this generally means import paths must end with `.js`. If set to null, no ending will be appended. - -Default: `""` +Default: `".js"` * * * diff --git a/package.json b/package.json index f612ad55..f037a32a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "grats", "version": "0.0.35", + "type": "module", "main": "dist/src/index.js", "bin": "dist/src/cli.js", "types": "dist/src/index.d.ts", @@ -11,16 +12,16 @@ "llm-docs" ], "scripts": { - "test": "ts-node src/tests/test.ts", + "test": "tsx src/tests/test.ts", "test-example-projects": "node src/tests/testExampleProjects.mjs", - "build": "rm -rf dist/ && tsc --build", + "build": "rm -rf dist/ && tsc --build && cp src/configSpecRaw.json dist/src/configSpecRaw.json", "format": "prettier . --write", "lint": "eslint . && prettier . --check", - "profile": "ts-node scripts/profile.ts" + "profile": "tsx scripts/profile.ts" }, "dependencies": { "commander": "^14.0.1", - "graphql": "^16.11.0", + "graphql": "17.0.0-alpha.11", "semver": "^7.7.2", "typescript": "5.9.2" }, @@ -38,7 +39,8 @@ "path-browserify": "^1.0.1", "prettier": "^3.6.2", "process": "^0.11.10", - "ts-node": "^10.9.2" + "ts-node": "^10.9.2", + "tsx": "^4.19.0" }, "prettier": { "trailingComma": "all" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad0e5d49..f3afdd8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^14.0.1 version: 14.0.1 graphql: - specifier: ^16.11.0 - version: 16.11.0 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 semver: specifier: ^7.7.2 version: 7.7.2 @@ -63,18 +63,21 @@ importers: ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@24.5.2)(typescript@5.9.2) + tsx: + specifier: ^4.19.0 + version: 4.21.0 examples/apollo-server: dependencies: '@apollo/server': specifier: ^5.0.0 - version: 5.0.0(graphql@16.11.0) + version: 5.0.0(graphql@17.0.0-alpha.11) '@types/node': specifier: ^20.8.10 version: 20.8.10 graphql: - specifier: 16.11.0 - version: 16.11.0 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 devDependencies: grats: specifier: workspace:* @@ -95,11 +98,11 @@ importers: specifier: ^4.18.2 version: 4.18.2 graphql: - specifier: 16.8.1 - version: 16.8.1 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-http: specifier: ^1.22.0 - version: 1.22.0(graphql@16.8.1) + version: 1.22.0(graphql@17.0.0-alpha.11) devDependencies: grats: specifier: workspace:* @@ -115,16 +118,16 @@ importers: version: 8.4.1 '@graphql-tools/schema': specifier: ^10.0.3 - version: 10.0.3(graphql@16.8.1) + version: 10.0.3(graphql@17.0.0-alpha.11) '@pothos/core': specifier: ^3.41.1 - version: 3.41.1(graphql@16.8.1) + version: 3.41.1(graphql@17.0.0-alpha.11) graphql: - specifier: 16.8.1 - version: 16.8.1 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-yoga: specifier: ^5.0.0 - version: 5.0.0(graphql@16.8.1) + version: 5.0.0(graphql@17.0.0-alpha.11) typescript: specifier: ^5.5.4 version: 5.5.4 @@ -139,11 +142,11 @@ importers: examples/next-js: dependencies: graphql: - specifier: ^16.8.1 - version: 16.8.1 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-yoga: specifier: ^5.0.0 - version: 5.0.0(graphql@16.8.1) + version: 5.0.0(graphql@17.0.0-alpha.11) next: specifier: 14.0.3 version: 14.0.3(@opentelemetry/api@1.6.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -174,22 +177,22 @@ importers: dependencies: '@graphql-tools/utils': specifier: ^9.2.1 - version: 9.2.1(graphql@16.11.0) + version: 9.2.1(graphql@17.0.0-alpha.11) '@graphql-yoga/plugin-defer-stream': specifier: ^3.1.1 - version: 3.1.1(graphql-yoga@5.16.0(graphql@16.11.0))(graphql@16.11.0) + version: 3.1.1(graphql-yoga@5.16.0(graphql@17.0.0-alpha.11))(graphql@17.0.0-alpha.11) dataloader: specifier: ^2.2.2 version: 2.2.2 graphql: - specifier: 16.11.0 - version: 16.11.0 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-relay: specifier: ^0.10.0 - version: 0.10.0(graphql@16.11.0) + version: 0.10.0(graphql@17.0.0-alpha.11) graphql-yoga: specifier: ^5.16.0 - version: 5.16.0(graphql@16.11.0) + version: 5.16.0(graphql@17.0.0-alpha.11) typescript: specifier: ^5.5.4 version: 5.5.4 @@ -204,11 +207,11 @@ importers: examples/strict-semantic-nullability: dependencies: graphql: - specifier: 16.8.1 - version: 16.8.1 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-yoga: specifier: ^5.0.0 - version: 5.0.0(graphql@16.8.1) + version: 5.0.0(graphql@17.0.0-alpha.11) typescript: specifier: ^5.5.4 version: 5.5.4 @@ -223,11 +226,11 @@ importers: examples/yoga: dependencies: graphql: - specifier: 16.8.1 - version: 16.8.1 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 graphql-yoga: specifier: ^5.0.0 - version: 5.0.0(graphql@16.8.1) + version: 5.0.0(graphql@17.0.0-alpha.11) typescript: specifier: ^5.5.4 version: 5.5.4 @@ -270,7 +273,7 @@ importers: version: 3.7.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@graphql-tools/utils': specifier: ^9.2.1 - version: 9.2.1(graphql@16.11.0) + version: 9.2.1(graphql@17.0.0-alpha.11) '@mdx-js/react': specifier: ^3.0.0 version: 3.0.1(@types/react@18.0.33)(react@18.2.0) @@ -290,8 +293,8 @@ importers: specifier: ^9.3.4 version: 9.3.4 graphql: - specifier: ^16.11.0 - version: 16.11.0 + specifier: 17.0.0-alpha.11 + version: 17.0.0-alpha.11 grats: specifier: workspace:* version: link:.. @@ -346,13 +349,13 @@ importers: version: 1.2.0 graphql-relay: specifier: ^0.10.0 - version: 0.10.0(graphql@16.11.0) + version: 0.10.0(graphql@17.0.0-alpha.11) monaco-editor-webpack-plugin: specifier: ^7.1.0 version: 7.1.0(monaco-editor@0.52.2)(webpack@5.78.0) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@18.15.0)(typescript@5.9.2) + tsx: + specifier: ^4.19.2 + version: 4.21.0 typescript: specifier: 5.9.2 version: 5.9.2 @@ -2198,6 +2201,162 @@ packages: resolution: {integrity: sha512-CsFmA3u3c2QoLDTfEpGr4t25fjMU31nyvse7IzWTvb0ZycuPjMjb0fjlheh+PbhBYb9YLugnT2uY6Mwcg1o+Zg==} engines: {node: '>=18.0.0'} + '@esbuild/aix-ppc64@0.27.3': + resolution: {integrity: sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.27.3': + resolution: {integrity: sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.27.3': + resolution: {integrity: sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.27.3': + resolution: {integrity: sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.27.3': + resolution: {integrity: sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.27.3': + resolution: {integrity: sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.27.3': + resolution: {integrity: sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.27.3': + resolution: {integrity: sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.27.3': + resolution: {integrity: sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.27.3': + resolution: {integrity: sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.27.3': + resolution: {integrity: sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.27.3': + resolution: {integrity: sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.27.3': + resolution: {integrity: sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.27.3': + resolution: {integrity: sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.27.3': + resolution: {integrity: sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.27.3': + resolution: {integrity: sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.27.3': + resolution: {integrity: sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.27.3': + resolution: {integrity: sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.27.3': + resolution: {integrity: sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.27.3': + resolution: {integrity: sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.27.3': + resolution: {integrity: sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.27.3': + resolution: {integrity: sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.27.3': + resolution: {integrity: sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.27.3': + resolution: {integrity: sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.27.3': + resolution: {integrity: sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.27.3': + resolution: {integrity: sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.9.0': resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4239,6 +4398,11 @@ packages: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} engines: {node: '>= 0.4'} + esbuild@0.27.3: + resolution: {integrity: sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==} + engines: {node: '>=18'} + hasBin: true + escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4546,6 +4710,11 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} @@ -4574,6 +4743,9 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} + get-tsconfig@4.13.6: + resolution: {integrity: sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==} + github-slugger@1.5.0: resolution: {integrity: sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==} @@ -4674,9 +4846,9 @@ packages: resolution: {integrity: sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} - graphql@16.8.1: - resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} - engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + graphql@17.0.0-alpha.11: + resolution: {integrity: sha512-28FSpHCjJZP9nxBmLYREbIkq5llRTfqaEPpnphQ05Q6rUME6bN3J2IppNY1blO5TZwiQruhu379A4BX4XlLTRQ==} + engines: {node: ^20.0.0 || ^22.0.0 || ^24.0.0 || >=25.0.0} grats@0.0.26: resolution: {integrity: sha512-9JVF3kvOB42+PDZhmxcbv5Co7vMUSfdUN417mubFleALZ9tTBlzlKQ2HkkkUghZp1/OE2VHk1cT3QyjvQzyE+w==} @@ -6674,6 +6846,9 @@ packages: resolve-pathname@3.0.0: resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve@1.22.1: resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==} hasBin: true @@ -7143,6 +7318,11 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsx@4.21.0: + resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==} + engines: {node: '>=18.0.0'} + hasBin: true + turndown@7.2.2: resolution: {integrity: sha512-1F7db8BiExOKxjSMU2b7if62D/XOyQyZbPKq/nUwopfgnHlqXHqQ0lvfUTeUIr1lZJzOPFn43dODyMSIfvWRKQ==} @@ -7688,9 +7868,9 @@ snapshots: '@jridgewell/gen-mapping': 0.1.1 '@jridgewell/trace-mapping': 0.3.25 - '@apollo/cache-control-types@1.0.3(graphql@16.11.0)': + '@apollo/cache-control-types@1.0.3(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 '@apollo/protobufjs@1.2.7': dependencies: @@ -7707,32 +7887,32 @@ snapshots: '@types/long': 4.0.2 long: 4.0.0 - '@apollo/server-gateway-interface@2.0.0(graphql@16.11.0)': + '@apollo/server-gateway-interface@2.0.0(graphql@17.0.0-alpha.11)': dependencies: '@apollo/usage-reporting-protobuf': 4.1.1 '@apollo/utils.fetcher': 3.1.0 '@apollo/utils.keyvaluecache': 4.0.0 '@apollo/utils.logger': 3.0.0 - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - '@apollo/server@5.0.0(graphql@16.11.0)': + '@apollo/server@5.0.0(graphql@17.0.0-alpha.11)': dependencies: - '@apollo/cache-control-types': 1.0.3(graphql@16.11.0) - '@apollo/server-gateway-interface': 2.0.0(graphql@16.11.0) + '@apollo/cache-control-types': 1.0.3(graphql@17.0.0-alpha.11) + '@apollo/server-gateway-interface': 2.0.0(graphql@17.0.0-alpha.11) '@apollo/usage-reporting-protobuf': 4.1.1 '@apollo/utils.createhash': 3.0.1 '@apollo/utils.fetcher': 3.1.0 '@apollo/utils.isnodelike': 3.0.0 '@apollo/utils.keyvaluecache': 4.0.0 '@apollo/utils.logger': 3.0.0 - '@apollo/utils.usagereporting': 2.1.0(graphql@16.11.0) + '@apollo/utils.usagereporting': 2.1.0(graphql@17.0.0-alpha.11) '@apollo/utils.withrequired': 3.0.0 - '@graphql-tools/schema': 10.0.11(graphql@16.11.0) + '@graphql-tools/schema': 10.0.11(graphql@17.0.0-alpha.11) async-retry: 1.3.3 body-parser: 2.2.0 cors: 2.8.5 finalhandler: 2.1.0 - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 loglevel: 1.8.1 lru-cache: 11.2.1 negotiator: 1.0.0 @@ -7750,9 +7930,9 @@ snapshots: '@apollo/utils.isnodelike': 3.0.0 sha.js: 2.4.11 - '@apollo/utils.dropunuseddefinitions@2.0.1(graphql@16.11.0)': + '@apollo/utils.dropunuseddefinitions@2.0.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 '@apollo/utils.fetcher@3.1.0': {} @@ -7765,32 +7945,32 @@ snapshots: '@apollo/utils.logger@3.0.0': {} - '@apollo/utils.printwithreducedwhitespace@2.0.1(graphql@16.11.0)': + '@apollo/utils.printwithreducedwhitespace@2.0.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - '@apollo/utils.removealiases@2.0.1(graphql@16.11.0)': + '@apollo/utils.removealiases@2.0.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - '@apollo/utils.sortast@2.0.1(graphql@16.11.0)': + '@apollo/utils.sortast@2.0.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 lodash.sortby: 4.7.0 - '@apollo/utils.stripsensitiveliterals@2.0.1(graphql@16.11.0)': + '@apollo/utils.stripsensitiveliterals@2.0.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - '@apollo/utils.usagereporting@2.1.0(graphql@16.11.0)': + '@apollo/utils.usagereporting@2.1.0(graphql@17.0.0-alpha.11)': dependencies: '@apollo/usage-reporting-protobuf': 4.1.1 - '@apollo/utils.dropunuseddefinitions': 2.0.1(graphql@16.11.0) - '@apollo/utils.printwithreducedwhitespace': 2.0.1(graphql@16.11.0) - '@apollo/utils.removealiases': 2.0.1(graphql@16.11.0) - '@apollo/utils.sortast': 2.0.1(graphql@16.11.0) - '@apollo/utils.stripsensitiveliterals': 2.0.1(graphql@16.11.0) - graphql: 16.11.0 + '@apollo/utils.dropunuseddefinitions': 2.0.1(graphql@17.0.0-alpha.11) + '@apollo/utils.printwithreducedwhitespace': 2.0.1(graphql@17.0.0-alpha.11) + '@apollo/utils.removealiases': 2.0.1(graphql@17.0.0-alpha.11) + '@apollo/utils.sortast': 2.0.1(graphql@17.0.0-alpha.11) + '@apollo/utils.stripsensitiveliterals': 2.0.1(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 '@apollo/utils.withrequired@3.0.0': {} @@ -10407,6 +10587,84 @@ snapshots: '@whatwg-node/promise-helpers': 1.3.2 tslib: 2.8.1 + '@esbuild/aix-ppc64@0.27.3': + optional: true + + '@esbuild/android-arm64@0.27.3': + optional: true + + '@esbuild/android-arm@0.27.3': + optional: true + + '@esbuild/android-x64@0.27.3': + optional: true + + '@esbuild/darwin-arm64@0.27.3': + optional: true + + '@esbuild/darwin-x64@0.27.3': + optional: true + + '@esbuild/freebsd-arm64@0.27.3': + optional: true + + '@esbuild/freebsd-x64@0.27.3': + optional: true + + '@esbuild/linux-arm64@0.27.3': + optional: true + + '@esbuild/linux-arm@0.27.3': + optional: true + + '@esbuild/linux-ia32@0.27.3': + optional: true + + '@esbuild/linux-loong64@0.27.3': + optional: true + + '@esbuild/linux-mips64el@0.27.3': + optional: true + + '@esbuild/linux-ppc64@0.27.3': + optional: true + + '@esbuild/linux-riscv64@0.27.3': + optional: true + + '@esbuild/linux-s390x@0.27.3': + optional: true + + '@esbuild/linux-x64@0.27.3': + optional: true + + '@esbuild/netbsd-arm64@0.27.3': + optional: true + + '@esbuild/netbsd-x64@0.27.3': + optional: true + + '@esbuild/openbsd-arm64@0.27.3': + optional: true + + '@esbuild/openbsd-x64@0.27.3': + optional: true + + '@esbuild/openharmony-arm64@0.27.3': + optional: true + + '@esbuild/sunos-x64@0.27.3': + optional: true + + '@esbuild/win32-arm64@0.27.3': + optional: true + + '@esbuild/win32-ia32@0.27.3': + optional: true + + '@esbuild/win32-x64@0.27.3': + optional: true + '@eslint-community/eslint-utils@4.9.0(eslint@9.36.0(jiti@1.21.6))': dependencies: eslint: 9.36.0(jiti@1.21.6) @@ -10455,109 +10713,83 @@ snapshots: '@fastify/busboy@3.2.0': {} - '@graphql-tools/executor@1.2.0(graphql@16.8.1)': + '@graphql-tools/executor@1.2.0(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) - '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + '@graphql-typed-document-node/core': 3.2.0(graphql@17.0.0-alpha.11) '@repeaterjs/repeater': 3.0.5 - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 tslib: 2.6.2 value-or-promise: 1.0.12 - '@graphql-tools/executor@1.4.9(graphql@16.11.0)': + '@graphql-tools/executor@1.4.9(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/utils': 10.9.1(graphql@16.11.0) - '@graphql-typed-document-node/core': 3.2.0(graphql@16.11.0) + '@graphql-tools/utils': 10.9.1(graphql@17.0.0-alpha.11) + '@graphql-typed-document-node/core': 3.2.0(graphql@17.0.0-alpha.11) '@repeaterjs/repeater': 3.0.5 '@whatwg-node/disposablestack': 0.0.6 '@whatwg-node/promise-helpers': 1.3.2 - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 tslib: 2.8.1 - '@graphql-tools/merge@9.0.12(graphql@16.11.0)': + '@graphql-tools/merge@9.0.12(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/utils': 10.6.2(graphql@16.11.0) - graphql: 16.11.0 + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 tslib: 2.8.1 - '@graphql-tools/merge@9.0.12(graphql@16.8.1)': + '@graphql-tools/merge@9.0.4(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) - graphql: 16.8.1 - tslib: 2.8.1 - - '@graphql-tools/merge@9.0.4(graphql@16.8.1)': - dependencies: - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) - graphql: 16.8.1 + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 tslib: 2.6.2 - '@graphql-tools/schema@10.0.11(graphql@16.11.0)': + '@graphql-tools/schema@10.0.11(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/merge': 9.0.12(graphql@16.11.0) - '@graphql-tools/utils': 10.6.2(graphql@16.11.0) - graphql: 16.11.0 + '@graphql-tools/merge': 9.0.12(graphql@17.0.0-alpha.11) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 tslib: 2.8.1 value-or-promise: 1.0.12 - '@graphql-tools/schema@10.0.11(graphql@16.8.1)': + '@graphql-tools/schema@10.0.3(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/merge': 9.0.12(graphql@16.8.1) - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) - graphql: 16.8.1 - tslib: 2.8.1 - value-or-promise: 1.0.12 - - '@graphql-tools/schema@10.0.3(graphql@16.8.1)': - dependencies: - '@graphql-tools/merge': 9.0.4(graphql@16.8.1) - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) - graphql: 16.8.1 + '@graphql-tools/merge': 9.0.4(graphql@17.0.0-alpha.11) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 tslib: 2.6.2 value-or-promise: 1.0.12 - '@graphql-tools/utils@10.6.2(graphql@16.11.0)': - dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.11.0) - cross-inspect: 1.0.1 - dset: 3.1.4 - graphql: 16.11.0 - tslib: 2.8.1 - - '@graphql-tools/utils@10.6.2(graphql@16.8.1)': + '@graphql-tools/utils@10.6.2(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) + '@graphql-typed-document-node/core': 3.2.0(graphql@17.0.0-alpha.11) cross-inspect: 1.0.1 dset: 3.1.4 - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 tslib: 2.8.1 - '@graphql-tools/utils@10.9.1(graphql@16.11.0)': + '@graphql-tools/utils@10.9.1(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.11.0) + '@graphql-typed-document-node/core': 3.2.0(graphql@17.0.0-alpha.11) '@whatwg-node/promise-helpers': 1.3.2 cross-inspect: 1.0.1 dset: 3.1.4 - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 tslib: 2.8.1 - '@graphql-tools/utils@9.2.1(graphql@16.11.0)': + '@graphql-tools/utils@9.2.1(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-typed-document-node/core': 3.1.2(graphql@16.11.0) - graphql: 16.11.0 + '@graphql-typed-document-node/core': 3.1.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 tslib: 2.5.0 - '@graphql-typed-document-node/core@3.1.2(graphql@16.11.0)': + '@graphql-typed-document-node/core@3.1.2(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - '@graphql-typed-document-node/core@3.2.0(graphql@16.11.0)': + '@graphql-typed-document-node/core@3.2.0(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.11.0 - - '@graphql-typed-document-node/core@3.2.0(graphql@16.8.1)': - dependencies: - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 '@graphql-yoga/logger@2.0.0': dependencies: @@ -10567,11 +10799,11 @@ snapshots: dependencies: tslib: 2.8.1 - '@graphql-yoga/plugin-defer-stream@3.1.1(graphql-yoga@5.16.0(graphql@16.11.0))(graphql@16.11.0)': + '@graphql-yoga/plugin-defer-stream@3.1.1(graphql-yoga@5.16.0(graphql@17.0.0-alpha.11))(graphql@17.0.0-alpha.11)': dependencies: - '@graphql-tools/utils': 10.6.2(graphql@16.11.0) - graphql: 16.11.0 - graphql-yoga: 5.16.0(graphql@16.11.0) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) + graphql: 17.0.0-alpha.11 + graphql-yoga: 5.16.0(graphql@17.0.0-alpha.11) '@graphql-yoga/subscription@5.0.0': dependencies: @@ -10776,9 +11008,9 @@ snapshots: '@polka/url@1.0.0-next.24': {} - '@pothos/core@3.41.1(graphql@16.8.1)': + '@pothos/core@3.41.1(graphql@17.0.0-alpha.11)': dependencies: - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 '@protobufjs/aspromise@1.1.2': {} @@ -12728,6 +12960,35 @@ snapshots: dependencies: es-errors: 1.3.0 + esbuild@0.27.3: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.3 + '@esbuild/android-arm': 0.27.3 + '@esbuild/android-arm64': 0.27.3 + '@esbuild/android-x64': 0.27.3 + '@esbuild/darwin-arm64': 0.27.3 + '@esbuild/darwin-x64': 0.27.3 + '@esbuild/freebsd-arm64': 0.27.3 + '@esbuild/freebsd-x64': 0.27.3 + '@esbuild/linux-arm': 0.27.3 + '@esbuild/linux-arm64': 0.27.3 + '@esbuild/linux-ia32': 0.27.3 + '@esbuild/linux-loong64': 0.27.3 + '@esbuild/linux-mips64el': 0.27.3 + '@esbuild/linux-ppc64': 0.27.3 + '@esbuild/linux-riscv64': 0.27.3 + '@esbuild/linux-s390x': 0.27.3 + '@esbuild/linux-x64': 0.27.3 + '@esbuild/netbsd-arm64': 0.27.3 + '@esbuild/netbsd-x64': 0.27.3 + '@esbuild/openbsd-arm64': 0.27.3 + '@esbuild/openbsd-x64': 0.27.3 + '@esbuild/openharmony-arm64': 0.27.3 + '@esbuild/sunos-x64': 0.27.3 + '@esbuild/win32-arm64': 0.27.3 + '@esbuild/win32-ia32': 0.27.3 + '@esbuild/win32-x64': 0.27.3 + escalade@3.1.1: {} escalade@3.1.2: {} @@ -13104,6 +13365,9 @@ snapshots: fsevents@2.3.2: optional: true + fsevents@2.3.3: + optional: true + function-bind@1.1.1: {} function-bind@1.1.2: {} @@ -13138,6 +13402,10 @@ snapshots: get-stream@6.0.1: {} + get-tsconfig@4.13.6: + dependencies: + resolve-pkg-maps: 1.0.0 + github-slugger@1.5.0: {} glob-parent@5.1.2: @@ -13225,49 +13493,49 @@ snapshots: graphemer@1.4.0: {} - graphql-http@1.22.0(graphql@16.8.1): + graphql-http@1.22.0(graphql@17.0.0-alpha.11): dependencies: - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 - graphql-relay@0.10.0(graphql@16.11.0): + graphql-relay@0.10.0(graphql@17.0.0-alpha.11): dependencies: - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 - graphql-yoga@5.0.0(graphql@16.8.1): + graphql-yoga@5.0.0(graphql@17.0.0-alpha.11): dependencies: '@envelop/core': 5.0.0 - '@graphql-tools/executor': 1.2.0(graphql@16.8.1) - '@graphql-tools/schema': 10.0.11(graphql@16.8.1) - '@graphql-tools/utils': 10.6.2(graphql@16.8.1) + '@graphql-tools/executor': 1.2.0(graphql@17.0.0-alpha.11) + '@graphql-tools/schema': 10.0.11(graphql@17.0.0-alpha.11) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) '@graphql-yoga/logger': 2.0.0 '@graphql-yoga/subscription': 5.0.0 '@whatwg-node/fetch': 0.9.14 '@whatwg-node/server': 0.9.16 dset: 3.1.3 - graphql: 16.8.1 + graphql: 17.0.0-alpha.11 lru-cache: 10.0.2 tslib: 2.6.2 - graphql-yoga@5.16.0(graphql@16.11.0): + graphql-yoga@5.16.0(graphql@17.0.0-alpha.11): dependencies: '@envelop/core': 5.3.2 '@envelop/instrumentation': 1.0.0 - '@graphql-tools/executor': 1.4.9(graphql@16.11.0) - '@graphql-tools/schema': 10.0.11(graphql@16.11.0) - '@graphql-tools/utils': 10.6.2(graphql@16.11.0) + '@graphql-tools/executor': 1.4.9(graphql@17.0.0-alpha.11) + '@graphql-tools/schema': 10.0.11(graphql@17.0.0-alpha.11) + '@graphql-tools/utils': 10.6.2(graphql@17.0.0-alpha.11) '@graphql-yoga/logger': 2.0.1 '@graphql-yoga/subscription': 5.0.5 '@whatwg-node/fetch': 0.10.11 '@whatwg-node/promise-helpers': 1.3.2 '@whatwg-node/server': 0.10.12 dset: 3.1.4 - graphql: 16.11.0 + graphql: 17.0.0-alpha.11 lru-cache: 10.0.2 tslib: 2.8.1 graphql@16.11.0: {} - graphql@16.8.1: {} + graphql@17.0.0-alpha.11: {} grats@0.0.26: dependencies: @@ -15753,6 +16021,8 @@ snapshots: resolve-pathname@3.0.0: {} + resolve-pkg-maps@1.0.0: {} + resolve@1.22.1: dependencies: is-core-module: 2.11.0 @@ -16217,24 +16487,6 @@ snapshots: ts-dedent@2.2.0: {} - ts-node@10.9.2(@types/node@18.15.0)(typescript@5.9.2): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.3 - '@types/node': 18.15.0 - acorn: 8.15.0 - acorn-walk: 8.2.0 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.9.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - ts-node@10.9.2(@types/node@24.5.2)(typescript@5.9.2): dependencies: '@cspotcode/source-map-support': 0.8.1 @@ -16259,6 +16511,13 @@ snapshots: tslib@2.8.1: {} + tsx@4.21.0: + dependencies: + esbuild: 0.27.3 + get-tsconfig: 4.13.6 + optionalDependencies: + fsevents: 2.3.3 + turndown@7.2.2: dependencies: '@mixmark-io/domino': 2.2.0 diff --git a/scripts/TGratsConfig.ts b/scripts/TGratsConfig.ts index d6efa30f..1e42e61a 100644 --- a/scripts/TGratsConfig.ts +++ b/scripts/TGratsConfig.ts @@ -71,11 +71,9 @@ export type GratsConfig = { */ tsClientEnumsHeader: string | null; /** - * This option allows you configure an extension that will be appended to - * the end of all import paths in the generated TypeScript schema file. - * When building a package that uses ES modules, import paths must not - * omit the file extension. In TypeScript code this generally means import - * paths must end with `.js`. If set to null, no ending will be appended. + * The extension appended to the end of all import paths in the generated + * TypeScript schema file. Defaults to `.js` which works for both CommonJS + * and ES module projects. Set to an empty string to omit the extension. */ importModuleSpecifierEnding: string; /** diff --git a/scripts/buildConfigTypes.ts b/scripts/buildConfigTypes.ts index 52184e4e..38695f41 100644 --- a/scripts/buildConfigTypes.ts +++ b/scripts/buildConfigTypes.ts @@ -1,7 +1,11 @@ import * as fs from "fs"; import * as path from "path"; -import { makeTypeScriptType } from "../src/gratsConfig"; -import { GratsConfigSpec } from "../src/configSpec"; +import { fileURLToPath } from "url"; +import { makeTypeScriptType } from "../src/gratsConfig.js"; +import { GratsConfigSpec } from "../src/configSpec.js"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); export function writeTypeScriptTypeToDisk(): void { const doc = `/** diff --git a/scripts/profile.ts b/scripts/profile.ts index d9fa4b95..f1a0c118 100644 --- a/scripts/profile.ts +++ b/scripts/profile.ts @@ -33,7 +33,7 @@ export async function main() { let prevType = ""; if (fileIndex > 0) { prevType = `Type${fileIndex - 1}`; - prelude = `import { ${prevType} } from "./file${fileIndex - 1}";\n`; + prelude = `import { ${prevType} } from "./file${fileIndex - 1}.js";\n`; edge = ` /** @gqlField */ previous(): ${prevType} { return new ${prevType}(); diff --git a/src/Errors.ts b/src/Errors.ts index 770756c0..ae2f774e 100644 --- a/src/Errors.ts +++ b/src/Errors.ts @@ -13,7 +13,7 @@ import { CONTEXT_TAG, INFO_TAG, DIRECTIVE_TAG, -} from "./Extractor"; +} from "./Extractor.js"; export const ISSUE_URL = "https://github.com/captbaritone/grats/issues"; diff --git a/src/Extractor.ts b/src/Extractor.ts index 41f6b651..a40bb039 100644 --- a/src/Extractor.ts +++ b/src/Extractor.ts @@ -26,34 +26,34 @@ import { DiagnosticsResult, gqlErr, DiagnosticResult, -} from "./utils/DiagnosticError"; -import { err, ok } from "./utils/Result"; +} from "./utils/DiagnosticError.js"; +import { err, ok } from "./utils/Result.js"; import * as ts from "typescript"; import { DeclarationDefinition, NameDefinition, UNRESOLVED_REFERENCE_NAME, -} from "./TypeContext"; -import * as E from "./Errors"; -import { traverseJSDocTags } from "./utils/JSDoc"; -import { GraphQLConstructor, loc } from "./GraphQLConstructor"; -import { relativePath } from "./gratsRoot"; -import { ISSUE_URL } from "./Errors"; -import { detectInvalidComments } from "./comments"; +} from "./TypeContext.js"; +import * as E from "./Errors.js"; +import { traverseJSDocTags } from "./utils/JSDoc.js"; +import { GraphQLConstructor, loc } from "./GraphQLConstructor.js"; +import { relativePath } from "./gratsRoot.js"; +import { ISSUE_URL } from "./Errors.js"; +import { detectInvalidComments } from "./comments.js"; import { bestMatch, extend, invariant, levenshteinDistance, TsIdentifier, -} from "./utils/helpers"; -import * as Act from "./CodeActions"; +} from "./utils/helpers.js"; +import * as Act from "./CodeActions.js"; import { InputValueDefinitionNodeOrResolverArg, ResolverArgument, -} from "./resolverSignature"; -import { Parser } from "graphql/language/parser"; -import { ExportDefinition } from "./GraphQLAstExtensions"; +} from "./resolverSignature.js"; +import { Parser } from "graphql/language/parser.js"; +import { ExportDefinition } from "./GraphQLAstExtensions.js"; export const LIBRARY_IMPORT_NAME = "grats"; export const LIBRARY_NAME = "Grats"; diff --git a/src/GraphQLAstExtensions.ts b/src/GraphQLAstExtensions.ts index 6efe28ca..b940fad9 100644 --- a/src/GraphQLAstExtensions.ts +++ b/src/GraphQLAstExtensions.ts @@ -1,5 +1,5 @@ -import { ResolverSignature } from "./resolverSignature"; -import { TsIdentifier } from "./utils/helpers"; +import { ResolverSignature } from "./resolverSignature.js"; +import { TsIdentifier } from "./utils/helpers.js"; export type ExportDefinition = { tsModulePath: string; diff --git a/src/GraphQLConstructor.ts b/src/GraphQLConstructor.ts index 40b77690..24f01b5e 100644 --- a/src/GraphQLConstructor.ts +++ b/src/GraphQLConstructor.ts @@ -35,13 +35,13 @@ import { EnumValueNode, } from "graphql"; import * as ts from "typescript"; -import { uniqueId } from "./utils/helpers"; -import { DiagnosticResult, TsLocatableNode } from "./utils/DiagnosticError"; +import { uniqueId } from "./utils/helpers.js"; +import { DiagnosticResult, TsLocatableNode } from "./utils/DiagnosticError.js"; import { InputValueDefinitionNodeOrResolverArg, ResolverSignature, -} from "./resolverSignature"; -import { ExportDefinition } from "./GraphQLAstExtensions"; +} from "./resolverSignature.js"; +import { ExportDefinition } from "./GraphQLAstExtensions.js"; export class GraphQLConstructor { /* Top Level Types */ diff --git a/src/InterfaceGraph.ts b/src/InterfaceGraph.ts index b1710fa0..40a972d6 100644 --- a/src/InterfaceGraph.ts +++ b/src/InterfaceGraph.ts @@ -1,5 +1,5 @@ -import { TypeContext } from "./TypeContext"; -import { DefaultMap } from "./utils/helpers"; +import { TypeContext } from "./TypeContext.js"; +import { DefaultMap } from "./utils/helpers.js"; import { DefinitionNode, Kind } from "graphql"; export type InterfaceImplementor = { kind: "TYPE" | "INTERFACE"; name: string }; diff --git a/src/Locate.ts b/src/Locate.ts index 48067f91..e3ff63af 100644 --- a/src/Locate.ts +++ b/src/Locate.ts @@ -1,81 +1,115 @@ import { - GraphQLInputObjectType, - GraphQLInterfaceType, - GraphQLObjectType, GraphQLSchema, Location, + resolveSchemaCoordinate, + type ResolvedSchemaElement, } from "graphql"; -import { Result, err, ok } from "./utils/Result"; -import { nullThrows } from "./utils/helpers"; - -type EntityName = { - parent: string; - field: string | null; -}; +import { Result, err, ok } from "./utils/Result.js"; +import { nullThrows } from "./utils/helpers.js"; /** - * Given an entity name of the format `ParentType` or `ParentType.fieldName`, - * locate the entity in the schema and return its location. + * Given a schema coordinate string, locate the entity in the schema + * and return its source location. + * + * Uses the Schema Coordinates spec: + * https://spec.graphql.org/draft/#sec-Schema-Coordinates + * + * Supports all schema coordinate forms: + * - `Type` — named type + * - `Type.field` — field on object/interface type + * - `Type.field(arg:)` — field argument + * - `EnumType.VALUE` — enum value + * - `InputType.field` — input field + * - `@directive` — directive + * - `@directive(arg:)` — directive argument */ export function locate( schema: GraphQLSchema, - entityName: string, + coordinate: string, ): Result { - const entityResult = parseEntityName(entityName); - if (entityResult.kind === "ERROR") { - return entityResult; - } - const entity = entityResult.value; - const type = schema.getType(entity.parent); - if (type == null) { - return err(`Cannot locate type \`${entity.parent}\`.`); - } - if (entity.field == null) { - if (type.astNode == null) { - throw new Error( - `Grats bug: Cannot find location of type \`${entity.parent}\`.`, - ); - } - return ok(nullThrows(type.astNode.name.loc)); - } - - if ( - !( - type instanceof GraphQLObjectType || - type instanceof GraphQLInterfaceType || - type instanceof GraphQLInputObjectType - ) - ) { + let resolved: ResolvedSchemaElement | undefined; + try { + resolved = resolveSchemaCoordinate(schema, coordinate); + } catch (e: unknown) { return err( - `Cannot locate field \`${entity.field}\` on type \`${entity.parent}\`. Only object types, interfaces, and input objects have fields.`, + `Invalid schema coordinate: \`${coordinate}\`. ${e instanceof Error ? e.message : String(e)}`, ); } - - const field = type.getFields()[entity.field]; - if (field == null) { - return err( - `Cannot locate field \`${entity.field}\` on type \`${entity.parent}\`.`, - ); - } - - if (field.astNode == null) { - throw new Error( - `Grats bug: Cannot find location of field \`${entity.field}\` on type \`${entity.parent}\`.`, - ); + if (resolved == null) { + return err(`Could not resolve schema coordinate: \`${coordinate}\`.`); } - return ok(nullThrows(field.astNode.name.loc)); -} - -const ENTITY_NAME_REGEX = /^([A-Za-z0-9_]+)(?:\.([A-Za-z0-9_]+))?$/; -function parseEntityName(entityName: string): Result { - const match = ENTITY_NAME_REGEX.exec(entityName); - if (match == null) { - return err( - `Invalid entity name: \`${entityName}\`. Expected \`ParentType\` or \`ParentType.fieldName\`.`, - ); + switch (resolved.kind) { + case "NamedType": { + const astNode = resolved.type.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of type in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "Field": { + const astNode = resolved.field.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of field in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "InputField": { + const astNode = resolved.inputField.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of input field in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "EnumValue": { + const astNode = resolved.enumValue.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of enum value in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "FieldArgument": { + const astNode = resolved.fieldArgument.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of field argument in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "Directive": { + const astNode = resolved.directive.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of directive in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + case "DirectiveArgument": { + const astNode = resolved.directiveArgument.astNode; + if (astNode == null) { + throw new Error( + `Grats bug: Cannot find location of directive argument in coordinate \`${coordinate}\`.`, + ); + } + return ok(nullThrows(astNode.name.loc)); + } + default: { + // Exhaustive check — if new schema coordinate kinds are added, + // TypeScript will catch this. + const _exhaustive: never = resolved; + throw new Error( + `Grats bug: Unexpected schema coordinate kind: ${(resolved as { kind: string }).kind}`, + ); + } } - const parent = match[1]; - const field = match[2] || null; - return ok({ parent, field }); } diff --git a/src/TypeContext.ts b/src/TypeContext.ts index f30c2ee6..41d32c61 100644 --- a/src/TypeContext.ts +++ b/src/TypeContext.ts @@ -13,11 +13,11 @@ import { gqlRelated, DiagnosticsResult, FixableDiagnosticWithLocation, -} from "./utils/DiagnosticError"; -import { err, ok } from "./utils/Result"; -import * as E from "./Errors"; -import { ExtractionSnapshot } from "./Extractor"; -import { ResolverArgument } from "./resolverSignature"; +} from "./utils/DiagnosticError.js"; +import { err, ok } from "./utils/Result.js"; +import * as E from "./Errors.js"; +import { ExtractionSnapshot } from "./Extractor.js"; +import { ResolverArgument } from "./resolverSignature.js"; export const UNRESOLVED_REFERENCE_NAME = `__UNRESOLVED_REFERENCE__`; @@ -45,7 +45,7 @@ export type NameDefinition = { export type DeclarationDefinition = NameDefinition | DerivedResolverDefinition; -import type { TsIdentifier } from "./utils/helpers"; +import type { TsIdentifier } from "./utils/helpers.js"; /** * Public interface for TypeContext. diff --git a/src/cli.ts b/src/cli.ts index b392c2fb..67c0a288 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,38 +3,56 @@ // LLM agent docs: See the llm-docs/ directory in the package root for // Markdown documentation covering all Grats features and configuration. -import * as E from "./Errors"; +import * as E from "./Errors.js"; import { Location } from "graphql"; -import { getParsedTsConfig } from "./"; +import { getParsedTsConfig } from "./index.js"; import { SchemaAndDoc, buildSchemaAndDocResult, extractSchemaAndDoc, -} from "./lib"; +} from "./lib.js"; import { Command } from "commander"; -import { writeFileSync } from "fs"; +import { writeFileSync, readFileSync } from "fs"; import { resolve, dirname } from "path"; -import { version } from "../package.json"; -import { locate } from "./Locate"; +import { fileURLToPath } from "url"; +import { locate } from "./Locate.js"; import { printGratsSDL, printExecutableSchema, printEnumsModule, -} from "./printSchema"; +} from "./printSchema.js"; import * as ts from "typescript"; import { diagnosticsMessage, locationlessErr, ReportableDiagnostics, DiagnosticsWithoutLocationResult, -} from "./utils/DiagnosticError"; -import { GratsConfig, ParsedCommandLineGrats } from "./gratsConfig"; -import { err, ok } from "./utils/Result"; -import { cacheFromProgram, cachesAreEqual, RunCache } from "./runCache"; -import { withFixesFixed, FixOptions, applyFixes } from "./fixFixable"; +} from "./utils/DiagnosticError.js"; +import { GratsConfig, ParsedCommandLineGrats } from "./gratsConfig.js"; +import { err, ok } from "./utils/Result.js"; +import { cacheFromProgram, cachesAreEqual, RunCache } from "./runCache.js"; +import { withFixesFixed, FixOptions, applyFixes } from "./fixFixable.js"; type BuildOptions = FixOptions; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const version = readPackageVersion(); + +function readPackageVersion(): string { + // Works from both source (src/cli.ts → ../package.json) + // and compiled output (dist/src/cli.js → ../../package.json) + for (const relPath of ["../package.json", "../../package.json"]) { + try { + const pkg = JSON.parse(readFileSync(resolve(__dirname, relPath), "utf8")); + if (pkg.name === "grats") return pkg.version; + } catch { + // Ignore missing/unreadable package.json files + } + } + return "unknown"; +} + const program = new Command(); program @@ -57,7 +75,10 @@ program program .command("locate") - .argument("", "GraphQL entity to locate. E.g. `User` or `User.id`") + .argument( + "", + "Schema coordinate to locate. E.g. `User`, `User.name`, `Query.user(id:)`, `@deprecated`", + ) .option( "--tsconfig ", "Path to tsconfig.json. Defaults to auto-detecting based on the current working directory", diff --git a/src/codegen/TSAstBuilder.ts b/src/codegen/TSAstBuilder.ts index 403d1be5..2317acea 100644 --- a/src/codegen/TSAstBuilder.ts +++ b/src/codegen/TSAstBuilder.ts @@ -1,7 +1,7 @@ import * as ts from "typescript"; -import { isNonNull } from "../utils/helpers"; +import { isNonNull } from "../utils/helpers.js"; import * as path from "path"; -import { resolveRelativePath } from "../gratsRoot"; +import { resolveRelativePath } from "../gratsRoot.js"; type JsonObject = { [key: string]: JsonValue }; type JsonArray = JsonValue[]; diff --git a/src/codegen/enumCodegen.ts b/src/codegen/enumCodegen.ts index 1fd2953f..ece3e97c 100644 --- a/src/codegen/enumCodegen.ts +++ b/src/codegen/enumCodegen.ts @@ -1,8 +1,8 @@ import { GraphQLEnumType, GraphQLSchema, isEnumType } from "graphql"; import * as ts from "typescript"; import { GratsConfig } from "../gratsConfig.js"; -import { nullThrows } from "../utils/helpers"; -import TSAstBuilder from "./TSAstBuilder"; +import { nullThrows } from "../utils/helpers.js"; +import TSAstBuilder from "./TSAstBuilder.js"; const F = ts.factory; diff --git a/src/codegen/resolverCodegen.ts b/src/codegen/resolverCodegen.ts index 99fc748b..f174f1ca 100644 --- a/src/codegen/resolverCodegen.ts +++ b/src/codegen/resolverCodegen.ts @@ -1,14 +1,14 @@ import { ConstDirectiveNode, GraphQLField } from "graphql"; import * as ts from "typescript"; -import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives"; +import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives.js"; import { ASSERT_NON_NULL_HELPER, createAssertNonNullHelper, -} from "../codegenHelpers"; -import { nullThrows } from "../utils/helpers"; -import { ResolverArgument, ResolverDefinition, Metadata } from "../metadata"; -import TSAstBuilder from "./TSAstBuilder"; -import { ExportDefinition } from "../GraphQLAstExtensions"; +} from "../codegenHelpers.js"; +import { nullThrows } from "../utils/helpers.js"; +import { ResolverArgument, ResolverDefinition, Metadata } from "../metadata.js"; +import TSAstBuilder from "./TSAstBuilder.js"; +import { ExportDefinition } from "../GraphQLAstExtensions.js"; const RESOLVER_ARGS = ["source", "args", "context", "info"] as const; diff --git a/src/codegen/resolverMapCodegen.ts b/src/codegen/resolverMapCodegen.ts index 1bb5d2b9..a32b133b 100644 --- a/src/codegen/resolverMapCodegen.ts +++ b/src/codegen/resolverMapCodegen.ts @@ -1,10 +1,10 @@ import * as ts from "typescript"; -import { GratsConfig } from "../gratsConfig"; -import TSAstBuilder from "./TSAstBuilder"; -import ResolverCodegen from "./resolverCodegen"; -import { Metadata, FieldDefinition } from "../metadata"; -import { GraphQLObjectType, GraphQLSchema } from "graphql"; -import { nullThrows } from "../utils/helpers"; +import { GratsConfig } from "../gratsConfig.js"; +import TSAstBuilder from "./TSAstBuilder.js"; +import ResolverCodegen from "./resolverCodegen.js"; +import { Metadata, FieldDefinition } from "../metadata.js"; +import { GraphQLSchema, isObjectType } from "graphql"; +import { nullThrows } from "../utils/helpers.js"; const F = ts.factory; @@ -89,7 +89,7 @@ class Codegen { fieldDefinitions: Record, ): ts.ObjectLiteralElementLike[] { const graphQLType = this._schema.getType(typeName); - if (!(graphQLType instanceof GraphQLObjectType)) { + if (!isObjectType(graphQLType)) { throw new Error(`Type ${typeName} is not an object type`); } const fields: ts.ObjectLiteralElementLike[] = []; diff --git a/src/codegen/schemaCodegen.ts b/src/codegen/schemaCodegen.ts index d451dcc3..189b1b46 100644 --- a/src/codegen/schemaCodegen.ts +++ b/src/codegen/schemaCodegen.ts @@ -1,4 +1,5 @@ import { + ConstDirectiveNode, GraphQLAbstractType, GraphQLArgument, GraphQLDirective, @@ -27,14 +28,13 @@ import { valueFromASTUntyped, } from "graphql"; import * as ts from "typescript"; -import { extend, nullThrows } from "../utils/helpers"; +import { extend, nullThrows } from "../utils/helpers.js"; import { GratsConfig } from "../gratsConfig.js"; -import { naturalCompare } from "../utils/naturalCompare"; -import TSAstBuilder, { JsonValue } from "./TSAstBuilder"; -import ResolverCodegen from "./resolverCodegen"; -import { Metadata } from "../metadata"; -import { ConstDirectiveNode } from "graphql/language"; -import { ExportDefinition } from "../GraphQLAstExtensions"; +import { naturalCompare } from "../utils/naturalCompare.js"; +import TSAstBuilder, { JsonValue } from "./TSAstBuilder.js"; +import ResolverCodegen from "./resolverCodegen.js"; +import { Metadata } from "../metadata.js"; +import { ExportDefinition } from "../GraphQLAstExtensions.js"; // These directives will be added to the schema by default, so we don't need to // include them in the generated schema. @@ -95,7 +95,7 @@ class Codegen { schemaDeclarationExport(): void { const scalars = Object.values(this._schema.getTypeMap()) .filter((type) => { - return type instanceof GraphQLScalarType; + return isScalarType(type); }) .filter((type) => !BUILT_IN_SCALARS.has(type.name)) .map((type) => { @@ -691,15 +691,20 @@ class Codegen { } argConfig(arg: GraphQLArgument): ts.Expression { + // In graphql-js v17, defaultValue is deprecated in favor of `default`. + const argDefault = arg.default; return this.ts.objectLiteral([ this.description(arg.description), this.deprecated(arg), F.createPropertyAssignment("type", this.typeReference(arg.type)), - // TODO: arg.defaultValue seems to be missing for complex objects - arg.defaultValue !== undefined + argDefault !== undefined ? F.createPropertyAssignment( "defaultValue", - this.defaultValue(arg.defaultValue), + this.defaultValue( + argDefault.value !== undefined + ? argDefault.value + : valueFromASTUntyped(argDefault.literal!), + ), ) : null, this.extensions(arg.astNode?.directives), diff --git a/src/comments.ts b/src/comments.ts index 805e0da2..a1c47ef6 100644 --- a/src/comments.ts +++ b/src/comments.ts @@ -1,12 +1,12 @@ import * as ts from "typescript"; -import { rangeErr } from "./utils/DiagnosticError"; -import * as E from "./Errors"; -import * as Act from "./CodeActions"; +import { rangeErr } from "./utils/DiagnosticError.js"; +import * as E from "./Errors.js"; +import * as Act from "./CodeActions.js"; import { ALL_GQL_TAGS, KILLS_PARENT_ON_EXCEPTION_TAG, ONE_OF_TAG, -} from "./Extractor"; +} from "./Extractor.js"; // A line that starts with optional *s followed by @gql or @killsParentOnException const BLOCK_COMMENT_REGEX = diff --git a/src/configSpec.ts b/src/configSpec.ts index 4b66e406..2a8a8952 100644 --- a/src/configSpec.ts +++ b/src/configSpec.ts @@ -1,5 +1,10 @@ -import * as _GratsConfigSpec from "./configSpecRaw.json"; -import { ConfigSpec } from "./gratsConfig"; +import { createRequire } from "module"; +import { ConfigSpec } from "./gratsConfig.js"; + +// Use createRequire to load JSON in ESM without `import ... with { type: "json" }` +// which is not supported by webpack's babel-loader (used by the playground). +const require = createRequire(import.meta.url); +const _GratsConfigSpec = require("./configSpecRaw.json"); // TypeScript does not preserve string literal types when importing JSON. export const GratsConfigSpec: ConfigSpec = _GratsConfigSpec as any; diff --git a/src/configSpecRaw.json b/src/configSpecRaw.json index f1d2fdc0..01db1f66 100644 --- a/src/configSpecRaw.json +++ b/src/configSpecRaw.json @@ -56,10 +56,10 @@ "default": "/**\n * TypeScript enum definitions generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */" }, "importModuleSpecifierEnding": { - "description": "This option allows you configure an extension that will be appended to the end of all import paths in the generated TypeScript schema file.\nWhen building a package that uses ES modules, import paths must not omit the file extension. In TypeScript code this generally means import paths must end with `.js`. If set to null, no ending will be appended.", + "description": "The extension appended to the end of all import paths in the generated TypeScript schema file. Defaults to `.js` which works for both CommonJS and ES module projects. Set to an empty string to omit the extension.", "type": { "kind": "string" }, "nullable": false, - "default": "" + "default": ".js" }, "EXPERIMENTAL__emitMetadata": { "description": "EXPERIMENTAL: THIS OPTION WILL BE RENAMED OR REMOVED IN A FUTURE RELEASE\nEmit a JSON file alongside the generated schema file which contains the metadata containing information about the resolvers.", diff --git a/src/fixFixable.ts b/src/fixFixable.ts index d926157a..f0dc406f 100644 --- a/src/fixFixable.ts +++ b/src/fixFixable.ts @@ -2,9 +2,9 @@ import * as ts from "typescript"; import { DiagnosticsWithoutLocationResult, FixableDiagnostic, -} from "./utils/DiagnosticError"; +} from "./utils/DiagnosticError.js"; import { writeFileSync, readFileSync } from "fs"; -import { relativePath } from "./gratsRoot"; +import { relativePath } from "./gratsRoot.js"; export type FixOptions = { fix: boolean; diff --git a/src/gratsConfig.ts b/src/gratsConfig.ts index 0688bd95..c76c7d3b 100644 --- a/src/gratsConfig.ts +++ b/src/gratsConfig.ts @@ -1,9 +1,9 @@ import * as ts from "typescript"; -import { err, ok, Result } from "./utils/Result"; -import { invariant } from "./utils/helpers"; -import { locationlessErr } from "./utils/DiagnosticError"; -import { GratsConfigSpec } from "./configSpec"; -import { GratsConfig } from "./TGratsConfig"; +import { err, ok, Result } from "./utils/Result.js"; +import { invariant } from "./utils/helpers.js"; +import { locationlessErr } from "./utils/DiagnosticError.js"; +import { GratsConfigSpec } from "./configSpec.js"; +import type { GratsConfig } from "./TGratsConfig.js"; /** * For Grats's config object we need the following: diff --git a/src/gratsRoot.ts b/src/gratsRoot.ts index 3e5b00db..92d6dc2c 100644 --- a/src/gratsRoot.ts +++ b/src/gratsRoot.ts @@ -1,4 +1,5 @@ -import { relative, resolve, join } from "path"; +import { relative, resolve, join, dirname } from "path"; +import { fileURLToPath } from "url"; // Grats parses TypeScript files and finds resolvers. If the field resolver is a // named export, Grats needs to be able to import that file during execution. @@ -7,7 +8,15 @@ import { relative, resolve, join } from "path"; // the path to the module that contains the resolver. In order to allow those // paths to be relative, they must be relative to something that both the build // step and the runtime can agree on. This path is that thing. -const gratsRoot = join(__dirname, "../.."); + +// This file lives at src/gratsRoot.ts (source) or dist/src/gratsRoot.js +// (compiled). In both cases, going up two levels reaches the project root. +// In the browser (webpack playground), fileURLToPath may not be available +// since the `url` module is stubbed out via webpack fallback. +const gratsRoot = + typeof fileURLToPath === "function" + ? join(dirname(fileURLToPath(import.meta.url)), "../..") + : "."; export function relativePath(absolute: string): string { return relative(gratsRoot, absolute); diff --git a/src/index.ts b/src/index.ts index a7487016..ada33786 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,17 +2,17 @@ // Markdown documentation covering all Grats features and configuration. import * as ts from "typescript"; -import { ParsedCommandLineGrats, validateGratsOptions } from "./gratsConfig"; -import { DiagnosticsWithoutLocationResult } from "./utils/DiagnosticError"; -import { err } from "./utils/Result"; +import { ParsedCommandLineGrats, validateGratsOptions } from "./gratsConfig.js"; +import { DiagnosticsWithoutLocationResult } from "./utils/DiagnosticError.js"; +import { err } from "./utils/Result.js"; -export { printSDLWithoutMetadata } from "./printSchema"; -export * from "./Types"; -export * from "./lib"; +export { printSDLWithoutMetadata } from "./printSchema.js"; +export * from "./Types.js"; +export * from "./lib.js"; // Used by the experimental TypeScript plugin -export { extract } from "./Extractor"; -export { codegen } from "./codegen/schemaCodegen"; -export { ReportableDiagnostics } from "./utils/DiagnosticError"; +export { extract } from "./Extractor.js"; +export { codegen } from "./codegen/schemaCodegen.js"; +export { ReportableDiagnostics } from "./utils/DiagnosticError.js"; // #FIXME: Report diagnostics instead of throwing! export function getParsedTsConfig( diff --git a/src/lib.ts b/src/lib.ts index 11a9c382..1582b17d 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -9,40 +9,40 @@ import { import { DiagnosticsWithoutLocationResult, graphQlErrorToDiagnostic, -} from "./utils/DiagnosticError"; -import { concatResults, ResultPipe } from "./utils/Result"; -import { ok, err } from "./utils/Result"; +} from "./utils/DiagnosticError.js"; +import { concatResults, ResultPipe } from "./utils/Result.js"; +import { ok, err } from "./utils/Result.js"; import * as ts from "typescript"; -import { ExtractionSnapshot } from "./Extractor"; -import { TypeContext } from "./TypeContext"; -import { validateSDL } from "graphql/validation/validate"; -import { ParsedCommandLineGrats } from "./gratsConfig"; -import { validateTypenames } from "./validations/validateTypenames"; -import { extractSnapshotsFromProgram } from "./transforms/snapshotsFromProgram"; -import { validateMergedInterfaces } from "./validations/validateMergedInterfaces"; -import { addInterfaceFields } from "./transforms/addInterfaceFields"; -import { filterNonGqlInterfaces } from "./transforms/filterNonGqlInterfaces"; -import { validateAsyncIterable } from "./validations/validateAsyncIterable"; -import { applyDefaultNullability } from "./transforms/applyDefaultNullability"; -import { mergeExtensions } from "./transforms/mergeExtensions"; -import { sortSchemaAst } from "./transforms/sortSchemaAst"; -import { validateDuplicateContextOrInfo } from "./validations/validateDuplicateContextOrInfo"; -import { validateSemanticNullability } from "./validations/validateSemanticNullability"; -import { resolveTypes } from "./transforms/resolveTypes"; -import { resolveResolverParams } from "./transforms/resolveResolverParams"; -import { customSpecValidations } from "./validations/customSpecValidations"; -import { makeResolverSignature } from "./transforms/makeResolverSignature"; -import { addImplicitRootTypes } from "./transforms/addImplicitRootTypes"; -import { Metadata } from "./metadata"; -import { validateDirectiveArguments } from "./validations/validateDirectiveArguments"; -import { coerceDefaultEnumValues } from "./transforms/coerceDefaultEnumValues"; -import { validateSomeTypesAreDefined } from "./validations/validateSomeTypesAreDefined"; +import { ExtractionSnapshot } from "./Extractor.js"; +import { TypeContext } from "./TypeContext.js"; +import { validateSDL } from "graphql/validation/validate.js"; +import { ParsedCommandLineGrats } from "./gratsConfig.js"; +import { validateTypenames } from "./validations/validateTypenames.js"; +import { extractSnapshotsFromProgram } from "./transforms/snapshotsFromProgram.js"; +import { validateMergedInterfaces } from "./validations/validateMergedInterfaces.js"; +import { addInterfaceFields } from "./transforms/addInterfaceFields.js"; +import { filterNonGqlInterfaces } from "./transforms/filterNonGqlInterfaces.js"; +import { validateAsyncIterable } from "./validations/validateAsyncIterable.js"; +import { applyDefaultNullability } from "./transforms/applyDefaultNullability.js"; +import { mergeExtensions } from "./transforms/mergeExtensions.js"; +import { sortSchemaAst } from "./transforms/sortSchemaAst.js"; +import { validateDuplicateContextOrInfo } from "./validations/validateDuplicateContextOrInfo.js"; +import { validateSemanticNullability } from "./validations/validateSemanticNullability.js"; +import { resolveTypes } from "./transforms/resolveTypes.js"; +import { resolveResolverParams } from "./transforms/resolveResolverParams.js"; +import { customSpecValidations } from "./validations/customSpecValidations.js"; +import { makeResolverSignature } from "./transforms/makeResolverSignature.js"; +import { addImplicitRootTypes } from "./transforms/addImplicitRootTypes.js"; +import { Metadata } from "./metadata.js"; +import { validateDirectiveArguments } from "./validations/validateDirectiveArguments.js"; +import { coerceDefaultEnumValues } from "./transforms/coerceDefaultEnumValues.js"; +import { validateSomeTypesAreDefined } from "./validations/validateSomeTypesAreDefined.js"; // Export the TypeScript plugin implementation used by // grats-ts-plugin -export { initTsPlugin } from "./tsPlugin/initTsPlugin"; +export { initTsPlugin } from "./tsPlugin/initTsPlugin.js"; -export type { GratsConfig } from "./gratsConfig"; +export type { GratsConfig } from "./gratsConfig.js"; export type SchemaAndDoc = { schema: GraphQLSchema; diff --git a/src/printSchema.ts b/src/printSchema.ts index 98ee268e..e17c8514 100644 --- a/src/printSchema.ts +++ b/src/printSchema.ts @@ -4,12 +4,12 @@ import { print, specifiedScalarTypes, } from "graphql"; -import { GratsConfig } from "./gratsConfig"; -import { codegen } from "./codegen/schemaCodegen"; -import { Metadata } from "./metadata"; -import { resolverMapCodegen } from "./codegen/resolverMapCodegen"; -import { codegenEnums } from "./codegen/enumCodegen"; -import { mapDefinitions } from "./utils/visitor"; +import { GratsConfig } from "./gratsConfig.js"; +import { codegen } from "./codegen/schemaCodegen.js"; +import { Metadata } from "./metadata.js"; +import { resolverMapCodegen } from "./codegen/resolverMapCodegen.js"; +import { codegenEnums } from "./codegen/enumCodegen.js"; +import { mapDefinitions } from "./utils/visitor.js"; /** * Prints code for a TypeScript module that exports a GraphQLSchema. diff --git a/src/publicDirectives.ts b/src/publicDirectives.ts index 31a470ca..f863917f 100644 --- a/src/publicDirectives.ts +++ b/src/publicDirectives.ts @@ -6,7 +6,7 @@ import { Location, parse, } from "graphql"; -import { uniqueId } from "./utils/helpers"; +import { uniqueId } from "./utils/helpers.js"; /** * Grats supports some additional, non-spec server directives in order to diff --git a/src/resolverSignature.ts b/src/resolverSignature.ts index fbb5a84b..7da1cd73 100644 --- a/src/resolverSignature.ts +++ b/src/resolverSignature.ts @@ -9,7 +9,7 @@ import { StringValueNode, TypeNode, } from "graphql"; -import { DiagnosticResult } from "./utils/DiagnosticError"; +import { DiagnosticResult } from "./utils/DiagnosticError.js"; /** * Describes the backing resolver for a field. This broadly matches the metadata diff --git a/src/tests/TestRunner.ts b/src/tests/TestRunner.ts index 03738faf..0bf906a4 100644 --- a/src/tests/TestRunner.ts +++ b/src/tests/TestRunner.ts @@ -1,9 +1,9 @@ import * as fs from "fs"; import * as path from "path"; import { diff } from "jest-diff"; -import { ask } from "./yesNo"; -import { Result } from "../utils/Result"; -import { Markdown } from "./Markdown"; +import { ask } from "./yesNo.js"; +import { Result } from "../utils/Result.js"; +import { Markdown } from "./Markdown.js"; export type TransformerResult = Result | false; diff --git a/src/tests/configParserFixtures/empty.json.expected.md b/src/tests/configParserFixtures/empty.json.expected.md index 3d8c5c83..42e0fa7b 100644 --- a/src/tests/configParserFixtures/empty.json.expected.md +++ b/src/tests/configParserFixtures/empty.json.expected.md @@ -21,7 +21,7 @@ "schemaHeader": "# Schema generated by Grats (https://grats.capt.dev)\n# Do not manually edit. Regenerate by running `npx grats`.", "tsSchemaHeader": "/**\n * Executable schema generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", "tsClientEnumsHeader": "/**\n * TypeScript enum definitions generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", - "importModuleSpecifierEnding": "", + "importModuleSpecifierEnding": ".js", "EXPERIMENTAL__emitMetadata": false, "EXPERIMENTAL__emitResolverMap": false } diff --git a/src/tests/configParserFixtures/experimentalField.json.expected.md b/src/tests/configParserFixtures/experimentalField.json.expected.md index 3df71cde..b3f978a5 100644 --- a/src/tests/configParserFixtures/experimentalField.json.expected.md +++ b/src/tests/configParserFixtures/experimentalField.json.expected.md @@ -23,7 +23,7 @@ "schemaHeader": "# Schema generated by Grats (https://grats.capt.dev)\n# Do not manually edit. Regenerate by running `npx grats`.", "tsSchemaHeader": "/**\n * Executable schema generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", "tsClientEnumsHeader": "/**\n * TypeScript enum definitions generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", - "importModuleSpecifierEnding": "", + "importModuleSpecifierEnding": ".js", "EXPERIMENTAL__emitMetadata": true, "EXPERIMENTAL__emitResolverMap": false } diff --git a/src/tests/configParserFixtures/multiLineHeader.json.expected.md b/src/tests/configParserFixtures/multiLineHeader.json.expected.md index 94ea0be6..d5cd4f51 100644 --- a/src/tests/configParserFixtures/multiLineHeader.json.expected.md +++ b/src/tests/configParserFixtures/multiLineHeader.json.expected.md @@ -23,7 +23,7 @@ "schemaHeader": "/**\n * An amazing GraphQL schema\n */", "tsSchemaHeader": "/**\n * Executable schema generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", "tsClientEnumsHeader": "/**\n * TypeScript enum definitions generated by Grats (https://grats.capt.dev)\n * Do not manually edit. Regenerate by running `npx grats`.\n */", - "importModuleSpecifierEnding": "", + "importModuleSpecifierEnding": ".js", "EXPERIMENTAL__emitMetadata": false, "EXPERIMENTAL__emitResolverMap": false } diff --git a/src/tests/fixtures/arguments/CustomScalarArgument.ts.expected.md b/src/tests/fixtures/arguments/CustomScalarArgument.ts.expected.md index fe961611..7e912bad 100644 --- a/src/tests/fixtures/arguments/CustomScalarArgument.ts.expected.md +++ b/src/tests/fixtures/arguments/CustomScalarArgument.ts.expected.md @@ -31,7 +31,7 @@ type SomeType { ```ts import type { GqlScalar } from "grats"; -import type { MyString as MyStringInternal } from "./CustomScalarArgument"; +import type { MyString as MyStringInternal } from "./CustomScalarArgument.js"; import { GraphQLSchema, GraphQLScalarType, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/arguments/PositionalArgDeprecatedWithDefault.ts.expected.md b/src/tests/fixtures/arguments/PositionalArgDeprecatedWithDefault.ts.expected.md index 16e6bdd2..d6f432f4 100644 --- a/src/tests/fixtures/arguments/PositionalArgDeprecatedWithDefault.ts.expected.md +++ b/src/tests/fixtures/arguments/PositionalArgDeprecatedWithDefault.ts.expected.md @@ -32,7 +32,7 @@ input Greeting { } type SomeType { - hello(greeting: Greeting! = {name: "Alice", salutation: "Hullo"} @deprecated(reason: "Unused!")): String + hello(greeting: Greeting! = { name: "Alice", salutation: "Hullo" } @deprecated(reason: "Unused!")): String } ``` diff --git a/src/tests/fixtures/custom_scalars/DefineCustomScalar.ts.expected.md b/src/tests/fixtures/custom_scalars/DefineCustomScalar.ts.expected.md index 2d75f30a..680c7dd5 100644 --- a/src/tests/fixtures/custom_scalars/DefineCustomScalar.ts.expected.md +++ b/src/tests/fixtures/custom_scalars/DefineCustomScalar.ts.expected.md @@ -29,7 +29,7 @@ type SomeType { ```ts import type { GqlScalar } from "grats"; -import type { MyUrl as MyUrlInternal } from "./DefineCustomScalar"; +import type { MyUrl as MyUrlInternal } from "./DefineCustomScalar.js"; import { GraphQLSchema, GraphQLScalarType, GraphQLObjectType, GraphQLString } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/custom_scalars/DefineCustomScalarWithDescription.ts.expected.md b/src/tests/fixtures/custom_scalars/DefineCustomScalarWithDescription.ts.expected.md index a3979d49..568c82f2 100644 --- a/src/tests/fixtures/custom_scalars/DefineCustomScalarWithDescription.ts.expected.md +++ b/src/tests/fixtures/custom_scalars/DefineCustomScalarWithDescription.ts.expected.md @@ -33,7 +33,7 @@ type SomeType { ```ts import type { GqlScalar } from "grats"; -import type { MyUrl as MyUrlInternal } from "./DefineCustomScalarWithDescription"; +import type { MyUrl as MyUrlInternal } from "./DefineCustomScalarWithDescription.js"; import { GraphQLSchema, GraphQLScalarType, GraphQLObjectType, GraphQLString } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/custom_scalars/DefineRenamedCustomScalar.ts.expected.md b/src/tests/fixtures/custom_scalars/DefineRenamedCustomScalar.ts.expected.md index 6899daf6..9da31ae4 100644 --- a/src/tests/fixtures/custom_scalars/DefineRenamedCustomScalar.ts.expected.md +++ b/src/tests/fixtures/custom_scalars/DefineRenamedCustomScalar.ts.expected.md @@ -29,7 +29,7 @@ type SomeType { ```ts import type { GqlScalar } from "grats"; -import type { MyUrl as CustomNameInternal } from "./DefineRenamedCustomScalar"; +import type { MyUrl as CustomNameInternal } from "./DefineRenamedCustomScalar.js"; import { GraphQLSchema, GraphQLScalarType, GraphQLObjectType, GraphQLString } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/custom_scalars/SpecifiedBy.ts.expected.md b/src/tests/fixtures/custom_scalars/SpecifiedBy.ts.expected.md index 384181b9..6ce0c225 100644 --- a/src/tests/fixtures/custom_scalars/SpecifiedBy.ts.expected.md +++ b/src/tests/fixtures/custom_scalars/SpecifiedBy.ts.expected.md @@ -22,7 +22,7 @@ scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122") ```ts import type { GqlScalar } from "grats"; -import type { UUID as UUIDInternal } from "./SpecifiedBy"; +import type { UUID as UUIDInternal } from "./SpecifiedBy.js"; import { GraphQLSchema, GraphQLScalarType } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts.expected.md b/src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts.expected.md index 5bdd2838..80eafb76 100644 --- a/src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts.expected.md +++ b/src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts.expected.md @@ -15,7 +15,7 @@ export type UUID = string; ### Error Report ```text -src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts:3:4 - error: Directive "@specifiedBy" argument "url" of type "String!" is required, but it was not provided. +src/tests/fixtures/custom_scalars/SpecifiedByMissingUrlinvalid.invalid.ts:3:4 - error: Argument "@specifiedBy(url:)" of type "String!" is required, but it was not provided. 3 * @gqlAnnotate specifiedBy ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/tests/fixtures/default_values/DefaultArgumentObjectLiteral.ts.expected.md b/src/tests/fixtures/default_values/DefaultArgumentObjectLiteral.ts.expected.md index c41ab0ae..1ca1d03a 100644 --- a/src/tests/fixtures/default_values/DefaultArgumentObjectLiteral.ts.expected.md +++ b/src/tests/fixtures/default_values/DefaultArgumentObjectLiteral.ts.expected.md @@ -35,7 +35,7 @@ input ConnectionInput { } type SomeType { - someField1(input: ConnectionInput = {first: 10, offset: 100}): String + someField1(input: ConnectionInput = { first: 10, offset: 100 }): String } ``` diff --git a/src/tests/fixtures/derived_context/derivedContextPromiseValid.ts.expected.md b/src/tests/fixtures/derived_context/derivedContextPromiseValid.ts.expected.md index 10b83e3d..6856bcd8 100644 --- a/src/tests/fixtures/derived_context/derivedContextPromiseValid.ts.expected.md +++ b/src/tests/fixtures/derived_context/derivedContextPromiseValid.ts.expected.md @@ -39,7 +39,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver, createDerivedContext } from "./derivedContextPromiseValid"; +import { greeting as queryGreetingResolver, createDerivedContext } from "./derivedContextPromiseValid.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/derived_context/derivedContextUsedMultipleTimes.ts.expected.md b/src/tests/fixtures/derived_context/derivedContextUsedMultipleTimes.ts.expected.md index 2a10d5bd..548272e6 100644 --- a/src/tests/fixtures/derived_context/derivedContextUsedMultipleTimes.ts.expected.md +++ b/src/tests/fixtures/derived_context/derivedContextUsedMultipleTimes.ts.expected.md @@ -46,7 +46,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { farewell as queryFarewellResolver, greetingContext, greeting as queryGreetingResolver } from "./derivedContextUsedMultipleTimes"; +import { farewell as queryFarewellResolver, greetingContext, greeting as queryGreetingResolver } from "./derivedContextUsedMultipleTimes.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/derived_context/nestedAsyncDerivedContext.ts.expected.md b/src/tests/fixtures/derived_context/nestedAsyncDerivedContext.ts.expected.md index b32abb54..0cefc697 100644 --- a/src/tests/fixtures/derived_context/nestedAsyncDerivedContext.ts.expected.md +++ b/src/tests/fixtures/derived_context/nestedAsyncDerivedContext.ts.expected.md @@ -49,7 +49,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver, createDerivedContext2, createDerivedContext1 } from "./nestedAsyncDerivedContext"; +import { greeting as queryGreetingResolver, createDerivedContext2, createDerivedContext1 } from "./nestedAsyncDerivedContext.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/derived_context/simpleDerivedContext.ts.expected.md b/src/tests/fixtures/derived_context/simpleDerivedContext.ts.expected.md index b30322c2..1285c227 100644 --- a/src/tests/fixtures/derived_context/simpleDerivedContext.ts.expected.md +++ b/src/tests/fixtures/derived_context/simpleDerivedContext.ts.expected.md @@ -40,7 +40,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver, createDerivedContext } from "./simpleDerivedContext"; +import { greeting as queryGreetingResolver, createDerivedContext } from "./simpleDerivedContext.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/derived_context/simpleDerivedContextNoArgs.ts.expected.md b/src/tests/fixtures/derived_context/simpleDerivedContextNoArgs.ts.expected.md index fa2330da..2b6ff7a3 100644 --- a/src/tests/fixtures/derived_context/simpleDerivedContextNoArgs.ts.expected.md +++ b/src/tests/fixtures/derived_context/simpleDerivedContextNoArgs.ts.expected.md @@ -40,7 +40,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver, createDerivedContext } from "./simpleDerivedContextNoArgs"; +import { greeting as queryGreetingResolver, createDerivedContext } from "./simpleDerivedContextNoArgs.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/directives/directiveArgFieldInvalid.invalid.ts.expected.md b/src/tests/fixtures/directives/directiveArgFieldInvalid.invalid.ts.expected.md index 3107dd1c..be425b57 100644 --- a/src/tests/fixtures/directives/directiveArgFieldInvalid.invalid.ts.expected.md +++ b/src/tests/fixtures/directives/directiveArgFieldInvalid.invalid.ts.expected.md @@ -35,5 +35,5 @@ GraphQL request:1:27 - error: String cannot represent a non string value: 10 src/tests/fixtures/directives/directiveArgFieldInvalid.invalid.ts:4:1 4 type MyInput = { a: string }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Parent input type defined here + Input type defined here ``` \ No newline at end of file diff --git a/src/tests/fixtures/directives/directiveOnArgumentDefinition.ts.expected.md b/src/tests/fixtures/directives/directiveOnArgumentDefinition.ts.expected.md index 2cc5ba7f..2eaf465b 100644 --- a/src/tests/fixtures/directives/directiveOnArgumentDefinition.ts.expected.md +++ b/src/tests/fixtures/directives/directiveOnArgumentDefinition.ts.expected.md @@ -39,7 +39,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLNonNull, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLString } from "graphql"; -import { likes as queryLikesResolver } from "./directiveOnArgumentDefinition"; +import { likes as queryLikesResolver } from "./directiveOnArgumentDefinition.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/directives/directiveOnFieldDefinition.ts.expected.md b/src/tests/fixtures/directives/directiveOnFieldDefinition.ts.expected.md index 990a6d07..47179deb 100644 --- a/src/tests/fixtures/directives/directiveOnFieldDefinition.ts.expected.md +++ b/src/tests/fixtures/directives/directiveOnFieldDefinition.ts.expected.md @@ -38,7 +38,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLNonNull, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLString } from "graphql"; -import { likes as queryLikesResolver } from "./directiveOnFieldDefinition"; +import { likes as queryLikesResolver } from "./directiveOnFieldDefinition.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/directives/directiveOnScalar.ts.expected.md b/src/tests/fixtures/directives/directiveOnScalar.ts.expected.md index 2b7aae1e..2fc5f8eb 100644 --- a/src/tests/fixtures/directives/directiveOnScalar.ts.expected.md +++ b/src/tests/fixtures/directives/directiveOnScalar.ts.expected.md @@ -32,7 +32,7 @@ scalar MyScalar @max(foo: 10) ```ts import type { GqlScalar } from "grats"; -import type { MyScalar as MyScalarInternal } from "./directiveOnScalar"; +import type { MyScalar as MyScalarInternal } from "./directiveOnScalar.js"; import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLNonNull, GraphQLInt, specifiedDirectives, GraphQLScalarType } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/directives/undefinedDirectiveWithoutArgs.ts.expected.md b/src/tests/fixtures/directives/undefinedDirectiveWithoutArgs.ts.expected.md index 372b93dd..96cdc91d 100644 --- a/src/tests/fixtures/directives/undefinedDirectiveWithoutArgs.ts.expected.md +++ b/src/tests/fixtures/directives/undefinedDirectiveWithoutArgs.ts.expected.md @@ -26,7 +26,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { myQueryField as queryMyQueryFieldResolver } from "./undefinedDirectiveWithoutArgs"; +import { myQueryField as queryMyQueryFieldResolver } from "./undefinedDirectiveWithoutArgs.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/enums/NonNullEnumDefault.ts.expected.md b/src/tests/fixtures/enums/NonNullEnumDefault.ts.expected.md index a61bd2ee..863e5de2 100644 --- a/src/tests/fixtures/enums/NonNullEnumDefault.ts.expected.md +++ b/src/tests/fixtures/enums/NonNullEnumDefault.ts.expected.md @@ -34,7 +34,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./NonNullEnumDefault"; +import { hello as queryHelloResolver } from "./NonNullEnumDefault.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/fixtures/enums/NonNullEnumDefaultInInputObject.ts.expected.md b/src/tests/fixtures/enums/NonNullEnumDefaultInInputObject.ts.expected.md index 9bc14ca2..99609468 100644 --- a/src/tests/fixtures/enums/NonNullEnumDefaultInInputObject.ts.expected.md +++ b/src/tests/fixtures/enums/NonNullEnumDefaultInInputObject.ts.expected.md @@ -37,7 +37,7 @@ input GreetingInput { } type Query { - hello(input: GreetingInput! = {greeting: Greetings}): String + hello(input: GreetingInput! = { greeting: Greetings }): String } ``` @@ -45,7 +45,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLInputObjectType, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./NonNullEnumDefaultInInputObject"; +import { hello as queryHelloResolver } from "./NonNullEnumDefaultInInputObject.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/fixtures/enums/NonNullPluralEnumDefaults.ts.expected.md b/src/tests/fixtures/enums/NonNullPluralEnumDefaults.ts.expected.md index 4dd4f389..9be1a520 100644 --- a/src/tests/fixtures/enums/NonNullPluralEnumDefaults.ts.expected.md +++ b/src/tests/fixtures/enums/NonNullPluralEnumDefaults.ts.expected.md @@ -36,7 +36,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./NonNullPluralEnumDefaults"; +import { hello as queryHelloResolver } from "./NonNullPluralEnumDefaults.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/fixtures/enums/NonNullTsEnumDefault.ts.expected.md b/src/tests/fixtures/enums/NonNullTsEnumDefault.ts.expected.md index aecf3a08..96355a69 100644 --- a/src/tests/fixtures/enums/NonNullTsEnumDefault.ts.expected.md +++ b/src/tests/fixtures/enums/NonNullTsEnumDefault.ts.expected.md @@ -41,7 +41,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./NonNullTsEnumDefault"; +import { hello as queryHelloResolver } from "./NonNullTsEnumDefault.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/fixtures/enums/NonNullTsEnumDefaultStringLiteral.ts.expected.md b/src/tests/fixtures/enums/NonNullTsEnumDefaultStringLiteral.ts.expected.md index 135aae57..6d7d36fe 100644 --- a/src/tests/fixtures/enums/NonNullTsEnumDefaultStringLiteral.ts.expected.md +++ b/src/tests/fixtures/enums/NonNullTsEnumDefaultStringLiteral.ts.expected.md @@ -41,7 +41,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./NonNullTsEnumDefaultStringLiteral"; +import { hello as queryHelloResolver } from "./NonNullTsEnumDefaultStringLiteral.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/fixtures/examples/playground.ts.expected.md b/src/tests/fixtures/examples/playground.ts.expected.md index ad0b8e04..b5399267 100644 --- a/src/tests/fixtures/examples/playground.ts.expected.md +++ b/src/tests/fixtures/examples/playground.ts.expected.md @@ -60,7 +60,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { getUser as someTypeGetUserResolver } from "./playground"; +import { getUser as someTypeGetUserResolver } from "./playground.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/examples/readme.ts.expected.md b/src/tests/fixtures/examples/readme.ts.expected.md index 95b51c82..5af0f177 100644 --- a/src/tests/fixtures/examples/readme.ts.expected.md +++ b/src/tests/fixtures/examples/readme.ts.expected.md @@ -54,7 +54,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { me as queryMeResolver, viewer as queryViewerResolver } from "./readme"; +import { me as queryMeResolver, viewer as queryViewerResolver } from "./readme.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/extend_interface/addStringFieldToInterface.ts.expected.md b/src/tests/fixtures/extend_interface/addStringFieldToInterface.ts.expected.md index a3ae65bf..685340a7 100644 --- a/src/tests/fixtures/extend_interface/addStringFieldToInterface.ts.expected.md +++ b/src/tests/fixtures/extend_interface/addStringFieldToInterface.ts.expected.md @@ -57,7 +57,7 @@ type User implements IPerson { ```ts import { GraphQLSchema, GraphQLInterfaceType, GraphQLString, GraphQLObjectType } from "graphql"; -import { greeting as adminGreetingResolver, greeting as userGreetingResolver } from "./addStringFieldToInterface"; +import { greeting as adminGreetingResolver, greeting as userGreetingResolver } from "./addStringFieldToInterface.js"; export function getSchema(): GraphQLSchema { const IPersonType: GraphQLInterfaceType = new GraphQLInterfaceType({ name: "IPerson", diff --git a/src/tests/fixtures/extend_interface/addStringFieldToInterfaceImplementedByInterface.ts.expected.md b/src/tests/fixtures/extend_interface/addStringFieldToInterfaceImplementedByInterface.ts.expected.md index 76203769..8488914c 100644 --- a/src/tests/fixtures/extend_interface/addStringFieldToInterfaceImplementedByInterface.ts.expected.md +++ b/src/tests/fixtures/extend_interface/addStringFieldToInterfaceImplementedByInterface.ts.expected.md @@ -63,7 +63,7 @@ type User implements IPerson & IThing { ```ts import { GraphQLSchema, GraphQLInterfaceType, GraphQLString, GraphQLObjectType } from "graphql"; -import { greeting as adminGreetingResolver, greeting as userGreetingResolver } from "./addStringFieldToInterfaceImplementedByInterface"; +import { greeting as adminGreetingResolver, greeting as userGreetingResolver } from "./addStringFieldToInterfaceImplementedByInterface.js"; export function getSchema(): GraphQLSchema { const IThingType: GraphQLInterfaceType = new GraphQLInterfaceType({ name: "IThing", diff --git a/src/tests/fixtures/extend_type/addDeprecatedField.ts.expected.md b/src/tests/fixtures/extend_type/addDeprecatedField.ts.expected.md index 2c2eea4b..0768213b 100644 --- a/src/tests/fixtures/extend_type/addDeprecatedField.ts.expected.md +++ b/src/tests/fixtures/extend_type/addDeprecatedField.ts.expected.md @@ -31,7 +31,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./addDeprecatedField"; +import { greeting as someTypeGreetingResolver } from "./addDeprecatedField.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/addFieldWithArguments.ts.expected.md b/src/tests/fixtures/extend_type/addFieldWithArguments.ts.expected.md index d1bfd965..a35492b1 100644 --- a/src/tests/fixtures/extend_type/addFieldWithArguments.ts.expected.md +++ b/src/tests/fixtures/extend_type/addFieldWithArguments.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./addFieldWithArguments"; +import { greeting as someTypeGreetingResolver } from "./addFieldWithArguments.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/addFieldWithDescription.ts.expected.md b/src/tests/fixtures/extend_type/addFieldWithDescription.ts.expected.md index b1583bac..42b2c25e 100644 --- a/src/tests/fixtures/extend_type/addFieldWithDescription.ts.expected.md +++ b/src/tests/fixtures/extend_type/addFieldWithDescription.ts.expected.md @@ -32,7 +32,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./addFieldWithDescription"; +import { greeting as someTypeGreetingResolver } from "./addFieldWithDescription.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/addRenamedFieldToSomeType.ts.expected.md b/src/tests/fixtures/extend_type/addRenamedFieldToSomeType.ts.expected.md index 7d3d312a..64ac460c 100644 --- a/src/tests/fixtures/extend_type/addRenamedFieldToSomeType.ts.expected.md +++ b/src/tests/fixtures/extend_type/addRenamedFieldToSomeType.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeHelloResolver } from "./addRenamedFieldToSomeType"; +import { greeting as someTypeHelloResolver } from "./addRenamedFieldToSomeType.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/addStringFieldToSomeType.ts.expected.md b/src/tests/fixtures/extend_type/addStringFieldToSomeType.ts.expected.md index 560a641c..e59b0b17 100644 --- a/src/tests/fixtures/extend_type/addStringFieldToSomeType.ts.expected.md +++ b/src/tests/fixtures/extend_type/addStringFieldToSomeType.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./addStringFieldToSomeType"; +import { greeting as someTypeGreetingResolver } from "./addStringFieldToSomeType.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/defaultExport.ts.expected.md b/src/tests/fixtures/extend_type/defaultExport.ts.expected.md index 51e12909..493c4647 100644 --- a/src/tests/fixtures/extend_type/defaultExport.ts.expected.md +++ b/src/tests/fixtures/extend_type/defaultExport.ts.expected.md @@ -27,7 +27,7 @@ type SomeType { ### TypeScript ```ts -import someTypeGreetingResolver from "./defaultExport"; +import someTypeGreetingResolver from "./defaultExport.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ diff --git a/src/tests/fixtures/extend_type/fieldAsExportedArrowFunction.ts.expected.md b/src/tests/fixtures/extend_type/fieldAsExportedArrowFunction.ts.expected.md index 81308322..0a5479b4 100644 --- a/src/tests/fixtures/extend_type/fieldAsExportedArrowFunction.ts.expected.md +++ b/src/tests/fixtures/extend_type/fieldAsExportedArrowFunction.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./fieldAsExportedArrowFunction"; +import { greeting as someTypeGreetingResolver } from "./fieldAsExportedArrowFunction.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/fieldAsExportedArrowFunctionPositionalArgs.ts.expected.md b/src/tests/fixtures/extend_type/fieldAsExportedArrowFunctionPositionalArgs.ts.expected.md index 1d6081b1..1144947c 100644 --- a/src/tests/fixtures/extend_type/fieldAsExportedArrowFunctionPositionalArgs.ts.expected.md +++ b/src/tests/fixtures/extend_type/fieldAsExportedArrowFunctionPositionalArgs.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./fieldAsExportedArrowFunctionPositionalArgs"; +import { greeting as someTypeGreetingResolver } from "./fieldAsExportedArrowFunctionPositionalArgs.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/fieldAsExportedAsyncArrowFunction.ts.expected.md b/src/tests/fixtures/extend_type/fieldAsExportedAsyncArrowFunction.ts.expected.md index 291d593d..f8bcb405 100644 --- a/src/tests/fixtures/extend_type/fieldAsExportedAsyncArrowFunction.ts.expected.md +++ b/src/tests/fixtures/extend_type/fieldAsExportedAsyncArrowFunction.ts.expected.md @@ -28,7 +28,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./fieldAsExportedAsyncArrowFunction"; +import { greeting as someTypeGreetingResolver } from "./fieldAsExportedAsyncArrowFunction.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/extend_type/functionFieldOnTypeDefinedWithInterface.ts.expected.md b/src/tests/fixtures/extend_type/functionFieldOnTypeDefinedWithInterface.ts.expected.md index be9030a7..c50101d8 100644 --- a/src/tests/fixtures/extend_type/functionFieldOnTypeDefinedWithInterface.ts.expected.md +++ b/src/tests/fixtures/extend_type/functionFieldOnTypeDefinedWithInterface.ts.expected.md @@ -28,7 +28,7 @@ type Cat { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { catSound as catCatSoundResolver } from "./functionFieldOnTypeDefinedWithInterface"; +import { catSound as catCatSoundResolver } from "./functionFieldOnTypeDefinedWithInterface.js"; export function getSchema(): GraphQLSchema { const CatType: GraphQLObjectType = new GraphQLObjectType({ name: "Cat", diff --git a/src/tests/fixtures/extend_type/optionalModelType.ts.expected.md b/src/tests/fixtures/extend_type/optionalModelType.ts.expected.md index 8c81b5ac..25e90acd 100644 --- a/src/tests/fixtures/extend_type/optionalModelType.ts.expected.md +++ b/src/tests/fixtures/extend_type/optionalModelType.ts.expected.md @@ -35,7 +35,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./optionalModelType"; +import { greeting as someTypeGreetingResolver } from "./optionalModelType.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethod.ts.expected.md b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethod.ts.expected.md index 5ce926c4..86bee804 100644 --- a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethod.ts.expected.md +++ b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethod.ts.expected.md @@ -36,7 +36,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { User as queryGetUserResolver } from "./FieldAsStaticClassMethod"; +import { User as queryGetUserResolver } from "./FieldAsStaticClassMethod.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnNonGqlClass.ts.expected.md b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnNonGqlClass.ts.expected.md index e07a8a8b..be69d860 100644 --- a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnNonGqlClass.ts.expected.md +++ b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnNonGqlClass.ts.expected.md @@ -28,7 +28,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { SomeClass as queryGreetResolver } from "./FieldAsStaticClassMethodOnNonGqlClass"; +import { SomeClass as queryGreetResolver } from "./FieldAsStaticClassMethodOnNonGqlClass.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnUnnamedNonGqlClass.ts.expected.md b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnUnnamedNonGqlClass.ts.expected.md index 1200e14b..bde089e0 100644 --- a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnUnnamedNonGqlClass.ts.expected.md +++ b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodOnUnnamedNonGqlClass.ts.expected.md @@ -27,7 +27,7 @@ type Query { ### TypeScript ```ts -import queryGreetResolver from "./FieldAsStaticClassMethodOnUnnamedNonGqlClass"; +import queryGreetResolver from "./FieldAsStaticClassMethodOnUnnamedNonGqlClass.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ diff --git a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodWithClassAsDefaultExport.ts.expected.md b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodWithClassAsDefaultExport.ts.expected.md index 6f72c5d6..52579e12 100644 --- a/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodWithClassAsDefaultExport.ts.expected.md +++ b/src/tests/fixtures/field_definitions/FieldAsStaticClassMethodWithClassAsDefaultExport.ts.expected.md @@ -35,7 +35,7 @@ type User { ### TypeScript ```ts -import queryGetUserResolver from "./FieldAsStaticClassMethodWithClassAsDefaultExport"; +import queryGetUserResolver from "./FieldAsStaticClassMethodWithClassAsDefaultExport.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ diff --git a/src/tests/fixtures/field_definitions/MultipleFieldsAsStaticClassMethods.ts.expected.md b/src/tests/fixtures/field_definitions/MultipleFieldsAsStaticClassMethods.ts.expected.md index c894dfdc..b35e1bb8 100644 --- a/src/tests/fixtures/field_definitions/MultipleFieldsAsStaticClassMethods.ts.expected.md +++ b/src/tests/fixtures/field_definitions/MultipleFieldsAsStaticClassMethods.ts.expected.md @@ -42,7 +42,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLList, GraphQLNonNull } from "graphql"; -import { User as queryGetUserResolver, User as queryGetUsersResolver } from "./MultipleFieldsAsStaticClassMethods"; +import { User as queryGetUserResolver, User as queryGetUsersResolver } from "./MultipleFieldsAsStaticClassMethods.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/field_values/CustomScalar.ts.expected.md b/src/tests/fixtures/field_values/CustomScalar.ts.expected.md index 002b26db..85c8a265 100644 --- a/src/tests/fixtures/field_values/CustomScalar.ts.expected.md +++ b/src/tests/fixtures/field_values/CustomScalar.ts.expected.md @@ -31,7 +31,7 @@ type SomeType { ```ts import type { GqlScalar } from "grats"; -import type { MyString as MyStringInternal } from "./CustomScalar"; +import type { MyString as MyStringInternal } from "./CustomScalar.js"; import { GraphQLSchema, GraphQLScalarType, GraphQLObjectType } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/generics/defineFieldOnGeneric.ts.expected.md b/src/tests/fixtures/generics/defineFieldOnGeneric.ts.expected.md index 652d0451..f61f0b88 100644 --- a/src/tests/fixtures/generics/defineFieldOnGeneric.ts.expected.md +++ b/src/tests/fixtures/generics/defineFieldOnGeneric.ts.expected.md @@ -46,7 +46,7 @@ type PageEdge { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { title as pageEdgeTitleResolver } from "./defineFieldOnGeneric"; +import { title as pageEdgeTitleResolver } from "./defineFieldOnGeneric.js"; export function getSchema(): GraphQLSchema { const PageType: GraphQLObjectType = new GraphQLObjectType({ name: "Page", diff --git a/src/tests/fixtures/generics/genericOverArg.ts.expected.md b/src/tests/fixtures/generics/genericOverArg.ts.expected.md index a3f2c044..d8883311 100644 --- a/src/tests/fixtures/generics/genericOverArg.ts.expected.md +++ b/src/tests/fixtures/generics/genericOverArg.ts.expected.md @@ -47,7 +47,7 @@ type SomeInputSomeClass { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLInputObjectType, GraphQLNonNull } from "graphql"; -import { someField as querySomeFieldResolver } from "./genericOverArg"; +import { someField as querySomeFieldResolver } from "./genericOverArg.js"; export function getSchema(): GraphQLSchema { const SomeInputType: GraphQLInputObjectType = new GraphQLInputObjectType({ name: "SomeInput", diff --git a/src/tests/fixtures/generics/genericTypeUsingClass.ts.expected.md b/src/tests/fixtures/generics/genericTypeUsingClass.ts.expected.md index 56f30bcb..b68ac2d6 100644 --- a/src/tests/fixtures/generics/genericTypeUsingClass.ts.expected.md +++ b/src/tests/fixtures/generics/genericTypeUsingClass.ts.expected.md @@ -49,7 +49,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { createEdge as queryCreateEdgeResolver } from "./genericTypeUsingClass"; +import { createEdge as queryCreateEdgeResolver } from "./genericTypeUsingClass.js"; export function getSchema(): GraphQLSchema { const PageType: GraphQLObjectType = new GraphQLObjectType({ name: "Page", diff --git a/src/tests/fixtures/generics/genericTypeUsingInterface.ts.expected.md b/src/tests/fixtures/generics/genericTypeUsingInterface.ts.expected.md index 024b6cf6..98b51051 100644 --- a/src/tests/fixtures/generics/genericTypeUsingInterface.ts.expected.md +++ b/src/tests/fixtures/generics/genericTypeUsingInterface.ts.expected.md @@ -49,7 +49,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { createEdge as queryCreateEdgeResolver } from "./genericTypeUsingInterface"; +import { createEdge as queryCreateEdgeResolver } from "./genericTypeUsingInterface.js"; export function getSchema(): GraphQLSchema { const PageType: GraphQLObjectType = new GraphQLObjectType({ name: "Page", diff --git a/src/tests/fixtures/generics/multiparamGeneric.ts.expected.md b/src/tests/fixtures/generics/multiparamGeneric.ts.expected.md index 89bf652a..696b4732 100644 --- a/src/tests/fixtures/generics/multiparamGeneric.ts.expected.md +++ b/src/tests/fixtures/generics/multiparamGeneric.ts.expected.md @@ -53,7 +53,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLUnionType, GraphQLString } from "graphql"; -import { pageResult as queryPageResultResolver } from "./multiparamGeneric"; +import { pageResult as queryPageResultResolver } from "./multiparamGeneric.js"; export function getSchema(): GraphQLSchema { const ErrType: GraphQLObjectType = new GraphQLObjectType({ name: "Err", diff --git a/src/tests/fixtures/generics/names/skippedTypeParam.ts.expected.md b/src/tests/fixtures/generics/names/skippedTypeParam.ts.expected.md index 25f42e89..66462e9e 100644 --- a/src/tests/fixtures/generics/names/skippedTypeParam.ts.expected.md +++ b/src/tests/fixtures/generics/names/skippedTypeParam.ts.expected.md @@ -57,7 +57,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { connection as queryConnectionResolver } from "./skippedTypeParam"; +import { connection as queryConnectionResolver } from "./skippedTypeParam.js"; export function getSchema(): GraphQLSchema { const BType: GraphQLObjectType = new GraphQLObjectType({ name: "B", diff --git a/src/tests/fixtures/generics/names/skippedTypeParamPassesLiteral.ts.expected.md b/src/tests/fixtures/generics/names/skippedTypeParamPassesLiteral.ts.expected.md index b1966091..6509e0cb 100644 --- a/src/tests/fixtures/generics/names/skippedTypeParamPassesLiteral.ts.expected.md +++ b/src/tests/fixtures/generics/names/skippedTypeParamPassesLiteral.ts.expected.md @@ -62,7 +62,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { connection as queryConnectionResolver } from "./skippedTypeParamPassesLiteral"; +import { connection as queryConnectionResolver } from "./skippedTypeParamPassesLiteral.js"; export function getSchema(): GraphQLSchema { const BType: GraphQLObjectType = new GraphQLObjectType({ name: "B", diff --git a/src/tests/fixtures/generics/scalarWithGeneric.ts.expected.md b/src/tests/fixtures/generics/scalarWithGeneric.ts.expected.md index 92482baf..b2c8d1d3 100644 --- a/src/tests/fixtures/generics/scalarWithGeneric.ts.expected.md +++ b/src/tests/fixtures/generics/scalarWithGeneric.ts.expected.md @@ -20,7 +20,7 @@ scalar MyScalar ```ts import type { GqlScalar } from "grats"; -import type { MyScalar as MyScalarInternal } from "./scalarWithGeneric"; +import type { MyScalar as MyScalarInternal } from "./scalarWithGeneric.js"; import { GraphQLSchema, GraphQLScalarType } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/fixtures/locate/enumValue.invalid.ts b/src/tests/fixtures/locate/enumValue.invalid.ts new file mode 100644 index 00000000..53bd1f60 --- /dev/null +++ b/src/tests/fixtures/locate/enumValue.invalid.ts @@ -0,0 +1,6 @@ +// Locate: Greeting.HELLO +/** @gqlEnum */ +export enum Greeting { + HELLO = "HELLO", + GOODBYE = "GOODBYE", +} diff --git a/src/tests/fixtures/locate/enumValue.invalid.ts.expected.md b/src/tests/fixtures/locate/enumValue.invalid.ts.expected.md new file mode 100644 index 00000000..ca3c72b5 --- /dev/null +++ b/src/tests/fixtures/locate/enumValue.invalid.ts.expected.md @@ -0,0 +1,23 @@ +# locate/enumValue.invalid.ts + +## Input + +```ts title="locate/enumValue.invalid.ts" +// Locate: Greeting.HELLO +/** @gqlEnum */ +export enum Greeting { + HELLO = "HELLO", + GOODBYE = "GOODBYE", +} +``` + +## Output + +### Error Report + +```text +src/tests/fixtures/locate/enumValue.invalid.ts:4:11 - error: Located here + +4 HELLO = "HELLO", + ~~~~~~~ +``` \ No newline at end of file diff --git a/src/tests/fixtures/locate/fieldArgument.invalid.ts b/src/tests/fixtures/locate/fieldArgument.invalid.ts new file mode 100644 index 00000000..7acadf58 --- /dev/null +++ b/src/tests/fixtures/locate/fieldArgument.invalid.ts @@ -0,0 +1,8 @@ +// Locate: Query.greeting(salutation:) +/** @gqlType */ +type Query = unknown; + +/** @gqlQueryField */ +export function greeting(salutation: string): string { + return `${salutation}, world!`; +} diff --git a/src/tests/fixtures/locate/fieldArgument.invalid.ts.expected.md b/src/tests/fixtures/locate/fieldArgument.invalid.ts.expected.md new file mode 100644 index 00000000..45fbc7ba --- /dev/null +++ b/src/tests/fixtures/locate/fieldArgument.invalid.ts.expected.md @@ -0,0 +1,25 @@ +# locate/fieldArgument.invalid.ts + +## Input + +```ts title="locate/fieldArgument.invalid.ts" +// Locate: Query.greeting(salutation:) +/** @gqlType */ +type Query = unknown; + +/** @gqlQueryField */ +export function greeting(salutation: string): string { + return `${salutation}, world!`; +} +``` + +## Output + +### Error Report + +```text +src/tests/fixtures/locate/fieldArgument.invalid.ts:6:26 - error: Located here + +6 export function greeting(salutation: string): string { + ~~~~~~~~~~ +``` \ No newline at end of file diff --git a/src/tests/fixtures/locate/fieldOnScalar.invalid.ts.expected.md b/src/tests/fixtures/locate/fieldOnScalar.invalid.ts.expected.md index b142adad..f7164924 100644 --- a/src/tests/fixtures/locate/fieldOnScalar.invalid.ts.expected.md +++ b/src/tests/fixtures/locate/fieldOnScalar.invalid.ts.expected.md @@ -13,5 +13,5 @@ export type Date = string; ### Error Locating Type ```text -Cannot locate field `name` on type `Date`. Only object types, interfaces, and input objects have fields. +Invalid schema coordinate: `Date.name`. Expected "Date" to be an Enum, Input Object, Object or Interface type. ``` \ No newline at end of file diff --git a/src/tests/fixtures/locate/malformedEntitySyntax.invalid.ts.expected.md b/src/tests/fixtures/locate/malformedEntitySyntax.invalid.ts.expected.md index e03b62f8..f62e732b 100644 --- a/src/tests/fixtures/locate/malformedEntitySyntax.invalid.ts.expected.md +++ b/src/tests/fixtures/locate/malformedEntitySyntax.invalid.ts.expected.md @@ -16,5 +16,5 @@ type User = { ### Error Locating Type ```text -Invalid entity name: `User->name`. Expected `ParentType` or `ParentType.fieldName`. +Invalid schema coordinate: `User->name`. Syntax Error: Invalid character: "-". ``` \ No newline at end of file diff --git a/src/tests/fixtures/locate/notFoundField.invalid.ts.expected.md b/src/tests/fixtures/locate/notFoundField.invalid.ts.expected.md index f0f00d41..1a4dbf06 100644 --- a/src/tests/fixtures/locate/notFoundField.invalid.ts.expected.md +++ b/src/tests/fixtures/locate/notFoundField.invalid.ts.expected.md @@ -16,5 +16,5 @@ type User = { ### Error Locating Type ```text -Cannot locate field `not_a_field` on type `User`. +Could not resolve schema coordinate: `User.not_a_field`. ``` \ No newline at end of file diff --git a/src/tests/fixtures/locate/notFoundType.invalid.ts.expected.md b/src/tests/fixtures/locate/notFoundType.invalid.ts.expected.md index 540f8583..1bf7d120 100644 --- a/src/tests/fixtures/locate/notFoundType.invalid.ts.expected.md +++ b/src/tests/fixtures/locate/notFoundType.invalid.ts.expected.md @@ -16,5 +16,5 @@ type User = { ### Error Locating Type ```text -Cannot locate type `WhoopsNotARealType`. +Could not resolve schema coordinate: `WhoopsNotARealType`. ``` \ No newline at end of file diff --git a/src/tests/fixtures/resolver_context/FunctionWithContextValue.ts.expected.md b/src/tests/fixtures/resolver_context/FunctionWithContextValue.ts.expected.md index d93427ef..32638b53 100644 --- a/src/tests/fixtures/resolver_context/FunctionWithContextValue.ts.expected.md +++ b/src/tests/fixtures/resolver_context/FunctionWithContextValue.ts.expected.md @@ -31,7 +31,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as userGreetingResolver } from "./FunctionWithContextValue"; +import { greeting as userGreetingResolver } from "./FunctionWithContextValue.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/resolver_info/FunctionWithInfoValue.ts.expected.md b/src/tests/fixtures/resolver_info/FunctionWithInfoValue.ts.expected.md index 5a7a21c9..ce882b89 100644 --- a/src/tests/fixtures/resolver_info/FunctionWithInfoValue.ts.expected.md +++ b/src/tests/fixtures/resolver_info/FunctionWithInfoValue.ts.expected.md @@ -28,7 +28,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greetz as queryGreetzResolver } from "./FunctionWithInfoValue"; +import { greetz as queryGreetzResolver } from "./FunctionWithInfoValue.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/resolver_info/StaticMethodWithInfoValue.ts.expected.md b/src/tests/fixtures/resolver_info/StaticMethodWithInfoValue.ts.expected.md index 9b4504fc..ea24ccbe 100644 --- a/src/tests/fixtures/resolver_info/StaticMethodWithInfoValue.ts.expected.md +++ b/src/tests/fixtures/resolver_info/StaticMethodWithInfoValue.ts.expected.md @@ -38,7 +38,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { SomeType as queryGreetingResolver } from "./StaticMethodWithInfoValue"; +import { SomeType as queryGreetingResolver } from "./StaticMethodWithInfoValue.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/subscriptions/SubscriptionFunctionFieldWithAsyncIterable.ts.expected.md b/src/tests/fixtures/subscriptions/SubscriptionFunctionFieldWithAsyncIterable.ts.expected.md index 87ada08b..b822845d 100644 --- a/src/tests/fixtures/subscriptions/SubscriptionFunctionFieldWithAsyncIterable.ts.expected.md +++ b/src/tests/fixtures/subscriptions/SubscriptionFunctionFieldWithAsyncIterable.ts.expected.md @@ -55,7 +55,7 @@ type Subscription { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLString } from "graphql"; -import { greetings as subscriptionGreetingsResolver, greetingsMaybe as subscriptionGreetingsMaybeResolver, maybeGreetings as subscriptionMaybeGreetingsResolver, maybeGreetingsMaybe as subscriptionMaybeGreetingsMaybeResolver } from "./SubscriptionFunctionFieldWithAsyncIterable"; +import { greetings as subscriptionGreetingsResolver, greetingsMaybe as subscriptionGreetingsMaybeResolver, maybeGreetings as subscriptionMaybeGreetingsResolver, maybeGreetingsMaybe as subscriptionMaybeGreetingsMaybeResolver } from "./SubscriptionFunctionFieldWithAsyncIterable.js"; export function getSchema(): GraphQLSchema { const SubscriptionType: GraphQLObjectType = new GraphQLObjectType({ name: "Subscription", diff --git a/src/tests/fixtures/todo/userExample.ts.expected.md b/src/tests/fixtures/todo/userExample.ts.expected.md index c221f8e3..77ce3aa5 100644 --- a/src/tests/fixtures/todo/userExample.ts.expected.md +++ b/src/tests/fixtures/todo/userExample.ts.expected.md @@ -45,7 +45,7 @@ type User { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { fullName as userFullNameResolver, me as someTypeMeResolver } from "./userExample"; +import { fullName as userFullNameResolver, me as someTypeMeResolver } from "./userExample.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/fixtures/top_level_fields/queryField.ts.expected.md b/src/tests/fixtures/top_level_fields/queryField.ts.expected.md index 6d836fad..92a9a2d3 100644 --- a/src/tests/fixtures/top_level_fields/queryField.ts.expected.md +++ b/src/tests/fixtures/top_level_fields/queryField.ts.expected.md @@ -23,7 +23,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver } from "./queryField"; +import { greeting as queryGreetingResolver } from "./queryField.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/top_level_fields/queryFieldOnStaticMethod.ts.expected.md b/src/tests/fixtures/top_level_fields/queryFieldOnStaticMethod.ts.expected.md index 60c308a4..683d678f 100644 --- a/src/tests/fixtures/top_level_fields/queryFieldOnStaticMethod.ts.expected.md +++ b/src/tests/fixtures/top_level_fields/queryFieldOnStaticMethod.ts.expected.md @@ -25,7 +25,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { SomeNonGraphQLClass as queryGreetingResolver } from "./queryFieldOnStaticMethod"; +import { SomeNonGraphQLClass as queryGreetingResolver } from "./queryFieldOnStaticMethod.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/top_level_fields/queryFieldRenamed.ts.expected.md b/src/tests/fixtures/top_level_fields/queryFieldRenamed.ts.expected.md index be99e939..ff0d140c 100644 --- a/src/tests/fixtures/top_level_fields/queryFieldRenamed.ts.expected.md +++ b/src/tests/fixtures/top_level_fields/queryFieldRenamed.ts.expected.md @@ -23,7 +23,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greetz as queryGreetingResolver } from "./queryFieldRenamed"; +import { greetz as queryGreetingResolver } from "./queryFieldRenamed.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/top_level_fields/queryFieldWithExplicitlyDefinedQuery.ts.expected.md b/src/tests/fixtures/top_level_fields/queryFieldWithExplicitlyDefinedQuery.ts.expected.md index 66f8d8b6..338bb895 100644 --- a/src/tests/fixtures/top_level_fields/queryFieldWithExplicitlyDefinedQuery.ts.expected.md +++ b/src/tests/fixtures/top_level_fields/queryFieldWithExplicitlyDefinedQuery.ts.expected.md @@ -32,7 +32,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver } from "./queryFieldWithExplicitlyDefinedQuery"; +import { greeting as queryGreetingResolver } from "./queryFieldWithExplicitlyDefinedQuery.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/top_level_fields/rootFields.ts.expected.md b/src/tests/fixtures/top_level_fields/rootFields.ts.expected.md index ce806288..6142bec8 100644 --- a/src/tests/fixtures/top_level_fields/rootFields.ts.expected.md +++ b/src/tests/fixtures/top_level_fields/rootFields.ts.expected.md @@ -45,7 +45,7 @@ type Subscription { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLNonNull } from "graphql"; -import { greeting as queryGreetingResolver, deleteSomething as mutationDeleteSomethingResolver, range as subscriptionRangeResolver } from "./rootFields"; +import { greeting as queryGreetingResolver, deleteSomething as mutationDeleteSomethingResolver, range as subscriptionRangeResolver } from "./rootFields.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/fixtures/type_definitions_from_alias/AliasOfUnknownDefinesType.ts.expected.md b/src/tests/fixtures/type_definitions_from_alias/AliasOfUnknownDefinesType.ts.expected.md index c8d848a3..41ecab7a 100644 --- a/src/tests/fixtures/type_definitions_from_alias/AliasOfUnknownDefinesType.ts.expected.md +++ b/src/tests/fixtures/type_definitions_from_alias/AliasOfUnknownDefinesType.ts.expected.md @@ -26,7 +26,7 @@ type SomeType { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as someTypeGreetingResolver } from "./AliasOfUnknownDefinesType"; +import { greeting as someTypeGreetingResolver } from "./AliasOfUnknownDefinesType.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/fixtures/type_definitions_from_alias/QueryAsAliasOfUnknown.ts.expected.md b/src/tests/fixtures/type_definitions_from_alias/QueryAsAliasOfUnknown.ts.expected.md index eb275203..cb13bd7a 100644 --- a/src/tests/fixtures/type_definitions_from_alias/QueryAsAliasOfUnknown.ts.expected.md +++ b/src/tests/fixtures/type_definitions_from_alias/QueryAsAliasOfUnknown.ts.expected.md @@ -26,7 +26,7 @@ type Query { ```ts import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { foo as queryFooResolver } from "./QueryAsAliasOfUnknown"; +import { foo as queryFooResolver } from "./QueryAsAliasOfUnknown.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/aliasedMethod/schema.ts b/src/tests/integrationFixtures/aliasedMethod/schema.ts index 3ce67d42..fd5179d3 100644 --- a/src/tests/integrationFixtures/aliasedMethod/schema.ts +++ b/src/tests/integrationFixtures/aliasedMethod/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { someType as querySomeTypeResolver } from "./index"; +import { someType as querySomeTypeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ name: "SomeType", diff --git a/src/tests/integrationFixtures/complexDefaultInput/schema.ts b/src/tests/integrationFixtures/complexDefaultInput/schema.ts index 75984419..14bd0723 100644 --- a/src/tests/integrationFixtures/complexDefaultInput/schema.ts +++ b/src/tests/integrationFixtures/complexDefaultInput/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLInputObjectType } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const SomeObjType: GraphQLInputObjectType = new GraphQLInputObjectType({ name: "SomeObj", diff --git a/src/tests/integrationFixtures/complexPlurals/schema.ts b/src/tests/integrationFixtures/complexPlurals/schema.ts index 427df5e5..95051f06 100644 --- a/src/tests/integrationFixtures/complexPlurals/schema.ts +++ b/src/tests/integrationFixtures/complexPlurals/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLNonNull, GraphQLString } from "graphql"; -import { arrayOfArrayOfPromises as queryArrayOfArrayOfPromisesResolver, arrayOfPromises as queryArrayOfPromisesResolver, asyncIterableOfArrayOfPromises as queryAsyncIterableOfArrayOfPromisesResolver } from "./index"; +import { arrayOfArrayOfPromises as queryArrayOfArrayOfPromisesResolver, arrayOfPromises as queryArrayOfPromisesResolver, asyncIterableOfArrayOfPromises as queryAsyncIterableOfArrayOfPromisesResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/connectionExample/index.ts b/src/tests/integrationFixtures/connectionExample/index.ts index 71c59e13..1f1db4c0 100644 --- a/src/tests/integrationFixtures/connectionExample/index.ts +++ b/src/tests/integrationFixtures/connectionExample/index.ts @@ -1,4 +1,4 @@ -import { Int } from "../../../Types"; +import { Int } from "../../../Types.js"; /** @gqlQueryField */ export function firstHundredIntegers(args: { diff --git a/src/tests/integrationFixtures/connectionExample/index.ts.expected.md b/src/tests/integrationFixtures/connectionExample/index.ts.expected.md index b7a5239c..0da561eb 100644 --- a/src/tests/integrationFixtures/connectionExample/index.ts.expected.md +++ b/src/tests/integrationFixtures/connectionExample/index.ts.expected.md @@ -3,7 +3,7 @@ ## Input ```ts title="connectionExample/index.ts" -import { Int } from "../../../Types"; +import { Int } from "../../../Types.js"; /** @gqlQueryField */ export function firstHundredIntegers(args: { diff --git a/src/tests/integrationFixtures/connectionExample/schema.ts b/src/tests/integrationFixtures/connectionExample/schema.ts index 826845a5..5d044b22 100644 --- a/src/tests/integrationFixtures/connectionExample/schema.ts +++ b/src/tests/integrationFixtures/connectionExample/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLNonNull, GraphQLString, GraphQLInt, GraphQLBoolean } from "graphql"; -import { firstHundredIntegers as queryFirstHundredIntegersResolver } from "./index"; +import { firstHundredIntegers as queryFirstHundredIntegersResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const FirstHundredIntegersEdgeType: GraphQLObjectType = new GraphQLObjectType({ name: "FirstHundredIntegersEdge", diff --git a/src/tests/integrationFixtures/customScalarSerialization/index.ts b/src/tests/integrationFixtures/customScalarSerialization/index.ts index 0af029cd..3c592a51 100644 --- a/src/tests/integrationFixtures/customScalarSerialization/index.ts +++ b/src/tests/integrationFixtures/customScalarSerialization/index.ts @@ -1,4 +1,4 @@ -import type { SchemaConfig } from "./schema"; +import type { SchemaConfig } from "./schema.js"; /** @gqlScalar */ export type CustomScalar = number; diff --git a/src/tests/integrationFixtures/customScalarSerialization/index.ts.expected.md b/src/tests/integrationFixtures/customScalarSerialization/index.ts.expected.md index b46fd56b..e50c155e 100644 --- a/src/tests/integrationFixtures/customScalarSerialization/index.ts.expected.md +++ b/src/tests/integrationFixtures/customScalarSerialization/index.ts.expected.md @@ -3,7 +3,7 @@ ## Input ```ts title="customScalarSerialization/index.ts" -import type { SchemaConfig } from "./schema"; +import type { SchemaConfig } from "./schema.js"; /** @gqlScalar */ export type CustomScalar = number; diff --git a/src/tests/integrationFixtures/customScalarSerialization/schema.ts b/src/tests/integrationFixtures/customScalarSerialization/schema.ts index 2b07240a..9a5a0096 100644 --- a/src/tests/integrationFixtures/customScalarSerialization/schema.ts +++ b/src/tests/integrationFixtures/customScalarSerialization/schema.ts @@ -1,5 +1,5 @@ import type { GqlScalar } from "grats"; -import { type CustomScalar as CustomScalarInternal, hello as queryHelloResolver } from "./index"; +import { type CustomScalar as CustomScalarInternal, hello as queryHelloResolver } from "./index.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLScalarType, GraphQLNonNull } from "graphql"; export type SchemaConfig = { scalars: { diff --git a/src/tests/integrationFixtures/deprecated/schema.ts b/src/tests/integrationFixtures/deprecated/schema.ts index 32ebbfc8..950a052f 100644 --- a/src/tests/integrationFixtures/deprecated/schema.ts +++ b/src/tests/integrationFixtures/deprecated/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { goodBye as queryGoodByeResolver, hello as queryHelloResolver } from "./index"; +import { goodBye as queryGoodByeResolver, hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/derivedContext/schema.ts b/src/tests/integrationFixtures/derivedContext/schema.ts index e569ba06..5c22045e 100644 --- a/src/tests/integrationFixtures/derivedContext/schema.ts +++ b/src/tests/integrationFixtures/derivedContext/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { hello as queryHelloResolver, derived } from "./index"; +import { hello as queryHelloResolver, derived } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/derivedContextAsync/schema.ts b/src/tests/integrationFixtures/derivedContextAsync/schema.ts index 44e8071b..160bd129 100644 --- a/src/tests/integrationFixtures/derivedContextAsync/schema.ts +++ b/src/tests/integrationFixtures/derivedContextAsync/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { derived, User as queryCurrentUserResolver, hello as queryHelloResolver, user as queryUserResolver } from "./index"; +import { derived, User as queryCurrentUserResolver, hello as queryHelloResolver, user as queryUserResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/integrationFixtures/enumDefault/schema.ts b/src/tests/integrationFixtures/enumDefault/schema.ts index 1e438ef0..c7d6a739 100644 --- a/src/tests/integrationFixtures/enumDefault/schema.ts +++ b/src/tests/integrationFixtures/enumDefault/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/integrationFixtures/enumExport/enums.ts b/src/tests/integrationFixtures/enumExport/enums.ts index a1ba037b..2cfb6a11 100644 --- a/src/tests/integrationFixtures/enumExport/enums.ts +++ b/src/tests/integrationFixtures/enumExport/enums.ts @@ -3,7 +3,7 @@ * Do not manually edit. Regenerate by running `npx grats`. */ -import { Color as ColorEnum, Priority as PriorityEnum } from "./index"; +import { Color as ColorEnum, Priority as PriorityEnum } from "./index.js"; export const enums = { Color: ColorEnum, Priority: PriorityEnum diff --git a/src/tests/integrationFixtures/enumExport/schema.ts b/src/tests/integrationFixtures/enumExport/schema.ts index 04ebf080..702da93f 100644 --- a/src/tests/integrationFixtures/enumExport/schema.ts +++ b/src/tests/integrationFixtures/enumExport/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType } from "graphql"; -import { colorName as queryColorNameResolver, currentPriority as queryCurrentPriorityResolver, favoriteColor as queryFavoriteColorResolver } from "./index"; +import { colorName as queryColorNameResolver, currentPriority as queryCurrentPriorityResolver, favoriteColor as queryFavoriteColorResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const ColorType: GraphQLEnumType = new GraphQLEnumType({ name: "Color", diff --git a/src/tests/integrationFixtures/explicitNullPassedToArgWithDefault/schema.ts b/src/tests/integrationFixtures/explicitNullPassedToArgWithDefault/schema.ts index 4c389c46..7a631589 100644 --- a/src/tests/integrationFixtures/explicitNullPassedToArgWithDefault/schema.ts +++ b/src/tests/integrationFixtures/explicitNullPassedToArgWithDefault/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/functionField/schema.ts b/src/tests/integrationFixtures/functionField/schema.ts index 8f5023f1..fbeeee1d 100644 --- a/src/tests/integrationFixtures/functionField/schema.ts +++ b/src/tests/integrationFixtures/functionField/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/functionFieldRenamed/schema.ts b/src/tests/integrationFixtures/functionFieldRenamed/schema.ts index bd020a71..76c9322a 100644 --- a/src/tests/integrationFixtures/functionFieldRenamed/schema.ts +++ b/src/tests/integrationFixtures/functionFieldRenamed/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { notHello as queryHelloResolver } from "./index"; +import { notHello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/getAcessor/schema.ts b/src/tests/integrationFixtures/getAcessor/schema.ts index 876c0d4b..1d879970 100644 --- a/src/tests/integrationFixtures/getAcessor/schema.ts +++ b/src/tests/integrationFixtures/getAcessor/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { me as queryMeResolver } from "./index"; +import { me as queryMeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/integrationFixtures/inputTypeOneOf/index.ts b/src/tests/integrationFixtures/inputTypeOneOf/index.ts index c22f9570..ba4bf238 100644 --- a/src/tests/integrationFixtures/inputTypeOneOf/index.ts +++ b/src/tests/integrationFixtures/inputTypeOneOf/index.ts @@ -1,4 +1,4 @@ -import { ID } from "../../.."; +import { ID } from "../../../Types.js"; /** @gqlInput */ type UserPayload = { diff --git a/src/tests/integrationFixtures/inputTypeOneOf/index.ts.expected.md b/src/tests/integrationFixtures/inputTypeOneOf/index.ts.expected.md index acce951e..aa75b1d5 100644 --- a/src/tests/integrationFixtures/inputTypeOneOf/index.ts.expected.md +++ b/src/tests/integrationFixtures/inputTypeOneOf/index.ts.expected.md @@ -3,7 +3,7 @@ ## Input ```ts title="inputTypeOneOf/index.ts" -import { ID } from "../../.."; +import { ID } from "../../../Types.js"; /** @gqlInput */ type UserPayload = { diff --git a/src/tests/integrationFixtures/inputTypeOneOf/schema.ts b/src/tests/integrationFixtures/inputTypeOneOf/schema.ts index a1fbb818..c7139465 100644 --- a/src/tests/integrationFixtures/inputTypeOneOf/schema.ts +++ b/src/tests/integrationFixtures/inputTypeOneOf/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLInputObjectType, GraphQLID } from "graphql"; -import { greet as queryGreetResolver } from "./index"; +import { greet as queryGreetResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserPayloadType: GraphQLInputObjectType = new GraphQLInputObjectType({ name: "UserPayload", diff --git a/src/tests/integrationFixtures/killsParentOnException/schema.ts b/src/tests/integrationFixtures/killsParentOnException/schema.ts index 865fa985..2e8e0ef7 100644 --- a/src/tests/integrationFixtures/killsParentOnException/schema.ts +++ b/src/tests/integrationFixtures/killsParentOnException/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLString } from "graphql"; -import { me as queryMeResolver } from "./index"; +import { me as queryMeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/integrationFixtures/killsParentOnExceptionOnQuery/schema.ts b/src/tests/integrationFixtures/killsParentOnExceptionOnQuery/schema.ts index 32856bb2..e7f11645 100644 --- a/src/tests/integrationFixtures/killsParentOnExceptionOnQuery/schema.ts +++ b/src/tests/integrationFixtures/killsParentOnExceptionOnQuery/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLString } from "graphql"; -import { alwaysThrowsKillsParentOnException as queryAlwaysThrowsKillsParentOnExceptionResolver, hello as queryHelloResolver } from "./index"; +import { alwaysThrowsKillsParentOnException as queryAlwaysThrowsKillsParentOnExceptionResolver, hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/killsParentOnExceptionReturnsNull/schema.ts b/src/tests/integrationFixtures/killsParentOnExceptionReturnsNull/schema.ts index 865fa985..2e8e0ef7 100644 --- a/src/tests/integrationFixtures/killsParentOnExceptionReturnsNull/schema.ts +++ b/src/tests/integrationFixtures/killsParentOnExceptionReturnsNull/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLNonNull, GraphQLString } from "graphql"; -import { me as queryMeResolver } from "./index"; +import { me as queryMeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/integrationFixtures/nonNullArgWithDefault/schema.ts b/src/tests/integrationFixtures/nonNullArgWithDefault/schema.ts index 61558fa9..15fd4a35 100644 --- a/src/tests/integrationFixtures/nonNullArgWithDefault/schema.ts +++ b/src/tests/integrationFixtures/nonNullArgWithDefault/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/nonNullEnumDefault/schema.ts b/src/tests/integrationFixtures/nonNullEnumDefault/schema.ts index 81aef994..f3c3706c 100644 --- a/src/tests/integrationFixtures/nonNullEnumDefault/schema.ts +++ b/src/tests/integrationFixtures/nonNullEnumDefault/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const GreetingOptionsType: GraphQLEnumType = new GraphQLEnumType({ name: "GreetingOptions", diff --git a/src/tests/integrationFixtures/nonNullableListIncludesNull/schema.ts b/src/tests/integrationFixtures/nonNullableListIncludesNull/schema.ts index b2f5570c..9f311f14 100644 --- a/src/tests/integrationFixtures/nonNullableListIncludesNull/schema.ts +++ b/src/tests/integrationFixtures/nonNullableListIncludesNull/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLNonNull, GraphQLString } from "graphql"; -import { someList as querySomeListResolver, someListOfLists as querySomeListOfListsResolver } from "./index"; +import { someList as querySomeListResolver, someListOfLists as querySomeListOfListsResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/numericID/index.ts b/src/tests/integrationFixtures/numericID/index.ts index 11c29e11..7b216dd4 100644 --- a/src/tests/integrationFixtures/numericID/index.ts +++ b/src/tests/integrationFixtures/numericID/index.ts @@ -1,4 +1,4 @@ -import { ID } from "../../../Types"; +import { ID } from "../../../Types.js"; /** * Validating that graphql-js will coerce a numeric ID to a string. diff --git a/src/tests/integrationFixtures/numericID/index.ts.expected.md b/src/tests/integrationFixtures/numericID/index.ts.expected.md index a4f11feb..ecd1efe2 100644 --- a/src/tests/integrationFixtures/numericID/index.ts.expected.md +++ b/src/tests/integrationFixtures/numericID/index.ts.expected.md @@ -3,7 +3,7 @@ ## Input ```ts title="numericID/index.ts" -import { ID } from "../../../Types"; +import { ID } from "../../../Types.js"; /** * Validating that graphql-js will coerce a numeric ID to a string. diff --git a/src/tests/integrationFixtures/numericID/schema.ts b/src/tests/integrationFixtures/numericID/schema.ts index feef4b50..3675efd9 100644 --- a/src/tests/integrationFixtures/numericID/schema.ts +++ b/src/tests/integrationFixtures/numericID/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLID } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/parameterPropertyRenamed/schema.ts b/src/tests/integrationFixtures/parameterPropertyRenamed/schema.ts index d5eb003a..4f45014c 100644 --- a/src/tests/integrationFixtures/parameterPropertyRenamed/schema.ts +++ b/src/tests/integrationFixtures/parameterPropertyRenamed/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { me as queryMeResolver } from "./index"; +import { me as queryMeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const UserType: GraphQLObjectType = new GraphQLObjectType({ name: "User", diff --git a/src/tests/integrationFixtures/positionalNonNullArgWithDefault/schema.ts b/src/tests/integrationFixtures/positionalNonNullArgWithDefault/schema.ts index 16ebb076..a6dd7fa4 100644 --- a/src/tests/integrationFixtures/positionalNonNullArgWithDefault/schema.ts +++ b/src/tests/integrationFixtures/positionalNonNullArgWithDefault/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLNonNull } from "graphql"; -import { hello as queryHelloResolver } from "./index"; +import { hello as queryHelloResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/promiseOfPromise/schema.ts b/src/tests/integrationFixtures/promiseOfPromise/schema.ts index 529efcde..aad551ef 100644 --- a/src/tests/integrationFixtures/promiseOfPromise/schema.ts +++ b/src/tests/integrationFixtures/promiseOfPromise/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { promiseOfPromise as queryPromiseOfPromiseResolver, promiseOfPromisePromise as queryPromiseOfPromisePromiseResolver } from "./index"; +import { promiseOfPromise as queryPromiseOfPromiseResolver, promiseOfPromisePromise as queryPromiseOfPromisePromiseResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/resolveTypeViaClass/index.ts b/src/tests/integrationFixtures/resolveTypeViaClass/index.ts index e5f7fc59..62325986 100644 --- a/src/tests/integrationFixtures/resolveTypeViaClass/index.ts +++ b/src/tests/integrationFixtures/resolveTypeViaClass/index.ts @@ -1,4 +1,4 @@ -import { ID } from "../../../Types"; +import { ID } from "../../../Types.js"; /** @gqlInterface */ interface GqlNode { diff --git a/src/tests/integrationFixtures/resolveTypeViaClass/index.ts.expected.md b/src/tests/integrationFixtures/resolveTypeViaClass/index.ts.expected.md index eec96fb9..040cb61f 100644 --- a/src/tests/integrationFixtures/resolveTypeViaClass/index.ts.expected.md +++ b/src/tests/integrationFixtures/resolveTypeViaClass/index.ts.expected.md @@ -3,7 +3,7 @@ ## Input ```ts title="resolveTypeViaClass/index.ts" -import { ID } from "../../../Types"; +import { ID } from "../../../Types.js"; /** @gqlInterface */ interface GqlNode { diff --git a/src/tests/integrationFixtures/resolveTypeViaClass/schema.ts b/src/tests/integrationFixtures/resolveTypeViaClass/schema.ts index 745b0fe0..0e486ce2 100644 --- a/src/tests/integrationFixtures/resolveTypeViaClass/schema.ts +++ b/src/tests/integrationFixtures/resolveTypeViaClass/schema.ts @@ -1,6 +1,6 @@ -import DefaultNodeClass from "./index"; +import DefaultNodeClass from "./index.js"; import { GraphQLSchema, GraphQLObjectType, GraphQLInterfaceType, GraphQLID, GraphQLNonNull } from "graphql"; -import { Guest as GuestClass, ThisNameGetsIgnored as RenamedNodeClass, User as UserClass, node as queryNodeResolver } from "./index"; +import { Guest as GuestClass, ThisNameGetsIgnored as RenamedNodeClass, User as UserClass, node as queryNodeResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const GqlNodeType: GraphQLInterfaceType = new GraphQLInterfaceType({ name: "GqlNode", diff --git a/src/tests/integrationFixtures/resolverErrorElidedToNull/schema.ts b/src/tests/integrationFixtures/resolverErrorElidedToNull/schema.ts index 3fb437da..3edc4e6e 100644 --- a/src/tests/integrationFixtures/resolverErrorElidedToNull/schema.ts +++ b/src/tests/integrationFixtures/resolverErrorElidedToNull/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; -import { alwaysThrows as queryAlwaysThrowsResolver } from "./index"; +import { alwaysThrows as queryAlwaysThrowsResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/skipInclude/schema.ts b/src/tests/integrationFixtures/skipInclude/schema.ts index 220cec17..92da08c8 100644 --- a/src/tests/integrationFixtures/skipInclude/schema.ts +++ b/src/tests/integrationFixtures/skipInclude/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLDirective, DirectiveLocation, specifiedDirectives, GraphQLObjectType, GraphQLString } from "graphql"; -import { greeting as queryGreetingResolver } from "./index"; +import { greeting as queryGreetingResolver } from "./index.js"; export function getSchema(): GraphQLSchema { const QueryType: GraphQLObjectType = new GraphQLObjectType({ name: "Query", diff --git a/src/tests/integrationFixtures/strictSemanticNullability/schema.ts b/src/tests/integrationFixtures/strictSemanticNullability/schema.ts index b57d75f7..c5c2b028 100644 --- a/src/tests/integrationFixtures/strictSemanticNullability/schema.ts +++ b/src/tests/integrationFixtures/strictSemanticNullability/schema.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLList, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLString, defaultFieldResolver, GraphQLInterfaceType } from "graphql"; -import { actuallyReturnsAsyncNull as queryActuallyReturnsAsyncNullResolver, actuallyReturnsNull as queryActuallyReturnsNullResolver, me as queryMeResolver, names as subscriptionNamesResolver } from "./index"; +import { actuallyReturnsAsyncNull as queryActuallyReturnsAsyncNullResolver, actuallyReturnsNull as queryActuallyReturnsNullResolver, me as queryMeResolver, names as subscriptionNamesResolver } from "./index.js"; async function assertNonNull(value: T | Promise): Promise { const awaited = await value; if (awaited == null) diff --git a/src/tests/test.ts b/src/tests/test.ts index 367f2a8c..c70fd475 100644 --- a/src/tests/test.ts +++ b/src/tests/test.ts @@ -1,9 +1,10 @@ import * as path from "path"; -import TestRunner, { Transformer, TransformerResult } from "./TestRunner"; +import { fileURLToPath } from "url"; +import TestRunner, { Transformer, TransformerResult } from "./TestRunner.js"; import { buildSchemaAndDocResult, buildSchemaAndDocResultWithHost, -} from "../lib"; +} from "../lib.js"; import * as ts from "typescript"; import { buildASTSchema, @@ -14,25 +15,25 @@ import { specifiedScalarTypes, } from "graphql"; import { Command } from "commander"; -import { locate } from "../Locate"; -import { gqlErr, ReportableDiagnostics } from "../utils/DiagnosticError"; +import { locate } from "../Locate.js"; +import { gqlErr, ReportableDiagnostics } from "../utils/DiagnosticError.js"; import { readFileSync, writeFileSync } from "fs"; -import { codegen } from "../codegen/schemaCodegen"; -import { printEnumsModule } from "../printSchema"; +import { codegen } from "../codegen/schemaCodegen.js"; +import { printEnumsModule } from "../printSchema.js"; import { diff } from "jest-diff"; import * as semver from "semver"; import { GratsConfig, ParsedCommandLineGrats, validateGratsOptions, -} from "../gratsConfig"; -import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives"; -import { applySDLHeader, applyTypeScriptHeader } from "../printSchema"; -import { extend } from "../utils/helpers"; -import { Result, ok, err } from "../utils/Result"; -import { applyFixes } from "../fixFixable"; -import { writeTypeScriptTypeToDisk } from "../../scripts/buildConfigTypes"; -import { Markdown } from "./Markdown"; +} from "../gratsConfig.js"; +import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives.js"; +import { applySDLHeader, applyTypeScriptHeader } from "../printSchema.js"; +import { extend } from "../utils/helpers.js"; +import { Result, ok, err } from "../utils/Result.js"; +import { applyFixes } from "../fixFixable.js"; +import { writeTypeScriptTypeToDisk } from "../../scripts/buildConfigTypes.js"; +import { Markdown } from "./Markdown.js"; writeTypeScriptTypeToDisk(); @@ -76,6 +77,9 @@ program } }); +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + const gratsDir = path.join(__dirname, "../.."); const fixturesDir = path.join(__dirname, "fixtures"); const configFixturesDir = path.join(__dirname, "configParserFixtures"); diff --git a/src/transforms/addImplicitRootTypes.ts b/src/transforms/addImplicitRootTypes.ts index ee1161c4..0c8d5162 100644 --- a/src/transforms/addImplicitRootTypes.ts +++ b/src/transforms/addImplicitRootTypes.ts @@ -5,9 +5,9 @@ import { NameNode, ObjectTypeDefinitionNode, } from "graphql"; -import { OPERATION_TYPES } from "../Extractor"; -import { nullThrows, TsIdentifier } from "../utils/helpers"; -import { visitDefinitions } from "../utils/visitor"; +import { OPERATION_TYPES } from "../Extractor.js"; +import { nullThrows, TsIdentifier } from "../utils/helpers.js"; +import { visitDefinitions } from "../utils/visitor.js"; /** * Ensure any root types which have been extended with `@gqlQueryField` and diff --git a/src/transforms/addInterfaceFields.ts b/src/transforms/addInterfaceFields.ts index b2ecd37c..831f5d9b 100644 --- a/src/transforms/addInterfaceFields.ts +++ b/src/transforms/addInterfaceFields.ts @@ -1,17 +1,17 @@ -import * as E from "../Errors"; +import * as E from "../Errors.js"; import * as ts from "typescript"; import { DefinitionNode, Kind, ObjectTypeExtensionNode } from "graphql"; -import { TypeContext } from "../TypeContext"; +import { TypeContext } from "../TypeContext.js"; import { DiagnosticResult, DiagnosticsResult, gqlErr, gqlRelated, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import { InterfaceMap, computeInterfaceMap } from "../InterfaceGraph"; -import { extend, nullThrows, uniqueId } from "../utils/helpers"; -import { FIELD_TAG } from "../Extractor"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import { InterfaceMap, computeInterfaceMap } from "../InterfaceGraph.js"; +import { extend, nullThrows, uniqueId } from "../utils/helpers.js"; +import { FIELD_TAG } from "../Extractor.js"; /** * Grats allows you to define GraphQL fields on TypeScript interfaces using diff --git a/src/transforms/applyDefaultNullability.ts b/src/transforms/applyDefaultNullability.ts index d8faf227..815f549d 100644 --- a/src/transforms/applyDefaultNullability.ts +++ b/src/transforms/applyDefaultNullability.ts @@ -1,15 +1,15 @@ import { DocumentNode, Kind, visit } from "graphql"; -import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; +import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; import * as ts from "typescript"; -import * as E from "../Errors"; +import * as E from "../Errors.js"; import { addSemanticNonNullDirective, makeSemanticNonNullDirective, -} from "../publicDirectives"; -import { GraphQLConstructor } from "../GraphQLConstructor"; -import { GratsConfig } from "../gratsConfig"; -import { nullThrows } from "../utils/helpers"; +} from "../publicDirectives.js"; +import { GraphQLConstructor } from "../GraphQLConstructor.js"; +import { GratsConfig } from "../gratsConfig.js"; +import { nullThrows } from "../utils/helpers.js"; /** * Grats has options to make all fields nullable by default to conform to diff --git a/src/transforms/filterNonGqlInterfaces.ts b/src/transforms/filterNonGqlInterfaces.ts index b0047674..1a63b4c4 100644 --- a/src/transforms/filterNonGqlInterfaces.ts +++ b/src/transforms/filterNonGqlInterfaces.ts @@ -1,5 +1,5 @@ import { DefinitionNode, Kind, NamedTypeNode } from "graphql"; -import { TypeContext } from "../TypeContext"; +import { TypeContext } from "../TypeContext.js"; type InterfaceHaver = { readonly interfaces?: ReadonlyArray; diff --git a/src/transforms/makeResolverSignature.ts b/src/transforms/makeResolverSignature.ts index 8a215e13..7ecd3f60 100644 --- a/src/transforms/makeResolverSignature.ts +++ b/src/transforms/makeResolverSignature.ts @@ -5,9 +5,9 @@ import { Metadata, FieldDefinition, ContextArgs, -} from "../metadata"; -import { invariant, nullThrows } from "../utils/helpers"; -import { ResolverArgument as DirectiveResolverArgument } from "../resolverSignature"; +} from "../metadata.js"; +import { invariant, nullThrows } from "../utils/helpers.js"; +import { ResolverArgument as DirectiveResolverArgument } from "../resolverSignature.js"; export function makeResolverSignature(documentAst: DocumentNode): Metadata { const resolvers: Metadata = { diff --git a/src/transforms/mergeExtensions.ts b/src/transforms/mergeExtensions.ts index 1b801078..a2f06d31 100644 --- a/src/transforms/mergeExtensions.ts +++ b/src/transforms/mergeExtensions.ts @@ -1,6 +1,6 @@ import { DocumentNode, FieldDefinitionNode } from "graphql"; -import { extend } from "../utils/helpers"; -import { mapDefinitions } from "../utils/visitor"; +import { extend } from "../utils/helpers.js"; +import { mapDefinitions } from "../utils/visitor.js"; /** * Takes every example of `extend type Foo` and `extend interface Foo` and diff --git a/src/transforms/resolveResolverParams.ts b/src/transforms/resolveResolverParams.ts index f4e31346..37b929e5 100644 --- a/src/transforms/resolveResolverParams.ts +++ b/src/transforms/resolveResolverParams.ts @@ -10,25 +10,25 @@ import { DerivedResolverDefinition, ITypeContext, UNRESOLVED_REFERENCE_NAME, -} from "../TypeContext"; -import { err, ok } from "../utils/Result"; +} from "../TypeContext.js"; +import { err, ok } from "../utils/Result.js"; import { DiagnosticsResult, FixableDiagnosticWithLocation, gqlErr, tsErr, tsRelated, -} from "../utils/DiagnosticError"; -import { invariant, nullThrows } from "../utils/helpers"; +} from "../utils/DiagnosticError.js"; +import { invariant, nullThrows } from "../utils/helpers.js"; import { ContextResolverArgument, DerivedContextResolverArgument, NamedResolverArgument, ResolverArgument, UnresolvedResolverArgument, -} from "../resolverSignature"; -import * as E from "../Errors"; -import { GraphQLConstructor } from "../GraphQLConstructor"; +} from "../resolverSignature.js"; +import * as E from "../Errors.js"; +import { GraphQLConstructor } from "../GraphQLConstructor.js"; export function resolveResolverParams( ctx: ITypeContext, diff --git a/src/transforms/resolveTypes.ts b/src/transforms/resolveTypes.ts index 623a528a..abdab57c 100644 --- a/src/transforms/resolveTypes.ts +++ b/src/transforms/resolveTypes.ts @@ -12,19 +12,19 @@ import { UnionTypeDefinitionNode, visit, } from "graphql"; -import { loc } from "../GraphQLConstructor"; -import { TypeContext } from "../TypeContext"; +import { loc } from "../GraphQLConstructor.js"; +import { TypeContext } from "../TypeContext.js"; import * as ts from "typescript"; -import { err, ok } from "../utils/Result"; +import { err, ok } from "../utils/Result.js"; import { DiagnosticResult, DiagnosticsResult, TsLocatableNode, gqlErr, tsErr, -} from "../utils/DiagnosticError"; -import { extend, invariant, nullThrows } from "../utils/helpers"; -import * as E from "../Errors"; +} from "../utils/DiagnosticError.js"; +import { extend, invariant, nullThrows } from "../utils/helpers.js"; +import * as E from "../Errors.js"; type Template = { declarationTemplate: TypeDefinitionNode; diff --git a/src/transforms/snapshotsFromProgram.ts b/src/transforms/snapshotsFromProgram.ts index a5c6f85f..b61b03ff 100644 --- a/src/transforms/snapshotsFromProgram.ts +++ b/src/transforms/snapshotsFromProgram.ts @@ -1,10 +1,10 @@ import * as ts from "typescript"; -import { ParsedCommandLineGrats } from "../gratsConfig"; -import { ExtractionSnapshot, extract } from "../Extractor"; -import { DiagnosticsWithoutLocationResult } from "../utils/DiagnosticError"; -import { collectResults } from "../utils/Result"; -import { err } from "../utils/Result"; -import { extend } from "../utils/helpers"; +import { ParsedCommandLineGrats } from "../gratsConfig.js"; +import { ExtractionSnapshot, extract } from "../Extractor.js"; +import { DiagnosticsWithoutLocationResult } from "../utils/DiagnosticError.js"; +import { collectResults } from "../utils/Result.js"; +import { err } from "../utils/Result.js"; +import { extend } from "../utils/helpers.js"; const TAG_REGEX = /@(gql)|(killsParentOnException)/i; diff --git a/src/transforms/sortSchemaAst.ts b/src/transforms/sortSchemaAst.ts index 265163fb..f79c0af6 100644 --- a/src/transforms/sortSchemaAst.ts +++ b/src/transforms/sortSchemaAst.ts @@ -1,5 +1,5 @@ import { DefinitionNode, DocumentNode, Kind, NameNode, visit } from "graphql"; -import { naturalCompare } from "../utils/naturalCompare"; +import { naturalCompare } from "../utils/naturalCompare.js"; /* * Similar to lexicographicSortSchema from graphql-js but applied against an AST diff --git a/src/tsPlugin/initTsPlugin.ts b/src/tsPlugin/initTsPlugin.ts index a691f6a4..4e8088f5 100644 --- a/src/tsPlugin/initTsPlugin.ts +++ b/src/tsPlugin/initTsPlugin.ts @@ -1,8 +1,9 @@ import { version as gratsTsVersion } from "typescript"; +// @ts-ignore — typescript/lib/tsserverlibrary is the standard entry point for TS plugins import type * as TS from "typescript/lib/tsserverlibrary"; -import { extract } from "../Extractor"; -import { FAKE_ERROR_CODE } from "../utils/DiagnosticError"; -import { nullThrows } from "../utils/helpers"; +import { extract } from "../Extractor.js"; +import { FAKE_ERROR_CODE } from "../utils/DiagnosticError.js"; +import { nullThrows } from "../utils/helpers.js"; // An experimental plugin for TypeScript that adds a new language service // which reports diagnostics for the current file. Currently it only reports @@ -23,7 +24,7 @@ export function initTsPlugin(modules: { typescript: typeof TS }) { keyof TS.LanguageService >) { const x = info.languageService[k]; - // @ts-expect-error + // @ts-ignore — dynamic proxy setup proxy[k] = (...args: Array) => x.apply(info.languageService, args); } diff --git a/src/utils/DiagnosticError.ts b/src/utils/DiagnosticError.ts index 39472662..c5cc7567 100644 --- a/src/utils/DiagnosticError.ts +++ b/src/utils/DiagnosticError.ts @@ -1,6 +1,6 @@ import { GraphQLError, Location, Source } from "graphql"; import * as ts from "typescript"; -import { Result } from "./Result"; +import { Result } from "./Result.js"; export type FixableDiagnostic = ts.Diagnostic & { fix?: ts.CodeFixAction; diff --git a/src/utils/Result.ts b/src/utils/Result.ts index 9d205649..63fa6d1e 100644 --- a/src/utils/Result.ts +++ b/src/utils/Result.ts @@ -1,5 +1,5 @@ import * as ts from "typescript"; -import { DiagnosticsResult } from "./DiagnosticError"; +import { DiagnosticsResult } from "./DiagnosticError.js"; export type Result = Ok | Err; diff --git a/src/validations/customSpecValidations.ts b/src/validations/customSpecValidations.ts index a9b8fece..dacc1f1a 100644 --- a/src/validations/customSpecValidations.ts +++ b/src/validations/customSpecValidations.ts @@ -1,8 +1,8 @@ import { DocumentNode, Kind } from "graphql"; -import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError"; -import { ok } from "../utils/Result"; +import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError.js"; +import { ok } from "../utils/Result.js"; import { DiagnosticWithLocation } from "typescript"; -import * as E from "../Errors"; +import * as E from "../Errors.js"; /** * Grats depends upon graphql-js for implementing spec-compliant GraphQL schema diff --git a/src/validations/validateAsyncIterable.ts b/src/validations/validateAsyncIterable.ts index caa1c762..df32e216 100644 --- a/src/validations/validateAsyncIterable.ts +++ b/src/validations/validateAsyncIterable.ts @@ -10,9 +10,9 @@ import { TypeNode, visit, } from "graphql"; -import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import * as E from "../Errors"; +import { DiagnosticsResult, gqlErr } from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import * as E from "../Errors.js"; /** * Ensure that all fields on `Subscription` return an AsyncIterable and transform diff --git a/src/validations/validateDirectiveArguments.ts b/src/validations/validateDirectiveArguments.ts index cbec4518..a7cdffc7 100644 --- a/src/validations/validateDirectiveArguments.ts +++ b/src/validations/validateDirectiveArguments.ts @@ -15,9 +15,9 @@ import { DiagnosticsWithoutLocationResult, gqlErr, gqlRelated, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import { nullThrows } from "../utils/helpers"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import { nullThrows } from "../utils/helpers.js"; /** * Surprisingly, the GraphQL spec (and therefore graphql-js) does not enforce diff --git a/src/validations/validateDuplicateContextOrInfo.ts b/src/validations/validateDuplicateContextOrInfo.ts index f0dac5e5..17aa20e6 100644 --- a/src/validations/validateDuplicateContextOrInfo.ts +++ b/src/validations/validateDuplicateContextOrInfo.ts @@ -1,12 +1,12 @@ -import { DeclarationDefinition, NameDefinition } from "../TypeContext"; -import { err, ok } from "../utils/Result"; +import { DeclarationDefinition, NameDefinition } from "../TypeContext.js"; +import { err, ok } from "../utils/Result.js"; import { DiagnosticsResult, FixableDiagnosticWithLocation, gqlErr, gqlRelated, -} from "../utils/DiagnosticError"; -import * as E from "../Errors"; +} from "../utils/DiagnosticError.js"; +import * as E from "../Errors.js"; export function validateDuplicateContextOrInfo( definitions: Iterable, diff --git a/src/validations/validateMergedInterfaces.ts b/src/validations/validateMergedInterfaces.ts index 08630d9c..0e315fc9 100644 --- a/src/validations/validateMergedInterfaces.ts +++ b/src/validations/validateMergedInterfaces.ts @@ -1,11 +1,11 @@ import * as ts from "typescript"; -import * as E from "../Errors"; +import * as E from "../Errors.js"; import { DiagnosticsWithoutLocationResult, tsErr, tsRelated, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; /** * Prevent using merged interfaces as GraphQL interfaces. diff --git a/src/validations/validateSemanticNullability.ts b/src/validations/validateSemanticNullability.ts index de126343..36a52718 100644 --- a/src/validations/validateSemanticNullability.ts +++ b/src/validations/validateSemanticNullability.ts @@ -9,11 +9,11 @@ import { DiagnosticsWithoutLocationResult, gqlErr, gqlRelated, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import { GratsConfig } from "../gratsConfig"; -import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives"; -import { astNode } from "../utils/helpers"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import { GratsConfig } from "../gratsConfig.js"; +import { SEMANTIC_NON_NULL_DIRECTIVE } from "../publicDirectives.js"; +import { astNode } from "../utils/helpers.js"; /** * Ensure that all semantically non-nullable fields on an interface are also diff --git a/src/validations/validateSomeTypesAreDefined.ts b/src/validations/validateSomeTypesAreDefined.ts index 112ab4b7..570ede3c 100644 --- a/src/validations/validateSomeTypesAreDefined.ts +++ b/src/validations/validateSomeTypesAreDefined.ts @@ -2,9 +2,9 @@ import { GraphQLNamedType, GraphQLSchema } from "graphql"; import { DiagnosticsWithoutLocationResult, locationlessErr, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import * as E from "../Errors"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import * as E from "../Errors.js"; /** * We want to support a "getting started" experience where users can run `npx diff --git a/src/validations/validateTypenames.ts b/src/validations/validateTypenames.ts index 87efedc8..3955b0a5 100644 --- a/src/validations/validateTypenames.ts +++ b/src/validations/validateTypenames.ts @@ -1,19 +1,19 @@ import * as ts from "typescript"; import { - GraphQLInterfaceType, GraphQLSchema, Kind, isAbstractType, + isInterfaceType, isType, } from "graphql"; import { DiagnosticsWithoutLocationResult, gqlErr, gqlRelated, -} from "../utils/DiagnosticError"; -import { err, ok } from "../utils/Result"; -import { nullThrows } from "../utils/helpers"; -import * as E from "../Errors"; +} from "../utils/DiagnosticError.js"; +import { err, ok } from "../utils/Result.js"; +import { nullThrows } from "../utils/helpers.js"; +import * as E from "../Errors.js"; /** * Ensure that every type which implements an interface or is a member of a @@ -34,22 +34,20 @@ export function validateTypenames( // Synthesized type cannot guarantee that they have the correct __typename field, so we // prevent their use in interfaces and unions. if (ast.kind === Kind.OBJECT_TYPE_DEFINITION && ast.wasSynthesized) { - const message = - type instanceof GraphQLInterfaceType - ? E.genericTypeImplementsInterface() - : E.genericTypeUsedAsUnionMember(); + const message = isInterfaceType(type) + ? E.genericTypeImplementsInterface() + : E.genericTypeUsedAsUnionMember(); errors.push(gqlErr(ast.name, message)); } else if (!hasTypename.has(implementor.name) && ast.exported == null) { - const message = - type instanceof GraphQLInterfaceType - ? E.concreteTypenameImplementingInterfaceCannotBeResolved( - implementor.name, - type.name, - ) - : E.concreteTypenameInUnionCannotBeResolved( - implementor.name, - type.name, - ); + const message = isInterfaceType(type) + ? E.concreteTypenameImplementingInterfaceCannotBeResolved( + implementor.name, + type.name, + ) + : E.concreteTypenameInUnionCannotBeResolved( + implementor.name, + type.name, + ); const err = gqlErr(ast.name, message, [ gqlRelated( diff --git a/tsconfig.json b/tsconfig.json index 0964f7d3..68c439c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,10 @@ { - // Most ts-node options can be specified here using their programmatic names. - "ts-node": { - // It is faster to skip typechecking. - // Remove if you want ts-node to do typechecking. - "transpileOnly": true, - "files": true, - "compilerOptions": { - // compilerOptions specified here will override those declared below, - // but *only* in ts-node. Useful if you want ts-node and tsc to use - // different options with a single tsconfig.json. - } - }, "grats": { "nullableByDefault": false }, "compilerOptions": { "skipLibCheck": true, - "lib": ["es2017"], - // typescript options here + "lib": ["es2020"], "experimentalDecorators": true, "outDir": "dist", "downlevelIteration": true, @@ -25,6 +12,8 @@ "declaration": true, "resolveJsonModule": true, "strictPropertyInitialization": true, + "module": "nodenext", + "moduleResolution": "nodenext", "paths": { // For tests "grats": ["./src/index.ts"] @@ -34,6 +23,7 @@ "node_modules", "dist", "src/tests/fixtures", + "src/tests/integrationFixtures", "docs", "examples", "website", diff --git a/website/docs/01-getting-started/02-cli.md b/website/docs/01-getting-started/02-cli.md index 480a36d7..44490e07 100644 --- a/website/docs/01-getting-started/02-cli.md +++ b/website/docs/01-getting-started/02-cli.md @@ -56,30 +56,42 @@ Options: -h, --help display help for command Commands: - locate [options] + locate [options] ``` ## Locate -The `locate` command reports the location (file, line, column) at which a given type or field is defined in your code. `grats locate` can also be invoked by other tools. For example the click-to-definition feature of an GraphQL editor integration could use invoke this command to find the location of a type or field. +The `locate` command reports the location (file, line, column) at which a given schema element is defined in your code. It accepts a [Schema Coordinate](https://spec.graphql.org/draft/#sec-Schema-Coordinates) as its argument. + +`grats locate` can also be invoked by other tools. For example the click-to-definition feature of a GraphQL editor integration could invoke this command to find the location of a type or field. For example, Relay's VSCode Extension is [exploring](https://github.com/facebook/relay/pull/4434) adding the ability to leverage such a tool. ```bash +# Locate a named type +npx grats locate User + # Locate a field npx grats locate User.name -# Locate a named type -npx grats locate User +# Locate a field argument +npx grats locate "Query.user(id:)" + +# Locate an enum value +npx grats locate "MyEnum.VALUE" + +# Locate a directive +npx grats locate @deprecated ``` ### Options ``` -Usage: grats locate [options] +Usage: grats locate [options] Arguments: -ENTITY GraphQL entity to locate. E.g. `User` or `User.id` +COORDINATE Schema coordinate to locate. E.g. `User`, `User.name`, + `Query.user(id:)`, `@deprecated` Options: --tsconfig Path to tsconfig.json. Defaults to auto-detecting based on the current working directory diff --git a/website/package.json b/website/package.json index 04869f86..0381a6ea 100644 --- a/website/package.json +++ b/website/package.json @@ -12,7 +12,7 @@ "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", "typecheck": "tsc", - "grats": "ts-node ./scripts/gratsCode.ts", + "grats": "tsx ./scripts/gratsCode.ts", "word-count": "find . -type f \\( -name \\*.md -o -name \\*.mdx \\) -exec wc -w {} + | awk '{total += $1} END {print total}'" }, "dependencies": { @@ -30,7 +30,7 @@ "@typescript/vfs": "1.6.0", "clsx": "^1.2.1", "glob": "^9.3.4", - "graphql": "^16.11.0", + "graphql": "17.0.0-alpha.11", "grats": "workspace:*", "lz-string": "^1.5.0", "monaco-editor": "^0.52.2", @@ -53,7 +53,7 @@ "cheerio": "^1.2.0", "graphql-relay": "^0.10.0", "monaco-editor-webpack-plugin": "^7.1.0", - "ts-node": "^10.9.2", + "tsx": "^4.19.2", "typescript": "5.9.2" }, "browserslist": { diff --git a/website/plugins/webpack.js b/website/plugins/webpack.js index 39a266cd..64d0d8f8 100644 --- a/website/plugins/webpack.js +++ b/website/plugins/webpack.js @@ -8,6 +8,13 @@ module.exports = function (_context, _options) { resolve: { fallback: { path: require.resolve("path-browserify"), + url: false, + fs: false, + module: false, + }, + // Map .js extensions to .ts for ESM-style imports in TypeScript source + extensionAlias: { + ".js": [".ts", ".tsx", ".js"], }, }, node: {