@gql.tada/cli-utils 1.9.3 → 1.9.4

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.
@@ -3009,6 +3009,9 @@ var writeOutput = async (t, r) => {
3009
3009
  }));
3010
3010
  }));
3011
3011
  }
3012
+ if (await readOutput(t) === r) {
3013
+ return;
3014
+ }
3012
3015
  var n = a("string" != typeof t ? await f.realpath(t) : t);
3013
3016
  if (!await directoryExists(n)) {
3014
3017
  await f.mkdir(n, {
@@ -6522,21 +6525,93 @@ function maybeBind(t, r) {
6522
6525
  return r ? r.bind(t) : void 0;
6523
6526
  }
6524
6527
 
6525
- var buildLanguageService = r => {
6526
- var {virtualMap: a} = r;
6527
- var n = I.createLanguageService(r.languageServiceHost, r.documentRegistry);
6528
- var i = maybeBind(n, n.getProgram);
6529
- var mapFileFn = t => (r, ...i) => {
6530
- var o = a.get(r);
6531
- if (o && o.sourceFileId === r) {
6532
- r = o.generatedFileId;
6528
+ var buildProgram = r => {
6529
+ var {program: a, virtualMap: n} = r;
6530
+ var i = ((r, a) => {
6531
+ var toKey = t => "win32" === process.platform ? t.toLowerCase() : t;
6532
+ var n = new Set([ toKey(t.resolve(r)) ]);
6533
+ for (var i of a) {
6534
+ if (t.isAbsolute(i)) {
6535
+ n.add(toKey(t.dirname(i)));
6536
+ }
6533
6537
  }
6534
- return t.call(n, r, ...i);
6538
+ return r => {
6539
+ var a = toKey(t.dirname(t.resolve(r)));
6540
+ for (;;) {
6541
+ if (n.has(a)) {
6542
+ return !0;
6543
+ }
6544
+ var i = t.dirname(a);
6545
+ if (i === a) {
6546
+ return !1;
6547
+ }
6548
+ a = i;
6549
+ }
6550
+ };
6551
+ })(r.projectRoot, r.rootNames);
6552
+ var o = maybeBind(a, a.isSourceFileFromExternalLibrary);
6553
+ var s = maybeBind(a, a.getModeForResolutionAtIndex);
6554
+ var l = maybeBind(a, a.getSourceFile);
6555
+ var c = maybeBind(a, a.getSourceFiles);
6556
+ var mapSourceFileFn = t => (r, ...i) => {
6557
+ var o = r && n.get(r.fileName);
6558
+ if (o && o.sourceFileId === r?.fileName) {
6559
+ r = l(o.generatedFileId) || r;
6560
+ }
6561
+ return t.call(a, r, ...i);
6535
6562
  };
6536
- var mapFileTextSpanFn = t => (r, i, ...o) => {
6537
- var s = a.get(r);
6538
- if (s && s.sourceFileId === r) {
6539
- r = s.generatedFileId;
6563
+ return Object.assign(a, {
6564
+ getSyntacticDiagnostics: mapSourceFileFn(a.getSyntacticDiagnostics),
6565
+ getSemanticDiagnostics: mapSourceFileFn(a.getSemanticDiagnostics),
6566
+ getDeclarationDiagnostics: mapSourceFileFn(a.getDeclarationDiagnostics),
6567
+ isSourceFileDefaultLibrary: mapSourceFileFn(a.isSourceFileDefaultLibrary),
6568
+ getModeForUsageLocation: mapSourceFileFn(a.getModeForUsageLocation),
6569
+ isSourceFileFromExternalLibrary(t) {
6570
+ var r = n.get(t.fileName);
6571
+ return !(!r || r.sourceFileId !== t.fileName) || o(t);
6572
+ },
6573
+ getSourceFiles() {
6574
+ var t = [];
6575
+ for (var r of c()) {
6576
+ if (i(r.fileName) && !a.isSourceFileFromExternalLibrary(r)) {
6577
+ t.push(r);
6578
+ }
6579
+ }
6580
+ return t;
6581
+ },
6582
+ getSourceFile(t) {
6583
+ var r = n.get(t);
6584
+ if (r && r.sourceFileId === t) {
6585
+ t = r.generatedFileId;
6586
+ }
6587
+ return l(t);
6588
+ },
6589
+ getModeForResolutionAtIndex(t, r) {
6590
+ var a = n.get(t.fileName);
6591
+ if (a && a.sourceFileId === t.fileName) {
6592
+ t = l(a.generatedFileId) || t;
6593
+ r = a.getGeneratedOffset(r)?.[0] ?? r;
6594
+ }
6595
+ return s(t, r);
6596
+ }
6597
+ });
6598
+ };
6599
+
6600
+ var buildLanguageService = t => {
6601
+ var {virtualMap: r} = t;
6602
+ var a = I.createLanguageService(t.languageServiceHost, t.documentRegistry);
6603
+ var n = maybeBind(a, a.getProgram);
6604
+ var mapFileFn = t => (n, ...i) => {
6605
+ var o = r.get(n);
6606
+ if (o && o.sourceFileId === n) {
6607
+ n = o.generatedFileId;
6608
+ }
6609
+ return t.call(a, n, ...i);
6610
+ };
6611
+ var mapFileTextSpanFn = t => (n, i, ...o) => {
6612
+ var s = r.get(n);
6613
+ if (s && s.sourceFileId === n) {
6614
+ n = s.generatedFileId;
6540
6615
  var l = s.getGeneratedOffset(i.start)?.[0];
6541
6616
  var c = s.getGeneratedOffset(i.start + i.length - 1)?.[0];
6542
6617
  if (null != l) {
@@ -6549,12 +6624,12 @@ var buildLanguageService = r => {
6549
6624
  }
6550
6625
  }
6551
6626
  }
6552
- return t.call(n, r, i, ...o);
6627
+ return t.call(a, n, i, ...o);
6553
6628
  };
6554
- var mapFileTextRangeFn = t => (r, i, ...o) => {
6555
- var s = a.get(r);
6556
- if (s && s.sourceFileId === r) {
6557
- r = s.generatedFileId;
6629
+ var mapFileTextRangeFn = t => (n, i, ...o) => {
6630
+ var s = r.get(n);
6631
+ if (s && s.sourceFileId === n) {
6632
+ n = s.generatedFileId;
6558
6633
  var l = s.getGeneratedOffset(i.pos)?.[0];
6559
6634
  var c = s.getGeneratedOffset(i.end)?.[0];
6560
6635
  if (null != l) {
@@ -6567,137 +6642,90 @@ var buildLanguageService = r => {
6567
6642
  }
6568
6643
  }
6569
6644
  }
6570
- return t.call(n, r, i, ...o);
6645
+ return t.call(a, n, i, ...o);
6571
6646
  };
6572
- var mapFilePositionFn = t => (r, i, ...o) => {
6573
- var s = a.get(r);
6574
- if (s && s.sourceFileId === r) {
6575
- r = s.generatedFileId;
6647
+ var mapFilePositionFn = t => (n, i, ...o) => {
6648
+ var s = r.get(n);
6649
+ if (s && s.sourceFileId === n) {
6650
+ n = s.generatedFileId;
6576
6651
  i = s.getGeneratedOffset(i)?.[0] ?? i;
6577
6652
  }
6578
- return t.call(n, r, i, ...o);
6653
+ return t.call(a, n, i, ...o);
6579
6654
  };
6580
- var mapFileStartEndFn = t => (r, i, o, ...s) => {
6581
- var l = a.get(r);
6582
- if (l && l.sourceFileId === r) {
6583
- r = l.generatedFileId;
6655
+ var mapFileStartEndFn = t => (n, i, o, ...s) => {
6656
+ var l = r.get(n);
6657
+ if (l && l.sourceFileId === n) {
6658
+ n = l.generatedFileId;
6584
6659
  i = l.getGeneratedOffset(i)?.[0] ?? i;
6585
6660
  o = l.getGeneratedOffset(o)?.[0] ?? o;
6586
6661
  }
6587
- return t.call(n, r, i, o, ...s);
6662
+ return t.call(a, n, i, o, ...s);
6588
6663
  };
6589
- var o;
6590
- return Object.assign(n, {
6664
+ var i;
6665
+ return Object.assign(a, {
6591
6666
  getProgram() {
6592
- if (o) {
6593
- return o;
6667
+ if (i) {
6668
+ return i;
6594
6669
  } else {
6595
- var a = i();
6596
- return a ? o = (r => {
6597
- var {program: a, virtualMap: n, projectRoot: i} = r;
6598
- var o = maybeBind(a, a.isSourceFileFromExternalLibrary);
6599
- var s = maybeBind(a, a.getModeForResolutionAtIndex);
6600
- var l = maybeBind(a, a.getSourceFile);
6601
- var c = maybeBind(a, a.getSourceFiles);
6602
- var mapSourceFileFn = t => (r, ...i) => {
6603
- var o = r && n.get(r.fileName);
6604
- if (o && o.sourceFileId === r?.fileName) {
6605
- r = l(o.generatedFileId) || r;
6606
- }
6607
- return t.call(a, r, ...i);
6608
- };
6609
- return Object.assign(a, {
6610
- getSyntacticDiagnostics: mapSourceFileFn(a.getSyntacticDiagnostics),
6611
- getSemanticDiagnostics: mapSourceFileFn(a.getSemanticDiagnostics),
6612
- getDeclarationDiagnostics: mapSourceFileFn(a.getDeclarationDiagnostics),
6613
- isSourceFileDefaultLibrary: mapSourceFileFn(a.isSourceFileDefaultLibrary),
6614
- getModeForUsageLocation: mapSourceFileFn(a.getModeForUsageLocation),
6615
- isSourceFileFromExternalLibrary(t) {
6616
- var r = n.get(t.fileName);
6617
- return !(!r || r.sourceFileId !== t.fileName) || o(t);
6618
- },
6619
- getSourceFiles() {
6620
- var r = [];
6621
- for (var n of c()) {
6622
- if (!t.relative(i, n.fileName).startsWith("..") && !a.isSourceFileFromExternalLibrary(n)) {
6623
- r.push(n);
6624
- }
6625
- }
6626
- return r;
6627
- },
6628
- getSourceFile(t) {
6629
- var r = n.get(t);
6630
- if (r && r.sourceFileId === t) {
6631
- t = r.generatedFileId;
6632
- }
6633
- return l(t);
6634
- },
6635
- getModeForResolutionAtIndex(t, r) {
6636
- var a = n.get(t.fileName);
6637
- if (a && a.sourceFileId === t.fileName) {
6638
- t = l(a.generatedFileId) || t;
6639
- r = a.getGeneratedOffset(r)?.[0] ?? r;
6640
- }
6641
- return s(t, r);
6642
- }
6643
- });
6644
- })({
6645
- program: a,
6646
- virtualMap: r.virtualMap,
6647
- projectRoot: r.projectRoot
6670
+ var r = n();
6671
+ return r ? i = buildProgram({
6672
+ program: r,
6673
+ virtualMap: t.virtualMap,
6674
+ projectRoot: t.projectRoot,
6675
+ rootNames: t.rootNames
6648
6676
  }) : void 0;
6649
6677
  }
6650
6678
  },
6651
- getReferencesAtPosition: mapFilePositionFn(n.getReferencesAtPosition),
6652
- findReferences: mapFilePositionFn(n.findReferences),
6653
- getDefinitionAtPosition: mapFilePositionFn(n.getDefinitionAtPosition),
6654
- getDefinitionAndBoundSpan: mapFilePositionFn(n.getDefinitionAndBoundSpan),
6655
- getTypeDefinitionAtPosition: mapFilePositionFn(n.getTypeDefinitionAtPosition),
6656
- getImplementationAtPosition: mapFilePositionFn(n.getImplementationAtPosition),
6657
- getCompletionsAtPosition: mapFilePositionFn(n.getCompletionsAtPosition),
6658
- getCompletionEntryDetails: mapFilePositionFn(n.getCompletionEntryDetails),
6659
- getCompletionEntrySymbol: mapFilePositionFn(n.getCompletionEntrySymbol),
6660
- getQuickInfoAtPosition: mapFilePositionFn(n.getQuickInfoAtPosition),
6661
- getBreakpointStatementAtPosition: mapFilePositionFn(n.getBreakpointStatementAtPosition),
6662
- getSignatureHelpItems: mapFilePositionFn(n.getSignatureHelpItems),
6663
- getRenameInfo: mapFilePositionFn(n.getRenameInfo),
6664
- getSmartSelectionRange: mapFilePositionFn(n.getSmartSelectionRange),
6665
- getDocumentHighlights: mapFilePositionFn(n.getDocumentHighlights),
6666
- prepareCallHierarchy: mapFilePositionFn(n.prepareCallHierarchy),
6667
- provideCallHierarchyIncomingCalls: mapFilePositionFn(n.provideCallHierarchyIncomingCalls),
6668
- provideCallHierarchyOutgoingCalls: mapFilePositionFn(n.provideCallHierarchyOutgoingCalls),
6669
- getBraceMatchingAtPosition: mapFilePositionFn(n.getBraceMatchingAtPosition),
6670
- getIndentationAtPosition: mapFilePositionFn(n.getIndentationAtPosition),
6671
- getFormattingEditsAfterKeystroke: mapFilePositionFn(n.getFormattingEditsAfterKeystroke),
6672
- getDocCommentTemplateAtPosition: mapFilePositionFn(n.getDocCommentTemplateAtPosition),
6673
- isValidBraceCompletionAtPosition: mapFilePositionFn(n.isValidBraceCompletionAtPosition),
6674
- getJsxClosingTagAtPosition: mapFilePositionFn(n.getJsxClosingTagAtPosition),
6675
- getLinkedEditingRangeAtPosition: mapFilePositionFn(n.getLinkedEditingRangeAtPosition),
6676
- getSpanOfEnclosingComment: mapFilePositionFn(n.getSpanOfEnclosingComment),
6677
- getSyntacticClassifications: mapFileTextSpanFn(n.getSyntacticClassifications),
6678
- getSemanticClassifications: mapFileTextSpanFn(n.getSemanticClassifications),
6679
- getEncodedSyntacticClassifications: mapFileTextSpanFn(n.getEncodedSyntacticClassifications),
6680
- getEncodedSemanticClassifications: mapFileTextSpanFn(n.getEncodedSemanticClassifications),
6681
- provideInlayHints: mapFileTextSpanFn(n.provideInlayHints),
6682
- getNameOrDottedNameSpan: mapFileStartEndFn(n.getNameOrDottedNameSpan),
6683
- getFormattingEditsForRange: mapFileStartEndFn(n.getFormattingEditsForRange),
6684
- getCodeFixesAtPosition: mapFileStartEndFn(n.getCodeFixesAtPosition),
6685
- getFileReferences: mapFileFn(n.getFileReferences),
6686
- getNavigationBarItems: mapFileFn(n.getNavigationBarItems),
6687
- getNavigationTree: mapFileFn(n.getNavigationTree),
6688
- getOutliningSpans: mapFileFn(n.getOutliningSpans),
6689
- getTodoComments: mapFileFn(n.getTodoComments),
6690
- getFormattingEditsForDocument: mapFileFn(n.getFormattingEditsForDocument),
6691
- getEditsForRefactor: mapFileFn(n.getEditsForRefactor),
6692
- getEmitOutput: mapFileFn(n.getEmitOutput),
6693
- getSuggestionDiagnostics: mapFileFn(n.getSuggestionDiagnostics),
6694
- getSemanticDiagnostics: mapFileFn(n.getSemanticDiagnostics),
6695
- getSyntacticDiagnostics: mapFileFn(n.getSyntacticDiagnostics),
6696
- getSupportedCodeFixes: mapFileFn(n.getSupportedCodeFixes),
6697
- toggleLineComment: mapFileTextRangeFn(n.toggleLineComment),
6698
- toggleMultilineComment: mapFileTextRangeFn(n.toggleMultilineComment),
6699
- commentSelection: mapFileTextRangeFn(n.commentSelection),
6700
- uncommentSelection: mapFileTextRangeFn(n.uncommentSelection)
6679
+ getReferencesAtPosition: mapFilePositionFn(a.getReferencesAtPosition),
6680
+ findReferences: mapFilePositionFn(a.findReferences),
6681
+ getDefinitionAtPosition: mapFilePositionFn(a.getDefinitionAtPosition),
6682
+ getDefinitionAndBoundSpan: mapFilePositionFn(a.getDefinitionAndBoundSpan),
6683
+ getTypeDefinitionAtPosition: mapFilePositionFn(a.getTypeDefinitionAtPosition),
6684
+ getImplementationAtPosition: mapFilePositionFn(a.getImplementationAtPosition),
6685
+ getCompletionsAtPosition: mapFilePositionFn(a.getCompletionsAtPosition),
6686
+ getCompletionEntryDetails: mapFilePositionFn(a.getCompletionEntryDetails),
6687
+ getCompletionEntrySymbol: mapFilePositionFn(a.getCompletionEntrySymbol),
6688
+ getQuickInfoAtPosition: mapFilePositionFn(a.getQuickInfoAtPosition),
6689
+ getBreakpointStatementAtPosition: mapFilePositionFn(a.getBreakpointStatementAtPosition),
6690
+ getSignatureHelpItems: mapFilePositionFn(a.getSignatureHelpItems),
6691
+ getRenameInfo: mapFilePositionFn(a.getRenameInfo),
6692
+ getSmartSelectionRange: mapFilePositionFn(a.getSmartSelectionRange),
6693
+ getDocumentHighlights: mapFilePositionFn(a.getDocumentHighlights),
6694
+ prepareCallHierarchy: mapFilePositionFn(a.prepareCallHierarchy),
6695
+ provideCallHierarchyIncomingCalls: mapFilePositionFn(a.provideCallHierarchyIncomingCalls),
6696
+ provideCallHierarchyOutgoingCalls: mapFilePositionFn(a.provideCallHierarchyOutgoingCalls),
6697
+ getBraceMatchingAtPosition: mapFilePositionFn(a.getBraceMatchingAtPosition),
6698
+ getIndentationAtPosition: mapFilePositionFn(a.getIndentationAtPosition),
6699
+ getFormattingEditsAfterKeystroke: mapFilePositionFn(a.getFormattingEditsAfterKeystroke),
6700
+ getDocCommentTemplateAtPosition: mapFilePositionFn(a.getDocCommentTemplateAtPosition),
6701
+ isValidBraceCompletionAtPosition: mapFilePositionFn(a.isValidBraceCompletionAtPosition),
6702
+ getJsxClosingTagAtPosition: mapFilePositionFn(a.getJsxClosingTagAtPosition),
6703
+ getLinkedEditingRangeAtPosition: mapFilePositionFn(a.getLinkedEditingRangeAtPosition),
6704
+ getSpanOfEnclosingComment: mapFilePositionFn(a.getSpanOfEnclosingComment),
6705
+ getSyntacticClassifications: mapFileTextSpanFn(a.getSyntacticClassifications),
6706
+ getSemanticClassifications: mapFileTextSpanFn(a.getSemanticClassifications),
6707
+ getEncodedSyntacticClassifications: mapFileTextSpanFn(a.getEncodedSyntacticClassifications),
6708
+ getEncodedSemanticClassifications: mapFileTextSpanFn(a.getEncodedSemanticClassifications),
6709
+ provideInlayHints: mapFileTextSpanFn(a.provideInlayHints),
6710
+ getNameOrDottedNameSpan: mapFileStartEndFn(a.getNameOrDottedNameSpan),
6711
+ getFormattingEditsForRange: mapFileStartEndFn(a.getFormattingEditsForRange),
6712
+ getCodeFixesAtPosition: mapFileStartEndFn(a.getCodeFixesAtPosition),
6713
+ getFileReferences: mapFileFn(a.getFileReferences),
6714
+ getNavigationBarItems: mapFileFn(a.getNavigationBarItems),
6715
+ getNavigationTree: mapFileFn(a.getNavigationTree),
6716
+ getOutliningSpans: mapFileFn(a.getOutliningSpans),
6717
+ getTodoComments: mapFileFn(a.getTodoComments),
6718
+ getFormattingEditsForDocument: mapFileFn(a.getFormattingEditsForDocument),
6719
+ getEditsForRefactor: mapFileFn(a.getEditsForRefactor),
6720
+ getEmitOutput: mapFileFn(a.getEmitOutput),
6721
+ getSuggestionDiagnostics: mapFileFn(a.getSuggestionDiagnostics),
6722
+ getSemanticDiagnostics: mapFileFn(a.getSemanticDiagnostics),
6723
+ getSyntacticDiagnostics: mapFileFn(a.getSyntacticDiagnostics),
6724
+ getSupportedCodeFixes: mapFileFn(a.getSupportedCodeFixes),
6725
+ toggleLineComment: mapFileTextRangeFn(a.toggleLineComment),
6726
+ toggleMultilineComment: mapFileTextRangeFn(a.toggleMultilineComment),
6727
+ commentSelection: mapFileTextRangeFn(a.commentSelection),
6728
+ uncommentSelection: mapFileTextRangeFn(a.uncommentSelection)
6701
6729
  });
6702
6730
  };
6703
6731
 
@@ -6880,17 +6908,20 @@ var programFactory = r => {
6880
6908
  var o = new Set(s);
6881
6909
  var l = new Set([ r.rootPath ]);
6882
6910
  for (var c of s) {
6883
- l.add(t.dirname(c));
6884
- }
6885
- for (var u of l) {
6886
- for (var d of i.readDirectory(u, a, [ "**/node_modules" ])) {
6887
- if (!o.has(d)) {
6888
- o.add(d);
6889
- var p = i.readFile(d, "utf8");
6890
- if (p) {
6911
+ var u = t.dirname(c);
6912
+ if (t.isAbsolute(u)) {
6913
+ l.add(u);
6914
+ }
6915
+ }
6916
+ for (var d of l) {
6917
+ for (var p of i.readDirectory(d, a, [ "**/node_modules" ])) {
6918
+ if (!o.has(p)) {
6919
+ o.add(p);
6920
+ var h = i.readFile(p, "utf8");
6921
+ if (h) {
6891
6922
  n.push(f.createSourceFile({
6892
- fileId: d,
6893
- sourceText: p
6923
+ fileId: p,
6924
+ sourceText: h
6894
6925
  }, I.ScriptKind.External));
6895
6926
  }
6896
6927
  }