-
-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove location data from loaded documents to reduce document size (#…
- Loading branch information
Showing
5 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import { loadTypedefs } from '@graphql-tools/load'; | ||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'; | ||
import { concatAST } from 'graphql'; | ||
import { getOptions } from 'loader-utils'; | ||
|
||
export default function (this: any, path: string) { | ||
const callback = this.async(); | ||
|
||
this.cacheable(); | ||
|
||
const options = getOptions(this); | ||
|
||
loadTypedefs(path, { | ||
loaders: [new GraphQLFileLoader()], | ||
noLocation: true, | ||
...options, | ||
}).then(sources => { | ||
const documents = sources.map(source => source.document); | ||
const mergedDoc = concatAST(documents); | ||
return callback(null, `module.exports = ${JSON.stringify(mergedDoc)}`); | ||
return callback(null, `export default ${JSON.stringify(mergedDoc)}`); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2056,6 +2056,14 @@ | |
"@types/koa-compose" "*" | ||
"@types/node" "*" | ||
|
||
"@types/[email protected]": | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/@types/loader-utils/-/loader-utils-1.1.3.tgz#82b9163f2ead596c68a8c03e450fbd6e089df401" | ||
integrity sha512-euKGFr2oCB3ASBwG39CYJMR3N9T0nanVqXdiH7Zu/Nqddt6SmFRxytq/i2w9LQYNQekEtGBz+pE3qG6fQTNvRg== | ||
dependencies: | ||
"@types/node" "*" | ||
"@types/webpack" "*" | ||
|
||
"@types/[email protected]": | ||
version "4.14.156" | ||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.156.tgz#cbe30909c89a1feeb7c60803e785344ea0ec82d1" | ||
|
@@ -2209,6 +2217,18 @@ | |
"@types/source-list-map" "*" | ||
source-map "^0.6.1" | ||
|
||
"@types/webpack@*": | ||
version "4.41.17" | ||
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.17.tgz#0a69005e644d657c85b7d6ec1c826a71bebd1c93" | ||
integrity sha512-6FfeCidTSHozwKI67gIVQQ5Mp0g4X96c2IXxX75hYEQJwST/i6NyZexP//zzMOBb+wG9jJ7oO8fk9yObP2HWAw== | ||
dependencies: | ||
"@types/anymatch" "*" | ||
"@types/node" "*" | ||
"@types/tapable" "*" | ||
"@types/uglify-js" "*" | ||
"@types/webpack-sources" "*" | ||
source-map "^0.6.0" | ||
|
||
"@types/webpack@^4.41.0", "@types/webpack@^4.41.8": | ||
version "4.41.13" | ||
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.13.tgz#988d114c8913d039b8a0e0502a7fe4f1f84f3d5e" | ||
|
@@ -8241,6 +8261,15 @@ [email protected]: | |
emojis-list "^2.0.0" | ||
json5 "^1.0.1" | ||
|
||
[email protected], loader-utils@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0" | ||
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ== | ||
dependencies: | ||
big.js "^5.2.2" | ||
emojis-list "^3.0.0" | ||
json5 "^2.1.2" | ||
|
||
loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" | ||
|
@@ -8250,15 +8279,6 @@ loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: | |
emojis-list "^3.0.0" | ||
json5 "^1.0.1" | ||
|
||
loader-utils@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0" | ||
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ== | ||
dependencies: | ||
big.js "^5.2.2" | ||
emojis-list "^3.0.0" | ||
json5 "^2.1.2" | ||
|
||
locate-path@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" | ||
|