mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-22 22:40:30 +00:00
!473 [ArkTS Linter] Revert linter cache funtion change
Merge pull request !473 from ironrain/work_0908_None_revertCache
This commit is contained in:
commit
7fc46f4a69
@ -196529,7 +196529,7 @@ var ts;
|
||||
function srcFilePathContainsDirectory(srcFile, dir) {
|
||||
var pathComps = srcFilePathComponents.get(srcFile);
|
||||
if (!pathComps) {
|
||||
pathComps = ts.getPathComponents(Utils.normalizePath(srcFile.fileName));
|
||||
pathComps = ts.getPathComponents(ts.normalizePath(srcFile.fileName));
|
||||
srcFilePathComponents.set(srcFile, pathComps);
|
||||
}
|
||||
for (var _i = 0, pathComps_1 = pathComps; _i < pathComps_1.length; _i++) {
|
||||
@ -197300,23 +197300,9 @@ var ts;
|
||||
return exportDeclSet;
|
||||
}
|
||||
Utils.searchFileExportDecl = searchFileExportDecl;
|
||||
var normalizedPathCache = new ts.Map();
|
||||
function normalizePath(path) {
|
||||
normalizedPathCache = normalizedPathCache ? normalizedPathCache : new ts.Map();
|
||||
var cached = normalizedPathCache.get(path);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
var normalized = ts.normalizePath(path);
|
||||
normalizedPathCache.set(path, normalized);
|
||||
return normalized;
|
||||
}
|
||||
Utils.normalizePath = normalizePath;
|
||||
function clearUtilsGlobalvariables() {
|
||||
parentSymbolCache === null || parentSymbolCache === void 0 ? void 0 : parentSymbolCache.clear();
|
||||
parentSymbolCache = undefined;
|
||||
normalizedPathCache === null || normalizedPathCache === void 0 ? void 0 : normalizedPathCache.clear();
|
||||
normalizedPathCache = undefined;
|
||||
}
|
||||
Utils.clearUtilsGlobalvariables = clearUtilsGlobalvariables;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
@ -200608,15 +200594,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.setTypeChecker(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker);
|
||||
linter.lint();
|
||||
// Get list of bad nodes from the current run.
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ts.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
ArkTSLinter_1_1.TypeScriptLinter.problemsInfos.forEach(function (x) { return currentDiagnostics.push(translateDiag(fileToLint, x)); });
|
||||
}
|
||||
else {
|
||||
ArkTSLinter_1_1.InteropTypescriptLinter.initStatic();
|
||||
var isKit = ts.getBaseFileName(fileToLint.fileName).indexOf('@kit.') === 0;
|
||||
var etsLoaderPath = program.getCompilerOptions().etsLoaderPath;
|
||||
var isInSdk = etsLoaderPath ?
|
||||
ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInSdk = etsLoaderPath ? ts.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInOhModules = ts.isOHModules(fileToLint.fileName);
|
||||
var tsImportSendableEnable = program.getCompilerOptions().tsImportSendableEnable;
|
||||
if (isKit || isInOhModules || (!tsImportSendableEnable && !isInSdk)) {
|
||||
|
1
lib/tsserverlibrary.d.ts
vendored
1
lib/tsserverlibrary.d.ts
vendored
@ -13459,7 +13459,6 @@ declare namespace ts {
|
||||
function isNonSendableFunctionTypeAlias(type: ts.Type): boolean;
|
||||
function isWrongSendableFunctionAssignment(lhsType: ts.Type, rhsType: ts.Type): boolean;
|
||||
function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts.SyntaxKind[]): Set<ts.Node>;
|
||||
function normalizePath(path: string): string;
|
||||
function clearUtilsGlobalvariables(): void;
|
||||
}
|
||||
}
|
||||
|
@ -196274,7 +196274,7 @@ var ts;
|
||||
function srcFilePathContainsDirectory(srcFile, dir) {
|
||||
var pathComps = srcFilePathComponents.get(srcFile);
|
||||
if (!pathComps) {
|
||||
pathComps = ts.getPathComponents(Utils.normalizePath(srcFile.fileName));
|
||||
pathComps = ts.getPathComponents(ts.normalizePath(srcFile.fileName));
|
||||
srcFilePathComponents.set(srcFile, pathComps);
|
||||
}
|
||||
for (var _i = 0, pathComps_1 = pathComps; _i < pathComps_1.length; _i++) {
|
||||
@ -197045,23 +197045,9 @@ var ts;
|
||||
return exportDeclSet;
|
||||
}
|
||||
Utils.searchFileExportDecl = searchFileExportDecl;
|
||||
var normalizedPathCache = new ts.Map();
|
||||
function normalizePath(path) {
|
||||
normalizedPathCache = normalizedPathCache ? normalizedPathCache : new ts.Map();
|
||||
var cached = normalizedPathCache.get(path);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
var normalized = ts.normalizePath(path);
|
||||
normalizedPathCache.set(path, normalized);
|
||||
return normalized;
|
||||
}
|
||||
Utils.normalizePath = normalizePath;
|
||||
function clearUtilsGlobalvariables() {
|
||||
parentSymbolCache === null || parentSymbolCache === void 0 ? void 0 : parentSymbolCache.clear();
|
||||
parentSymbolCache = undefined;
|
||||
normalizedPathCache === null || normalizedPathCache === void 0 ? void 0 : normalizedPathCache.clear();
|
||||
normalizedPathCache = undefined;
|
||||
}
|
||||
Utils.clearUtilsGlobalvariables = clearUtilsGlobalvariables;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
@ -200353,15 +200339,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.setTypeChecker(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker);
|
||||
linter.lint();
|
||||
// Get list of bad nodes from the current run.
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ts.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
ArkTSLinter_1_1.TypeScriptLinter.problemsInfos.forEach(function (x) { return currentDiagnostics.push(translateDiag(fileToLint, x)); });
|
||||
}
|
||||
else {
|
||||
ArkTSLinter_1_1.InteropTypescriptLinter.initStatic();
|
||||
var isKit = ts.getBaseFileName(fileToLint.fileName).indexOf('@kit.') === 0;
|
||||
var etsLoaderPath = program.getCompilerOptions().etsLoaderPath;
|
||||
var isInSdk = etsLoaderPath ?
|
||||
ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInSdk = etsLoaderPath ? ts.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInOhModules = ts.isOHModules(fileToLint.fileName);
|
||||
var tsImportSendableEnable = program.getCompilerOptions().tsImportSendableEnable;
|
||||
if (isKit || isInOhModules || (!tsImportSendableEnable && !isInSdk)) {
|
||||
|
1
lib/typescript.d.ts
vendored
1
lib/typescript.d.ts
vendored
@ -9513,7 +9513,6 @@ declare namespace ts {
|
||||
function isNonSendableFunctionTypeAlias(type: ts.Type): boolean;
|
||||
function isWrongSendableFunctionAssignment(lhsType: ts.Type, rhsType: ts.Type): boolean;
|
||||
function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts.SyntaxKind[]): Set<ts.Node>;
|
||||
function normalizePath(path: string): string;
|
||||
function clearUtilsGlobalvariables(): void;
|
||||
}
|
||||
}
|
||||
|
@ -185368,7 +185368,7 @@ var ts;
|
||||
function srcFilePathContainsDirectory(srcFile, dir) {
|
||||
var pathComps = srcFilePathComponents.get(srcFile);
|
||||
if (!pathComps) {
|
||||
pathComps = ts.getPathComponents(Utils.normalizePath(srcFile.fileName));
|
||||
pathComps = ts.getPathComponents(ts.normalizePath(srcFile.fileName));
|
||||
srcFilePathComponents.set(srcFile, pathComps);
|
||||
}
|
||||
for (var _i = 0, pathComps_1 = pathComps; _i < pathComps_1.length; _i++) {
|
||||
@ -186139,23 +186139,9 @@ var ts;
|
||||
return exportDeclSet;
|
||||
}
|
||||
Utils.searchFileExportDecl = searchFileExportDecl;
|
||||
var normalizedPathCache = new ts.Map();
|
||||
function normalizePath(path) {
|
||||
normalizedPathCache = normalizedPathCache ? normalizedPathCache : new ts.Map();
|
||||
var cached = normalizedPathCache.get(path);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
var normalized = ts.normalizePath(path);
|
||||
normalizedPathCache.set(path, normalized);
|
||||
return normalized;
|
||||
}
|
||||
Utils.normalizePath = normalizePath;
|
||||
function clearUtilsGlobalvariables() {
|
||||
parentSymbolCache === null || parentSymbolCache === void 0 ? void 0 : parentSymbolCache.clear();
|
||||
parentSymbolCache = undefined;
|
||||
normalizedPathCache === null || normalizedPathCache === void 0 ? void 0 : normalizedPathCache.clear();
|
||||
normalizedPathCache = undefined;
|
||||
}
|
||||
Utils.clearUtilsGlobalvariables = clearUtilsGlobalvariables;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
@ -189447,15 +189433,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.setTypeChecker(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker);
|
||||
linter.lint();
|
||||
// Get list of bad nodes from the current run.
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ts.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
ArkTSLinter_1_1.TypeScriptLinter.problemsInfos.forEach(function (x) { return currentDiagnostics.push(translateDiag(fileToLint, x)); });
|
||||
}
|
||||
else {
|
||||
ArkTSLinter_1_1.InteropTypescriptLinter.initStatic();
|
||||
var isKit = ts.getBaseFileName(fileToLint.fileName).indexOf('@kit.') === 0;
|
||||
var etsLoaderPath = program.getCompilerOptions().etsLoaderPath;
|
||||
var isInSdk = etsLoaderPath ?
|
||||
ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInSdk = etsLoaderPath ? ts.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInOhModules = ts.isOHModules(fileToLint.fileName);
|
||||
var tsImportSendableEnable = program.getCompilerOptions().tsImportSendableEnable;
|
||||
if (isKit || isInOhModules || (!tsImportSendableEnable && !isInSdk)) {
|
||||
|
1
lib/typescriptServices.d.ts
vendored
1
lib/typescriptServices.d.ts
vendored
@ -9513,7 +9513,6 @@ declare namespace ts {
|
||||
function isNonSendableFunctionTypeAlias(type: ts.Type): boolean;
|
||||
function isWrongSendableFunctionAssignment(lhsType: ts.Type, rhsType: ts.Type): boolean;
|
||||
function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts.SyntaxKind[]): Set<ts.Node>;
|
||||
function normalizePath(path: string): string;
|
||||
function clearUtilsGlobalvariables(): void;
|
||||
}
|
||||
}
|
||||
|
@ -185368,7 +185368,7 @@ var ts;
|
||||
function srcFilePathContainsDirectory(srcFile, dir) {
|
||||
var pathComps = srcFilePathComponents.get(srcFile);
|
||||
if (!pathComps) {
|
||||
pathComps = ts.getPathComponents(Utils.normalizePath(srcFile.fileName));
|
||||
pathComps = ts.getPathComponents(ts.normalizePath(srcFile.fileName));
|
||||
srcFilePathComponents.set(srcFile, pathComps);
|
||||
}
|
||||
for (var _i = 0, pathComps_1 = pathComps; _i < pathComps_1.length; _i++) {
|
||||
@ -186139,23 +186139,9 @@ var ts;
|
||||
return exportDeclSet;
|
||||
}
|
||||
Utils.searchFileExportDecl = searchFileExportDecl;
|
||||
var normalizedPathCache = new ts.Map();
|
||||
function normalizePath(path) {
|
||||
normalizedPathCache = normalizedPathCache ? normalizedPathCache : new ts.Map();
|
||||
var cached = normalizedPathCache.get(path);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
var normalized = ts.normalizePath(path);
|
||||
normalizedPathCache.set(path, normalized);
|
||||
return normalized;
|
||||
}
|
||||
Utils.normalizePath = normalizePath;
|
||||
function clearUtilsGlobalvariables() {
|
||||
parentSymbolCache === null || parentSymbolCache === void 0 ? void 0 : parentSymbolCache.clear();
|
||||
parentSymbolCache = undefined;
|
||||
normalizedPathCache === null || normalizedPathCache === void 0 ? void 0 : normalizedPathCache.clear();
|
||||
normalizedPathCache = undefined;
|
||||
}
|
||||
Utils.clearUtilsGlobalvariables = clearUtilsGlobalvariables;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
@ -189447,15 +189433,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.setTypeChecker(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker);
|
||||
linter.lint();
|
||||
// Get list of bad nodes from the current run.
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
currentDiagnostics = (_a = tscStrictDiagnostics.get(ts.normalizePath(fileToLint.fileName))) !== null && _a !== void 0 ? _a : [];
|
||||
ArkTSLinter_1_1.TypeScriptLinter.problemsInfos.forEach(function (x) { return currentDiagnostics.push(translateDiag(fileToLint, x)); });
|
||||
}
|
||||
else {
|
||||
ArkTSLinter_1_1.InteropTypescriptLinter.initStatic();
|
||||
var isKit = ts.getBaseFileName(fileToLint.fileName).indexOf('@kit.') === 0;
|
||||
var etsLoaderPath = program.getCompilerOptions().etsLoaderPath;
|
||||
var isInSdk = etsLoaderPath ?
|
||||
ArkTSLinter_1_1.Utils.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInSdk = etsLoaderPath ? ts.normalizePath(fileToLint.fileName).indexOf(ts.resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
var isInOhModules = ts.isOHModules(fileToLint.fileName);
|
||||
var tsImportSendableEnable = program.getCompilerOptions().tsImportSendableEnable;
|
||||
if (isKit || isInOhModules || (!tsImportSendableEnable && !isInSdk)) {
|
||||
|
@ -94,14 +94,13 @@ export function runArkTSLinter(tsBuilderProgram: BuilderProgram, srcFile?: Sourc
|
||||
linter.lint();
|
||||
|
||||
// Get list of bad nodes from the current run.
|
||||
currentDiagnostics = tscStrictDiagnostics.get(Utils.normalizePath(fileToLint.fileName)) ?? [];
|
||||
currentDiagnostics = tscStrictDiagnostics.get(normalizePath(fileToLint.fileName)) ?? [];
|
||||
TypeScriptLinter.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag(fileToLint, x)));
|
||||
} else {
|
||||
InteropTypescriptLinter.initStatic();
|
||||
const isKit = ts.getBaseFileName(fileToLint.fileName).indexOf('@kit.') === 0;
|
||||
const etsLoaderPath = program.getCompilerOptions().etsLoaderPath;
|
||||
const isInSdk = etsLoaderPath ?
|
||||
Utils.normalizePath(fileToLint.fileName).indexOf(resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
const isInSdk = etsLoaderPath ? normalizePath(fileToLint.fileName).indexOf(resolvePath(etsLoaderPath, '../..')) === 0 : false;
|
||||
const isInOhModules = isOHModules(fileToLint.fileName);
|
||||
const tsImportSendableEnable = program.getCompilerOptions().tsImportSendableEnable;
|
||||
if (isKit || isInOhModules || (!tsImportSendableEnable && !isInSdk)) {
|
||||
|
@ -1534,7 +1534,7 @@ const srcFilePathComponents = new Map<SourceFile, string[]>();
|
||||
export function srcFilePathContainsDirectory(srcFile: SourceFile, dir: string): boolean {
|
||||
let pathComps = srcFilePathComponents.get(srcFile);
|
||||
if (!pathComps) {
|
||||
pathComps = getPathComponents(Utils.normalizePath(srcFile.fileName));
|
||||
pathComps = getPathComponents(normalizePath(srcFile.fileName));
|
||||
srcFilePathComponents.set(srcFile, pathComps);
|
||||
}
|
||||
for (const subdir of pathComps) {
|
||||
@ -2355,23 +2355,9 @@ export function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts
|
||||
return exportDeclSet;
|
||||
}
|
||||
|
||||
let normalizedPathCache: ESMap<string, string> | undefined = new Map<string, string>();
|
||||
export function normalizePath(path: string): string {
|
||||
normalizedPathCache = normalizedPathCache ? normalizedPathCache : new Map<string, string>();
|
||||
const cached = normalizedPathCache.get(path);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const normalized = ts.normalizePath(path);
|
||||
normalizedPathCache.set(path, normalized);
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function clearUtilsGlobalvariables(): void {
|
||||
parentSymbolCache?.clear();
|
||||
parentSymbolCache = undefined;
|
||||
normalizedPathCache?.clear();
|
||||
normalizedPathCache = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13459,7 +13459,6 @@ declare namespace ts {
|
||||
function isNonSendableFunctionTypeAlias(type: ts.Type): boolean;
|
||||
function isWrongSendableFunctionAssignment(lhsType: ts.Type, rhsType: ts.Type): boolean;
|
||||
function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts.SyntaxKind[]): Set<ts.Node>;
|
||||
function normalizePath(path: string): string;
|
||||
function clearUtilsGlobalvariables(): void;
|
||||
}
|
||||
}
|
||||
|
@ -9513,7 +9513,6 @@ declare namespace ts {
|
||||
function isNonSendableFunctionTypeAlias(type: ts.Type): boolean;
|
||||
function isWrongSendableFunctionAssignment(lhsType: ts.Type, rhsType: ts.Type): boolean;
|
||||
function searchFileExportDecl(sourceFile: ts.SourceFile, targetDecls?: ts.SyntaxKind[]): Set<ts.Node>;
|
||||
function normalizePath(path: string): string;
|
||||
function clearUtilsGlobalvariables(): void;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user