This commit is contained in:
TypeScript Bot 2024-11-21 01:19:43 +00:00
Родитель 0503a630fd
Коммит d701d908d5
6 изменённых файлов: 22 добавлений и 59 удалений

Просмотреть файл

@ -18,7 +18,7 @@ and limitations under the License.
// src/compiler/corePublic.ts
var versionMajorMinor = "5.7";
var version = "5.7.1-rc";
var version = "5.7.2";
// src/compiler/core.ts
var emptyArray = [];

11
lib/typescript.d.ts поставляемый
Просмотреть файл

@ -123,7 +123,6 @@ declare namespace ts {
ProvideInlayHints = "provideInlayHints",
WatchChange = "watchChange",
MapCode = "mapCode",
CopilotRelated = "copilotRelated",
}
/**
* A TypeScript Server message
@ -1831,16 +1830,6 @@ declare namespace ts {
export interface MapCodeResponse extends Response {
body: readonly FileCodeEdits[];
}
export interface CopilotRelatedRequest extends FileRequest {
command: CommandTypes.CopilotRelated;
arguments: FileRequestArgs;
}
export interface CopilotRelatedItems {
relatedFiles: readonly string[];
}
export interface CopilotRelatedResponse extends Response {
body: CopilotRelatedItems;
}
/**
* Synchronous request for semantic diagnostics of one file.
*/

Просмотреть файл

@ -2278,7 +2278,7 @@ module.exports = __toCommonJS(typescript_exports);
// src/compiler/corePublic.ts
var versionMajorMinor = "5.7";
var version = "5.7.1-rc";
var version = "5.7.2";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@ -146430,23 +146430,22 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
for (const statement of toMove) {
forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
if (!symbol.declarations || isGlobalType(checker, symbol)) {
if (!symbol.declarations) {
return;
}
if (existingTargetLocals.has(skipAlias(symbol, checker))) {
unusedImportsFromOldFile.add(symbol);
return;
}
for (const decl of symbol.declarations) {
if (isInImport(decl)) {
const prevIsTypeOnly = oldImportsNeededByTargetFile.get(symbol);
oldImportsNeededByTargetFile.set(symbol, [
prevIsTypeOnly === void 0 ? isValidTypeOnlyUseSite : prevIsTypeOnly && isValidTypeOnlyUseSite,
tryCast(decl, (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration(d))
]);
} else if (isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile && !movedSymbols.has(symbol)) {
targetFileImportsFromOldFile.set(symbol, isValidTypeOnlyUseSite);
}
const importedDeclaration = find(symbol.declarations, isInImport);
if (importedDeclaration) {
const prevIsTypeOnly = oldImportsNeededByTargetFile.get(symbol);
oldImportsNeededByTargetFile.set(symbol, [
prevIsTypeOnly === void 0 ? isValidTypeOnlyUseSite : prevIsTypeOnly && isValidTypeOnlyUseSite,
tryCast(importedDeclaration, (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration(d))
]);
} else if (!movedSymbols.has(symbol) && every(symbol.declarations, (decl) => isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile)) {
targetFileImportsFromOldFile.set(symbol, isValidTypeOnlyUseSite);
}
});
}
@ -146480,16 +146479,6 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
return !!jsxNamespaceSymbol2 && some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0;
}
}
function isGlobalType(checker, symbol) {
return !!checker.resolveName(
symbol.name,
/*location*/
void 0,
788968 /* Type */,
/*excludeGlobals*/
false
);
}
function makeUniqueFilename(proposedFilename, extension, inDirectory, host) {
let newFilename = proposedFilename;
for (let i = 1; ; i++) {
@ -151312,8 +151301,7 @@ var invalidOperationsInPartialSemanticMode = [
"provideCallHierarchyOutgoingCalls",
"provideInlayHints",
"getSupportedCodeFixes",
"getPasteEdits",
"getImports"
"getPasteEdits"
];
var invalidOperationsInSyntacticMode = [
...invalidOperationsInPartialSemanticMode,
@ -152565,18 +152553,6 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
preferences
);
}
function getImports(fileName) {
var _a2, _b;
synchronizeHostData();
const file = getValidSourceFile(fileName);
let imports;
for (const specifier of file.imports) {
if (nodeIsSynthesized(specifier)) continue;
const name = (_b = (_a2 = program.getResolvedModuleFromModuleSpecifier(specifier, file)) == null ? void 0 : _a2.resolvedModule) == null ? void 0 : _b.resolvedFileName;
if (name) (imports ?? (imports = /* @__PURE__ */ new Set())).add(name);
}
return imports ? arrayFrom(imports) : emptyArray;
}
const ls = {
dispose,
cleanupSemanticCache,
@ -152650,8 +152626,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
getSupportedCodeFixes,
preparePasteEditsForFile,
getPasteEdits,
mapCode: mapCode2,
getImports
mapCode: mapCode2
};
switch (languageServiceMode) {
case 0 /* Semantic */:
@ -193108,8 +193083,8 @@ var Session3 = class _Session {
["mapCode" /* MapCode */]: (request) => {
return this.requiredResponse(this.mapCode(request.arguments));
},
["copilotRelated" /* CopilotRelated */]: (request) => {
return this.requiredResponse(this.getCopilotRelatedInfo(request.arguments));
["copilotRelated" /* CopilotRelated */]: () => {
return this.requiredResponse(this.getCopilotRelatedInfo());
}
}));
this.host = opts.host;
@ -194057,10 +194032,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
const changes = languageService.mapCode(file, args.mapping.contents, focusLocations, formatOptions, preferences);
return this.mapTextChangesToCodeEdits(changes);
}
getCopilotRelatedInfo(args) {
const { file, project } = this.getFileAndProject(args);
getCopilotRelatedInfo() {
return {
relatedFiles: project.getLanguageService().getImports(file)
relatedFiles: []
};
}
setCompilerOptionsForInferredProjects(args) {

4
package-lock.json сгенерированный
Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "typescript",
"version": "5.7.1-rc",
"version": "5.7.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "typescript",
"version": "5.7.1-rc",
"version": "5.7.2",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",

Просмотреть файл

@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "5.7.1-rc",
"version": "5.7.2",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [

Просмотреть файл

@ -3,7 +3,7 @@
export const versionMajorMinor = "5.7";
// The following is baselined as a literal template type without intervention
/** The version of the TypeScript compiler release */
export const version = "5.7.1-rc" as string;
export const version = "5.7.2" as string;
/**
* Type of objects whose values are all of the same type.