@astrojs/language-server 2.7.7 → 2.8.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/dist/core/astro2tsx.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function safeConvertToTSX(content: string, options: ConvertToTSXO
|
|
|
40
40
|
};
|
|
41
41
|
export declare function getTSXRangesAsLSPRanges(tsx: TSXResult): LSPTSXRanges;
|
|
42
42
|
export declare function astro2tsx(input: string, fileName: string, htmlDocument: HTMLDocument): {
|
|
43
|
-
virtualCode: VirtualCode
|
|
43
|
+
virtualCode: VirtualCode;
|
|
44
44
|
diagnostics: import("@astrojs/compiler").DiagnosticMessage[] | {
|
|
45
45
|
code: 1000;
|
|
46
46
|
location: {
|
package/dist/core/index.js
CHANGED
|
@@ -168,6 +168,7 @@ class AstroVirtualCode {
|
|
|
168
168
|
this.htmlDocument = htmlDocument;
|
|
169
169
|
const scriptTags = (0, parseJS_js_1.extractScriptTags)(this.snapshot, htmlDocument, astroMetadata.ast);
|
|
170
170
|
this.scriptCodeIds = scriptTags.map((scriptTag) => scriptTag.id);
|
|
171
|
+
htmlVirtualCode.embeddedCodes = [];
|
|
171
172
|
htmlVirtualCode.embeddedCodes.push(...(0, parseCSS_1.extractStylesheets)(this.snapshot, htmlDocument, astroMetadata.ast), ...scriptTags);
|
|
172
173
|
this.embeddedCodes = [];
|
|
173
174
|
this.embeddedCodes.push(htmlVirtualCode);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Connection } from '@volar/language-server/node';
|
|
2
|
-
import type { ServerOptions
|
|
3
|
-
export declare function createServerOptions(connection: Connection,
|
|
2
|
+
import type { ServerOptions } from '@volar/language-server/lib/server.js';
|
|
3
|
+
export declare function createServerOptions(connection: Connection, ts: typeof import('typescript')): ServerOptions;
|
|
@@ -16,7 +16,7 @@ const astro_js_1 = require("./plugins/astro.js");
|
|
|
16
16
|
const html_js_1 = require("./plugins/html.js");
|
|
17
17
|
const index_js_1 = require("./plugins/typescript-addons/index.js");
|
|
18
18
|
const index_js_2 = require("./plugins/typescript/index.js");
|
|
19
|
-
function createServerOptions(connection,
|
|
19
|
+
function createServerOptions(connection, ts) {
|
|
20
20
|
return {
|
|
21
21
|
watchFileExtensions: [
|
|
22
22
|
'js',
|
|
@@ -33,7 +33,6 @@ function createServerOptions(connection, server) {
|
|
|
33
33
|
'svelte',
|
|
34
34
|
],
|
|
35
35
|
getServicePlugins() {
|
|
36
|
-
const ts = getTypeScriptModule();
|
|
37
36
|
return [
|
|
38
37
|
(0, html_js_1.create)(),
|
|
39
38
|
(0, volar_service_css_1.create)(),
|
|
@@ -46,7 +45,6 @@ function createServerOptions(connection, server) {
|
|
|
46
45
|
];
|
|
47
46
|
},
|
|
48
47
|
getLanguagePlugins(serviceEnv, projectContext) {
|
|
49
|
-
const ts = getTypeScriptModule();
|
|
50
48
|
const languagePlugins = [
|
|
51
49
|
(0, vue_js_1.getVueLanguageModule)(),
|
|
52
50
|
(0, svelte_js_1.getSvelteLanguageModule)(),
|
|
@@ -55,7 +53,7 @@ function createServerOptions(connection, server) {
|
|
|
55
53
|
const rootPath = projectContext.typescript.configFileName
|
|
56
54
|
? projectContext.typescript.configFileName.split('/').slice(0, -1).join('/')
|
|
57
55
|
: serviceEnv.typescript.uriToFileName(serviceEnv.workspaceFolder);
|
|
58
|
-
const nearestPackageJson =
|
|
56
|
+
const nearestPackageJson = ts.findConfigFile(rootPath, ts.sys.fileExists, 'package.json');
|
|
59
57
|
const astroInstall = (0, utils_js_1.getAstroInstall)([rootPath], {
|
|
60
58
|
nearestPackageJson: nearestPackageJson,
|
|
61
59
|
readDirectory: ts.sys.readDirectory,
|
|
@@ -71,13 +69,6 @@ function createServerOptions(connection, server) {
|
|
|
71
69
|
return languagePlugins;
|
|
72
70
|
},
|
|
73
71
|
};
|
|
74
|
-
function getTypeScriptModule() {
|
|
75
|
-
const tsModule = server.modules.typescript;
|
|
76
|
-
if (!tsModule) {
|
|
77
|
-
throw new Error('TypeScript module is missing');
|
|
78
|
-
}
|
|
79
|
-
return tsModule;
|
|
80
|
-
}
|
|
81
72
|
function getPrettierService() {
|
|
82
73
|
let prettier;
|
|
83
74
|
let prettierPluginPath;
|
|
@@ -117,6 +108,7 @@ function createServerOptions(connection, server) {
|
|
|
117
108
|
parser: 'astro',
|
|
118
109
|
};
|
|
119
110
|
},
|
|
111
|
+
allowImportError: true,
|
|
120
112
|
});
|
|
121
113
|
}
|
|
122
114
|
}
|
package/dist/nodeServer.js
CHANGED
|
@@ -6,7 +6,12 @@ const connection = (0, node_1.createConnection)();
|
|
|
6
6
|
const server = (0, node_1.createServer)(connection);
|
|
7
7
|
connection.listen();
|
|
8
8
|
connection.onInitialize((params) => {
|
|
9
|
-
|
|
9
|
+
const tsdk = params.initializationOptions?.typescript?.tsdk;
|
|
10
|
+
if (!tsdk) {
|
|
11
|
+
throw new Error('The `typescript.tsdk` init option is required. It should point to a directory containing a `typescript.js` or `tsserverlibrary.js` file, such as `node_modules/typescript/lib`.');
|
|
12
|
+
}
|
|
13
|
+
const { typescript, diagnosticMessages } = (0, node_1.loadTsdkByPath)(tsdk, params.locale);
|
|
14
|
+
return server.initialize(params, (0, node_1.createTypeScriptProjectProviderFactory)(typescript, diagnosticMessages), (0, languageServerPlugin_js_1.createServerOptions)(connection, typescript));
|
|
10
15
|
});
|
|
11
16
|
connection.onInitialized(() => {
|
|
12
17
|
server.initialized();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"author": "withastro",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"astro-ls": "./bin/nodeServer.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@astrojs/compiler": "^2.
|
|
23
|
+
"@astrojs/compiler": "^2.7.0",
|
|
24
24
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
25
|
-
"@volar/kit": "~2.
|
|
26
|
-
"@volar/language-core": "~2.
|
|
27
|
-
"@volar/language-server": "~2.
|
|
28
|
-
"@volar/language-service": "~2.
|
|
29
|
-
"@volar/typescript": "~2.
|
|
25
|
+
"@volar/kit": "~2.1.2",
|
|
26
|
+
"@volar/language-core": "~2.1.2",
|
|
27
|
+
"@volar/language-server": "~2.1.2",
|
|
28
|
+
"@volar/language-service": "~2.1.2",
|
|
29
|
+
"@volar/typescript": "~2.1.2",
|
|
30
30
|
"fast-glob": "^3.2.12",
|
|
31
|
-
"volar-service-css": "0.0.
|
|
32
|
-
"volar-service-emmet": "0.0.
|
|
33
|
-
"volar-service-html": "0.0.
|
|
34
|
-
"volar-service-prettier": "0.0.
|
|
35
|
-
"volar-service-typescript": "0.0.
|
|
36
|
-
"volar-service-typescript-twoslash-queries": "0.0.
|
|
31
|
+
"volar-service-css": "0.0.31",
|
|
32
|
+
"volar-service-emmet": "0.0.31",
|
|
33
|
+
"volar-service-html": "0.0.31",
|
|
34
|
+
"volar-service-prettier": "0.0.31-patch.1",
|
|
35
|
+
"volar-service-typescript": "0.0.31",
|
|
36
|
+
"volar-service-typescript-twoslash-queries": "0.0.31",
|
|
37
37
|
"vscode-html-languageservice": "^5.1.2",
|
|
38
38
|
"vscode-uri": "^3.0.8"
|
|
39
39
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/chai": "^4.3.5",
|
|
45
45
|
"@types/mocha": "^10.0.1",
|
|
46
46
|
"@types/node": "^18.17.8",
|
|
47
|
-
"@volar/test-utils": "~2.
|
|
47
|
+
"@volar/test-utils": "~2.1.2",
|
|
48
48
|
"astro": "^4.3.5",
|
|
49
49
|
"chai": "^4.3.7",
|
|
50
50
|
"mocha": "^10.2.0",
|