@graphql-codegen/typescript-urql 3.7.3 → 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.UrqlVisitor = 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, "UrqlVisitor", { enumerable: true, get: function () { return visitor_js_1.UrqlVisitor; } });
8
- const path_1 = require("path");
9
9
  const plugin = (schema, documents, config) => {
10
10
  const allAst = (0, graphql_1.concatAST)(documents.map(v => v.document));
11
11
  const allFragments = [
@@ -21,7 +21,10 @@ const plugin = (schema, documents, config) => {
21
21
  const visitorResult = (0, plugin_helpers_1.oldVisit)(allAst, { leave: visitor });
22
22
  return {
23
23
  prepend: visitor.getImports(),
24
- content: [visitor.fragments, ...visitorResult.definitions.filter(t => typeof t === 'string')].join('\n'),
24
+ content: [
25
+ visitor.fragments,
26
+ ...visitorResult.definitions.filter(t => typeof t === 'string'),
27
+ ].join('\n'),
25
28
  };
26
29
  };
27
30
  exports.plugin = plugin;
package/cjs/visitor.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UrqlVisitor = 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 graphql_1 = require("graphql");
7
+ const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
8
8
  class UrqlVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
9
9
  constructor(schema, fragments, rawConfig) {
10
10
  super(schema, fragments, rawConfig, {
@@ -15,7 +15,8 @@ class UrqlVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
15
15
  this._externalImportPrefix = '';
16
16
  if (this.config.importOperationTypesFrom) {
17
17
  this._externalImportPrefix = `${this.config.importOperationTypesFrom}.`;
18
- if (this.config.documentMode !== visitor_plugin_common_1.DocumentMode.external || !this.config.importDocumentNodeExternallyFrom) {
18
+ if (this.config.documentMode !== visitor_plugin_common_1.DocumentMode.external ||
19
+ !this.config.importDocumentNodeExternallyFrom) {
19
20
  // eslint-disable-next-line no-console
20
21
  console.warn('"importOperationTypesFrom" should be used with "documentMode=external" and "importDocumentNodeExternallyFrom"');
21
22
  }
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 { UrqlVisitor } from './visitor.js';
4
- import { extname } from 'path';
5
5
  export const plugin = (schema, documents, config) => {
6
6
  const allAst = concatAST(documents.map(v => v.document));
7
7
  const allFragments = [
@@ -17,7 +17,10 @@ export const plugin = (schema, documents, config) => {
17
17
  const visitorResult = oldVisit(allAst, { leave: visitor });
18
18
  return {
19
19
  prepend: visitor.getImports(),
20
- content: [visitor.fragments, ...visitorResult.definitions.filter(t => typeof t === 'string')].join('\n'),
20
+ content: [
21
+ visitor.fragments,
22
+ ...visitorResult.definitions.filter(t => typeof t === 'string'),
23
+ ].join('\n'),
21
24
  };
22
25
  };
23
26
  export const validate = async (schema, documents, config, outputFile) => {
package/esm/visitor.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ClientSideBaseVisitor, getConfigValue, OMIT_TYPE, DocumentMode, } from '@graphql-codegen/visitor-plugin-common';
2
1
  import autoBind from 'auto-bind';
3
2
  import { Kind } from 'graphql';
3
+ import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, } from '@graphql-codegen/visitor-plugin-common';
4
4
  export class UrqlVisitor extends ClientSideBaseVisitor {
5
5
  constructor(schema, fragments, rawConfig) {
6
6
  super(schema, fragments, rawConfig, {
@@ -11,7 +11,8 @@ export class UrqlVisitor extends ClientSideBaseVisitor {
11
11
  this._externalImportPrefix = '';
12
12
  if (this.config.importOperationTypesFrom) {
13
13
  this._externalImportPrefix = `${this.config.importOperationTypesFrom}.`;
14
- if (this.config.documentMode !== DocumentMode.external || !this.config.importDocumentNodeExternallyFrom) {
14
+ if (this.config.documentMode !== DocumentMode.external ||
15
+ !this.config.importDocumentNodeExternallyFrom) {
15
16
  // eslint-disable-next-line no-console
16
17
  console.warn('"importOperationTypesFrom" should be used with "documentMode=external" and "importDocumentNodeExternallyFrom"');
17
18
  }
package/package.json CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-urql",
3
- "version": "3.7.3",
3
+ "version": "4.0.0-alpha-20230524082546-d7e1d0a4a",
4
4
  "description": "GraphQL Code Generator plugin for generating an introspection file for Urql's Schema Awareness",
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.7.2",
10
+ "@graphql-codegen/plugin-helpers": "^3.0.0",
11
11
  "@graphql-codegen/visitor-plugin-common": "2.13.1",
12
12
  "auto-bind": "~4.0.0",
13
13
  "tslib": "~2.4.0"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/dotansimha/graphql-code-generator.git",
17
+ "url": "https://github.com/dotansimha/graphql-code-generator-community.git",
18
18
  "directory": "packages/plugins/typescript/urql"
19
19
  },
20
20
  "license": "MIT",
21
+ "engines": {
22
+ "node": ">= 16.0.0"
23
+ },
21
24
  "main": "cjs/index.js",
22
25
  "module": "esm/index.js",
23
26
  "typings": "typings/index.d.ts",
@@ -1,6 +1,6 @@
1
- import { Types, PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
2
- import { UrqlVisitor } from './visitor.cjs';
1
+ import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
3
2
  import { UrqlRawPluginConfig } from './config.cjs';
3
+ import { UrqlVisitor } from './visitor.cjs';
4
4
  export declare const plugin: PluginFunction<UrqlRawPluginConfig, Types.ComplexPluginOutput>;
5
5
  export declare const validate: PluginValidateFn<any>;
6
6
  export { UrqlVisitor };
@@ -1,6 +1,6 @@
1
- import { Types, PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
2
- import { UrqlVisitor } from './visitor.js';
1
+ import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
3
2
  import { UrqlRawPluginConfig } from './config.js';
3
+ import { UrqlVisitor } from './visitor.js';
4
4
  export declare const plugin: PluginFunction<UrqlRawPluginConfig, Types.ComplexPluginOutput>;
5
5
  export declare const validate: PluginValidateFn<any>;
6
6
  export { UrqlVisitor };
@@ -1,6 +1,6 @@
1
- import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
1
+ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
2
+ import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2
3
  import { UrqlRawPluginConfig } from './config.cjs';
3
- import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
4
4
  export interface UrqlPluginConfig extends ClientSideBasePluginConfig {
5
5
  withComponent: boolean;
6
6
  withHooks: boolean;
@@ -1,6 +1,6 @@
1
- import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
1
+ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
2
+ import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2
3
  import { UrqlRawPluginConfig } from './config.js';
3
- import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
4
4
  export interface UrqlPluginConfig extends ClientSideBasePluginConfig {
5
5
  withComponent: boolean;
6
6
  withHooks: boolean;