typescript 5.1.0-dev.20230426 → 5.1.0-dev.20230428

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.
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230426`;
57
+ var version = `${versionMajorMinor}.0-dev.20230428`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -3689,9 +3689,6 @@ var curSysLog = noop;
3689
3689
  function sysLog(s) {
3690
3690
  return curSysLog(s);
3691
3691
  }
3692
- function setSysLog(logger) {
3693
- curSysLog = logger;
3694
- }
3695
3692
  function createDirectoryWatcherSupportingRecursive({
3696
3693
  watchDirectory,
3697
3694
  useCaseSensitiveFileNames,
@@ -10005,10 +10002,15 @@ function createSingleLineStringWriter() {
10005
10002
  clear: () => str = ""
10006
10003
  };
10007
10004
  }
10008
- function copyEntries(source, target) {
10009
- source.forEach((value, key) => {
10010
- target.set(key, value);
10011
- });
10005
+ function forEachKey(map2, callback) {
10006
+ const iterator = map2.keys();
10007
+ for (const key of iterator) {
10008
+ const result = callback(key);
10009
+ if (result) {
10010
+ return result;
10011
+ }
10012
+ }
10013
+ return void 0;
10012
10014
  }
10013
10015
  function getFullWidth(node) {
10014
10016
  return node.end - node.pos;
@@ -10491,6 +10493,7 @@ function canHaveJSDoc(node) {
10491
10493
  case 171 /* PropertyDeclaration */:
10492
10494
  case 170 /* PropertySignature */:
10493
10495
  case 252 /* ReturnStatement */:
10496
+ case 239 /* SemicolonClassElement */:
10494
10497
  case 177 /* SetAccessor */:
10495
10498
  case 303 /* ShorthandPropertyAssignment */:
10496
10499
  case 304 /* SpreadAssignment */:
@@ -10969,10 +10972,6 @@ function directoryProbablyExists(directoryName, host) {
10969
10972
  function closeFileWatcher(watcher) {
10970
10973
  watcher.close();
10971
10974
  }
10972
- function clearMap(map2, onDeleteValue) {
10973
- map2.forEach(onDeleteValue);
10974
- map2.clear();
10975
- }
10976
10975
  function getLastChild(node) {
10977
10976
  let lastChild;
10978
10977
  forEachChild(
@@ -23140,11 +23139,11 @@ var Parser;
23140
23139
  }
23141
23140
  function parseClassElement() {
23142
23141
  const pos = getNodePos();
23142
+ const hasJSDoc = hasPrecedingJSDocComment();
23143
23143
  if (token() === 27 /* SemicolonToken */) {
23144
23144
  nextToken();
23145
- return finishNode(factory2.createSemicolonClassElement(), pos);
23145
+ return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
23146
23146
  }
23147
- const hasJSDoc = hasPrecedingJSDocComment();
23148
23147
  const modifiers = parseModifiers(
23149
23148
  /*allowDecorators*/
23150
23149
  true,
@@ -30464,104 +30463,6 @@ function createBracketsMap() {
30464
30463
  }
30465
30464
 
30466
30465
  // src/compiler/watchUtilities.ts
30467
- function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
30468
- setSysLog(watchLogLevel === 2 /* Verbose */ ? log2 : noop);
30469
- const plainInvokeFactory = {
30470
- watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
30471
- watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1 /* Recursive */) !== 0, options)
30472
- };
30473
- const triggerInvokingFactory = watchLogLevel !== 0 /* None */ ? {
30474
- watchFile: createTriggerLoggingAddWatch("watchFile"),
30475
- watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
30476
- } : void 0;
30477
- const factory2 = watchLogLevel === 2 /* Verbose */ ? {
30478
- watchFile: createFileWatcherWithLogging,
30479
- watchDirectory: createDirectoryWatcherWithLogging
30480
- } : triggerInvokingFactory || plainInvokeFactory;
30481
- const excludeWatcherFactory = watchLogLevel === 2 /* Verbose */ ? createExcludeWatcherWithLogging : returnNoopFileWatcher;
30482
- return {
30483
- watchFile: createExcludeHandlingAddWatch("watchFile"),
30484
- watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
30485
- };
30486
- function createExcludeHandlingAddWatch(key) {
30487
- return (file, cb, flags, options, detailInfo1, detailInfo2) => {
30488
- var _a;
30489
- return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call(
30490
- /*thisArgs*/
30491
- void 0,
30492
- file,
30493
- cb,
30494
- flags,
30495
- options,
30496
- detailInfo1,
30497
- detailInfo2
30498
- ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
30499
- };
30500
- }
30501
- function useCaseSensitiveFileNames() {
30502
- return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
30503
- }
30504
- function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
30505
- log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
30506
- return {
30507
- close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
30508
- };
30509
- }
30510
- function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
30511
- log2(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
30512
- const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
30513
- return {
30514
- close: () => {
30515
- log2(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
30516
- watcher.close();
30517
- }
30518
- };
30519
- }
30520
- function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
30521
- const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
30522
- log2(watchInfo);
30523
- const start = timestamp();
30524
- const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
30525
- const elapsed = timestamp() - start;
30526
- log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
30527
- return {
30528
- close: () => {
30529
- const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
30530
- log2(watchInfo2);
30531
- const start2 = timestamp();
30532
- watcher.close();
30533
- const elapsed2 = timestamp() - start2;
30534
- log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
30535
- }
30536
- };
30537
- }
30538
- function createTriggerLoggingAddWatch(key) {
30539
- return (file, cb, flags, options, detailInfo1, detailInfo2) => plainInvokeFactory[key].call(
30540
- /*thisArgs*/
30541
- void 0,
30542
- file,
30543
- (...args) => {
30544
- const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
30545
- log2(triggerredInfo);
30546
- const start = timestamp();
30547
- cb.call(
30548
- /*thisArg*/
30549
- void 0,
30550
- ...args
30551
- );
30552
- const elapsed = timestamp() - start;
30553
- log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
30554
- },
30555
- flags,
30556
- options,
30557
- detailInfo1,
30558
- detailInfo2
30559
- );
30560
- }
30561
- function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
30562
- return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
30563
- }
30564
- }
30565
30466
  function getFallbackOptions(options) {
30566
30467
  const fallbackPolling = options == null ? void 0 : options.fallbackPolling;
30567
30468
  return {
@@ -31140,8 +31041,6 @@ var screenStartingMessageCodes = [
31140
31041
  Diagnostics.Starting_compilation_in_watch_mode.code,
31141
31042
  Diagnostics.File_change_detected_Starting_incremental_compilation.code
31142
31043
  ];
31143
- var noopFileWatcher = { close: noop };
31144
- var returnNoopFileWatcher = () => noopFileWatcher;
31145
31044
 
31146
31045
  // src/jsTyping/_namespaces/ts.JsTyping.ts
31147
31046
  var ts_JsTyping_exports = {};
@@ -31466,11 +31365,11 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
31466
31365
 
31467
31366
  // src/jsTyping/shared.ts
31468
31367
  var ActionSet = "action::set";
31469
- var ActionInvalidate = "action::invalidate";
31470
31368
  var ActionPackageInstalled = "action::packageInstalled";
31471
31369
  var EventTypesRegistry = "event::typesRegistry";
31472
31370
  var EventBeginInstallTypes = "event::beginInstallTypes";
31473
31371
  var EventEndInstallTypes = "event::endInstallTypes";
31372
+ var ActionWatchTypingLocations = "action::watchTypingLocations";
31474
31373
  var Arguments;
31475
31374
  ((Arguments2) => {
31476
31375
  Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
@@ -31530,19 +31429,6 @@ function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remainin
31530
31429
  }
31531
31430
  return { command, remaining: remaining - toSlice };
31532
31431
  }
31533
- function endsWith2(str, suffix, caseSensitive) {
31534
- const expectedPos = str.length - suffix.length;
31535
- return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
31536
- }
31537
- function isPackageOrBowerJson(fileName, caseSensitive) {
31538
- return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
31539
- }
31540
- function sameFiles(a, b, caseSensitive) {
31541
- return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
31542
- }
31543
- function getDetailWatchInfo(projectName, watchers) {
31544
- return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
31545
- }
31546
31432
  var TypingsInstaller = class {
31547
31433
  constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation2, throttleLimit, log2 = nullLog) {
31548
31434
  this.installTypingHost = installTypingHost;
@@ -31560,13 +31446,10 @@ var TypingsInstaller = class {
31560
31446
  this.installRunCount = 1;
31561
31447
  this.inFlightRequestCount = 0;
31562
31448
  this.latestDistTag = "latest";
31563
- this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
31564
- this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
31565
31449
  const isLoggingEnabled = this.log.isEnabled();
31566
31450
  if (isLoggingEnabled) {
31567
31451
  this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation2}`);
31568
31452
  }
31569
- this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
31570
31453
  this.processCacheLocation(this.globalCachePath);
31571
31454
  }
31572
31455
  closeProject(req) {
@@ -31583,8 +31466,8 @@ var TypingsInstaller = class {
31583
31466
  }
31584
31467
  return;
31585
31468
  }
31586
- clearMap(watchers, closeFileWatcher);
31587
31469
  this.projectWatchers.delete(projectName);
31470
+ this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
31588
31471
  if (this.log.isEnabled()) {
31589
31472
  this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
31590
31473
  }
@@ -31617,7 +31500,7 @@ var TypingsInstaller = class {
31617
31500
  if (this.log.isEnabled()) {
31618
31501
  this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
31619
31502
  }
31620
- this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch, req.projectRootPath, req.watchOptions);
31503
+ this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
31621
31504
  if (discoverTypingsResult.newTypingNames.length) {
31622
31505
  this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
31623
31506
  } else {
@@ -31818,75 +31701,19 @@ var TypingsInstaller = class {
31818
31701
  host.createDirectory(directory);
31819
31702
  }
31820
31703
  }
31821
- watchFiles(projectName, files, projectRootPath, options) {
31704
+ watchFiles(projectName, files) {
31822
31705
  if (!files.length) {
31823
31706
  this.closeWatchers(projectName);
31824
31707
  return;
31825
31708
  }
31826
- let watchers = this.projectWatchers.get(projectName);
31827
- const toRemove = /* @__PURE__ */ new Map();
31828
- if (!watchers) {
31829
- watchers = /* @__PURE__ */ new Map();
31830
- this.projectWatchers.set(projectName, watchers);
31709
+ const existing = this.projectWatchers.get(projectName);
31710
+ const newSet = new Set(files);
31711
+ if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
31712
+ this.projectWatchers.set(projectName, newSet);
31713
+ this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
31831
31714
  } else {
31832
- copyEntries(watchers, toRemove);
31715
+ this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
31833
31716
  }
31834
- watchers.isInvoked = false;
31835
- const isLoggingEnabled = this.log.isEnabled();
31836
- const createProjectWatcher = (path2, projectWatcherType) => {
31837
- const canonicalPath = this.toCanonicalFileName(path2);
31838
- toRemove.delete(canonicalPath);
31839
- if (watchers.has(canonicalPath)) {
31840
- return;
31841
- }
31842
- if (isLoggingEnabled) {
31843
- this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path2}`);
31844
- }
31845
- const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path2, () => {
31846
- if (!watchers.isInvoked) {
31847
- watchers.isInvoked = true;
31848
- this.sendResponse({ projectName, kind: ActionInvalidate });
31849
- }
31850
- }, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path2, (f) => {
31851
- if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
31852
- return;
31853
- }
31854
- if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
31855
- watchers.isInvoked = true;
31856
- this.sendResponse({ projectName, kind: ActionInvalidate });
31857
- }
31858
- }, 1 /* Recursive */, options, projectName, watchers);
31859
- watchers.set(canonicalPath, isLoggingEnabled ? {
31860
- close: () => {
31861
- this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path2}`);
31862
- watcher.close();
31863
- }
31864
- } : watcher);
31865
- };
31866
- for (const file of files) {
31867
- if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
31868
- createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
31869
- continue;
31870
- }
31871
- if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
31872
- const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
31873
- if (subDirectory !== -1) {
31874
- createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
31875
- } else {
31876
- createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
31877
- }
31878
- continue;
31879
- }
31880
- if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
31881
- createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
31882
- continue;
31883
- }
31884
- createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
31885
- }
31886
- toRemove.forEach((watch, path2) => {
31887
- watch.close();
31888
- watchers.delete(path2);
31889
- });
31890
31717
  }
31891
31718
  createSetTypings(request, typings) {
31892
31719
  return {
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.1.0-dev.20230426",
5
+ "version": "5.1.0-dev.20230428",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "14.21.1",
116
116
  "npm": "8.19.3"
117
117
  },
118
- "gitHead": "eb014a26522dd809ae4d0e85634a62eabda2755a"
118
+ "gitHead": "9a52f943ef2b8136e988954c20920a892e5fa992"
119
119
  }