@astrojs/language-server 2.7.6 → 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 +1 -1
- package/dist/core/index.js +1 -0
- package/dist/languageServerPlugin.d.ts +2 -2
- package/dist/languageServerPlugin.js +3 -11
- package/dist/nodeServer.js +6 -1
- package/dist/plugins/html-data.js +22 -11
- package/package.json +14 -14
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();
|
|
@@ -9,7 +9,7 @@ exports.classListAttribute = (0, vscode_html_languageservice_1.newHTMLDataProvid
|
|
|
9
9
|
globalAttributes: [
|
|
10
10
|
{
|
|
11
11
|
name: 'class:list',
|
|
12
|
-
description: 'Utility to provide a list of class',
|
|
12
|
+
description: 'Utility to provide a list of classes of the element. Takes an array of class values and converts them into a class string.',
|
|
13
13
|
references: [
|
|
14
14
|
{
|
|
15
15
|
name: 'Astro reference',
|
|
@@ -55,7 +55,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
name: 'define:vars',
|
|
58
|
-
description: 'Passes serializable server-side variables into a client-side script element',
|
|
58
|
+
description: 'Passes serializable server-side variables into a client-side script element.',
|
|
59
59
|
references: [
|
|
60
60
|
{
|
|
61
61
|
name: 'Astro reference',
|
|
@@ -65,7 +65,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
name: 'hoist',
|
|
68
|
-
description: '**Deprecated in Astro >= 0.26.0**\n\nBuilds, optimizes, and bundles your script with the other JavaScript on the page',
|
|
68
|
+
description: '**Deprecated in Astro >= 0.26.0**\n\nBuilds, optimizes, and bundles your script with the other JavaScript on the page.',
|
|
69
69
|
valueSet: 'v',
|
|
70
70
|
references: [
|
|
71
71
|
{
|
|
@@ -76,7 +76,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: 'is:inline',
|
|
79
|
-
description: 'Leave a script tag inline in the page template. No processing will be done on its content',
|
|
79
|
+
description: 'Leave a script tag inline in the page template. No processing will be done on its content.',
|
|
80
80
|
valueSet: 'v',
|
|
81
81
|
references: [
|
|
82
82
|
{
|
|
@@ -85,6 +85,17 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
85
85
|
},
|
|
86
86
|
],
|
|
87
87
|
},
|
|
88
|
+
{
|
|
89
|
+
name: 'data-astro-rerun',
|
|
90
|
+
description: 'Force a script to be reexecuted when using <ViewTransitions/>. This will make your script is:inline as well.',
|
|
91
|
+
valueSet: 'v',
|
|
92
|
+
references: [
|
|
93
|
+
{
|
|
94
|
+
name: 'Astro reference',
|
|
95
|
+
url: 'https://docs.astro.build/en/guides/view-transitions/#script-behavior',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
88
99
|
],
|
|
89
100
|
},
|
|
90
101
|
{
|
|
@@ -92,7 +103,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
92
103
|
attributes: [
|
|
93
104
|
{
|
|
94
105
|
name: 'define:vars',
|
|
95
|
-
description: 'Passes serializable server-side variables into a client-side style element',
|
|
106
|
+
description: 'Passes serializable server-side variables into a client-side style element.',
|
|
96
107
|
references: [
|
|
97
108
|
{
|
|
98
109
|
name: 'Astro reference',
|
|
@@ -102,7 +113,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
102
113
|
},
|
|
103
114
|
{
|
|
104
115
|
name: 'global',
|
|
105
|
-
description: '**Deprecated in favor of `is:global` in >= Astro 0.26.0**\n\nOpts-out of automatic CSS scoping, all contents will be available globally',
|
|
116
|
+
description: '**Deprecated in favor of `is:global` in >= Astro 0.26.0**\n\nOpts-out of automatic CSS scoping, all contents will be available globally.',
|
|
106
117
|
valueSet: 'v',
|
|
107
118
|
references: [
|
|
108
119
|
{
|
|
@@ -113,7 +124,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
113
124
|
},
|
|
114
125
|
{
|
|
115
126
|
name: 'is:global',
|
|
116
|
-
description: 'Opts-out of automatic CSS scoping, all contents will be available globally',
|
|
127
|
+
description: 'Opts-out of automatic CSS scoping, all contents will be available globally.',
|
|
117
128
|
valueSet: 'v',
|
|
118
129
|
references: [
|
|
119
130
|
{
|
|
@@ -124,7 +135,7 @@ exports.astroElements = (0, vscode_html_languageservice_1.newHTMLDataProvider)('
|
|
|
124
135
|
},
|
|
125
136
|
{
|
|
126
137
|
name: 'is:inline',
|
|
127
|
-
description: 'Leave a style tag inline in the page template. No processing will be done on its content',
|
|
138
|
+
description: 'Leave a style tag inline in the page template. No processing will be done on its content.',
|
|
128
139
|
valueSet: 'v',
|
|
129
140
|
references: [
|
|
130
141
|
{
|
|
@@ -142,7 +153,7 @@ exports.astroAttributes = (0, vscode_html_languageservice_1.newHTMLDataProvider)
|
|
|
142
153
|
globalAttributes: [
|
|
143
154
|
{
|
|
144
155
|
name: 'set:html',
|
|
145
|
-
description: 'Inject unescaped HTML into this tag',
|
|
156
|
+
description: 'Inject unescaped HTML into this tag.',
|
|
146
157
|
references: [
|
|
147
158
|
{
|
|
148
159
|
name: 'Astro reference',
|
|
@@ -152,7 +163,7 @@ exports.astroAttributes = (0, vscode_html_languageservice_1.newHTMLDataProvider)
|
|
|
152
163
|
},
|
|
153
164
|
{
|
|
154
165
|
name: 'set:text',
|
|
155
|
-
description: 'Inject escaped text into this tag',
|
|
166
|
+
description: 'Inject escaped text into this tag.',
|
|
156
167
|
references: [
|
|
157
168
|
{
|
|
158
169
|
name: 'Astro reference',
|
|
@@ -162,7 +173,7 @@ exports.astroAttributes = (0, vscode_html_languageservice_1.newHTMLDataProvider)
|
|
|
162
173
|
},
|
|
163
174
|
{
|
|
164
175
|
name: 'is:raw',
|
|
165
|
-
description: 'Instructs the Astro compiler to treat any children of this element as text',
|
|
176
|
+
description: 'Instructs the Astro compiler to treat any children of this element as text.',
|
|
166
177
|
valueSet: 'v',
|
|
167
178
|
references: [
|
|
168
179
|
{
|
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",
|