@graphql-codegen/typescript-react-offix 2.3.6 → 3.0.0-alpha-20230524083052-08ce957b4
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/index.js +2 -2
- package/cjs/visitor.js +7 -3
- package/esm/index.js +2 -2
- package/esm/visitor.js +7 -3
- package/package.json +7 -4
- package/typings/index.d.cts +1 -1
- package/typings/index.d.ts +1 -1
- package/typings/visitor.d.cts +2 -2
- package/typings/visitor.d.ts +2 -2
package/cjs/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReactApolloVisitor = exports.validate = exports.plugin = void 0;
|
|
4
|
-
const
|
|
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, "ReactApolloVisitor", { enumerable: true, get: function () { return visitor_js_1.ReactApolloVisitor; } });
|
|
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 = [
|
package/cjs/visitor.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReactApolloVisitor = 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
|
class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
9
9
|
constructor(schema, fragments, rawConfig, documents) {
|
|
10
10
|
super(schema, fragments, rawConfig, {});
|
|
11
11
|
this.imports = new Set();
|
|
12
|
-
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
12
|
+
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
13
|
+
? `${this.config.importOperationTypesFrom}.`
|
|
14
|
+
: '';
|
|
13
15
|
this._documents = documents;
|
|
14
16
|
(0, auto_bind_1.default)(this);
|
|
15
17
|
}
|
|
@@ -17,7 +19,9 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
17
19
|
return `import * as OffixReactHooks from "react-offix-hooks";`;
|
|
18
20
|
}
|
|
19
21
|
getDocumentNodeVariable(node, documentVariableName) {
|
|
20
|
-
return this.config.documentMode === visitor_plugin_common_1.DocumentMode.external
|
|
22
|
+
return this.config.documentMode === visitor_plugin_common_1.DocumentMode.external
|
|
23
|
+
? `Operations.${node.name.value}`
|
|
24
|
+
: documentVariableName;
|
|
21
25
|
}
|
|
22
26
|
getImports() {
|
|
23
27
|
const baseImports = super.getImports({ excludeFragments: true });
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extname } from 'path';
|
|
2
2
|
import { concatAST, Kind } from 'graphql';
|
|
3
|
+
import { oldVisit } from '@graphql-codegen/plugin-helpers';
|
|
3
4
|
import { ReactApolloVisitor } 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 = [
|
package/esm/visitor.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ClientSideBaseVisitor, DocumentMode, } from '@graphql-codegen/visitor-plugin-common';
|
|
2
1
|
import autoBind from 'auto-bind';
|
|
3
2
|
import { pascalCase } from 'change-case-all';
|
|
3
|
+
import { ClientSideBaseVisitor, DocumentMode, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
5
5
|
constructor(schema, fragments, rawConfig, documents) {
|
|
6
6
|
super(schema, fragments, rawConfig, {});
|
|
7
7
|
this.imports = new Set();
|
|
8
|
-
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
8
|
+
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
9
|
+
? `${this.config.importOperationTypesFrom}.`
|
|
10
|
+
: '';
|
|
9
11
|
this._documents = documents;
|
|
10
12
|
autoBind(this);
|
|
11
13
|
}
|
|
@@ -13,7 +15,9 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
13
15
|
return `import * as OffixReactHooks from "react-offix-hooks";`;
|
|
14
16
|
}
|
|
15
17
|
getDocumentNodeVariable(node, documentVariableName) {
|
|
16
|
-
return this.config.documentMode === DocumentMode.external
|
|
18
|
+
return this.config.documentMode === DocumentMode.external
|
|
19
|
+
? `Operations.${node.name.value}`
|
|
20
|
+
: documentVariableName;
|
|
17
21
|
}
|
|
18
22
|
getImports() {
|
|
19
23
|
const baseImports = super.getImports({ excludeFragments: true });
|
package/package.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-react-offix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha-20230524083052-08ce957b4",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating useOffline mutations for offix use",
|
|
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": "^
|
|
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
|
-
"change-case-all": "1.0.
|
|
13
|
+
"change-case-all": "1.0.15"
|
|
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/react-apollo-offix"
|
|
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",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginFunction, PluginValidateFn } from '@graphql-codegen/plugin-helpers';
|
|
2
2
|
import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
3
|
import { ReactApolloVisitor } from './visitor.cjs';
|
|
4
4
|
export declare const plugin: PluginFunction<RawClientSideBasePluginConfig>;
|
package/typings/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginFunction, PluginValidateFn } from '@graphql-codegen/plugin-helpers';
|
|
2
2
|
import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
3
|
import { ReactApolloVisitor } from './visitor.js';
|
|
4
4
|
export declare const plugin: PluginFunction<RawClientSideBasePluginConfig>;
|
package/typings/visitor.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
3
2
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment, RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export interface ReactApolloPluginConfig extends ClientSideBasePluginConfig {
|
|
5
5
|
}
|
|
6
6
|
export declare class ReactApolloVisitor extends ClientSideBaseVisitor<RawClientSideBasePluginConfig, ReactApolloPluginConfig> {
|
package/typings/visitor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
3
2
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment, RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export interface ReactApolloPluginConfig extends ClientSideBasePluginConfig {
|
|
5
5
|
}
|
|
6
6
|
export declare class ReactApolloVisitor extends ClientSideBaseVisitor<RawClientSideBasePluginConfig, ReactApolloPluginConfig> {
|