@orkestrel/probe 0.0.8 → 0.0.10

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.
@@ -732,6 +732,15 @@ function releaseListeners(emitter, capture) {
732
732
  * is what makes a resident tool re-read a path this overlay holds, so two inspections that supply
733
733
  * different text for one path never share a cached answer.
734
734
  *
735
+ * This overlay matches a lookup key the way the host its stage declares to its tool matches file
736
+ * names. A host that resolves two spellings of one file name to one file leaves the tool holding
737
+ * whichever spelling it met first — the disk one, where the file is on disk — and the tool asks
738
+ * under that, so an overlay matching keys exactly answers nothing and the tool reads the committed
739
+ * file instead. Mint the overlay with the sensitivity the stage declares, and one reading decides
740
+ * both. The recorded spelling is what `paths` reports and what `covers` matches a directory
741
+ * against, so a folded key never reaches the paths a tool is handed and containment stays an exact
742
+ * comparison.
743
+ *
735
744
  * @example
736
745
  * ```ts
737
746
  * const overlay = new Overlay()
@@ -742,22 +751,36 @@ function releaseListeners(emitter, capture) {
742
751
  */
743
752
  var Overlay = class {
744
753
  #revision = (0, node_crypto.randomUUID)();
754
+ #sensitive;
745
755
  #candidates = /* @__PURE__ */ new Map();
756
+ /**
757
+ * Creates an empty candidate set under a fresh identity.
758
+ *
759
+ * @param options - Construction options
760
+ */
761
+ constructor(options = {}) {
762
+ this.#sensitive = options.sensitive ?? true;
763
+ }
746
764
  get revision() {
747
765
  return this.#revision;
748
766
  }
749
767
  get paths() {
750
- return [...this.#candidates.keys()];
768
+ return [...this.#candidates.values()].map(([path]) => path);
751
769
  }
752
770
  /**
753
771
  * Records one candidate's text against the absolute path it stands in for.
754
772
  *
773
+ * @remarks
774
+ * Recording a candidate under a path this overlay's own matching reads as one already recorded
775
+ * replaces that candidate, the way one file holds one text.
776
+ *
755
777
  * @param path - The absolute path the candidate replaces
756
778
  * @param text - The candidate's full contents
757
779
  * @returns Nothing
758
780
  */
759
781
  set(path, text) {
760
- this.#candidates.set(normalizePath(path), text);
782
+ const recorded = normalizePath(path);
783
+ this.#candidates.set(this.#key(recorded), [recorded, text]);
761
784
  }
762
785
  /**
763
786
  * Reads the candidate text recorded for one absolute path.
@@ -766,7 +789,7 @@ var Overlay = class {
766
789
  * @returns The recorded text, or `undefined` when this overlay holds no candidate there
767
790
  */
768
791
  text(path) {
769
- return this.#candidates.get(normalizePath(path));
792
+ return this.#candidates.get(this.#key(normalizePath(path)))?.[1];
770
793
  }
771
794
  /**
772
795
  * Checks whether a candidate sits beneath one directory.
@@ -775,14 +798,16 @@ var Overlay = class {
775
798
  * The answer is derived from the paths the overlay holds rather than stored, so it stops being
776
799
  * true exactly when the inspection that declared those candidates clears them. Both sides pass
777
800
  * through `normalizePath` first, because a tool that normalizes its own paths asks about a
778
- * directory in a spelling the recorded path may not share.
801
+ * directory in a spelling the recorded path may not share. Case is never folded here: this is a
802
+ * containment comparison, and it reads the recorded spelling whatever an overlay minted for a
803
+ * case-folding host matches its lookup keys by.
779
804
  *
780
805
  * @param directory - The absolute directory path to check
781
806
  * @returns True if a candidate path sits beneath the directory; false otherwise
782
807
  */
783
808
  covers(directory) {
784
809
  const base = `${normalizePath(directory).replace(/\/+$/, "")}/`;
785
- for (const path of this.#candidates.keys()) if (path.startsWith(base)) return true;
810
+ for (const [path] of this.#candidates.values()) if (path.startsWith(base)) return true;
786
811
  return false;
787
812
  }
788
813
  /**
@@ -793,10 +818,13 @@ var Overlay = class {
793
818
  clear() {
794
819
  this.#candidates.clear();
795
820
  }
821
+ #key(path) {
822
+ return this.#sensitive ? path : path.toLowerCase();
823
+ }
796
824
  };
797
825
  //#endregion
798
826
  //#region package.json
799
- var version = "0.0.8";
827
+ var version = "0.0.10";
800
828
  var peerDependencies = {
801
829
  "oxlint": "^1.77.0",
802
830
  "typescript": "^6.0.0",
@@ -1770,7 +1798,7 @@ var TypeStage = class {
1770
1798
  this.#configure(this.#service(typescript, selection.project), selection.project);
1771
1799
  await this.#unblock();
1772
1800
  }
1773
- const overlay = new Overlay();
1801
+ const overlay = new Overlay({ sensitive: this.#caseSensitive(typescript) });
1774
1802
  this.#overlay = overlay;
1775
1803
  try {
1776
1804
  this.#record(subject.test, overlay);