@graphql-tools/utils 7.0.1-alpha-5036b91e.0 → 7.0.2
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.
- package/es5/index.cjs.js +67 -45
- package/es5/index.cjs.js.map +1 -1
- package/es5/index.esm.js +67 -45
- package/es5/index.esm.js.map +1 -1
- package/es5/observableToAsyncIterable.d.ts +1 -1
- package/es5/package.json +1 -1
- package/index.cjs.js +65 -44
- package/index.cjs.js.map +1 -1
- package/index.esm.js +65 -44
- package/index.esm.js.map +1 -1
- package/observableToAsyncIterable.d.ts +1 -1
- package/package.json +1 -1
package/es5/index.cjs.js
CHANGED
|
@@ -714,7 +714,7 @@ function dedentBlockStringValue(rawString) {
|
|
|
714
714
|
// Expand a block string's raw value into independent lines.
|
|
715
715
|
var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first.
|
|
716
716
|
|
|
717
|
-
var commonIndent = getBlockStringIndentation(
|
|
717
|
+
var commonIndent = getBlockStringIndentation(rawString);
|
|
718
718
|
|
|
719
719
|
if (commonIndent !== 0) {
|
|
720
720
|
for (var i = 1; i < lines.length; i++) {
|
|
@@ -723,56 +723,78 @@ function dedentBlockStringValue(rawString) {
|
|
|
723
723
|
} // Remove leading and trailing blank lines.
|
|
724
724
|
|
|
725
725
|
|
|
726
|
-
|
|
727
|
-
|
|
726
|
+
var startLine = 0;
|
|
727
|
+
|
|
728
|
+
while (startLine < lines.length && isBlank(lines[startLine])) {
|
|
729
|
+
++startLine;
|
|
728
730
|
}
|
|
729
731
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
+
var endLine = lines.length;
|
|
733
|
+
|
|
734
|
+
while (endLine > startLine && isBlank(lines[endLine - 1])) {
|
|
735
|
+
--endLine;
|
|
732
736
|
} // Return a string of the lines joined with U+000A.
|
|
733
737
|
|
|
734
738
|
|
|
735
|
-
return lines.join('\n');
|
|
739
|
+
return lines.slice(startLine, endLine).join('\n');
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function isBlank(str) {
|
|
743
|
+
for (var i = 0; i < str.length; ++i) {
|
|
744
|
+
if (str[i] !== ' ' && str[i] !== '\t') {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
return true;
|
|
736
750
|
}
|
|
737
751
|
/**
|
|
738
752
|
* @internal
|
|
739
753
|
*/
|
|
740
754
|
|
|
741
|
-
function getBlockStringIndentation(lines) {
|
|
742
|
-
var commonIndent = null;
|
|
743
755
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
var indent = leadingWhitespace(line);
|
|
756
|
+
function getBlockStringIndentation(value) {
|
|
757
|
+
var _commonIndent;
|
|
747
758
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
759
|
+
var isFirstLine = true;
|
|
760
|
+
var isEmptyLine = true;
|
|
761
|
+
var indent = 0;
|
|
762
|
+
var commonIndent = null;
|
|
763
|
+
|
|
764
|
+
for (var i = 0; i < value.length; ++i) {
|
|
765
|
+
switch (value.charCodeAt(i)) {
|
|
766
|
+
case 13:
|
|
767
|
+
// \r
|
|
768
|
+
if (value.charCodeAt(i + 1) === 10) {
|
|
769
|
+
++i; // skip \r\n as one symbol
|
|
770
|
+
}
|
|
751
771
|
|
|
752
|
-
|
|
753
|
-
commonIndent = indent;
|
|
772
|
+
// falls through
|
|
754
773
|
|
|
755
|
-
|
|
774
|
+
case 10:
|
|
775
|
+
// \n
|
|
776
|
+
isFirstLine = false;
|
|
777
|
+
isEmptyLine = true;
|
|
778
|
+
indent = 0;
|
|
756
779
|
break;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
780
|
|
|
761
|
-
|
|
762
|
-
}
|
|
781
|
+
case 9: // \t
|
|
763
782
|
|
|
764
|
-
|
|
765
|
-
|
|
783
|
+
case 32:
|
|
784
|
+
// <space>
|
|
785
|
+
++indent;
|
|
786
|
+
break;
|
|
766
787
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
788
|
+
default:
|
|
789
|
+
if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {
|
|
790
|
+
commonIndent = indent;
|
|
791
|
+
}
|
|
770
792
|
|
|
771
|
-
|
|
772
|
-
}
|
|
793
|
+
isEmptyLine = false;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
773
796
|
|
|
774
|
-
|
|
775
|
-
return leadingWhitespace(str) === str.length;
|
|
797
|
+
return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;
|
|
776
798
|
}
|
|
777
799
|
|
|
778
800
|
function parseGraphQLSDL(location, rawSDL, options) {
|
|
@@ -3606,21 +3628,21 @@ function observableToAsyncIterable(observable) {
|
|
|
3606
3628
|
pushQueue.length = 0;
|
|
3607
3629
|
}
|
|
3608
3630
|
};
|
|
3609
|
-
return _a = {
|
|
3631
|
+
return _a = {
|
|
3632
|
+
next: function () {
|
|
3633
|
+
return listening ? pullValue() : this.return();
|
|
3634
|
+
},
|
|
3635
|
+
return: function () {
|
|
3636
|
+
emptyQueue();
|
|
3637
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
3638
|
+
},
|
|
3639
|
+
throw: function (error) {
|
|
3640
|
+
emptyQueue();
|
|
3641
|
+
return Promise.reject(error);
|
|
3642
|
+
}
|
|
3643
|
+
},
|
|
3610
3644
|
_a[Symbol.asyncIterator] = function () {
|
|
3611
|
-
return
|
|
3612
|
-
next: function () {
|
|
3613
|
-
return listening ? pullValue() : this.return();
|
|
3614
|
-
},
|
|
3615
|
-
return: function () {
|
|
3616
|
-
emptyQueue();
|
|
3617
|
-
return Promise.resolve({ value: undefined, done: true });
|
|
3618
|
-
},
|
|
3619
|
-
throw: function (error) {
|
|
3620
|
-
emptyQueue();
|
|
3621
|
-
return Promise.reject(error);
|
|
3622
|
-
},
|
|
3623
|
-
};
|
|
3645
|
+
return this;
|
|
3624
3646
|
},
|
|
3625
3647
|
_a;
|
|
3626
3648
|
}
|