Skip to content

Commit 3e3c7f8

Browse files
authored
Merge pull request #182 from croutonn/no-auto-bind
Remove auto-bind dependency
2 parents a807713 + 841e50a commit 3e3c7f8

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"module": "build/module/index.js",
88
"repository": "https://github.com/croutonn/graphql-codegen-plugin-typescript-swr",
99
"license": "MIT",
10+
"engines": {
11+
"node": ">=12.0.0"
12+
},
1013
"keywords": [
1114
"graphql",
1215
"codegen",
@@ -36,7 +39,6 @@
3639
"@graphql-codegen/plugin-helpers": "^2.0.0",
3740
"@graphql-codegen/visitor-plugin-common": "^2.0.0",
3841
"@types/micromatch": "^4.0.1",
39-
"auto-bind": "^4.0.0",
4042
"graphql-request": "^3.4.0",
4143
"micromatch": "^4.0.4",
4244
"pascal-case": "^3.1.2",

src/visitor.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
LoadedFragment,
66
ParsedConfig,
77
} from '@graphql-codegen/visitor-plugin-common'
8-
import autoBind from 'auto-bind'
98
import { GraphQLSchema, Kind, OperationDefinitionNode } from 'graphql'
109
import glob from 'micromatch'
1110
import { pascalCase } from 'pascal-case'
@@ -111,8 +110,6 @@ export class SWRVisitor extends ClientSideBaseVisitor<
111110
(Array.isArray(this.config.useSWRInfinite) &&
112111
this.config.useSWRInfinite.length > 0)
113112

114-
autoBind(this)
115-
116113
const typeImport = this.config.useTypeImports ? 'import type' : 'import'
117114

118115
this._additionalImports.push(

tests/visitor.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { GraphQLSchema } from 'graphql';
2+
import { SWRVisitor } from '../src/visitor'
3+
4+
describe('SWRVisitor', () => {
5+
describe('sdkContent', () => {
6+
it('should export SWRInfiniteKeyLoader', () => {
7+
const schema = new GraphQLSchema({
8+
})
9+
const visitor = new SWRVisitor(
10+
schema,
11+
[],
12+
{
13+
useSWRInfinite: ['_query_']
14+
}
15+
)
16+
expect(visitor.sdkContent).toContain('export type SWRInfiniteKeyLoader<Data = unknown,')
17+
})
18+
})
19+
});

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ asynckit@^0.4.0:
13061306
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
13071307
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
13081308

1309-
auto-bind@^4.0.0, auto-bind@~4.0.0:
1309+
auto-bind@~4.0.0:
13101310
version "4.0.0"
13111311
resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb"
13121312
integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ==

0 commit comments

Comments
 (0)