@graphql-codegen/fragment-matcher 3.3.1-alpha-0814e49cc.0 → 3.3.1

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,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-codegen/fragment-matcher",
3
- "version": "3.3.1-alpha-0814e49cc.0",
3
+ "version": "3.3.1",
4
4
  "description": "graphql-code-generate plugin for generating fragments matcher introspection file",
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"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-0814e49cc.0",
9
+ "@graphql-codegen/plugin-helpers": "^2.6.2",
10
10
  "tslib": "~2.4.0"
11
11
  },
12
12
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "exports": {
26
26
  ".": {
27
27
  "require": {
28
- "types": "./typings/index.d.ts",
28
+ "types": "./typings/index.d.cts",
29
29
  "default": "./cjs/index.js"
30
30
  },
31
31
  "import": {
@@ -0,0 +1,64 @@
1
+ import { PluginFunction, PluginValidateFn } from '@graphql-codegen/plugin-helpers';
2
+ /**
3
+ * @description This plugin generates an introspection file but only with Interfaces and Unions, based on your GraphQLSchema.
4
+ *
5
+ * If you are using `apollo-client` and your schema contains `interface` or `union` declaration, it's recommended to use Apollo's Fragment Matcher and the result generated by the plugin.
6
+ *
7
+ * You can read more about it in [`apollo-client` documentation](https://apollographql.com/docs/react/data/fragments/#fragments-on-unions-and-interfaces).
8
+ *
9
+ * Fragment Matcher plugin accepts a TypeScript / JavaScript or a JSON file as an output _(`.ts, .tsx, .js, .jsx, .json`)_.
10
+ *
11
+ * Both in TypeScript and JavaScript a default export is being used.
12
+ *
13
+ * > The output is based on the output you choose for the output file name.
14
+ */
15
+ export interface FragmentMatcherConfig {
16
+ /**
17
+ * @description Compatible only with JSON extension, allow you to choose the export type, either `module.exports` or `export default`. Allowed values are: `commonjs`, `es2015`.
18
+ * @default es2015
19
+ *
20
+ * @exampleMarkdown
21
+ * ```yaml {6}
22
+ * generates:
23
+ * path/to/file.json:
24
+ * plugins:
25
+ * - fragment-matcher
26
+ * config:
27
+ * module: commonjs
28
+ * ```
29
+ */
30
+ module?: 'commonjs' | 'es2015';
31
+ /**
32
+ * @description Compatible only with TS/TSX/JS/JSX extensions, allow you to generate output based on your Apollo-Client version. Valid values are: `2`, `3`.
33
+ * @default 3
34
+ *
35
+ * @exampleMarkdown
36
+ * ```yaml {6}
37
+ * generates:
38
+ * path/to/file.ts:
39
+ * plugins:
40
+ * - fragment-matcher
41
+ * config:
42
+ * apolloClientVersion: 3
43
+ * ```
44
+ */
45
+ apolloClientVersion?: 2 | 3;
46
+ /**
47
+ * @description Create an explicit type based on your schema. This can help IDEs autofill your fragment matcher. This is mostly useful if you do more with your fragment matcher than just pass it to an Apollo-Client.
48
+ * @default false
49
+ *
50
+ * @exampleMarkdown
51
+ * ```yaml {6}
52
+ * generates:
53
+ * path/to/file.ts:
54
+ * plugins:
55
+ * - fragment-matcher
56
+ * config:
57
+ * useExplicitTyping: true
58
+ * ```
59
+ */
60
+ useExplicitTyping?: boolean;
61
+ federation?: boolean;
62
+ }
63
+ export declare const plugin: PluginFunction;
64
+ export declare const validate: PluginValidateFn<any>;