@graphql-codegen/named-operations-object 2.2.2-alpha-4a7e799f2.0 → 2.3.0-alpha-bd464a586.0

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.
@@ -1,21 +1,19 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const pluginHelpers = require('@graphql-codegen/plugin-helpers');
6
- const graphql = require('graphql');
7
- const changeCaseAll = require('change-case-all');
8
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.plugin = void 0;
4
+ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
5
+ const graphql_1 = require("graphql");
6
+ const change_case_all_1 = require("change-case-all");
9
7
  const plugin = (schema, documents, config) => {
10
8
  const identifierName = config.identifierName || 'namedOperations';
11
- const allAst = graphql.concatAST(documents.map(v => v.document));
9
+ const allAst = (0, graphql_1.concatAST)(documents.map(v => v.document));
12
10
  const allOperationsNames = {
13
11
  query: new Set(),
14
12
  mutation: new Set(),
15
13
  subscription: new Set(),
16
14
  fragment: new Set(),
17
15
  };
18
- pluginHelpers.oldVisit(allAst, {
16
+ (0, plugin_helpers_1.oldVisit)(allAst, {
19
17
  enter: {
20
18
  OperationDefinition: node => {
21
19
  var _a;
@@ -32,7 +30,7 @@ const plugin = (schema, documents, config) => {
32
30
  .map(operationType => {
33
31
  const relevantOperations = allOperationsNames[operationType];
34
32
  if (relevantOperations && relevantOperations.size > 0) {
35
- const rootFieldName = changeCaseAll.capitalCase(operationType);
33
+ const rootFieldName = (0, change_case_all_1.capitalCase)(operationType);
36
34
  return ` ${rootFieldName}: {
37
35
  ${Array.from(relevantOperations)
38
36
  .map(t => ` ${t}: '${t}'${config.useConsts ? ' as const' : ''}`)
@@ -51,5 +49,4 @@ ${Array.from(relevantOperations)
51
49
  ${objectItems.join(',\n')}
52
50
  }`;
53
51
  };
54
-
55
52
  exports.plugin = plugin;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,8 +1,7 @@
1
1
  import { oldVisit } from '@graphql-codegen/plugin-helpers';
2
2
  import { concatAST } from 'graphql';
3
3
  import { capitalCase } from 'change-case-all';
4
-
5
- const plugin = (schema, documents, config) => {
4
+ export const plugin = (schema, documents, config) => {
6
5
  const identifierName = config.identifierName || 'namedOperations';
7
6
  const allAst = concatAST(documents.map(v => v.document));
8
7
  const allOperationsNames = {
@@ -47,5 +46,3 @@ ${Array.from(relevantOperations)
47
46
  ${objectItems.join(',\n')}
48
47
  }`;
49
48
  };
50
-
51
- export { plugin };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-codegen/named-operations-object",
3
- "version": "2.2.2-alpha-4a7e799f2.0",
3
+ "version": "2.3.0-alpha-bd464a586.0",
4
4
  "description": "GraphQL Code Generator plugin for generating an enum with all loaded operations, for simpler and type-safe access",
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
  "graphql-tag": "^2.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-codegen/plugin-helpers": "2.4.2-alpha-4a7e799f2.0",
10
+ "@graphql-codegen/plugin-helpers": "^2.5.0-alpha-bd464a586.0",
11
11
  "change-case-all": "1.0.14",
12
- "tslib": "~2.3.0"
12
+ "tslib": "~2.4.0"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -17,21 +17,28 @@
17
17
  "directory": "packages/plugins/typescript/named-operations-object"
18
18
  },
19
19
  "license": "MIT",
20
- "main": "index.js",
21
- "module": "index.mjs",
22
- "typings": "index.d.ts",
20
+ "main": "cjs/index.js",
21
+ "module": "esm/index.js",
22
+ "typings": "typings/index.d.ts",
23
23
  "typescript": {
24
- "definition": "index.d.ts"
24
+ "definition": "typings/index.d.ts"
25
25
  },
26
+ "type": "module",
26
27
  "exports": {
27
- "./package.json": "./package.json",
28
28
  ".": {
29
- "require": "./index.js",
30
- "import": "./index.mjs"
29
+ "require": {
30
+ "types": "./typings/index.d.ts",
31
+ "default": "./cjs/index.js"
32
+ },
33
+ "import": {
34
+ "types": "./typings/index.d.ts",
35
+ "default": "./esm/index.js"
36
+ },
37
+ "default": {
38
+ "types": "./typings/index.d.ts",
39
+ "default": "./esm/index.js"
40
+ }
31
41
  },
32
- "./*": {
33
- "require": "./*.js",
34
- "import": "./*.mjs"
35
- }
42
+ "./package.json": "./package.json"
36
43
  }
37
- }
44
+ }
@@ -5,7 +5,7 @@ export interface NamedOperationsObjectPluginConfig {
5
5
  * @default namedOperations
6
6
  *
7
7
  * @exampleMarkdown
8
- * ```yml
8
+ * ```yaml
9
9
  * generates:
10
10
  * path/to/file.ts:
11
11
  * plugins: