Skip to content

Commit

Permalink
Merge pull request #594 from microsoft/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Sep 18, 2024
2 parents f18e798 + 49ad1a3 commit 387d9c6
Show file tree
Hide file tree
Showing 1,384 changed files with 45,732 additions and 34,512 deletions.
2 changes: 1 addition & 1 deletion .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
// Note: if adding new languages, make sure settings.template.json is updated too.
// Also, if updating typescript, update the one in package.json.
"plugins": [
"https://plugins.dprint.dev/typescript-0.91.7.wasm",
"https://plugins.dprint.dev/typescript-0.91.8.wasm",
"https://plugins.dprint.dev/json-0.19.3.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
]
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default tseslint.config(
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/class-literal-property-style": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/consistent-generic-constructors": "off",
"@typescript-eslint/no-duplicate-enum-values": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-namespace": "off",
Expand Down
604 changes: 236 additions & 368 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
],
"devDependencies": {
"@dprint/formatter": "^0.4.1",
"@dprint/typescript": "0.91.7",
"@dprint/typescript": "0.91.8",
"@esfx/canceltoken": "^1.0.0",
"@eslint/js": "^9.9.1",
"@eslint/js": "^9.10.0",
"@octokit/rest": "^21.0.2",
"@types/chai": "^4.3.19",
"@types/diff": "^5.2.2",
Expand All @@ -52,9 +52,9 @@
"@types/node": "latest",
"@types/source-map-support": "^0.5.10",
"@types/which": "^3.0.4",
"@typescript-eslint/rule-tester": "^8.3.0",
"@typescript-eslint/type-utils": "^8.3.0",
"@typescript-eslint/utils": "^8.3.0",
"@typescript-eslint/rule-tester": "^8.5.0",
"@typescript-eslint/type-utils": "^8.5.0",
"@typescript-eslint/utils": "^8.5.0",
"azure-devops-node-api": "^14.0.2",
"c8": "^10.1.2",
"chai": "^4.5.0",
Expand All @@ -63,26 +63,25 @@
"diff": "^5.2.0",
"dprint": "^0.47.2",
"esbuild": "^0.23.1",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"eslint-formatter-autolinkable-stylish": "^1.4.0",
"eslint-plugin-regexp": "^2.6.0",
"fast-xml-parser": "^4.4.1",
"fast-xml-parser": "^4.5.0",
"glob": "^10.4.5",
"globals": "^15.9.0",
"hereby": "^1.9.0",
"jsonc-parser": "^3.3.1",
"knip": "^5.27.5",
"knip": "^5.30.1",
"minimist": "^1.2.8",
"mocha": "^10.7.3",
"mocha-fivemat-progress-reporter": "^0.1.0",
"monocart-coverage-reports": "^2.10.3",
"ms": "^2.1.3",
"node-fetch": "^3.3.2",
"playwright": "^1.46.1",
"playwright": "^1.47.0",
"source-map-support": "^0.5.21",
"tslib": "^2.7.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.3.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.5.0",
"which": "^3.0.1"
},
"overrides": {
Expand Down
1 change: 0 additions & 1 deletion scripts/post-vsts-artifact-comment.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Octokit } from "@octokit/rest";
import assert from "assert";
import ado from "azure-devops-node-api";
import fetch from "node-fetch";

/**
* @param {string} name
Expand Down
3 changes: 2 additions & 1 deletion scripts/processDiagnosticMessages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function buildInfoFileOutput(messageTable, inputFilePathRel) {
" return { code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated };",
"}",
"",
"/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion*/", // type assertions are needed for isolatedDeclarations
"/** @internal */",
"export const Diagnostics = {",
];
Expand All @@ -101,7 +102,7 @@ function buildInfoFileOutput(messageTable, inputFilePathRel) {
const argElidedInCompatabilityPyramid = elidedInCompatabilityPyramid ? `${!reportsUnnecessary ? ", /*reportsUnnecessary*/ undefined" : ""}, /*elidedInCompatabilityPyramid*/ ${elidedInCompatabilityPyramid}` : "";
const argReportsDeprecated = reportsDeprecated ? `${!argElidedInCompatabilityPyramid ? ", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ undefined" : ""}, /*reportsDeprecated*/ ${reportsDeprecated}` : "";

result.push(` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}${argElidedInCompatabilityPyramid}${argReportsDeprecated}),`);
result.push(` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}${argElidedInCompatabilityPyramid}${argReportsDeprecated}) as DiagnosticMessage,`);
});

result.push("};");
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ export function createFlowNode(flags: FlowFlags, node: unknown, antecedent: Flow
const binder = /* @__PURE__ */ createBinder();

/** @internal */
export function bindSourceFile(file: SourceFile, options: CompilerOptions) {
export function bindSourceFile(file: SourceFile, options: CompilerOptions): void {
performance.mark("beforeBind");
binder(file, options);
performance.mark("afterBind");
Expand Down
11 changes: 6 additions & 5 deletions src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
BuilderProgramHost,
BuilderState,
BuildInfo,
BuildInfoFileVersionMap,
CancellationToken,
CommandLineOption,
compareStringsCaseSensitive,
Expand Down Expand Up @@ -277,7 +278,7 @@ function toBuilderProgramStateWithDefinedProgram(state: ReusableBuilderProgramSt
*
* @internal
*/
export function getBuilderFileEmit(options: CompilerOptions) {
export function getBuilderFileEmit(options: CompilerOptions): BuilderFileEmit {
let result = BuilderFileEmit.Js;
if (options.sourceMap) result = result | BuilderFileEmit.JsMap;
if (options.inlineSourceMap) result = result | BuilderFileEmit.JsInlineMap;
Expand Down Expand Up @@ -733,7 +734,7 @@ export function getPendingEmitKindWithSeen(
seenOldOptionsOrEmitKind: CompilerOptions | BuilderFileEmit | undefined,
emitOnlyDtsFiles: boolean | undefined,
isForDtsErrors: boolean,
) {
): BuilderFileEmit {
let pendingKind = getPendingEmitKind(optionsOrEmitKind, seenOldOptionsOrEmitKind);
if (emitOnlyDtsFiles) pendingKind = pendingKind & BuilderFileEmit.AllDts;
if (isForDtsErrors) pendingKind = pendingKind & BuilderFileEmit.DtsErrors;
Expand Down Expand Up @@ -1623,7 +1624,7 @@ export function computeSignatureWithDiagnostics(
text: string,
host: HostForComputeHash,
data: WriteFileCallbackData | undefined,
) {
): string {
text = getTextHandlingSourceMapForSignature(text, data);
let sourceFileDirectory: string | undefined;
if (data?.diagnostics?.length) {
Expand Down Expand Up @@ -2395,7 +2396,7 @@ export function getBuildInfoFileVersionMap(
program: IncrementalBuildInfo,
buildInfoPath: string,
host: Pick<ReadBuildProgramHost, "useCaseSensitiveFileNames" | "getCurrentDirectory">,
) {
): BuildInfoFileVersionMap {
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const fileInfos = new Map<Path, string>();
Expand Down Expand Up @@ -2440,7 +2441,7 @@ export function getNonIncrementalBuildInfoRoots(
buildInfo: BuildInfo,
buildInfoPath: string,
host: Pick<ReadBuildProgramHost, "useCaseSensitiveFileNames" | "getCurrentDirectory">,
) {
): Path[] | undefined {
if (!isNonIncrementalBuildInfo(buildInfo)) return undefined;
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
Expand Down
16 changes: 8 additions & 8 deletions src/compiler/builderState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ export namespace BuilderState {
/**
* Returns true if oldState is reusable, that is the emitKind = module/non module has not changed
*/
export function canReuseOldState(newReferencedMap: ReadonlyManyToManyPathMap | undefined, oldState: BuilderState | undefined) {
export function canReuseOldState(newReferencedMap: ReadonlyManyToManyPathMap | undefined, oldState: BuilderState | undefined): boolean | undefined {
return oldState && !oldState.referencedMap === !newReferencedMap;
}

export function createReferencedMap(options: CompilerOptions) {
export function createReferencedMap(options: CompilerOptions): ManyToManyPathMap | undefined {
return options.module !== ModuleKind.None && !options.outFile ?
createManyToManyPathMap() :
undefined;
Expand Down Expand Up @@ -346,7 +346,7 @@ export namespace BuilderState {
/**
* Releases needed properties
*/
export function releaseCache(state: BuilderState) {
export function releaseCache(state: BuilderState): void {
state.allFilesExcludingDefaultLibraryFile = undefined;
state.allFileNames = undefined;
}
Expand Down Expand Up @@ -391,7 +391,7 @@ export namespace BuilderState {
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
}

export function updateSignatureOfFile(state: BuilderState, signature: string | undefined, path: Path) {
export function updateSignatureOfFile(state: BuilderState, signature: string | undefined, path: Path): void {
state.fileInfos.get(path)!.signature = signature;
(state.hasCalledUpdateShapeSignature ||= new Set()).add(path);
}
Expand All @@ -402,7 +402,7 @@ export namespace BuilderState {
cancellationToken: CancellationToken | undefined,
host: HostForComputeHash,
onNewSignature: (signature: string, sourceFiles: readonly SourceFile[]) => void,
) {
): void {
programOfThisState.emit(
sourceFile,
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
Expand Down Expand Up @@ -434,8 +434,8 @@ export namespace BuilderState {
sourceFile: SourceFile,
cancellationToken: CancellationToken | undefined,
host: HostForComputeHash,
useFileVersionAsSignature = state.useFileVersionAsSignature,
) {
useFileVersionAsSignature: boolean | undefined = state.useFileVersionAsSignature,
): boolean {
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
if (state.hasCalledUpdateShapeSignature?.has(sourceFile.resolvedPath)) return false;

Expand Down Expand Up @@ -507,7 +507,7 @@ export namespace BuilderState {
/**
* Gets the files referenced by the the file path
*/
export function getReferencedByPaths(state: Readonly<BuilderState>, referencedFilePath: Path) {
export function getReferencedByPaths(state: Readonly<BuilderState>, referencedFilePath: Path): Path[] {
const keys = state.referencedMap!.getKeys(referencedFilePath);
return keys ? arrayFrom(keys.keys()) : [];
}
Expand Down
6 changes: 4 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ export function getSymbolId(symbol: Symbol): SymbolId {
}

/** @internal */
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean {
const moduleState = getModuleInstanceState(node);
return moduleState === ModuleInstanceState.Instantiated ||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
Expand Down Expand Up @@ -1641,6 +1641,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
getBaseTypeOfLiteralType,
getWidenedType,
getWidenedLiteralType,
fillMissingTypeArguments,
getTypeFromTypeNode: nodeIn => {
const node = getParseTreeNode(nodeIn, isTypeNode);
return node ? getTypeFromTypeNode(node) : errorType;
Expand Down Expand Up @@ -52709,7 +52710,7 @@ function getIterationTypesKeyFromIterationTypeKind(typeKind: IterationTypeKind)
}

/** @internal */
export function signatureHasRestParameter(s: Signature) {
export function signatureHasRestParameter(s: Signature): boolean {
return !!(s.flags & SignatureFlags.HasRestParameter);
}

Expand All @@ -52732,6 +52733,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host: TypeCheckerHo
readFile: host.readFile ? (fileName => host.readFile!(fileName)) : undefined,
getDefaultResolutionModeForFile: file => host.getDefaultResolutionModeForFile(file),
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index),
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation),
};
}

Expand Down
Loading

0 comments on commit 387d9c6

Please sign in to comment.