You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
50 KiB

4 years ago
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e=e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.graphql={}))}(this,(function(e){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var t=function(e,n){var t=new SyntaxError(e+" ("+n.start.line+":"+n.start.column+")");return t.loc=n,t};var i=function(e){return/^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(e)};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,n){return e(n={exports:{}},n.exports),n.exports}var a=o((function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,n){if(!Boolean(e))throw new Error(n)}}));r(a);var s=o((function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){"function"==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return this.constructor.name}})}}));r(s);var c=o((function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Source=void 0;var t=r(a),i=r(s);function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e,n,i){this.body=e,this.name=n||"GraphQL request",this.locationOffset=i||{line:1,column:1},this.locationOffset.line>0||(0,t.default)(0,"line in locationOffset is 1-indexed and must be positive"),this.locationOffset.column>0||(0,t.default)(0,"column in locationOffset is 1-indexed and must be positive")};n.Source=o,(0,i.default)(o)}));r(c);c.Source;var u=o((function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getLocation=function(e,n){var t,i=/\r\n|[\n\r]/g,r=1,o=n+1;for(;(t=i.exec(e.body))&&t.index<n;)r+=1,o=n+1-(t.index+t[0].length);return{line:r,column:o}}}));r(u);u.getLocation;var l=o((function(e,n){function t(e,n){var t=e.locationOffset.column-1,o=r(t)+e.body,a=n.line-1,s=e.locationOffset.line-1,c=n.line+s,u=1===n.line?t:0,l=n.column+u,d="".concat(e.name,":").concat(c,":").concat(l,"\n"),p=o.split(/\r\n|[\n\r]/g),f=p[a];if(f.length>120){for(var h=Math.floor(l/80),T=l%80,v=[],E=0;E<f.length;E+=80)v.push(f.slice(E,E+80));return d+i([["".concat(c),v[0]]].concat(v.slice(1,h+1).map((function(e){return["",e]})),[[" ",r(T-1)+"^"],["",v[h+1]]]))}return d+i([["".concat(c-1),p[a-1]],["".concat(c),f],["",r(l-1)+"^"],["".concat(c+1),p[a+1]]])}function i(e){var n=e.filter((function(e){e[0];return void 0!==e[1]})),t=Math.max.apply(Math,n.map((function(e){return e[0].length})));return n.map((function(e){var n,i=e[0],o=e[1];return r(t-(n=i).length)+n+(o?" | "+o:" |")})).join("\n")}function r(e){return Array(e+1).join(" ")}Object.defineProperty(n,"__esModule",{value:!0}),n.printLocation=function(e){return t(e.source,(0,u.getLocation)(e.source,e.start))},n.printSourceLocation=t}));r(l);l.printLocation,l.printSourceLocation;var d=o((function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Kind=void 0;var t=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITI