@typescript-deploys/pr-build 5.2.0-pr-54546-4 → 5.2.0-pr-54581-2

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.
@@ -60,7 +60,7 @@ interface ReadonlyMap<K, V> {
60
60
  readonly size: number;
61
61
  }
62
62
 
63
- interface WeakMap<K extends object, V> {
63
+ interface WeakMap<K extends WeakKey, V> {
64
64
  /**
65
65
  * Removes the specified element from the WeakMap.
66
66
  * @returns true if the element was successfully removed, or false if it was not present.
@@ -76,14 +76,14 @@ interface WeakMap<K extends object, V> {
76
76
  has(key: K): boolean;
77
77
  /**
78
78
  * Adds a new element with a specified key and value.
79
- * @param key Must be an object.
79
+ * @param key Must be an object or symbol.
80
80
  */
81
81
  set(key: K, value: V): this;
82
82
  }
83
83
 
84
84
  interface WeakMapConstructor {
85
- new <K extends object = object, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
86
- readonly prototype: WeakMap<object, any>;
85
+ new <K extends WeakKey = WeakKey, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
86
+ readonly prototype: WeakMap<WeakKey, any>;
87
87
  }
88
88
  declare var WeakMap: WeakMapConstructor;
89
89
 
@@ -125,9 +125,9 @@ interface ReadonlySet<T> {
125
125
  readonly size: number;
126
126
  }
127
127
 
128
- interface WeakSet<T extends object> {
128
+ interface WeakSet<T extends WeakKey> {
129
129
  /**
130
- * Appends a new object to the end of the WeakSet.
130
+ * Appends a new value to the end of the WeakSet.
131
131
  */
132
132
  add(value: T): this;
133
133
  /**
@@ -136,13 +136,13 @@ interface WeakSet<T extends object> {
136
136
  */
137
137
  delete(value: T): boolean;
138
138
  /**
139
- * @returns a boolean indicating whether an object exists in the WeakSet or not.
139
+ * @returns a boolean indicating whether a value exists in the WeakSet or not.
140
140
  */
141
141
  has(value: T): boolean;
142
142
  }
143
143
 
144
144
  interface WeakSetConstructor {
145
- new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
146
- readonly prototype: WeakSet<object>;
145
+ new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
146
+ readonly prototype: WeakSet<WeakKey>;
147
147
  }
148
148
  declare var WeakSet: WeakSetConstructor;
@@ -159,10 +159,10 @@ interface MapConstructor {
159
159
  new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
160
160
  }
161
161
 
162
- interface WeakMap<K extends object, V> { }
162
+ interface WeakMap<K extends WeakKey, V> { }
163
163
 
164
164
  interface WeakMapConstructor {
165
- new <K extends object, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
165
+ new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
166
166
  }
167
167
 
168
168
  interface Set<T> {
@@ -207,10 +207,10 @@ interface SetConstructor {
207
207
  new <T>(iterable?: Iterable<T> | null): Set<T>;
208
208
  }
209
209
 
210
- interface WeakSet<T extends object> { }
210
+ interface WeakSet<T extends WeakKey> { }
211
211
 
212
212
  interface WeakSetConstructor {
213
- new <T extends object = object>(iterable: Iterable<T>): WeakSet<T>;
213
+ new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;
214
214
  }
215
215
 
216
216
  interface Promise<T> { }
@@ -137,7 +137,7 @@ interface Map<K, V> {
137
137
  readonly [Symbol.toStringTag]: string;
138
138
  }
139
139
 
140
- interface WeakMap<K extends object, V> {
140
+ interface WeakMap<K extends WeakKey, V> {
141
141
  readonly [Symbol.toStringTag]: string;
142
142
  }
143
143
 
@@ -145,7 +145,7 @@ interface Set<T> {
145
145
  readonly [Symbol.toStringTag]: string;
146
146
  }
147
147
 
148
- interface WeakSet<T extends object> {
148
+ interface WeakSet<T extends WeakKey> {
149
149
  readonly [Symbol.toStringTag]: string;
150
150
  }
151
151
 
@@ -16,12 +16,13 @@ and limitations under the License.
16
16
 
17
17
  /// <reference no-default-lib="true"/>
18
18
 
19
- interface WeakRef<T extends object> {
19
+ interface WeakRef<T extends WeakKey> {
20
20
  readonly [Symbol.toStringTag]: "WeakRef";
21
21
 
22
22
  /**
23
- * Returns the WeakRef instance's target object, or undefined if the target object has been
23
+ * Returns the WeakRef instance's target value, or undefined if the target value has been
24
24
  * reclaimed.
25
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
25
26
  */
26
27
  deref(): T | undefined;
27
28
  }
@@ -30,10 +31,11 @@ interface WeakRefConstructor {
30
31
  readonly prototype: WeakRef<any>;
31
32
 
32
33
  /**
33
- * Creates a WeakRef instance for the given target object.
34
- * @param target The target object for the WeakRef instance.
34
+ * Creates a WeakRef instance for the given target value.
35
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
36
+ * @param target The target value for the WeakRef instance.
35
37
  */
36
- new<T extends object>(target: T): WeakRef<T>;
38
+ new<T extends WeakKey>(target: T): WeakRef<T>;
37
39
  }
38
40
 
39
41
  declare var WeakRef: WeakRefConstructor;
@@ -42,22 +44,23 @@ interface FinalizationRegistry<T> {
42
44
  readonly [Symbol.toStringTag]: "FinalizationRegistry";
43
45
 
44
46
  /**
45
- * Registers an object with the registry.
46
- * @param target The target object to register.
47
- * @param heldValue The value to pass to the finalizer for this object. This cannot be the
48
- * target object.
47
+ * Registers a value with the registry.
48
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
49
+ * @param target The target value to register.
50
+ * @param heldValue The value to pass to the finalizer for this value. This cannot be the
51
+ * target value.
49
52
  * @param unregisterToken The token to pass to the unregister method to unregister the target
50
- * object. If provided (and not undefined), this must be an object. If not provided, the target
51
- * cannot be unregistered.
53
+ * value. If not provided, the target cannot be unregistered.
52
54
  */
53
- register(target: object, heldValue: T, unregisterToken?: object): void;
55
+ register(target: WeakKey, heldValue: T, unregisterToken?: WeakKey): void;
54
56
 
55
57
  /**
56
- * Unregisters an object from the registry.
58
+ * Unregisters a value from the registry.
59
+ * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.
57
60
  * @param unregisterToken The token that was used as the unregisterToken argument when calling
58
- * register to register the target object.
61
+ * register to register the target value.
59
62
  */
60
- unregister(unregisterToken: object): void;
63
+ unregister(unregisterToken: WeakKey): void;
61
64
  }
62
65
 
63
66
  interface FinalizationRegistryConstructor {
@@ -65,7 +68,7 @@ interface FinalizationRegistryConstructor {
65
68
 
66
69
  /**
67
70
  * Creates a finalization registry with an associated cleanup callback
68
- * @param cleanupCallback The callback to call after an object in the registry has been reclaimed.
71
+ * @param cleanupCallback The callback to call after a value in the registry has been reclaimed.
69
72
  */
70
73
  new<T>(cleanupCallback: (heldValue: T) => void): FinalizationRegistry<T>;
71
74
  }
@@ -0,0 +1,21 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface WeakKeyTypes {
20
+ symbol: symbol;
21
+ }
@@ -18,3 +18,4 @@ and limitations under the License.
18
18
 
19
19
  /// <reference lib="es2022" />
20
20
  /// <reference lib="es2023.array" />
21
+ /// <reference lib="es2023.collection" />
package/lib/lib.es5.d.ts CHANGED
@@ -1665,6 +1665,15 @@ type Uncapitalize<S extends string> = intrinsic;
1665
1665
  */
1666
1666
  interface ThisType<T> { }
1667
1667
 
1668
+ /**
1669
+ * Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry
1670
+ */
1671
+ interface WeakKeyTypes {
1672
+ object: object;
1673
+ }
1674
+
1675
+ type WeakKey = WeakKeyTypes[keyof WeakKeyTypes];
1676
+
1668
1677
  /**
1669
1678
  * Represents a raw buffer of binary data, which is used to store data for the
1670
1679
  * different typed arrays. ArrayBuffers cannot be read from or written to directly,
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230605`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230609`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1600,6 +1600,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1600
1600
  );
1601
1601
  }
1602
1602
  Debug2.formatSnippetKind = formatSnippetKind;
1603
+ function formatScriptKind(kind) {
1604
+ return formatEnum(
1605
+ kind,
1606
+ ScriptKind,
1607
+ /*isFlags*/
1608
+ false
1609
+ );
1610
+ }
1611
+ Debug2.formatScriptKind = formatScriptKind;
1603
1612
  function formatNodeFlags(flags) {
1604
1613
  return formatEnum(
1605
1614
  flags,
@@ -3787,6 +3796,17 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
3787
3796
  ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
3788
3797
  return ModuleKind2;
3789
3798
  })(ModuleKind || {});
3799
+ var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
3800
+ ScriptKind3[ScriptKind3["Unknown"] = 0] = "Unknown";
3801
+ ScriptKind3[ScriptKind3["JS"] = 1] = "JS";
3802
+ ScriptKind3[ScriptKind3["JSX"] = 2] = "JSX";
3803
+ ScriptKind3[ScriptKind3["TS"] = 3] = "TS";
3804
+ ScriptKind3[ScriptKind3["TSX"] = 4] = "TSX";
3805
+ ScriptKind3[ScriptKind3["External"] = 5] = "External";
3806
+ ScriptKind3[ScriptKind3["JSON"] = 6] = "JSON";
3807
+ ScriptKind3[ScriptKind3["Deferred"] = 7] = "Deferred";
3808
+ return ScriptKind3;
3809
+ })(ScriptKind || {});
3790
3810
  var TransformFlags = /* @__PURE__ */ ((TransformFlags3) => {
3791
3811
  TransformFlags3[TransformFlags3["None"] = 0] = "None";
3792
3812
  TransformFlags3[TransformFlags3["ContainsTypeScript"] = 1] = "ContainsTypeScript";
@@ -6138,7 +6158,6 @@ var Diagnostics = {
6138
6158
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
6139
6159
  Add_extends_constraint: diag(2211, 3 /* Message */, "Add_extends_constraint_2211", "Add `extends` constraint."),
6140
6160
  Add_extends_constraint_to_all_type_parameters: diag(2212, 3 /* Message */, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
6141
- The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2213, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supp_2213", "The project root is ambiguous, but is required to determine the module format of output '.js' files. Supply the `rootDir` compiler option to disambiguate."),
6142
6161
  Duplicate_identifier_0: diag(2300, 1 /* Error */, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
6143
6162
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, 1 /* Error */, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
6144
6163
  Static_members_cannot_reference_class_type_parameters: diag(2302, 1 /* Error */, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -7709,6 +7728,7 @@ var Diagnostics = {
7709
7728
  Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
7710
7729
  Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
7711
7730
  Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
7731
+ Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
7712
7732
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7713
7733
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7714
7734
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -33408,7 +33428,9 @@ var libEntries = [
33408
33428
  ["es2022.string", "lib.es2022.string.d.ts"],
33409
33429
  ["es2022.regexp", "lib.es2022.regexp.d.ts"],
33410
33430
  ["es2023.array", "lib.es2023.array.d.ts"],
33431
+ ["es2023.collection", "lib.es2023.collection.d.ts"],
33411
33432
  ["esnext.array", "lib.es2023.array.d.ts"],
33433
+ ["esnext.collection", "lib.es2023.collection.d.ts"],
33412
33434
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
33413
33435
  ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
33414
33436
  ["esnext.intl", "lib.esnext.intl.d.ts"],
@@ -36914,7 +36936,7 @@ function compilerOptionValueToString(value) {
36914
36936
  return str + "}";
36915
36937
  }
36916
36938
  function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
36917
- return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + (options.pathsBasePath ? `|${options.pathsBasePath}` : void 0);
36939
+ return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
36918
36940
  }
36919
36941
  function createCacheWithRedirects(ownOptions) {
36920
36942
  const redirectsMap = /* @__PURE__ */ new Map();
@@ -46476,7 +46498,7 @@ function createTypeChecker(host) {
46476
46498
  function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
46477
46499
  const type = createType(kind);
46478
46500
  type.intrinsicName = intrinsicName;
46479
- type.objectFlags = objectFlags;
46501
+ type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
46480
46502
  return type;
46481
46503
  }
46482
46504
  function createObjectType(objectFlags, symbol) {
@@ -58097,13 +58119,18 @@ function createTypeChecker(host) {
58097
58119
  if (!result) {
58098
58120
  const newMapper = createTypeMapper(typeParameters, typeArguments);
58099
58121
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
58100
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58122
+ target.instantiations.set(id, result);
58123
+ const resultObjectFlags = getObjectFlags(result);
58124
+ if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58101
58125
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58102
- if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58103
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
58126
+ if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
58127
+ if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
58128
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
58129
+ } else {
58130
+ result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
58131
+ }
58104
58132
  }
58105
58133
  }
58106
- target.instantiations.set(id, result);
58107
58134
  }
58108
58135
  return result;
58109
58136
  }
@@ -107162,15 +107189,6 @@ function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, get
107162
107189
  getDeclarationEmitExtensionForPath(inputFileName)
107163
107190
  );
107164
107191
  }
107165
- function getOutputDeclarationFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
107166
- const directory = options.declarationDir || options.outDir ? getNormalizedAbsolutePath(options.declarationDir || options.outDir, currentDirectory) : void 0;
107167
- const outputPathWithoutChangedExtension = directory ? resolvePath(directory, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
107168
- const outputFileName = changeExtension(
107169
- outputPathWithoutChangedExtension,
107170
- getDeclarationEmitExtensionForPath(inputFileName)
107171
- );
107172
- return outputFileName;
107173
- }
107174
107192
  function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
107175
107193
  if (configFile.options.emitDeclarationOnly)
107176
107194
  return void 0;
@@ -107181,18 +107199,6 @@ function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSou
107181
107199
  );
107182
107200
  return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
107183
107201
  }
107184
- function getOutputJSFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
107185
- if (options.emitDeclarationOnly)
107186
- return void 0;
107187
- const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
107188
- const outDir = options.outDir ? getNormalizedAbsolutePath(options.outDir, currentDirectory) : void 0;
107189
- const outputPathWithoutChangedExtension = outDir ? resolvePath(outDir, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
107190
- const outputFileName = changeExtension(
107191
- outputPathWithoutChangedExtension,
107192
- getOutputExtension(inputFileName, options)
107193
- );
107194
- return !isJsonFile || !options.configFilePath || comparePaths(inputFileName, outputFileName, options.configFilePath, ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
107195
- }
107196
107202
  function createAddOutput() {
107197
107203
  let outputs;
107198
107204
  return { addOutput, getOutputs };
@@ -113668,15 +113674,6 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
113668
113674
  return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
113669
113675
  }
113670
113676
  }
113671
- function moduleFormatNeedsPackageJsonLookup(fileName, options) {
113672
- switch (getEmitModuleResolutionKind(options)) {
113673
- case 3 /* Node16 */:
113674
- case 99 /* NodeNext */:
113675
- return fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]);
113676
- default:
113677
- return false;
113678
- }
113679
- }
113680
113677
  var plainJSErrors = /* @__PURE__ */ new Set([
113681
113678
  // binder errors
113682
113679
  Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
@@ -113797,7 +113794,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113797
113794
  let files;
113798
113795
  let symlinks;
113799
113796
  let commonSourceDirectory;
113800
- let assumedCommonSourceDirectory;
113801
113797
  let typeChecker;
113802
113798
  let classifiableNames;
113803
113799
  const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
@@ -114289,9 +114285,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114289
114285
  }
114290
114286
  return commonSourceDirectory;
114291
114287
  }
114292
- function getAssumedCommonSourceDirectory() {
114293
- return commonSourceDirectory ?? (assumedCommonSourceDirectory ?? (assumedCommonSourceDirectory = getCommonSourceDirectory(options, () => rootNames, host.getCurrentDirectory(), getCanonicalFileName)));
114294
- }
114295
114288
  function getClassifiableNames() {
114296
114289
  var _a2;
114297
114290
  if (!classifiableNames) {
@@ -114515,20 +114508,20 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114515
114508
  })(SeenPackageName || (SeenPackageName = {}));
114516
114509
  const seenPackageNames = /* @__PURE__ */ new Map();
114517
114510
  for (const oldSourceFile of oldSourceFiles) {
114518
- const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
114511
+ const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
114519
114512
  let newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(
114520
114513
  oldSourceFile.fileName,
114521
114514
  oldSourceFile.resolvedPath,
114522
114515
  sourceFileOptions,
114523
114516
  /*onError*/
114524
114517
  void 0,
114525
- shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat
114518
+ shouldCreateNewSourceFile
114526
114519
  ) : host.getSourceFile(
114527
114520
  oldSourceFile.fileName,
114528
114521
  sourceFileOptions,
114529
114522
  /*onError*/
114530
114523
  void 0,
114531
- shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat
114524
+ shouldCreateNewSourceFile
114532
114525
  );
114533
114526
  if (!newSourceFile) {
114534
114527
  return 0 /* Not */;
@@ -115477,52 +115470,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115477
115470
  (_b2 = tracing) == null ? void 0 : _b2.pop();
115478
115471
  return result;
115479
115472
  }
115480
- function getImpliedNodeFormatForFile(fileName) {
115481
- let fileNameForModuleFormatDetection = getNormalizedAbsolutePath(fileName, currentDirectory);
115482
- if (moduleFormatNeedsPackageJsonLookup(fileName, options)) {
115483
- const projectReference = getResolvedProjectReferenceToRedirect(fileName);
115484
- if (projectReference) {
115485
- Debug.assert(useSourceOfProjectReferenceRedirect);
115486
- fileNameForModuleFormatDetection = getOutputDeclarationFileName(
115487
- fileNameForModuleFormatDetection,
115488
- projectReference.commandLine,
115489
- !host.useCaseSensitiveFileNames()
115490
- ) || getOutputJSFileName(
115491
- fileNameForModuleFormatDetection,
115492
- projectReference.commandLine,
115493
- !host.useCaseSensitiveFileNames()
115494
- ) || fileNameForModuleFormatDetection;
115495
- } else {
115496
- fileNameForModuleFormatDetection = getOutputDeclarationFileNameWithoutConfigFile(
115497
- fileNameForModuleFormatDetection,
115498
- options,
115499
- !host.useCaseSensitiveFileNames(),
115500
- currentDirectory,
115501
- getAssumedCommonSourceDirectory
115502
- ) || getOutputJSFileNameWithoutConfigFile(
115503
- fileNameForModuleFormatDetection,
115504
- options,
115505
- !host.useCaseSensitiveFileNames(),
115506
- currentDirectory,
115507
- getAssumedCommonSourceDirectory
115508
- ) || fileNameForModuleFormatDetection;
115509
- }
115510
- }
115511
- return getImpliedNodeFormatForFileWorker(
115512
- fileNameForModuleFormatDetection,
115513
- moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
115514
- host,
115515
- options
115516
- );
115517
- }
115518
- function getCreateSourceFileOptions(fileName) {
115519
- const result = getImpliedNodeFormatForFile(fileName);
115520
- const languageVersion = getEmitScriptTarget(options);
115521
- const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options);
115473
+ function getCreateSourceFileOptions(fileName, moduleResolutionCache2, host2, options2) {
115474
+ const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
115475
+ const languageVersion = getEmitScriptTarget(options2);
115476
+ const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
115522
115477
  return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
115523
115478
  }
115524
115479
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
115525
- var _a2, _b2;
115480
+ var _a2;
115526
115481
  const path = toPath3(fileName);
115527
115482
  if (useSourceOfProjectReferenceRedirect) {
115528
115483
  let source = getSourceOfProjectReferenceRedirect(path);
@@ -115590,7 +115545,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115590
115545
  redirectedPath = toPath3(redirect);
115591
115546
  }
115592
115547
  }
115593
- const sourceFileOptions = getCreateSourceFileOptions(fileName);
115548
+ const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
115594
115549
  const file = host.getSourceFile(
115595
115550
  fileName,
115596
115551
  sourceFileOptions,
@@ -115601,7 +115556,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115601
115556
  Diagnostics.Cannot_read_file_0_Colon_1,
115602
115557
  [fileName, hostErrorMessage]
115603
115558
  ),
115604
- shouldCreateNewSourceFile || ((_a2 = oldProgram == null ? void 0 : oldProgram.getSourceFileByPath(toPath3(fileName))) == null ? void 0 : _a2.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat
115559
+ shouldCreateNewSourceFile
115605
115560
  );
115606
115561
  if (packageId) {
115607
115562
  const packageIdKey = packageIdToString(packageId);
@@ -115626,7 +115581,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115626
115581
  file.path = path;
115627
115582
  file.resolvedPath = toPath3(fileName);
115628
115583
  file.originalFileName = originalFileName;
115629
- file.packageJsonLocations = ((_b2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _b2.length) ? sourceFileOptions.packageJsonLocations : void 0;
115584
+ file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
115630
115585
  file.packageJsonScope = sourceFileOptions.packageJsonScope;
115631
115586
  addFileIncludeReason(file, reason);
115632
115587
  if (host.useCaseSensitiveFileNames()) {
@@ -116213,9 +116168,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116213
116168
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
116214
116169
  }
116215
116170
  }
116216
- if (assumedCommonSourceDirectory && assumedCommonSourceDirectory !== getCommonSourceDirectory2()) {
116217
- programDiagnostics.add(createCompilerDiagnostic(Diagnostics.The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate));
116218
- }
116219
116171
  if (options.useDefineForClassFields && languageVersion === 0 /* ES3 */) {
116220
116172
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields");
116221
116173
  }
@@ -120699,7 +120651,8 @@ function createWatchProgram(host) {
120699
120651
  if (isFileMissingOnHost(hostSourceFile)) {
120700
120652
  return void 0;
120701
120653
  }
120702
- if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) {
120654
+ const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
120655
+ if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
120703
120656
  const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
120704
120657
  if (hostSourceFile) {
120705
120658
  if (sourceFile) {