@flint.fyi/typescript-language 0.0.0 → 0.18.1
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/LICENSE.md +20 -0
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/collectReferencedFilePaths.js +9 -10
- package/lib/convertTypeScriptDiagnosticToLanguageReport.d.ts +18 -0
- package/lib/{convertTypeScriptDiagnosticToLanguageFileDiagnostic.js → convertTypeScriptDiagnosticToLanguageReport.js} +13 -10
- package/lib/createTypeScriptServerHost.d.ts +4 -0
- package/lib/createTypeScriptServerHost.js +99 -0
- package/lib/directives/parseDirectivesFromTypeScriptFile.js +33 -3
- package/lib/getFirstEnumValues.js +1 -1
- package/lib/getTSNodeRange.js +1 -1
- package/lib/getTypeScriptFileCacheImpacts.d.ts +4 -0
- package/lib/getTypeScriptFileCacheImpacts.js +9 -0
- package/lib/index.d.ts +8 -9
- package/lib/index.js +6 -8
- package/lib/language.d.ts +211 -5
- package/lib/language.js +108 -14
- package/lib/nodes.d.ts +3 -1
- package/lib/normalizeRange.js +1 -2
- package/lib/package.js +7 -0
- package/lib/types/ast.d.ts +2 -2
- package/lib/utils/createRuleTesterTSConfig.d.ts +8 -0
- package/lib/utils/createRuleTesterTSConfig.js +18 -0
- package/lib/utils/declarationIncludesGlobal.js +1 -1
- package/lib/utils/declarationsIncludeGlobal.js +1 -2
- package/lib/utils/getDeclarationsIfGlobal.d.ts +4 -5
- package/lib/utils/getDeclarationsIfGlobal.js +1 -2
- package/lib/utils/getModifyingReferences.d.ts +1 -3
- package/lib/utils/getModifyingReferences.js +13 -11
- package/lib/utils/hasSameTokens.d.ts +2 -2
- package/lib/utils/hasSameTokens.js +4 -5
- package/lib/utils/isBuiltinArrayMethod.d.ts +2 -3
- package/lib/utils/isBuiltinArrayMethod.js +1 -2
- package/lib/utils/isFunction.d.ts +2 -4
- package/lib/utils/isFunction.js +1 -1
- package/lib/utils/isGlobalDeclaration.d.ts +2 -4
- package/lib/utils/isGlobalDeclaration.js +1 -2
- package/lib/utils/isGlobalDeclarationOfName.d.ts +1 -2
- package/lib/utils/isGlobalDeclarationOfName.js +1 -2
- package/lib/utils/isGlobalVariable.d.ts +2 -5
- package/lib/utils/isGlobalVariable.js +1 -2
- package/lib/utils/isInlineArrayCreation.d.ts +0 -1
- package/lib/utils/isInlineArrayCreation.js +1 -2
- package/lib/utils/unwrapParentParenthesizedExpressions.d.ts +2 -2
- package/lib/utils/unwrapParentParenthesizedExpressions.js +4 -5
- package/lib/utils/unwrapParenthesizedNode.d.ts +7 -0
- package/lib/utils/unwrapParenthesizedNode.js +9 -0
- package/package.json +45 -52
- package/lib/_virtual/rolldown_runtime.js +0 -18
- package/lib/convertTypeScriptDiagnosticToLanguageFileDiagnostic.d.ts +0 -18
- package/lib/createTypeScriptFileFromProgram.d.ts +0 -12
- package/lib/createTypeScriptFileFromProgram.js +0 -41
- package/lib/createTypeScriptFileFromProjectService.d.ts +0 -8
- package/lib/createTypeScriptFileFromProjectService.js +0 -16
- package/lib/lib/convertTypeScriptDiagnosticToLanguageFileDiagnostic.d.ts +0 -2
- package/lib/lib/createTypeScriptFileFromProgram.d.ts +0 -5
- package/lib/lib/directives/parseDirectivesFromTypeScriptFile.d.ts +0 -2
- package/lib/lib/getTSNodeRange.d.ts +0 -3
- package/lib/lib/index.d.ts +0 -21
- package/lib/lib/language.d.ts +0 -5
- package/lib/lib/nodes.d.ts +0 -1
- package/lib/lib/prepareTypeScriptBasedLanguage.d.ts +0 -2
- package/lib/lib/types/ast.d.ts +0 -2066
- package/lib/lib/types/checker.d.ts +0 -23
- package/lib/lib/utils/declarationIncludesGlobal.d.ts +0 -1
- package/lib/lib/utils/getDeclarationsIfGlobal.d.ts +0 -2
- package/lib/lib/utils/getModifyingReferences.d.ts +0 -3
- package/lib/lib/utils/hasSameTokens.d.ts +0 -1
- package/lib/lib/utils/isBuiltinArrayMethod.d.ts +0 -2
- package/lib/lib/utils/isFunction.d.ts +0 -1
- package/lib/lib/utils/isGlobalDeclaration.d.ts +0 -1
- package/lib/lib/utils/isGlobalDeclarationOfName.d.ts +0 -2
- package/lib/lib/utils/isGlobalVariable.d.ts +0 -1
- package/lib/lib/utils/isInlineArrayCreation.d.ts +0 -1
- package/lib/lib/utils/unwrapParentParenthesizedExpressions.d.ts +0 -1
- package/lib/lib/utils/unwrapParenthesizedExpression.d.ts +0 -1
- package/lib/prepareTypeScriptBasedLanguage.d.ts +0 -16
- package/lib/prepareTypeScriptBasedLanguage.js +0 -55
- package/lib/prepareTypeScriptFile.d.ts +0 -14
- package/lib/prepareTypeScriptFile.js +0 -18
- package/lib/utils/unwrapParenthesizedExpression.d.ts +0 -7
- package/lib/utils/unwrapParenthesizedExpression.js +0 -10
package/package.json
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public",
|
|
49
|
-
"exports": {
|
|
50
|
-
".": "./lib/index.js"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
2
|
+
"name": "@flint.fyi/typescript-language",
|
|
3
|
+
"version": "0.18.1",
|
|
4
|
+
"description": "[Experimental] TypeScript language for Flint.",
|
|
5
|
+
"homepage": "https://flint.fyi",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/flint-fyi/flint.git",
|
|
9
|
+
"directory": "packages/typescript-language"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "JoshuaKGoldberg",
|
|
14
|
+
"email": "npm@joshuakgoldberg.com"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": true,
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib/",
|
|
23
|
+
"!lib/**/*.map"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@typescript-eslint/project-service": "^8.53.0",
|
|
27
|
+
"debug-for-file": "^0.3.0",
|
|
28
|
+
"ts-api-utils": "^2.4.0",
|
|
29
|
+
"typescript": "^5.9.0 || ^6.0.0",
|
|
30
|
+
"@flint.fyi/core": "^0.21.1",
|
|
31
|
+
"@flint.fyi/utils": "^0.14.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tsdown": "0.21.0",
|
|
35
|
+
"vitest": "4.1.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=24.0.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "vitest --project typescript-language"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) {
|
|
6
|
-
__defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
if (symbols) {
|
|
12
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { __exportAll };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LanguageFileDiagnostic, SourceFileWithLineMapAndFileName } from "@flint.fyi/core";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
|
|
4
|
-
//#region src/convertTypeScriptDiagnosticToLanguageFileDiagnostic.d.ts
|
|
5
|
-
interface TSBasedDiagnostic extends TSBasedDiagnosticRelatedInformation {
|
|
6
|
-
relatedInformation?: TSBasedDiagnosticRelatedInformation[];
|
|
7
|
-
}
|
|
8
|
-
interface TSBasedDiagnosticRelatedInformation {
|
|
9
|
-
code: number;
|
|
10
|
-
file: SourceFileWithLineMapAndFileName | undefined;
|
|
11
|
-
length: number | undefined;
|
|
12
|
-
messageText: string | ts.DiagnosticMessageChain;
|
|
13
|
-
start: number | undefined;
|
|
14
|
-
}
|
|
15
|
-
declare function convertTypeScriptDiagnosticToLanguageFileDiagnostic(diagnostic: TSBasedDiagnostic): LanguageFileDiagnostic;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { convertTypeScriptDiagnosticToLanguageFileDiagnostic };
|
|
18
|
-
//# sourceMappingURL=convertTypeScriptDiagnosticToLanguageFileDiagnostic.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SourceFile } from "./types/ast.js";
|
|
2
|
-
import "./nodes.js";
|
|
3
|
-
import "./language.js";
|
|
4
|
-
import { LanguageFileCacheImpacts } from "@flint.fyi/core";
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
|
|
7
|
-
//#region src/createTypeScriptFileFromProgram.d.ts
|
|
8
|
-
declare const NodeSyntaxKinds: typeof ts.SyntaxKind;
|
|
9
|
-
declare function collectTypeScriptFileCacheImpacts(program: ts.Program, sourceFile: SourceFile): LanguageFileCacheImpacts;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { NodeSyntaxKinds, collectTypeScriptFileCacheImpacts };
|
|
12
|
-
//# sourceMappingURL=createTypeScriptFileFromProgram.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { convertTypeScriptDiagnosticToLanguageFileDiagnostic } from "./convertTypeScriptDiagnosticToLanguageFileDiagnostic.js";
|
|
2
|
-
import { collectReferencedFilePaths } from "./collectReferencedFilePaths.js";
|
|
3
|
-
import { getFirstEnumValues } from "./getFirstEnumValues.js";
|
|
4
|
-
import ts, { SyntaxKind } from "typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/createTypeScriptFileFromProgram.ts
|
|
7
|
-
const NodeSyntaxKinds = getFirstEnumValues(SyntaxKind);
|
|
8
|
-
function collectTypeScriptFileCacheImpacts(program, sourceFile) {
|
|
9
|
-
return { dependencies: ["tsconfig.json", ...collectReferencedFilePaths(program, sourceFile)] };
|
|
10
|
-
}
|
|
11
|
-
function createTypeScriptFileFromProgram(data, program, sourceFile) {
|
|
12
|
-
return {
|
|
13
|
-
about: {
|
|
14
|
-
...data,
|
|
15
|
-
sourceText: sourceFile.text
|
|
16
|
-
},
|
|
17
|
-
cache: collectTypeScriptFileCacheImpacts(program, sourceFile),
|
|
18
|
-
getDiagnostics() {
|
|
19
|
-
return ts.getPreEmitDiagnostics(program, sourceFile).map(convertTypeScriptDiagnosticToLanguageFileDiagnostic);
|
|
20
|
-
},
|
|
21
|
-
runVisitors(options, runtime) {
|
|
22
|
-
if (!runtime.visitors) return;
|
|
23
|
-
const { visitors } = runtime;
|
|
24
|
-
const fileServices = {
|
|
25
|
-
options,
|
|
26
|
-
program,
|
|
27
|
-
sourceFile,
|
|
28
|
-
typeChecker: program.getTypeChecker()
|
|
29
|
-
};
|
|
30
|
-
const visit = (node) => {
|
|
31
|
-
visitors[NodeSyntaxKinds[node.kind]]?.(node, fileServices);
|
|
32
|
-
node.forEachChild(visit);
|
|
33
|
-
};
|
|
34
|
-
visit(sourceFile);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { NodeSyntaxKinds, collectTypeScriptFileCacheImpacts, createTypeScriptFileFromProgram };
|
|
41
|
-
//# sourceMappingURL=createTypeScriptFileFromProgram.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type * as ts from "typescript";
|
|
2
|
-
import type * as AST from "./types/ast.ts";
|
|
3
|
-
export declare function createTypeScriptFileFromProjectService(filePathAbsolute: string, program: ts.Program, service: ts.server.ProjectService): {
|
|
4
|
-
program: ts.Program;
|
|
5
|
-
sourceFile: AST.SourceFile;
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=createTypeScriptFileFromProjectService.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/createTypeScriptFileFromProjectService.ts
|
|
2
|
-
function createTypeScriptFileFromProjectService(filePathAbsolute, program, service) {
|
|
3
|
-
const sourceFile = program.getSourceFile(filePathAbsolute);
|
|
4
|
-
if (!sourceFile) throw new Error(`Could not retrieve source file for: ${filePathAbsolute}`);
|
|
5
|
-
return {
|
|
6
|
-
program,
|
|
7
|
-
sourceFile,
|
|
8
|
-
[Symbol.dispose]() {
|
|
9
|
-
service.closeClientFile(filePathAbsolute);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { createTypeScriptFileFromProjectService };
|
|
16
|
-
//# sourceMappingURL=createTypeScriptFileFromProjectService.js.map
|
package/lib/lib/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "./convertTypeScriptDiagnosticToLanguageFileDiagnostic.js";
|
|
2
|
-
import "./types/ast.js";
|
|
3
|
-
import "./nodes.js";
|
|
4
|
-
import { Checker } from "./types/checker.js";
|
|
5
|
-
import "./language.js";
|
|
6
|
-
import "./createTypeScriptFileFromProgram.js";
|
|
7
|
-
import "./directives/parseDirectivesFromTypeScriptFile.js";
|
|
8
|
-
import "./getTSNodeRange.js";
|
|
9
|
-
import "./prepareTypeScriptBasedLanguage.js";
|
|
10
|
-
import "./utils/declarationIncludesGlobal.js";
|
|
11
|
-
import "./utils/getDeclarationsIfGlobal.js";
|
|
12
|
-
import "./utils/getModifyingReferences.js";
|
|
13
|
-
import "./utils/hasSameTokens.js";
|
|
14
|
-
import "./utils/isBuiltinArrayMethod.js";
|
|
15
|
-
import "./utils/isFunction.js";
|
|
16
|
-
import "./utils/isGlobalDeclaration.js";
|
|
17
|
-
import "./utils/isGlobalDeclarationOfName.js";
|
|
18
|
-
import "./utils/isGlobalVariable.js";
|
|
19
|
-
import "./utils/isInlineArrayCreation.js";
|
|
20
|
-
import "./utils/unwrapParenthesizedExpression.js";
|
|
21
|
-
import "./utils/unwrapParentParenthesizedExpressions.js";
|
package/lib/lib/language.d.ts
DELETED
package/lib/lib/nodes.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./types/ast.js";
|