@tsrx/language-server 0.7.0 → 0.7.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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_server = require('./server-B_LRzE1h.js');
2
+ const require_server = require('./server-ni8rJaUl.js');
3
3
 
4
4
  //#region src/language-server.js
5
5
  require_server.createTsrxLanguageServer();
@@ -2064,8 +2064,6 @@ function extract_regions(code, regex, tag_name_length, id_prefix) {
2064
2064
  const require$2 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
2065
2065
  const root_dirname = path.default.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
2066
2066
  const { log: log$9, logWarning, logError: logError$4 } = createLogging("[TSRX Language]");
2067
- /** @type {Set<string>} */
2068
- const loggedCompilationFailures = /* @__PURE__ */ new Set();
2069
2067
  const TSRX_EXTENSIONS$1 = [".tsrx"];
2070
2068
  /**
2071
2069
  * `[package name, package directory parts, supported extensions, package hints, entry candidates?]`.
@@ -2504,7 +2502,6 @@ var TSRXVirtualCode = class {
2504
2502
  }
2505
2503
  if (result.fatalError) {
2506
2504
  logError$4("TSRX compilation failed for", this.fileName, ":", result.fatalError);
2507
- if (process.env.TSRX_TSC === "true") logTSRXErrors(this.fileName, [result.fatalError], newCode);
2508
2505
  this.fatalErrors.push(result.fatalError);
2509
2506
  files_with_fatal_compile_error.add(normalize_file_name_key(this.fileName));
2510
2507
  } else {
@@ -2518,7 +2515,6 @@ var TSRXVirtualCode = class {
2518
2515
  this.usageErrors = result.errors;
2519
2516
  this.sourceAst = result.sourceAst;
2520
2517
  this.scriptRegions = result.scriptRegions;
2521
- if (process.env.TSRX_TSC === "true" && result.errors.length > 0) logTSRXErrors(this.fileName, result.errors, newCode);
2522
2518
  if (result.cssRegions.length > 0) log$9("Creating", result.cssRegions.length, "CSS embedded codes");
2523
2519
  this.embeddedCodes = result.cssRegions.map((region) => create_embedded_code_from_region(region, "css"));
2524
2520
  if (DEBUG) {
@@ -2658,72 +2654,6 @@ function clamp_offset(offset, length) {
2658
2654
  return Math.min(Math.max(offset, 0), length);
2659
2655
  }
2660
2656
  /**
2661
- * @typedef {{
2662
- * message?: unknown,
2663
- * code?: unknown,
2664
- * severity?: unknown,
2665
- * type?: unknown,
2666
- * pos?: unknown,
2667
- * loc?: { line?: unknown, column?: unknown, start?: { line?: unknown, column?: unknown } },
2668
- * }} LoggedDiagnostic
2669
- */
2670
- /**
2671
- * Mirrors compiler diagnostics to stderr under `tsrx-tsc`. The line follows
2672
- * tsc's `file(line,col): error TS2339: message` convention — position when the
2673
- * diagnostic has one, then severity and the diagnostic `code` — so output is
2674
- * greppable by code and actionable by position. A thrown (fatal) error stops
2675
- * the compile, so it prints as an error whatever its `severity`, as the
2676
- * language server shows it.
2677
- * @param {string} file_name
2678
- * @param {ReadonlyArray<unknown>} errors
2679
- * @param {string} source the compiled text, which a diagnostic's `pos` indexes
2680
- */
2681
- function logTSRXErrors(file_name, errors, source) {
2682
- for (const error of errors) {
2683
- const details = error && typeof error === "object" ? error : void 0;
2684
- const message = details && "message" in details ? String(details.message) : String(error);
2685
- const severity = details?.severity === "warning" && details.type !== "fatal" ? "warning" : "error";
2686
- const code = typeof details?.code === "string" && details.code.length > 0 ? details.code : void 0;
2687
- const label = code === void 0 ? severity : `${severity} ${code}`;
2688
- const start = diagnostic_start(details, source);
2689
- const position = start ? `(${start.line},${start.column + 1})` : "";
2690
- const key = `${file_name}\0${position}\0${label}\0${message}`;
2691
- if (loggedCompilationFailures.has(key)) continue;
2692
- loggedCompilationFailures.add(key);
2693
- console.error(`[tsrx-tsc] ${file_name}${position}: ${label}: ${message}`);
2694
- }
2695
- }
2696
- const LINE_BREAK = /\r\n?|[\n\u2028\u2029]/g;
2697
- /**
2698
- * Where a diagnostic starts, as a 1-based line and a 0-based column. A
2699
- * collected error's `loc` is a range, and a parse error acorn throws gives its
2700
- * position as `loc` itself (`{ line, column }`). A diagnostic without `loc`,
2701
- * such as one a consumer compiler builds with only `pos` and `end`, is placed
2702
- * by `pos` in `source`, breaking lines where tsc does.
2703
- * @param {LoggedDiagnostic | undefined} details
2704
- * @param {string} source
2705
- * @returns {{ line: number, column: number } | undefined}
2706
- */
2707
- function diagnostic_start(details, source) {
2708
- const start = details?.loc?.start ?? details?.loc;
2709
- if (typeof start?.line === "number" && typeof start?.column === "number") return {
2710
- line: start.line,
2711
- column: start.column
2712
- };
2713
- const pos = details?.pos;
2714
- if (typeof pos !== "number" || pos < 0 || pos > source.length) return void 0;
2715
- let line = 1;
2716
- let line_start = 0;
2717
- for (const match of source.slice(0, pos).matchAll(LINE_BREAK)) {
2718
- line++;
2719
- line_start = match.index + match[0].length;
2720
- }
2721
- return {
2722
- line,
2723
- column: pos - line_start
2724
- };
2725
- }
2726
- /**
2727
2657
  * Build an embedded virtual code from a `<style>` / `<script>` region produced
2728
2658
  * by the transform. The embedded document text is the region's content;
2729
2659
  * `languageId` selects which Volar service handles it (`css` or `typescript`).
@@ -3122,7 +3052,6 @@ function invalidateCompilerResolutionCaches() {
3122
3052
  path2TsrxCompilerPathMap.clear();
3123
3053
  pathToPackageManifestCache.clear();
3124
3054
  reset_consumer_compiler_resolution_caches();
3125
- loggedCompilationFailures.clear();
3126
3055
  }
3127
3056
  /**
3128
3057
  * Drop cached definition-file content and matches. A path invalidates only one
@@ -26328,4 +26257,4 @@ Object.defineProperty(exports, 'createTsrxLanguageServer', {
26328
26257
  return createTsrxLanguageServer;
26329
26258
  }
26330
26259
  });
26331
- //# sourceMappingURL=server-B_LRzE1h.js.map
26260
+ //# sourceMappingURL=server-ni8rJaUl.js.map