modern-monaco 0.1.4 → 0.1.6

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.
@@ -1603,33 +1603,33 @@ import libs from "./libs.js";
1603
1603
  import { cache } from "../../cache.js";
1604
1604
  import { initializeWorker } from "../../editor-worker.js";
1605
1605
  var TypeScriptWorker = class extends WorkerBase {
1606
- _compilerOptions;
1607
- _importMap;
1608
- _importMapVersion;
1609
- _isBlankImportMap;
1610
- _types;
1611
- _formatOptions;
1612
- _languageService = ts.createLanguageService(this);
1613
- _urlMappings = /* @__PURE__ */ new Map();
1614
- _typesMappings = /* @__PURE__ */ new Map();
1615
- _httpLibs = /* @__PURE__ */ new Map();
1616
- _httpModules = /* @__PURE__ */ new Map();
1617
- _httpTsModules = /* @__PURE__ */ new Map();
1618
- _redirectedImports = [];
1619
- _unknownImports = /* @__PURE__ */ new Set();
1620
- _badImports = /* @__PURE__ */ new Set();
1621
- _openPromises = /* @__PURE__ */ new Map();
1622
- _fetchPromises = /* @__PURE__ */ new Map();
1623
- _httpDocumentCache = /* @__PURE__ */ new Map();
1606
+ #compilerOptions;
1607
+ #formatOptions;
1608
+ #importMap;
1609
+ #importMapVersion;
1610
+ #isBlankImportMap;
1611
+ #types;
1612
+ #languageService = ts.createLanguageService(this);
1613
+ #urlMappings = /* @__PURE__ */ new Map();
1614
+ #typesMappings = /* @__PURE__ */ new Map();
1615
+ #httpLibs = /* @__PURE__ */ new Map();
1616
+ #httpModules = /* @__PURE__ */ new Map();
1617
+ #httpTsModules = /* @__PURE__ */ new Map();
1618
+ #redirectedImports = [];
1619
+ #unknownImports = /* @__PURE__ */ new Set();
1620
+ #badImports = /* @__PURE__ */ new Set();
1621
+ #openPromises = /* @__PURE__ */ new Map();
1622
+ #fetchPromises = /* @__PURE__ */ new Map();
1623
+ #httpDocumentCache = /* @__PURE__ */ new Map();
1624
1624
  constructor(ctx, createData) {
1625
1625
  super(ctx);
1626
- this._compilerOptions = ts.convertCompilerOptionsFromJson(createData.compilerOptions, ".").options;
1627
- this._importMap = createData.importMap;
1628
- this._importMapVersion = 0;
1629
- this._isBlankImportMap = isBlankImportMap(createData.importMap);
1630
- this._types = createData.types;
1631
- this._formatOptions = createData.formatOptions;
1632
- this._updateJsxImportSource();
1626
+ this.#compilerOptions = ts.convertCompilerOptionsFromJson(createData.compilerOptions, ".").options;
1627
+ this.#importMap = createData.importMap;
1628
+ this.#importMapVersion = 0;
1629
+ this.#isBlankImportMap = isBlankImportMap(createData.importMap);
1630
+ this.#types = createData.types;
1631
+ this.#formatOptions = createData.formatOptions;
1632
+ this.#updateJsxImportSource();
1633
1633
  }
1634
1634
  // #region language service host
1635
1635
  getCurrentDirectory() {
@@ -1641,30 +1641,30 @@ var TypeScriptWorker = class extends WorkerBase {
1641
1641
  }
1642
1642
  if (path.startsWith("file:///node_modules/")) {
1643
1643
  const dirname = path.slice("file:///node_modules/".length);
1644
- return Object.keys(this._importMap.imports).filter((key) => key !== "@jsxRuntime" && (dirname.length === 0 || key.startsWith(dirname))).map((key) => dirname.length > 0 ? key.slice(dirname.length) : key).filter((key) => key !== "/" && key.includes("/")).map((key) => key.split("/")[0]);
1644
+ return Object.keys(this.#importMap.imports).filter((key) => key !== "@jsxRuntime" && (dirname.length === 0 || key.startsWith(dirname))).map((key) => dirname.length > 0 ? key.slice(dirname.length) : key).filter((key) => key !== "/" && key.includes("/")).map((key) => key.split("/")[0]);
1645
1645
  }
1646
1646
  return this.readDir(path).filter(([_, type]) => type === 2 /* Directory */).map(([name, _]) => name);
1647
1647
  }
1648
1648
  readDirectory(path, extensions, exclude, include, depth) {
1649
1649
  if (path.startsWith("file:///node_modules/")) {
1650
1650
  const dirname = path.slice("file:///node_modules/".length);
1651
- return Object.keys(this._importMap.imports).filter((key) => key !== "@jsxRuntime" && (dirname.length === 0 || key.startsWith(dirname))).map((key) => dirname.length > 0 ? key.slice(dirname.length) : key).filter((key) => !key.includes("/"));
1651
+ return Object.keys(this.#importMap.imports).filter((key) => key !== "@jsxRuntime" && (dirname.length === 0 || key.startsWith(dirname))).map((key) => dirname.length > 0 ? key.slice(dirname.length) : key).filter((key) => !key.includes("/"));
1652
1652
  }
1653
1653
  return this.readDir(path, extensions).filter(([_, type]) => type === 1 /* File */).map(([name, _]) => name);
1654
1654
  }
1655
1655
  fileExists(filename) {
1656
1656
  if (filename.startsWith("/node_modules/")) return false;
1657
- return filename in libs || `lib.${filename}.d.ts` in libs || filename in this._types || this._httpLibs.has(filename) || this._httpModules.has(filename) || this._httpTsModules.has(filename) || this.hasModel(filename);
1657
+ return filename in libs || `lib.${filename}.d.ts` in libs || filename in this.#types || this.#httpLibs.has(filename) || this.#httpModules.has(filename) || this.#httpTsModules.has(filename) || this.hasModel(filename);
1658
1658
  }
1659
1659
  readFile(filename) {
1660
- return this._getScriptText(filename);
1660
+ return this.#getScriptText(filename);
1661
1661
  }
1662
1662
  getScriptFileNames() {
1663
1663
  const models = this.getMirrorModels();
1664
- const types = Object.keys(this._types);
1664
+ const types = Object.keys(this.#types);
1665
1665
  const libNames = Object.keys(libs);
1666
1666
  const filenames = new Array(
1667
- models.length + types.length + libNames.length + this._httpLibs.size + this._httpModules.size + this._httpTsModules.size
1667
+ models.length + types.length + libNames.length + this.#httpLibs.size + this.#httpModules.size + this.#httpTsModules.size
1668
1668
  );
1669
1669
  let i = 0;
1670
1670
  for (const model of models) {
@@ -1676,39 +1676,39 @@ var TypeScriptWorker = class extends WorkerBase {
1676
1676
  for (const filename of libNames) {
1677
1677
  filenames[i++] = filename;
1678
1678
  }
1679
- for (const filename of this._httpLibs.keys()) {
1679
+ for (const filename of this.#httpLibs.keys()) {
1680
1680
  filenames[i++] = filename;
1681
1681
  }
1682
- for (const filename of this._httpModules.keys()) {
1682
+ for (const filename of this.#httpModules.keys()) {
1683
1683
  filenames[i++] = filename;
1684
1684
  }
1685
- for (const filename of this._httpTsModules.keys()) {
1685
+ for (const filename of this.#httpTsModules.keys()) {
1686
1686
  filenames[i++] = filename;
1687
1687
  }
1688
1688
  return filenames;
1689
1689
  }
1690
1690
  getScriptVersion(fileName) {
1691
- if (fileName in this._types) {
1692
- return String(this._types[fileName].version);
1691
+ if (fileName in this.#types) {
1692
+ return String(this.#types[fileName].version);
1693
1693
  }
1694
- if (fileName in libs || fileName in this._types || this._httpLibs.has(fileName) || this._httpModules.has(fileName) || this._httpTsModules.has(fileName)) {
1694
+ if (fileName in libs || fileName in this.#types || this.#httpLibs.has(fileName) || this.#httpModules.has(fileName) || this.#httpTsModules.has(fileName)) {
1695
1695
  return "1";
1696
1696
  }
1697
1697
  const model = this.getModel(fileName);
1698
1698
  if (model) {
1699
- return this._importMapVersion + "." + model.version;
1699
+ return this.#importMapVersion + "." + model.version;
1700
1700
  }
1701
1701
  return "0";
1702
1702
  }
1703
1703
  getScriptSnapshot(fileName) {
1704
- const text = this._getScriptText(fileName);
1704
+ const text = this.#getScriptText(fileName);
1705
1705
  if (text === void 0) {
1706
1706
  return void 0;
1707
1707
  }
1708
1708
  return ts.ScriptSnapshot.fromString(text);
1709
1709
  }
1710
1710
  getCompilationSettings() {
1711
- return this._compilerOptions;
1711
+ return this.#compilerOptions;
1712
1712
  }
1713
1713
  getDefaultLibFileName(options) {
1714
1714
  switch (options.target) {
@@ -1725,6 +1725,7 @@ var TypeScriptWorker = class extends WorkerBase {
1725
1725
  case 8:
1726
1726
  case 9:
1727
1727
  case 10:
1728
+ case 11:
1728
1729
  return `lib.es${2013 + options.target}.full.d.ts`;
1729
1730
  case 99:
1730
1731
  return "lib.esnext.full.d.ts";
@@ -1733,12 +1734,12 @@ var TypeScriptWorker = class extends WorkerBase {
1733
1734
  }
1734
1735
  }
1735
1736
  resolveModuleNameLiterals(moduleLiterals, containingFile, _redirectedReference, _options, _containingSourceFile, _reusedNames) {
1736
- this._redirectedImports = this._redirectedImports.filter(([modelUrl]) => modelUrl !== containingFile);
1737
+ this.#redirectedImports = this.#redirectedImports.filter(([modelUrl]) => modelUrl !== containingFile);
1737
1738
  return moduleLiterals.map((literal) => {
1738
1739
  let specifier = literal.text;
1739
1740
  let importMapResolved = false;
1740
- if (!this._isBlankImportMap) {
1741
- const [url, resolved] = resolve(this._importMap, specifier, containingFile);
1741
+ if (!this.#isBlankImportMap) {
1742
+ const [url, resolved] = resolve(this.#importMap, specifier, containingFile);
1742
1743
  importMapResolved = resolved;
1743
1744
  if (importMapResolved) {
1744
1745
  specifier = url;
@@ -1759,7 +1760,7 @@ var TypeScriptWorker = class extends WorkerBase {
1759
1760
  moduleUrl.pathname += ext;
1760
1761
  }
1761
1762
  }
1762
- if (this._httpModules.has(containingFile)) {
1763
+ if (this.#httpModules.has(containingFile)) {
1763
1764
  return {
1764
1765
  resolvedFileName: moduleUrl.href,
1765
1766
  extension: ".js"
@@ -1767,7 +1768,7 @@ var TypeScriptWorker = class extends WorkerBase {
1767
1768
  }
1768
1769
  if (moduleUrl.protocol === "file:") {
1769
1770
  const moduleHref = moduleUrl.href;
1770
- if (this._badImports.has(moduleHref)) {
1771
+ if (this.#badImports.has(moduleHref)) {
1771
1772
  return void 0;
1772
1773
  }
1773
1774
  for (const model of this.getMirrorModels()) {
@@ -1781,96 +1782,96 @@ var TypeScriptWorker = class extends WorkerBase {
1781
1782
  if (!this.hasFileSystemProvider) {
1782
1783
  return void 0;
1783
1784
  }
1784
- if (!this._openPromises.has(moduleHref)) {
1785
- this._openPromises.set(
1785
+ if (!this.#openPromises.has(moduleHref)) {
1786
+ this.#openPromises.set(
1786
1787
  moduleHref,
1787
1788
  this.host.openModel(moduleHref).then((ok) => {
1788
1789
  if (!ok) {
1789
- this._badImports.add(moduleHref);
1790
- this._rollbackVersion(containingFile);
1790
+ this.#badImports.add(moduleHref);
1791
+ this.#rollbackVersion(containingFile);
1791
1792
  }
1792
1793
  }).finally(() => {
1793
- this._openPromises.delete(moduleHref);
1794
+ this.#openPromises.delete(moduleHref);
1794
1795
  this.host.refreshDiagnostics(containingFile);
1795
1796
  })
1796
1797
  );
1797
1798
  }
1798
1799
  } else {
1799
1800
  const moduleHref = moduleUrl.href;
1800
- if (this._badImports.has(moduleHref) || this._unknownImports.has(moduleHref)) {
1801
+ if (this.#badImports.has(moduleHref) || this.#unknownImports.has(moduleHref)) {
1801
1802
  return void 0;
1802
1803
  }
1803
- if (!importMapResolved && this._urlMappings.has(moduleHref)) {
1804
- const redirectUrl = this._urlMappings.get(moduleHref);
1805
- this._redirectedImports.push([containingFile, literal, redirectUrl]);
1804
+ if (!importMapResolved && this.#urlMappings.has(moduleHref)) {
1805
+ const redirectUrl = this.#urlMappings.get(moduleHref);
1806
+ this.#redirectedImports.push([containingFile, literal, redirectUrl]);
1806
1807
  }
1807
- if (this._httpModules.has(moduleHref)) {
1808
+ if (this.#httpModules.has(moduleHref)) {
1808
1809
  return {
1809
1810
  resolvedFileName: moduleHref,
1810
1811
  extension: getScriptExtension(moduleUrl.pathname) ?? ".js"
1811
1812
  };
1812
1813
  }
1813
- if (this._httpTsModules.has(moduleHref)) {
1814
+ if (this.#httpTsModules.has(moduleHref)) {
1814
1815
  return {
1815
1816
  resolvedFileName: moduleHref,
1816
1817
  extension: getScriptExtension(moduleUrl.pathname) ?? ".ts"
1817
1818
  };
1818
1819
  }
1819
- if (this._typesMappings.has(moduleHref)) {
1820
+ if (this.#typesMappings.has(moduleHref)) {
1820
1821
  return {
1821
- resolvedFileName: this._typesMappings.get(moduleHref),
1822
+ resolvedFileName: this.#typesMappings.get(moduleHref),
1822
1823
  extension: ".d.ts"
1823
1824
  };
1824
1825
  }
1825
- if (this._httpLibs.has(moduleHref)) {
1826
+ if (this.#httpLibs.has(moduleHref)) {
1826
1827
  return {
1827
1828
  resolvedFileName: moduleHref,
1828
1829
  extension: ".d.ts"
1829
1830
  };
1830
1831
  }
1831
- if (!this._fetchPromises.has(moduleHref)) {
1832
- const autoFetch = importMapResolved || this._isJsxImportUrl(specifier) || isHttpUrl(containingFile) || isWellKnownCDNURL(moduleUrl);
1832
+ if (!this.#fetchPromises.has(moduleHref)) {
1833
+ const autoFetch = importMapResolved || this.#isJsxImportUrl(specifier) || isHttpUrl(containingFile) || isWellKnownCDNURL(moduleUrl);
1833
1834
  const promise = autoFetch ? cache.fetch(moduleUrl) : cache.query(moduleUrl);
1834
- this._fetchPromises.set(
1835
+ this.#fetchPromises.set(
1835
1836
  moduleHref,
1836
1837
  promise.then(async (res) => {
1837
1838
  if (!res) {
1838
- this._unknownImports.add(moduleHref);
1839
+ this.#unknownImports.add(moduleHref);
1839
1840
  return;
1840
1841
  }
1841
1842
  if (res.ok) {
1842
1843
  const contentType = res.headers.get("content-type");
1843
1844
  const dts = res.headers.get("x-typescript-types");
1844
1845
  if (res.redirected) {
1845
- this._urlMappings.set(moduleHref, res.url);
1846
+ this.#urlMappings.set(moduleHref, res.url);
1846
1847
  } else if (dts) {
1847
1848
  res.body?.cancel();
1848
1849
  const dtsRes = await cache.fetch(new URL(dts, res.url));
1849
1850
  if (dtsRes.ok) {
1850
- this._typesMappings.set(moduleHref, dtsRes.url);
1851
- this._markHttpLib(dtsRes.url, await dtsRes.text());
1851
+ this.#typesMappings.set(moduleHref, dtsRes.url);
1852
+ this.#markHttpLib(dtsRes.url, await dtsRes.text());
1852
1853
  }
1853
1854
  } else if (/\.(c|m)?jsx?$/.test(moduleUrl.pathname) || contentType && /^(application|text)\/(javascript|jsx)/.test(contentType)) {
1854
- this._httpModules.set(moduleHref, await res.text());
1855
+ this.#httpModules.set(moduleHref, await res.text());
1855
1856
  } else if (/\.(c|m)?tsx?$/.test(moduleUrl.pathname) || contentType && /^(application|text)\/(typescript|tsx)/.test(contentType)) {
1856
1857
  if (/\.d\.(c|m)?ts$/.test(moduleUrl.pathname)) {
1857
- this._markHttpLib(moduleHref, await res.text());
1858
+ this.#markHttpLib(moduleHref, await res.text());
1858
1859
  } else {
1859
- this._httpTsModules.set(moduleHref, await res.text());
1860
+ this.#httpTsModules.set(moduleHref, await res.text());
1860
1861
  }
1861
1862
  } else {
1862
1863
  res.body?.cancel();
1863
- this._badImports.add(moduleHref);
1864
+ this.#badImports.add(moduleHref);
1864
1865
  }
1865
1866
  } else {
1866
1867
  res.body?.cancel();
1867
- this._badImports.add(moduleHref);
1868
+ this.#badImports.add(moduleHref);
1868
1869
  }
1869
1870
  }).catch((err) => {
1870
1871
  console.error(`Failed to fetch module: ${moduleHref}`, err);
1871
1872
  }).finally(() => {
1872
- this._rollbackVersion(containingFile);
1873
- this._fetchPromises.delete(moduleHref);
1873
+ this.#rollbackVersion(containingFile);
1874
+ this.#fetchPromises.delete(moduleHref);
1874
1875
  this.host.refreshDiagnostics(containingFile);
1875
1876
  })
1876
1877
  );
@@ -1884,27 +1885,27 @@ var TypeScriptWorker = class extends WorkerBase {
1884
1885
  // #endregion
1885
1886
  // #region language features
1886
1887
  async doValidation(uri) {
1887
- const document2 = this._getTextDocument(uri);
1888
+ const document2 = this.#getTextDocument(uri);
1888
1889
  if (!document2) {
1889
1890
  return null;
1890
1891
  }
1891
1892
  const ext = getScriptExtension(uri);
1892
1893
  const diagnostics = [];
1893
- for (const diagnostic of this._languageService.getSyntacticDiagnostics(uri)) {
1894
- diagnostics.push(this._convertDiagnostic(document2, diagnostic));
1894
+ for (const diagnostic of this.#languageService.getSyntacticDiagnostics(uri)) {
1895
+ diagnostics.push(this.#convertDiagnostic(document2, diagnostic));
1895
1896
  }
1896
- for (const diagnostic of this._languageService.getSuggestionDiagnostics(uri)) {
1897
- diagnostics.push(this._convertDiagnostic(document2, diagnostic));
1897
+ for (const diagnostic of this.#languageService.getSuggestionDiagnostics(uri)) {
1898
+ diagnostics.push(this.#convertDiagnostic(document2, diagnostic));
1898
1899
  }
1899
1900
  if (ext === ".tsx" || ext?.endsWith("ts")) {
1900
- for (const diagnostic of this._languageService.getSemanticDiagnostics(uri)) {
1901
- diagnostics.push(this._convertDiagnostic(document2, diagnostic));
1901
+ for (const diagnostic of this.#languageService.getSemanticDiagnostics(uri)) {
1902
+ diagnostics.push(this.#convertDiagnostic(document2, diagnostic));
1902
1903
  }
1903
1904
  }
1904
- if (this._redirectedImports.length > 0) {
1905
- this._redirectedImports.forEach(([modelUrl, node, url]) => {
1905
+ if (this.#redirectedImports.length > 0) {
1906
+ this.#redirectedImports.forEach(([modelUrl, node, url]) => {
1906
1907
  if (modelUrl === uri) {
1907
- diagnostics.push(this._convertDiagnostic(document2, {
1908
+ diagnostics.push(this.#convertDiagnostic(document2, {
1908
1909
  file: void 0,
1909
1910
  start: node.getStart(),
1910
1911
  length: node.getWidth(),
@@ -1918,23 +1919,23 @@ var TypeScriptWorker = class extends WorkerBase {
1918
1919
  return diagnostics;
1919
1920
  }
1920
1921
  async doAutoComplete(uri, position, ch) {
1921
- const document2 = this._getTextDocument(uri);
1922
+ const document2 = this.#getTextDocument(uri);
1922
1923
  if (!document2) {
1923
1924
  return null;
1924
1925
  }
1925
- const info = this._languageService.getJsxClosingTagAtPosition(uri, document2.offsetAt(position));
1926
+ const info = this.#languageService.getJsxClosingTagAtPosition(uri, document2.offsetAt(position));
1926
1927
  if (info) {
1927
1928
  return "$0" + info.newText;
1928
1929
  }
1929
1930
  return null;
1930
1931
  }
1931
1932
  async doComplete(uri, position) {
1932
- const document2 = this._getTextDocument(uri);
1933
+ const document2 = this.#getTextDocument(uri);
1933
1934
  if (!document2) {
1934
1935
  return null;
1935
1936
  }
1936
1937
  const offset = document2.offsetAt(position);
1937
- const completions = this._getCompletionsAtPosition(uri, offset);
1938
+ const completions = this.#getCompletionsAtPosition(uri, offset);
1938
1939
  if (!completions) {
1939
1940
  return { isIncomplete: false, items: [] };
1940
1941
  }
@@ -1943,7 +1944,7 @@ var TypeScriptWorker = class extends WorkerBase {
1943
1944
  if (entry.name === "") {
1944
1945
  continue;
1945
1946
  }
1946
- if (entry.kind === "script" && entry.name in this._importMap.imports || entry.name + "/" in this._importMap.imports) {
1947
+ if (entry.kind === "script" && entry.name in this.#importMap.imports || entry.name + "/" in this.#importMap.imports) {
1947
1948
  const { replacementSpan } = entry;
1948
1949
  if (replacementSpan?.length) {
1949
1950
  const replacementText = document2.getText({
@@ -1980,11 +1981,11 @@ var TypeScriptWorker = class extends WorkerBase {
1980
1981
  return null;
1981
1982
  }
1982
1983
  const { uri, offset } = item.data.context;
1983
- const document2 = this._getTextDocument(uri);
1984
+ const document2 = this.#getTextDocument(uri);
1984
1985
  if (!document2) {
1985
1986
  return null;
1986
1987
  }
1987
- const details = this._getCompletionEntryDetails(uri, offset, item.label, item.data.entryData);
1988
+ const details = this.#getCompletionEntryDetails(uri, offset, item.label, item.data.entryData);
1988
1989
  if (!details) {
1989
1990
  return null;
1990
1991
  }
@@ -2006,11 +2007,11 @@ var TypeScriptWorker = class extends WorkerBase {
2006
2007
  return { label: item.label, detail, documentation, additionalTextEdits };
2007
2008
  }
2008
2009
  async doHover(uri, position) {
2009
- const document2 = this._getTextDocument(uri);
2010
+ const document2 = this.#getTextDocument(uri);
2010
2011
  if (!document2) {
2011
2012
  return null;
2012
2013
  }
2013
- const info = this._getQuickInfoAtPosition(uri, document2.offsetAt(position));
2014
+ const info = this.#getQuickInfoAtPosition(uri, document2.offsetAt(position));
2014
2015
  if (info) {
2015
2016
  const contents = ts.displayPartsToString(info.displayParts);
2016
2017
  const documentation = ts.displayPartsToString(info.documentation);
@@ -2027,7 +2028,7 @@ var TypeScriptWorker = class extends WorkerBase {
2027
2028
  }
2028
2029
  async doSignatureHelp(uri, position, context) {
2029
2030
  const triggerReason = toTsSignatureHelpTriggerReason(context);
2030
- const items = this._languageService.getSignatureHelpItems(uri, position, { triggerReason });
2031
+ const items = this.#languageService.getSignatureHelpItems(uri, position, { triggerReason });
2031
2032
  if (!items) {
2032
2033
  return null;
2033
2034
  }
@@ -2059,14 +2060,14 @@ var TypeScriptWorker = class extends WorkerBase {
2059
2060
  return { signatures, activeSignature, activeParameter };
2060
2061
  }
2061
2062
  async doCodeAction(uri, range, context, formatOptions) {
2062
- const document2 = this._getTextDocument(uri);
2063
+ const document2 = this.#getTextDocument(uri);
2063
2064
  if (!document2) {
2064
2065
  return null;
2065
2066
  }
2066
2067
  const start = document2.offsetAt(range.start);
2067
2068
  const end = document2.offsetAt(range.end);
2068
2069
  const errorCodes = context.diagnostics.map((diagnostic) => diagnostic.code).filter(Boolean).map(Number);
2069
- const codeFixes = await this._getCodeFixesAtPosition(uri, start, end, errorCodes, toTsFormatOptions(formatOptions));
2070
+ const codeFixes = await this.#getCodeFixesAtPosition(uri, start, end, errorCodes, toTsFormatOptions(formatOptions));
2070
2071
  return codeFixes.map((codeFix) => {
2071
2072
  const action = {
2072
2073
  title: codeFix.description,
@@ -2093,16 +2094,16 @@ var TypeScriptWorker = class extends WorkerBase {
2093
2094
  });
2094
2095
  }
2095
2096
  async doRename(uri, position, newName) {
2096
- const document2 = this._getTextDocument(uri);
2097
+ const document2 = this.#getTextDocument(uri);
2097
2098
  if (!document2) {
2098
2099
  return null;
2099
2100
  }
2100
2101
  const documentPosition = document2.offsetAt(position);
2101
- const renameInfo = this._languageService.getRenameInfo(uri, documentPosition, { allowRenameOfImportPath: true });
2102
+ const renameInfo = this.#languageService.getRenameInfo(uri, documentPosition, { allowRenameOfImportPath: true });
2102
2103
  if (!renameInfo.canRename) {
2103
2104
  return null;
2104
2105
  }
2105
- const locations = this._languageService.findRenameLocations(uri, documentPosition, false, false, {
2106
+ const locations = this.#languageService.findRenameLocations(uri, documentPosition, false, false, {
2106
2107
  providePrefixAndSuffixTextForRename: false
2107
2108
  });
2108
2109
  if (!locations) {
@@ -2111,7 +2112,7 @@ var TypeScriptWorker = class extends WorkerBase {
2111
2112
  const changes = {};
2112
2113
  locations.map((loc) => {
2113
2114
  const edits = changes[loc.fileName] || (changes[loc.fileName] = []);
2114
- const locDocument = this._getTextDocument(loc.fileName);
2115
+ const locDocument = this.#getTextDocument(loc.fileName);
2115
2116
  if (locDocument) {
2116
2117
  edits.push({
2117
2118
  range: createRangeFromDocumentSpan(locDocument, loc.textSpan),
@@ -2122,18 +2123,18 @@ var TypeScriptWorker = class extends WorkerBase {
2122
2123
  return { changes };
2123
2124
  }
2124
2125
  async doFormat(uri, range, formatOptions, docText) {
2125
- const document2 = docText ? TextDocument2.create(uri, "typescript", 0, docText) : this._getTextDocument(uri);
2126
+ const document2 = docText ? TextDocument2.create(uri, "typescript", 0, docText) : this.#getTextDocument(uri);
2126
2127
  if (!document2) {
2127
2128
  return null;
2128
2129
  }
2129
- const formattingOptions = this._mergeFormatOptions(toTsFormatOptions(formatOptions));
2130
+ const formattingOptions = this.#mergeFormatOptions(toTsFormatOptions(formatOptions));
2130
2131
  let edits;
2131
2132
  if (range) {
2132
2133
  const start = document2.offsetAt(range.start);
2133
2134
  const end = document2.offsetAt(range.end);
2134
- edits = this._languageService.getFormattingEditsForRange(uri, start, end, formattingOptions);
2135
+ edits = this.#languageService.getFormattingEditsForRange(uri, start, end, formattingOptions);
2135
2136
  } else {
2136
- edits = this._languageService.getFormattingEditsForDocument(uri, formattingOptions);
2137
+ edits = this.#languageService.getFormattingEditsForDocument(uri, formattingOptions);
2137
2138
  }
2138
2139
  return edits.map(({ span, newText }) => ({
2139
2140
  range: createRangeFromDocumentSpan(document2, span),
@@ -2141,7 +2142,7 @@ var TypeScriptWorker = class extends WorkerBase {
2141
2142
  }));
2142
2143
  }
2143
2144
  async findDocumentSymbols(uri) {
2144
- const document2 = this._getTextDocument(uri);
2145
+ const document2 = this.#getTextDocument(uri);
2145
2146
  if (!document2) {
2146
2147
  return null;
2147
2148
  }
@@ -2158,20 +2159,20 @@ var TypeScriptWorker = class extends WorkerBase {
2158
2159
  }
2159
2160
  return result;
2160
2161
  };
2161
- const root = this._languageService.getNavigationTree(uri);
2162
+ const root = this.#languageService.getNavigationTree(uri);
2162
2163
  return root.childItems?.map((item) => toSymbol(item)) ?? null;
2163
2164
  }
2164
2165
  async findDefinition(uri, position) {
2165
- const document2 = this._getTextDocument(uri);
2166
+ const document2 = this.#getTextDocument(uri);
2166
2167
  if (!document2) {
2167
2168
  return null;
2168
2169
  }
2169
- const res = this._languageService.getDefinitionAndBoundSpan(uri, document2.offsetAt(position));
2170
+ const res = this.#languageService.getDefinitionAndBoundSpan(uri, document2.offsetAt(position));
2170
2171
  if (res) {
2171
2172
  const { definitions, textSpan } = res;
2172
2173
  if (definitions) {
2173
2174
  return definitions.map((d) => {
2174
- const targetDocument = d.fileName === uri ? document2 : this._getTextDocument(d.fileName);
2175
+ const targetDocument = d.fileName === uri ? document2 : this.#getTextDocument(d.fileName);
2175
2176
  if (targetDocument) {
2176
2177
  const range = createRangeFromDocumentSpan(targetDocument, d.textSpan);
2177
2178
  const link = {
@@ -2200,15 +2201,15 @@ var TypeScriptWorker = class extends WorkerBase {
2200
2201
  return null;
2201
2202
  }
2202
2203
  async findReferences(uri, position) {
2203
- const document2 = this._getTextDocument(uri);
2204
+ const document2 = this.#getTextDocument(uri);
2204
2205
  if (!document2) {
2205
2206
  return null;
2206
2207
  }
2207
- const references = this._languageService.getReferencesAtPosition(uri, document2.offsetAt(position));
2208
+ const references = this.#languageService.getReferencesAtPosition(uri, document2.offsetAt(position));
2208
2209
  const result = [];
2209
2210
  if (references) {
2210
2211
  for (let entry of references) {
2211
- const entryDocument = this._getTextDocument(entry.fileName);
2212
+ const entryDocument = this.#getTextDocument(entry.fileName);
2212
2213
  if (entryDocument) {
2213
2214
  result.push({
2214
2215
  uri: entryDocument.uri,
@@ -2220,11 +2221,11 @@ var TypeScriptWorker = class extends WorkerBase {
2220
2221
  return result;
2221
2222
  }
2222
2223
  async findDocumentHighlights(uri, position) {
2223
- const document2 = this._getTextDocument(uri);
2224
+ const document2 = this.#getTextDocument(uri);
2224
2225
  if (!document2) {
2225
2226
  return null;
2226
2227
  }
2227
- const highlights = this._languageService.getDocumentHighlights(uri, document2.offsetAt(position), [uri]);
2228
+ const highlights = this.#languageService.getDocumentHighlights(uri, document2.offsetAt(position), [uri]);
2228
2229
  const out = [];
2229
2230
  for (const entry of highlights || []) {
2230
2231
  for (const highlight of entry.highlightSpans) {
@@ -2237,11 +2238,11 @@ var TypeScriptWorker = class extends WorkerBase {
2237
2238
  return out;
2238
2239
  }
2239
2240
  async getFoldingRanges(uri) {
2240
- const document2 = this._getTextDocument(uri);
2241
+ const document2 = this.#getTextDocument(uri);
2241
2242
  if (!document2) {
2242
2243
  return null;
2243
2244
  }
2244
- const spans = this._languageService.getOutliningSpans(uri);
2245
+ const spans = this.#languageService.getOutliningSpans(uri);
2245
2246
  const ranges = [];
2246
2247
  for (const span of spans) {
2247
2248
  const curr = createRangeFromDocumentSpan(document2, span.textSpan);
@@ -2259,7 +2260,7 @@ var TypeScriptWorker = class extends WorkerBase {
2259
2260
  return ranges;
2260
2261
  }
2261
2262
  async getSelectionRanges(uri, positions) {
2262
- const document2 = this._getTextDocument(uri);
2263
+ const document2 = this.#getTextDocument(uri);
2263
2264
  if (!document2) {
2264
2265
  return null;
2265
2266
  }
@@ -2268,53 +2269,53 @@ var TypeScriptWorker = class extends WorkerBase {
2268
2269
  return SelectionRange.create(createRangeFromDocumentSpan(document2, selectionRange.textSpan), parent);
2269
2270
  }
2270
2271
  return positions.map((position) => {
2271
- const range = this._languageService.getSmartSelectionRange(uri, document2.offsetAt(position));
2272
+ const range = this.#languageService.getSmartSelectionRange(uri, document2.offsetAt(position));
2272
2273
  return convertSelectionRange(range);
2273
2274
  });
2274
2275
  }
2275
2276
  // #endregion
2276
2277
  // #region public methods used by the host
2277
2278
  async fetchHttpModule(specifier, containingFile) {
2278
- if (this._unknownImports.has(specifier)) {
2279
+ if (this.#unknownImports.has(specifier)) {
2279
2280
  const res = await cache.fetch(specifier);
2280
2281
  res.body?.cancel();
2281
- this._unknownImports.delete(specifier);
2282
+ this.#unknownImports.delete(specifier);
2282
2283
  if (!res.ok) {
2283
- this._badImports.add(specifier);
2284
+ this.#badImports.add(specifier);
2284
2285
  }
2285
- this._rollbackVersion(containingFile);
2286
+ this.#rollbackVersion(containingFile);
2286
2287
  this.host.refreshDiagnostics(containingFile);
2287
2288
  }
2288
2289
  }
2289
2290
  async updateCompilerOptions(options) {
2290
2291
  const { compilerOptions, importMap, types } = options;
2291
2292
  if (compilerOptions) {
2292
- this._compilerOptions = ts.convertCompilerOptionsFromJson(compilerOptions, ".").options;
2293
- this._updateJsxImportSource();
2293
+ this.#compilerOptions = ts.convertCompilerOptionsFromJson(compilerOptions, ".").options;
2294
+ this.#updateJsxImportSource();
2294
2295
  }
2295
2296
  if (importMap) {
2296
- this._importMap = importMap;
2297
- this._importMapVersion++;
2298
- this._isBlankImportMap = isBlankImportMap(importMap);
2299
- this._updateJsxImportSource();
2297
+ this.#importMap = importMap;
2298
+ this.#importMapVersion++;
2299
+ this.#isBlankImportMap = isBlankImportMap(importMap);
2300
+ this.#updateJsxImportSource();
2300
2301
  }
2301
2302
  if (types) {
2302
- for (const uri of Object.keys(this._types)) {
2303
+ for (const uri of Object.keys(this.#types)) {
2303
2304
  if (!(uri in types)) {
2304
2305
  this.removeDocumentCache(uri);
2305
2306
  }
2306
2307
  }
2307
- this._types = types;
2308
+ this.#types = types;
2308
2309
  }
2309
2310
  }
2310
2311
  // #endregion
2311
2312
  // #region private methods
2312
- _getCompletionsAtPosition(fileName, position) {
2313
- const completions = this._languageService.getCompletionsAtPosition(
2313
+ #getCompletionsAtPosition(fileName, position) {
2314
+ const completions = this.#languageService.getCompletionsAtPosition(
2314
2315
  fileName,
2315
2316
  position,
2316
2317
  {
2317
- quotePreference: this._formatOptions?.quotePreference,
2318
+ quotePreference: this.#formatOptions?.quotePreference,
2318
2319
  allowRenameOfImportPath: true,
2319
2320
  importModuleSpecifierEnding: "js",
2320
2321
  importModuleSpecifierPreference: "shortest",
@@ -2332,11 +2333,11 @@ var TypeScriptWorker = class extends WorkerBase {
2332
2333
  return true;
2333
2334
  }
2334
2335
  const { moduleSpecifier, exportName } = data;
2335
- if (moduleSpecifier && (moduleSpecifier in this._importMap.imports || this._typesMappings.has(moduleSpecifier))) {
2336
+ if (moduleSpecifier && (moduleSpecifier in this.#importMap.imports || this.#typesMappings.has(moduleSpecifier))) {
2336
2337
  autoImports.add(exportName + " " + moduleSpecifier);
2337
2338
  return true;
2338
2339
  }
2339
- const specifier = this._getSpecifierFromDts(data.fileName);
2340
+ const specifier = this.#getSpecifierFromDts(data.fileName);
2340
2341
  if (specifier && !autoImports.has(exportName + " " + specifier)) {
2341
2342
  autoImports.add(exportName + " " + specifier);
2342
2343
  return true;
@@ -2347,9 +2348,9 @@ var TypeScriptWorker = class extends WorkerBase {
2347
2348
  }
2348
2349
  return void 0;
2349
2350
  }
2350
- _getCompletionEntryDetails(fileName, position, entryName, data) {
2351
+ #getCompletionEntryDetails(fileName, position, entryName, data) {
2351
2352
  try {
2352
- const detail = this._languageService.getCompletionEntryDetails(
2353
+ const detail = this.#languageService.getCompletionEntryDetails(
2353
2354
  fileName,
2354
2355
  position,
2355
2356
  entryName,
@@ -2364,7 +2365,7 @@ var TypeScriptWorker = class extends WorkerBase {
2364
2365
  detail?.codeActions?.forEach((action) => {
2365
2366
  if (action.description.startsWith("Add import from ")) {
2366
2367
  const specifier = action.description.slice(17, -1);
2367
- const newSpecifier = this._getSpecifierFromDts(isDts(specifier) ? specifier : specifier + ".d.ts");
2368
+ const newSpecifier = this.#getSpecifierFromDts(isDts(specifier) ? specifier : specifier + ".d.ts");
2368
2369
  if (newSpecifier) {
2369
2370
  action.description = `Add type import from "${newSpecifier}"`;
2370
2371
  action.changes.forEach((change) => {
@@ -2383,8 +2384,8 @@ var TypeScriptWorker = class extends WorkerBase {
2383
2384
  return;
2384
2385
  }
2385
2386
  }
2386
- _getQuickInfoAtPosition(fileName, position) {
2387
- const info = this._languageService.getQuickInfoAtPosition(fileName, position);
2387
+ #getQuickInfoAtPosition(fileName, position) {
2388
+ const info = this.#languageService.getQuickInfoAtPosition(fileName, position);
2388
2389
  if (!info) {
2389
2390
  return;
2390
2391
  }
@@ -2408,7 +2409,7 @@ var TypeScriptWorker = class extends WorkerBase {
2408
2409
  kindModifiers === "declare" && moduleName.startsWith('"http')
2409
2410
  ) {
2410
2411
  const specifier = JSON.parse(moduleName);
2411
- for (const [url, dts] of this._typesMappings) {
2412
+ for (const [url, dts] of this.#typesMappings) {
2412
2413
  if (specifier + ".d.ts" === dts) {
2413
2414
  displayParts[2].text = '"' + url + '"';
2414
2415
  info.tags = [{
@@ -2444,22 +2445,22 @@ var TypeScriptWorker = class extends WorkerBase {
2444
2445
  }
2445
2446
  return info;
2446
2447
  }
2447
- async _getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) {
2448
+ async #getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) {
2448
2449
  let span = [start + 1, end - 1];
2449
- if (start === end && (this._redirectedImports.length > 0 || errorCodes.includes(2307))) {
2450
- const a = this._languageService.getReferencesAtPosition(fileName, start);
2450
+ if (start === end && (this.#redirectedImports.length > 0 || errorCodes.includes(2307))) {
2451
+ const a = this.#languageService.getReferencesAtPosition(fileName, start);
2451
2452
  if (a && a.length > 0) {
2452
2453
  const b = a[0];
2453
2454
  span = [b.textSpan.start, b.textSpan.start + b.textSpan.length];
2454
2455
  }
2455
2456
  }
2456
2457
  const fixes = [];
2457
- if (this._redirectedImports.length > 0) {
2458
- const i = this._redirectedImports.findIndex(([modelUrl, node]) => {
2458
+ if (this.#redirectedImports.length > 0) {
2459
+ const i = this.#redirectedImports.findIndex(([modelUrl, node]) => {
2459
2460
  return fileName === modelUrl && node.getStart() === span[0] - 1 && node.getEnd() === span[1] + 1;
2460
2461
  });
2461
2462
  if (i >= 0) {
2462
- const [_, node, url] = this._redirectedImports[i];
2463
+ const [_, node, url] = this.#redirectedImports[i];
2463
2464
  const fixName = `Update module specifier to ${url}`;
2464
2465
  fixes.push({
2465
2466
  fixName,
@@ -2477,7 +2478,7 @@ var TypeScriptWorker = class extends WorkerBase {
2477
2478
  if (errorCodes.includes(2307)) {
2478
2479
  const specifier = this.getModel(fileName)?.getValue().slice(...span);
2479
2480
  if (specifier) {
2480
- if (this._unknownImports.has(specifier)) {
2481
+ if (this.#unknownImports.has(specifier)) {
2481
2482
  const fixName = `Fetch module from '${specifier}'`;
2482
2483
  fixes.push({
2483
2484
  fixName,
@@ -2493,12 +2494,12 @@ var TypeScriptWorker = class extends WorkerBase {
2493
2494
  }
2494
2495
  }
2495
2496
  try {
2496
- const tsFixes = this._languageService.getCodeFixesAtPosition(
2497
+ const tsFixes = this.#languageService.getCodeFixesAtPosition(
2497
2498
  fileName,
2498
2499
  start,
2499
2500
  end,
2500
2501
  errorCodes,
2501
- this._mergeFormatOptions(formatOptions),
2502
+ this.#mergeFormatOptions(formatOptions),
2502
2503
  {}
2503
2504
  );
2504
2505
  return fixes.concat(tsFixes);
@@ -2507,26 +2508,26 @@ var TypeScriptWorker = class extends WorkerBase {
2507
2508
  }
2508
2509
  }
2509
2510
  /** rollback the version to force reinvoke `resolveModuleNameLiterals` method. */
2510
- _rollbackVersion(fileName) {
2511
+ #rollbackVersion(fileName) {
2511
2512
  const model = this.getModel(fileName);
2512
2513
  if (model) {
2513
2514
  model._versionId--;
2514
2515
  }
2515
2516
  }
2516
- _getScriptText(fileName) {
2517
- return libs[fileName] ?? libs[`lib.${fileName}.d.ts`] ?? this._types[fileName]?.content ?? this._httpLibs.get(fileName) ?? this._httpModules.get(fileName) ?? this._httpTsModules.get(fileName) ?? this.getModel(fileName)?.getValue();
2517
+ #getScriptText(fileName) {
2518
+ return libs[fileName] ?? libs[`lib.${fileName}.d.ts`] ?? this.#types[fileName]?.content ?? this.#httpLibs.get(fileName) ?? this.#httpModules.get(fileName) ?? this.#httpTsModules.get(fileName) ?? this.getModel(fileName)?.getValue();
2518
2519
  }
2519
- _getTextDocument(uri) {
2520
+ #getTextDocument(uri) {
2520
2521
  const doc = this.getTextDocument(uri);
2521
2522
  if (doc) {
2522
2523
  return doc;
2523
2524
  }
2524
2525
  if (uri.startsWith("http://") || uri.startsWith("https://")) {
2525
- const docCache = this._httpDocumentCache;
2526
+ const docCache = this.#httpDocumentCache;
2526
2527
  if (docCache.has(uri)) {
2527
2528
  return docCache.get(uri);
2528
2529
  }
2529
- const scriptText = this._getScriptText(uri);
2530
+ const scriptText = this.#getScriptText(uri);
2530
2531
  if (scriptText) {
2531
2532
  const doc2 = TextDocument2.create(uri, "typescript", 1, scriptText);
2532
2533
  docCache.set(uri, doc2);
@@ -2535,36 +2536,36 @@ var TypeScriptWorker = class extends WorkerBase {
2535
2536
  }
2536
2537
  return null;
2537
2538
  }
2538
- _markHttpLib(url, dtsContent) {
2539
- this._httpLibs.set(url, dtsContent);
2539
+ #markHttpLib(url, dtsContent) {
2540
+ this.#httpLibs.set(url, dtsContent);
2540
2541
  setTimeout(() => {
2541
- const referencedFiles = this._languageService.getProgram()?.getSourceFile(url)?.referencedFiles ?? [];
2542
+ const referencedFiles = this.#languageService.getProgram()?.getSourceFile(url)?.referencedFiles ?? [];
2542
2543
  referencedFiles.forEach((ref) => {
2543
2544
  const refUrl = new URL(ref.fileName, url).href;
2544
- if (isDts(refUrl) && !this._fetchPromises.has(refUrl) && !this._httpLibs.has(refUrl) && !this._badImports.has(refUrl)) {
2545
- this._fetchPromises.set(
2545
+ if (isDts(refUrl) && !this.#fetchPromises.has(refUrl) && !this.#httpLibs.has(refUrl) && !this.#badImports.has(refUrl)) {
2546
+ this.#fetchPromises.set(
2546
2547
  refUrl,
2547
2548
  cache.fetch(refUrl).then(async (res) => {
2548
2549
  if (res.ok) {
2549
- this._httpLibs.set(refUrl, await res.text());
2550
+ this.#httpLibs.set(refUrl, await res.text());
2550
2551
  } else {
2551
- this._badImports.add(refUrl);
2552
+ this.#badImports.add(refUrl);
2552
2553
  }
2553
2554
  }).catch((err) => {
2554
2555
  console.error(`Failed to fetch types: ${refUrl}`, err);
2555
2556
  }).finally(() => {
2556
- this._fetchPromises.delete(refUrl);
2557
+ this.#fetchPromises.delete(refUrl);
2557
2558
  })
2558
2559
  );
2559
2560
  }
2560
2561
  });
2561
2562
  });
2562
2563
  }
2563
- _getSpecifierFromDts(filename) {
2564
- for (const [specifier, dts] of this._typesMappings) {
2564
+ #getSpecifierFromDts(filename) {
2565
+ for (const [specifier, dts] of this.#typesMappings) {
2565
2566
  if (filename === dts) {
2566
- if (!this._isBlankImportMap) {
2567
- for (const [key, value] of Object.entries(this._importMap.imports)) {
2567
+ if (!this.#isBlankImportMap) {
2568
+ for (const [key, value] of Object.entries(this.#importMap.imports)) {
2568
2569
  if (value === specifier && key !== "@jsxRuntime") {
2569
2570
  return key;
2570
2571
  }
@@ -2574,7 +2575,7 @@ var TypeScriptWorker = class extends WorkerBase {
2574
2575
  }
2575
2576
  }
2576
2577
  }
2577
- _convertDiagnostic(document2, diagnostic) {
2578
+ #convertDiagnostic(document2, diagnostic) {
2578
2579
  const tags = [];
2579
2580
  if (diagnostic.reportsUnnecessary) {
2580
2581
  tags.push(DiagnosticTag.Unnecessary);
@@ -2589,16 +2590,16 @@ var TypeScriptWorker = class extends WorkerBase {
2589
2590
  message: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
2590
2591
  source: diagnostic.source,
2591
2592
  tags,
2592
- relatedInformation: this._convertRelatedInformation(document2, diagnostic.relatedInformation)
2593
+ relatedInformation: this.#convertRelatedInformation(document2, diagnostic.relatedInformation)
2593
2594
  };
2594
2595
  }
2595
- _convertRelatedInformation(document2, relatedInformation) {
2596
+ #convertRelatedInformation(document2, relatedInformation) {
2596
2597
  if (!relatedInformation) {
2597
2598
  return [];
2598
2599
  }
2599
2600
  const result = [];
2600
2601
  relatedInformation.forEach((info) => {
2601
- const doc = info.file ? this._getTextDocument(info.file.fileName) : document2;
2602
+ const doc = info.file ? this.#getTextDocument(info.file.fileName) : document2;
2602
2603
  if (!doc) {
2603
2604
  return;
2604
2605
  }
@@ -2614,8 +2615,8 @@ var TypeScriptWorker = class extends WorkerBase {
2614
2615
  });
2615
2616
  return result;
2616
2617
  }
2617
- _getJsxImportSource() {
2618
- const { imports } = this._importMap;
2618
+ #getJsxImportSource() {
2619
+ const { imports } = this.#importMap;
2619
2620
  for (const specifier of ["@jsxRuntime", "@jsxImportSource", "preact", "react"]) {
2620
2621
  if (specifier in imports) {
2621
2622
  return imports[specifier];
@@ -2623,20 +2624,20 @@ var TypeScriptWorker = class extends WorkerBase {
2623
2624
  }
2624
2625
  return void 0;
2625
2626
  }
2626
- _updateJsxImportSource() {
2627
- if (!this._compilerOptions.jsxImportSource) {
2628
- const jsxImportSource = this._getJsxImportSource();
2627
+ #updateJsxImportSource() {
2628
+ if (!this.#compilerOptions.jsxImportSource) {
2629
+ const jsxImportSource = this.#getJsxImportSource();
2629
2630
  if (jsxImportSource) {
2630
- this._compilerOptions.jsx = ts.JsxEmit.React;
2631
- this._compilerOptions.jsxImportSource = jsxImportSource;
2631
+ this.#compilerOptions.jsx = ts.JsxEmit.React;
2632
+ this.#compilerOptions.jsxImportSource = jsxImportSource;
2632
2633
  }
2633
2634
  }
2634
2635
  }
2635
- _mergeFormatOptions(formatOptions) {
2636
- return { ...this._formatOptions, ...formatOptions };
2636
+ #mergeFormatOptions(formatOptions) {
2637
+ return { ...this.#formatOptions, ...formatOptions };
2637
2638
  }
2638
- _isJsxImportUrl(url) {
2639
- const jsxImportUrl = this._getJsxImportSource();
2639
+ #isJsxImportUrl(url) {
2640
+ const jsxImportUrl = this.#getJsxImportSource();
2640
2641
  if (jsxImportUrl) {
2641
2642
  return url === jsxImportUrl + "/jsx-runtime" || url === jsxImportUrl + "/jsx-dev-runtime";
2642
2643
  }