typescript 4.6.0-dev.20220118 → 4.6.0-dev.20220119

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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20220118";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220119";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -44497,7 +44497,7 @@ var ts;
44497
44497
  maybeBindExpressionFlowIfCall(node.expression);
44498
44498
  }
44499
44499
  function maybeBindExpressionFlowIfCall(node) {
44500
- // A top level or LHS of comma expression call expression with a dotted function name and at least one argument
44500
+ // A top level or comma expression call expression with a dotted function name and at least one argument
44501
44501
  // is potentially an assertion and is therefore included in the control flow.
44502
44502
  if (node.kind === 207 /* CallExpression */) {
44503
44503
  var call = node;
@@ -44665,22 +44665,27 @@ var ts;
44665
44665
  }
44666
44666
  return state;
44667
44667
  }
44668
- function onLeft(left, state, _node) {
44668
+ function onLeft(left, state, node) {
44669
44669
  if (!state.skip) {
44670
- return maybeBind(left);
44670
+ var maybeBound = maybeBind(left);
44671
+ if (node.operatorToken.kind === 27 /* CommaToken */) {
44672
+ maybeBindExpressionFlowIfCall(left);
44673
+ }
44674
+ return maybeBound;
44671
44675
  }
44672
44676
  }
44673
- function onOperator(operatorToken, state, node) {
44677
+ function onOperator(operatorToken, state, _node) {
44674
44678
  if (!state.skip) {
44675
- if (operatorToken.kind === 27 /* CommaToken */) {
44676
- maybeBindExpressionFlowIfCall(node.left);
44677
- }
44678
44679
  bind(operatorToken);
44679
44680
  }
44680
44681
  }
44681
- function onRight(right, state, _node) {
44682
+ function onRight(right, state, node) {
44682
44683
  if (!state.skip) {
44683
- return maybeBind(right);
44684
+ var maybeBound = maybeBind(right);
44685
+ if (node.operatorToken.kind === 27 /* CommaToken */) {
44686
+ maybeBindExpressionFlowIfCall(right);
44687
+ }
44688
+ return maybeBound;
44684
44689
  }
44685
44690
  }
44686
44691
  function onExit(node, state) {
@@ -50957,6 +50962,7 @@ var ts;
50957
50962
  getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
50958
50963
  getCurrentDirectory: function () { return host.getCurrentDirectory(); },
50959
50964
  getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
50965
+ getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
50960
50966
  useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
50961
50967
  redirectTargetsMap: host.redirectTargetsMap,
50962
50968
  getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
@@ -95529,10 +95535,19 @@ var ts;
95529
95535
  var _a;
95530
95536
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95531
95537
  var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
95532
- var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
95538
+ var args = [tagName, objectProperties];
95539
+ // function jsx(type, config, maybeKey) {}
95540
+ // "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
95541
+ if (keyAttr) {
95542
+ args.push(transformJsxAttributeInitializer(keyAttr.initializer));
95543
+ }
95533
95544
  if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
95534
95545
  var originalFile = ts.getOriginalNode(currentSourceFile);
95535
95546
  if (originalFile && ts.isSourceFile(originalFile)) {
95547
+ // "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
95548
+ if (keyAttr === undefined) {
95549
+ args.push(factory.createVoidZero());
95550
+ }
95536
95551
  // isStaticChildren development flag
95537
95552
  args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
95538
95553
  // __source development flag
@@ -119397,11 +119412,12 @@ var ts;
119397
119412
  };
119398
119413
  }
119399
119414
  function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
119415
+ var _a;
119400
119416
  if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
119401
119417
  && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
119402
119418
  return false;
119403
119419
  }
119404
- return ts.getImpliedNodeFormatForFile(importingSourceFileName, /*packageJsonInfoCache*/ undefined, getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
119420
+ return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
119405
119421
  }
119406
119422
  function getModuleResolutionHost(host) {
119407
119423
  var _a;
@@ -119961,11 +119977,13 @@ var ts;
119961
119977
  // For classic resolution, only allow importing from node_modules/@types, not other node_modules
119962
119978
  return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
119963
119979
  function tryDirectoryWithPackageJson(packageRootIndex) {
119980
+ var _a, _b;
119964
119981
  var packageRootPath = path.substring(0, packageRootIndex);
119965
119982
  var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
119966
119983
  var moduleFileToTry = path;
119967
- if (host.fileExists(packageJsonPath)) {
119968
- var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
119984
+ var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
119985
+ if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
119986
+ var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
119969
119987
  if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
119970
119988
  // `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
119971
119989
  // an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
@@ -120804,6 +120822,7 @@ var ts;
120804
120822
  var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
120805
120823
  var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
120806
120824
  var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
120825
+ var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
120807
120826
  var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
120808
120827
  var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
120809
120828
  var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
@@ -120966,14 +120985,21 @@ var ts;
120966
120985
  var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
120967
120986
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
120968
120987
  if (hasChangedConfigFileParsingErrors) {
120988
+ if (reportFileChangeDetectedOnCreateProgram) {
120989
+ reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
120990
+ }
120969
120991
  builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
120970
120992
  hasChangedConfigFileParsingErrors = false;
120971
120993
  }
120972
120994
  }
120973
120995
  else {
120996
+ if (reportFileChangeDetectedOnCreateProgram) {
120997
+ reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
120998
+ }
120974
120999
  createNewProgram(hasInvalidatedResolution);
120975
121000
  }
120976
121001
  changesAffectResolution = false; // reset for next sync
121002
+ reportFileChangeDetectedOnCreateProgram = false;
120977
121003
  if (host.afterProgramCreate && program !== builderProgram) {
120978
121004
  host.afterProgramCreate(builderProgram);
120979
121005
  }
@@ -121175,7 +121201,7 @@ var ts;
121175
121201
  }
121176
121202
  function updateProgramWithWatchStatus() {
121177
121203
  timerToUpdateProgram = undefined;
121178
- reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
121204
+ reportFileChangeDetectedOnCreateProgram = true;
121179
121205
  updateProgram();
121180
121206
  }
121181
121207
  function updateProgram() {
@@ -123282,6 +123308,7 @@ var ts;
123282
123308
  ScriptElementKind["externalModuleName"] = "external module name";
123283
123309
  /**
123284
123310
  * <JsxTagName attribute1 attribute2={0} />
123311
+ * @deprecated
123285
123312
  */
123286
123313
  ScriptElementKind["jsxAttribute"] = "JSX attribute";
123287
123314
  /** String literal */
@@ -125173,6 +125200,7 @@ var ts;
125173
125200
  useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
125174
125201
  getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
125175
125202
  getModuleSpecifierCache: ts.maybeBind(host, host.getModuleSpecifierCache),
125203
+ getPackageJsonInfoCache: function () { var _a; return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); },
125176
125204
  getGlobalTypingsCacheLocation: ts.maybeBind(host, host.getGlobalTypingsCacheLocation),
125177
125205
  redirectTargetsMap: program.redirectTargetsMap,
125178
125206
  getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
@@ -128917,6 +128945,7 @@ var ts;
128917
128945
  function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
128918
128946
  var _a, _b, _c;
128919
128947
  var start = ts.timestamp();
128948
+ var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
128920
128949
  var resolutionLimitExceeded = false;
128921
128950
  var ambientCount = 0;
128922
128951
  var resolvedCount = 0;
@@ -128939,7 +128968,7 @@ var ts;
128939
128968
  var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
128940
128969
  var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
128941
128970
  var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
128942
- ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, shouldGetModuleSpecifierFromCache)
128971
+ ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
128943
128972
  : undefined;
128944
128973
  if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
128945
128974
  resolutionLimitExceeded = true;
@@ -130337,9 +130366,7 @@ var ts;
130337
130366
  // GH#39946. Pulling on the type of a node inside of a function with a contextual `this` parameter can result in a circularity
130338
130367
  // if the `node` is part of the exprssion of a `yield` or `return`. This circularity doesn't exist at compile time because
130339
130368
  // we will check (and cache) the type of `this` *before* checking the type of the node.
130340
- var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
130341
- if (!ts.isSourceFile(container) && container.parent)
130342
- typeChecker.getTypeAtLocation(container);
130369
+ typeChecker.tryGetThisTypeAt(node, /*includeGlobalThis*/ false);
130343
130370
  var type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
130344
130371
  var insertQuestionDot = false;
130345
130372
  if (type.isNullableType()) {
@@ -141209,18 +141236,7 @@ var ts;
141209
141236
  }
141210
141237
  return unionPropertyKind;
141211
141238
  }
141212
- // If we requested completions after `x.` at the top-level, we may be at a source file location.
141213
- switch (location.parent && location.parent.kind) {
141214
- // If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
141215
- case 279 /* JsxOpeningElement */:
141216
- case 277 /* JsxElement */:
141217
- case 278 /* JsxSelfClosingElement */:
141218
- return location.kind === 79 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
141219
- case 284 /* JsxAttribute */:
141220
- return "JSX attribute" /* jsxAttribute */;
141221
- default:
141222
- return "property" /* memberVariableElement */;
141223
- }
141239
+ return "property" /* memberVariableElement */;
141224
141240
  }
141225
141241
  return "" /* unknown */;
141226
141242
  }
@@ -149212,7 +149228,8 @@ var ts;
149212
149228
  codefix.getImportCompletionAction = getImportCompletionAction;
149213
149229
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149214
149230
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
149215
- return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, host, preferences);
149231
+ var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
149232
+ return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
149216
149233
  }
149217
149234
  function codeFixActionToCodeAction(_a) {
149218
149235
  var description = _a.description, changes = _a.changes, commands = _a.commands;
@@ -149267,12 +149284,12 @@ var ts;
149267
149284
  return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
149268
149285
  }
149269
149286
  }
149270
- function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, fromCacheOnly) {
149287
+ function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
149271
149288
  var _a = getNewImportFixes(program, importingFile,
149272
149289
  /*position*/ undefined,
149273
149290
  /*isValidTypeOnlyUseSite*/ false,
149274
149291
  /*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
149275
- var result = getBestFix(fixes, importingFile, program, host, preferences);
149292
+ var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
149276
149293
  return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
149277
149294
  }
149278
149295
  codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
@@ -149492,23 +149509,22 @@ var ts;
149492
149509
  var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
149493
149510
  ? getFixesInfoForUMDImport(context, symbolToken)
149494
149511
  : ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
149495
- return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, context.host, context.preferences) });
149512
+ var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
149513
+ return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
149496
149514
  }
149497
- function sortFixes(fixes, sourceFile, program, host, preferences) {
149498
- var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
149499
- return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, allowsImportingSpecifier); });
149515
+ function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
149516
+ return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
149500
149517
  }
149501
- function getBestFix(fixes, sourceFile, program, host, preferences) {
149518
+ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
149502
149519
  if (!ts.some(fixes))
149503
149520
  return;
149504
149521
  // These will always be placed first if available, and are better than other kinds
149505
149522
  if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
149506
149523
  return fixes[0];
149507
149524
  }
149508
- var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
149509
149525
  return fixes.reduce(function (best, fix) {
149510
149526
  // Takes true branch of conditional if `fix` is better than `best`
149511
- return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
149527
+ return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
149512
149528
  });
149513
149529
  }
149514
149530
  /** @returns `Comparison.LessThan` if `a` is better than `b`. */
@@ -152360,7 +152376,7 @@ var ts;
152360
152376
  });
152361
152377
  var name = declaration && ts.getNameOfDeclaration(declaration);
152362
152378
  return !name || changes.length === 0 ? undefined
152363
- : [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), name.getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
152379
+ : [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getTextOfNode(name)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
152364
152380
  },
152365
152381
  fixIds: [fixId],
152366
152382
  getAllCodeActions: function (context) {
@@ -152438,7 +152454,7 @@ var ts;
152438
152454
  case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
152439
152455
  var symbol = program.getTypeChecker().getSymbolAtLocation(token);
152440
152456
  if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
152441
- annotateVariableDeclaration(changes, importAdder, sourceFile, symbol.valueDeclaration, program, host, cancellationToken);
152457
+ annotateVariableDeclaration(changes, importAdder, ts.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken);
152442
152458
  importAdder.writeFixes(changes);
152443
152459
  return symbol.valueDeclaration;
152444
152460
  }
@@ -160717,6 +160733,7 @@ var ts;
160717
160733
  hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
160718
160734
  trace: parseConfigHost.trace,
160719
160735
  resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
160736
+ getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
160720
160737
  resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
160721
160738
  useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
160722
160739
  getParsedCommandLine: getParsedCommandLine,
@@ -165347,6 +165364,9 @@ var ts;
165347
165364
  Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile) {
165348
165365
  return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile);
165349
165366
  };
165367
+ Project.prototype.getModuleResolutionCache = function () {
165368
+ return this.resolutionCache.getModuleResolutionCache();
165369
+ };
165350
165370
  Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile, resolutionMode) {
165351
165371
  return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
165352
165372
  };
@@ -166609,6 +166629,7 @@ var ts;
166609
166629
  if (!program) {
166610
166630
  return ts.emptyArray;
166611
166631
  }
166632
+ var start = ts.timestamp();
166612
166633
  var dependencyNames;
166613
166634
  var rootNames;
166614
166635
  var rootFileName = ts.combinePaths(hostProject.currentDirectory, ts.inferredTypesContainingFile);
@@ -166618,14 +166639,14 @@ var ts;
166618
166639
  (_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a.forEach(function (_, dependenyName) { return addDependency(dependenyName); });
166619
166640
  (_b = packageJson.peerDependencies) === null || _b === void 0 ? void 0 : _b.forEach(function (_, dependencyName) { return addDependency(dependencyName); });
166620
166641
  }
166642
+ var dependenciesAdded = 0;
166621
166643
  if (dependencyNames) {
166622
- var dependenciesAdded = 0;
166623
166644
  var symlinkCache = hostProject.getSymlinkCache();
166624
166645
  for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
166625
166646
  var name = _d[_c];
166626
166647
  // Avoid creating a large project that would significantly slow down time to editor interactivity
166627
166648
  if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
166628
- hostProject.log("Auto-import provider attempted to add more than " + this.maxDependencies + " dependencies.");
166649
+ hostProject.log("AutoImportProviderProject: attempted to add more than " + this.maxDependencies + " dependencies. Aborting.");
166629
166650
  return ts.emptyArray;
166630
166651
  }
166631
166652
  // 1. Try to load from the implementation package. For many dependencies, the
@@ -166659,6 +166680,9 @@ var ts;
166659
166680
  }
166660
166681
  }
166661
166682
  }
166683
+ if (rootNames === null || rootNames === void 0 ? void 0 : rootNames.length) {
166684
+ hostProject.log("AutoImportProviderProject: found " + rootNames.length + " root files in " + dependenciesAdded + " dependencies in " + (ts.timestamp() - start) + " ms");
166685
+ }
166662
166686
  return rootNames || ts.emptyArray;
166663
166687
  function addDependency(dependency) {
166664
166688
  if (!ts.startsWith(dependency, "@types/")) {
@@ -166759,6 +166783,11 @@ var ts;
166759
166783
  return this.hostProject.getSymlinkCache();
166760
166784
  };
166761
166785
  /*@internal*/
166786
+ AutoImportProviderProject.prototype.getModuleResolutionCache = function () {
166787
+ var _a;
166788
+ return (_a = this.hostProject.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getModuleResolutionCache();
166789
+ };
166790
+ /*@internal*/
166762
166791
  AutoImportProviderProject.maxDependencies = 10;
166763
166792
  /*@internal*/
166764
166793
  AutoImportProviderProject.compilerOptionsOverrides = {
@@ -6594,6 +6594,7 @@ declare namespace ts {
6594
6594
  externalModuleName = "external module name",
6595
6595
  /**
6596
6596
  * <JsxTagName attribute1 attribute2={0} />
6597
+ * @deprecated
6597
6598
  */
6598
6599
  jsxAttribute = "JSX attribute",
6599
6600
  /** String literal */
@@ -9874,6 +9875,7 @@ declare namespace ts.server {
9874
9875
  writeFile(fileName: string, content: string): void;
9875
9876
  fileExists(file: string): boolean;
9876
9877
  resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference, _options?: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModuleFull | undefined)[];
9878
+ getModuleResolutionCache(): ModuleResolutionCache | undefined;
9877
9879
  getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined;
9878
9880
  resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
9879
9881
  directoryExists(path: string): boolean;