mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
28 lines
729 B
JavaScript
28 lines
729 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.KnownFragmentNamesRule = KnownFragmentNamesRule;
|
||
|
|
||
|
var _GraphQLError = require("../../error/GraphQLError");
|
||
|
|
||
|
/**
|
||
|
* Known fragment names
|
||
|
*
|
||
|
* A GraphQL document is only valid if all `...Fragment` fragment spreads refer
|
||
|
* to fragments defined in the same document.
|
||
|
*/
|
||
|
function KnownFragmentNamesRule(context) {
|
||
|
return {
|
||
|
FragmentSpread: function FragmentSpread(node) {
|
||
|
var fragmentName = node.name.value;
|
||
|
var fragment = context.getFragment(fragmentName);
|
||
|
|
||
|
if (!fragment) {
|
||
|
context.reportError(new _GraphQLError.GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name));
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|