tstyche 4.1.0 → 4.2.0

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.
@@ -558,6 +558,11 @@ declare class ExpectService {
558
558
  match(assertion: AssertionNode, onDiagnostics: DiagnosticsHandler<Diagnostic | Array<Diagnostic>>): MatchResult | undefined;
559
559
  }
560
560
 
561
+ declare class Glob {
562
+ #private;
563
+ static toRegex(patterns: Array<string>, target: "directories" | "files"): RegExp;
564
+ }
565
+
561
566
  declare class CancellationHandler implements EventHandler {
562
567
  #private;
563
568
  constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
@@ -810,5 +815,5 @@ declare class WhenService {
810
815
  action(when: WhenNode): void;
811
816
  }
812
817
 
813
- export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, SuppressedService, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
818
+ export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, Glob, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, SuppressedService, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
814
819
  export type { CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, DirectiveRange, DirectiveRanges, EnvironmentOptions, Event, EventHandler, FileWatchHandler, InlineConfig, InputHandler, ItemDefinition, MatchResult, OptionDefinition, Plugin, Reporter, ReporterEvent, ResolvedConfig, ScribblerOptions, SelectHookContext, SuppressedError, SuppressedErrors, TargetResultStatus, TaskResultStatus, TextRange, TypeChecker, WatchHandler, WatcherOptions };
package/build/tstyche.js CHANGED
@@ -2742,7 +2742,64 @@ class InputService {
2742
2742
  }
2743
2743
  }
2744
2744
 
2745
- class GlobPattern {
2745
+ class Braces {
2746
+ static expand(text) {
2747
+ const start = text.indexOf("{");
2748
+ if (start === -1) {
2749
+ return [text];
2750
+ }
2751
+ let position = start;
2752
+ let depth = 0;
2753
+ for (position; position < text.length; position++) {
2754
+ if (text[position] === "{") {
2755
+ depth++;
2756
+ }
2757
+ else if (text[position] === "}") {
2758
+ depth--;
2759
+ }
2760
+ if (depth === 0) {
2761
+ break;
2762
+ }
2763
+ }
2764
+ if (depth !== 0) {
2765
+ return [text];
2766
+ }
2767
+ const before = text.slice(0, start);
2768
+ const options = Braces.#splitOptions(text.slice(start + 1, position));
2769
+ const after = text.slice(position + 1);
2770
+ const result = [];
2771
+ for (const option of options) {
2772
+ for (const expanded of Braces.expand(option + after)) {
2773
+ result.push(before + expanded);
2774
+ }
2775
+ }
2776
+ return result;
2777
+ }
2778
+ static #splitOptions(optionText) {
2779
+ const options = [];
2780
+ let current = "";
2781
+ let depth = 0;
2782
+ for (const character of optionText) {
2783
+ if (character === "," && depth === 0) {
2784
+ options.push(current);
2785
+ current = "";
2786
+ }
2787
+ else {
2788
+ if (character === "{") {
2789
+ depth++;
2790
+ }
2791
+ if (character === "}") {
2792
+ depth--;
2793
+ }
2794
+ current += character;
2795
+ }
2796
+ }
2797
+ options.push(current);
2798
+ return options;
2799
+ }
2800
+ }
2801
+
2802
+ class Glob {
2746
2803
  static #reservedCharacterRegex = /[^\w\s/]/g;
2747
2804
  static #parse(pattern, usageTarget) {
2748
2805
  const segments = pattern.split("/");
@@ -2761,7 +2818,7 @@ class GlobPattern {
2761
2818
  optionalSegmentCount++;
2762
2819
  }
2763
2820
  resultPattern += "\\/";
2764
- const segmentPattern = segment.replace(GlobPattern.#reservedCharacterRegex, GlobPattern.#replaceReservedCharacter);
2821
+ const segmentPattern = segment.replace(Glob.#reservedCharacterRegex, Glob.#replaceReservedCharacter);
2765
2822
  if (segmentPattern !== segment) {
2766
2823
  resultPattern += "(?!(node_modules)(\\/|$))";
2767
2824
  }
@@ -2781,7 +2838,10 @@ class GlobPattern {
2781
2838
  }
2782
2839
  }
2783
2840
  static toRegex(patterns, target) {
2784
- const patternText = patterns.map((pattern) => `(${GlobPattern.#parse(pattern, target)})`).join("|");
2841
+ const patternText = patterns
2842
+ .flatMap((pattern) => Braces.expand(pattern))
2843
+ .map((pattern) => `(${Glob.#parse(pattern, target)})`)
2844
+ .join("|");
2785
2845
  return new RegExp(`^(${patternText})$`);
2786
2846
  }
2787
2847
  }
@@ -2839,8 +2899,8 @@ class Select {
2839
2899
  let matchPatterns = Select.#patternsCache.get(globPatterns);
2840
2900
  if (!matchPatterns) {
2841
2901
  matchPatterns = {
2842
- includedDirectory: GlobPattern.toRegex(globPatterns, "directories"),
2843
- includedFile: GlobPattern.toRegex(globPatterns, "files"),
2902
+ includedDirectory: Glob.toRegex(globPatterns, "directories"),
2903
+ includedFile: Glob.toRegex(globPatterns, "files"),
2844
2904
  };
2845
2905
  Select.#patternsCache.set(globPatterns, matchPatterns);
2846
2906
  }
@@ -3723,7 +3783,7 @@ class SuppressedDiagnosticText {
3723
3783
  return [
3724
3784
  "Directive requires an argument.",
3725
3785
  "Add a fragment of the expected error message after the directive.",
3726
- "To ignore the directive, append a '!' character after it.",
3786
+ "To ignore the directive, append the '!' character after it.",
3727
3787
  ];
3728
3788
  }
3729
3789
  static messageDidNotMatch() {
@@ -3956,7 +4016,9 @@ class MatchWorker {
3956
4016
  }
3957
4017
  }
3958
4018
  extendsObjectType(type) {
3959
- const nonPrimitiveType = { flags: this.#compiler.TypeFlags.NonPrimitive };
4019
+ const nonPrimitiveType = "getNonPrimitiveType" in this.typeChecker
4020
+ ? this.typeChecker.getNonPrimitiveType()
4021
+ : { flags: this.#compiler.TypeFlags.NonPrimitive };
3960
4022
  return this.typeChecker.isTypeAssignableTo(type, nonPrimitiveType);
3961
4023
  }
3962
4024
  getParameterType(signature, index) {
@@ -5022,7 +5084,7 @@ class TaskRunner {
5022
5084
  class Runner {
5023
5085
  #eventEmitter = new EventEmitter();
5024
5086
  #resolvedConfig;
5025
- static version = "4.1.0";
5087
+ static version = "4.2.0";
5026
5088
  constructor(resolvedConfig) {
5027
5089
  this.#resolvedConfig = resolvedConfig;
5028
5090
  }
@@ -5222,4 +5284,4 @@ class Cli {
5222
5284
  }
5223
5285
  }
5224
5286
 
5225
- export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, SuppressedService, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
5287
+ export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, Glob, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, SuppressedService, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tstyche",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Everything You Need for Type Testing.",
5
5
  "keywords": [
6
6
  "typescript",