Skip to content

Commit 646606a

Browse files
committed
feat(graphql)!: use hook filters
BREAKING CHANGES: - drops support for rollup below v2.78.0
1 parent 5cc7fc5 commit 646606a

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

packages/graphql/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
],
5757
"peerDependencies": {
5858
"graphql": ">=0.9.0",
59-
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
59+
"rollup": "^2.78.0||^3.0.0||^4.0.0"
6060
},
6161
"peerDependenciesMeta": {
6262
"rollup": {

packages/graphql/src/index.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,31 @@ export default function graphql({ include, exclude } = {}) {
1111

1212
return {
1313
name: 'graphql',
14-
transform(source, id) {
15-
if (!filter(id)) return null;
16-
if (!filterExt.test(id)) return null;
14+
transform: {
15+
filter: {
16+
id: filterExt
17+
},
18+
handler(source, id) {
19+
if (!filter(id)) return null;
20+
if (!filterExt.test(id)) return null;
1721

18-
// XXX: this.cachable() in graphql-tag/loader
19-
const code = toESModules(
20-
loader.call(
21-
{
22-
cacheable() {}
23-
},
24-
source
25-
)
26-
);
22+
// XXX: this.cachable() in graphql-tag/loader
23+
const code = toESModules(
24+
loader.call(
25+
{
26+
cacheable() {}
27+
},
28+
source
29+
)
30+
);
2731

28-
const map = { mappings: '' };
32+
const map = { mappings: '' };
2933

30-
return {
31-
code,
32-
map
33-
};
34+
return {
35+
code,
36+
map
37+
};
38+
}
3439
}
3540
};
3641
}

0 commit comments

Comments
 (0)