typescript 5.0.0-dev.20221129 → 5.0.0-dev.20221130

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
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20221129`;
26
+ var version = `${versionMajorMinor}.0-dev.20221130`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -33767,7 +33767,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
33767
33767
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
33768
33768
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
33769
33769
  const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
33770
- const versionPaths = packageInfo && packageInfo.contents.versionPaths;
33770
+ const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
33771
33771
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
33772
33772
  }
33773
33773
  function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
@@ -33797,6 +33797,12 @@ function getPackageScopeForPath(fileName, state) {
33797
33797
  }
33798
33798
  return void 0;
33799
33799
  }
33800
+ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
33801
+ if (packageJsonInfo.contents.versionPaths === void 0) {
33802
+ packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
33803
+ }
33804
+ return packageJsonInfo.contents.versionPaths || void 0;
33805
+ }
33800
33806
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
33801
33807
  var _a2, _b, _c;
33802
33808
  const { host, traceEnabled } = state;
@@ -33825,8 +33831,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
33825
33831
  if (traceEnabled) {
33826
33832
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
33827
33833
  }
33828
- const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
33829
- const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
33834
+ const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
33830
33835
  (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
33831
33836
  state.affectingLocations.push(packageJsonPath);
33832
33837
  return result;
@@ -34291,7 +34296,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
34291
34296
  !nodeModulesDirectoryExists,
34292
34297
  state,
34293
34298
  packageInfo.contents.packageJsonContent,
34294
- packageInfo.contents.versionPaths
34299
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
34295
34300
  );
34296
34301
  return withPackageId(packageInfo, fromDirectory);
34297
34302
  }
@@ -34303,7 +34308,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
34303
34308
  onlyRecordFailures,
34304
34309
  state2,
34305
34310
  packageInfo && packageInfo.contents.packageJsonContent,
34306
- packageInfo && packageInfo.contents.versionPaths
34311
+ packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
34307
34312
  );
34308
34313
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
34309
34314
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -34318,12 +34323,13 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
34318
34323
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
34319
34324
  return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
34320
34325
  }
34321
- if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
34326
+ const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
34327
+ if (versionPaths) {
34322
34328
  if (state.traceEnabled) {
34323
- trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
34329
+ trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
34324
34330
  }
34325
34331
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
34326
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
34332
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
34327
34333
  if (fromPaths) {
34328
34334
  return fromPaths.value;
34329
34335
  }
@@ -51607,7 +51613,7 @@ function createTypeChecker(host) {
51607
51613
  return isTypeRelatedTo(source, target, assignableRelation);
51608
51614
  }
51609
51615
  function isTypeDerivedFrom(source, target) {
51610
- return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
51616
+ return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
51611
51617
  }
51612
51618
  function isTypeComparableTo(source, target) {
51613
51619
  return isTypeRelatedTo(source, target, comparableRelation);
@@ -101262,7 +101268,7 @@ function getBuildInfo2(state, bundle) {
101262
101268
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
101263
101269
  if (tryAddToSet(seenFiles, path)) {
101264
101270
  const file = state.program.getSourceFileByPath(path);
101265
- if (!sourceFileMayBeEmitted(file, state.program))
101271
+ if (!file || !sourceFileMayBeEmitted(file, state.program))
101266
101272
  continue;
101267
101273
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
101268
101274
  (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
@@ -103085,9 +103091,9 @@ function createWatchFactory(host, options) {
103085
103091
  function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
103086
103092
  const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
103087
103093
  const hostGetNewLine = memoize(() => host.getNewLine());
103088
- return {
103094
+ const compilerHost = {
103089
103095
  getSourceFile: createGetSourceFile(
103090
- (fileName, encoding) => host.readFile(fileName, encoding),
103096
+ (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
103091
103097
  getCompilerOptions,
103092
103098
  void 0
103093
103099
  ),
@@ -103114,6 +103120,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
103114
103120
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
103115
103121
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
103116
103122
  };
103123
+ return compilerHost;
103117
103124
  }
103118
103125
  function getSourceFileVersionAsHashFromText(host, text) {
103119
103126
  if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
@@ -103147,12 +103154,12 @@ function getSourceFileVersionAsHashFromText(host, text) {
103147
103154
  }
103148
103155
  return (host.createHash || generateDjb2Hash)(text);
103149
103156
  }
103150
- function setGetSourceFileAsHashVersioned(compilerHost, host) {
103157
+ function setGetSourceFileAsHashVersioned(compilerHost) {
103151
103158
  const originalGetSourceFile = compilerHost.getSourceFile;
103152
103159
  compilerHost.getSourceFile = (...args) => {
103153
103160
  const result = originalGetSourceFile.call(compilerHost, ...args);
103154
103161
  if (result) {
103155
- result.version = getSourceFileVersionAsHashFromText(host, result.text);
103162
+ result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
103156
103163
  }
103157
103164
  return result;
103158
103165
  };
@@ -103281,7 +103288,7 @@ function createIncrementalCompilerHost(options, system = sys) {
103281
103288
  host.createHash = maybeBind(system, system.createHash);
103282
103289
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
103283
103290
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
103284
- setGetSourceFileAsHashVersioned(host, system);
103291
+ setGetSourceFileAsHashVersioned(host);
103285
103292
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
103286
103293
  return host;
103287
103294
  }
@@ -103343,7 +103350,7 @@ function createWatchProgram(host) {
103343
103350
  configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
103344
103351
  }
103345
103352
  const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
103346
- setGetSourceFileAsHashVersioned(compilerHost, host);
103353
+ setGetSourceFileAsHashVersioned(compilerHost);
103347
103354
  const getNewSourceFile = compilerHost.getSourceFile;
103348
103355
  compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
103349
103356
  compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
@@ -103442,9 +103449,10 @@ function createWatchProgram(host) {
103442
103449
  originalFileExists,
103443
103450
  originalDirectoryExists,
103444
103451
  originalCreateDirectory,
103445
- originalWriteFile
103452
+ originalWriteFile,
103453
+ readFileWithCache
103446
103454
  } = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
103447
- if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103455
+ if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103448
103456
  if (hasChangedConfigFileParsingErrors) {
103449
103457
  if (reportFileChangeDetectedOnCreateProgram) {
103450
103458
  reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -103563,9 +103571,14 @@ function createWatchProgram(host) {
103563
103571
  }
103564
103572
  }
103565
103573
  }
103566
- function getSourceVersion(path) {
103574
+ function getSourceVersion(path, readFileWithCache) {
103567
103575
  const hostSourceFile = sourceFilesCache.get(path);
103568
- return !hostSourceFile || !hostSourceFile.version ? void 0 : hostSourceFile.version;
103576
+ if (!hostSourceFile)
103577
+ return void 0;
103578
+ if (hostSourceFile.version)
103579
+ return hostSourceFile.version;
103580
+ const text = readFileWithCache(path);
103581
+ return text ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
103569
103582
  }
103570
103583
  function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
103571
103584
  const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
@@ -104004,7 +104017,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
104004
104017
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
104005
104018
  const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
104006
104019
  const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
104007
- setGetSourceFileAsHashVersioned(compilerHost, host);
104020
+ setGetSourceFileAsHashVersioned(compilerHost);
104008
104021
  compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
104009
104022
  compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
104010
104023
  compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
package/lib/tsserver.js CHANGED
@@ -2648,7 +2648,7 @@ var ts = (() => {
2648
2648
 
2649
2649
  // src/compiler/corePublic.ts
2650
2650
  var versionMajorMinor = "5.0";
2651
- var version = `${versionMajorMinor}.0-dev.20221129`;
2651
+ var version = `${versionMajorMinor}.0-dev.20221130`;
2652
2652
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2653
2653
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2654
2654
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -38479,7 +38479,7 @@ ${lanes.join("\n")}
38479
38479
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
38480
38480
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
38481
38481
  const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
38482
- const versionPaths = packageInfo && packageInfo.contents.versionPaths;
38482
+ const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
38483
38483
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
38484
38484
  }
38485
38485
  function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
@@ -38498,7 +38498,7 @@ ${lanes.join("\n")}
38498
38498
  false,
38499
38499
  requireState,
38500
38500
  packageJsonInfo.contents.packageJsonContent,
38501
- packageJsonInfo.contents.versionPaths
38501
+ getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
38502
38502
  );
38503
38503
  entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
38504
38504
  if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
@@ -38591,6 +38591,12 @@ ${lanes.join("\n")}
38591
38591
  }
38592
38592
  return void 0;
38593
38593
  }
38594
+ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
38595
+ if (packageJsonInfo.contents.versionPaths === void 0) {
38596
+ packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
38597
+ }
38598
+ return packageJsonInfo.contents.versionPaths || void 0;
38599
+ }
38594
38600
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
38595
38601
  var _a2, _b, _c;
38596
38602
  const { host, traceEnabled } = state;
@@ -38619,8 +38625,7 @@ ${lanes.join("\n")}
38619
38625
  if (traceEnabled) {
38620
38626
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
38621
38627
  }
38622
- const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
38623
- const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
38628
+ const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
38624
38629
  (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
38625
38630
  state.affectingLocations.push(packageJsonPath);
38626
38631
  return result;
@@ -39085,7 +39090,7 @@ ${lanes.join("\n")}
39085
39090
  !nodeModulesDirectoryExists,
39086
39091
  state,
39087
39092
  packageInfo.contents.packageJsonContent,
39088
- packageInfo.contents.versionPaths
39093
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
39089
39094
  );
39090
39095
  return withPackageId(packageInfo, fromDirectory);
39091
39096
  }
@@ -39097,7 +39102,7 @@ ${lanes.join("\n")}
39097
39102
  onlyRecordFailures,
39098
39103
  state2,
39099
39104
  packageInfo && packageInfo.contents.packageJsonContent,
39100
- packageInfo && packageInfo.contents.versionPaths
39105
+ packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
39101
39106
  );
39102
39107
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
39103
39108
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -39112,12 +39117,13 @@ ${lanes.join("\n")}
39112
39117
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
39113
39118
  return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
39114
39119
  }
39115
- if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
39120
+ const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
39121
+ if (versionPaths) {
39116
39122
  if (state.traceEnabled) {
39117
- trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
39123
+ trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
39118
39124
  }
39119
39125
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
39120
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
39126
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
39121
39127
  if (fromPaths) {
39122
39128
  return fromPaths.value;
39123
39129
  }
@@ -56450,7 +56456,7 @@ ${lanes.join("\n")}
56450
56456
  return isTypeRelatedTo(source, target, assignableRelation);
56451
56457
  }
56452
56458
  function isTypeDerivedFrom(source, target) {
56453
- return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
56459
+ return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
56454
56460
  }
56455
56461
  function isTypeComparableTo(source, target) {
56456
56462
  return isTypeRelatedTo(source, target, comparableRelation);
@@ -106351,7 +106357,7 @@ ${lanes.join("\n")}
106351
106357
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
106352
106358
  if (tryAddToSet(seenFiles, path)) {
106353
106359
  const file = state.program.getSourceFileByPath(path);
106354
- if (!sourceFileMayBeEmitted(file, state.program))
106360
+ if (!file || !sourceFileMayBeEmitted(file, state.program))
106355
106361
  continue;
106356
106362
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
106357
106363
  (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
@@ -108186,9 +108192,9 @@ ${lanes.join("\n")}
108186
108192
  function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
108187
108193
  const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
108188
108194
  const hostGetNewLine = memoize(() => host.getNewLine());
108189
- return {
108195
+ const compilerHost = {
108190
108196
  getSourceFile: createGetSourceFile(
108191
- (fileName, encoding) => host.readFile(fileName, encoding),
108197
+ (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
108192
108198
  getCompilerOptions,
108193
108199
  void 0
108194
108200
  ),
@@ -108215,6 +108221,7 @@ ${lanes.join("\n")}
108215
108221
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
108216
108222
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
108217
108223
  };
108224
+ return compilerHost;
108218
108225
  }
108219
108226
  function getSourceFileVersionAsHashFromText(host, text) {
108220
108227
  if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
@@ -108248,12 +108255,12 @@ ${lanes.join("\n")}
108248
108255
  }
108249
108256
  return (host.createHash || generateDjb2Hash)(text);
108250
108257
  }
108251
- function setGetSourceFileAsHashVersioned(compilerHost, host) {
108258
+ function setGetSourceFileAsHashVersioned(compilerHost) {
108252
108259
  const originalGetSourceFile = compilerHost.getSourceFile;
108253
108260
  compilerHost.getSourceFile = (...args) => {
108254
108261
  const result = originalGetSourceFile.call(compilerHost, ...args);
108255
108262
  if (result) {
108256
- result.version = getSourceFileVersionAsHashFromText(host, result.text);
108263
+ result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
108257
108264
  }
108258
108265
  return result;
108259
108266
  };
@@ -108382,7 +108389,7 @@ ${lanes.join("\n")}
108382
108389
  host.createHash = maybeBind(system, system.createHash);
108383
108390
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
108384
108391
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
108385
- setGetSourceFileAsHashVersioned(host, system);
108392
+ setGetSourceFileAsHashVersioned(host);
108386
108393
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
108387
108394
  return host;
108388
108395
  }
@@ -108469,7 +108476,7 @@ ${lanes.join("\n")}
108469
108476
  configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
108470
108477
  }
108471
108478
  const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
108472
- setGetSourceFileAsHashVersioned(compilerHost, host);
108479
+ setGetSourceFileAsHashVersioned(compilerHost);
108473
108480
  const getNewSourceFile = compilerHost.getSourceFile;
108474
108481
  compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
108475
108482
  compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
@@ -108568,9 +108575,10 @@ ${lanes.join("\n")}
108568
108575
  originalFileExists,
108569
108576
  originalDirectoryExists,
108570
108577
  originalCreateDirectory,
108571
- originalWriteFile
108578
+ originalWriteFile,
108579
+ readFileWithCache
108572
108580
  } = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
108573
- if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
108581
+ if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
108574
108582
  if (hasChangedConfigFileParsingErrors) {
108575
108583
  if (reportFileChangeDetectedOnCreateProgram) {
108576
108584
  reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -108689,9 +108697,14 @@ ${lanes.join("\n")}
108689
108697
  }
108690
108698
  }
108691
108699
  }
108692
- function getSourceVersion(path) {
108700
+ function getSourceVersion(path, readFileWithCache) {
108693
108701
  const hostSourceFile = sourceFilesCache.get(path);
108694
- return !hostSourceFile || !hostSourceFile.version ? void 0 : hostSourceFile.version;
108702
+ if (!hostSourceFile)
108703
+ return void 0;
108704
+ if (hostSourceFile.version)
108705
+ return hostSourceFile.version;
108706
+ const text = readFileWithCache(path);
108707
+ return text ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
108695
108708
  }
108696
108709
  function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
108697
108710
  const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
@@ -109150,7 +109163,7 @@ ${lanes.join("\n")}
109150
109163
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
109151
109164
  const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
109152
109165
  const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
109153
- setGetSourceFileAsHashVersioned(compilerHost, host);
109166
+ setGetSourceFileAsHashVersioned(compilerHost);
109154
109167
  compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
109155
109168
  compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
109156
109169
  compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
@@ -42,7 +42,7 @@ var ts = (() => {
42
42
  "src/compiler/corePublic.ts"() {
43
43
  "use strict";
44
44
  versionMajorMinor = "5.0";
45
- version = `${versionMajorMinor}.0-dev.20221129`;
45
+ version = `${versionMajorMinor}.0-dev.20221130`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -36012,7 +36012,7 @@ ${lanes.join("\n")}
36012
36012
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
36013
36013
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
36014
36014
  const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
36015
- const versionPaths = packageInfo && packageInfo.contents.versionPaths;
36015
+ const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
36016
36016
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
36017
36017
  }
36018
36018
  function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
@@ -36031,7 +36031,7 @@ ${lanes.join("\n")}
36031
36031
  false,
36032
36032
  requireState,
36033
36033
  packageJsonInfo.contents.packageJsonContent,
36034
- packageJsonInfo.contents.versionPaths
36034
+ getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
36035
36035
  );
36036
36036
  entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
36037
36037
  if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
@@ -36124,6 +36124,12 @@ ${lanes.join("\n")}
36124
36124
  }
36125
36125
  return void 0;
36126
36126
  }
36127
+ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
36128
+ if (packageJsonInfo.contents.versionPaths === void 0) {
36129
+ packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
36130
+ }
36131
+ return packageJsonInfo.contents.versionPaths || void 0;
36132
+ }
36127
36133
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
36128
36134
  var _a2, _b, _c;
36129
36135
  const { host, traceEnabled } = state;
@@ -36152,8 +36158,7 @@ ${lanes.join("\n")}
36152
36158
  if (traceEnabled) {
36153
36159
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
36154
36160
  }
36155
- const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
36156
- const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
36161
+ const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
36157
36162
  (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
36158
36163
  state.affectingLocations.push(packageJsonPath);
36159
36164
  return result;
@@ -36618,7 +36623,7 @@ ${lanes.join("\n")}
36618
36623
  !nodeModulesDirectoryExists,
36619
36624
  state,
36620
36625
  packageInfo.contents.packageJsonContent,
36621
- packageInfo.contents.versionPaths
36626
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
36622
36627
  );
36623
36628
  return withPackageId(packageInfo, fromDirectory);
36624
36629
  }
@@ -36630,7 +36635,7 @@ ${lanes.join("\n")}
36630
36635
  onlyRecordFailures,
36631
36636
  state2,
36632
36637
  packageInfo && packageInfo.contents.packageJsonContent,
36633
- packageInfo && packageInfo.contents.versionPaths
36638
+ packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
36634
36639
  );
36635
36640
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
36636
36641
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -36645,12 +36650,13 @@ ${lanes.join("\n")}
36645
36650
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
36646
36651
  return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
36647
36652
  }
36648
- if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
36653
+ const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
36654
+ if (versionPaths) {
36649
36655
  if (state.traceEnabled) {
36650
- trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
36656
+ trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
36651
36657
  }
36652
36658
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
36653
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
36659
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
36654
36660
  if (fromPaths) {
36655
36661
  return fromPaths.value;
36656
36662
  }
@@ -53908,7 +53914,7 @@ ${lanes.join("\n")}
53908
53914
  return isTypeRelatedTo(source, target, assignableRelation);
53909
53915
  }
53910
53916
  function isTypeDerivedFrom(source, target) {
53911
- return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
53917
+ return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
53912
53918
  }
53913
53919
  function isTypeComparableTo(source, target) {
53914
53920
  return isTypeRelatedTo(source, target, comparableRelation);
@@ -104142,7 +104148,7 @@ ${lanes.join("\n")}
104142
104148
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
104143
104149
  if (tryAddToSet(seenFiles, path)) {
104144
104150
  const file = state.program.getSourceFileByPath(path);
104145
- if (!sourceFileMayBeEmitted(file, state.program))
104151
+ if (!file || !sourceFileMayBeEmitted(file, state.program))
104146
104152
  continue;
104147
104153
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
104148
104154
  (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
@@ -105978,9 +105984,9 @@ ${lanes.join("\n")}
105978
105984
  function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
105979
105985
  const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
105980
105986
  const hostGetNewLine = memoize(() => host.getNewLine());
105981
- return {
105987
+ const compilerHost = {
105982
105988
  getSourceFile: createGetSourceFile(
105983
- (fileName, encoding) => host.readFile(fileName, encoding),
105989
+ (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
105984
105990
  getCompilerOptions,
105985
105991
  void 0
105986
105992
  ),
@@ -106007,6 +106013,7 @@ ${lanes.join("\n")}
106007
106013
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
106008
106014
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
106009
106015
  };
106016
+ return compilerHost;
106010
106017
  }
106011
106018
  function getSourceFileVersionAsHashFromText(host, text) {
106012
106019
  if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
@@ -106040,12 +106047,12 @@ ${lanes.join("\n")}
106040
106047
  }
106041
106048
  return (host.createHash || generateDjb2Hash)(text);
106042
106049
  }
106043
- function setGetSourceFileAsHashVersioned(compilerHost, host) {
106050
+ function setGetSourceFileAsHashVersioned(compilerHost) {
106044
106051
  const originalGetSourceFile = compilerHost.getSourceFile;
106045
106052
  compilerHost.getSourceFile = (...args) => {
106046
106053
  const result = originalGetSourceFile.call(compilerHost, ...args);
106047
106054
  if (result) {
106048
- result.version = getSourceFileVersionAsHashFromText(host, result.text);
106055
+ result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
106049
106056
  }
106050
106057
  return result;
106051
106058
  };
@@ -106213,7 +106220,7 @@ ${lanes.join("\n")}
106213
106220
  host.createHash = maybeBind(system, system.createHash);
106214
106221
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
106215
106222
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
106216
- setGetSourceFileAsHashVersioned(host, system);
106223
+ setGetSourceFileAsHashVersioned(host);
106217
106224
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
106218
106225
  return host;
106219
106226
  }
@@ -106300,7 +106307,7 @@ ${lanes.join("\n")}
106300
106307
  configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
106301
106308
  }
106302
106309
  const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
106303
- setGetSourceFileAsHashVersioned(compilerHost, host);
106310
+ setGetSourceFileAsHashVersioned(compilerHost);
106304
106311
  const getNewSourceFile = compilerHost.getSourceFile;
106305
106312
  compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
106306
106313
  compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
@@ -106399,9 +106406,10 @@ ${lanes.join("\n")}
106399
106406
  originalFileExists,
106400
106407
  originalDirectoryExists,
106401
106408
  originalCreateDirectory,
106402
- originalWriteFile
106409
+ originalWriteFile,
106410
+ readFileWithCache
106403
106411
  } = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
106404
- if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
106412
+ if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
106405
106413
  if (hasChangedConfigFileParsingErrors) {
106406
106414
  if (reportFileChangeDetectedOnCreateProgram) {
106407
106415
  reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -106520,9 +106528,14 @@ ${lanes.join("\n")}
106520
106528
  }
106521
106529
  }
106522
106530
  }
106523
- function getSourceVersion(path) {
106531
+ function getSourceVersion(path, readFileWithCache) {
106524
106532
  const hostSourceFile = sourceFilesCache.get(path);
106525
- return !hostSourceFile || !hostSourceFile.version ? void 0 : hostSourceFile.version;
106533
+ if (!hostSourceFile)
106534
+ return void 0;
106535
+ if (hostSourceFile.version)
106536
+ return hostSourceFile.version;
106537
+ const text = readFileWithCache(path);
106538
+ return text ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
106526
106539
  }
106527
106540
  function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
106528
106541
  const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
@@ -106993,7 +107006,7 @@ ${lanes.join("\n")}
106993
107006
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
106994
107007
  const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
106995
107008
  const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
106996
- setGetSourceFileAsHashVersioned(compilerHost, host);
107009
+ setGetSourceFileAsHashVersioned(compilerHost);
106997
107010
  compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
106998
107011
  compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
106999
107012
  compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
package/lib/typescript.js CHANGED
@@ -42,7 +42,7 @@ var ts = (() => {
42
42
  "src/compiler/corePublic.ts"() {
43
43
  "use strict";
44
44
  versionMajorMinor = "5.0";
45
- version = `${versionMajorMinor}.0-dev.20221129`;
45
+ version = `${versionMajorMinor}.0-dev.20221130`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -36012,7 +36012,7 @@ ${lanes.join("\n")}
36012
36012
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
36013
36013
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
36014
36014
  const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
36015
- const versionPaths = packageInfo && packageInfo.contents.versionPaths;
36015
+ const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
36016
36016
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
36017
36017
  }
36018
36018
  function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
@@ -36031,7 +36031,7 @@ ${lanes.join("\n")}
36031
36031
  false,
36032
36032
  requireState,
36033
36033
  packageJsonInfo.contents.packageJsonContent,
36034
- packageJsonInfo.contents.versionPaths
36034
+ getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
36035
36035
  );
36036
36036
  entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
36037
36037
  if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
@@ -36124,6 +36124,12 @@ ${lanes.join("\n")}
36124
36124
  }
36125
36125
  return void 0;
36126
36126
  }
36127
+ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
36128
+ if (packageJsonInfo.contents.versionPaths === void 0) {
36129
+ packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
36130
+ }
36131
+ return packageJsonInfo.contents.versionPaths || void 0;
36132
+ }
36127
36133
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
36128
36134
  var _a2, _b, _c;
36129
36135
  const { host, traceEnabled } = state;
@@ -36152,8 +36158,7 @@ ${lanes.join("\n")}
36152
36158
  if (traceEnabled) {
36153
36159
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
36154
36160
  }
36155
- const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
36156
- const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
36161
+ const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
36157
36162
  (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
36158
36163
  state.affectingLocations.push(packageJsonPath);
36159
36164
  return result;
@@ -36618,7 +36623,7 @@ ${lanes.join("\n")}
36618
36623
  !nodeModulesDirectoryExists,
36619
36624
  state,
36620
36625
  packageInfo.contents.packageJsonContent,
36621
- packageInfo.contents.versionPaths
36626
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
36622
36627
  );
36623
36628
  return withPackageId(packageInfo, fromDirectory);
36624
36629
  }
@@ -36630,7 +36635,7 @@ ${lanes.join("\n")}
36630
36635
  onlyRecordFailures,
36631
36636
  state2,
36632
36637
  packageInfo && packageInfo.contents.packageJsonContent,
36633
- packageInfo && packageInfo.contents.versionPaths
36638
+ packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
36634
36639
  );
36635
36640
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
36636
36641
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -36645,12 +36650,13 @@ ${lanes.join("\n")}
36645
36650
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
36646
36651
  return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
36647
36652
  }
36648
- if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
36653
+ const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
36654
+ if (versionPaths) {
36649
36655
  if (state.traceEnabled) {
36650
- trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
36656
+ trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
36651
36657
  }
36652
36658
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
36653
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
36659
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
36654
36660
  if (fromPaths) {
36655
36661
  return fromPaths.value;
36656
36662
  }
@@ -53908,7 +53914,7 @@ ${lanes.join("\n")}
53908
53914
  return isTypeRelatedTo(source, target, assignableRelation);
53909
53915
  }
53910
53916
  function isTypeDerivedFrom(source, target) {
53911
- return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
53917
+ return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
53912
53918
  }
53913
53919
  function isTypeComparableTo(source, target) {
53914
53920
  return isTypeRelatedTo(source, target, comparableRelation);
@@ -104142,7 +104148,7 @@ ${lanes.join("\n")}
104142
104148
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
104143
104149
  if (tryAddToSet(seenFiles, path)) {
104144
104150
  const file = state.program.getSourceFileByPath(path);
104145
- if (!sourceFileMayBeEmitted(file, state.program))
104151
+ if (!file || !sourceFileMayBeEmitted(file, state.program))
104146
104152
  continue;
104147
104153
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
104148
104154
  (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
@@ -105978,9 +105984,9 @@ ${lanes.join("\n")}
105978
105984
  function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
105979
105985
  const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
105980
105986
  const hostGetNewLine = memoize(() => host.getNewLine());
105981
- return {
105987
+ const compilerHost = {
105982
105988
  getSourceFile: createGetSourceFile(
105983
- (fileName, encoding) => host.readFile(fileName, encoding),
105989
+ (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
105984
105990
  getCompilerOptions,
105985
105991
  void 0
105986
105992
  ),
@@ -106007,6 +106013,7 @@ ${lanes.join("\n")}
106007
106013
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
106008
106014
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
106009
106015
  };
106016
+ return compilerHost;
106010
106017
  }
106011
106018
  function getSourceFileVersionAsHashFromText(host, text) {
106012
106019
  if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
@@ -106040,12 +106047,12 @@ ${lanes.join("\n")}
106040
106047
  }
106041
106048
  return (host.createHash || generateDjb2Hash)(text);
106042
106049
  }
106043
- function setGetSourceFileAsHashVersioned(compilerHost, host) {
106050
+ function setGetSourceFileAsHashVersioned(compilerHost) {
106044
106051
  const originalGetSourceFile = compilerHost.getSourceFile;
106045
106052
  compilerHost.getSourceFile = (...args) => {
106046
106053
  const result = originalGetSourceFile.call(compilerHost, ...args);
106047
106054
  if (result) {
106048
- result.version = getSourceFileVersionAsHashFromText(host, result.text);
106055
+ result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
106049
106056
  }
106050
106057
  return result;
106051
106058
  };
@@ -106213,7 +106220,7 @@ ${lanes.join("\n")}
106213
106220
  host.createHash = maybeBind(system, system.createHash);
106214
106221
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
106215
106222
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
106216
- setGetSourceFileAsHashVersioned(host, system);
106223
+ setGetSourceFileAsHashVersioned(host);
106217
106224
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
106218
106225
  return host;
106219
106226
  }
@@ -106300,7 +106307,7 @@ ${lanes.join("\n")}
106300
106307
  configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
106301
106308
  }
106302
106309
  const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
106303
- setGetSourceFileAsHashVersioned(compilerHost, host);
106310
+ setGetSourceFileAsHashVersioned(compilerHost);
106304
106311
  const getNewSourceFile = compilerHost.getSourceFile;
106305
106312
  compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
106306
106313
  compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
@@ -106399,9 +106406,10 @@ ${lanes.join("\n")}
106399
106406
  originalFileExists,
106400
106407
  originalDirectoryExists,
106401
106408
  originalCreateDirectory,
106402
- originalWriteFile
106409
+ originalWriteFile,
106410
+ readFileWithCache
106403
106411
  } = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
106404
- if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
106412
+ if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
106405
106413
  if (hasChangedConfigFileParsingErrors) {
106406
106414
  if (reportFileChangeDetectedOnCreateProgram) {
106407
106415
  reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -106520,9 +106528,14 @@ ${lanes.join("\n")}
106520
106528
  }
106521
106529
  }
106522
106530
  }
106523
- function getSourceVersion(path) {
106531
+ function getSourceVersion(path, readFileWithCache) {
106524
106532
  const hostSourceFile = sourceFilesCache.get(path);
106525
- return !hostSourceFile || !hostSourceFile.version ? void 0 : hostSourceFile.version;
106533
+ if (!hostSourceFile)
106534
+ return void 0;
106535
+ if (hostSourceFile.version)
106536
+ return hostSourceFile.version;
106537
+ const text = readFileWithCache(path);
106538
+ return text ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
106526
106539
  }
106527
106540
  function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
106528
106541
  const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
@@ -106993,7 +107006,7 @@ ${lanes.join("\n")}
106993
107006
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
106994
107007
  const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
106995
107008
  const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
106996
- setGetSourceFileAsHashVersioned(compilerHost, host);
107009
+ setGetSourceFileAsHashVersioned(compilerHost);
106997
107010
  compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
106998
107011
  compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
106999
107012
  compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
50
50
 
51
51
  // src/compiler/corePublic.ts
52
52
  var versionMajorMinor = "5.0";
53
- var version = `${versionMajorMinor}.0-dev.20221129`;
53
+ var version = `${versionMajorMinor}.0-dev.20221130`;
54
54
 
55
55
  // src/compiler/core.ts
56
56
  var emptyArray = [];
@@ -26366,7 +26366,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
26366
26366
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
26367
26367
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
26368
26368
  const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
26369
- const versionPaths = packageInfo && packageInfo.contents.versionPaths;
26369
+ const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
26370
26370
  return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
26371
26371
  }
26372
26372
  function getPackageScopeForPath(fileName, state) {
@@ -26381,6 +26381,12 @@ function getPackageScopeForPath(fileName, state) {
26381
26381
  }
26382
26382
  return void 0;
26383
26383
  }
26384
+ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
26385
+ if (packageJsonInfo.contents.versionPaths === void 0) {
26386
+ packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
26387
+ }
26388
+ return packageJsonInfo.contents.versionPaths || void 0;
26389
+ }
26384
26390
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
26385
26391
  var _a2, _b, _c;
26386
26392
  const { host, traceEnabled } = state;
@@ -26409,8 +26415,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
26409
26415
  if (traceEnabled) {
26410
26416
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
26411
26417
  }
26412
- const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
26413
- const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
26418
+ const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
26414
26419
  (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
26415
26420
  state.affectingLocations.push(packageJsonPath);
26416
26421
  return result;
@@ -26875,7 +26880,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
26875
26880
  !nodeModulesDirectoryExists,
26876
26881
  state,
26877
26882
  packageInfo.contents.packageJsonContent,
26878
- packageInfo.contents.versionPaths
26883
+ getVersionPathsOfPackageJsonInfo(packageInfo, state)
26879
26884
  );
26880
26885
  return withPackageId(packageInfo, fromDirectory);
26881
26886
  }
@@ -26887,7 +26892,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
26887
26892
  onlyRecordFailures,
26888
26893
  state2,
26889
26894
  packageInfo && packageInfo.contents.packageJsonContent,
26890
- packageInfo && packageInfo.contents.versionPaths
26895
+ packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
26891
26896
  );
26892
26897
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
26893
26898
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -26902,12 +26907,13 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
26902
26907
  if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
26903
26908
  return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
26904
26909
  }
26905
- if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
26910
+ const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
26911
+ if (versionPaths) {
26906
26912
  if (state.traceEnabled) {
26907
- trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
26913
+ trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
26908
26914
  }
26909
26915
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
26910
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
26916
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
26911
26917
  if (fromPaths) {
26912
26918
  return fromPaths.value;
26913
26919
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.0.0-dev.20221129",
5
+ "version": "5.0.0-dev.20221130",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [