@graphql-codegen/plugin-helpers 7.2.1 → 7.3.0-alpha-20260831150731-308349d17a63278dee2bccc6aaac7be3ced4bf55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/plugin-helpers",
3
- "version": "7.2.1",
3
+ "version": "7.3.0-alpha-20260831150731-308349d17a63278dee2bccc6aaac7be3ced4bf55",
4
4
  "description": "GraphQL Code Generator common utils and types",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
@@ -3,6 +3,21 @@ import type { ApolloEngineOptions } from '@graphql-tools/apollo-engine-loader';
3
3
  import { Source } from '@graphql-tools/utils';
4
4
  import type { Profiler } from './profiler.cjs';
5
5
  export declare namespace Types {
6
+ /**
7
+ * @description Controls how the CLI decides whether the generated content already
8
+ * matches the output file so the write can be skipped:
9
+ *
10
+ * - `'cache-first'` (default): compare against the in-memory hash of what codegen
11
+ * last wrote, falling back to reading the file from disk when there is no cached
12
+ * entry. Assumes the output is a pure function of the codegen inputs.
13
+ * - `'disk'`: always compare against the file on disk. Use this when the output
14
+ * depends on the file's existing content (e.g. a preset that reads the file and
15
+ * rewrites part of it), so a file that was changed on disk is not wrongly skipped
16
+ * in watch mode.
17
+ *
18
+ * @default 'cache-first'
19
+ */
20
+ type ContentComparison = 'cache-first' | 'disk';
6
21
  interface GenerateOptions {
7
22
  filename: string;
8
23
  plugins: Types.ConfiguredPlugin[];
@@ -24,6 +39,11 @@ export declare namespace Types {
24
39
  documentTransforms?: ConfiguredDocumentTransform[];
25
40
  emitLegacyCommonJSImports?: boolean;
26
41
  importExtension?: '' | `.${string}`;
42
+ /**
43
+ * @description How the CLI compares generated content against the output file
44
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
45
+ */
46
+ contentComparison?: Types.ContentComparison;
27
47
  }
28
48
  type FileOutput = {
29
49
  filename: string;
@@ -32,6 +52,11 @@ export declare namespace Types {
32
52
  beforeOneFileWrite?: LifecycleHooksDefinition['beforeOneFileWrite'];
33
53
  afterOneFileWrite?: LifecycleHooksDefinition['afterOneFileWrite'];
34
54
  };
55
+ /**
56
+ * @description How the CLI compares generated content against the output file
57
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
58
+ */
59
+ contentComparison?: Types.ContentComparison;
35
60
  };
36
61
  interface DocumentFile extends Source {
37
62
  hash?: string | null;
@@ -258,6 +283,14 @@ export declare namespace Types {
258
283
  * For more details: https://graphql-code-generator.com/docs/config-reference/codegen-config
259
284
  */
260
285
  overwrite?: boolean | Partial<NormalizedOverwriteOption>;
286
+ /**
287
+ * @description How the CLI compares generated content against the output file
288
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
289
+ *
290
+ * A preset can also set this per output from `buildGeneratesSection`; the value
291
+ * returned there takes precedence over this one.
292
+ */
293
+ contentComparison?: Types.ContentComparison;
261
294
  /**
262
295
  * @description A pointer(s) to your GraphQL documents: query, mutation, subscription and fragment. These documents will be loaded into for all your output files.
263
296
  * You can use one of the following:
@@ -3,6 +3,21 @@ import type { ApolloEngineOptions } from '@graphql-tools/apollo-engine-loader';
3
3
  import { Source } from '@graphql-tools/utils';
4
4
  import type { Profiler } from './profiler.js';
5
5
  export declare namespace Types {
6
+ /**
7
+ * @description Controls how the CLI decides whether the generated content already
8
+ * matches the output file so the write can be skipped:
9
+ *
10
+ * - `'cache-first'` (default): compare against the in-memory hash of what codegen
11
+ * last wrote, falling back to reading the file from disk when there is no cached
12
+ * entry. Assumes the output is a pure function of the codegen inputs.
13
+ * - `'disk'`: always compare against the file on disk. Use this when the output
14
+ * depends on the file's existing content (e.g. a preset that reads the file and
15
+ * rewrites part of it), so a file that was changed on disk is not wrongly skipped
16
+ * in watch mode.
17
+ *
18
+ * @default 'cache-first'
19
+ */
20
+ type ContentComparison = 'cache-first' | 'disk';
6
21
  interface GenerateOptions {
7
22
  filename: string;
8
23
  plugins: Types.ConfiguredPlugin[];
@@ -24,6 +39,11 @@ export declare namespace Types {
24
39
  documentTransforms?: ConfiguredDocumentTransform[];
25
40
  emitLegacyCommonJSImports?: boolean;
26
41
  importExtension?: '' | `.${string}`;
42
+ /**
43
+ * @description How the CLI compares generated content against the output file
44
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
45
+ */
46
+ contentComparison?: Types.ContentComparison;
27
47
  }
28
48
  type FileOutput = {
29
49
  filename: string;
@@ -32,6 +52,11 @@ export declare namespace Types {
32
52
  beforeOneFileWrite?: LifecycleHooksDefinition['beforeOneFileWrite'];
33
53
  afterOneFileWrite?: LifecycleHooksDefinition['afterOneFileWrite'];
34
54
  };
55
+ /**
56
+ * @description How the CLI compares generated content against the output file
57
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
58
+ */
59
+ contentComparison?: Types.ContentComparison;
35
60
  };
36
61
  interface DocumentFile extends Source {
37
62
  hash?: string | null;
@@ -258,6 +283,14 @@ export declare namespace Types {
258
283
  * For more details: https://graphql-code-generator.com/docs/config-reference/codegen-config
259
284
  */
260
285
  overwrite?: boolean | Partial<NormalizedOverwriteOption>;
286
+ /**
287
+ * @description How the CLI compares generated content against the output file
288
+ * to decide whether the write can be skipped. See {@link Types.ContentComparison}.
289
+ *
290
+ * A preset can also set this per output from `buildGeneratesSection`; the value
291
+ * returned there takes precedence over this one.
292
+ */
293
+ contentComparison?: Types.ContentComparison;
261
294
  /**
262
295
  * @description A pointer(s) to your GraphQL documents: query, mutation, subscription and fragment. These documents will be loaded into for all your output files.
263
296
  * You can use one of the following: