@graphql-codegen/typescript-vue-apollo 3.3.7 → 4.0.0-alpha-20230524082546-d7e1d0a4a

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/cjs/config.js CHANGED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VueApolloVisitor = exports.validate = exports.plugin = void 0;
4
- const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
4
+ const path_1 = require("path");
5
5
  const graphql_1 = require("graphql");
6
+ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
6
7
  const visitor_js_1 = require("./visitor.js");
7
8
  Object.defineProperty(exports, "VueApolloVisitor", { enumerable: true, get: function () { return visitor_js_1.VueApolloVisitor; } });
8
- const path_1 = require("path");
9
9
  const plugin = (schema, documents, config) => {
10
10
  const allAst = (0, graphql_1.concatAST)(documents.map(s => s.document));
11
11
  const allFragments = [
package/cjs/visitor.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VueApolloVisitor = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
6
5
  const auto_bind_1 = tslib_1.__importDefault(require("auto-bind"));
7
6
  const change_case_all_1 = require("change-case-all");
7
+ const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
8
8
  function insertIf(condition, ...elements) {
9
9
  return condition ? elements : [];
10
10
  }
@@ -17,7 +17,9 @@ class VueApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
17
17
  addDocBlocks: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.addDocBlocks, true),
18
18
  });
19
19
  this.imports = new Set();
20
- this.externalImportPrefix = this.config.importOperationTypesFrom ? `${this.config.importOperationTypesFrom}.` : '';
20
+ this.externalImportPrefix = this.config.importOperationTypesFrom
21
+ ? `${this.config.importOperationTypesFrom}.`
22
+ : '';
21
23
  this._documents = documents;
22
24
  (0, auto_bind_1.default)(this);
23
25
  }
@@ -34,7 +36,9 @@ class VueApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
34
36
  return 'export type ReactiveFunction<TParam> = () => TParam;';
35
37
  }
36
38
  getDocumentNodeVariable(node, documentVariableName) {
37
- return this.config.documentMode === visitor_plugin_common_1.DocumentMode.external ? `Operations.${node.name.value}` : documentVariableName;
39
+ return this.config.documentMode === visitor_plugin_common_1.DocumentMode.external
40
+ ? `Operations.${node.name.value}`
41
+ : documentVariableName;
38
42
  }
39
43
  getImports() {
40
44
  const baseImports = super.getImports();
@@ -81,7 +85,11 @@ class VueApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
81
85
  ? `
82
86
  * @param variables that will be passed into the ${operationType.toLowerCase()}`
83
87
  : ''}
84
- * @param options that will be passed into the ${operationType.toLowerCase()}, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/${operationType === 'Mutation' ? 'mutation' : operationType === 'Subscription' ? 'subscription' : 'query'}.html#options;
88
+ * @param options that will be passed into the ${operationType.toLowerCase()}, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/${operationType === 'Mutation'
89
+ ? 'mutation'
90
+ : operationType === 'Subscription'
91
+ ? 'subscription'
92
+ : 'query'}.html#options;
85
93
  *
86
94
  * @example${operationType === 'Mutation' ? mutationExample : queryExample}
87
95
  */`;
@@ -153,7 +161,9 @@ class VueApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
153
161
  }));
154
162
  }
155
163
  return [
156
- ...insertIf(this.config.addDocBlocks, [this.buildCompositionFunctionsJSDoc(node, operationName, operationType)]),
164
+ ...insertIf(this.config.addDocBlocks, [
165
+ this.buildCompositionFunctionsJSDoc(node, operationName, operationType),
166
+ ]),
157
167
  compositionFunctions.join('\n'),
158
168
  compositionFunctionResultType,
159
169
  ].join('\n');
package/esm/config.js CHANGED
@@ -1 +0,0 @@
1
- export {};
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { oldVisit } from '@graphql-codegen/plugin-helpers';
1
+ import { extname } from 'path';
2
2
  import { concatAST, Kind } from 'graphql';
3
+ import { oldVisit } from '@graphql-codegen/plugin-helpers';
3
4
  import { VueApolloVisitor } from './visitor.js';
4
- import { extname } from 'path';
5
5
  export const plugin = (schema, documents, config) => {
6
6
  const allAst = concatAST(documents.map(s => s.document));
7
7
  const allFragments = [
package/esm/visitor.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ClientSideBaseVisitor, getConfigValue, DocumentMode, } from '@graphql-codegen/visitor-plugin-common';
2
1
  import autoBind from 'auto-bind';
3
2
  import { pascalCase, titleCase } from 'change-case-all';
3
+ import { ClientSideBaseVisitor, DocumentMode, getConfigValue, } from '@graphql-codegen/visitor-plugin-common';
4
4
  function insertIf(condition, ...elements) {
5
5
  return condition ? elements : [];
6
6
  }
@@ -13,7 +13,9 @@ export class VueApolloVisitor extends ClientSideBaseVisitor {
13
13
  addDocBlocks: getConfigValue(rawConfig.addDocBlocks, true),
14
14
  });
15
15
  this.imports = new Set();
16
- this.externalImportPrefix = this.config.importOperationTypesFrom ? `${this.config.importOperationTypesFrom}.` : '';
16
+ this.externalImportPrefix = this.config.importOperationTypesFrom
17
+ ? `${this.config.importOperationTypesFrom}.`
18
+ : '';
17
19
  this._documents = documents;
18
20
  autoBind(this);
19
21
  }
@@ -30,7 +32,9 @@ export class VueApolloVisitor extends ClientSideBaseVisitor {
30
32
  return 'export type ReactiveFunction<TParam> = () => TParam;';
31
33
  }
32
34
  getDocumentNodeVariable(node, documentVariableName) {
33
- return this.config.documentMode === DocumentMode.external ? `Operations.${node.name.value}` : documentVariableName;
35
+ return this.config.documentMode === DocumentMode.external
36
+ ? `Operations.${node.name.value}`
37
+ : documentVariableName;
34
38
  }
35
39
  getImports() {
36
40
  const baseImports = super.getImports();
@@ -77,7 +81,11 @@ export class VueApolloVisitor extends ClientSideBaseVisitor {
77
81
  ? `
78
82
  * @param variables that will be passed into the ${operationType.toLowerCase()}`
79
83
  : ''}
80
- * @param options that will be passed into the ${operationType.toLowerCase()}, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/${operationType === 'Mutation' ? 'mutation' : operationType === 'Subscription' ? 'subscription' : 'query'}.html#options;
84
+ * @param options that will be passed into the ${operationType.toLowerCase()}, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/${operationType === 'Mutation'
85
+ ? 'mutation'
86
+ : operationType === 'Subscription'
87
+ ? 'subscription'
88
+ : 'query'}.html#options;
81
89
  *
82
90
  * @example${operationType === 'Mutation' ? mutationExample : queryExample}
83
91
  */`;
@@ -149,7 +157,9 @@ export class VueApolloVisitor extends ClientSideBaseVisitor {
149
157
  }));
150
158
  }
151
159
  return [
152
- ...insertIf(this.config.addDocBlocks, [this.buildCompositionFunctionsJSDoc(node, operationName, operationType)]),
160
+ ...insertIf(this.config.addDocBlocks, [
161
+ this.buildCompositionFunctionsJSDoc(node, operationName, operationType),
162
+ ]),
153
163
  compositionFunctions.join('\n'),
154
164
  compositionFunctionResultType,
155
165
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-vue-apollo",
3
- "version": "3.3.7",
3
+ "version": "4.0.0-alpha-20230524082546-d7e1d0a4a",
4
4
  "description": "GraphQL Code Generator plugin for generating ready-to-use Vue-Apollo composition functions 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",
@@ -19,6 +19,9 @@
19
19
  "directory": "packages/plugins/typescript/vue-apollo"
20
20
  },
21
21
  "license": "MIT",
22
+ "engines": {
23
+ "node": ">= 16.0.0"
24
+ },
22
25
  "main": "cjs/index.js",
23
26
  "module": "esm/index.js",
24
27
  "typings": "typings/index.d.ts",
@@ -1,6 +1,6 @@
1
- import { Types, PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
2
- import { VueApolloVisitor } from './visitor.cjs';
1
+ import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
3
2
  import { VueApolloRawPluginConfig } from './config.cjs';
3
+ import { VueApolloVisitor } from './visitor.cjs';
4
4
  export declare const plugin: PluginFunction<VueApolloRawPluginConfig, Types.ComplexPluginOutput>;
5
5
  export declare const validate: PluginValidateFn<any>;
6
6
  export { VueApolloVisitor };
@@ -1,6 +1,6 @@
1
- import { Types, PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
2
- import { VueApolloVisitor } from './visitor.js';
1
+ import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
3
2
  import { VueApolloRawPluginConfig } from './config.js';
3
+ import { VueApolloVisitor } from './visitor.js';
4
4
  export declare const plugin: PluginFunction<VueApolloRawPluginConfig, Types.ComplexPluginOutput>;
5
5
  export declare const validate: PluginValidateFn<any>;
6
6
  export { VueApolloVisitor };
@@ -1,7 +1,7 @@
1
- import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2
- import { VueApolloRawPluginConfig } from './config.cjs';
3
- import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
1
+ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
4
2
  import { Types } from '@graphql-codegen/plugin-helpers';
3
+ import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
4
+ import { VueApolloRawPluginConfig } from './config.cjs';
5
5
  export interface VueApolloPluginConfig extends ClientSideBasePluginConfig {
6
6
  withCompositionFunctions: boolean;
7
7
  vueApolloComposableImportFrom: 'vue' | '@vue/apollo-composable' | string;
@@ -1,7 +1,7 @@
1
- import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2
- import { VueApolloRawPluginConfig } from './config.js';
3
- import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
1
+ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
4
2
  import { Types } from '@graphql-codegen/plugin-helpers';
3
+ import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
4
+ import { VueApolloRawPluginConfig } from './config.js';
5
5
  export interface VueApolloPluginConfig extends ClientSideBasePluginConfig {
6
6
  withCompositionFunctions: boolean;
7
7
  vueApolloComposableImportFrom: 'vue' | '@vue/apollo-composable' | string;