@astrojs/ts-plugin 1.8.0 → 1.9.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/index.js +3 -1
- package/dist/language.d.ts +1 -3
- package/dist/language.js +7 -19
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
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)(() => ({
|
|
5
|
+
languagePlugins: [(0, language_js_1.getLanguagePlugin)()],
|
|
6
|
+
}));
|
package/dist/language.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CodeMapping, type LanguagePlugin, type VirtualCode } from '@volar/language-core';
|
|
2
2
|
import type ts from 'typescript';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function getLanguagePlugin(): LanguagePlugin<string, AstroVirtualCode>;
|
|
4
4
|
export declare class AstroVirtualCode implements VirtualCode {
|
|
5
5
|
fileName: string;
|
|
6
6
|
snapshot: ts.IScriptSnapshot;
|
|
@@ -10,6 +10,4 @@ export declare class AstroVirtualCode implements VirtualCode {
|
|
|
10
10
|
embeddedCodes: VirtualCode[];
|
|
11
11
|
codegenStacks: never[];
|
|
12
12
|
constructor(fileName: string, snapshot: ts.IScriptSnapshot);
|
|
13
|
-
update(newSnapshot: ts.IScriptSnapshot): void;
|
|
14
|
-
onSnapshotUpdated(): void;
|
|
15
13
|
}
|
package/dist/language.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/// <reference types="@volar/typescript" />
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AstroVirtualCode = exports.
|
|
4
|
+
exports.AstroVirtualCode = exports.getLanguagePlugin = void 0;
|
|
4
5
|
const language_core_1 = require("@volar/language-core");
|
|
5
6
|
const astro2tsx_js_1 = require("./astro2tsx.js");
|
|
6
|
-
function
|
|
7
|
+
function getLanguagePlugin() {
|
|
7
8
|
return {
|
|
8
|
-
getLanguageId(
|
|
9
|
-
if (
|
|
9
|
+
getLanguageId(fileName) {
|
|
10
|
+
if (fileName.endsWith('.astro')) {
|
|
10
11
|
return 'astro';
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
|
-
createVirtualCode(
|
|
14
|
+
createVirtualCode(fileName, languageId, snapshot) {
|
|
14
15
|
if (languageId === 'astro') {
|
|
15
|
-
// scriptId will never be a uri in ts plugin
|
|
16
|
-
const fileName = scriptId;
|
|
17
16
|
return new AstroVirtualCode(fileName, snapshot);
|
|
18
17
|
}
|
|
19
18
|
},
|
|
20
|
-
updateVirtualCode(_scriptId, astroFile, snapshot) {
|
|
21
|
-
astroFile.update(snapshot);
|
|
22
|
-
return astroFile;
|
|
23
|
-
},
|
|
24
19
|
typescript: {
|
|
25
20
|
extraFileExtensions: [{ extension: 'astro', isMixedContent: true, scriptKind: 7 }],
|
|
26
21
|
getServiceScript(astroCode) {
|
|
@@ -37,7 +32,7 @@ function getLanguageModule() {
|
|
|
37
32
|
},
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
|
-
exports.
|
|
35
|
+
exports.getLanguagePlugin = getLanguagePlugin;
|
|
41
36
|
class AstroVirtualCode {
|
|
42
37
|
constructor(fileName, snapshot) {
|
|
43
38
|
this.fileName = fileName;
|
|
@@ -45,13 +40,6 @@ class AstroVirtualCode {
|
|
|
45
40
|
this.id = 'root';
|
|
46
41
|
this.languageId = 'astro';
|
|
47
42
|
this.codegenStacks = [];
|
|
48
|
-
this.onSnapshotUpdated();
|
|
49
|
-
}
|
|
50
|
-
update(newSnapshot) {
|
|
51
|
-
this.snapshot = newSnapshot;
|
|
52
|
-
this.onSnapshotUpdated();
|
|
53
|
-
}
|
|
54
|
-
onSnapshotUpdated() {
|
|
55
43
|
this.mappings = [
|
|
56
44
|
{
|
|
57
45
|
sourceOffsets: [0],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/ts-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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.
|
|
26
|
-
"@volar/typescript": "~2.
|
|
25
|
+
"@volar/language-core": "~2.4.0-alpha.15",
|
|
26
|
+
"@volar/typescript": "~2.4.0-alpha.15",
|
|
27
27
|
"@astrojs/compiler": "^2.7.0",
|
|
28
28
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
29
29
|
"semver": "^7.3.8",
|