@flint.fyi/typescript-language 0.18.2 → 0.18.4
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/lib/collectReferencedFilePaths.d.ts +0 -1
- package/lib/collectReferencedFilePaths.js +1 -3
- package/lib/convertTypeScriptDiagnosticToLanguageReport.d.ts +2 -3
- package/lib/convertTypeScriptDiagnosticToLanguageReport.js +3 -4
- package/lib/createTypeScriptServerHost.d.ts +1 -2
- package/lib/createTypeScriptServerHost.js +1 -3
- package/lib/directives/parseDirectivesFromTypeScriptFile.d.ts +1 -2
- package/lib/directives/parseDirectivesFromTypeScriptFile.js +2 -4
- package/lib/getFirstEnumValues.d.ts +0 -1
- package/lib/getFirstEnumValues.js +0 -2
- package/lib/getTSNodeRange.d.ts +2 -3
- package/lib/getTSNodeRange.js +0 -2
- package/lib/getTypeScriptFileCacheImpacts.d.ts +0 -1
- package/lib/getTypeScriptFileCacheImpacts.js +5 -3
- package/lib/index.d.ts +8 -3
- package/lib/index.js +5 -1
- package/lib/language.d.ts +393 -201
- package/lib/language.js +2 -4
- package/lib/nodes.d.ts +1 -2
- package/lib/normalizeRange.d.ts +0 -1
- package/lib/normalizeRange.js +0 -2
- package/lib/orderTypeScriptFilePaths.d.ts +0 -1
- package/lib/orderTypeScriptFilePaths.js +0 -2
- package/lib/package.js +1 -3
- package/lib/scope/identifierReferences.d.ts +3 -0
- package/lib/scope/identifierReferences.js +89 -0
- package/lib/scope/scopeManager.d.ts +14 -0
- package/lib/scope/scopeManager.js +153 -0
- package/lib/scope/scopes.d.ts +7 -0
- package/lib/scope/scopes.js +64 -0
- package/lib/scope/types.d.ts +45 -0
- package/lib/types/ast.d.ts +2 -2
- package/lib/types/checker.d.ts +1 -2
- package/lib/utils/containsGlobalDeclarations.d.ts +6 -0
- package/lib/utils/containsGlobalDeclarations.js +17 -0
- package/lib/utils/createRuleTesterTSConfig.d.ts +1 -2
- package/lib/utils/createRuleTesterTSConfig.js +0 -2
- package/lib/utils/declarationIncludesGlobal.d.ts +1 -2
- package/lib/utils/declarationIncludesGlobal.js +0 -2
- package/lib/utils/declarationsIncludeGlobal.d.ts +0 -1
- package/lib/utils/declarationsIncludeGlobal.js +0 -2
- package/lib/utils/forEachChild.d.ts +7 -0
- package/lib/utils/forEachChild.js +5 -0
- package/lib/utils/getDeclarationsIfGlobal.d.ts +2 -5
- package/lib/utils/getDeclarationsIfGlobal.js +0 -2
- package/lib/utils/getModifyingReferences.d.ts +2 -7
- package/lib/utils/getModifyingReferences.js +5 -27
- package/lib/utils/hasSameTokens.d.ts +1 -2
- package/lib/utils/hasSameTokens.js +0 -2
- package/lib/utils/isBuiltinArrayMethod.d.ts +1 -2
- package/lib/utils/isBuiltinArrayMethod.js +0 -2
- package/lib/utils/isFunction.d.ts +1 -2
- package/lib/utils/isFunction.js +0 -2
- package/lib/utils/isGlobalDeclaration.d.ts +1 -2
- package/lib/utils/isGlobalDeclaration.js +0 -2
- package/lib/utils/isGlobalDeclarationOfName.d.ts +1 -2
- package/lib/utils/isGlobalDeclarationOfName.js +0 -2
- package/lib/utils/isGlobalVariable.d.ts +1 -2
- package/lib/utils/isGlobalVariable.js +0 -2
- package/lib/utils/isInlineArrayCreation.d.ts +1 -2
- package/lib/utils/isInlineArrayCreation.js +0 -2
- package/lib/utils/isStaticString.d.ts +5 -0
- package/lib/utils/isStaticString.js +7 -0
- package/lib/utils/isStringRawNoSubstitution.d.ts +7 -0
- package/lib/utils/isStringRawNoSubstitution.js +9 -0
- package/lib/utils/unwrapParentParenthesizedExpressions.d.ts +1 -2
- package/lib/utils/unwrapParentParenthesizedExpressions.js +0 -2
- package/lib/utils/unwrapParenthesizedNode.d.ts +1 -2
- package/lib/utils/unwrapParenthesizedNode.js +0 -2
- package/package.json +5 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { nullThrows } from "@flint.fyi/utils";
|
|
3
2
|
import * as tsutils from "ts-api-utils";
|
|
3
|
+
import { nullThrows } from "@flint.fyi/utils";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
//#region src/collectReferencedFilePaths.ts
|
|
6
6
|
function collectReferencedFilePaths(program, sourceFile) {
|
|
@@ -36,5 +36,3 @@ function isImportTypeNode(node) {
|
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
38
|
export { collectReferencedFilePaths };
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=collectReferencedFilePaths.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LanguageReport, SourceFileWithLineMapAndFileName } from "@flint.fyi/core";
|
|
2
1
|
import ts from "typescript";
|
|
2
|
+
import { LanguageReport, SourceFileWithLineMapAndFileName } from "@flint.fyi/core";
|
|
3
3
|
|
|
4
4
|
//#region src/convertTypeScriptDiagnosticToLanguageReport.d.ts
|
|
5
5
|
interface TSDiagnostic extends TSDiagnosticRelatedInformation {
|
|
@@ -14,5 +14,4 @@ interface TSDiagnosticRelatedInformation {
|
|
|
14
14
|
}
|
|
15
15
|
declare function convertTypeScriptDiagnosticToLanguageReport(diagnostic: TSDiagnostic): LanguageReport;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { convertTypeScriptDiagnosticToLanguageReport };
|
|
18
|
-
//# sourceMappingURL=convertTypeScriptDiagnosticToLanguageReport.d.ts.map
|
|
17
|
+
export { TSDiagnostic, convertTypeScriptDiagnosticToLanguageReport };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { getColumnAndLineOfPosition, getPositionOfColumnAndLine } from "@flint.fyi/core";
|
|
2
1
|
import ts from "typescript";
|
|
2
|
+
import { getColumnAndLineOfPosition, getPositionOfColumnAndLine } from "@flint.fyi/core";
|
|
3
3
|
//#region src/convertTypeScriptDiagnosticToLanguageReport.ts
|
|
4
4
|
function convertTypeScriptDiagnosticToLanguageReport(diagnostic) {
|
|
5
5
|
return {
|
|
6
6
|
code: `TS${diagnostic.code}`,
|
|
7
|
+
source: "typescript",
|
|
7
8
|
text: formatReport(diagnostic),
|
|
8
9
|
...diagnostic.file !== void 0 && diagnostic.start !== void 0 && { range: {
|
|
9
10
|
begin: diagnostic.start,
|
|
@@ -68,7 +69,7 @@ function formatCodeSpan(file, start, length, indent, squiggleColor) {
|
|
|
68
69
|
for (let i = firstLine; i <= lastLine; i++) {
|
|
69
70
|
context += "\n";
|
|
70
71
|
if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
|
|
71
|
-
context += indent + color(ellipsis.padStart(gutterWidth), gutterStyleSequence) +
|
|
72
|
+
context += indent + color(ellipsis.padStart(gutterWidth), gutterStyleSequence) + " \n";
|
|
72
73
|
i = lastLine - 1;
|
|
73
74
|
}
|
|
74
75
|
const lineStart = getPositionOfColumnAndLine(file, {
|
|
@@ -109,5 +110,3 @@ function formatLocation(file, start) {
|
|
|
109
110
|
}
|
|
110
111
|
//#endregion
|
|
111
112
|
export { convertTypeScriptDiagnosticToLanguageReport };
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=convertTypeScriptDiagnosticToLanguageReport.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type LinterHost } from "@flint.fyi/core";
|
|
2
1
|
import ts from "typescript";
|
|
2
|
+
import { type LinterHost } from "@flint.fyi/core";
|
|
3
3
|
export declare function createTypeScriptServerHost(host: LinterHost): ts.server.ServerHost;
|
|
4
|
-
//# sourceMappingURL=createTypeScriptServerHost.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { commonlyIgnoredPaths } from "@flint.fyi/core";
|
|
2
1
|
import ts from "typescript";
|
|
2
|
+
import { commonlyIgnoredPaths } from "@flint.fyi/core";
|
|
3
3
|
import { FlintAssertionError, assert } from "@flint.fyi/utils";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import timers from "node:timers";
|
|
@@ -99,5 +99,3 @@ function createTypeScriptServerHost(host) {
|
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
101
|
export { createTypeScriptServerHost };
|
|
102
|
-
|
|
103
|
-
//# sourceMappingURL=createTypeScriptServerHost.js.map
|
|
@@ -9,5 +9,4 @@ interface ExtractedDirective {
|
|
|
9
9
|
}
|
|
10
10
|
declare function extractDirectivesFromTypeScriptFile(sourceFile: SourceFile): ExtractedDirective[];
|
|
11
11
|
//#endregion
|
|
12
|
-
export { ExtractedDirective, extractDirectivesFromTypeScriptFile };
|
|
13
|
-
//# sourceMappingURL=parseDirectivesFromTypeScriptFile.d.ts.map
|
|
12
|
+
export { ExtractedDirective, extractDirectivesFromTypeScriptFile };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeRange } from "../normalizeRange.js";
|
|
2
|
-
import { DirectivesCollector } from "@flint.fyi/core";
|
|
3
2
|
import ts from "typescript";
|
|
4
|
-
import {
|
|
3
|
+
import { DirectivesCollector } from "@flint.fyi/core";
|
|
5
4
|
import * as tsutils from "ts-api-utils";
|
|
5
|
+
import { nullThrows } from "@flint.fyi/utils";
|
|
6
6
|
//#region src/directives/parseDirectivesFromTypeScriptFile.ts
|
|
7
7
|
function extractDirectivesFromTypeScriptFile(sourceFile) {
|
|
8
8
|
const directives = [];
|
|
@@ -62,5 +62,3 @@ function extendRangeToNextCodeLine(sourceFile, range) {
|
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
64
|
export { extractDirectivesFromTypeScriptFile, parseDirectivesFromTypeScriptFile };
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=parseDirectivesFromTypeScriptFile.js.map
|
package/lib/getTSNodeRange.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SourceFile } from "./types/ast.js";
|
|
2
|
-
import { CharacterReportRange } from "@flint.fyi/core";
|
|
3
2
|
import * as ts$1 from "typescript";
|
|
3
|
+
import { CharacterReportRange } from "@flint.fyi/core";
|
|
4
4
|
|
|
5
5
|
//#region src/getTSNodeRange.d.ts
|
|
6
6
|
declare function getTSNodeRange(node: ts$1.Node, sourceFile: SourceFile): CharacterReportRange;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { getTSNodeRange };
|
|
9
|
-
//# sourceMappingURL=getTSNodeRange.d.ts.map
|
|
8
|
+
export { getTSNodeRange };
|
package/lib/getTSNodeRange.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { LanguageFile, LanguageFileCacheImpacts } from "@flint.fyi/core";
|
|
2
2
|
import type { TypeScriptFileServices } from "./language.ts";
|
|
3
3
|
export declare function getTypeScriptFileCacheImpacts(file: LanguageFile<TypeScriptFileServices>): LanguageFileCacheImpacts;
|
|
4
|
-
//# sourceMappingURL=getTypeScriptFileCacheImpacts.d.ts.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { collectReferencedFilePaths } from "./collectReferencedFilePaths.js";
|
|
2
|
+
import { containsGlobalDeclarations } from "./utils/containsGlobalDeclarations.js";
|
|
2
3
|
//#region src/getTypeScriptFileCacheImpacts.ts
|
|
3
4
|
function getTypeScriptFileCacheImpacts(file) {
|
|
4
|
-
return {
|
|
5
|
+
return {
|
|
6
|
+
dependencies: ["tsconfig.json", ...collectReferencedFilePaths(file.services.program, file.services.sourceFile)],
|
|
7
|
+
invalidatesCache: containsGlobalDeclarations(file.services.sourceFile)
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
10
|
//#endregion
|
|
7
11
|
export { getTypeScriptFileCacheImpacts };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=getTypeScriptFileCacheImpacts.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { convertTypeScriptDiagnosticToLanguageReport } from "./convertTypeScriptDiagnosticToLanguageReport.js";
|
|
1
|
+
import { TSDiagnostic, convertTypeScriptDiagnosticToLanguageReport } from "./convertTypeScriptDiagnosticToLanguageReport.js";
|
|
2
2
|
import { ast_d_exports } from "./types/ast.js";
|
|
3
3
|
import { ExtractedDirective, extractDirectivesFromTypeScriptFile } from "./directives/parseDirectivesFromTypeScriptFile.js";
|
|
4
4
|
import { getTSNodeRange } from "./getTSNodeRange.js";
|
|
5
5
|
import { TypeScriptNodeVisitors, TypeScriptNodesByName } from "./nodes.js";
|
|
6
6
|
import { Checker } from "./types/checker.js";
|
|
7
7
|
import { NodeSyntaxKinds, TypeScriptFileServices, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage } from "./language.js";
|
|
8
|
+
import { FunctionWithParameters, Scope, ScopeDefinition, ScopeDefinitionKind, ScopeManager, ScopeReference, ScopeVariable } from "./scope/types.js";
|
|
9
|
+
import { createScopeManager, getScopeManager } from "./scope/scopeManager.js";
|
|
8
10
|
import { createRuleTesterTSConfig } from "./utils/createRuleTesterTSConfig.js";
|
|
9
11
|
import { declarationIncludesGlobal } from "./utils/declarationIncludesGlobal.js";
|
|
12
|
+
import { forEachChild } from "./utils/forEachChild.js";
|
|
10
13
|
import { getDeclarationsIfGlobal } from "./utils/getDeclarationsIfGlobal.js";
|
|
11
14
|
import { getModifyingReferences } from "./utils/getModifyingReferences.js";
|
|
12
15
|
import { hasSameTokens } from "./utils/hasSameTokens.js";
|
|
13
|
-
import { isBuiltinArrayMethod } from "./utils/isBuiltinArrayMethod.js";
|
|
16
|
+
import { BuiltInArrayMethodNode, isBuiltinArrayMethod } from "./utils/isBuiltinArrayMethod.js";
|
|
14
17
|
import { isFunction } from "./utils/isFunction.js";
|
|
15
18
|
import { isGlobalDeclaration } from "./utils/isGlobalDeclaration.js";
|
|
16
19
|
import { isGlobalDeclarationOfName } from "./utils/isGlobalDeclarationOfName.js";
|
|
17
20
|
import { isGlobalVariable } from "./utils/isGlobalVariable.js";
|
|
18
21
|
import { isInlineArrayCreation } from "./utils/isInlineArrayCreation.js";
|
|
22
|
+
import { isStaticString } from "./utils/isStaticString.js";
|
|
23
|
+
import { isStringRawNoSubstitution } from "./utils/isStringRawNoSubstitution.js";
|
|
19
24
|
import { unwrapParenthesizedNode } from "./utils/unwrapParenthesizedNode.js";
|
|
20
25
|
import { unwrapParentParenthesizedExpressions } from "./utils/unwrapParentParenthesizedExpressions.js";
|
|
21
|
-
export { type ast_d_exports as AST, type Checker, type ExtractedDirective, NodeSyntaxKinds, TypeScriptFileServices, TypeScriptNodeVisitors, type TypeScriptNodesByName, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, getDeclarationsIfGlobal, getModifyingReferences, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
|
|
26
|
+
export { type ast_d_exports as AST, type BuiltInArrayMethodNode, type Checker, type ExtractedDirective, type FunctionWithParameters, NodeSyntaxKinds, type Scope, type ScopeDefinition, type ScopeDefinitionKind, type ScopeManager, type ScopeReference, type ScopeVariable, type TSDiagnostic, type TypeScriptFileServices, type TypeScriptNodeVisitors, type TypeScriptNodesByName, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, createScopeManager, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, forEachChild, getDeclarationsIfGlobal, getModifyingReferences, getScopeManager, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, isStaticString, isStringRawNoSubstitution, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { convertTypeScriptDiagnosticToLanguageReport } from "./convertTypeScript
|
|
|
2
2
|
import { extractDirectivesFromTypeScriptFile } from "./directives/parseDirectivesFromTypeScriptFile.js";
|
|
3
3
|
import { getTSNodeRange } from "./getTSNodeRange.js";
|
|
4
4
|
import { NodeSyntaxKinds, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage } from "./language.js";
|
|
5
|
+
import { forEachChild } from "./utils/forEachChild.js";
|
|
6
|
+
import { createScopeManager, getScopeManager } from "./scope/scopeManager.js";
|
|
5
7
|
import { createRuleTesterTSConfig } from "./utils/createRuleTesterTSConfig.js";
|
|
6
8
|
import { declarationIncludesGlobal } from "./utils/declarationIncludesGlobal.js";
|
|
7
9
|
import { getDeclarationsIfGlobal } from "./utils/getDeclarationsIfGlobal.js";
|
|
@@ -14,5 +16,7 @@ import { isGlobalDeclaration } from "./utils/isGlobalDeclaration.js";
|
|
|
14
16
|
import { isGlobalDeclarationOfName } from "./utils/isGlobalDeclarationOfName.js";
|
|
15
17
|
import { isGlobalVariable } from "./utils/isGlobalVariable.js";
|
|
16
18
|
import { isInlineArrayCreation } from "./utils/isInlineArrayCreation.js";
|
|
19
|
+
import { isStaticString } from "./utils/isStaticString.js";
|
|
20
|
+
import { isStringRawNoSubstitution } from "./utils/isStringRawNoSubstitution.js";
|
|
17
21
|
import { unwrapParentParenthesizedExpressions } from "./utils/unwrapParentParenthesizedExpressions.js";
|
|
18
|
-
export { NodeSyntaxKinds, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, getDeclarationsIfGlobal, getModifyingReferences, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
|
|
22
|
+
export { NodeSyntaxKinds, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, createScopeManager, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, forEachChild, getDeclarationsIfGlobal, getModifyingReferences, getScopeManager, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, isStaticString, isStringRawNoSubstitution, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
|