@typescript-deploys/pr-build 5.6.0-pr-59059-2 → 5.6.0-pr-59048-28

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-insiders.20240627`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240628`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1078,10 +1078,10 @@ function matchedText(pattern, candidate) {
1078
1078
  Debug.assert(isPatternMatch(pattern, candidate));
1079
1079
  return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
1080
1080
  }
1081
- function findBestPatternMatch(values, getPattern, candidate) {
1081
+ function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
1082
1082
  let matchedValue;
1083
1083
  let longestMatchPrefixLength = -1;
1084
- for (let i = 0; i < values.length; i++) {
1084
+ for (let i = 0; i < endIndex; i++) {
1085
1085
  const v = values[i];
1086
1086
  const pattern = getPattern(v);
1087
1087
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
@@ -18279,8 +18279,43 @@ function tryParsePattern(pattern) {
18279
18279
  suffix: pattern.substr(indexOfStar + 1)
18280
18280
  };
18281
18281
  }
18282
- function tryParsePatterns(paths) {
18283
- return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
18282
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
18283
+ function tryParsePatterns(paths, shouldCache = true, sortByAggregateLength = false) {
18284
+ let result;
18285
+ if (shouldCache) {
18286
+ result = parsedPatternsCache.get(paths);
18287
+ if (result !== void 0) {
18288
+ return result;
18289
+ }
18290
+ }
18291
+ let matchableStringSet;
18292
+ let sortedPatterns;
18293
+ const pathList = getOwnKeys(paths);
18294
+ for (const path of pathList) {
18295
+ const patternOrStr = tryParsePattern(path);
18296
+ if (patternOrStr === void 0) {
18297
+ continue;
18298
+ } else if (typeof patternOrStr === "string") {
18299
+ (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
18300
+ } else {
18301
+ (sortedPatterns ?? (sortedPatterns = [])).push(patternOrStr);
18302
+ }
18303
+ }
18304
+ sortedPatterns == null ? void 0 : sortedPatterns.sort((a, b) => {
18305
+ const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix);
18306
+ if (prefixComparison === 0 && sortByAggregateLength) {
18307
+ return a.suffix.length - b.suffix.length;
18308
+ }
18309
+ return prefixComparison;
18310
+ });
18311
+ result = {
18312
+ matchableStringSet,
18313
+ sortedPatterns
18314
+ };
18315
+ if (shouldCache) {
18316
+ parsedPatternsCache.set(paths, result);
18317
+ }
18318
+ return result;
18284
18319
  }
18285
18320
  function positionIsSynthesized(pos) {
18286
18321
  return !(pos >= 0);
@@ -18306,16 +18341,43 @@ var emptyFileSystemEntries = {
18306
18341
  directories: emptyArray
18307
18342
  };
18308
18343
  function matchPatternOrExact(patternOrStrings, candidate) {
18309
- const patterns = [];
18310
- for (const patternOrString of patternOrStrings) {
18311
- if (patternOrString === candidate) {
18312
- return candidate;
18344
+ const { matchableStringSet, sortedPatterns } = patternOrStrings;
18345
+ if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
18346
+ return candidate;
18347
+ }
18348
+ if (sortedPatterns === void 0 || sortedPatterns.length === 0) {
18349
+ return void 0;
18350
+ }
18351
+ let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
18352
+ if (index < 0) {
18353
+ index = ~index;
18354
+ }
18355
+ if (index >= sortedPatterns.length) {
18356
+ index--;
18357
+ }
18358
+ const groupPrefix = sortedPatterns[index].prefix;
18359
+ while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
18360
+ index--;
18361
+ }
18362
+ for (let i = index; i < sortedPatterns.length; i++) {
18363
+ const currentPattern = sortedPatterns[i];
18364
+ if (currentPattern.prefix !== groupPrefix) {
18365
+ break;
18313
18366
  }
18314
- if (!isString(patternOrString)) {
18315
- patterns.push(patternOrString);
18367
+ if (isPatternMatch(currentPattern, candidate)) {
18368
+ return currentPattern;
18316
18369
  }
18317
18370
  }
18318
- return findBestPatternMatch(patterns, (_) => _, candidate);
18371
+ return findBestPatternMatch(
18372
+ sortedPatterns,
18373
+ (_) => _,
18374
+ candidate,
18375
+ /*endIndex*/
18376
+ index
18377
+ );
18378
+ }
18379
+ function getPatternPrefix(pattern) {
18380
+ return pattern.prefix;
18319
18381
  }
18320
18382
  function sliceAfter(arr, value) {
18321
18383
  const index = arr.indexOf(value);
@@ -39574,7 +39636,16 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
39574
39636
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
39575
39637
  }
39576
39638
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
39577
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
39639
+ let pathPatterns;
39640
+ if (configFile == null ? void 0 : configFile.configFileSpecs) {
39641
+ pathPatterns = (_a = configFile.configFileSpecs).pathPatterns ?? (_a.pathPatterns = tryParsePatterns(
39642
+ paths,
39643
+ /*shouldCache*/
39644
+ false
39645
+ ));
39646
+ } else {
39647
+ pathPatterns = tryParsePatterns(paths);
39648
+ }
39578
39649
  return tryLoadModuleUsingPaths(
39579
39650
  extensions,
39580
39651
  moduleName,
@@ -40252,17 +40323,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
40252
40323
  if (state.traceEnabled) {
40253
40324
  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, moduleName);
40254
40325
  }
40255
- const result = tryLoadModuleUsingPaths(
40256
- extensions,
40257
- moduleName,
40258
- candidate,
40259
- versionPaths.paths,
40260
- /*pathPatterns*/
40261
- void 0,
40262
- loader,
40263
- onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
40264
- state
40265
- );
40326
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
40327
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
40266
40328
  if (result) {
40267
40329
  return removeIgnoredPackageId(result.value);
40268
40330
  }
@@ -40854,17 +40916,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40854
40916
  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);
40855
40917
  }
40856
40918
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
40857
- const fromPaths = tryLoadModuleUsingPaths(
40858
- extensions,
40859
- rest,
40860
- packageDirectory,
40861
- versionPaths.paths,
40862
- /*pathPatterns*/
40863
- void 0,
40864
- loader,
40865
- !packageDirectoryExists,
40866
- state
40867
- );
40919
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
40920
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
40868
40921
  if (fromPaths) {
40869
40922
  return fromPaths.value;
40870
40923
  }
@@ -40872,7 +40925,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40872
40925
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
40873
40926
  }
40874
40927
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
40875
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
40876
40928
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
40877
40929
  if (matchedPattern) {
40878
40930
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -67597,11 +67649,7 @@ function createTypeChecker(host) {
67597
67649
  }
67598
67650
  function getTypeFactsWorker(type, callerOnlyNeeds) {
67599
67651
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
67600
- const constraintType = getBaseConstraintOfType(type) || unknownType;
67601
- if (strictNullChecks && type.flags & 465829888 /* Instantiable */ && constraintType === unknownType) {
67602
- return callerOnlyNeeds;
67603
- }
67604
- type = constraintType;
67652
+ type = getBaseConstraintOfType(type) || unknownType;
67605
67653
  }
67606
67654
  const flags = type.flags;
67607
67655
  if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
@@ -67701,7 +67749,7 @@ function createTypeChecker(host) {
67701
67749
  return type;
67702
67750
  }
67703
67751
  const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
67704
- return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, (strictNullChecks || !(facts & otherIncludesFacts)) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67752
+ return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67705
67753
  }
67706
67754
  function recombineUnknownType(type) {
67707
67755
  return type === unknownUnionType ? unknownType : type;
package/lib/typescript.js CHANGED
@@ -2250,7 +2250,7 @@ module.exports = __toCommonJS(typescript_exports);
2250
2250
 
2251
2251
  // src/compiler/corePublic.ts
2252
2252
  var versionMajorMinor = "5.6";
2253
- var version = `${versionMajorMinor}.0-insiders.20240627`;
2253
+ var version = `${versionMajorMinor}.0-insiders.20240628`;
2254
2254
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2255
2255
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2256
2256
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3602,10 +3602,10 @@ function matchedText(pattern, candidate) {
3602
3602
  Debug.assert(isPatternMatch(pattern, candidate));
3603
3603
  return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
3604
3604
  }
3605
- function findBestPatternMatch(values, getPattern, candidate) {
3605
+ function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
3606
3606
  let matchedValue;
3607
3607
  let longestMatchPrefixLength = -1;
3608
- for (let i = 0; i < values.length; i++) {
3608
+ for (let i = 0; i < endIndex; i++) {
3609
3609
  const v = values[i];
3610
3610
  const pattern = getPattern(v);
3611
3611
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
@@ -22244,8 +22244,43 @@ function tryParsePattern(pattern) {
22244
22244
  suffix: pattern.substr(indexOfStar + 1)
22245
22245
  };
22246
22246
  }
22247
- function tryParsePatterns(paths) {
22248
- return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
22247
+ var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
22248
+ function tryParsePatterns(paths, shouldCache = true, sortByAggregateLength = false) {
22249
+ let result;
22250
+ if (shouldCache) {
22251
+ result = parsedPatternsCache.get(paths);
22252
+ if (result !== void 0) {
22253
+ return result;
22254
+ }
22255
+ }
22256
+ let matchableStringSet;
22257
+ let sortedPatterns;
22258
+ const pathList = getOwnKeys(paths);
22259
+ for (const path of pathList) {
22260
+ const patternOrStr = tryParsePattern(path);
22261
+ if (patternOrStr === void 0) {
22262
+ continue;
22263
+ } else if (typeof patternOrStr === "string") {
22264
+ (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
22265
+ } else {
22266
+ (sortedPatterns ?? (sortedPatterns = [])).push(patternOrStr);
22267
+ }
22268
+ }
22269
+ sortedPatterns == null ? void 0 : sortedPatterns.sort((a, b) => {
22270
+ const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix);
22271
+ if (prefixComparison === 0 && sortByAggregateLength) {
22272
+ return a.suffix.length - b.suffix.length;
22273
+ }
22274
+ return prefixComparison;
22275
+ });
22276
+ result = {
22277
+ matchableStringSet,
22278
+ sortedPatterns
22279
+ };
22280
+ if (shouldCache) {
22281
+ parsedPatternsCache.set(paths, result);
22282
+ }
22283
+ return result;
22249
22284
  }
22250
22285
  function positionIsSynthesized(pos) {
22251
22286
  return !(pos >= 0);
@@ -22274,16 +22309,43 @@ var emptyFileSystemEntries = {
22274
22309
  directories: emptyArray
22275
22310
  };
22276
22311
  function matchPatternOrExact(patternOrStrings, candidate) {
22277
- const patterns = [];
22278
- for (const patternOrString of patternOrStrings) {
22279
- if (patternOrString === candidate) {
22280
- return candidate;
22312
+ const { matchableStringSet, sortedPatterns } = patternOrStrings;
22313
+ if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
22314
+ return candidate;
22315
+ }
22316
+ if (sortedPatterns === void 0 || sortedPatterns.length === 0) {
22317
+ return void 0;
22318
+ }
22319
+ let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
22320
+ if (index < 0) {
22321
+ index = ~index;
22322
+ }
22323
+ if (index >= sortedPatterns.length) {
22324
+ index--;
22325
+ }
22326
+ const groupPrefix = sortedPatterns[index].prefix;
22327
+ while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
22328
+ index--;
22329
+ }
22330
+ for (let i = index; i < sortedPatterns.length; i++) {
22331
+ const currentPattern = sortedPatterns[i];
22332
+ if (currentPattern.prefix !== groupPrefix) {
22333
+ break;
22281
22334
  }
22282
- if (!isString(patternOrString)) {
22283
- patterns.push(patternOrString);
22335
+ if (isPatternMatch(currentPattern, candidate)) {
22336
+ return currentPattern;
22284
22337
  }
22285
22338
  }
22286
- return findBestPatternMatch(patterns, (_) => _, candidate);
22339
+ return findBestPatternMatch(
22340
+ sortedPatterns,
22341
+ (_) => _,
22342
+ candidate,
22343
+ /*endIndex*/
22344
+ index
22345
+ );
22346
+ }
22347
+ function getPatternPrefix(pattern) {
22348
+ return pattern.prefix;
22287
22349
  }
22288
22350
  function sliceAfter(arr, value) {
22289
22351
  const index = arr.indexOf(value);
@@ -43917,7 +43979,16 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
43917
43979
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
43918
43980
  }
43919
43981
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
43920
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
43982
+ let pathPatterns;
43983
+ if (configFile == null ? void 0 : configFile.configFileSpecs) {
43984
+ pathPatterns = (_a = configFile.configFileSpecs).pathPatterns ?? (_a.pathPatterns = tryParsePatterns(
43985
+ paths,
43986
+ /*shouldCache*/
43987
+ false
43988
+ ));
43989
+ } else {
43990
+ pathPatterns = tryParsePatterns(paths);
43991
+ }
43921
43992
  return tryLoadModuleUsingPaths(
43922
43993
  extensions,
43923
43994
  moduleName,
@@ -44722,17 +44793,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
44722
44793
  if (state.traceEnabled) {
44723
44794
  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, moduleName);
44724
44795
  }
44725
- const result = tryLoadModuleUsingPaths(
44726
- extensions,
44727
- moduleName,
44728
- candidate,
44729
- versionPaths.paths,
44730
- /*pathPatterns*/
44731
- void 0,
44732
- loader,
44733
- onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
44734
- state
44735
- );
44796
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
44797
+ const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
44736
44798
  if (result) {
44737
44799
  return removeIgnoredPackageId(result.value);
44738
44800
  }
@@ -45324,17 +45386,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45324
45386
  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);
45325
45387
  }
45326
45388
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
45327
- const fromPaths = tryLoadModuleUsingPaths(
45328
- extensions,
45329
- rest,
45330
- packageDirectory,
45331
- versionPaths.paths,
45332
- /*pathPatterns*/
45333
- void 0,
45334
- loader,
45335
- !packageDirectoryExists,
45336
- state
45337
- );
45389
+ const pathPatterns = tryParsePatterns(versionPaths.paths);
45390
+ const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
45338
45391
  if (fromPaths) {
45339
45392
  return fromPaths.value;
45340
45393
  }
@@ -45342,7 +45395,6 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45342
45395
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
45343
45396
  }
45344
45397
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
45345
- pathPatterns || (pathPatterns = tryParsePatterns(paths));
45346
45398
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
45347
45399
  if (matchedPattern) {
45348
45400
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -72185,11 +72237,7 @@ function createTypeChecker(host) {
72185
72237
  }
72186
72238
  function getTypeFactsWorker(type, callerOnlyNeeds) {
72187
72239
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
72188
- const constraintType = getBaseConstraintOfType(type) || unknownType;
72189
- if (strictNullChecks && type.flags & 465829888 /* Instantiable */ && constraintType === unknownType) {
72190
- return callerOnlyNeeds;
72191
- }
72192
- type = constraintType;
72240
+ type = getBaseConstraintOfType(type) || unknownType;
72193
72241
  }
72194
72242
  const flags = type.flags;
72195
72243
  if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
@@ -72289,7 +72337,7 @@ function createTypeChecker(host) {
72289
72337
  return type;
72290
72338
  }
72291
72339
  const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
72292
- return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, (strictNullChecks || !(facts & otherIncludesFacts)) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
72340
+ return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
72293
72341
  }
72294
72342
  function recombineUnknownType(type) {
72295
72343
  return type === unknownUnionType ? unknownType : type;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.6.0-pr-59059-2",
5
+ "version": "5.6.0-pr-59048-28",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [