@ripple-ts/language-server 0.3.97 → 0.3.99

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-DhFWQsiH.js');
2
+ const require_server = require('./server-BDTOWnFL.js');
3
3
 
4
4
  //#region src/language-server.js
5
5
  require_server.createRippleLanguageServer();
@@ -734,7 +734,7 @@ const { log: log$9, logWarning, logError: logError$4 } = createLogging("[Ripple
734
734
  /** @type {Set<string>} */
735
735
  const loggedCompilationFailures = /* @__PURE__ */ new Set();
736
736
  const RIPPLE_EXTENSIONS$1 = [".tsrx"];
737
- /** @typedef {[string, string[], string[], string[]]} CompilerCandidate */
737
+ /** @typedef {[string, string[], string[], string[], string[]?]} CompilerCandidate */
738
738
  /** @type {CompilerCandidate[]} */
739
739
  const COMPILER_CANDIDATES = [
740
740
  [
@@ -790,8 +790,20 @@ const COMPILER_CANDIDATES = [
790
790
  ],
791
791
  [".tsrx"],
792
792
  ["@tsrx/vue", "@tsrx/vite-plugin-vue"]
793
+ ],
794
+ [
795
+ "octane",
796
+ ["node_modules", "octane"],
797
+ [".tsrx"],
798
+ ["octane", "@octanejs/vite-plugin"],
799
+ [
800
+ "src",
801
+ "compiler",
802
+ "volar.js"
803
+ ]
793
804
  ]
794
805
  ];
806
+ const DEFAULT_COMPILER_ENTRY_PARTS = ["src", "index.js"];
795
807
  /**
796
808
  * @param {string} file_name
797
809
  * @returns {boolean}
@@ -852,6 +864,7 @@ function getRippleLanguagePlugin() {
852
864
  scriptKind: 4
853
865
  };
854
866
  },
867
+ ...process.env.TSRX_TSC === "true" ? null : {
855
868
  /**
856
869
  * Register each embedded `<script>` body as its own TypeScript service
857
870
  * script so volar-service-typescript's semantic features (type-aware
@@ -867,7 +880,7 @@ function getRippleLanguagePlugin() {
867
880
  * @param {string} fileName
868
881
  * @param {VirtualCode} ripple_code
869
882
  */
870
- getExtraServiceScripts(fileName, ripple_code) {
883
+ getExtraServiceScripts(fileName, ripple_code) {
871
884
  /** @type {Array<{ fileName: string, code: VirtualCode, extension: string, scriptKind: number }>} */
872
885
  const scripts = [];
873
886
  for (const code of (0, import_language_core.forEachEmbeddedCode)(ripple_code)) if (code.languageId === "typescript") scripts.push({
@@ -877,7 +890,7 @@ function getRippleLanguagePlugin() {
877
890
  scriptKind: typescript.default.ScriptKind.TS
878
891
  });
879
892
  return scripts;
880
- }
893
+ } }
881
894
  }
882
895
  };
883
896
  }
@@ -1431,7 +1444,14 @@ function package_manifest_matches_compiler(package_manifest, compiler_name, pack
1431
1444
  */
1432
1445
  function get_tsrx_compiler(normalized_file_name) {
1433
1446
  const compiler_path = get_compiler_entry_for_file(normalized_file_name);
1434
- if (compiler_path) return require$2(compiler_path);
1447
+ if (compiler_path) {
1448
+ const compiler_module = require$2(compiler_path);
1449
+ if (typeof compiler_module?.compile_to_volar_mappings !== "function" && typeof compiler_module?.compileToVolarMappings === "function") return {
1450
+ ...compiler_module,
1451
+ compile_to_volar_mappings: compiler_module.compileToVolarMappings
1452
+ };
1453
+ return compiler_module;
1454
+ }
1435
1455
  }
1436
1456
  /**
1437
1457
  * @param {string} normalized_file_name
@@ -1448,13 +1468,12 @@ function find_workspace_compiler_entry_for_file(normalized_file_name, exists_syn
1448
1468
  if (!compiler_path_map.has(cache_key)) {
1449
1469
  /** @type {Array<[string, string, string[]]>} */
1450
1470
  const available_candidates = [];
1451
- for (const [compiler_name, compiler_dir_parts, supported_extensions, package_hints] of COMPILER_CANDIDATES) {
1471
+ for (const [compiler_name, compiler_dir_parts, supported_extensions, package_hints, entry_parts = DEFAULT_COMPILER_ENTRY_PARTS] of COMPILER_CANDIDATES) {
1452
1472
  if (!supported_extensions.includes(ext)) continue;
1453
1473
  const full_path = [
1454
1474
  dir,
1455
1475
  ...compiler_dir_parts,
1456
- "src",
1457
- "index.js"
1476
+ ...entry_parts
1458
1477
  ].join("/");
1459
1478
  if (exists_sync(full_path)) available_candidates.push([
1460
1479
  compiler_name,
@@ -1488,10 +1507,10 @@ function get_compiler_entry_for_file(normalized_file_name) {
1488
1507
  while (current_dir) {
1489
1508
  /** @type {Array<[string, string, string[]]>} */
1490
1509
  const available_candidates = [];
1491
- for (const [compiler_name, compiler_dir_parts, supported_extensions, package_hints] of COMPILER_CANDIDATES) {
1510
+ for (const [compiler_name, compiler_dir_parts, supported_extensions, package_hints, entry_parts = DEFAULT_COMPILER_ENTRY_PARTS] of COMPILER_CANDIDATES) {
1492
1511
  if (!supported_extensions.includes(ext)) continue;
1493
1512
  const full_path = path.default.join(current_dir, ...compiler_dir_parts);
1494
- const entry_path = path.default.join(full_path, "src", "index.js");
1513
+ const entry_path = path.default.join(full_path, ...entry_parts);
1495
1514
  if (fs.default.existsSync(entry_path)) available_candidates.push([
1496
1515
  compiler_name,
1497
1516
  entry_path,
@@ -1521,12 +1540,8 @@ function get_tsrx_compiler_name_for_file(file_name) {
1521
1540
  const entry = get_compiler_entry_for_file(file_name.replace(/\\/g, "/"));
1522
1541
  if (!entry) return;
1523
1542
  const normalized_entry = entry.replace(/\\/g, "/");
1524
- for (const [compiler_name, compiler_dir_parts] of COMPILER_CANDIDATES) {
1525
- const suffix = "/" + [
1526
- ...compiler_dir_parts,
1527
- "src",
1528
- "index.js"
1529
- ].join("/");
1543
+ for (const [compiler_name, compiler_dir_parts, , , entry_parts = DEFAULT_COMPILER_ENTRY_PARTS] of COMPILER_CANDIDATES) {
1544
+ const suffix = "/" + [...compiler_dir_parts, ...entry_parts].join("/");
1530
1545
  if (normalized_entry.endsWith(suffix)) return compiler_name;
1531
1546
  }
1532
1547
  }
@@ -22698,4 +22713,4 @@ Object.defineProperty(exports, 'createRippleLanguageServer', {
22698
22713
  return createRippleLanguageServer;
22699
22714
  }
22700
22715
  });
22701
- //# sourceMappingURL=server-DhFWQsiH.js.map
22716
+ //# sourceMappingURL=server-BDTOWnFL.js.map