graphql-tag 2.11.0 → 2.12.0

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.
@@ -0,0 +1,9 @@
1
+ # Please see the documentation for all configuration options:
2
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3
+
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: "npm"
7
+ directory: "/" # Location of package manifests
8
+ schedule:
9
+ interval: "daily"
@@ -0,0 +1,29 @@
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: Node.js CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ main ]
9
+ pull_request:
10
+ branches: [ main ]
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+
16
+ strategy:
17
+ matrix:
18
+ node-version: [10.x, 12.x, 14.x, 15.x]
19
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Use Node.js ${{ matrix.node-version }}
24
+ uses: actions/setup-node@v1
25
+ with:
26
+ node-version: ${{ matrix.node-version }}
27
+ - run: npm ci
28
+ - run: npm run build --if-present
29
+ - run: npm test
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ### v2.12.0
4
+
5
+ * The `graphql-tag` repository has been converted to TypeScript, adding type safety and enabling both ECMAScript and CommonJS module exports. While these changes are intended to be as backwards-compatible as possible, we decided to bump the minor version to reflect the significant refactoring. <br/>
6
+ [@PowerKiKi](http://github.com/PowerKiKi) and [@benjamn](http://github.com/benjamn) in [#325](https://github.com/apollographql/graphql-tag/pull/325)
7
+
3
8
  ### v2.11.0 (2020-07-28)
4
9
 
5
10
  * `package.json` `sideEffects` changes to clearly identify that `graphql-tag` doesn't have side effects. <br/>
package/README.md CHANGED
@@ -8,7 +8,7 @@ Helpful utilities for parsing GraphQL queries. Includes:
8
8
  - `gql` A JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST.
9
9
  - `/loader` A webpack loader to preprocess queries
10
10
 
11
- `graphql-tag` uses [the reference `graphql` library](https://github.com/graphql/graphql-js) under the hood as a peer dependency, so in addition to installing this module, you'll also have to install `graphql-js`.
11
+ `graphql-tag` uses [the reference `graphql` library](https://github.com/graphql/graphql-js) under the hood as a peer dependency, so in addition to installing this module, you'll also have to install `graphql`.
12
12
 
13
13
  ### gql
14
14
 
@@ -1,189 +1,131 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (factory());
5
- }(this, (function () { 'use strict';
6
-
7
- var parser = require('graphql/language/parser');
8
-
9
- var parse = parser.parse;
10
-
11
- // Strip insignificant whitespace
12
- // Note that this could do a lot more, such as reorder fields etc.
13
- function normalize(string) {
14
- return string.replace(/[\s,]+/g, ' ').trim();
15
- }
16
-
17
- // A map docString -> graphql document
18
- var docCache = {};
19
-
20
- // A map fragmentName -> [normalized source]
21
- var fragmentSourceMap = {};
22
-
23
- function cacheKeyFromLoc(loc) {
24
- return normalize(loc.source.body.substring(loc.start, loc.end));
25
- }
26
-
27
- // For testing.
28
- function resetCaches() {
29
- docCache = {};
30
- fragmentSourceMap = {};
31
- }
32
-
33
- // Take a unstripped parsed document (query/mutation or even fragment), and
34
- // check all fragment definitions, checking for name->source uniqueness.
35
- // We also want to make sure only unique fragments exist in the document.
36
- var printFragmentWarnings = true;
37
- function processFragments(ast) {
38
- var astFragmentMap = {};
39
- var definitions = [];
40
-
41
- for (var i = 0; i < ast.definitions.length; i++) {
42
- var fragmentDefinition = ast.definitions[i];
43
-
44
- if (fragmentDefinition.kind === 'FragmentDefinition') {
45
- var fragmentName = fragmentDefinition.name.value;
46
- var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
47
-
48
- // We know something about this fragment
49
- if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) {
50
-
51
- // this is a problem because the app developer is trying to register another fragment with
52
- // the same name as one previously registered. So, we tell them about it.
53
- if (printFragmentWarnings) {
54
- console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
55
- + "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
56
- + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('graphql')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'graphql'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['graphql-tag'] = {}, global.tslib, global.graphql));
5
+ }(this, (function (exports, tslib, graphql) { 'use strict';
6
+
7
+ var docCache = new Map();
8
+ var fragmentSourceMap = new Map();
9
+ var printFragmentWarnings = true;
10
+ var experimentalFragmentVariables = false;
11
+ function normalize(string) {
12
+ return string.replace(/[\s,]+/g, ' ').trim();
13
+ }
14
+ function cacheKeyFromLoc(loc) {
15
+ return normalize(loc.source.body.substring(loc.start, loc.end));
16
+ }
17
+ function processFragments(ast) {
18
+ var seenKeys = new Set();
19
+ var definitions = [];
20
+ ast.definitions.forEach(function (fragmentDefinition) {
21
+ if (fragmentDefinition.kind === 'FragmentDefinition') {
22
+ var fragmentName = fragmentDefinition.name.value;
23
+ var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
24
+ var sourceKeySet = fragmentSourceMap.get(fragmentName);
25
+ if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
26
+ if (printFragmentWarnings) {
27
+ console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
28
+ + "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
29
+ + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
30
+ }
31
+ }
32
+ else if (!sourceKeySet) {
33
+ fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
34
+ }
35
+ sourceKeySet.add(sourceKey);
36
+ if (!seenKeys.has(sourceKey)) {
37
+ seenKeys.add(sourceKey);
38
+ definitions.push(fragmentDefinition);
39
+ }
40
+ }
41
+ else {
42
+ definitions.push(fragmentDefinition);
43
+ }
44
+ });
45
+ return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions });
46
+ }
47
+ function stripLoc(doc) {
48
+ var workSet = new Set(doc.definitions);
49
+ workSet.forEach(function (node) {
50
+ if (node.loc)
51
+ delete node.loc;
52
+ Object.keys(node).forEach(function (key) {
53
+ var value = node[key];
54
+ if (value && typeof value === 'object') {
55
+ workSet.add(value);
56
+ }
57
+ });
58
+ });
59
+ var loc = doc.loc;
60
+ if (loc) {
61
+ delete loc.startToken;
62
+ delete loc.endToken;
57
63
  }
58
-
59
- fragmentSourceMap[fragmentName][sourceKey] = true;
60
-
61
- } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) {
62
- fragmentSourceMap[fragmentName] = {};
63
- fragmentSourceMap[fragmentName][sourceKey] = true;
64
- }
65
-
66
- if (!astFragmentMap[sourceKey]) {
67
- astFragmentMap[sourceKey] = true;
68
- definitions.push(fragmentDefinition);
69
- }
70
- } else {
71
- definitions.push(fragmentDefinition);
64
+ return doc;
72
65
  }
73
- }
74
-
75
- ast.definitions = definitions;
76
- return ast;
77
- }
78
-
79
- function disableFragmentWarnings() {
80
- printFragmentWarnings = false;
81
- }
82
-
83
- function stripLoc(doc, removeLocAtThisLevel) {
84
- var docType = Object.prototype.toString.call(doc);
85
-
86
- if (docType === '[object Array]') {
87
- return doc.map(function (d) {
88
- return stripLoc(d, removeLocAtThisLevel);
89
- });
90
- }
91
-
92
- if (docType !== '[object Object]') {
93
- throw new Error('Unexpected input.');
94
- }
95
-
96
- // We don't want to remove the root loc field so we can use it
97
- // for fragment substitution (see below)
98
- if (removeLocAtThisLevel && doc.loc) {
99
- delete doc.loc;
100
- }
101
-
102
- // https://github.com/apollographql/graphql-tag/issues/40
103
- if (doc.loc) {
104
- delete doc.loc.startToken;
105
- delete doc.loc.endToken;
106
- }
107
-
108
- var keys = Object.keys(doc);
109
- var key;
110
- var value;
111
- var valueType;
112
-
113
- for (key in keys) {
114
- if (keys.hasOwnProperty(key)) {
115
- value = doc[keys[key]];
116
- valueType = Object.prototype.toString.call(value);
117
-
118
- if (valueType === '[object Object]' || valueType === '[object Array]') {
119
- doc[keys[key]] = stripLoc(value, true);
120
- }
66
+ function parseDocument(source) {
67
+ var cacheKey = normalize(source);
68
+ if (!docCache.has(cacheKey)) {
69
+ var parsed = graphql.parse(source, {
70
+ experimentalFragmentVariables: experimentalFragmentVariables
71
+ });
72
+ if (!parsed || parsed.kind !== 'Document') {
73
+ throw new Error('Not a valid GraphQL document.');
74
+ }
75
+ docCache.set(cacheKey, stripLoc(processFragments(parsed)));
76
+ }
77
+ return docCache.get(cacheKey);
121
78
  }
122
- }
123
-
124
- return doc;
125
- }
126
-
127
- var experimentalFragmentVariables = false;
128
- function parseDocument(doc) {
129
- var cacheKey = normalize(doc);
130
-
131
- if (docCache[cacheKey]) {
132
- return docCache[cacheKey];
133
- }
134
-
135
- var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables });
136
- if (!parsed || parsed.kind !== 'Document') {
137
- throw new Error('Not a valid GraphQL document.');
138
- }
139
-
140
- // check that all "new" fragments inside the documents are consistent with
141
- // existing fragments of the same name
142
- parsed = processFragments(parsed);
143
- parsed = stripLoc(parsed, false);
144
- docCache[cacheKey] = parsed;
145
-
146
- return parsed;
147
- }
148
-
149
- function enableExperimentalFragmentVariables() {
150
- experimentalFragmentVariables = true;
151
- }
152
-
153
- function disableExperimentalFragmentVariables() {
154
- experimentalFragmentVariables = false;
155
- }
156
-
157
- // XXX This should eventually disallow arbitrary string interpolation, like Relay does
158
- function gql(/* arguments */) {
159
- var args = Array.prototype.slice.call(arguments);
160
-
161
- var literals = args[0];
162
-
163
- // We always get literals[0] and then matching post literals for each arg given
164
- var result = (typeof(literals) === "string") ? literals : literals[0];
165
-
166
- for (var i = 1; i < args.length; i++) {
167
- if (args[i] && args[i].kind && args[i].kind === 'Document') {
168
- result += args[i].loc.source.body;
169
- } else {
170
- result += args[i];
79
+ function gql(literals) {
80
+ var args = [];
81
+ for (var _i = 1; _i < arguments.length; _i++) {
82
+ args[_i - 1] = arguments[_i];
83
+ }
84
+ if (typeof literals === 'string') {
85
+ literals = [literals];
86
+ }
87
+ var result = literals[0];
88
+ args.forEach(function (arg, i) {
89
+ if (arg && arg.kind === 'Document') {
90
+ result += arg.loc.source.body;
91
+ }
92
+ else {
93
+ result += arg;
94
+ }
95
+ result += literals[i + 1];
96
+ });
97
+ return parseDocument(result);
171
98
  }
99
+ function resetCaches() {
100
+ docCache.clear();
101
+ fragmentSourceMap.clear();
102
+ }
103
+ function disableFragmentWarnings() {
104
+ printFragmentWarnings = false;
105
+ }
106
+ function enableExperimentalFragmentVariables() {
107
+ experimentalFragmentVariables = true;
108
+ }
109
+ function disableExperimentalFragmentVariables() {
110
+ experimentalFragmentVariables = false;
111
+ }
112
+ var index = Object.assign(gql, {
113
+ gql: gql,
114
+ "default": gql,
115
+ resetCaches: resetCaches,
116
+ disableFragmentWarnings: disableFragmentWarnings,
117
+ enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,
118
+ disableExperimentalFragmentVariables: disableExperimentalFragmentVariables
119
+ });
172
120
 
173
- result += literals[i];
174
- }
175
-
176
- return parseDocument(result);
177
- }
178
-
179
- // Support typescript, which isn't as nice as Babel about default exports
180
- gql.default = gql;
181
- gql.resetCaches = resetCaches;
182
- gql.disableFragmentWarnings = disableFragmentWarnings;
183
- gql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;
184
- gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;
121
+ exports.default = index;
122
+ exports.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;
123
+ exports.disableFragmentWarnings = disableFragmentWarnings;
124
+ exports.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;
125
+ exports.gql = gql;
126
+ exports.resetCaches = resetCaches;
185
127
 
186
- module.exports = gql;
128
+ Object.defineProperty(exports, '__esModule', { value: true });
187
129
 
188
130
  })));
189
131
  //# sourceMappingURL=graphql-tag.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-tag.umd.js","sources":["../src/index.js"],"sourcesContent":["var parser = require('graphql/language/parser');\n\nvar parse = parser.parse;\n\n// Strip insignificant whitespace\n// Note that this could do a lot more, such as reorder fields etc.\nfunction normalize(string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\n\n// A map docString -> graphql document\nvar docCache = {};\n\n// A map fragmentName -> [normalized source]\nvar fragmentSourceMap = {};\n\nfunction cacheKeyFromLoc(loc) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\n\n// For testing.\nfunction resetCaches() {\n docCache = {};\n fragmentSourceMap = {};\n}\n\n// Take a unstripped parsed document (query/mutation or even fragment), and\n// check all fragment definitions, checking for name->source uniqueness.\n// We also want to make sure only unique fragments exist in the document.\nvar printFragmentWarnings = true;\nfunction processFragments(ast) {\n var astFragmentMap = {};\n var definitions = [];\n\n for (var i = 0; i < ast.definitions.length; i++) {\n var fragmentDefinition = ast.definitions[i];\n\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);\n\n // We know something about this fragment\n if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) {\n\n // this is a problem because the app developer is trying to register another fragment with\n // the same name as one previously registered. So, we tell them about it.\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n\n fragmentSourceMap[fragmentName][sourceKey] = true;\n\n } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) {\n fragmentSourceMap[fragmentName] = {};\n fragmentSourceMap[fragmentName][sourceKey] = true;\n }\n\n if (!astFragmentMap[sourceKey]) {\n astFragmentMap[sourceKey] = true;\n definitions.push(fragmentDefinition);\n }\n } else {\n definitions.push(fragmentDefinition);\n }\n }\n\n ast.definitions = definitions;\n return ast;\n}\n\nfunction disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\n\nfunction stripLoc(doc, removeLocAtThisLevel) {\n var docType = Object.prototype.toString.call(doc);\n\n if (docType === '[object Array]') {\n return doc.map(function (d) {\n return stripLoc(d, removeLocAtThisLevel);\n });\n }\n\n if (docType !== '[object Object]') {\n throw new Error('Unexpected input.');\n }\n\n // We don't want to remove the root loc field so we can use it\n // for fragment substitution (see below)\n if (removeLocAtThisLevel && doc.loc) {\n delete doc.loc;\n }\n\n // https://github.com/apollographql/graphql-tag/issues/40\n if (doc.loc) {\n delete doc.loc.startToken;\n delete doc.loc.endToken;\n }\n\n var keys = Object.keys(doc);\n var key;\n var value;\n var valueType;\n\n for (key in keys) {\n if (keys.hasOwnProperty(key)) {\n value = doc[keys[key]];\n valueType = Object.prototype.toString.call(value);\n\n if (valueType === '[object Object]' || valueType === '[object Array]') {\n doc[keys[key]] = stripLoc(value, true);\n }\n }\n }\n\n return doc;\n}\n\nvar experimentalFragmentVariables = false;\nfunction parseDocument(doc) {\n var cacheKey = normalize(doc);\n\n if (docCache[cacheKey]) {\n return docCache[cacheKey];\n }\n\n var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables });\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n\n // check that all \"new\" fragments inside the documents are consistent with\n // existing fragments of the same name\n parsed = processFragments(parsed);\n parsed = stripLoc(parsed, false);\n docCache[cacheKey] = parsed;\n\n return parsed;\n}\n\nfunction enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\n\nfunction disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\n\n// XXX This should eventually disallow arbitrary string interpolation, like Relay does\nfunction gql(/* arguments */) {\n var args = Array.prototype.slice.call(arguments);\n\n var literals = args[0];\n\n // We always get literals[0] and then matching post literals for each arg given\n var result = (typeof(literals) === \"string\") ? literals : literals[0];\n\n for (var i = 1; i < args.length; i++) {\n if (args[i] && args[i].kind && args[i].kind === 'Document') {\n result += args[i].loc.source.body;\n } else {\n result += args[i];\n }\n\n result += literals[i];\n }\n\n return parseDocument(result);\n}\n\n// Support typescript, which isn't as nice as Babel about default exports\ngql.default = gql;\ngql.resetCaches = resetCaches;\ngql.disableFragmentWarnings = disableFragmentWarnings;\ngql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;\ngql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;\n\nmodule.exports = gql;\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;;AAEhD,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;;;;AAIzB,SAAS,SAAS,CAAC,MAAM,EAAE;EACzB,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;CAC9C;;;AAGD,IAAI,QAAQ,GAAG,EAAE,CAAC;;;AAGlB,IAAI,iBAAiB,GAAG,EAAE,CAAC;;AAE3B,SAAS,eAAe,CAAC,GAAG,EAAE;EAC5B,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;CACjE;;;AAGD,SAAS,WAAW,GAAG;EACrB,QAAQ,GAAG,EAAE,CAAC;EACd,iBAAiB,GAAG,EAAE,CAAC;CACxB;;;;;AAKD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,SAAS,gBAAgB,CAAC,GAAG,EAAE;EAC7B,IAAI,cAAc,GAAG,EAAE,CAAC;EACxB,IAAI,WAAW,GAAG,E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,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE;MAC1D,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;KACnC,MAAM;MACL,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;KACnB;;IAED,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;GACvB;;EAED,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B;;;AAGD,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC;AAClB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;AAC9B,GAAG,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;AACtD,GAAG,CAAC,mCAAmC,GAAG,mCAAmC,CAAC;AAC9E,GAAG,CAAC,oCAAoC,GAAG,oCAAoC,CAAC;;AAEhF,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;;;;"}
1
+ {"version":3,"file":"graphql-tag.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { parse } from 'graphql';\n\nimport type {\n DocumentNode,\n DefinitionNode,\n Location,\n} from 'graphql/language/ast';\n\n// A map docString -> graphql document\nconst docCache = new Map<string, DocumentNode>();\n\n// A map fragmentName -> [normalized source]\nconst fragmentSourceMap = new Map<string, Set<string>>();\n\nlet printFragmentWarnings = true;\nlet experimentalFragmentVariables = false;\n\n// Strip insignificant whitespace\n// Note that this could do a lot more, such as reorder fields etc.\nfunction normalize(string: string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\n\nfunction cacheKeyFromLoc(loc: Location) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\n\n// Take a unstripped parsed document (query/mutation or even fragment), and\n// check all fragment definitions, checking for name->source uniqueness.\n// We also want to make sure only unique fragments exist in the document.\nfunction processFragments(ast: DocumentNode) {\n const seenKeys = new Set<string>();\n const definitions: DefinitionNode[] = [];\n\n ast.definitions.forEach(fragmentDefinition => {\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc!);\n\n // We know something about this fragment\n let sourceKeySet = fragmentSourceMap.get(fragmentName)!;\n if (sourceKeySet && !sourceKeySet.has(sourceKey)) {\n // this is a problem because the app developer is trying to register another fragment with\n // the same name as one previously registered. So, we tell them about it.\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n } else if (!sourceKeySet) {\n fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);\n }\n\n sourceKeySet.add(sourceKey);\n\n if (!seenKeys.has(sourceKey)) {\n seenKeys.add(sourceKey);\n definitions.push(fragmentDefinition);\n }\n } else {\n definitions.push(fragmentDefinition);\n }\n });\n\n return {\n ...ast,\n definitions,\n };\n}\n\nfunction stripLoc(doc: DocumentNode) {\n const workSet = new Set<Record<string, any>>(doc.definitions);\n\n workSet.forEach(node => {\n if (node.loc) delete node.loc;\n Object.keys(node).forEach(key => {\n const value = node[key];\n if (value && typeof value === 'object') {\n workSet.add(value);\n }\n });\n });\n\n const loc = doc.loc as Record<string, any>;\n if (loc) {\n delete loc.startToken;\n delete loc.endToken;\n }\n\n return doc;\n}\n\nfunction parseDocument(source: string) {\n var cacheKey = normalize(source);\n if (!docCache.has(cacheKey)) {\n const parsed = parse(source, {\n experimentalFragmentVariables,\n });\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n docCache.set(\n cacheKey,\n // check that all \"new\" fragments inside the documents are consistent with\n // existing fragments of the same name\n stripLoc(processFragments(parsed)),\n );\n }\n return docCache.get(cacheKey)!;\n}\n\n// XXX This should eventually disallow arbitrary string interpolation, like Relay does\nexport function gql(\n literals: string | readonly string[],\n ...args: any[]\n) {\n\n if (typeof literals === 'string') {\n literals = [literals];\n }\n\n let result = literals[0];\n\n args.forEach((arg, i) => {\n if (arg && arg.kind === 'Document') {\n result += arg.loc.source.body;\n } else {\n result += arg;\n }\n result += literals[i + 1];\n });\n\n return parseDocument(result);\n}\n\nexport function resetCaches() {\n docCache.clear();\n fragmentSourceMap.clear();\n}\n\nexport function disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\n\nexport function enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\n\nexport function disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\n\nexport default Object.assign(gql, {\n gql,\n default: gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n});\n"],"names":["parse"],"mappings":";;;;;;IASA,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;IACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;IAI1C,SAAS,SAAS,CAAC,MAAc;QAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;IAED,SAAS,eAAe,CAAC,GAAa;QACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,CAAC;IAKD,SAAS,gBAAgB,CAAC,GAAiB;QACzC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACnC,IAAM,WAAW,GAAqB,EAAE,CAAC;QAEzC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,kBAAkB;YACxC,IAAI,kBAAkB,CAAC,IAA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AI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;gBAClC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;aAC/B;iBAAM;gBACL,MAAM,IAAI,GAAG,CAAC;aACf;YACD,MAAM,IAAI,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SAC3B,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;aAEe,WAAW;QACzB,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;aAEe,uBAAuB;QACrC,qBAAqB,GAAG,KAAK,CAAC;IAChC,CAAC;aAEe,mCAAmC;QACjD,6BAA6B,GAAG,IAAI,CAAC;IACvC,CAAC;aAEe,oCAAoC;QAClD,6BAA6B,GAAG,KAAK,CAAC;IACxC,CAAC;AAED,gBAAe,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;QAChC,GAAG,KAAA;QACH,SAAO,EAAE,GAAG;QACZ,WAAW,aAAA;QACX,uBAAuB,yBAAA;QACvB,mCAAmC,qCAAA;QACnC,oCAAoC,sCAAA;KACrC,CAAC;;;;;;;;;;;;;;;"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { DocumentNode } from 'graphql/language/ast';
2
+ export declare function gql(literals: string | readonly string[], ...args: any[]): DocumentNode;
3
+ export declare function resetCaches(): void;
4
+ export declare function disableFragmentWarnings(): void;
5
+ export declare function enableExperimentalFragmentVariables(): void;
6
+ export declare function disableExperimentalFragmentVariables(): void;
7
+ declare const _default: typeof gql & {
8
+ gql: typeof gql;
9
+ default: typeof gql;
10
+ resetCaches: typeof resetCaches;
11
+ disableFragmentWarnings: typeof disableFragmentWarnings;
12
+ enableExperimentalFragmentVariables: typeof enableExperimentalFragmentVariables;
13
+ disableExperimentalFragmentVariables: typeof disableExperimentalFragmentVariables;
14
+ };
15
+ export default _default;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,sBAAsB,CAAC;AA0G9B,wBAAgB,GAAG,CACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACpC,GAAG,IAAI,EAAE,GAAG,EAAE,gBAmBf;AAED,wBAAgB,WAAW,SAG1B;AAED,wBAAgB,uBAAuB,SAEtC;AAED,wBAAgB,mCAAmC,SAElD;AAED,wBAAgB,oCAAoC,SAEnD;;;;;;;;;AAED,wBAOG"}
package/lib/index.js ADDED
@@ -0,0 +1,116 @@
1
+ import { __assign } from "tslib";
2
+ import { parse } from 'graphql';
3
+ var docCache = new Map();
4
+ var fragmentSourceMap = new Map();
5
+ var printFragmentWarnings = true;
6
+ var experimentalFragmentVariables = false;
7
+ function normalize(string) {
8
+ return string.replace(/[\s,]+/g, ' ').trim();
9
+ }
10
+ function cacheKeyFromLoc(loc) {
11
+ return normalize(loc.source.body.substring(loc.start, loc.end));
12
+ }
13
+ function processFragments(ast) {
14
+ var seenKeys = new Set();
15
+ var definitions = [];
16
+ ast.definitions.forEach(function (fragmentDefinition) {
17
+ if (fragmentDefinition.kind === 'FragmentDefinition') {
18
+ var fragmentName = fragmentDefinition.name.value;
19
+ var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
20
+ var sourceKeySet = fragmentSourceMap.get(fragmentName);
21
+ if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
22
+ if (printFragmentWarnings) {
23
+ console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
24
+ + "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
25
+ + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
26
+ }
27
+ }
28
+ else if (!sourceKeySet) {
29
+ fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
30
+ }
31
+ sourceKeySet.add(sourceKey);
32
+ if (!seenKeys.has(sourceKey)) {
33
+ seenKeys.add(sourceKey);
34
+ definitions.push(fragmentDefinition);
35
+ }
36
+ }
37
+ else {
38
+ definitions.push(fragmentDefinition);
39
+ }
40
+ });
41
+ return __assign(__assign({}, ast), { definitions: definitions });
42
+ }
43
+ function stripLoc(doc) {
44
+ var workSet = new Set(doc.definitions);
45
+ workSet.forEach(function (node) {
46
+ if (node.loc)
47
+ delete node.loc;
48
+ Object.keys(node).forEach(function (key) {
49
+ var value = node[key];
50
+ if (value && typeof value === 'object') {
51
+ workSet.add(value);
52
+ }
53
+ });
54
+ });
55
+ var loc = doc.loc;
56
+ if (loc) {
57
+ delete loc.startToken;
58
+ delete loc.endToken;
59
+ }
60
+ return doc;
61
+ }
62
+ function parseDocument(source) {
63
+ var cacheKey = normalize(source);
64
+ if (!docCache.has(cacheKey)) {
65
+ var parsed = parse(source, {
66
+ experimentalFragmentVariables: experimentalFragmentVariables
67
+ });
68
+ if (!parsed || parsed.kind !== 'Document') {
69
+ throw new Error('Not a valid GraphQL document.');
70
+ }
71
+ docCache.set(cacheKey, stripLoc(processFragments(parsed)));
72
+ }
73
+ return docCache.get(cacheKey);
74
+ }
75
+ export function gql(literals) {
76
+ var args = [];
77
+ for (var _i = 1; _i < arguments.length; _i++) {
78
+ args[_i - 1] = arguments[_i];
79
+ }
80
+ if (typeof literals === 'string') {
81
+ literals = [literals];
82
+ }
83
+ var result = literals[0];
84
+ args.forEach(function (arg, i) {
85
+ if (arg && arg.kind === 'Document') {
86
+ result += arg.loc.source.body;
87
+ }
88
+ else {
89
+ result += arg;
90
+ }
91
+ result += literals[i + 1];
92
+ });
93
+ return parseDocument(result);
94
+ }
95
+ export function resetCaches() {
96
+ docCache.clear();
97
+ fragmentSourceMap.clear();
98
+ }
99
+ export function disableFragmentWarnings() {
100
+ printFragmentWarnings = false;
101
+ }
102
+ export function enableExperimentalFragmentVariables() {
103
+ experimentalFragmentVariables = true;
104
+ }
105
+ export function disableExperimentalFragmentVariables() {
106
+ experimentalFragmentVariables = false;
107
+ }
108
+ export default Object.assign(gql, {
109
+ gql: gql,
110
+ "default": gql,
111
+ resetCaches: resetCaches,
112
+ disableFragmentWarnings: disableFragmentWarnings,
113
+ enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,
114
+ disableExperimentalFragmentVariables: disableExperimentalFragmentVariables
115
+ });
116
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAShC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAI1C,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AAKD,SAAS,gBAAgB,CAAC,GAAiB;IACzC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAM,WAAW,GAAqB,EAAE,CAAC;IAEzC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,kBAAkB;QACxC,IAAI,kBAAkB,CAAC,IAAI,KAAK,oBAAoB,EAAE;YACpD,IAAI,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,IAAI,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAI,CAAC,CAA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