diff --git a/lib/_tsc.js b/lib/_tsc.js index d06c7ff6caf..3bcdbf7ae59 100644 --- a/lib/_tsc.js +++ b/lib/_tsc.js @@ -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 = []; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 0ed1d1e839f..6780dd1ddb9 100644 --- a/lib/typescript.d.ts +++ b/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. */ diff --git a/lib/typescript.js b/lib/typescript.js index 366e30eeb7d..33387eadeb8 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -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) { diff --git a/package-lock.json b/package-lock.json index 08cd1112d54..009efa478a1 100644 --- a/package-lock.json +++ b/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", diff --git a/package.json b/package.json index 445f7c955bd..fbf62429c6c 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index c60bf994c56..7b82bca47e5 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -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.