@astrojs/ts-plugin 1.5.1 → 1.5.2
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/astro2tsx.d.ts +1 -1
- package/dist/astro2tsx.js +3 -3
- package/dist/index.js +1 -1
- package/dist/language.d.ts +2 -3
- package/dist/language.js +6 -6
- package/package.json +3 -3
package/dist/astro2tsx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VirtualCode } from '@volar/language-core';
|
|
2
|
-
export declare function astro2tsx(input: string, fileName: string
|
|
2
|
+
export declare function astro2tsx(input: string, fileName: string): {
|
|
3
3
|
virtualFile: VirtualCode<string>;
|
|
4
4
|
diagnostics: import("@astrojs/compiler").DiagnosticMessage[] | {
|
|
5
5
|
code: 1000;
|
package/dist/astro2tsx.js
CHANGED
|
@@ -46,15 +46,15 @@ function safeConvertToTSX(content, options) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function astro2tsx(input, fileName
|
|
49
|
+
function astro2tsx(input, fileName) {
|
|
50
50
|
const tsx = safeConvertToTSX(input, { filename: fileName });
|
|
51
51
|
return {
|
|
52
|
-
virtualFile: getVirtualFileTSX(input, tsx, fileName
|
|
52
|
+
virtualFile: getVirtualFileTSX(input, tsx, fileName),
|
|
53
53
|
diagnostics: tsx.diagnostics,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
exports.astro2tsx = astro2tsx;
|
|
57
|
-
function getVirtualFileTSX(input, tsx, fileName
|
|
57
|
+
function getVirtualFileTSX(input, tsx, fileName) {
|
|
58
58
|
tsx.code = patchTSX(tsx.code, fileName);
|
|
59
59
|
const v3Mappings = (0, sourcemap_codec_1.decode)(tsx.map.mappings);
|
|
60
60
|
const sourcedDoc = vscode_languageserver_textdocument_1.TextDocument.create(fileName, 'astro', 0, input);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const createLanguageServicePlugin_js_1 = require("@volar/typescript/lib/quickstart/createLanguageServicePlugin.js");
|
|
3
3
|
const language_js_1 = require("./language.js");
|
|
4
|
-
module.exports = (0, createLanguageServicePlugin_js_1.createLanguageServicePlugin)((
|
|
4
|
+
module.exports = (0, createLanguageServicePlugin_js_1.createLanguageServicePlugin)(() => [(0, language_js_1.getLanguageModule)()]);
|
package/dist/language.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { type CodeMapping, type LanguagePlugin, type VirtualCode } from '@volar/language-core';
|
|
2
2
|
import type ts from 'typescript';
|
|
3
|
-
export declare function getLanguageModule(
|
|
3
|
+
export declare function getLanguageModule(): LanguagePlugin<AstroVirtualCode>;
|
|
4
4
|
export declare class AstroVirtualCode implements VirtualCode {
|
|
5
5
|
fileName: string;
|
|
6
6
|
snapshot: ts.IScriptSnapshot;
|
|
7
|
-
private readonly ts;
|
|
8
7
|
id: string;
|
|
9
8
|
languageId: string;
|
|
10
9
|
mappings: CodeMapping[];
|
|
11
10
|
embeddedCodes: VirtualCode[];
|
|
12
11
|
codegenStacks: never[];
|
|
13
|
-
constructor(fileName: string, snapshot: ts.IScriptSnapshot
|
|
12
|
+
constructor(fileName: string, snapshot: ts.IScriptSnapshot);
|
|
14
13
|
update(newSnapshot: ts.IScriptSnapshot): void;
|
|
15
14
|
onSnapshotUpdated(): void;
|
|
16
15
|
}
|
package/dist/language.js
CHANGED
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AstroVirtualCode = exports.getLanguageModule = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const astro2tsx_js_1 = require("./astro2tsx.js");
|
|
6
|
-
function getLanguageModule(
|
|
6
|
+
function getLanguageModule() {
|
|
7
7
|
return {
|
|
8
8
|
createVirtualCode(fileId, languageId, snapshot) {
|
|
9
9
|
if (languageId === 'astro') {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// fileId will never be a uri in ts plugin
|
|
11
|
+
const fileName = fileId;
|
|
12
|
+
return new AstroVirtualCode(fileName, snapshot);
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
updateVirtualCode(_fileId, astroFile, snapshot) {
|
|
@@ -33,10 +34,9 @@ function getLanguageModule(ts) {
|
|
|
33
34
|
}
|
|
34
35
|
exports.getLanguageModule = getLanguageModule;
|
|
35
36
|
class AstroVirtualCode {
|
|
36
|
-
constructor(fileName, snapshot
|
|
37
|
+
constructor(fileName, snapshot) {
|
|
37
38
|
this.fileName = fileName;
|
|
38
39
|
this.snapshot = snapshot;
|
|
39
|
-
this.ts = ts;
|
|
40
40
|
this.id = 'root';
|
|
41
41
|
this.languageId = 'astro';
|
|
42
42
|
this.codegenStacks = [];
|
|
@@ -63,7 +63,7 @@ class AstroVirtualCode {
|
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
65
|
this.embeddedCodes = [];
|
|
66
|
-
const tsx = (0, astro2tsx_js_1.astro2tsx)(this.snapshot.getText(0, this.snapshot.getLength()), this.fileName
|
|
66
|
+
const tsx = (0, astro2tsx_js_1.astro2tsx)(this.snapshot.getText(0, this.snapshot.getLength()), this.fileName);
|
|
67
67
|
this.embeddedCodes.push(tsx.virtualFile);
|
|
68
68
|
}
|
|
69
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/ts-plugin",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A TypeScript Plugin providing Astro intellisense",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"author": "withastro",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@volar/language-core": "~2.0.
|
|
26
|
-
"@volar/typescript": "~2.0.
|
|
25
|
+
"@volar/language-core": "~2.0.4",
|
|
26
|
+
"@volar/typescript": "~2.0.4",
|
|
27
27
|
"@astrojs/compiler": "^2.4.0",
|
|
28
28
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
29
29
|
"semver": "^7.3.8",
|