@typescript-deploys/pr-build 5.0.0-pr-51387-10 → 5.0.0-pr-51387-49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -15,10 +15,15 @@ and limitations under the License.
15
15
 
16
16
 
17
17
  "use strict";
18
+ var __defProp = Object.defineProperty;
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
18
23
 
19
24
  // src/compiler/corePublic.ts
20
25
  var versionMajorMinor = "5.0";
21
- var version = `${versionMajorMinor}.0-insiders.20221102`;
26
+ var version = `${versionMajorMinor}.0-insiders.20221107`;
22
27
  var NativeCollections;
23
28
  ((NativeCollections2) => {
24
29
  const globals = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : void 0;
@@ -1962,6 +1967,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
1962
1967
  })(BoxCharacter || (BoxCharacter = {}));
1963
1968
  let Connection;
1964
1969
  ((Connection2) => {
1970
+ Connection2[Connection2["None"] = 0] = "None";
1965
1971
  Connection2[Connection2["Up"] = 1] = "Up";
1966
1972
  Connection2[Connection2["Down"] = 2] = "Down";
1967
1973
  Connection2[Connection2["Left"] = 4] = "Left";
@@ -2679,6 +2685,25 @@ try {
2679
2685
  }
2680
2686
  var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : nullLogger;
2681
2687
 
2688
+ // src/compiler/_namespaces/ts.performance.ts
2689
+ var ts_performance_exports = {};
2690
+ __export(ts_performance_exports, {
2691
+ clearMarks: () => clearMarks,
2692
+ clearMeasures: () => clearMeasures,
2693
+ createTimer: () => createTimer,
2694
+ createTimerIf: () => createTimerIf,
2695
+ disable: () => disable,
2696
+ enable: () => enable,
2697
+ forEachMark: () => forEachMark,
2698
+ forEachMeasure: () => forEachMeasure,
2699
+ getCount: () => getCount,
2700
+ getDuration: () => getDuration,
2701
+ isEnabled: () => isEnabled,
2702
+ mark: () => mark,
2703
+ measure: () => measure,
2704
+ nullTimer: () => nullTimer
2705
+ });
2706
+
2682
2707
  // src/compiler/performance.ts
2683
2708
  var perfHooks;
2684
2709
  var performanceImpl;
@@ -4824,7 +4849,7 @@ var sys = (() => {
4824
4849
  }
4825
4850
  let activeSession;
4826
4851
  let profilePath = "./profile.cpuprofile";
4827
- const Buffer = require("buffer").Buffer;
4852
+ const Buffer2 = require("buffer").Buffer;
4828
4853
  const nodeVersion = getNodeMajorVersion();
4829
4854
  const isNode4OrLater = nodeVersion >= 4;
4830
4855
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
@@ -5022,7 +5047,7 @@ var sys = (() => {
5022
5047
  }
5023
5048
  }
5024
5049
  function bufferFrom(input, encoding) {
5025
- return Buffer.from && Buffer.from !== Int8Array.from ? Buffer.from(input, encoding) : new Buffer(input, encoding);
5050
+ return Buffer2.from && Buffer2.from !== Int8Array.from ? Buffer2.from(input, encoding) : new Buffer2(input, encoding);
5026
5051
  }
5027
5052
  function isFileSystemCaseSensitive() {
5028
5053
  if (platform === "win32" || platform === "win64") {
@@ -6205,7 +6230,7 @@ var Diagnostics = {
6205
6230
  The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, 1 /* Error */, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."),
6206
6231
  Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, 1 /* Error */, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."),
6207
6232
  Enum_declarations_must_all_be_const_or_non_const: diag(2473, 1 /* Error */, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."),
6208
- const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values: diag(2474, 1 /* Error */, "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474", "const enum member initializers can only contain literal values and other computed enum values."),
6233
+ const_enum_member_initializers_must_be_constant_expressions: diag(2474, 1 /* Error */, "const_enum_member_initializers_must_be_constant_expressions_2474", "const enum member initializers must be constant expressions."),
6209
6234
  const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: diag(2475, 1 /* Error */, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."),
6210
6235
  A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, 1 /* Error */, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."),
6211
6236
  const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, 1 /* Error */, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."),
@@ -6261,7 +6286,6 @@ var Diagnostics = {
6261
6286
  Object_is_possibly_undefined: diag(2532, 1 /* Error */, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."),
6262
6287
  Object_is_possibly_null_or_undefined: diag(2533, 1 /* Error */, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."),
6263
6288
  A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, 1 /* Error */, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."),
6264
- Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, 1 /* Error */, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."),
6265
6289
  Type_0_cannot_be_used_to_index_type_1: diag(2536, 1 /* Error */, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."),
6266
6290
  Type_0_has_no_matching_index_signature_for_type_1: diag(2537, 1 /* Error */, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."),
6267
6291
  Type_0_cannot_be_used_as_an_index_type: diag(2538, 1 /* Error */, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."),
@@ -7504,7 +7528,7 @@ var Diagnostics = {
7504
7528
  An_optional_chain_cannot_contain_private_identifiers: diag(18030, 1 /* Error */, "An_optional_chain_cannot_contain_private_identifiers_18030", "An optional chain cannot contain private identifiers."),
7505
7529
  The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents: diag(18031, 1 /* Error */, "The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031", "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."),
7506
7530
  The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some: diag(18032, 1 /* Error */, "The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032", "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."),
7507
- Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead: diag(18033, 1 /* Error */, "Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033", "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead."),
7531
+ Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values: diag(18033, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values_18033", "Type '{0}' is not assignable to type '{1}' as required for computed enum member values."),
7508
7532
  Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment: diag(18034, 3 /* Message */, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."),
7509
7533
  Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(18035, 1 /* Error */, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."),
7510
7534
  Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator: diag(18036, 1 /* Error */, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."),
@@ -14431,7 +14455,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
14431
14455
  return node;
14432
14456
  }
14433
14457
  }
14434
- function Symbol3(flags, name) {
14458
+ function Symbol4(flags, name) {
14435
14459
  this.flags = flags;
14436
14460
  this.escapedName = name;
14437
14461
  this.declarations = void 0;
@@ -14494,7 +14518,7 @@ var objectAllocator = {
14494
14518
  getIdentifierConstructor: () => Identifier2,
14495
14519
  getPrivateIdentifierConstructor: () => Node4,
14496
14520
  getSourceFileConstructor: () => Node4,
14497
- getSymbolConstructor: () => Symbol3,
14521
+ getSymbolConstructor: () => Symbol4,
14498
14522
  getTypeConstructor: () => Type3,
14499
14523
  getSignatureConstructor: () => Signature2,
14500
14524
  getSourceMapSourceConstructor: () => SourceMapSource
@@ -16661,7 +16685,7 @@ function createNodeFactory(flags, baseFactory2) {
16661
16685
  createUnparsedPrepend,
16662
16686
  createUnparsedTextLike,
16663
16687
  createUnparsedSyntheticReference,
16664
- createInputFiles: createInputFiles2,
16688
+ createInputFiles,
16665
16689
  createSyntheticExpression,
16666
16690
  createSyntaxList,
16667
16691
  createNotEmittedStatement,
@@ -19543,7 +19567,7 @@ function createNodeFactory(flags, baseFactory2) {
19543
19567
  node.section = section;
19544
19568
  return node;
19545
19569
  }
19546
- function createInputFiles2() {
19570
+ function createInputFiles() {
19547
19571
  const node = createBaseNode(311 /* InputFiles */);
19548
19572
  node.javascriptText = "";
19549
19573
  node.declarationText = "";
@@ -20424,69 +20448,64 @@ function parseOldFileOfCurrentEmit(bundleFileInfo) {
20424
20448
  node.helpers = map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, (name) => getAllUnscopedEmitHelpers().get(name));
20425
20449
  return node;
20426
20450
  }
20427
- function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
20451
+ function createInputFilesWithFilePaths(readFileText, javascriptPath, javascriptMapPath, declarationPath, declarationMapPath, buildInfoPath, host, options) {
20428
20452
  const node = parseNodeFactory.createInputFiles();
20429
- if (!isString(javascriptTextOrReadFileText)) {
20430
- const cache = new Map();
20431
- const textGetter = (path) => {
20432
- if (path === void 0)
20433
- return void 0;
20434
- let value = cache.get(path);
20435
- if (value === void 0) {
20436
- value = javascriptTextOrReadFileText(path);
20437
- cache.set(path, value !== void 0 ? value : false);
20438
- }
20439
- return value !== false ? value : void 0;
20440
- };
20441
- const definedTextGetter = (path) => {
20442
- const result = textGetter(path);
20443
- return result !== void 0 ? result : `/* Input file ${path} was missing */\r
20453
+ node.javascriptPath = javascriptPath;
20454
+ node.javascriptMapPath = javascriptMapPath;
20455
+ node.declarationPath = declarationPath;
20456
+ node.declarationMapPath = declarationMapPath;
20457
+ node.buildInfoPath = buildInfoPath;
20458
+ const cache = new Map();
20459
+ const textGetter = (path) => {
20460
+ if (path === void 0)
20461
+ return void 0;
20462
+ let value = cache.get(path);
20463
+ if (value === void 0) {
20464
+ value = readFileText(path);
20465
+ cache.set(path, value !== void 0 ? value : false);
20466
+ }
20467
+ return value !== false ? value : void 0;
20468
+ };
20469
+ const definedTextGetter = (path) => {
20470
+ const result = textGetter(path);
20471
+ return result !== void 0 ? result : `/* Input file ${path} was missing */\r
20444
20472
  `;
20445
- };
20446
- let buildInfo2;
20447
- const getAndCacheBuildInfo = (getText) => {
20448
- var _a2;
20449
- if (buildInfo2 === void 0) {
20450
- const result = getText();
20451
- buildInfo2 = result !== void 0 ? (_a2 = getBuildInfo(node.buildInfoPath, result)) != null ? _a2 : false : false;
20473
+ };
20474
+ let buildInfo;
20475
+ const getAndCacheBuildInfo = () => {
20476
+ var _a2, _b;
20477
+ if (buildInfo === void 0 && buildInfoPath) {
20478
+ if (host == null ? void 0 : host.getBuildInfo) {
20479
+ buildInfo = (_a2 = host.getBuildInfo(buildInfoPath, options.configFilePath)) != null ? _a2 : false;
20480
+ } else {
20481
+ const result = textGetter(buildInfoPath);
20482
+ buildInfo = result !== void 0 ? (_b = getBuildInfo(buildInfoPath, result)) != null ? _b : false : false;
20452
20483
  }
20453
- return buildInfo2 || void 0;
20454
- };
20455
- node.javascriptPath = declarationTextOrJavascriptPath;
20456
- node.javascriptMapPath = javascriptMapPath;
20457
- node.declarationPath = Debug.checkDefined(javascriptMapTextOrDeclarationPath);
20458
- node.declarationMapPath = declarationMapPath;
20459
- node.buildInfoPath = declarationMapTextOrBuildInfoPath;
20460
- Object.defineProperties(node, {
20461
- javascriptText: { get() {
20462
- return definedTextGetter(declarationTextOrJavascriptPath);
20463
- } },
20464
- javascriptMapText: { get() {
20465
- return textGetter(javascriptMapPath);
20466
- } },
20467
- declarationText: { get() {
20468
- return definedTextGetter(Debug.checkDefined(javascriptMapTextOrDeclarationPath));
20469
- } },
20470
- declarationMapText: { get() {
20471
- return textGetter(declarationMapPath);
20472
- } },
20473
- buildInfo: { get() {
20474
- return getAndCacheBuildInfo(() => textGetter(declarationMapTextOrBuildInfoPath));
20475
- } }
20476
- });
20477
- } else {
20478
- node.javascriptText = javascriptTextOrReadFileText;
20479
- node.javascriptMapPath = javascriptMapPath;
20480
- node.javascriptMapText = javascriptMapTextOrDeclarationPath;
20481
- node.declarationText = declarationTextOrJavascriptPath;
20482
- node.declarationMapPath = declarationMapPath;
20483
- node.declarationMapText = declarationMapTextOrBuildInfoPath;
20484
- node.javascriptPath = javascriptPath;
20485
- node.declarationPath = declarationPath;
20486
- node.buildInfoPath = buildInfoPath;
20487
- node.buildInfo = buildInfo;
20488
- node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
20489
- }
20484
+ }
20485
+ return buildInfo || void 0;
20486
+ };
20487
+ Object.defineProperties(node, {
20488
+ javascriptText: { get: () => definedTextGetter(javascriptPath) },
20489
+ javascriptMapText: { get: () => textGetter(javascriptMapPath) },
20490
+ declarationText: { get: () => definedTextGetter(Debug.checkDefined(declarationPath)) },
20491
+ declarationMapText: { get: () => textGetter(declarationMapPath) },
20492
+ buildInfo: { get: getAndCacheBuildInfo }
20493
+ });
20494
+ return node;
20495
+ }
20496
+ function createInputFilesWithFileTexts(javascriptPath, javascriptText, javascriptMapPath, javascriptMapText, declarationPath, declarationText, declarationMapPath, declarationMapText, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
20497
+ const node = parseNodeFactory.createInputFiles();
20498
+ node.javascriptPath = javascriptPath;
20499
+ node.javascriptText = javascriptText;
20500
+ node.javascriptMapPath = javascriptMapPath;
20501
+ node.javascriptMapText = javascriptMapText;
20502
+ node.declarationPath = declarationPath;
20503
+ node.declarationText = declarationText;
20504
+ node.declarationMapPath = declarationMapPath;
20505
+ node.declarationMapText = declarationMapText;
20506
+ node.buildInfoPath = buildInfoPath;
20507
+ node.buildInfo = buildInfo;
20508
+ node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
20490
20509
  return node;
20491
20510
  }
20492
20511
  function setOriginalNode(node, original) {
@@ -34709,7 +34728,7 @@ function createBinder() {
34709
34728
  let inStrictMode;
34710
34729
  let inAssignmentPattern = false;
34711
34730
  let symbolCount = 0;
34712
- let Symbol11;
34731
+ let Symbol12;
34713
34732
  let classifiableNames;
34714
34733
  const unreachableFlow = { flags: 1 /* Unreachable */ };
34715
34734
  const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
@@ -34725,7 +34744,7 @@ function createBinder() {
34725
34744
  inStrictMode = bindInStrictMode(file, opts);
34726
34745
  classifiableNames = new Set();
34727
34746
  symbolCount = 0;
34728
- Symbol11 = objectAllocator.getSymbolConstructor();
34747
+ Symbol12 = objectAllocator.getSymbolConstructor();
34729
34748
  Debug.attachFlowNodeDebugInfo(unreachableFlow);
34730
34749
  Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
34731
34750
  if (!file.locals) {
@@ -34768,7 +34787,7 @@ function createBinder() {
34768
34787
  }
34769
34788
  function createSymbol(flags, name) {
34770
34789
  symbolCount++;
34771
- return new Symbol11(flags, name);
34790
+ return new Symbol12(flags, name);
34772
34791
  }
34773
34792
  function addDeclarationToSymbol(symbol, node, symbolFlags) {
34774
34793
  symbol.flags |= symbolFlags;
@@ -38172,12 +38191,11 @@ function createTypeChecker(host) {
38172
38191
  let cancellationToken;
38173
38192
  let requestedExternalEmitHelpers;
38174
38193
  let externalHelpersModule;
38175
- const Symbol11 = objectAllocator.getSymbolConstructor();
38194
+ const Symbol12 = objectAllocator.getSymbolConstructor();
38176
38195
  const Type7 = objectAllocator.getTypeConstructor();
38177
38196
  const Signature5 = objectAllocator.getSignatureConstructor();
38178
38197
  let typeCount = 0;
38179
38198
  let symbolCount = 0;
38180
- let enumCount = 0;
38181
38199
  let totalInstantiationCount = 0;
38182
38200
  let instantiationCount = 0;
38183
38201
  let instantiationDepth = 0;
@@ -38977,7 +38995,7 @@ function createTypeChecker(host) {
38977
38995
  }
38978
38996
  function createSymbol(flags, name, checkFlags) {
38979
38997
  symbolCount++;
38980
- const symbol = new Symbol11(flags | 33554432 /* Transient */, name);
38998
+ const symbol = new Symbol12(flags | 33554432 /* Transient */, name);
38981
38999
  symbol.checkFlags = checkFlags || 0;
38982
39000
  return symbol;
38983
39001
  }
@@ -40008,7 +40026,7 @@ function createTypeChecker(host) {
40008
40026
  }
40009
40027
  }
40010
40028
  function isSameScopeDescendentOf(initial, parent, stopAt) {
40011
- return !!parent && !!findAncestor(initial, (n) => n === parent || (n === stopAt || isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n) ? "quit" : false));
40029
+ return !!parent && !!findAncestor(initial, (n) => n === parent || (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || isAsyncFunction(n)) ? "quit" : false));
40012
40030
  }
40013
40031
  function getAnyImportSyntax(node) {
40014
40032
  switch (node.kind) {
@@ -41281,6 +41299,11 @@ function createTypeChecker(host) {
41281
41299
  (_a2 = tracing) == null ? void 0 : _a2.recordType(result);
41282
41300
  return result;
41283
41301
  }
41302
+ function createTypeWithSymbol(flags, symbol) {
41303
+ const result = createType(flags);
41304
+ result.symbol = symbol;
41305
+ return result;
41306
+ }
41284
41307
  function createOriginType(flags) {
41285
41308
  return new Type7(checker, flags);
41286
41309
  }
@@ -41291,9 +41314,8 @@ function createTypeChecker(host) {
41291
41314
  return type;
41292
41315
  }
41293
41316
  function createObjectType(objectFlags, symbol) {
41294
- const type = createType(524288 /* Object */);
41317
+ const type = createTypeWithSymbol(524288 /* Object */, symbol);
41295
41318
  type.objectFlags = objectFlags;
41296
- type.symbol = symbol;
41297
41319
  type.members = void 0;
41298
41320
  type.properties = void 0;
41299
41321
  type.callSignatures = void 0;
@@ -41305,10 +41327,7 @@ function createTypeChecker(host) {
41305
41327
  return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
41306
41328
  }
41307
41329
  function createTypeParameter(symbol) {
41308
- const type = createType(262144 /* TypeParameter */);
41309
- if (symbol)
41310
- type.symbol = symbol;
41311
- return type;
41330
+ return createTypeWithSymbol(262144 /* TypeParameter */, symbol);
41312
41331
  }
41313
41332
  function isReservedMemberName(name) {
41314
41333
  return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */ && name.charCodeAt(2) !== 64 /* at */ && name.charCodeAt(2) !== 35 /* hash */;
@@ -41899,29 +41918,29 @@ function createTypeChecker(host) {
41899
41918
  context.approximateLength += 7;
41900
41919
  return factory.createKeywordTypeNode(134 /* BooleanKeyword */);
41901
41920
  }
41902
- if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
41903
- const parentSymbol = getParentOfSymbol(type.symbol);
41904
- const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
41905
- if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
41906
- return parentName;
41907
- }
41908
- const memberName = symbolName(type.symbol);
41909
- if (isIdentifierText(memberName, 0 /* ES3 */)) {
41910
- return appendReferenceToType(
41911
- parentName,
41912
- factory.createTypeReferenceNode(memberName, void 0)
41913
- );
41914
- }
41915
- if (isImportTypeNode(parentName)) {
41916
- parentName.isTypeOf = true;
41917
- return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
41918
- } else if (isTypeReferenceNode(parentName)) {
41919
- return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
41920
- } else {
41921
- return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
41922
- }
41923
- }
41924
41921
  if (type.flags & 1056 /* EnumLike */) {
41922
+ if (type.symbol.flags & 8 /* EnumMember */) {
41923
+ const parentSymbol = getParentOfSymbol(type.symbol);
41924
+ const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
41925
+ if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
41926
+ return parentName;
41927
+ }
41928
+ const memberName = symbolName(type.symbol);
41929
+ if (isIdentifierText(memberName, 0 /* ES3 */)) {
41930
+ return appendReferenceToType(
41931
+ parentName,
41932
+ factory.createTypeReferenceNode(memberName, void 0)
41933
+ );
41934
+ }
41935
+ if (isImportTypeNode(parentName)) {
41936
+ parentName.isTypeOf = true;
41937
+ return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
41938
+ } else if (isTypeReferenceNode(parentName)) {
41939
+ return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
41940
+ } else {
41941
+ return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
41942
+ }
41943
+ }
41925
41944
  return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
41926
41945
  }
41927
41946
  if (type.flags & 128 /* StringLiteral */) {
@@ -46260,91 +46279,36 @@ function createTypeChecker(host) {
46260
46279
  }
46261
46280
  return links.declaredType;
46262
46281
  }
46263
- function isStringConcatExpression(expr) {
46264
- if (isStringLiteralLike(expr)) {
46265
- return true;
46266
- } else if (expr.kind === 223 /* BinaryExpression */) {
46267
- return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
46268
- }
46269
- return false;
46270
- }
46271
- function isLiteralEnumMember(member) {
46272
- const expr = member.initializer;
46273
- if (!expr) {
46274
- return !(member.flags & 16777216 /* Ambient */);
46275
- }
46276
- switch (expr.kind) {
46277
- case 10 /* StringLiteral */:
46278
- case 8 /* NumericLiteral */:
46279
- case 14 /* NoSubstitutionTemplateLiteral */:
46280
- return true;
46281
- case 221 /* PrefixUnaryExpression */:
46282
- return expr.operator === 40 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */;
46283
- case 79 /* Identifier */:
46284
- return nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
46285
- case 223 /* BinaryExpression */:
46286
- return isStringConcatExpression(expr);
46287
- default:
46288
- return false;
46289
- }
46290
- }
46291
- function getEnumKind(symbol) {
46292
- const links = getSymbolLinks(symbol);
46293
- if (links.enumKind !== void 0) {
46294
- return links.enumKind;
46295
- }
46296
- let hasNonLiteralMember = false;
46297
- if (symbol.declarations) {
46298
- for (const declaration of symbol.declarations) {
46299
- if (declaration.kind === 263 /* EnumDeclaration */) {
46300
- for (const member of declaration.members) {
46301
- if (member.initializer && isStringLiteralLike(member.initializer)) {
46302
- return links.enumKind = 1 /* Literal */;
46303
- }
46304
- if (!isLiteralEnumMember(member)) {
46305
- hasNonLiteralMember = true;
46306
- }
46307
- }
46308
- }
46309
- }
46310
- }
46311
- return links.enumKind = hasNonLiteralMember ? 0 /* Numeric */ : 1 /* Literal */;
46312
- }
46313
46282
  function getBaseTypeOfEnumLiteralType(type) {
46314
46283
  return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
46315
46284
  }
46316
46285
  function getDeclaredTypeOfEnum(symbol) {
46317
46286
  const links = getSymbolLinks(symbol);
46318
- if (links.declaredType) {
46319
- return links.declaredType;
46320
- }
46321
- if (getEnumKind(symbol) === 1 /* Literal */) {
46322
- enumCount++;
46287
+ if (!links.declaredType) {
46323
46288
  const memberTypeList = [];
46324
46289
  if (symbol.declarations) {
46325
46290
  for (const declaration of symbol.declarations) {
46326
46291
  if (declaration.kind === 263 /* EnumDeclaration */) {
46327
46292
  for (const member of declaration.members) {
46328
- const value = getEnumMemberValue(member);
46329
- const memberType = getFreshTypeOfLiteralType(getEnumLiteralType(value !== void 0 ? value : 0, enumCount, getSymbolOfNode(member)));
46330
- getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType;
46331
- memberTypeList.push(getRegularTypeOfLiteralType(memberType));
46293
+ if (hasBindableName(member)) {
46294
+ const memberSymbol = getSymbolOfNode(member);
46295
+ const value = getEnumMemberValue(member);
46296
+ const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
46297
+ getSymbolLinks(memberSymbol).declaredType = memberType;
46298
+ memberTypeList.push(getRegularTypeOfLiteralType(memberType));
46299
+ }
46332
46300
  }
46333
46301
  }
46334
46302
  }
46335
46303
  }
46336
- if (memberTypeList.length) {
46337
- const enumType2 = getUnionType(memberTypeList, 1 /* Literal */, symbol, void 0);
46338
- if (enumType2.flags & 1048576 /* Union */) {
46339
- enumType2.flags |= 1024 /* EnumLiteral */;
46340
- enumType2.symbol = symbol;
46341
- }
46342
- return links.declaredType = enumType2;
46304
+ const enumType = memberTypeList.length ? getUnionType(memberTypeList, 1 /* Literal */, symbol, void 0) : createTypeWithSymbol(32 /* Enum */, symbol);
46305
+ if (enumType.flags & 1048576 /* Union */) {
46306
+ enumType.flags |= 1024 /* EnumLiteral */;
46307
+ enumType.symbol = symbol;
46343
46308
  }
46309
+ links.declaredType = enumType;
46344
46310
  }
46345
- const enumType = createType(32 /* Enum */);
46346
- enumType.symbol = symbol;
46347
- return links.declaredType = enumType;
46311
+ return links.declaredType;
46348
46312
  }
46349
46313
  function getDeclaredTypeOfEnumMember(symbol) {
46350
46314
  const links = getSymbolLinks(symbol);
@@ -48596,8 +48560,7 @@ function createTypeChecker(host) {
48596
48560
  return type;
48597
48561
  }
48598
48562
  function cloneTypeReference(source) {
48599
- const type = createType(source.flags);
48600
- type.symbol = source.symbol;
48563
+ const type = createTypeWithSymbol(source.flags, source.symbol);
48601
48564
  type.objectFlags = source.objectFlags;
48602
48565
  type.target = source.target;
48603
48566
  type.resolvedTypeArguments = source.resolvedTypeArguments;
@@ -50145,8 +50108,7 @@ function createTypeChecker(host) {
50145
50108
  return result;
50146
50109
  }
50147
50110
  function createStringMappingType(symbol, type) {
50148
- const result = createType(268435456 /* StringMapping */);
50149
- result.symbol = symbol;
50111
+ const result = createTypeWithSymbol(268435456 /* StringMapping */, symbol);
50150
50112
  result.type = type;
50151
50113
  return result;
50152
50114
  }
@@ -50960,8 +50922,7 @@ function createTypeChecker(host) {
50960
50922
  return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
50961
50923
  }
50962
50924
  function createLiteralType(flags, value, symbol, regularType) {
50963
- const type = createType(flags);
50964
- type.symbol = symbol;
50925
+ const type = createTypeWithSymbol(flags, symbol);
50965
50926
  type.value = value;
50966
50927
  type.regularType = regularType || type;
50967
50928
  return type;
@@ -50998,8 +50959,7 @@ function createTypeChecker(host) {
50998
50959
  }
50999
50960
  function getEnumLiteralType(value, enumId, symbol) {
51000
50961
  let type;
51001
- const qualifier = typeof value === "string" ? "@" : "#";
51002
- const key = enumId + qualifier + value;
50962
+ const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`;
51003
50963
  const flags = 1024 /* EnumLiteral */ | (typeof value === "string" ? 128 /* StringLiteral */ : 256 /* NumberLiteral */);
51004
50964
  return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type);
51005
50965
  }
@@ -51014,8 +50974,7 @@ function createTypeChecker(host) {
51014
50974
  return links.resolvedType;
51015
50975
  }
51016
50976
  function createUniqueESSymbolType(symbol) {
51017
- const type = createType(8192 /* UniqueESSymbol */);
51018
- type.symbol = symbol;
50977
+ const type = createTypeWithSymbol(8192 /* UniqueESSymbol */, symbol);
51019
50978
  type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
51020
50979
  return type;
51021
50980
  }
@@ -52256,19 +52215,20 @@ function createTypeChecker(host) {
52256
52215
  function isStringIndexSignatureOnlyType(type) {
52257
52216
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
52258
52217
  }
52259
- function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
52218
+ function isEnumTypeRelatedTo(source, target, errorReporter) {
52219
+ const sourceSymbol = source.flags & 8 /* EnumMember */ ? getParentOfSymbol(source) : source;
52220
+ const targetSymbol = target.flags & 8 /* EnumMember */ ? getParentOfSymbol(target) : target;
52260
52221
  if (sourceSymbol === targetSymbol) {
52261
52222
  return true;
52262
52223
  }
52224
+ if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
52225
+ return false;
52226
+ }
52263
52227
  const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
52264
52228
  const entry = enumRelation.get(id);
52265
52229
  if (entry !== void 0 && !(!(entry & 4 /* Reported */) && entry & 2 /* Failed */ && errorReporter)) {
52266
52230
  return !!(entry & 1 /* Succeeded */);
52267
52231
  }
52268
- if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
52269
- enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
52270
- return false;
52271
- }
52272
52232
  const targetEnumType = getTypeOfSymbol(targetSymbol);
52273
52233
  for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
52274
52234
  if (property.flags & 8 /* EnumMember */) {
@@ -52312,12 +52272,12 @@ function createTypeChecker(host) {
52312
52272
  return true;
52313
52273
  if (s & 12288 /* ESSymbolLike */ && t & 4096 /* ESSymbol */)
52314
52274
  return true;
52315
- if (s & 32 /* Enum */ && t & 32 /* Enum */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52275
+ if (s & 32 /* Enum */ && t & 32 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52316
52276
  return true;
52317
52277
  if (s & 1024 /* EnumLiteral */ && t & 1024 /* EnumLiteral */) {
52318
52278
  if (s & 1048576 /* Union */ && t & 1048576 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52319
52279
  return true;
52320
- if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
52280
+ if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52321
52281
  return true;
52322
52282
  }
52323
52283
  if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
@@ -53813,28 +53773,30 @@ function createTypeChecker(host) {
53813
53773
  }
53814
53774
  const sourceTypeArguments = getTypeArguments(source2);
53815
53775
  const targetTypeArguments = getTypeArguments(target2);
53816
- const startCount = Math.min(isTupleType(source2) ? getStartElementCount(source2.target, 11 /* NonRest */) : 0, getStartElementCount(target2.target, 11 /* NonRest */));
53817
- const endCount = Math.min(isTupleType(source2) ? getEndElementCount(source2.target, 11 /* NonRest */) : 0, targetRestFlag ? getEndElementCount(target2.target, 11 /* NonRest */) : 0);
53776
+ const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
53777
+ const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
53778
+ const targetHasRestElement = target2.target.hasRestElement;
53818
53779
  let canExcludeDiscriminants = !!excludedProperties;
53819
- for (let i = 0; i < targetArity; i++) {
53820
- const sourceIndex = i < targetArity - endCount ? i : i + sourceArity - targetArity;
53821
- const sourceFlags = isTupleType(source2) && (i < startCount || i >= targetArity - endCount) ? source2.target.elementFlags[sourceIndex] : 4 /* Rest */;
53822
- const targetFlags = target2.target.elementFlags[i];
53780
+ for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
53781
+ const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
53782
+ const sourcePositionFromEnd = sourceArity - 1 - sourcePosition;
53783
+ const targetPosition = targetHasRestElement && sourcePosition >= targetStartCount ? targetArity - 1 - Math.min(sourcePositionFromEnd, targetEndCount) : sourcePosition;
53784
+ const targetFlags = target2.target.elementFlags[targetPosition];
53823
53785
  if (targetFlags & 8 /* Variadic */ && !(sourceFlags & 8 /* Variadic */)) {
53824
53786
  if (reportErrors2) {
53825
- reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, i);
53787
+ reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, targetPosition);
53826
53788
  }
53827
53789
  return 0 /* False */;
53828
53790
  }
53829
53791
  if (sourceFlags & 8 /* Variadic */ && !(targetFlags & 12 /* Variable */)) {
53830
53792
  if (reportErrors2) {
53831
- reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourceIndex, i);
53793
+ reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourcePosition, targetPosition);
53832
53794
  }
53833
53795
  return 0 /* False */;
53834
53796
  }
53835
53797
  if (targetFlags & 1 /* Required */ && !(sourceFlags & 1 /* Required */)) {
53836
53798
  if (reportErrors2) {
53837
- reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, i);
53799
+ reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, targetPosition);
53838
53800
  }
53839
53801
  return 0 /* False */;
53840
53802
  }
@@ -53842,20 +53804,20 @@ function createTypeChecker(host) {
53842
53804
  if (sourceFlags & 12 /* Variable */ || targetFlags & 12 /* Variable */) {
53843
53805
  canExcludeDiscriminants = false;
53844
53806
  }
53845
- if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" + i))) {
53807
+ if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" + sourcePosition))) {
53846
53808
  continue;
53847
53809
  }
53848
53810
  }
53849
- const sourceType = !isTupleType(source2) ? sourceTypeArguments[0] : i < startCount || i >= targetArity - endCount ? removeMissingType(sourceTypeArguments[sourceIndex], !!(sourceFlags & targetFlags & 2 /* Optional */)) : getElementTypeOfSliceOfTupleType(source2, startCount, endCount) || neverType;
53850
- const targetType = targetTypeArguments[i];
53811
+ const sourceType = removeMissingType(sourceTypeArguments[sourcePosition], !!(sourceFlags & targetFlags & 2 /* Optional */));
53812
+ const targetType = targetTypeArguments[targetPosition];
53851
53813
  const targetCheckType = sourceFlags & 8 /* Variadic */ && targetFlags & 4 /* Rest */ ? createArrayType(targetType) : removeMissingType(targetType, !!(targetFlags & 2 /* Optional */));
53852
53814
  const related = isRelatedTo(sourceType, targetCheckType, 3 /* Both */, reportErrors2, void 0, intersectionState);
53853
53815
  if (!related) {
53854
53816
  if (reportErrors2 && (targetArity > 1 || sourceArity > 1)) {
53855
- if (i < startCount || i >= targetArity - endCount || sourceArity - startCount - endCount === 1) {
53856
- reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourceIndex, i);
53817
+ if (targetHasRestElement && sourcePosition >= targetStartCount && sourcePositionFromEnd >= targetEndCount && targetStartCount !== sourceArity - targetEndCount - 1) {
53818
+ reportIncompatibleError(Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, targetStartCount, sourceArity - targetEndCount - 1, targetPosition);
53857
53819
  } else {
53858
- reportIncompatibleError(Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, startCount, sourceArity - endCount - 1, i);
53820
+ reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourcePosition, targetPosition);
53859
53821
  }
53860
53822
  }
53861
53823
  return 0 /* False */;
@@ -55435,10 +55397,7 @@ function createTypeChecker(host) {
55435
55397
  return;
55436
55398
  }
55437
55399
  source = getUnionType(sources);
55438
- } else if (target.flags & 2097152 /* Intersection */ && some(
55439
- target.types,
55440
- (t) => !!getInferenceInfoForType(t) || isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)
55441
- )) {
55400
+ } else if (target.flags & 2097152 /* Intersection */ && !every(target.types, isNonGenericObjectType)) {
55442
55401
  if (!(source.flags & 1048576 /* Union */)) {
55443
55402
  const [sources, targets] = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo);
55444
55403
  if (sources.length === 0 || targets.length === 0) {
@@ -62667,7 +62626,7 @@ function createTypeChecker(host) {
62667
62626
  if (symbol && symbol.flags & 2097152 /* Alias */) {
62668
62627
  symbol = resolveAlias(symbol);
62669
62628
  }
62670
- return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */ && getEnumKind(symbol) === 1 /* Literal */);
62629
+ return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */);
62671
62630
  }
62672
62631
  return false;
62673
62632
  }
@@ -64592,7 +64551,7 @@ function createTypeChecker(host) {
64592
64551
  }
64593
64552
  }
64594
64553
  function checkExpressionCached(node, checkMode) {
64595
- if (checkMode && checkMode !== 0 /* Normal */) {
64554
+ if (checkMode) {
64596
64555
  return checkExpression(node, checkMode);
64597
64556
  }
64598
64557
  const links = getNodeLinks(node);
@@ -65609,9 +65568,6 @@ function createTypeChecker(host) {
65609
65568
  symbol.escapedName
65610
65569
  );
65611
65570
  }
65612
- if (type.flags & 32 /* Enum */ && symbol.flags & 8 /* EnumMember */) {
65613
- error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
65614
- }
65615
65571
  }
65616
65572
  }
65617
65573
  }
@@ -68935,7 +68891,7 @@ function createTypeChecker(host) {
68935
68891
  if (member.initializer) {
68936
68892
  return computeConstantValue(member);
68937
68893
  }
68938
- if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0 /* Numeric */) {
68894
+ if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)) {
68939
68895
  return void 0;
68940
68896
  }
68941
68897
  if (autoValue !== void 0) {
@@ -68945,134 +68901,140 @@ function createTypeChecker(host) {
68945
68901
  return void 0;
68946
68902
  }
68947
68903
  function computeConstantValue(member) {
68948
- const enumKind = getEnumKind(getSymbolOfNode(member.parent));
68949
68904
  const isConstEnum = isEnumConst(member.parent);
68950
68905
  const initializer = member.initializer;
68951
- const value = enumKind === 1 /* Literal */ && !isLiteralEnumMember(member) ? void 0 : evaluate(initializer);
68906
+ const value = evaluate(initializer, member);
68952
68907
  if (value !== void 0) {
68953
68908
  if (isConstEnum && typeof value === "number" && !isFinite(value)) {
68954
68909
  error(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);
68955
68910
  }
68956
- } else if (enumKind === 1 /* Literal */) {
68957
- error(initializer, Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members);
68958
- return 0;
68959
68911
  } else if (isConstEnum) {
68960
- error(initializer, Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
68912
+ error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
68961
68913
  } else if (member.parent.flags & 16777216 /* Ambient */) {
68962
68914
  error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
68963
68915
  } else {
68964
- const source = checkExpression(initializer);
68965
- if (!isTypeAssignableToKind(source, 296 /* NumberLike */)) {
68966
- error(initializer, Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead, typeToString(source));
68967
- } else {
68968
- checkTypeAssignableTo(source, getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), initializer, void 0);
68969
- }
68916
+ checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
68970
68917
  }
68971
68918
  return value;
68972
- function evaluate(expr) {
68973
- switch (expr.kind) {
68974
- case 221 /* PrefixUnaryExpression */:
68975
- const value2 = evaluate(expr.operand);
68976
- if (typeof value2 === "number") {
68977
- switch (expr.operator) {
68978
- case 39 /* PlusToken */:
68979
- return value2;
68980
- case 40 /* MinusToken */:
68981
- return -value2;
68982
- case 54 /* TildeToken */:
68983
- return ~value2;
68984
- }
68919
+ }
68920
+ function evaluate(expr, location) {
68921
+ switch (expr.kind) {
68922
+ case 221 /* PrefixUnaryExpression */:
68923
+ const value = evaluate(expr.operand, location);
68924
+ if (typeof value === "number") {
68925
+ switch (expr.operator) {
68926
+ case 39 /* PlusToken */:
68927
+ return value;
68928
+ case 40 /* MinusToken */:
68929
+ return -value;
68930
+ case 54 /* TildeToken */:
68931
+ return ~value;
68985
68932
  }
68986
- break;
68987
- case 223 /* BinaryExpression */:
68988
- const left = evaluate(expr.left);
68989
- const right = evaluate(expr.right);
68990
- if (typeof left === "number" && typeof right === "number") {
68991
- switch (expr.operatorToken.kind) {
68992
- case 51 /* BarToken */:
68993
- return left | right;
68994
- case 50 /* AmpersandToken */:
68995
- return left & right;
68996
- case 48 /* GreaterThanGreaterThanToken */:
68997
- return left >> right;
68998
- case 49 /* GreaterThanGreaterThanGreaterThanToken */:
68999
- return left >>> right;
69000
- case 47 /* LessThanLessThanToken */:
69001
- return left << right;
69002
- case 52 /* CaretToken */:
69003
- return left ^ right;
69004
- case 41 /* AsteriskToken */:
69005
- return left * right;
69006
- case 43 /* SlashToken */:
69007
- return left / right;
69008
- case 39 /* PlusToken */:
69009
- return left + right;
69010
- case 40 /* MinusToken */:
69011
- return left - right;
69012
- case 44 /* PercentToken */:
69013
- return left % right;
69014
- case 42 /* AsteriskAsteriskToken */:
69015
- return left ** right;
68933
+ }
68934
+ break;
68935
+ case 223 /* BinaryExpression */:
68936
+ const left = evaluate(expr.left, location);
68937
+ const right = evaluate(expr.right, location);
68938
+ if (typeof left === "number" && typeof right === "number") {
68939
+ switch (expr.operatorToken.kind) {
68940
+ case 51 /* BarToken */:
68941
+ return left | right;
68942
+ case 50 /* AmpersandToken */:
68943
+ return left & right;
68944
+ case 48 /* GreaterThanGreaterThanToken */:
68945
+ return left >> right;
68946
+ case 49 /* GreaterThanGreaterThanGreaterThanToken */:
68947
+ return left >>> right;
68948
+ case 47 /* LessThanLessThanToken */:
68949
+ return left << right;
68950
+ case 52 /* CaretToken */:
68951
+ return left ^ right;
68952
+ case 41 /* AsteriskToken */:
68953
+ return left * right;
68954
+ case 43 /* SlashToken */:
68955
+ return left / right;
68956
+ case 39 /* PlusToken */:
68957
+ return left + right;
68958
+ case 40 /* MinusToken */:
68959
+ return left - right;
68960
+ case 44 /* PercentToken */:
68961
+ return left % right;
68962
+ case 42 /* AsteriskAsteriskToken */:
68963
+ return left ** right;
68964
+ }
68965
+ } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 39 /* PlusToken */) {
68966
+ return "" + left + right;
68967
+ }
68968
+ break;
68969
+ case 10 /* StringLiteral */:
68970
+ case 14 /* NoSubstitutionTemplateLiteral */:
68971
+ return expr.text;
68972
+ case 225 /* TemplateExpression */:
68973
+ return evaluateTemplateExpression(expr, location);
68974
+ case 8 /* NumericLiteral */:
68975
+ checkGrammarNumericLiteral(expr);
68976
+ return +expr.text;
68977
+ case 214 /* ParenthesizedExpression */:
68978
+ return evaluate(expr.expression, location);
68979
+ case 79 /* Identifier */:
68980
+ if (isInfinityOrNaNString(expr.escapedText)) {
68981
+ return +expr.escapedText;
68982
+ }
68983
+ case 208 /* PropertyAccessExpression */:
68984
+ if (isEntityNameExpression(expr)) {
68985
+ const symbol = resolveEntityName(expr, 111551 /* Value */, true);
68986
+ if (symbol) {
68987
+ if (symbol.flags & 8 /* EnumMember */) {
68988
+ return evaluateEnumMember(expr, symbol, location);
69016
68989
  }
69017
- } else if (typeof left === "string" && typeof right === "string" && expr.operatorToken.kind === 39 /* PlusToken */) {
69018
- return left + right;
69019
- }
69020
- break;
69021
- case 10 /* StringLiteral */:
69022
- case 14 /* NoSubstitutionTemplateLiteral */:
69023
- return expr.text;
69024
- case 8 /* NumericLiteral */:
69025
- checkGrammarNumericLiteral(expr);
69026
- return +expr.text;
69027
- case 214 /* ParenthesizedExpression */:
69028
- return evaluate(expr.expression);
69029
- case 79 /* Identifier */:
69030
- const identifier = expr;
69031
- if (isInfinityOrNaNString(identifier.escapedText)) {
69032
- return +identifier.escapedText;
69033
- }
69034
- return nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
69035
- case 209 /* ElementAccessExpression */:
69036
- case 208 /* PropertyAccessExpression */:
69037
- if (isConstantMemberAccess(expr)) {
69038
- const type = getTypeOfExpression(expr.expression);
69039
- if (type.symbol && type.symbol.flags & 384 /* Enum */) {
69040
- let name;
69041
- if (expr.kind === 208 /* PropertyAccessExpression */) {
69042
- name = expr.name.escapedText;
69043
- } else {
69044
- name = escapeLeadingUnderscores(cast(expr.argumentExpression, isLiteralExpression).text);
68990
+ if (isConstVariable(symbol)) {
68991
+ const declaration = symbol.valueDeclaration;
68992
+ if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
68993
+ return evaluate(declaration.initializer, declaration);
69045
68994
  }
69046
- return evaluateEnumMember(expr, type.symbol, name);
69047
68995
  }
69048
68996
  }
69049
- break;
69050
- }
69051
- return void 0;
69052
- }
69053
- function evaluateEnumMember(expr, enumSymbol, name) {
69054
- const memberSymbol = enumSymbol.exports.get(name);
69055
- if (memberSymbol) {
69056
- const declaration = memberSymbol.valueDeclaration;
69057
- if (declaration !== member) {
69058
- if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && isEnumDeclaration(declaration.parent)) {
69059
- return getEnumMemberValue(declaration);
68997
+ }
68998
+ break;
68999
+ case 209 /* ElementAccessExpression */:
69000
+ const root = expr.expression;
69001
+ if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
69002
+ const rootSymbol = resolveEntityName(root, 111551 /* Value */, true);
69003
+ if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
69004
+ const name = escapeLeadingUnderscores(expr.argumentExpression.text);
69005
+ const member = rootSymbol.exports.get(name);
69006
+ if (member) {
69007
+ return evaluateEnumMember(expr, member, location);
69008
+ }
69060
69009
  }
69061
- error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
69062
- return 0;
69063
- } else {
69064
- error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol));
69065
69010
  }
69066
- }
69011
+ break;
69012
+ }
69013
+ return void 0;
69014
+ }
69015
+ function evaluateEnumMember(expr, symbol, location) {
69016
+ const declaration = symbol.valueDeclaration;
69017
+ if (!declaration || declaration === location) {
69018
+ error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
69067
69019
  return void 0;
69068
69020
  }
69021
+ if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
69022
+ error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
69023
+ return 0;
69024
+ }
69025
+ return getEnumMemberValue(declaration);
69069
69026
  }
69070
- function isConstantMemberAccess(node) {
69071
- const type = getTypeOfExpression(node);
69072
- if (type === errorType) {
69073
- return false;
69027
+ function evaluateTemplateExpression(expr, location) {
69028
+ let result = expr.head.text;
69029
+ for (const span of expr.templateSpans) {
69030
+ const value = evaluate(span.expression, location);
69031
+ if (value === void 0) {
69032
+ return void 0;
69033
+ }
69034
+ result += value;
69035
+ result += span.literal.text;
69074
69036
  }
69075
- return node.kind === 79 /* Identifier */ || node.kind === 208 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || node.kind === 209 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && isStringLiteralLike(node.argumentExpression);
69037
+ return result;
69076
69038
  }
69077
69039
  function checkEnumDeclaration(node) {
69078
69040
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
@@ -69118,6 +69080,9 @@ function createTypeChecker(host) {
69118
69080
  if (isPrivateIdentifier(node.name)) {
69119
69081
  error(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
69120
69082
  }
69083
+ if (node.initializer) {
69084
+ checkExpression(node.initializer);
69085
+ }
69121
69086
  }
69122
69087
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
69123
69088
  const declarations = symbol.declarations;
@@ -92357,17 +92322,19 @@ function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host)
92357
92322
  });
92358
92323
  }
92359
92324
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
92325
+ var _a2, _b;
92326
+ (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Emit, "emitUsingBuildInfo", {}, true);
92327
+ ts_performance_exports.mark("beforeEmit");
92328
+ const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
92329
+ ts_performance_exports.mark("afterEmit");
92330
+ ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
92331
+ (_b = tracing) == null ? void 0 : _b.pop();
92332
+ return result;
92333
+ }
92334
+ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
92360
92335
  const createHash = maybeBind(host, host.createHash);
92361
92336
  const { buildInfoPath, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(config.options, false);
92362
- let buildInfo;
92363
- if (host.getBuildInfo) {
92364
- buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92365
- } else {
92366
- const buildInfoText = host.readFile(buildInfoPath);
92367
- if (!buildInfoText)
92368
- return buildInfoPath;
92369
- buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
92370
- }
92337
+ const buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92371
92338
  if (!buildInfo)
92372
92339
  return buildInfoPath;
92373
92340
  if (!buildInfo.bundle || !buildInfo.bundle.js || declarationFilePath && !buildInfo.bundle.dts)
@@ -92393,21 +92360,21 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
92393
92360
  if (declarationMapPath && computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
92394
92361
  return declarationMapPath;
92395
92362
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
92396
- const ownPrependInput = createInputFiles(
92363
+ const ownPrependInput = createInputFilesWithFileTexts(
92364
+ jsFilePath,
92397
92365
  jsFileText,
92398
- declarationText,
92399
92366
  sourceMapFilePath,
92400
92367
  sourceMapText,
92368
+ declarationFilePath,
92369
+ declarationText,
92401
92370
  declarationMapPath,
92402
92371
  declarationMapText,
92403
- jsFilePath,
92404
- declarationFilePath,
92405
92372
  buildInfoPath,
92406
92373
  buildInfo,
92407
92374
  true
92408
92375
  );
92409
92376
  const outputFiles = [];
92410
- const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f));
92377
+ const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f), host);
92411
92378
  const sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
92412
92379
  let changedDtsText;
92413
92380
  let changedDtsData;
@@ -97058,14 +97025,12 @@ function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, ge
97058
97025
  function createCompilerHost(options, setParentNodes) {
97059
97026
  return createCompilerHostWorker(options, setParentNodes);
97060
97027
  }
97061
- function createCompilerHostWorker(options, setParentNodes, system = sys) {
97062
- const existingDirectories = new Map();
97063
- const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
97064
- function getSourceFile(fileName, languageVersionOrOptions, onError) {
97028
+ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
97029
+ return (fileName, languageVersionOrOptions, onError) => {
97065
97030
  let text;
97066
97031
  try {
97067
97032
  mark("beforeIORead");
97068
- text = compilerHost.readFile(fileName);
97033
+ text = readFile(fileName, getCompilerOptions().charset);
97069
97034
  mark("afterIORead");
97070
97035
  measure("I/O Read", "beforeIORead", "afterIORead");
97071
97036
  } catch (e) {
@@ -97075,27 +97040,19 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
97075
97040
  text = "";
97076
97041
  }
97077
97042
  return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
97078
- }
97079
- function directoryExists(directoryPath) {
97080
- if (existingDirectories.has(directoryPath)) {
97081
- return true;
97082
- }
97083
- if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
97084
- existingDirectories.set(directoryPath, true);
97085
- return true;
97086
- }
97087
- return false;
97088
- }
97089
- function writeFile2(fileName, data, writeByteOrderMark, onError) {
97043
+ };
97044
+ }
97045
+ function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
97046
+ return (fileName, data, writeByteOrderMark, onError) => {
97090
97047
  try {
97091
97048
  mark("beforeIOWrite");
97092
97049
  writeFileEnsuringDirectories(
97093
97050
  fileName,
97094
97051
  data,
97095
97052
  writeByteOrderMark,
97096
- (path, data2, writeByteOrderMark2) => system.writeFile(path, data2, writeByteOrderMark2),
97097
- (path) => (compilerHost.createDirectory || system.createDirectory)(path),
97098
- (path) => directoryExists(path)
97053
+ actualWriteFile,
97054
+ createDirectory,
97055
+ directoryExists
97099
97056
  );
97100
97057
  mark("afterIOWrite");
97101
97058
  measure("I/O Write", "beforeIOWrite", "afterIOWrite");
@@ -97104,6 +97061,20 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
97104
97061
  onError(e.message);
97105
97062
  }
97106
97063
  }
97064
+ };
97065
+ }
97066
+ function createCompilerHostWorker(options, setParentNodes, system = sys) {
97067
+ const existingDirectories = new Map();
97068
+ const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
97069
+ function directoryExists(directoryPath) {
97070
+ if (existingDirectories.has(directoryPath)) {
97071
+ return true;
97072
+ }
97073
+ if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
97074
+ existingDirectories.set(directoryPath, true);
97075
+ return true;
97076
+ }
97077
+ return false;
97107
97078
  }
97108
97079
  function getDefaultLibLocation() {
97109
97080
  return getDirectoryPath(normalizePath(system.getExecutingFilePath()));
@@ -97111,10 +97082,14 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
97111
97082
  const newLine = getNewLineCharacter(options, () => system.newLine);
97112
97083
  const realpath = system.realpath && ((path) => system.realpath(path));
97113
97084
  const compilerHost = {
97114
- getSourceFile,
97085
+ getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
97115
97086
  getDefaultLibLocation,
97116
97087
  getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
97117
- writeFile: writeFile2,
97088
+ writeFile: createWriteFileMeasuringIO(
97089
+ (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
97090
+ (path) => (compilerHost.createDirectory || system.createDirectory)(path),
97091
+ (path) => directoryExists(path)
97092
+ ),
97118
97093
  getCurrentDirectory: memoize(() => system.getCurrentDirectory()),
97119
97094
  useCaseSensitiveFileNames: () => system.useCaseSensitiveFileNames,
97120
97095
  getCanonicalFileName,
@@ -98458,7 +98433,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
98458
98433
  const path = toPath3(fileName);
98459
98434
  const sourceFile = getSourceFileByPath(path);
98460
98435
  return sourceFile ? sourceFile.text : filesByName.has(path) ? void 0 : host.readFile(path);
98461
- }
98436
+ },
98437
+ host
98462
98438
  );
98463
98439
  }
98464
98440
  function isSourceFileFromExternalLibrary(file) {
@@ -100244,7 +100220,7 @@ function parseConfigHostFromCompilerHostLike(host, directoryStructureHost = host
100244
100220
  trace: host.trace ? (s) => host.trace(s) : void 0
100245
100221
  };
100246
100222
  }
100247
- function createPrependNodes(projectReferences, getCommandLine, readFile) {
100223
+ function createPrependNodes(projectReferences, getCommandLine, readFile, host) {
100248
100224
  if (!projectReferences)
100249
100225
  return emptyArray;
100250
100226
  let nodes;
@@ -100256,7 +100232,7 @@ function createPrependNodes(projectReferences, getCommandLine, readFile) {
100256
100232
  if (!out)
100257
100233
  continue;
100258
100234
  const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(resolvedRefOpts.options, true);
100259
- const node = createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath);
100235
+ const node = createInputFilesWithFilePaths(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath, host, resolvedRefOpts.options);
100260
100236
  (nodes || (nodes = [])).push(node);
100261
100237
  }
100262
100238
  }
@@ -100450,7 +100426,8 @@ var BuilderState;
100450
100426
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
100451
100427
  var _a2, _b, _c;
100452
100428
  const fileInfos = new Map();
100453
- const referencedMap = newProgram.getCompilerOptions().module !== 0 /* None */ ? createManyToManyPathMap() : void 0;
100429
+ const options = newProgram.getCompilerOptions();
100430
+ const referencedMap = options.module !== 0 /* None */ && !outFile(options) ? createManyToManyPathMap() : void 0;
100454
100431
  const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
100455
100432
  const useOldState = canReuseOldState(referencedMap, oldState);
100456
100433
  newProgram.getTypeChecker();
@@ -100898,7 +100875,7 @@ function getNextAffectedFilePendingEmit(state) {
100898
100875
  const seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = new Map());
100899
100876
  for (let i = state.affectedFilesPendingEmitIndex; i < affectedFilesPendingEmit.length; i++) {
100900
100877
  const affectedFile = Debug.checkDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]);
100901
- if (affectedFile) {
100878
+ if (affectedFile && sourceFileMayBeEmitted(affectedFile, state.program)) {
100902
100879
  const seenKind = seenEmittedFiles.get(affectedFile.resolvedPath);
100903
100880
  const emitKind = Debug.checkDefined(Debug.checkDefined(state.affectedFilesPendingEmitKind).get(affectedFile.resolvedPath));
100904
100881
  if (seenKind === void 0 || seenKind < emitKind) {
@@ -101203,6 +101180,9 @@ function getProgramBuildInfo(state, getCanonicalFileName) {
101203
101180
  const seenFiles = new Set();
101204
101181
  for (const path of state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(compareStringsCaseSensitive)) {
101205
101182
  if (tryAddToSet(seenFiles, path)) {
101183
+ const file = state.program.getSourceFileByPath(path);
101184
+ if (!sourceFileMayBeEmitted(file, state.program))
101185
+ continue;
101206
101186
  const fileId = toFileId(path), emitKind = state.affectedFilesPendingEmitKind.get(path);
101207
101187
  (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
101208
101188
  emitKind === 1 /* Full */ ? fileId : [fileId]
@@ -102976,24 +102956,18 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
102976
102956
  const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
102977
102957
  const hostGetNewLine = memoize(() => host.getNewLine());
102978
102958
  return {
102979
- getSourceFile: (fileName, languageVersionOrOptions, onError) => {
102980
- let text;
102981
- try {
102982
- mark("beforeIORead");
102983
- text = host.readFile(fileName, getCompilerOptions().charset);
102984
- mark("afterIORead");
102985
- measure("I/O Read", "beforeIORead", "afterIORead");
102986
- } catch (e) {
102987
- if (onError) {
102988
- onError(e.message);
102989
- }
102990
- text = "";
102991
- }
102992
- return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions) : void 0;
102993
- },
102959
+ getSourceFile: createGetSourceFile(
102960
+ (fileName, encoding) => host.readFile(fileName, encoding),
102961
+ getCompilerOptions,
102962
+ void 0
102963
+ ),
102994
102964
  getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
102995
102965
  getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
102996
- writeFile: writeFile2,
102966
+ writeFile: createWriteFileMeasuringIO(
102967
+ (path, data, writeByteOrderMark) => host.writeFile(path, data, writeByteOrderMark),
102968
+ (path) => host.createDirectory(path),
102969
+ (path) => host.directoryExists(path)
102970
+ ),
102997
102971
  getCurrentDirectory: memoize(() => host.getCurrentDirectory()),
102998
102972
  useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
102999
102973
  getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames),
@@ -103010,25 +102984,6 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
103010
102984
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
103011
102985
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
103012
102986
  };
103013
- function writeFile2(fileName, text, writeByteOrderMark, onError) {
103014
- try {
103015
- mark("beforeIOWrite");
103016
- writeFileEnsuringDirectories(
103017
- fileName,
103018
- text,
103019
- writeByteOrderMark,
103020
- (path, data, writeByteOrderMark2) => host.writeFile(path, data, writeByteOrderMark2),
103021
- (path) => host.createDirectory(path),
103022
- (path) => host.directoryExists(path)
103023
- );
103024
- mark("afterIOWrite");
103025
- measure("I/O Write", "beforeIOWrite", "afterIOWrite");
103026
- } catch (e) {
103027
- if (onError) {
103028
- onError(e.message);
103029
- }
103030
- }
103031
- }
103032
102987
  }
103033
102988
  function setGetSourceFileAsHashVersioned(compilerHost, host) {
103034
102989
  const originalGetSourceFile = compilerHost.getSourceFile;
@@ -104489,7 +104444,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
104489
104444
  return emitDiagnostics;
104490
104445
  }
104491
104446
  function emitBundle(writeFileCallback, customTransformers) {
104492
- var _a2, _b;
104447
+ var _a2, _b, _c, _d;
104493
104448
  Debug.assert(kind === 1 /* UpdateBundle */);
104494
104449
  if (state.options.dry) {
104495
104450
  reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
@@ -104501,6 +104456,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
104501
104456
  reportStatus(state, Diagnostics.Updating_output_of_project_0, project);
104502
104457
  const { compilerHost } = state;
104503
104458
  state.projectCompilerOptions = config.options;
104459
+ (_b = (_a2 = state.host).beforeEmitBundle) == null ? void 0 : _b.call(_a2, config);
104504
104460
  const outputFiles = emitUsingBuildInfo(
104505
104461
  config,
104506
104462
  compilerHost,
@@ -104508,7 +104464,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
104508
104464
  const refName = resolveProjectName(state, ref.path);
104509
104465
  return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
104510
104466
  },
104511
- customTransformers || ((_b = (_a2 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a2, project))
104467
+ customTransformers || ((_d = (_c = state.host).getCustomTransformers) == null ? void 0 : _d.call(_c, project))
104512
104468
  );
104513
104469
  if (isString(outputFiles)) {
104514
104470
  reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
@@ -106250,14 +106206,17 @@ function performBuild(sys2, cb, buildOptions, watchOptions, projects, errors) {
106250
106206
  const solutionPerformance2 = enableSolutionPerformance(sys2, buildOptions);
106251
106207
  updateSolutionBuilderHost(sys2, cb, buildHost2, solutionPerformance2);
106252
106208
  const onWatchStatusChange = buildHost2.onWatchStatusChange;
106209
+ let reportBuildStatistics = false;
106253
106210
  buildHost2.onWatchStatusChange = (d, newLine, options, errorCount) => {
106254
106211
  onWatchStatusChange == null ? void 0 : onWatchStatusChange(d, newLine, options, errorCount);
106255
- if (d.code === Diagnostics.Found_0_errors_Watching_for_file_changes.code || d.code === Diagnostics.Found_1_error_Watching_for_file_changes.code) {
106212
+ if (reportBuildStatistics && (d.code === Diagnostics.Found_0_errors_Watching_for_file_changes.code || d.code === Diagnostics.Found_1_error_Watching_for_file_changes.code)) {
106256
106213
  reportSolutionBuilderTimes(builder2, solutionPerformance2);
106257
106214
  }
106258
106215
  };
106259
106216
  const builder2 = createSolutionBuilderWithWatch(buildHost2, projects, buildOptions, watchOptions);
106260
106217
  builder2.build();
106218
+ reportSolutionBuilderTimes(builder2, solutionPerformance2);
106219
+ reportBuildStatistics = true;
106261
106220
  return builder2;
106262
106221
  }
106263
106222
  const buildHost = createSolutionBuilderHost(
@@ -106329,7 +106288,11 @@ function updateSolutionBuilderHost(sys2, cb, buildHost, solutionPerformance) {
106329
106288
  reportStatistics(sys2, program.getProgram(), solutionPerformance);
106330
106289
  cb(program);
106331
106290
  };
106332
- buildHost.afterEmitBundle = cb;
106291
+ buildHost.beforeEmitBundle = (config) => enableStatisticsAndTracing(sys2, config.options, true);
106292
+ buildHost.afterEmitBundle = (config) => {
106293
+ reportStatistics(sys2, config, solutionPerformance);
106294
+ cb(config);
106295
+ };
106333
106296
  }
106334
106297
  function updateCreateProgram(sys2, host, isBuildMode) {
106335
106298
  const compileUsingBuilder = host.createProgram;
@@ -106434,6 +106397,7 @@ function reportSolutionBuilderTimes(builder, solutionPerformance) {
106434
106397
  });
106435
106398
  disable();
106436
106399
  enable();
106400
+ solutionPerformance.clear();
106437
106401
  reportAllStatistics(sys, statistics);
106438
106402
  function reportSolutionBuilderCountStatistic(name) {
106439
106403
  const value = getCount(name);
@@ -106466,9 +106430,14 @@ function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
106466
106430
  function isSolutionMarkOrMeasure(name) {
106467
106431
  return startsWith(name, "SolutionBuilder::");
106468
106432
  }
106469
- function reportStatistics(sys2, program, solutionPerformance) {
106433
+ function isProgram(programOrConfig) {
106434
+ return !programOrConfig.options;
106435
+ }
106436
+ function reportStatistics(sys2, programOrConfig, solutionPerformance) {
106470
106437
  var _a2;
106471
- const compilerOptions = program.getCompilerOptions();
106438
+ const program = isProgram(programOrConfig) ? programOrConfig : void 0;
106439
+ const config = isProgram(programOrConfig) ? void 0 : programOrConfig;
106440
+ const compilerOptions = program ? program.getCompilerOptions() : config.options;
106472
106441
  if (canTrace(sys2, compilerOptions)) {
106473
106442
  (_a2 = tracing) == null ? void 0 : _a2.stopTracing();
106474
106443
  }
@@ -106476,19 +106445,21 @@ function reportStatistics(sys2, program, solutionPerformance) {
106476
106445
  if (canReportDiagnostics(sys2, compilerOptions)) {
106477
106446
  statistics = [];
106478
106447
  const memoryUsed = sys2.getMemoryUsage ? sys2.getMemoryUsage() : -1;
106479
- reportCountStatistic("Files", program.getSourceFiles().length);
106480
- const lineCounts = countLines(program);
106481
- if (compilerOptions.extendedDiagnostics) {
106482
- for (const key of arrayFrom(lineCounts.keys())) {
106483
- reportCountStatistic("Lines of " + key, lineCounts.get(key));
106448
+ if (program) {
106449
+ reportCountStatistic("Files", program.getSourceFiles().length);
106450
+ const lineCounts = countLines(program);
106451
+ if (compilerOptions.extendedDiagnostics) {
106452
+ for (const key of arrayFrom(lineCounts.keys())) {
106453
+ reportCountStatistic("Lines of " + key, lineCounts.get(key));
106454
+ }
106455
+ } else {
106456
+ reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum2, count) => sum2 + count, 0));
106484
106457
  }
106485
- } else {
106486
- reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum2, count) => sum2 + count, 0));
106458
+ reportCountStatistic("Identifiers", program.getIdentifierCount());
106459
+ reportCountStatistic("Symbols", program.getSymbolCount());
106460
+ reportCountStatistic("Types", program.getTypeCount());
106461
+ reportCountStatistic("Instantiations", program.getInstantiationCount());
106487
106462
  }
106488
- reportCountStatistic("Identifiers", program.getIdentifierCount());
106489
- reportCountStatistic("Symbols", program.getSymbolCount());
106490
- reportCountStatistic("Types", program.getTypeCount());
106491
- reportCountStatistic("Instantiations", program.getInstantiationCount());
106492
106463
  if (memoryUsed >= 0) {
106493
106464
  reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: 2 /* memory */ }, true);
106494
106465
  }
@@ -106498,11 +106469,13 @@ function reportStatistics(sys2, program, solutionPerformance) {
106498
106469
  const checkTime = isPerformanceEnabled ? getDuration("Check") : 0;
106499
106470
  const emitTime = isPerformanceEnabled ? getDuration("Emit") : 0;
106500
106471
  if (compilerOptions.extendedDiagnostics) {
106501
- const caches = program.getRelationCacheSizes();
106502
- reportCountStatistic("Assignability cache size", caches.assignable);
106503
- reportCountStatistic("Identity cache size", caches.identity);
106504
- reportCountStatistic("Subtype cache size", caches.subtype);
106505
- reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
106472
+ if (program) {
106473
+ const caches = program.getRelationCacheSizes();
106474
+ reportCountStatistic("Assignability cache size", caches.assignable);
106475
+ reportCountStatistic("Identity cache size", caches.identity);
106476
+ reportCountStatistic("Subtype cache size", caches.subtype);
106477
+ reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
106478
+ }
106506
106479
  if (isPerformanceEnabled) {
106507
106480
  forEachMeasure((name, duration) => {
106508
106481
  if (!isSolutionMarkOrMeasure(name))