@jbearak/sight 0.15.0 → 0.15.1

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.
@@ -52,7 +52,7 @@ var package_default;
52
52
  var init_package = __esm(() => {
53
53
  package_default = {
54
54
  name: "@jbearak/sight",
55
- version: "0.15.0",
55
+ version: "0.15.1",
56
56
  type: "module",
57
57
  workspaces: [
58
58
  "client"
@@ -2357,6 +2357,9 @@ function ascii_to_lower(c) {
2357
2357
  return String.fromCharCode(code + 32);
2358
2358
  return c;
2359
2359
  }
2360
+ function ascii_case_fold(text) {
2361
+ return text.replace(ASCII_UPPERCASE_PATTERN, ascii_to_lower);
2362
+ }
2360
2363
  function ascii_ci_equal(a, b) {
2361
2364
  if (a.length !== b.length)
2362
2365
  return false;
@@ -2425,12 +2428,17 @@ function resolve_path_rich(resolved_fs_path, options) {
2425
2428
  return { kind: "exact", path: chosen_root };
2426
2429
  }
2427
2430
  const the_components = remainder.split(sep2);
2428
- let current_dir = chosen_root;
2429
- let had_case_mismatch = false;
2430
2431
  const join_path = (dir, name) => dir.endsWith(sep2) ? `${dir}${name}` : `${dir}${sep2}${name}`;
2431
- for (let comp_idx = 0;comp_idx < the_components.length; comp_idx++) {
2432
+ let directory_reads_left = the_components.length + MAX_CASE_VARIANT_BACKTRACK_READS;
2433
+ let budget_exhausted = false;
2434
+ const walk = (current_dir, comp_idx, had_case_mismatch) => {
2432
2435
  const my_component = the_components[comp_idx];
2433
2436
  const my_is_final = comp_idx === the_components.length - 1;
2437
+ if (directory_reads_left <= 0) {
2438
+ budget_exhausted = true;
2439
+ return { kind: "missing", requested: resolved_fs_path };
2440
+ }
2441
+ directory_reads_left--;
2434
2442
  let my_entries;
2435
2443
  try {
2436
2444
  my_entries = the_fs.readdirSync(current_dir, {
@@ -2442,20 +2450,43 @@ function resolve_path_rich(resolved_fs_path, options) {
2442
2450
  if (!my_is_final) {
2443
2451
  const my_exact = my_entries.find((e) => e.name === my_component && entry_is_dir(e, join_path(current_dir, e.name), the_fs));
2444
2452
  if (my_exact !== undefined) {
2445
- current_dir = join_path(current_dir, my_exact.name);
2446
- continue;
2453
+ const my_outcome = walk(join_path(current_dir, my_exact.name), comp_idx + 1, had_case_mismatch);
2454
+ if (my_outcome.kind !== "missing") {
2455
+ return my_outcome;
2456
+ }
2447
2457
  }
2448
- const the_ci_dirs = my_entries.filter((e) => ascii_ci_equal(e.name, my_component) && entry_is_dir(e, join_path(current_dir, e.name), the_fs));
2449
- if (the_ci_dirs.length === 1) {
2450
- had_case_mismatch = true;
2451
- current_dir = join_path(current_dir, the_ci_dirs[0].name);
2452
- continue;
2458
+ const the_hits = [];
2459
+ for (const my_entry of my_entries) {
2460
+ if (my_entry.name === my_component || !ascii_ci_equal(my_entry.name, my_component) || !entry_is_dir(my_entry, join_path(current_dir, my_entry.name), the_fs)) {
2461
+ continue;
2462
+ }
2463
+ const my_outcome = walk(join_path(current_dir, my_entry.name), comp_idx + 1, true);
2464
+ if (my_outcome.kind === "ambiguous") {
2465
+ the_hits.push(...my_outcome.matches);
2466
+ } else if (my_outcome.kind !== "missing") {
2467
+ the_hits.push(my_outcome.path);
2468
+ }
2469
+ if (the_hits.length > 1) {
2470
+ return {
2471
+ kind: "ambiguous",
2472
+ requested: resolved_fs_path,
2473
+ matches: the_hits
2474
+ };
2475
+ }
2453
2476
  }
2454
- if (the_ci_dirs.length > 1) {
2477
+ if (budget_exhausted) {
2455
2478
  return {
2456
2479
  kind: "ambiguous",
2457
2480
  requested: resolved_fs_path,
2458
- matches: the_ci_dirs.map((e) => join_path(current_dir, e.name))
2481
+ matches: the_hits,
2482
+ truncated: true
2483
+ };
2484
+ }
2485
+ if (the_hits.length === 1) {
2486
+ return {
2487
+ kind: "case_only",
2488
+ path: the_hits[0],
2489
+ requested: resolved_fs_path
2459
2490
  };
2460
2491
  }
2461
2492
  return { kind: "missing", requested: resolved_fs_path };
@@ -2504,8 +2535,8 @@ function resolve_path_rich(resolved_fs_path, options) {
2504
2535
  };
2505
2536
  }
2506
2537
  return { kind: "missing", requested: resolved_fs_path };
2507
- }
2508
- return { kind: "missing", requested: resolved_fs_path };
2538
+ };
2539
+ return walk(chosen_root, 0, false);
2509
2540
  }
2510
2541
  function host_is_case_sensitive(seed_existing_dir, fs3) {
2511
2542
  if (fs3 !== undefined) {
@@ -2575,6 +2606,31 @@ function is_resolvable_static_call(call) {
2575
2606
  function outcome_fs_path(outcome) {
2576
2607
  return outcome.kind === "exact" || outcome.kind === "case_only" ? outcome.path : outcome.requested;
2577
2608
  }
2609
+ function case_only_matched_directory(outcome) {
2610
+ const dir_of = (fs_path) => node_path.posix.dirname(fs_path.replace(/\\/g, "/"));
2611
+ return dir_of(outcome.path) !== dir_of(outcome.requested);
2612
+ }
2613
+ function case_mismatch_display_paths(raw_path, outcome, display_dir) {
2614
+ const my_normalized_raw = raw_path.replace(/\\/g, "/");
2615
+ const my_is_abs = node_path.isAbsolute(my_normalized_raw) || /^[a-zA-Z]:\//.test(my_normalized_raw);
2616
+ const the_raw_parts = my_normalized_raw.split("/").filter((my_part) => my_part.length > 0);
2617
+ const my_count = the_raw_parts.length;
2618
+ const the_requested_parts = outcome.requested.replace(/\\/g, "/").split("/");
2619
+ const the_real_parts = outcome.path.replace(/\\/g, "/").split("/");
2620
+ const my_base_count = the_requested_parts.length - my_count;
2621
+ const my_pairs = !my_is_abs && my_count > 0 && the_raw_parts.every((my_part) => my_part !== "." && my_part !== "..") && my_base_count >= 0 && the_real_parts.length === the_requested_parts.length && the_requested_parts.slice(my_base_count).join("/") === the_raw_parts.join("/") && the_requested_parts.slice(0, my_base_count).join("/") === the_real_parts.slice(0, my_base_count).join("/");
2622
+ if (my_pairs) {
2623
+ return {
2624
+ requested: the_raw_parts.join("/"),
2625
+ on_disk: the_real_parts.slice(-my_count).join("/")
2626
+ };
2627
+ }
2628
+ const relative_to_display_dir = (fs_path) => node_path.relative(display_dir, fs_path).replace(/\\/g, "/") || fs_path;
2629
+ return {
2630
+ requested: relative_to_display_dir(outcome.requested),
2631
+ on_disk: relative_to_display_dir(outcome.path)
2632
+ };
2633
+ }
2578
2634
  function resolve_forward_call_rich(raw_path, caller_dir, working_directory, options) {
2579
2635
  const my_normalized_raw = raw_path.replace(/\\/g, "/");
2580
2636
  const my_is_abs = node_path.isAbsolute(my_normalized_raw) || /^[a-zA-Z]:\//.test(my_normalized_raw);
@@ -2657,6 +2713,7 @@ function build_cd_timeline(params) {
2657
2713
  const { starting_wd, caller_dir, cd_commands, workspace_roots, fs: fs3 } = params;
2658
2714
  const the_diagnostics = [];
2659
2715
  const the_entries = [];
2716
+ let depends_on_directory_casing = false;
2660
2717
  const the_statics = (cd_commands ?? []).filter((c) => c.is_static && c.raw_path.length > 0).sort((a, b) => position_before(a.range.start, b.range.start) ? -1 : position_before(b.range.start, a.range.start) ? 1 : 0);
2661
2718
  let current_wd = starting_wd;
2662
2719
  for (const my_cd of the_statics) {
@@ -2672,6 +2729,7 @@ function build_cd_timeline(params) {
2672
2729
  current_wd = my_outcome.path;
2673
2730
  } else if (my_outcome.kind === "case_only") {
2674
2731
  current_wd = my_outcome.path;
2732
+ depends_on_directory_casing = true;
2675
2733
  the_diagnostics.push(make_cd_case_mismatch_diagnostic(my_cd, my_outcome, caller_dir, workspace_roots));
2676
2734
  } else if (my_outcome.kind === "missing") {
2677
2735
  current_wd = my_outcome.requested;
@@ -2683,8 +2741,9 @@ function build_cd_timeline(params) {
2683
2741
  code: "CROSS_FILE_MISSING_FILE" /* CROSS_FILE_MISSING_FILE */
2684
2742
  });
2685
2743
  } else {
2744
+ depends_on_directory_casing = true;
2686
2745
  the_diagnostics.push({
2687
- message: `Ambiguous directory for cd: "${my_cd.raw_path}" ` + `(multiple case-insensitive matches)`,
2746
+ message: `Ambiguous directory for cd: "${my_cd.raw_path}" ` + (my_outcome.truncated ? `(too many case-variant directories to search)` : `(multiple case-insensitive matches)`),
2688
2747
  range: my_cd.range,
2689
2748
  severity: "warning",
2690
2749
  kind: "missing_directory",
@@ -2695,15 +2754,15 @@ function build_cd_timeline(params) {
2695
2754
  }
2696
2755
  return {
2697
2756
  timeline: { starting_wd, entries: the_entries },
2698
- diagnostics: the_diagnostics
2757
+ diagnostics: the_diagnostics,
2758
+ depends_on_directory_casing
2699
2759
  };
2700
2760
  }
2701
2761
  function make_cd_case_mismatch_diagnostic(cd, outcome, caller_dir, workspace_roots) {
2702
- const my_req_disp = node_path.relative(caller_dir, outcome.requested).replace(/\\/g, "/") || outcome.requested;
2703
- const my_real_disp = node_path.relative(caller_dir, outcome.path).replace(/\\/g, "/") || outcome.path;
2762
+ const my_display = case_mismatch_display_paths(cd.raw_path, outcome, caller_dir);
2704
2763
  const my_seed = workspace_roots ? get_workspace_root_for_path(workspace_roots, outcome.path) ?? node_path.dirname(outcome.path) : node_path.dirname(outcome.path);
2705
2764
  return {
2706
- message: `Path "${my_req_disp}" does not match the directory on disk ` + `"${my_real_disp}"; Stata will not find it on case-sensitive ` + `filesystems (Linux). Update the path to match.`,
2765
+ message: `Path "${my_display.requested}" does not match the directory ` + `on disk "${my_display.on_disk}"; Stata will not find it on ` + `case-sensitive filesystems (Linux). Update the path to match.`,
2707
2766
  range: cd.range,
2708
2767
  severity: "warning",
2709
2768
  kind: "path_case_mismatch",
@@ -2722,7 +2781,7 @@ function apply_cd_timeline(forward_calls, timeline) {
2722
2781
  };
2723
2782
  });
2724
2783
  }
2725
- var FILE_COMMANDS, PATH_DIRECTIVES, STATA_FILE_EXTENSIONS, VCS_METADATA_DIRS, entry_is_dir, entry_is_file, case_sensitivity_cache;
2784
+ var FILE_COMMANDS, PATH_DIRECTIVES, STATA_FILE_EXTENSIONS, VCS_METADATA_DIRS, MAX_CASE_VARIANT_BACKTRACK_READS = 256, ASCII_UPPERCASE_PATTERN, entry_is_dir, entry_is_file, case_sensitivity_cache;
2726
2785
  var init_file_path_utils = __esm(() => {
2727
2786
  init_types();
2728
2787
  init_workspace_roots();
@@ -2755,6 +2814,7 @@ var init_file_path_utils = __esm(() => {
2755
2814
  ]);
2756
2815
  STATA_FILE_EXTENSIONS = [".do", ".ado", ".doh", ".mata"];
2757
2816
  VCS_METADATA_DIRS = new Set([".git", ".hg", ".svn"]);
2817
+ ASCII_UPPERCASE_PATTERN = /[A-Z]/g;
2758
2818
  entry_is_dir = entry_is_directory_sync;
2759
2819
  entry_is_file = entry_is_file_sync;
2760
2820
  case_sensitivity_cache = new Map;
@@ -22010,6 +22070,11 @@ function build_forward_closure_key(inputs) {
22010
22070
  inputs.dep_graph_version
22011
22071
  ]);
22012
22072
  }
22073
+ function mark_directory_casing(collector) {
22074
+ if (collector !== undefined) {
22075
+ collector.depends_on_directory_casing = true;
22076
+ }
22077
+ }
22013
22078
 
22014
22079
  class ForwardScopeResolver {
22015
22080
  scope_resolver;
@@ -22034,6 +22099,7 @@ class ForwardScopeResolver {
22034
22099
  };
22035
22100
  standalone_in_flight = new Set;
22036
22101
  active_probe_collectors = [];
22102
+ collector_by_visited = new WeakMap;
22037
22103
  dependency_graph;
22038
22104
  constructor(scope_resolver, config = {}) {
22039
22105
  this.scope_resolver = scope_resolver;
@@ -22066,7 +22132,7 @@ class ForwardScopeResolver {
22066
22132
  }
22067
22133
  invalidate_forward_closure_for_uri(uri) {
22068
22134
  this.memo_invalidation_epoch++;
22069
- const the_keys = this.memo_uri_to_keys.get(uri);
22135
+ const the_keys = this.memo_uri_to_keys.get(this.memo_index_key(uri));
22070
22136
  if (!the_keys) {
22071
22137
  return 0;
22072
22138
  }
@@ -22096,15 +22162,19 @@ class ForwardScopeResolver {
22096
22162
  }
22097
22163
  prune_memo_uri_to_keys_for_entry(key, entry) {
22098
22164
  for (const my_dep_uri of entry.dependent_uris) {
22099
- const my_key_set = this.memo_uri_to_keys.get(my_dep_uri);
22165
+ const my_index_key = this.memo_index_key(my_dep_uri);
22166
+ const my_key_set = this.memo_uri_to_keys.get(my_index_key);
22100
22167
  if (my_key_set) {
22101
22168
  my_key_set.delete(key);
22102
22169
  if (my_key_set.size === 0) {
22103
- this.memo_uri_to_keys.delete(my_dep_uri);
22170
+ this.memo_uri_to_keys.delete(my_index_key);
22104
22171
  }
22105
22172
  }
22106
22173
  }
22107
22174
  }
22175
+ memo_index_key(uri) {
22176
+ return ascii_case_fold(uri);
22177
+ }
22108
22178
  set_forward_closure_memo_capacity(max_entries) {
22109
22179
  this.forward_closure_memo.set_max_size(max_entries);
22110
22180
  }
@@ -22118,7 +22188,7 @@ class ForwardScopeResolver {
22118
22188
  for (const my_fs_path of fs_paths) {
22119
22189
  const my_probe_uri = URI.file(my_fs_path).toString();
22120
22190
  for (const my_collector of this.active_probe_collectors) {
22121
- my_collector.add(my_probe_uri);
22191
+ my_collector.probes.add(my_probe_uri);
22122
22192
  }
22123
22193
  }
22124
22194
  }
@@ -22137,7 +22207,7 @@ class ForwardScopeResolver {
22137
22207
  const resolved = path5.resolve(fs_path);
22138
22208
  return this.workspace_roots.some((root) => resolved.startsWith(root + path5.sep) || resolved === root);
22139
22209
  }
22140
- resolve_call_path(raw_path, caller_uri, working_directory) {
22210
+ resolve_call_path(raw_path, caller_uri, working_directory, casing_collector) {
22141
22211
  const my_caller_dir = path5.dirname(URI.parse(caller_uri).fsPath);
22142
22212
  const my_missed_candidates = this.active_probe_collectors.length > 0 ? [] : undefined;
22143
22213
  const my_outcome = resolve_forward_call_rich(raw_path, my_caller_dir, working_directory, {
@@ -22155,6 +22225,9 @@ class ForwardScopeResolver {
22155
22225
  };
22156
22226
  }
22157
22227
  if (my_outcome.kind === "case_only") {
22228
+ if (case_only_matched_directory(my_outcome)) {
22229
+ mark_directory_casing(casing_collector);
22230
+ }
22158
22231
  const my_seed = this.find_seed_dir(my_outcome.path);
22159
22232
  return {
22160
22233
  resolved_path: my_outcome.path,
@@ -22171,13 +22244,16 @@ class ForwardScopeResolver {
22171
22244
  find_seed_dir(fs_path) {
22172
22245
  return get_workspace_root_for_path(this.workspace_roots, fs_path) ?? path5.dirname(fs_path);
22173
22246
  }
22174
- resolve_call_path_simple(raw_path, caller_uri, working_directory) {
22247
+ resolve_call_path_simple(raw_path, caller_uri, working_directory, casing_collector) {
22175
22248
  const my_caller_dir = path5.dirname(URI.parse(caller_uri).fsPath);
22176
22249
  const my_outcome = resolve_forward_call_rich(raw_path, my_caller_dir, working_directory, {
22177
22250
  workspace_roots: this.workspace_roots.length > 0 ? this.workspace_roots : undefined,
22178
22251
  fs: this.resolve_fs
22179
22252
  });
22180
22253
  if (my_outcome.kind === "exact" || my_outcome.kind === "case_only") {
22254
+ if (my_outcome.kind === "case_only" && case_only_matched_directory(my_outcome)) {
22255
+ mark_directory_casing(casing_collector);
22256
+ }
22181
22257
  return my_outcome.path;
22182
22258
  }
22183
22259
  return null;
@@ -22205,13 +22281,21 @@ class ForwardScopeResolver {
22205
22281
  const the_call_sites = [];
22206
22282
  let accumulated_symbols = create_empty_symbol_table();
22207
22283
  const my_caller_dir = path5.dirname(URI.parse(file_uri).fsPath);
22208
- const { timeline: cd_timeline, diagnostics: cd_diagnostics } = build_cd_timeline({
22284
+ const my_casing_collector = this.collector_by_visited.get(my_context.visited);
22285
+ const {
22286
+ timeline: cd_timeline,
22287
+ diagnostics: cd_diagnostics,
22288
+ depends_on_directory_casing
22289
+ } = build_cd_timeline({
22209
22290
  starting_wd: my_context.working_directory,
22210
22291
  caller_dir: my_caller_dir,
22211
22292
  cd_commands: my_context.cd_commands ?? [],
22212
22293
  workspace_roots: this.workspace_roots.length > 0 ? this.workspace_roots : undefined,
22213
22294
  fs: this.resolve_fs
22214
22295
  });
22296
+ if (depends_on_directory_casing) {
22297
+ mark_directory_casing(my_casing_collector);
22298
+ }
22215
22299
  if (my_context.diagnostic_owner_uri !== undefined && file_uri === my_context.diagnostic_owner_uri && my_context.depth === 0) {
22216
22300
  const my_source_filename = path5.basename(URI.parse(file_uri).fsPath);
22217
22301
  for (const my_cd_diag of cd_diagnostics) {
@@ -22258,16 +22342,16 @@ class ForwardScopeResolver {
22258
22342
  break;
22259
22343
  }
22260
22344
  const my_effective_type = this.compute_effective_call_type(my_call.type, my_context.effective_call_type);
22261
- const my_path_result = this.resolve_call_path(my_call.raw_path, file_uri, effective_call_wd);
22345
+ const my_path_result = this.resolve_call_path(my_call.raw_path, file_uri, effective_call_wd, my_casing_collector);
22262
22346
  const resolved_path = my_path_result.resolved_path;
22263
22347
  const callee_uri = URI.file(resolved_path).toString();
22264
22348
  if (my_path_result.outcome_kind === "case_only" && my_context.diagnostic_owner_uri !== undefined && file_uri === my_context.diagnostic_owner_uri && my_context.depth === 0) {
22265
- const my_requested = my_path_result.requested_path ?? my_call.raw_path;
22266
- const my_real = my_path_result.resolved_path;
22267
- const my_req_disp = path5.relative(path5.dirname(URI.parse(file_uri).fsPath), my_requested).replace(/\\/g, "/") || my_requested;
22268
- const my_real_disp = path5.relative(path5.dirname(URI.parse(file_uri).fsPath), my_real).replace(/\\/g, "/") || my_real;
22349
+ const my_display = case_mismatch_display_paths(my_call.raw_path, {
22350
+ path: my_path_result.resolved_path,
22351
+ requested: my_path_result.requested_path ?? my_call.raw_path
22352
+ }, path5.dirname(URI.parse(file_uri).fsPath));
22269
22353
  my_context.diagnostics.push({
22270
- message: `Path "${my_req_disp}" does not match the file ` + `on disk "${my_real_disp}"; Stata will not find ` + `it on case-sensitive filesystems (Linux). ` + `Update the path to match.`,
22354
+ message: `Path "${my_display.requested}" does not match ` + `the file on disk "${my_display.on_disk}"; ` + `Stata will not find ` + `it on case-sensitive filesystems (Linux). ` + `Update the path to match.`,
22271
22355
  range: my_call.range,
22272
22356
  severity: "warning",
22273
22357
  kind: "path_case_mismatch",
@@ -22315,7 +22399,7 @@ class ForwardScopeResolver {
22315
22399
  if ("error" in callee_result) {
22316
22400
  continue;
22317
22401
  }
22318
- const effective_end_state = await this.compute_effective_end_state_locals(callee_uri, resolved_path, callee_result.working_directory ?? effective_call_wd, new Set(my_stack), my_context.depth + 1, resolved_config, token);
22402
+ const effective_end_state = await this.compute_effective_end_state_locals(callee_uri, resolved_path, callee_result.working_directory ?? effective_call_wd, new Set(my_stack), my_context.depth + 1, resolved_config, token, my_casing_collector);
22319
22403
  const boundary_excluded = effective_end_state.size > 0 ? effective_end_state : undefined;
22320
22404
  the_call_sites.push({
22321
22405
  callee_uri,
@@ -22363,7 +22447,7 @@ class ForwardScopeResolver {
22363
22447
  }
22364
22448
  let excluded_locals;
22365
22449
  if (my_call.type !== "include" && my_effective_type === "do" && my_context.depth === 0) {
22366
- const effective_end_state = await this.compute_effective_end_state_locals(callee_uri, resolved_path, callee_result.working_directory ?? effective_call_wd, new Set(my_stack), my_context.depth + 1, resolved_config, token);
22450
+ const effective_end_state = await this.compute_effective_end_state_locals(callee_uri, resolved_path, callee_result.working_directory ?? effective_call_wd, new Set(my_stack), my_context.depth + 1, resolved_config, token, my_casing_collector);
22367
22451
  if (effective_end_state.size > 0) {
22368
22452
  excluded_locals = effective_end_state;
22369
22453
  }
@@ -22465,8 +22549,12 @@ class ForwardScopeResolver {
22465
22549
  const fresh_diagnostics = [];
22466
22550
  this.memo_metrics.misses++;
22467
22551
  this.standalone_in_flight.add(callee_uri);
22468
- const my_probe_collector = new Set;
22552
+ const my_probe_collector = {
22553
+ probes: new Set,
22554
+ depends_on_directory_casing: false
22555
+ };
22469
22556
  this.active_probe_collectors.push(my_probe_collector);
22557
+ this.collector_by_visited.set(fresh_visited, my_probe_collector);
22470
22558
  let standalone;
22471
22559
  try {
22472
22560
  standalone = await this.resolve(callee_uri, forward_calls, effective_call_type, {
@@ -22489,6 +22577,7 @@ class ForwardScopeResolver {
22489
22577
  if (my_collector_index >= 0) {
22490
22578
  this.active_probe_collectors.splice(my_collector_index, 1);
22491
22579
  }
22580
+ this.collector_by_visited.delete(fresh_visited);
22492
22581
  }
22493
22582
  if (token?.isCancellationRequested) {
22494
22583
  return;
@@ -22502,9 +22591,9 @@ class ForwardScopeResolver {
22502
22591
  const dependent_uris = new Set([
22503
22592
  callee_uri,
22504
22593
  ...fresh_visited.keys(),
22505
- ...my_probe_collector
22594
+ ...my_probe_collector.probes
22506
22595
  ]);
22507
- if (fresh_diagnostics.length > 0) {
22596
+ if (fresh_diagnostics.length > 0 || my_probe_collector.depends_on_directory_casing) {
22508
22597
  return this.store_memo_entry(key, {
22509
22598
  kind: "unservable",
22510
22599
  dependent_uris
@@ -22525,10 +22614,11 @@ class ForwardScopeResolver {
22525
22614
  }
22526
22615
  this.forward_closure_memo.set(key, entry);
22527
22616
  for (const my_dep_uri of entry.dependent_uris) {
22528
- let my_key_set = this.memo_uri_to_keys.get(my_dep_uri);
22617
+ const my_index_key = this.memo_index_key(my_dep_uri);
22618
+ let my_key_set = this.memo_uri_to_keys.get(my_index_key);
22529
22619
  if (!my_key_set) {
22530
22620
  my_key_set = new Set;
22531
- this.memo_uri_to_keys.set(my_dep_uri, my_key_set);
22621
+ this.memo_uri_to_keys.set(my_index_key, my_key_set);
22532
22622
  }
22533
22623
  my_key_set.add(key);
22534
22624
  }
@@ -22581,7 +22671,7 @@ class ForwardScopeResolver {
22581
22671
  }
22582
22672
  return result;
22583
22673
  }
22584
- async compute_effective_end_state_locals(callee_uri, callee_fs_path, working_directory, stack, depth, resolved_config, token) {
22674
+ async compute_effective_end_state_locals(callee_uri, callee_fs_path, working_directory, stack, depth, resolved_config, token, casing_collector) {
22585
22675
  if (token?.isCancellationRequested)
22586
22676
  return new Map;
22587
22677
  if (stack.has(callee_uri))
@@ -22633,13 +22723,19 @@ class ForwardScopeResolver {
22633
22723
  the_events.sort((a, b) => a.line - b.line || a.character - b.character);
22634
22724
  const the_effective = new Map;
22635
22725
  const nested_base_wd = callee_result.working_directory ?? working_directory;
22636
- const { timeline: nested_cd_timeline } = build_cd_timeline({
22726
+ const {
22727
+ timeline: nested_cd_timeline,
22728
+ depends_on_directory_casing: nested_depends_on_casing
22729
+ } = build_cd_timeline({
22637
22730
  starting_wd: nested_base_wd,
22638
22731
  caller_dir: path5.dirname(URI.parse(callee_uri).fsPath),
22639
22732
  cd_commands: callee_result.cd_commands,
22640
22733
  workspace_roots: this.workspace_roots.length > 0 ? this.workspace_roots : undefined,
22641
22734
  fs: this.resolve_fs
22642
22735
  });
22736
+ if (nested_depends_on_casing) {
22737
+ mark_directory_casing(casing_collector);
22738
+ }
22643
22739
  for (const my_event of the_events) {
22644
22740
  if (token?.isCancellationRequested)
22645
22741
  break;
@@ -22647,12 +22743,12 @@ class ForwardScopeResolver {
22647
22743
  the_effective.set(my_event.name, my_event.symbol);
22648
22744
  } else {
22649
22745
  const event_wd = wd_for_position(nested_cd_timeline, my_event.call.range.start);
22650
- const nested_resolved = this.resolve_call_path_simple(my_event.call.raw_path, callee_uri, event_wd);
22746
+ const nested_resolved = this.resolve_call_path_simple(my_event.call.raw_path, callee_uri, event_wd, casing_collector);
22651
22747
  if (nested_resolved === null) {
22652
22748
  continue;
22653
22749
  }
22654
22750
  const nested_uri = URI.file(nested_resolved).toString();
22655
- const nested_effective = await this.compute_effective_end_state_locals(nested_uri, nested_resolved, event_wd, stack, depth + 1, resolved_config, token);
22751
+ const nested_effective = await this.compute_effective_end_state_locals(nested_uri, nested_resolved, event_wd, stack, depth + 1, resolved_config, token, casing_collector);
22656
22752
  for (const [my_name, my_symbol] of nested_effective) {
22657
22753
  the_effective.set(my_name, my_symbol);
22658
22754
  }
@@ -25487,8 +25583,8 @@ function is_missing(error) {
25487
25583
  return typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
25488
25584
  }
25489
25585
  function contains_path(root, target) {
25490
- const relative6 = path10.relative(root, target);
25491
- return relative6 !== ".." && !relative6.startsWith(`..${path10.sep}`) && !path10.isAbsolute(relative6);
25586
+ const relative5 = path10.relative(root, target);
25587
+ return relative5 !== ".." && !relative5.startsWith(`..${path10.sep}`) && !path10.isAbsolute(relative5);
25492
25588
  }
25493
25589
  function create_gitignore_matcher(workspace_roots, respect_gitignore = true) {
25494
25590
  if (!respect_gitignore || workspace_roots.length === 0) {
@@ -25535,8 +25631,8 @@ function create_gitignore_matcher(workspace_roots, respect_gitignore = true) {
25535
25631
  function matches_rules(context, absolute_path, kind) {
25536
25632
  if (context.ignored)
25537
25633
  return true;
25538
- const relative6 = path10.relative(context.rule_root, absolute_path).split(path10.sep).join("/");
25539
- return context.rules.ignores(kind === "directory" ? `${relative6}/` : relative6);
25634
+ const relative5 = path10.relative(context.rule_root, absolute_path).split(path10.sep).join("/");
25635
+ return context.rules.ignores(kind === "directory" ? `${relative5}/` : relative5);
25540
25636
  }
25541
25637
  function directory_context(scope, directory) {
25542
25638
  const cached = scope.directories.get(directory);
@@ -26628,9 +26724,9 @@ var require_parse = __commonJS((exports, module) => {
26628
26724
  const idx = prev.value.lastIndexOf("[");
26629
26725
  const pre = prev.value.slice(0, idx);
26630
26726
  const rest2 = prev.value.slice(idx + 2);
26631
- const posix3 = POSIX_REGEX_SOURCE[rest2];
26632
- if (posix3) {
26633
- prev.value = pre + posix3;
26727
+ const posix4 = POSIX_REGEX_SOURCE[rest2];
26728
+ if (posix4) {
26729
+ prev.value = pre + posix4;
26634
26730
  state.backtrack = true;
26635
26731
  advance();
26636
26732
  if (!bos.output && tokens.indexOf(prev) === 1) {
@@ -27151,7 +27247,7 @@ var require_picomatch = __commonJS((exports, module) => {
27151
27247
  throw new TypeError("Expected pattern to be a non-empty string");
27152
27248
  }
27153
27249
  const opts = options || {};
27154
- const posix3 = opts.windows;
27250
+ const posix4 = opts.windows;
27155
27251
  const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
27156
27252
  const state = regex.state;
27157
27253
  delete regex.state;
@@ -27161,8 +27257,8 @@ var require_picomatch = __commonJS((exports, module) => {
27161
27257
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
27162
27258
  }
27163
27259
  const matcher = (input, returnObject = false) => {
27164
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix: posix3 });
27165
- const result = { glob, state, regex, posix: posix3, input, output, match, isMatch };
27260
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix: posix4 });
27261
+ const result = { glob, state, regex, posix: posix4, input, output, match, isMatch };
27166
27262
  if (typeof opts.onResult === "function") {
27167
27263
  opts.onResult(result);
27168
27264
  }
@@ -27187,7 +27283,7 @@ var require_picomatch = __commonJS((exports, module) => {
27187
27283
  }
27188
27284
  return matcher;
27189
27285
  };
27190
- picomatch.test = (input, regex, options, { glob, posix: posix3 } = {}) => {
27286
+ picomatch.test = (input, regex, options, { glob, posix: posix4 } = {}) => {
27191
27287
  if (typeof input !== "string") {
27192
27288
  throw new TypeError("Expected input to be a string");
27193
27289
  }
@@ -27195,7 +27291,7 @@ var require_picomatch = __commonJS((exports, module) => {
27195
27291
  return { isMatch: false, output: "" };
27196
27292
  }
27197
27293
  const opts = options || {};
27198
- const format = opts.format || (posix3 ? utils.toPosixSlashes : null);
27294
+ const format = opts.format || (posix4 ? utils.toPosixSlashes : null);
27199
27295
  let match = input === glob;
27200
27296
  let output = match && format ? format(input) : input;
27201
27297
  if (match === false) {
@@ -27204,7 +27300,7 @@ var require_picomatch = __commonJS((exports, module) => {
27204
27300
  }
27205
27301
  if (match === false || opts.capture === true) {
27206
27302
  if (opts.matchBase === true || opts.basename === true) {
27207
- match = picomatch.matchBase(input, regex, options, posix3);
27303
+ match = picomatch.matchBase(input, regex, options, posix4);
27208
27304
  } else {
27209
27305
  match = regex.exec(output);
27210
27306
  }
@@ -27357,12 +27453,12 @@ function create_exclude_matcher(patterns) {
27357
27453
  return {
27358
27454
  is_empty: false,
27359
27455
  is_excluded_file(abs_path, workspace_roots) {
27360
- const relative6 = relative_to_containing_root(abs_path, workspace_roots);
27361
- if (relative6 === null || relative6 === "")
27456
+ const relative5 = relative_to_containing_root(abs_path, workspace_roots);
27457
+ if (relative5 === null || relative5 === "")
27362
27458
  return false;
27363
27459
  let excluded = false;
27364
27460
  for (const my_rule of compiled) {
27365
- if (my_rule.match(relative6)) {
27461
+ if (my_rule.match(relative5)) {
27366
27462
  excluded = !my_rule.is_negated;
27367
27463
  }
27368
27464
  }
@@ -27371,8 +27467,8 @@ function create_exclude_matcher(patterns) {
27371
27467
  is_excluded_dir(abs_path, workspace_roots) {
27372
27468
  if (dir_match === null)
27373
27469
  return false;
27374
- const relative6 = relative_to_containing_root(abs_path, workspace_roots);
27375
- return relative6 !== null && relative6 !== "" && dir_match(relative6);
27470
+ const relative5 = relative_to_containing_root(abs_path, workspace_roots);
27471
+ return relative5 !== null && relative5 !== "" && dir_match(relative5);
27376
27472
  }
27377
27473
  };
27378
27474
  }
@@ -35121,20 +35217,20 @@ function canonicalize_existing_path(file_path) {
35121
35217
  return fs13.realpathSync.native(file_path);
35122
35218
  }
35123
35219
  function workspace_relative(workspace_root, file_path) {
35124
- const relative7 = path14.relative(workspace_root, file_path);
35125
- const inside = relative7 !== ".." && !relative7.startsWith(`..${path14.sep}`) && !path14.isAbsolute(relative7);
35126
- return { relative: relative7, inside };
35220
+ const relative6 = path14.relative(workspace_root, file_path);
35221
+ const inside = relative6 !== ".." && !relative6.startsWith(`..${path14.sep}`) && !path14.isAbsolute(relative6);
35222
+ return { relative: relative6, inside };
35127
35223
  }
35128
35224
  function relative_path(workspace_root, file_path) {
35129
- const { relative: relative7 } = workspace_relative(workspace_root, file_path);
35130
- if (relative7 === "") {
35225
+ const { relative: relative6 } = workspace_relative(workspace_root, file_path);
35226
+ if (relative6 === "") {
35131
35227
  return ".";
35132
35228
  }
35133
- return path14.isAbsolute(relative7) ? file_path : relative7.split(path14.sep).join("/");
35229
+ return path14.isAbsolute(relative6) ? file_path : relative6.split(path14.sep).join("/");
35134
35230
  }
35135
35231
  function is_within_workspace(workspace_root, file_path) {
35136
- const { relative: relative7, inside } = workspace_relative(workspace_root, file_path);
35137
- return relative7 === "" || relative7.length > 0 && inside;
35232
+ const { relative: relative6, inside } = workspace_relative(workspace_root, file_path);
35233
+ return relative6 === "" || relative6.length > 0 && inside;
35138
35234
  }
35139
35235
  function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_matcher, gitignore_matcher) {
35140
35236
  if (gitignore_matcher.is_ignored(dir_path, "directory"))
@@ -37418,11 +37514,11 @@ ${source_info}${footer}`
37418
37514
  if (workspace_fs_path === null) {
37419
37515
  return fs_path;
37420
37516
  }
37421
- const relative8 = path16.relative(workspace_fs_path, fs_path);
37422
- if (relative8.startsWith("..") || path16.isAbsolute(relative8)) {
37517
+ const relative7 = path16.relative(workspace_fs_path, fs_path);
37518
+ if (relative7.startsWith("..") || path16.isAbsolute(relative7)) {
37423
37519
  return fs_path;
37424
37520
  }
37425
- return relative8;
37521
+ return relative7;
37426
37522
  }
37427
37523
  format_source_link(source_uri, current_uri, workspace_root) {
37428
37524
  const source_path = this.normalize_file_path(source_uri);
@@ -73502,8 +73598,8 @@ async function create_server(options) {
73502
73598
  function is_relevant_gitignore(uri) {
73503
73599
  const directory = path19.dirname(URI.parse(uri).fsPath);
73504
73600
  return gitignore_watch_directories.some((watch) => {
73505
- const relative9 = path19.relative(watch.directory, directory);
73506
- return relative9 === "" || watch.recursive && relative9 !== ".." && !relative9.startsWith(`..${path19.sep}`) && !path19.isAbsolute(relative9);
73601
+ const relative8 = path19.relative(watch.directory, directory);
73602
+ return relative8 === "" || watch.recursive && relative8 !== ".." && !relative8.startsWith(`..${path19.sep}`) && !path19.isAbsolute(relative8);
73507
73603
  });
73508
73604
  }
73509
73605
  function schedule_gitignore_refresh() {
@@ -74526,4 +74622,4 @@ export {
74526
74622
  is_cli_entry_point
74527
74623
  };
74528
74624
 
74529
- //# debugId=47C20F7ACC43ED9664756E2164756E21
74625
+ //# debugId=7D74EF27B76852CD64756E2164756E21
@@ -1 +1 @@
1
- 65f2c1d1eb4d0efd5e73e44566ce6a00345e4c8e38f623c055fabb4b1e954f0e sight-server.js
1
+ 6cb7a3ff1e19375396733e1315ef0fc4c003f25802a8144cb68ff5ef92d8bdf9 sight-server.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbearak/sight",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  "client"