astro-vscode 2.0.16 → 2.0.18
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/node/client.js +37 -7
- package/dist/node/server.js +38 -8
- package/package.json +3 -3
package/dist/node/client.js
CHANGED
|
@@ -218751,8 +218751,36 @@ var require_astro2tsx = __commonJS({
|
|
|
218751
218751
|
var language_core_1 = require_out3();
|
|
218752
218752
|
var vscode_html_languageservice_1 = (init_htmlLanguageService(), __toCommonJS(htmlLanguageService_exports));
|
|
218753
218753
|
var utils_js_1 = require_utils6();
|
|
218754
|
+
function safeConvertToTSX(content, options) {
|
|
218755
|
+
try {
|
|
218756
|
+
const tsx = (0, sync_1.convertToTSX)(content, { filename: options.filename });
|
|
218757
|
+
return tsx;
|
|
218758
|
+
} catch (e) {
|
|
218759
|
+
console.error(`There was an error transforming ${options.filename} to TSX. An empty file will be returned instead. Please create an issue: https://github.com/withastro/language-tools/issues
|
|
218760
|
+
Error: ${e}.`);
|
|
218761
|
+
return {
|
|
218762
|
+
code: "",
|
|
218763
|
+
map: {
|
|
218764
|
+
file: options.filename ?? "",
|
|
218765
|
+
sources: [],
|
|
218766
|
+
sourcesContent: [],
|
|
218767
|
+
names: [],
|
|
218768
|
+
mappings: "",
|
|
218769
|
+
version: 0
|
|
218770
|
+
},
|
|
218771
|
+
diagnostics: [
|
|
218772
|
+
{
|
|
218773
|
+
code: 1e3,
|
|
218774
|
+
location: { file: options.filename, line: 1, column: 1, length: content.length },
|
|
218775
|
+
severity: 1,
|
|
218776
|
+
text: `The Astro compiler encountered an unknown error while parsing this file. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/language-tools/issues`
|
|
218777
|
+
}
|
|
218778
|
+
]
|
|
218779
|
+
};
|
|
218780
|
+
}
|
|
218781
|
+
}
|
|
218754
218782
|
function astro2tsx(input, fileName, ts, htmlDocument) {
|
|
218755
|
-
const tsx = (
|
|
218783
|
+
const tsx = safeConvertToTSX(input, { filename: fileName });
|
|
218756
218784
|
return {
|
|
218757
218785
|
virtualFile: getVirtualFileTSX(input, tsx, fileName, ts, htmlDocument),
|
|
218758
218786
|
diagnostics: tsx.diagnostics
|
|
@@ -218826,11 +218854,13 @@ var require_astro2tsx = __commonJS({
|
|
|
218826
218854
|
data: {}
|
|
218827
218855
|
});
|
|
218828
218856
|
const ast = ts.createSourceFile("/a.tsx", tsx.code, ts.ScriptTarget.ESNext);
|
|
218829
|
-
|
|
218830
|
-
|
|
218831
|
-
|
|
218832
|
-
|
|
218833
|
-
|
|
218857
|
+
if (ast.statements[0]) {
|
|
218858
|
+
mappings.push({
|
|
218859
|
+
sourceRange: [0, input.length],
|
|
218860
|
+
generatedRange: [ast.statements[0].getStart(ast), tsx.code.length],
|
|
218861
|
+
data: {}
|
|
218862
|
+
});
|
|
218863
|
+
}
|
|
218834
218864
|
return {
|
|
218835
218865
|
fileName: fileName + ".tsx",
|
|
218836
218866
|
kind: language_core_1.FileKind.TypeScriptHostFile,
|
|
@@ -222374,7 +222404,7 @@ var require_astro = __commonJS({
|
|
|
222374
222404
|
return file.compilerDiagnostics.map(compilerMessageToDiagnostic);
|
|
222375
222405
|
function compilerMessageToDiagnostic(message) {
|
|
222376
222406
|
return {
|
|
222377
|
-
message: message.text + "\n\n" + message.hint,
|
|
222407
|
+
message: message.text + (message.hint ? "\n\n" + message.hint : ""),
|
|
222378
222408
|
range: language_server_1.Range.create(message.location.line - 1, message.location.column - 1, message.location.line, message.location.length),
|
|
222379
222409
|
code: message.code,
|
|
222380
222410
|
severity: message.severity,
|
package/dist/node/server.js
CHANGED
|
@@ -38,7 +38,7 @@ var require_package = __commonJS({
|
|
|
38
38
|
"../language-server/package.json"(exports2, module2) {
|
|
39
39
|
module2.exports = {
|
|
40
40
|
name: "@astrojs/language-server",
|
|
41
|
-
version: "2.0.
|
|
41
|
+
version: "2.0.17",
|
|
42
42
|
author: "withastro",
|
|
43
43
|
license: "MIT",
|
|
44
44
|
repository: {
|
|
@@ -236913,8 +236913,36 @@ var require_astro2tsx = __commonJS({
|
|
|
236913
236913
|
var language_core_1 = require_out3();
|
|
236914
236914
|
var vscode_html_languageservice_1 = (init_htmlLanguageService(), __toCommonJS(htmlLanguageService_exports));
|
|
236915
236915
|
var utils_js_1 = require_utils();
|
|
236916
|
+
function safeConvertToTSX(content, options) {
|
|
236917
|
+
try {
|
|
236918
|
+
const tsx = (0, sync_1.convertToTSX)(content, { filename: options.filename });
|
|
236919
|
+
return tsx;
|
|
236920
|
+
} catch (e) {
|
|
236921
|
+
console.error(`There was an error transforming ${options.filename} to TSX. An empty file will be returned instead. Please create an issue: https://github.com/withastro/language-tools/issues
|
|
236922
|
+
Error: ${e}.`);
|
|
236923
|
+
return {
|
|
236924
|
+
code: "",
|
|
236925
|
+
map: {
|
|
236926
|
+
file: options.filename ?? "",
|
|
236927
|
+
sources: [],
|
|
236928
|
+
sourcesContent: [],
|
|
236929
|
+
names: [],
|
|
236930
|
+
mappings: "",
|
|
236931
|
+
version: 0
|
|
236932
|
+
},
|
|
236933
|
+
diagnostics: [
|
|
236934
|
+
{
|
|
236935
|
+
code: 1e3,
|
|
236936
|
+
location: { file: options.filename, line: 1, column: 1, length: content.length },
|
|
236937
|
+
severity: 1,
|
|
236938
|
+
text: `The Astro compiler encountered an unknown error while parsing this file. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/language-tools/issues`
|
|
236939
|
+
}
|
|
236940
|
+
]
|
|
236941
|
+
};
|
|
236942
|
+
}
|
|
236943
|
+
}
|
|
236916
236944
|
function astro2tsx(input, fileName, ts, htmlDocument) {
|
|
236917
|
-
const tsx = (
|
|
236945
|
+
const tsx = safeConvertToTSX(input, { filename: fileName });
|
|
236918
236946
|
return {
|
|
236919
236947
|
virtualFile: getVirtualFileTSX(input, tsx, fileName, ts, htmlDocument),
|
|
236920
236948
|
diagnostics: tsx.diagnostics
|
|
@@ -236988,11 +237016,13 @@ var require_astro2tsx = __commonJS({
|
|
|
236988
237016
|
data: {}
|
|
236989
237017
|
});
|
|
236990
237018
|
const ast = ts.createSourceFile("/a.tsx", tsx.code, ts.ScriptTarget.ESNext);
|
|
236991
|
-
|
|
236992
|
-
|
|
236993
|
-
|
|
236994
|
-
|
|
236995
|
-
|
|
237019
|
+
if (ast.statements[0]) {
|
|
237020
|
+
mappings.push({
|
|
237021
|
+
sourceRange: [0, input.length],
|
|
237022
|
+
generatedRange: [ast.statements[0].getStart(ast), tsx.code.length],
|
|
237023
|
+
data: {}
|
|
237024
|
+
});
|
|
237025
|
+
}
|
|
236996
237026
|
return {
|
|
236997
237027
|
fileName: fileName + ".tsx",
|
|
236998
237028
|
kind: language_core_1.FileKind.TypeScriptHostFile,
|
|
@@ -243448,7 +243478,7 @@ var require_astro = __commonJS({
|
|
|
243448
243478
|
return file.compilerDiagnostics.map(compilerMessageToDiagnostic);
|
|
243449
243479
|
function compilerMessageToDiagnostic(message) {
|
|
243450
243480
|
return {
|
|
243451
|
-
message: message.text + "\n\n" + message.hint,
|
|
243481
|
+
message: message.text + (message.hint ? "\n\n" + message.hint : ""),
|
|
243452
243482
|
range: language_server_1.Range.create(message.location.line - 1, message.location.column - 1, message.location.line, message.location.length),
|
|
243453
243483
|
code: message.code,
|
|
243454
243484
|
severity: message.severity,
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"color": "#17191E",
|
|
25
25
|
"theme": "dark"
|
|
26
26
|
},
|
|
27
|
-
"version": "2.0.
|
|
27
|
+
"version": "2.0.18",
|
|
28
28
|
"author": "withastro",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"publisher": "astro-build",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
]
|
|
209
209
|
},
|
|
210
210
|
"devDependencies": {
|
|
211
|
-
"@astrojs/language-server": "^2.0.
|
|
211
|
+
"@astrojs/language-server": "^2.0.17",
|
|
212
212
|
"@types/glob": "^8.1.0",
|
|
213
213
|
"@types/mocha": "^10.0.1",
|
|
214
214
|
"@types/node": "^16.18.26",
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"vscode-tmgrammar-test": "^0.1.1"
|
|
229
229
|
},
|
|
230
230
|
"dependencies": {
|
|
231
|
-
"@astrojs/ts-plugin": "^1.0.
|
|
231
|
+
"@astrojs/ts-plugin": "^1.0.10",
|
|
232
232
|
"prettier": "^2.8.8",
|
|
233
233
|
"prettier-plugin-astro": "^0.10.0"
|
|
234
234
|
},
|