@graphql-codegen/typescript-graphql-files-modules 2.2.1-alpha-0814e49cc.0 → 2.2.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/typescript-graphql-files-modules",
3
- "version": "2.2.1-alpha-0814e49cc.0",
3
+ "version": "2.2.1",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript module declarations based on GraphQL operations",
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,45 @@
1
+ import { PluginFunction, PluginValidateFn } from '@graphql-codegen/plugin-helpers';
2
+ /**
3
+ * @description This plugin generates TypeScript typings for `.graphql` files containing GraphQL documents, which later on can be consumed using [`graphql-tag/loader`](https://github.com/apollographql/graphql-tag#webpack-preprocessing-with-graphql-tagloader) or use `string` types if you will use the operations as raw strings, and get type-check and type-safety for your imports. This means that any time you import objects from `.graphql` files, your IDE will provide auto-complete.
4
+ *
5
+ * This plugin also handles `.graphql` files containing multiple GraphQL documents, and name the imports according to the operation name.
6
+ *
7
+ * > ⚠ Fragments are not generated with named imports, only as default imports, due to `graphql-tag/loader` behavior.
8
+ *
9
+ */
10
+ export interface TypeScriptFilesModulesPluginConfig {
11
+ /**
12
+ * @default ""
13
+ * @description Allows specifying a module definition path prefix to provide distinction
14
+ * between generated types.
15
+ *
16
+ * @exampleMarkdown
17
+ * ```yaml
18
+ * generates: src/api/user-service/queries.d.ts
19
+ * documents: src/api/user-service/queries.graphql
20
+ * plugins:
21
+ * - typescript-graphql-files-modules
22
+ * config:
23
+ * # resulting module definition path glob: "*\/api/user-service/queries.graphql"
24
+ * modulePathPrefix: "/api/user-service/"
25
+ * ```
26
+ */
27
+ modulePathPrefix?: string;
28
+ /**
29
+ * @default false
30
+ * @description By default, only the filename is being used to generate TS module declarations. Setting this to `true` will generate it with a full path based on the CWD.
31
+ */
32
+ relativeToCwd?: boolean;
33
+ /**
34
+ * @default *\/
35
+ * @description By default, a wildcard is being added as prefix, you can change that to a custom prefix
36
+ */
37
+ prefix?: string;
38
+ /**
39
+ * @default "DocumentNode"
40
+ * @description By default, the named exports will have a type `DocumentNode`. Change this to "string" if you only use raw strings.
41
+ */
42
+ type?: 'string' | 'DocumentNode';
43
+ }
44
+ export declare const plugin: PluginFunction;
45
+ export declare const validate: PluginValidateFn<any>;