Skip to content

Commit 535105f

Browse files
Fix issues after rebasing (#10563)
* Fix missing dep * chore(dependencies): updated changesets for modified dependencies * Fix dev-tests --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 8b1c696 commit 535105f

7 files changed

Lines changed: 32 additions & 44 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphql-codegen/typescript-operations": patch
3+
---
4+
dependencies updates:
5+
- Added dependency [`@graphql-codegen/schema-ast@^5.0.0` ↗︎](https://www.npmjs.com/package/@graphql-codegen/schema-ast/v/5.0.0) (to `dependencies`)

dev-test/standalone-operations/import-schema-types/_types.generated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type * as Types from './_base.generated';
1+
import type * as Types from './_base.generated.js';
22

33
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
44
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };

packages/plugins/typescript/operations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@graphql-codegen/plugin-helpers": "^6.1.1",
17-
"@graphql-codegen/typescript": "^5.0.9",
17+
"@graphql-codegen/schema-ast": "^5.0.1",
1818
"@graphql-codegen/visitor-plugin-common": "^6.2.4",
1919
"auto-bind": "~4.0.0",
2020
"tslib": "~2.6.0"

packages/plugins/typescript/operations/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const plugin: PluginFunction<TypeScriptDocumentsPluginConfig, Types.Compl
6464
};
6565
};
6666

67-
export { TypeScriptDocumentsVisitor };
67+
export { TypeScriptDocumentsVisitor, type TypeScriptDocumentsPluginConfig };
6868

6969
const semanticToStrict = async (schema: GraphQLSchema): Promise<GraphQLSchema> => {
7070
try {

packages/plugins/typescript/operations/src/visitor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
getNodeComment,
2424
wrapTypeWithModifiers,
2525
} from '@graphql-codegen/visitor-plugin-common';
26+
import { normalizeImportExtension } from '@graphql-codegen/plugin-helpers';
2627
import autoBind from 'auto-bind';
2728
import {
2829
type DocumentNode,
@@ -370,8 +371,11 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor<
370371
identifiers: [],
371372
},
372373
typesImport: true,
373-
// FIXME: rebase with master for the new extension
374-
emitLegacyCommonJSImports: true,
374+
emitLegacyCommonJSImports: this.config.emitLegacyCommonJSImports,
375+
importExtension: normalizeImportExtension({
376+
emitLegacyCommonJSImports: this.config.emitLegacyCommonJSImports,
377+
importExtension: this.config.importExtension,
378+
}),
375379
}),
376380
];
377381
}

packages/plugins/typescript/operations/tests/extract-all-types.spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { mergeOutputs, Types } from '@graphql-codegen/plugin-helpers';
22
import { validateTs } from '@graphql-codegen/testing';
33
import { buildSchema, parse } from 'graphql';
4-
import { plugin as tsPlugin } from '../../typescript/src/index.js';
5-
import { plugin, TypeScriptDocumentsPluginConfig } from '../src/index.js';
4+
import { plugin, type TypeScriptDocumentsPluginConfig } from '../src/index.js';
65

76
describe('extractAllFieldsToTypes: true', () => {
8-
const validate = async (content: Types.PluginOutput, config: any = {}, pluginSchema) => {
9-
const m = mergeOutputs([await tsPlugin(pluginSchema, [], config, { outputFile: '' }), content]);
7+
const validate = async (content: Types.PluginOutput) => {
8+
const m = mergeOutputs([content]);
109
validateTs(m, undefined, undefined, undefined, []);
1110

1211
return m;
@@ -197,7 +196,7 @@ describe('extractAllFieldsToTypes: true', () => {
197196
"
198197
`);
199198

200-
await validate(content, config, dummyUserTestSchema);
199+
await validate(content);
201200
});
202201

203202
const complexTestSchemaWithUnionsAndInterfaces = buildSchema(/* GraphQL */ `
@@ -551,7 +550,7 @@ describe('extractAllFieldsToTypes: true', () => {
551550
"
552551
`);
553552

554-
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
553+
await validate(content);
555554
});
556555

557556
it('should extract types from multiple fragments (mergeFragmentTypes: true)', async () => {
@@ -725,7 +724,7 @@ describe('extractAllFieldsToTypes: true', () => {
725724
"
726725
`);
727726

728-
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
727+
await validate(content);
729728
});
730729

731730
it("should extract types from multiple fragments (inlineFragmentTypes: 'combine')", async () => {
@@ -968,7 +967,7 @@ describe('extractAllFieldsToTypes: true', () => {
968967
"
969968
`);
970969

971-
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
970+
await validate(content);
972971
});
973972

974973
it("should extract types from multiple fragments (inlineFragmentTypes: 'mask')", async () => {
@@ -1209,7 +1208,7 @@ describe('extractAllFieldsToTypes: true', () => {
12091208
"
12101209
`);
12111210

1212-
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
1211+
await validate(content);
12131212
});
12141213

12151214
it('fields with shared types and no fragments should use the shared type interface name', async () => {
@@ -1302,7 +1301,7 @@ describe('extractAllFieldsToTypes: true', () => {
13021301
"
13031302
`);
13041303

1305-
await validate(content, config, nestedInterfacesSchema);
1304+
await validate(content);
13061305
});
13071306

13081307
it('fragment spreads on the same interface should not force concrete parent type names (regression #10502)', async () => {
@@ -1518,7 +1517,7 @@ describe('extractAllFieldsToTypes: true', () => {
15181517
export type GetNotificationsQuery = GetNotificationsQuery_Query;
15191518
"
15201519
`);
1521-
await validate(content, config, notificationSchema);
1520+
await validate(content);
15221521
});
15231522

15241523
it('named fragments should use their name and not parent type name', async () => {
@@ -1599,6 +1598,6 @@ describe('extractAllFieldsToTypes: true', () => {
15991598
export type GetNotificationsQuery = GetNotificationsQuery_Query;
16001599
"
16011600
`);
1602-
await validate(content, config, notificationSchema);
1601+
await validate(content);
16031602
});
16041603
});

yarn.lock

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2820,16 +2820,6 @@
28202820
"@graphql-tools/utils" "^11.0.0"
28212821
tslib "^2.4.0"
28222822

2823-
"@graphql-tools/import@7.1.11":
2824-
version "7.1.11"
2825-
resolved "https://registry.yarnpkg.com/@graphql-tools/import/-/import-7.1.11.tgz#55c077107f89dfe48fe7105b639d446f58c0014b"
2826-
integrity sha512-depwWrqK2r9gcJhFDb/QC8cGFvZ15pAfBqxYVcuUIy+/pSjQXA5trMlgMqB1EhxL3aJevKMbiAqI46F3JOgwVg==
2827-
dependencies:
2828-
"@graphql-tools/utils" "^11.0.0"
2829-
"@theguild/federation-composition" "^0.22.0"
2830-
resolve-from "5.0.0"
2831-
tslib "^2.4.0"
2832-
28332823
"@graphql-tools/import@^7.1.12":
28342824
version "7.1.12"
28352825
resolved "https://registry.yarnpkg.com/@graphql-tools/import/-/import-7.1.12.tgz#a6b04c0c53b58cccb132950913e55b1f31f0f30a"
@@ -4513,16 +4503,6 @@
45134503
eslint-plugin-unicorn "56.0.1"
45144504
eslint-plugin-yml "1.16.0"
45154505

4516-
"@theguild/federation-composition@^0.22.0":
4517-
version "0.22.0"
4518-
resolved "https://registry.yarnpkg.com/@theguild/federation-composition/-/federation-composition-0.22.0.tgz#49a0748c063bd4c58cbf8e6ca980c1b2cec605f5"
4519-
integrity sha512-bGueT2FzlwRG8ZpiCmXnheqPESxg/5FlqgczBJET5w9X7kUJr6F47BaPyL+xzY+uesyawu1KE7Nd2jvJf2AKTw==
4520-
dependencies:
4521-
constant-case "^3.0.4"
4522-
debug "4.4.3"
4523-
json5 "^2.2.3"
4524-
lodash.sortby "^4.7.0"
4525-
45264506
"@theguild/prettier-config@0.1.1":
45274507
version "0.1.1"
45284508
resolved "https://registry.yarnpkg.com/@theguild/prettier-config/-/prettier-config-0.1.1.tgz#31935992aaacabe6bcc6578ba1b2c0166dab3410"
@@ -7154,20 +7134,20 @@ debug@4.3.6, debug@~4.3.6:
71547134
dependencies:
71557135
ms "2.1.2"
71567136

7157-
debug@4.4.3, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.4.0, debug@^4.4.3:
7158-
version "4.4.3"
7159-
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a"
7160-
integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==
7161-
dependencies:
7162-
ms "^2.1.3"
7163-
71647137
debug@^3.1.0, debug@^3.2.7:
71657138
version "3.2.7"
71667139
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
71677140
integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==
71687141
dependencies:
71697142
ms "^2.1.1"
71707143

7144+
debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.4.0, debug@^4.4.3:
7145+
version "4.4.3"
7146+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a"
7147+
integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==
7148+
dependencies:
7149+
ms "^2.1.3"
7150+
71717151
decamelize@^1.2.0:
71727152
version "1.2.0"
71737153
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"

0 commit comments

Comments
 (0)