Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .changeset/typescript-7-build-tooling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
'@pothos/converter': patch
'@pothos/core': patch
'@pothos/plugin-add-graphql': patch
'@pothos/plugin-complexity': patch
'@pothos/plugin-dataloader': patch
'@pothos/plugin-directives': patch
'@pothos/plugin-drizzle': patch
'@pothos/plugin-errors': patch
'@pothos/plugin-example': patch
'@pothos/plugin-federation': patch
'@pothos/plugin-grafast': patch
'@pothos/plugin-mocks': patch
'@pothos/plugin-prisma-utils': patch
'@pothos/plugin-prisma': patch
'@pothos/plugin-relay': patch
'@pothos/plugin-scope-auth': patch
'@pothos/plugin-simple-objects': patch
'@pothos/plugin-smart-subscriptions': patch
'@pothos/plugin-sub-graph': patch
'@pothos/plugin-tracing': patch
'@pothos/plugin-validation': patch
'@pothos/plugin-with-input': patch
'@pothos/plugin-zod': patch
'@pothos/test-utils': patch
'@pothos/tracing-newrelic': patch
'@pothos/tracing-opentelemetry': patch
'@pothos/tracing-sentry': patch
'@pothos/tracing-xray': patch
---

Rebuild with TypeScript 7. Source files now use explicit `.js` import extensions (enforced by
lint) instead of adding them during the build, and declaration files are emitted by TypeScript
7's compiler. Published output is functionally unchanged.
18 changes: 18 additions & 0 deletions .changeset/typescript-7-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@pothos/plugin-prisma': minor
'@pothos/plugin-relay': patch
---

Support TypeScript 7.

The prisma generator (`prisma-pothos-types`) previously built its output with the TypeScript
compiler API (`ts.factory` + printer), which no longer exists in TypeScript 7 — the Go-based
compiler ships no in-process JS API. The generator now emits the same output (byte-identical)
via string templates, so it no longer imports `typescript` at runtime and works regardless of
which TypeScript version (or none) is installed. The `typescript` peer dependency of
`@pothos/plugin-prisma` has been removed accordingly.

`@pothos/plugin-relay` contains two internal fixes for type-checker differences between
TypeScript 6 and 7 (explicit type arguments where 7 picks a different inference candidate, and a
resolver wrapper that is checked against the declared resolver type). No public types changed;
the plugin now type-checks cleanly under both majors.
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@
"indentStyle": "space"
}
},
{
"includes": ["**/packages/*/src/**"],
"linter": {
"rules": {
"correctness": {
"useImportExtensions": {
"level": "error",
"options": {
"forceJsExtensions": true
}
}
}
}
}
},
{
"includes": ["**/global-types.ts"],
"linter": {
Expand Down
2 changes: 1 addition & 1 deletion examples/complex-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"schema": "node scripts/build-schema.ts",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/fastify-mercurius/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "src/index.ts",
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"dependencies": {
"@pothos/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion examples/federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "src/index.ts",
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"dependencies": {
"@apollo/gateway": "2.13.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"generate": "tsx graphql/build-schema.ts && echo | gql.tada generate-output",
"dev": "next dev",
"prod-build": "next build",
"type": "tsgo --noEmit",
"type": "tsc --noEmit",
"start": "next start"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/open-telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
}
}
2 changes: 1 addition & 1 deletion examples/prisma-federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generate": "prisma generate",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generate": "prisma generate",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-smart-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generate": "prisma generate",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generate": "prisma generate",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generate": "prisma generate",
"seed": "prisma migrate reset -f",
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/relay-windowed-pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "src/index.ts",
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"prisma": {
"seed": "node prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-classes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "src/index.ts",
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"dependencies": {
"@faker-js/faker": "^10.4.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "src/index.ts",
"scripts": {
"start": "node src/server.ts",
"type": "tsgo --noEmit"
"type": "tsc --noEmit"
},
"dependencies": {
"@faker-js/faker": "^10.4.0",
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@
"@biomejs/biome": "^2.4.11",
"@changesets/cli": "^2.30.0",
"@faker-js/faker": "^10.4.0",
"@swc-node/register": "^1.11.1",
"@swc/cli": "^0.8.1",
"@swc/core": "^1.15.24",
"@types/node": "^25.6.0",
"@typescript/native-preview": "npm:@typescript/native-preview@7.0.0-dev.20260616.1",
"graphql": "^17.0.1",
"pkg-pr-new": "^0.0.66",
"tsx": "^4.21.0",
"turbo": "^2.9.6",
"typescript": "npm:@typescript/typescript6@^6.0.0",
"typescript": "^7.0.2",
"vitest": "^4.1.4"
},
"engines": {
Expand Down
7 changes: 3 additions & 4 deletions packages/converter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
}
},
"scripts": {
"type": "tsgo --project tsconfig.type.json",
"type": "tsc --project tsconfig.type.json",
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
"build:clean": "git clean -dfX esm lib",
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths",
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths && pnpm esm:extensions",
"build:dts": "tsgo",
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths",
"build:dts": "tsc",
"test": "pnpm vitest --run"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/converter/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { buildSchema } from 'graphql';
import yargs from 'yargs';
import PothosConverter from '.';
import PothosConverter from './index.js';

export default yargs().command(
'convert <path>',
Expand Down
7 changes: 3 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
}
},
"scripts": {
"type": "tsgo --project tsconfig.type.json",
"type": "tsc --project tsconfig.type.json",
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
"build:clean": "git clean -dfX esm lib",
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths",
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths && pnpm esm:extensions",
"build:dts": "tsgo",
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths",
"build:dts": "tsc",
"test": "pnpm vitest --run"
},
"repository": {
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/build-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import {
type GraphQLTypeResolver,
GraphQLUnionType,
} from 'graphql';
import type { SchemaBuilder } from './builder';
import type { ConfigStore } from './config-store';
import { PothosError, PothosSchemaError } from './errors';
import { type BasePlugin, MergedPlugins } from './plugins';
import { BuiltinScalarRef } from './refs/builtin-scalar';
import type { SchemaBuilder } from './builder.js';
import type { ConfigStore } from './config-store.js';
import { PothosError, PothosSchemaError } from './errors.js';
import { type BasePlugin, MergedPlugins } from './plugins/index.js';
import { BuiltinScalarRef } from './refs/builtin-scalar.js';
import {
type InputType,
type OutputType,
Expand All @@ -49,8 +49,8 @@ import {
type PothosUnionTypeConfig,
type SchemaTypes,
typeBrandKey,
} from './types';
import { assertNever, getTypeBrand, isThenable } from './utils';
} from './types/index.js';
import { assertNever, getTypeBrand, isThenable } from './utils/index.js';

type NullableOutputType =
| GraphQLScalarType
Expand Down
42 changes: 21 additions & 21 deletions packages/core/src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ import {
type GraphQLTypeResolver,
lexicographicSortSchema,
} from 'graphql';
import { BuildCache } from './build-cache';
import { ConfigStore } from './config-store';
import { PothosError } from './errors';
import { InputFieldBuilder } from './fieldUtils/input';
import { InterfaceFieldBuilder } from './fieldUtils/interface';
import { MutationFieldBuilder } from './fieldUtils/mutation';
import { ObjectFieldBuilder } from './fieldUtils/object';
import { QueryFieldBuilder } from './fieldUtils/query';
import { SubscriptionFieldBuilder } from './fieldUtils/subscription';
import { BaseTypeRef } from './refs/base';
import { EnumRef } from './refs/enum';
import { ImplementableInputObjectRef, InputObjectRef } from './refs/input-object';
import { ImplementableInterfaceRef, InterfaceRef } from './refs/interface';
import { MutationRef } from './refs/mutation';
import { ImplementableObjectRef, ObjectRef } from './refs/object';
import { QueryRef } from './refs/query';
import { ScalarRef } from './refs/scalar';
import { SubscriptionRef } from './refs/subscription';
import { UnionRef } from './refs/union';
import { BuildCache } from './build-cache.js';
import { ConfigStore } from './config-store.js';
import { PothosError } from './errors.js';
import { InputFieldBuilder } from './fieldUtils/input.js';
import { InterfaceFieldBuilder } from './fieldUtils/interface.js';
import { MutationFieldBuilder } from './fieldUtils/mutation.js';
import { ObjectFieldBuilder } from './fieldUtils/object.js';
import { QueryFieldBuilder } from './fieldUtils/query.js';
import { SubscriptionFieldBuilder } from './fieldUtils/subscription.js';
import { BaseTypeRef } from './refs/base.js';
import { EnumRef } from './refs/enum.js';
import { ImplementableInputObjectRef, InputObjectRef } from './refs/input-object.js';
import { ImplementableInterfaceRef, InterfaceRef } from './refs/interface.js';
import { MutationRef } from './refs/mutation.js';
import { ImplementableObjectRef, ObjectRef } from './refs/object.js';
import { QueryRef } from './refs/query.js';
import { ScalarRef } from './refs/scalar.js';
import { SubscriptionRef } from './refs/subscription.js';
import { UnionRef } from './refs/union.js';
import type {
AbstractReturnShape,
AddVersionedDefaultsToBuilderOptions,
Expand Down Expand Up @@ -69,8 +69,8 @@ import type {
SubscriptionFieldsShape,
SubscriptionFieldThunk,
ValuesFromEnum,
} from './types';
import { normalizeEnumValues, valuesFromEnum, verifyInterfaces, verifyRef } from './utils';
} from './types/index.js';
import { normalizeEnumValues, valuesFromEnum, verifyInterfaces, verifyRef } from './utils/index.js';

export class SchemaBuilder<Types extends SchemaTypes> {
$inferSchemaTypes!: Types;
Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/config-store.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PothosSchemaError } from './errors';
import { BaseTypeRef } from './refs/base';
import { InputObjectRef } from './refs/input-object';
import { InterfaceRef } from './refs/interface';
import { MutationRef } from './refs/mutation';
import { ObjectRef } from './refs/object';
import { QueryRef } from './refs/query';
import { SubscriptionRef } from './refs/subscription';
import { PothosSchemaError } from './errors.js';
import { BaseTypeRef } from './refs/base.js';
import { InputObjectRef } from './refs/input-object.js';
import { InterfaceRef } from './refs/interface.js';
import { MutationRef } from './refs/mutation.js';
import { ObjectRef } from './refs/object.js';
import { QueryRef } from './refs/query.js';
import { SubscriptionRef } from './refs/subscription.js';
import type {
ConfigurableRef,
FieldMap,
Expand All @@ -16,7 +16,7 @@ import type {
PothosFieldConfig,
PothosTypeConfig,
SchemaTypes,
} from './types';
} from './types/index.js';

export class ConfigStore<Types extends SchemaTypes> {
typeConfigs = new Map<string, PothosTypeConfig>();
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/fieldUtils/base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defaultFieldResolver } from 'graphql';
import type { ArgumentRef } from '../refs/arg';
import { FieldRef } from '../refs/field';
import type { ArgumentRef } from '../refs/arg.js';
import { FieldRef } from '../refs/field.js';
import type {
FieldKind,
FieldNullability,
Expand All @@ -10,8 +10,8 @@ import type {
SchemaTypes,
ShapeFromTypeParam,
TypeParam,
} from '../types';
import { typeFromParam } from '../utils';
} from '../types/index.js';
import { typeFromParam } from '../utils/index.js';

export class BaseFieldUtil<Types extends SchemaTypes, ParentShape, Kind extends FieldKind> {
kind: Kind;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/fieldUtils/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
NormalizeArgs,
SchemaTypes,
TypeParam,
} from '../types';
import { RootFieldBuilder } from './root';
} from '../types/index.js';
import { RootFieldBuilder } from './root.js';

export class FieldBuilder<
Types extends SchemaTypes,
Expand Down
Loading
Loading