@flint.fyi/volar-language 0.3.1 → 0.4.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.d.mts +3 -3
- package/dist/index.mjs +11 -18
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ type VolarBasedLanguageCreateFile<FileServices extends object> = (ctx: VolarBase
|
|
|
27
27
|
reports?: FileReport[];
|
|
28
28
|
};
|
|
29
29
|
type VolarLanguage<FileServices extends object> = Language<TypeScriptNodesByName, Partial<FileServices> & TypeScriptFileServices>;
|
|
30
|
-
declare function createVolarBasedLanguage<FileServices extends object>(initializer: VolarLanguagePluginInitializer<FileServices>): VolarLanguage<FileServices>;
|
|
31
|
-
declare function reportSourceCode<T extends string>(context: RuleContext<T>, report: RuleReport<T>): void;
|
|
30
|
+
export declare function createVolarBasedLanguage<FileServices extends object>(initializer: VolarLanguagePluginInitializer<FileServices>): VolarLanguage<FileServices>;
|
|
31
|
+
export declare function reportSourceCode<T extends string>(context: RuleContext<T>, report: RuleReport<T>): void;
|
|
32
32
|
//#endregion
|
|
33
|
-
export {
|
|
33
|
+
export type { VolarLanguage };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { proxyCreateProgram } from "@volar/typescript/lib/node/proxyCreateProgram.js";
|
|
2
|
-
import { getPreEmitDiagnostics } from "typescript";
|
|
3
|
-
import { DirectivesCollector, createLanguage, getColumnAndLineOfPosition, isSuggestionForFiles } from "@flint.fyi/core";
|
|
2
|
+
import { SyntaxKind, getPreEmitDiagnostics } from "typescript";
|
|
3
|
+
import { DirectivesCollector, createLanguage, getColumnAndLineOfPosition, isSuggestionForFiles, runFileVisitorSubscriptions } from "@flint.fyi/core";
|
|
4
4
|
import { setTSProgramCreationProxy } from "@flint.fyi/ts-patch";
|
|
5
|
-
import {
|
|
5
|
+
import { convertTypeScriptDiagnosticToLanguageReport, createNodeVisitorsForFile, extractDirectivesFromTypeScriptFile, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage } from "@flint.fyi/typescript-language";
|
|
6
6
|
import { FlintAssertionError, assert, nullThrows } from "@flint.fyi/utils";
|
|
7
7
|
//#region package.json
|
|
8
8
|
var name = "@flint.fyi/volar-language";
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.4.0";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/language.ts
|
|
12
12
|
const stateSymbol = Symbol.for("@flint.fyi/volar-language/state");
|
|
@@ -101,21 +101,13 @@ setVolarCreateFile((data, program, sourceFile) => {
|
|
|
101
101
|
const collected = directivesCollector.collect();
|
|
102
102
|
return {
|
|
103
103
|
__volarServices: {
|
|
104
|
-
runVisitors(
|
|
105
|
-
const
|
|
104
|
+
runVisitors(fileVisitors) {
|
|
105
|
+
const visitors = createNodeVisitorsForFile(fileVisitors);
|
|
106
106
|
if (!visitors) return;
|
|
107
|
-
const
|
|
108
|
-
options,
|
|
109
|
-
...file.services
|
|
110
|
-
};
|
|
107
|
+
const { enter, exit, visit } = visitors;
|
|
111
108
|
let lastMappingIdx = 0;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
visitors[key]?.(node, visitorServices);
|
|
115
|
-
node.forEachChild(visit);
|
|
116
|
-
visitors[`${key}:exit`]?.(node, visitorServices);
|
|
117
|
-
};
|
|
118
|
-
visitors.SourceFile?.(sourceFile, visitorServices);
|
|
109
|
+
const sourceFileEnter = enter?.[SyntaxKind.SourceFile];
|
|
110
|
+
if (sourceFileEnter !== void 0) runFileVisitorSubscriptions(sourceFileEnter, sourceFile);
|
|
119
111
|
Statements: for (const statement of sourceFile.statements) {
|
|
120
112
|
while (true) {
|
|
121
113
|
const currentMapping = sortedMappings[lastMappingIdx];
|
|
@@ -132,7 +124,8 @@ setVolarCreateFile((data, program, sourceFile) => {
|
|
|
132
124
|
visit(statement);
|
|
133
125
|
}
|
|
134
126
|
visit(sourceFile.endOfFileToken);
|
|
135
|
-
|
|
127
|
+
const sourceFileExit = exit?.[SyntaxKind.SourceFile];
|
|
128
|
+
if (sourceFileExit !== void 0) runFileVisitorSubscriptions(sourceFileExit, sourceFile);
|
|
136
129
|
},
|
|
137
130
|
getLanguageReports() {
|
|
138
131
|
return [...getPreEmitDiagnostics(program, sourceFile).map((diagnostic) => convertTypeScriptDiagnosticToLanguageReport({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/volar-language",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "[Experimental] Volar.js language for Flint.",
|
|
5
5
|
"homepage": "https://flint.fyi",
|
|
6
6
|
"repository": {
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@flint.fyi/core": "^0.
|
|
26
|
-
"@flint.fyi/ts-patch": "^0.
|
|
27
|
-
"@flint.fyi/typescript-language": "^0.
|
|
25
|
+
"@flint.fyi/core": "^0.27.0",
|
|
26
|
+
"@flint.fyi/ts-patch": "^0.17.0",
|
|
27
|
+
"@flint.fyi/typescript-language": "^0.21.0",
|
|
28
28
|
"@flint.fyi/utils": "^0.16.0",
|
|
29
29
|
"@volar/language-core": "2.4.28",
|
|
30
30
|
"@volar/typescript": "2.4.28",
|
|
31
|
-
"typescript": "^
|
|
31
|
+
"typescript": "^6.0.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@flint.fyi/build": "^0.1.0",
|
|
35
|
-
"tsdown": "0.
|
|
36
|
-
"vitest": "
|
|
35
|
+
"tsdown": "0.23.0",
|
|
36
|
+
"vitest": "5.0.1"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=26.1.0"
|