Skip to content

Commit 78dde79

Browse files
authored
Merge branch 'main' into main
2 parents bb93845 + 669c25c commit 78dde79

File tree

70 files changed

+4651
-2965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4651
-2965
lines changed

package-lock.json

Lines changed: 977 additions & 1109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,45 @@
4242
"@dprint/formatter": "^0.4.1",
4343
"@dprint/typescript": "0.93.4",
4444
"@esfx/canceltoken": "^1.0.0",
45-
"@eslint/js": "^9.33.0",
46-
"@octokit/rest": "^21.1.1",
45+
"@eslint/js": "^9.39.1",
46+
"@octokit/rest": "^22.0.1",
4747
"@types/chai": "^4.3.20",
4848
"@types/minimist": "^1.2.5",
4949
"@types/mocha": "^10.0.10",
50-
"@types/ms": "^0.7.34",
50+
"@types/ms": "^2.1.0",
5151
"@types/node": "latest",
5252
"@types/source-map-support": "^0.5.10",
5353
"@types/which": "^3.0.4",
54-
"@typescript-eslint/rule-tester": "^8.39.1",
55-
"@typescript-eslint/type-utils": "^8.39.1",
56-
"@typescript-eslint/utils": "^8.39.1",
54+
"@typescript-eslint/rule-tester": "^8.47.0",
55+
"@typescript-eslint/type-utils": "^8.47.0",
56+
"@typescript-eslint/utils": "^8.47.0",
5757
"azure-devops-node-api": "^15.1.1",
5858
"c8": "^10.1.3",
5959
"chai": "^4.5.0",
6060
"chokidar": "^4.0.3",
6161
"diff": "^8.0.2",
6262
"dprint": "^0.49.1",
63-
"esbuild": "^0.25.9",
64-
"eslint": "^9.33.0",
63+
"esbuild": "^0.27.0",
64+
"eslint": "^9.39.1",
6565
"eslint-formatter-autolinkable-stylish": "^1.4.0",
6666
"eslint-plugin-regexp": "^2.10.0",
67-
"fast-xml-parser": "^5.2.5",
68-
"glob": "^10.4.5",
69-
"globals": "^16.3.0",
70-
"hereby": "^1.11.0",
67+
"fast-xml-parser": "^5.3.2",
68+
"glob": "^10.5.0",
69+
"globals": "^16.5.0",
70+
"hereby": "^1.11.1",
7171
"jsonc-parser": "^3.3.1",
72-
"knip": "^5.62.0",
72+
"knip": "^5.70.0",
7373
"minimist": "^1.2.8",
7474
"mocha": "^10.8.2",
7575
"mocha-fivemat-progress-reporter": "^0.1.0",
76-
"monocart-coverage-reports": "^2.12.6",
76+
"monocart-coverage-reports": "^2.12.9",
7777
"ms": "^2.1.3",
7878
"picocolors": "^1.1.1",
79-
"playwright": "^1.54.2",
79+
"playwright": "^1.56.1",
8080
"source-map-support": "^0.5.21",
8181
"tslib": "^2.8.1",
82-
"typescript": "^5.9.2",
83-
"typescript-eslint": "^8.39.1",
82+
"typescript": "^5.9.3",
83+
"typescript-eslint": "^8.47.0",
8484
"which": "^3.0.1"
8585
},
8686
"overrides": {

src/compiler/binder.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,11 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
10911091
// and set it before we descend into nodes that could actually be part of an assignment pattern.
10921092
inAssignmentPattern = false;
10931093

1094+
// Clear Unreachable flag from previous binding (for incremental scenarios)
1095+
if (isPotentiallyExecutableNode(node)) {
1096+
(node as Mutable<Node>).flags &= ~NodeFlags.Unreachable;
1097+
}
1098+
10941099
if (currentFlow === unreachableFlow) {
10951100
if (canHaveFlowNode(node)) {
10961101
node.flowNode = undefined;

src/compiler/checker.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ import {
504504
isCallLikeOrFunctionLikeExpression,
505505
isCallOrNewExpression,
506506
isCallSignatureDeclaration,
507+
isCaseOrDefaultClause,
507508
isCatchClause,
508509
isCatchClauseVariableDeclaration,
509510
isCatchClauseVariableDeclarationOrBindingElement,
@@ -53180,6 +53181,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
5318053181
Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration,
5318153182
);
5318253183
}
53184+
else if (isVariableStatement(declarationList.parent) && isCaseOrDefaultClause(declarationList.parent.parent)) {
53185+
return grammarErrorOnNode(
53186+
declarationList,
53187+
blockScopeFlags === NodeFlags.Using ?
53188+
Diagnostics.using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block :
53189+
Diagnostics.await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block,
53190+
);
53191+
}
5318353192

5318453193
if (declarationList.flags & NodeFlags.Ambient) {
5318553194
return grammarErrorOnNode(

src/compiler/commandLineParser.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,15 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
674674
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
675675
defaultValueDescription: false,
676676
},
677+
{
678+
name: "ignoreConfig",
679+
type: "boolean",
680+
showInSimplifiedHelpView: true,
681+
category: Diagnostics.Command_line_Options,
682+
isCommandLineOnly: true,
683+
description: Diagnostics.Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files,
684+
defaultValueDescription: false,
685+
},
677686

678687
// Basic
679688
targetOptionDeclaration,

src/compiler/diagnosticMessages.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,6 +1849,18 @@
18491849
"category": "Error",
18501850
"code": 1546
18511851
},
1852+
"'using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.": {
1853+
"category": "Error",
1854+
"code": 1547
1855+
},
1856+
"'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.": {
1857+
"category": "Error",
1858+
"code": 1548
1859+
},
1860+
"Ignore the tsconfig found and build with commandline options and files.": {
1861+
"category": "Message",
1862+
"code": 1549
1863+
},
18521864

18531865
"The types of '{0}' are incompatible between these types.": {
18541866
"category": "Error",
@@ -4729,6 +4741,10 @@
47294741
"category": "Message",
47304742
"code": 5111
47314743
},
4744+
"tsconfig.json is present but will not be loaded if files are specified on commandline. Use '--ignoreConfig' to skip this error.": {
4745+
"category": "Error",
4746+
"code": 5112
4747+
},
47324748

47334749
"Generates a sourcemap for each corresponding '.d.ts' file.": {
47344750
"category": "Message",

src/compiler/executeCommandLine.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -614,20 +614,27 @@ function executeCommandLineWorker(
614614
}
615615
}
616616
}
617-
else if (commandLine.fileNames.length === 0) {
617+
else if (!commandLine.options.ignoreConfig || commandLine.fileNames.length === 0) {
618618
const searchPath = normalizePath(sys.getCurrentDirectory());
619619
configFileName = findConfigFile(searchPath, fileName => sys.fileExists(fileName));
620-
}
621-
622-
if (commandLine.fileNames.length === 0 && !configFileName) {
623-
if (commandLine.options.showConfig) {
624-
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys.getCurrentDirectory())));
620+
// if (!commandLine.options.ignoreConfig) {
621+
if (commandLine.fileNames.length !== 0) {
622+
if (configFileName) {
623+
// Error to not specify config file
624+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConfig_to_skip_this_error));
625+
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
626+
}
625627
}
626-
else {
627-
printVersion(sys);
628-
printHelp(sys, commandLine);
628+
else if (!configFileName) {
629+
if (commandLine.options.showConfig) {
630+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys.getCurrentDirectory())));
631+
}
632+
else {
633+
printVersion(sys);
634+
printHelp(sys, commandLine);
635+
}
636+
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
629637
}
630-
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
631638
}
632639

633640
const currentDirectory = sys.getCurrentDirectory();

src/compiler/transformers/esnext.ts

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
BindingElement,
77
Block,
88
Bundle,
9-
CaseOrDefaultClause,
109
chainBundle,
1110
ClassDeclaration,
1211
Debug,
@@ -25,7 +24,6 @@ import {
2524
isArray,
2625
isBindingPattern,
2726
isBlock,
28-
isCaseClause,
2927
isCustomPrologue,
3028
isExpression,
3129
isGeneratedIdentifier,
@@ -49,7 +47,6 @@ import {
4947
skipOuterExpressions,
5048
SourceFile,
5149
Statement,
52-
SwitchStatement,
5350
SyntaxKind,
5451
TransformationContext,
5552
TransformFlags,
@@ -123,9 +120,6 @@ export function transformESNext(context: TransformationContext): (x: SourceFile
123120
case SyntaxKind.ForOfStatement:
124121
return visitForOfStatement(node as ForOfStatement);
125122

126-
case SyntaxKind.SwitchStatement:
127-
return visitSwitchStatement(node as SwitchStatement);
128-
129123
default:
130124
return visitEachChild(node, visitor, context);
131125
}
@@ -339,72 +333,6 @@ export function transformESNext(context: TransformationContext): (x: SourceFile
339333
return visitEachChild(node, visitor, context);
340334
}
341335

342-
function visitCaseOrDefaultClause(node: CaseOrDefaultClause, envBinding: Identifier) {
343-
if (getUsingKindOfStatements(node.statements) !== UsingKind.None) {
344-
if (isCaseClause(node)) {
345-
return factory.updateCaseClause(
346-
node,
347-
visitNode(node.expression, visitor, isExpression),
348-
transformUsingDeclarations(node.statements, /*start*/ 0, node.statements.length, envBinding, /*topLevelStatements*/ undefined),
349-
);
350-
}
351-
else {
352-
return factory.updateDefaultClause(
353-
node,
354-
transformUsingDeclarations(node.statements, /*start*/ 0, node.statements.length, envBinding, /*topLevelStatements*/ undefined),
355-
);
356-
}
357-
}
358-
return visitEachChild(node, visitor, context);
359-
}
360-
361-
function visitSwitchStatement(node: SwitchStatement) {
362-
// given:
363-
//
364-
// switch (expr) {
365-
// case expr:
366-
// using res = expr;
367-
// }
368-
//
369-
// produces:
370-
//
371-
// const env_1 = { stack: [], error: void 0, hasError: false };
372-
// try {
373-
// switch(expr) {
374-
// case expr:
375-
// const res = __addDisposableResource(env_1, expr, false);
376-
// }
377-
// }
378-
// catch (e_1) {
379-
// env_1.error = e_1;
380-
// env_1.hasError = true;
381-
// }
382-
// finally {
383-
// __disposeResources(env_1);
384-
// }
385-
//
386-
const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses);
387-
if (usingKind) {
388-
const envBinding = createEnvBinding();
389-
return createDownlevelUsingStatements(
390-
[
391-
factory.updateSwitchStatement(
392-
node,
393-
visitNode(node.expression, visitor, isExpression),
394-
factory.updateCaseBlock(
395-
node.caseBlock,
396-
node.caseBlock.clauses.map(clause => visitCaseOrDefaultClause(clause, envBinding)),
397-
),
398-
),
399-
],
400-
envBinding,
401-
usingKind === UsingKind.Async,
402-
);
403-
}
404-
405-
return visitEachChild(node, visitor, context);
406-
}
407-
408336
/**
409337
* Transform `using` declarations in a statement list.
410338
*/
@@ -870,13 +798,3 @@ function getUsingKindOfStatements(statements: readonly Statement[]): UsingKind {
870798
}
871799
return result;
872800
}
873-
874-
function getUsingKindOfCaseOrDefaultClauses(clauses: readonly CaseOrDefaultClause[]): UsingKind {
875-
let result = UsingKind.None;
876-
for (const clause of clauses) {
877-
const usingKind = getUsingKindOfStatements(clause.statements);
878-
if (usingKind === UsingKind.Async) return UsingKind.Async;
879-
if (usingKind > result) result = usingKind;
880-
}
881-
return result;
882-
}

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7552,6 +7552,7 @@ export interface CompilerOptions {
75527552
/** @internal */ watch?: boolean;
75537553
esModuleInterop?: boolean;
75547554
/** @internal */ showConfig?: boolean;
7555+
/** @internal */ ignoreConfig?: boolean;
75557556
useDefineForClassFields?: boolean;
75567557
/** @internal */ tscBuild?: boolean;
75577558

src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10635,11 +10635,11 @@
1063510635
</Str>
1063610636
<Disp Icon="Str" />
1063710637
</Item>
10638-
<Item ItemId=";Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096" ItemType="0" PsrId="306" Leaf="true">
10638+
<Item ItemId=";Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewrite_5096" ItemType="0" PsrId="306" Leaf="true">
1063910639
<Str Cat="Text">
10640-
<Val><![CDATA[Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.]]></Val>
10640+
<Val><![CDATA[Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set.]]></Val>
1064110641
<Tgt Cat="Text" Stat="Loc" Orig="New">
10642-
<Val><![CDATA[只有在设置“noEmit”或“emitDeclarationOnly”时,才能使用选项allowImportingTsExtensions。]]></Val>
10642+
<Val><![CDATA[仅当设置了 'noEmit'、'emitDeclarationOnly' 或 'rewriteRelativeImportExtensions' 其中之一时,才能使用选项 'allowImportingTsExtensions'。]]></Val>
1064310643
</Tgt>
1064410644
</Str>
1064510645
<Disp Icon="Str" />

0 commit comments

Comments
 (0)