@astrojs/language-server 2.0.0 → 2.0.14
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.js +1 -1
- package/dist/core/utils.d.ts +1 -1
- package/dist/core/utils.js +5 -3
- package/dist/utils.d.ts +2 -2
- package/package.json +12 -12
package/dist/core/astro2tsx.js
CHANGED
|
@@ -15,7 +15,7 @@ function astro2tsx(input, fileName, ts, htmlDocument) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.astro2tsx = astro2tsx;
|
|
17
17
|
function getVirtualFileTSX(input, tsx, fileName, ts, htmlDocument) {
|
|
18
|
-
tsx.code = (0, utils_js_1.patchTSX)(tsx.code);
|
|
18
|
+
tsx.code = (0, utils_js_1.patchTSX)(tsx.code, fileName);
|
|
19
19
|
const v3Mappings = (0, sourcemap_codec_1.decode)(tsx.map.mappings);
|
|
20
20
|
const sourcedDoc = vscode_html_languageservice_1.TextDocument.create(fileName, 'astro', 0, input);
|
|
21
21
|
const genDoc = vscode_html_languageservice_1.TextDocument.create(fileName + '.tsx', 'typescriptreact', 0, tsx.code);
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export interface AstroInstall {
|
|
|
11
11
|
export declare function getAstroInstall(basePaths: string[]): AstroInstall | undefined;
|
|
12
12
|
export declare function framework2tsx(fileName: string, filePath: string, sourceCode: string, framework: 'vue' | 'svelte'): VirtualFile;
|
|
13
13
|
export declare function classNameFromFilename(filename: string): string;
|
|
14
|
-
export declare function patchTSX(code: string): string;
|
|
14
|
+
export declare function patchTSX(code: string, fileName: string): string;
|
package/dist/core/utils.js
CHANGED
|
@@ -76,7 +76,7 @@ function framework2tsx(fileName, filePath, sourceCode, framework) {
|
|
|
76
76
|
return getVirtualFile(EMPTY_FILE);
|
|
77
77
|
}
|
|
78
78
|
const className = classNameFromFilename(filePath);
|
|
79
|
-
const tsx = patchTSX(integrationEditorEntrypoint.toTSX(sourceCode, className));
|
|
79
|
+
const tsx = patchTSX(integrationEditorEntrypoint.toTSX(sourceCode, className), fileName);
|
|
80
80
|
return getVirtualFile(tsx);
|
|
81
81
|
function getVirtualFile(content) {
|
|
82
82
|
return {
|
|
@@ -131,8 +131,10 @@ function classNameFromFilename(filename) {
|
|
|
131
131
|
}
|
|
132
132
|
exports.classNameFromFilename = classNameFromFilename;
|
|
133
133
|
// TODO: Patch the upstream packages with these changes
|
|
134
|
-
function patchTSX(code) {
|
|
135
|
-
|
|
134
|
+
function patchTSX(code, fileName) {
|
|
135
|
+
const basename = path.basename(fileName, path.extname(fileName));
|
|
136
|
+
const isDynamic = basename.startsWith('[') && basename.endsWith(']');
|
|
137
|
+
return code.replace(/\b(\S*)__AstroComponent_/, (_, m1) => isDynamic ? `_${m1}_` : m1[0].toUpperCase() + m1.slice(1));
|
|
136
138
|
}
|
|
137
139
|
exports.patchTSX = patchTSX;
|
|
138
140
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AttributeNode, Position as CompilerPosition
|
|
2
|
-
import { HTMLDocument, Position as LSPPosition,
|
|
1
|
+
import type { AttributeNode, Point, Position as CompilerPosition } from '@astrojs/compiler/types';
|
|
2
|
+
import { HTMLDocument, Node, Position as LSPPosition, Range, TextEdit } from 'vscode-html-languageservice';
|
|
3
3
|
import type { FrontmatterStatus } from './core/parseAstro.js';
|
|
4
4
|
export declare function isJSDocument(languageId: string): boolean;
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"author": "withastro",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@astrojs/compiler": "^1.5.0",
|
|
24
24
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
25
|
-
"@volar/kit": "
|
|
26
|
-
"@volar/language-core": "
|
|
27
|
-
"@volar/language-server": "
|
|
28
|
-
"@volar/language-service": "
|
|
29
|
-
"@volar/source-map": "
|
|
25
|
+
"@volar/kit": "1.6.9",
|
|
26
|
+
"@volar/language-core": "1.6.9",
|
|
27
|
+
"@volar/language-server": "1.6.9",
|
|
28
|
+
"@volar/language-service": "1.6.9",
|
|
29
|
+
"@volar/source-map": "1.6.9",
|
|
30
30
|
"fast-glob": "^3.2.12",
|
|
31
31
|
"muggle-string": "^0.3.1",
|
|
32
|
-
"volar-service-css": "
|
|
33
|
-
"volar-service-emmet": "
|
|
34
|
-
"volar-service-html": "
|
|
35
|
-
"volar-service-prettier": "
|
|
36
|
-
"volar-service-typescript": "
|
|
37
|
-
"volar-service-typescript-twoslash-queries": "
|
|
32
|
+
"volar-service-css": "0.0.4",
|
|
33
|
+
"volar-service-emmet": "0.0.4",
|
|
34
|
+
"volar-service-html": "0.0.4",
|
|
35
|
+
"volar-service-prettier": "0.0.4",
|
|
36
|
+
"volar-service-typescript": "0.0.4",
|
|
37
|
+
"volar-service-typescript-twoslash-queries": "0.0.4",
|
|
38
38
|
"vscode-html-languageservice": "^5.0.5",
|
|
39
39
|
"vscode-uri": "^3.0.7"
|
|
40
40
|
},
|