@astrojs/language-server 0.8.10 → 0.9.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @astrojs/language-server
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6b6b47a: Remove internal astro.d.ts files, instead prefer the one provided by Astro itself
8
+
3
9
  ## 0.8.10
4
10
 
5
11
  ### Patch Changes
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs_1 = require("fs");
4
3
  const os_1 = require("os");
5
4
  const parseAstro_1 = require("../../core/documents/parseAstro");
6
- const ASTRO_DEFINITION_BYTES = (0, fs_1.readFileSync)(require.resolve('../../../astro.d.ts'));
7
- const ASTRO_DEFINITION_STR = ASTRO_DEFINITION_BYTES.toString('utf-8');
8
- function addProps(content, dtsContent) {
9
- let defaultExportType = 'AstroBuiltinProps & Record<string, any>';
10
- // Using TypeScript to parse here would cause a double-parse, slowing down the extension
11
- // This needs to be done a different way when the new compiler is added.
5
+ function addProps(content) {
6
+ let defaultExportType = 'Record<string, any>';
12
7
  if (/(interface|type) Props/.test(content)) {
13
- defaultExportType = 'AstroBuiltinProps & Props';
8
+ defaultExportType = 'Props';
14
9
  }
15
- return dtsContent + os_1.EOL + `export default function (_props: ${defaultExportType}) { return <div></div>; }`;
10
+ return os_1.EOL + `export default function (_props: ${defaultExportType}) { return <div></div>; }`;
16
11
  }
17
12
  function escapeTemplateLiteralContent(content) {
18
13
  return content.replace(/`/g, '\\`');
@@ -81,7 +76,7 @@ function default_1(content) {
81
76
  htmlRaw +
82
77
  os_1.EOL +
83
78
  // Add TypeScript definitions
84
- addProps(frontMatterRaw, ASTRO_DEFINITION_STR);
79
+ addProps(frontMatterRaw);
85
80
  return result;
86
81
  }
87
82
  exports.default = default_1;
@@ -60,10 +60,10 @@ async function createLanguageService(tsconfigPath, workspaceRoot, docContext) {
60
60
  },
61
61
  };
62
62
  let configJson = (tsconfigPath && ts.readConfigFile(tsconfigPath, ts.sys.readFile).config) || {};
63
- // If our user has types in their config but it doesn't include the types for ImportMeta, let's add them for them
63
+ // If our user has types in their config but it doesn't include the types needed for Astro, add them to the config
64
64
  if (((_a = configJson.compilerOptions) === null || _a === void 0 ? void 0 : _a.types) &&
65
- !((_b = configJson.compilerOptions) === null || _b === void 0 ? void 0 : _b.types.includes("vite/client"))) {
66
- configJson.compilerOptions.types.push("vite/client");
65
+ !((_b = configJson.compilerOptions) === null || _b === void 0 ? void 0 : _b.types.includes("astro/env"))) {
66
+ configJson.compilerOptions.types.push("astro/env");
67
67
  }
68
68
  configJson.compilerOptions = Object.assign(getDefaultCompilerOptions(), configJson.compilerOptions);
69
69
  // If the user supplied exclude, let's use theirs
@@ -161,8 +161,7 @@ function getDefaultCompilerOptions() {
161
161
  maxNodeModuleJsDepth: 2,
162
162
  allowSyntheticDefaultImports: true,
163
163
  allowJs: true,
164
- // By providing vite/client here, our users get proper typing on import.meta in .astro files
165
- types: ["vite/client"],
164
+ types: ["astro/env"]
166
165
  };
167
166
  }
168
167
  function getDefaultExclude() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/language-server",
3
- "version": "0.8.10",
3
+ "version": "0.9.0",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/lodash": "^4.14.116",
38
- "astro": "0.19.1",
38
+ "astro": "0.23.5",
39
39
  "astro-scripts": "0.0.1",
40
40
  "tap": "^15.0.9"
41
41
  }
package/astro.d.ts DELETED
@@ -1,48 +0,0 @@
1
- export {};
2
-
3
- type AstroRenderedHTML = string;
4
-
5
- type AstroElement = any;
6
- type Fragment = (...a: any[]) => AstroElement;
7
-
8
- type FetchContentResultBase = {
9
- astro: {
10
- headers: string[];
11
- source: string;
12
- html: AstroRenderedHTML;
13
- };
14
- url: URL;
15
- };
16
-
17
- type FetchContentResult<T> = FetchContentResultBase & T;
18
-
19
- export type Params = Record<string, string | undefined>;
20
-
21
- interface AstroPageRequest {
22
- url: URL;
23
- canonicalURL: URL;
24
- params: Params;
25
- }
26
-
27
- interface AstroBuiltinProps {
28
- 'client:load'?: boolean;
29
- 'client:idle'?: boolean;
30
- 'client:media'?: string;
31
- 'client:visible'?: boolean;
32
- }
33
-
34
- interface Astro {
35
- isPage: boolean;
36
- fetchContent<T = any>(globStr: string): FetchContentResult<T>[];
37
- props: Record<string, number | string | any>;
38
- request: AstroPageRequest;
39
- resolve: (path: string) => string;
40
- site: URL;
41
- slots: Record<string, true | undefined>;
42
- }
43
-
44
- declare var Astro: Astro;
45
- declare var Fragment: string;
46
-
47
- void Astro;
48
- void Fragment;