@astrojs/language-server 2.6.1 → 2.6.3

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.
@@ -2,7 +2,7 @@ import type { DiagnosticMessage } from '@astrojs/compiler/types';
2
2
  import { FileCapabilities, FileKind, type Language, type VirtualFile } from '@volar/language-core';
3
3
  import type ts from 'typescript/lib/tsserverlibrary';
4
4
  import type { HTMLDocument } from 'vscode-html-languageservice';
5
- import type { AstroInstall } from '../utils.js';
5
+ import { type AstroInstall } from '../utils.js';
6
6
  import { AstroMetadata } from './parseAstro';
7
7
  export declare function getLanguageModule(astroInstall: AstroInstall | undefined, ts: typeof import('typescript/lib/tsserverlibrary.js')): Language<AstroFile>;
8
8
  export declare class AstroFile implements VirtualFile {
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.AstroFile = exports.getLanguageModule = void 0;
27
27
  const language_core_1 = require("@volar/language-core");
28
28
  const path = __importStar(require("node:path"));
29
+ const utils_js_1 = require("../utils.js");
29
30
  const astro2tsx_1 = require("./astro2tsx");
30
31
  const parseAstro_1 = require("./parseAstro");
31
32
  const parseCSS_1 = require("./parseCSS");
@@ -54,13 +55,7 @@ function getLanguageModule(astroInstall, ts) {
54
55
  return host.resolveModuleName?.(moduleName, impliedNodeFormat) ?? moduleName;
55
56
  },
56
57
  getScriptFileNames() {
57
- let languageServerDirectory;
58
- try {
59
- languageServerDirectory = path.dirname(require.resolve('@astrojs/language-server'));
60
- }
61
- catch (e) {
62
- languageServerDirectory = __dirname;
63
- }
58
+ const languageServerTypesDirectory = (0, utils_js_1.getLanguageServerTypesDir)(ts);
64
59
  const fileNames = host.getScriptFileNames();
65
60
  const addedFileNames = [];
66
61
  if (astroInstall) {
@@ -71,17 +66,14 @@ function getLanguageModule(astroInstall, ts) {
71
66
  (astroInstall.version.major === 4 &&
72
67
  astroInstall.version.minor === 0 &&
73
68
  astroInstall.version.patch < 8)) {
74
- addedFileNames.push(...['../types/jsx-runtime-augment.d.ts'].map((filePath) => ts.sys.resolvePath(path.resolve(languageServerDirectory, filePath))));
69
+ addedFileNames.push(...['./jsx-runtime-augment.d.ts'].map((filePath) => ts.sys.resolvePath(path.resolve(languageServerTypesDirectory, filePath))));
70
+ console.log(addedFileNames);
75
71
  }
76
72
  }
77
73
  else {
78
74
  // If we don't have an Astro installation, add the fallback types from the language server.
79
75
  // See the README in packages/language-server/types for more information.
80
- addedFileNames.push(...[
81
- '../types/env.d.ts',
82
- '../types/astro-jsx.d.ts',
83
- '../types/jsx-runtime-fallback.d.ts',
84
- ].map((f) => ts.sys.resolvePath(path.resolve(languageServerDirectory, f))));
76
+ addedFileNames.push(...['./env.d.ts', './astro-jsx.d.ts', './jsx-runtime-fallback.d.ts'].map((f) => ts.sys.resolvePath(path.resolve(languageServerTypesDirectory, f))));
85
77
  }
86
78
  return [...fileNames, ...addedFileNames];
87
79
  },
@@ -183,7 +183,17 @@ exports.astroAttributes = (0, vscode_html_languageservice_1.newHTMLDataProvider)
183
183
  },
184
184
  {
185
185
  name: 'transition:name',
186
- description: 'Specifies a `view-transition-name` for this element. The name should be unique on the page.',
186
+ description: 'Specifies a `view-transition-name` for this element. The name must be unique on the page.',
187
+ references: [
188
+ {
189
+ name: 'Astro reference',
190
+ url: 'https://docs.astro.build/en/guides/view-transitions/#transition-directives',
191
+ },
192
+ ],
193
+ },
194
+ {
195
+ name: 'transition:persist',
196
+ description: 'Marks this element to be moved to the next page during view transitions.',
187
197
  references: [
188
198
  {
189
199
  name: 'Astro reference',
package/dist/utils.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface AstroInstall {
7
7
  patch: number;
8
8
  };
9
9
  }
10
+ export declare function getLanguageServerTypesDir(ts: typeof import('typescript')): string;
10
11
  export declare function getAstroInstall(basePaths: string[], checkForAstro?: {
11
12
  nearestPackageJson: string | undefined;
12
13
  readDirectory: typeof import('typescript/lib/tsserverlibrary.js').sys.readDirectory;
package/dist/utils.js CHANGED
@@ -23,9 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getAstroInstall = void 0;
26
+ exports.getAstroInstall = exports.getLanguageServerTypesDir = void 0;
27
27
  const path = __importStar(require("node:path"));
28
28
  const importPackage_js_1 = require("./importPackage.js");
29
+ function getLanguageServerTypesDir(ts) {
30
+ return ts.sys.resolvePath(path.resolve(__dirname, '../types'));
31
+ }
32
+ exports.getLanguageServerTypesDir = getLanguageServerTypesDir;
29
33
  function getAstroInstall(basePaths, checkForAstro) {
30
34
  let astroPath;
31
35
  let version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/language-server",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "repository": {