@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/index.esm.js
CHANGED
|
@@ -564,7 +564,7 @@ function dedentBlockStringValue(rawString) {
|
|
|
564
564
|
// Expand a block string's raw value into independent lines.
|
|
565
565
|
var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first.
|
|
566
566
|
|
|
567
|
-
var commonIndent = getBlockStringIndentation(
|
|
567
|
+
var commonIndent = getBlockStringIndentation(rawString);
|
|
568
568
|
|
|
569
569
|
if (commonIndent !== 0) {
|
|
570
570
|
for (var i = 1; i < lines.length; i++) {
|
|
@@ -573,56 +573,78 @@ function dedentBlockStringValue(rawString) {
|
|
|
573
573
|
} // Remove leading and trailing blank lines.
|
|
574
574
|
|
|
575
575
|
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
var startLine = 0;
|
|
577
|
+
|
|
578
|
+
while (startLine < lines.length && isBlank(lines[startLine])) {
|
|
579
|
+
++startLine;
|
|
578
580
|
}
|
|
579
581
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
+
var endLine = lines.length;
|
|
583
|
+
|
|
584
|
+
while (endLine > startLine && isBlank(lines[endLine - 1])) {
|
|
585
|
+
--endLine;
|
|
582
586
|
} // Return a string of the lines joined with U+000A.
|
|
583
587
|
|
|
584
588
|
|
|
585
|
-
return lines.join('\n');
|
|
589
|
+
return lines.slice(startLine, endLine).join('\n');
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function isBlank(str) {
|
|
593
|
+
for (var i = 0; i < str.length; ++i) {
|
|
594
|
+
if (str[i] !== ' ' && str[i] !== '\t') {
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return true;
|
|
586
600
|
}
|
|
587
601
|
/**
|
|
588
602
|
* @internal
|
|
589
603
|
*/
|
|
590
604
|
|
|
591
|
-
function getBlockStringIndentation(lines) {
|
|
592
|
-
var commonIndent = null;
|
|
593
605
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
var indent = leadingWhitespace(line);
|
|
606
|
+
function getBlockStringIndentation(value) {
|
|
607
|
+
var _commonIndent;
|
|
597
608
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
609
|
+
var isFirstLine = true;
|
|
610
|
+
var isEmptyLine = true;
|
|
611
|
+
var indent = 0;
|
|
612
|
+
var commonIndent = null;
|
|
601
613
|
|
|
602
|
-
|
|
603
|
-
|
|
614
|
+
for (var i = 0; i < value.length; ++i) {
|
|
615
|
+
switch (value.charCodeAt(i)) {
|
|
616
|
+
case 13:
|
|
617
|
+
// \r
|
|
618
|
+
if (value.charCodeAt(i + 1) === 10) {
|
|
619
|
+
++i; // skip \r\n as one symbol
|
|
620
|
+
}
|
|
604
621
|
|
|
605
|
-
|
|
622
|
+
// falls through
|
|
623
|
+
|
|
624
|
+
case 10:
|
|
625
|
+
// \n
|
|
626
|
+
isFirstLine = false;
|
|
627
|
+
isEmptyLine = true;
|
|
628
|
+
indent = 0;
|
|
606
629
|
break;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
630
|
|
|
611
|
-
|
|
612
|
-
}
|
|
631
|
+
case 9: // \t
|
|
613
632
|
|
|
614
|
-
|
|
615
|
-
|
|
633
|
+
case 32:
|
|
634
|
+
// <space>
|
|
635
|
+
++indent;
|
|
636
|
+
break;
|
|
616
637
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
638
|
+
default:
|
|
639
|
+
if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {
|
|
640
|
+
commonIndent = indent;
|
|
641
|
+
}
|
|
620
642
|
|
|
621
|
-
|
|
622
|
-
}
|
|
643
|
+
isEmptyLine = false;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
623
646
|
|
|
624
|
-
|
|
625
|
-
return leadingWhitespace(str) === str.length;
|
|
647
|
+
return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;
|
|
626
648
|
}
|
|
627
649
|
|
|
628
650
|
function parseGraphQLSDL(location, rawSDL, options = {}) {
|
|
@@ -3542,20 +3564,19 @@ function observableToAsyncIterable(observable) {
|
|
|
3542
3564
|
}
|
|
3543
3565
|
};
|
|
3544
3566
|
return {
|
|
3567
|
+
next() {
|
|
3568
|
+
return listening ? pullValue() : this.return();
|
|
3569
|
+
},
|
|
3570
|
+
return() {
|
|
3571
|
+
emptyQueue();
|
|
3572
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
3573
|
+
},
|
|
3574
|
+
throw(error) {
|
|
3575
|
+
emptyQueue();
|
|
3576
|
+
return Promise.reject(error);
|
|
3577
|
+
},
|
|
3545
3578
|
[Symbol.asyncIterator]() {
|
|
3546
|
-
return
|
|
3547
|
-
next() {
|
|
3548
|
-
return listening ? pullValue() : this.return();
|
|
3549
|
-
},
|
|
3550
|
-
return() {
|
|
3551
|
-
emptyQueue();
|
|
3552
|
-
return Promise.resolve({ value: undefined, done: true });
|
|
3553
|
-
},
|
|
3554
|
-
throw(error) {
|
|
3555
|
-
emptyQueue();
|
|
3556
|
-
return Promise.reject(error);
|
|
3557
|
-
},
|
|
3558
|
-
};
|
|
3579
|
+
return this;
|
|
3559
3580
|
},
|
|
3560
3581
|
};
|
|
3561
3582
|
}
|