typescript 5.7.0-dev.20240820 → 5.7.0-dev.20240822

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/typescript.js CHANGED
@@ -529,6 +529,7 @@ __export(typescript_exports, {
529
529
  escapeTemplateSubstitution: () => escapeTemplateSubstitution,
530
530
  evaluatorResult: () => evaluatorResult,
531
531
  every: () => every,
532
+ exclusivelyPrefixedNodeCoreModules: () => exclusivelyPrefixedNodeCoreModules,
532
533
  executeCommandLine: () => executeCommandLine,
533
534
  expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
534
535
  explainFiles: () => explainFiles,
@@ -541,7 +542,6 @@ __export(typescript_exports, {
541
542
  extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
542
543
  externalHelpersModuleNameText: () => externalHelpersModuleNameText,
543
544
  factory: () => factory,
544
- fileContainsPackageImport: () => fileContainsPackageImport,
545
545
  fileExtensionIs: () => fileExtensionIs,
546
546
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
547
547
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -1391,7 +1391,7 @@ __export(typescript_exports, {
1391
1391
  isImportSpecifier: () => isImportSpecifier,
1392
1392
  isImportTypeAssertionContainer: () => isImportTypeAssertionContainer,
1393
1393
  isImportTypeNode: () => isImportTypeNode,
1394
- isImportableFile: () => isImportableFile,
1394
+ isImportable: () => isImportable,
1395
1395
  isInComment: () => isInComment,
1396
1396
  isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
1397
1397
  isInExpressionContext: () => isInExpressionContext,
@@ -1872,6 +1872,7 @@ __export(typescript_exports, {
1872
1872
  noTransformers: () => noTransformers,
1873
1873
  noTruncationMaximumTruncationLength: () => noTruncationMaximumTruncationLength,
1874
1874
  nodeCanBeDecorated: () => nodeCanBeDecorated,
1875
+ nodeCoreModules: () => nodeCoreModules,
1875
1876
  nodeHasName: () => nodeHasName,
1876
1877
  nodeIsDecorated: () => nodeIsDecorated,
1877
1878
  nodeIsMissing: () => nodeIsMissing,
@@ -2222,6 +2223,7 @@ __export(typescript_exports, {
2222
2223
  unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
2223
2224
  unmangleScopedPackageName: () => unmangleScopedPackageName,
2224
2225
  unorderedRemoveItem: () => unorderedRemoveItem,
2226
+ unprefixedNodeCoreModules: () => unprefixedNodeCoreModules,
2225
2227
  unreachableCodeIsError: () => unreachableCodeIsError,
2226
2228
  unsetNodeChildren: () => unsetNodeChildren,
2227
2229
  unusedLabelIsError: () => unusedLabelIsError,
@@ -2263,7 +2265,7 @@ module.exports = __toCommonJS(typescript_exports);
2263
2265
 
2264
2266
  // src/compiler/corePublic.ts
2265
2267
  var versionMajorMinor = "5.7";
2266
- var version = `${versionMajorMinor}.0-dev.20240820`;
2268
+ var version = `${versionMajorMinor}.0-dev.20240822`;
2267
2269
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2268
2270
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2269
2271
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -21026,6 +21028,9 @@ function accessKind(node) {
21026
21028
  return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent);
21027
21029
  case 209 /* ArrayLiteralExpression */:
21028
21030
  return accessKind(parent2);
21031
+ case 249 /* ForInStatement */:
21032
+ case 250 /* ForOfStatement */:
21033
+ return node === parent2.initializer ? 1 /* Write */ : 0 /* Read */;
21029
21034
  default:
21030
21035
  return 0 /* Read */;
21031
21036
  }
@@ -23626,6 +23631,75 @@ function isSideEffectImport(node) {
23626
23631
  const ancestor = findAncestor(node, isImportDeclaration);
23627
23632
  return !!ancestor && !ancestor.importClause;
23628
23633
  }
23634
+ var unprefixedNodeCoreModulesList = [
23635
+ "assert",
23636
+ "assert/strict",
23637
+ "async_hooks",
23638
+ "buffer",
23639
+ "child_process",
23640
+ "cluster",
23641
+ "console",
23642
+ "constants",
23643
+ "crypto",
23644
+ "dgram",
23645
+ "diagnostics_channel",
23646
+ "dns",
23647
+ "dns/promises",
23648
+ "domain",
23649
+ "events",
23650
+ "fs",
23651
+ "fs/promises",
23652
+ "http",
23653
+ "http2",
23654
+ "https",
23655
+ "inspector",
23656
+ "inspector/promises",
23657
+ "module",
23658
+ "net",
23659
+ "os",
23660
+ "path",
23661
+ "path/posix",
23662
+ "path/win32",
23663
+ "perf_hooks",
23664
+ "process",
23665
+ "punycode",
23666
+ "querystring",
23667
+ "readline",
23668
+ "readline/promises",
23669
+ "repl",
23670
+ "stream",
23671
+ "stream/consumers",
23672
+ "stream/promises",
23673
+ "stream/web",
23674
+ "string_decoder",
23675
+ "sys",
23676
+ "test/mock_loader",
23677
+ "timers",
23678
+ "timers/promises",
23679
+ "tls",
23680
+ "trace_events",
23681
+ "tty",
23682
+ "url",
23683
+ "util",
23684
+ "util/types",
23685
+ "v8",
23686
+ "vm",
23687
+ "wasi",
23688
+ "worker_threads",
23689
+ "zlib"
23690
+ ];
23691
+ var unprefixedNodeCoreModules = new Set(unprefixedNodeCoreModulesList);
23692
+ var exclusivelyPrefixedNodeCoreModules = /* @__PURE__ */ new Set([
23693
+ "node:sea",
23694
+ "node:sqlite",
23695
+ "node:test",
23696
+ "node:test/reporters"
23697
+ ]);
23698
+ var nodeCoreModules = /* @__PURE__ */ new Set([
23699
+ ...unprefixedNodeCoreModulesList,
23700
+ ...unprefixedNodeCoreModulesList.map((name) => `node:${name}`),
23701
+ ...exclusivelyPrefixedNodeCoreModules
23702
+ ]);
23629
23703
 
23630
23704
  // src/compiler/factory/baseNodeFactory.ts
23631
23705
  function createBaseNodeFactory() {
@@ -74394,6 +74468,12 @@ function createTypeChecker(host) {
74394
74468
  function getControlFlowContainer(node) {
74395
74469
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 307 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
74396
74470
  }
74471
+ function isSymbolAssignedDefinitely(symbol) {
74472
+ if (symbol.lastAssignmentPos !== void 0) {
74473
+ return symbol.lastAssignmentPos < 0;
74474
+ }
74475
+ return isSymbolAssigned(symbol) && symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
74476
+ }
74397
74477
  function isSymbolAssigned(symbol) {
74398
74478
  return !isPastLastAssignment(
74399
74479
  symbol,
@@ -74413,7 +74493,7 @@ function createTypeChecker(host) {
74413
74493
  markNodeAssignments(parent2);
74414
74494
  }
74415
74495
  }
74416
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
74496
+ return !symbol.lastAssignmentPos || location && Math.abs(symbol.lastAssignmentPos) < location.pos;
74417
74497
  }
74418
74498
  function isSomeSymbolAssigned(rootDeclaration) {
74419
74499
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -74434,12 +74514,19 @@ function createTypeChecker(host) {
74434
74514
  function markNodeAssignments(node) {
74435
74515
  switch (node.kind) {
74436
74516
  case 80 /* Identifier */:
74437
- if (isAssignmentTarget(node)) {
74517
+ const assigmentTarget = getAssignmentTargetKind(node);
74518
+ if (assigmentTarget !== 0 /* None */) {
74438
74519
  const symbol = getResolvedSymbol(node);
74439
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
74440
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74441
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74442
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74520
+ const hasDefiniteAssignment = assigmentTarget === 1 /* Definite */ || symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
74521
+ if (isParameterOrMutableLocalVariable(symbol)) {
74522
+ if (symbol.lastAssignmentPos === void 0 || Math.abs(symbol.lastAssignmentPos) !== Number.MAX_VALUE) {
74523
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74524
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74525
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74526
+ }
74527
+ if (hasDefiniteAssignment && symbol.lastAssignmentPos > 0) {
74528
+ symbol.lastAssignmentPos *= -1;
74529
+ }
74443
74530
  }
74444
74531
  }
74445
74532
  return;
@@ -74456,7 +74543,8 @@ function createTypeChecker(host) {
74456
74543
  true
74457
74544
  );
74458
74545
  if (symbol && isParameterOrMutableLocalVariable(symbol)) {
74459
- symbol.lastAssignmentPos = Number.MAX_VALUE;
74546
+ const sign = symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0 ? -1 : 1;
74547
+ symbol.lastAssignmentPos = sign * Number.MAX_VALUE;
74460
74548
  }
74461
74549
  }
74462
74550
  return;
@@ -75040,6 +75128,7 @@ function createTypeChecker(host) {
75040
75128
  }
75041
75129
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
75042
75130
  let declaration = localOrExportSymbol.valueDeclaration;
75131
+ const immediateDeclaration = declaration;
75043
75132
  if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent2) => parent2 === declaration.parent)) {
75044
75133
  return nonInferrableAnyType;
75045
75134
  }
@@ -75085,7 +75174,8 @@ function createTypeChecker(host) {
75085
75174
  while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
75086
75175
  flowContainer = getControlFlowContainer(flowContainer);
75087
75176
  }
75088
- const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
75177
+ const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol);
75178
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
75089
75179
  const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type);
75090
75180
  const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer);
75091
75181
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -96271,7 +96361,7 @@ function transformTypeScript(context) {
96271
96361
  let currentNamespaceContainerName;
96272
96362
  let currentLexicalScope;
96273
96363
  let currentScopeFirstDeclarationsOfName;
96274
- let enabledSubstitutions;
96364
+ let enabledSubstitutions = 0 /* None */;
96275
96365
  let applicableSubstitutions;
96276
96366
  return transformSourceFileOrBundle;
96277
96367
  function transformSourceFileOrBundle(node) {
@@ -98079,7 +98169,7 @@ function transformClassFields(context) {
98079
98169
  const previousOnEmitNode = context.onEmitNode;
98080
98170
  context.onEmitNode = onEmitNode;
98081
98171
  let shouldTransformPrivateStaticElementsInFile = false;
98082
- let enabledSubstitutions;
98172
+ let enabledSubstitutions = 0 /* None */;
98083
98173
  let classAliases;
98084
98174
  let pendingExpressions;
98085
98175
  let pendingStatements;
@@ -103008,7 +103098,7 @@ function transformES2017(context) {
103008
103098
  const resolver = context.getEmitResolver();
103009
103099
  const compilerOptions = context.getCompilerOptions();
103010
103100
  const languageVersion = getEmitScriptTarget(compilerOptions);
103011
- let enabledSubstitutions;
103101
+ let enabledSubstitutions = 0 /* None */;
103012
103102
  let enclosingSuperContainerFlags = 0;
103013
103103
  let enclosingFunctionParameterNames;
103014
103104
  let capturedSuperProperties;
@@ -103883,7 +103973,7 @@ function transformES2018(context) {
103883
103973
  const previousOnSubstituteNode = context.onSubstituteNode;
103884
103974
  context.onSubstituteNode = onSubstituteNode;
103885
103975
  let exportedVariableStatement = false;
103886
- let enabledSubstitutions;
103976
+ let enabledSubstitutions = 0 /* None */;
103887
103977
  let enclosingFunctionFlags;
103888
103978
  let parametersWithPrecedingObjectRestOrSpread;
103889
103979
  let enclosingSuperContainerFlags = 0;
@@ -107018,7 +107108,7 @@ function transformES2015(context) {
107018
107108
  );
107019
107109
  }
107020
107110
  let convertedLoopState;
107021
- let enabledSubstitutions;
107111
+ let enabledSubstitutions = 0 /* None */;
107022
107112
  return chainBundle(context, transformSourceFile);
107023
107113
  function transformSourceFile(node) {
107024
107114
  if (node.isDeclarationFile) {
@@ -124900,7 +124990,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124900
124990
  const packageIdToSourceFile = /* @__PURE__ */ new Map();
124901
124991
  let sourceFileToPackageName = /* @__PURE__ */ new Map();
124902
124992
  let redirectTargetsMap = createMultiMap();
124903
- let usesUriStyleNodeCoreModules = false;
124993
+ let usesUriStyleNodeCoreModules;
124904
124994
  const filesByName = /* @__PURE__ */ new Map();
124905
124995
  let missingFileNames = /* @__PURE__ */ new Map();
124906
124996
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
@@ -126322,7 +126412,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126322
126412
  );
126323
126413
  imports = append(imports, moduleNameExpr);
126324
126414
  if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) {
126325
- usesUriStyleNodeCoreModules = startsWith(moduleNameExpr.text, "node:");
126415
+ if (startsWith(moduleNameExpr.text, "node:") && !exclusivelyPrefixedNodeCoreModules.has(moduleNameExpr.text)) {
126416
+ usesUriStyleNodeCoreModules = true;
126417
+ } else if (usesUriStyleNodeCoreModules === void 0 && unprefixedNodeCoreModules.has(moduleNameExpr.text)) {
126418
+ usesUriStyleNodeCoreModules = false;
126419
+ }
126326
126420
  }
126327
126421
  }
126328
126422
  } else if (isModuleDeclaration(node)) {
@@ -135798,8 +135892,6 @@ __export(ts_JsTyping_exports, {
135798
135892
  isTypingUpToDate: () => isTypingUpToDate,
135799
135893
  loadSafeList: () => loadSafeList,
135800
135894
  loadTypesMap: () => loadTypesMap,
135801
- nodeCoreModuleList: () => nodeCoreModuleList,
135802
- nodeCoreModules: () => nodeCoreModules,
135803
135895
  nonRelativeModuleNameForTypingCache: () => nonRelativeModuleNameForTypingCache,
135804
135896
  renderPackageNameValidationFailure: () => renderPackageNameValidationFailure,
135805
135897
  validatePackageName: () => validatePackageName
@@ -135848,58 +135940,6 @@ function isTypingUpToDate(cachedTyping, availableTypingVersions) {
135848
135940
  const availableVersion = new Version(getProperty(availableTypingVersions, `ts${versionMajorMinor}`) || getProperty(availableTypingVersions, "latest"));
135849
135941
  return availableVersion.compareTo(cachedTyping.version) <= 0;
135850
135942
  }
135851
- var unprefixedNodeCoreModuleList = [
135852
- "assert",
135853
- "assert/strict",
135854
- "async_hooks",
135855
- "buffer",
135856
- "child_process",
135857
- "cluster",
135858
- "console",
135859
- "constants",
135860
- "crypto",
135861
- "dgram",
135862
- "diagnostics_channel",
135863
- "dns",
135864
- "dns/promises",
135865
- "domain",
135866
- "events",
135867
- "fs",
135868
- "fs/promises",
135869
- "http",
135870
- "https",
135871
- "http2",
135872
- "inspector",
135873
- "module",
135874
- "net",
135875
- "os",
135876
- "path",
135877
- "perf_hooks",
135878
- "process",
135879
- "punycode",
135880
- "querystring",
135881
- "readline",
135882
- "repl",
135883
- "stream",
135884
- "stream/promises",
135885
- "string_decoder",
135886
- "timers",
135887
- "timers/promises",
135888
- "tls",
135889
- "trace_events",
135890
- "tty",
135891
- "url",
135892
- "util",
135893
- "util/types",
135894
- "v8",
135895
- "vm",
135896
- "wasi",
135897
- "worker_threads",
135898
- "zlib"
135899
- ];
135900
- var prefixedNodeCoreModuleList = unprefixedNodeCoreModuleList.map((name) => `node:${name}`);
135901
- var nodeCoreModuleList = [...unprefixedNodeCoreModuleList, ...prefixedNodeCoreModuleList];
135902
- var nodeCoreModules = new Set(nodeCoreModuleList);
135903
135943
  function nonRelativeModuleNameForTypingCache(moduleName) {
135904
135944
  return nodeCoreModules.has(moduleName) ? "node" : moduleName;
135905
135945
  }
@@ -138903,7 +138943,7 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
138903
138943
  return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
138904
138944
  }
138905
138945
  function isAllowedCoreNodeModulesImport(moduleSpecifier) {
138906
- if (isFullSourceFile(fromFile) && isSourceFileJS(fromFile) && ts_JsTyping_exports.nodeCoreModules.has(moduleSpecifier)) {
138946
+ if (isFullSourceFile(fromFile) && isSourceFileJS(fromFile) && nodeCoreModules.has(moduleSpecifier)) {
138907
138947
  if (usesNodeCoreModules === void 0) {
138908
138948
  usesNodeCoreModules = consumesNodeCoreModules(fromFile);
138909
138949
  }
@@ -138940,7 +138980,7 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
138940
138980
  }
138941
138981
  }
138942
138982
  function consumesNodeCoreModules(sourceFile) {
138943
- return some(sourceFile.imports, ({ text }) => ts_JsTyping_exports.nodeCoreModules.has(text));
138983
+ return some(sourceFile.imports, ({ text }) => nodeCoreModules.has(text));
138944
138984
  }
138945
138985
  function isInsideNodeModules(fileOrDirectory) {
138946
138986
  return contains(getPathComponents(fileOrDirectory), "node_modules");
@@ -139076,11 +139116,16 @@ function isDeprecatedDeclaration(decl) {
139076
139116
  return !!(getCombinedNodeFlagsAlwaysIncludeJSDoc(decl) & 65536 /* Deprecated */);
139077
139117
  }
139078
139118
  function shouldUseUriStyleNodeCoreModules(file, program) {
139079
- const decisionFromFile = firstDefined(file.imports, (node) => {
139080
- if (ts_JsTyping_exports.nodeCoreModules.has(node.text)) {
139081
- return startsWith(node.text, "node:");
139119
+ let decisionFromFile;
139120
+ for (const node of file.imports) {
139121
+ if (nodeCoreModules.has(node.text) && !exclusivelyPrefixedNodeCoreModules.has(node.text)) {
139122
+ if (startsWith(node.text, "node:")) {
139123
+ return true;
139124
+ } else {
139125
+ decisionFromFile = false;
139126
+ }
139082
139127
  }
139083
- });
139128
+ }
139084
139129
  return decisionFromFile ?? program.usesUriStyleNodeCoreModules;
139085
139130
  }
139086
139131
  function getNewLineKind(newLineCharacter) {
@@ -139430,30 +139475,39 @@ function createCacheableExportInfoMap(host) {
139430
139475
  return !packageDeepestNodeModulesPath || startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
139431
139476
  }
139432
139477
  }
139433
- function isImportableFile(program, from, to, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) {
139478
+ function isImportable(program, fromFile, toFile, toModule, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) {
139434
139479
  var _a;
139435
- if (from === to) return false;
139436
- const cachedResult = moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
139480
+ if (!toFile) {
139481
+ let useNodePrefix;
139482
+ const moduleName = stripQuotes(toModule.name);
139483
+ if (nodeCoreModules.has(moduleName) && (useNodePrefix = shouldUseUriStyleNodeCoreModules(fromFile, program)) !== void 0) {
139484
+ return useNodePrefix === startsWith(moduleName, "node:");
139485
+ }
139486
+ return !packageJsonFilter || packageJsonFilter.allowsImportingAmbientModule(toModule, moduleSpecifierResolutionHost) || fileContainsPackageImport(fromFile, moduleName);
139487
+ }
139488
+ Debug.assertIsDefined(toFile);
139489
+ if (fromFile === toFile) return false;
139490
+ const cachedResult = moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.get(fromFile.path, toFile.path, preferences, {});
139437
139491
  if ((cachedResult == null ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== void 0) {
139438
- return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(from, cachedResult.packageName);
139492
+ return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(fromFile, cachedResult.packageName);
139439
139493
  }
139440
139494
  const getCanonicalFileName = hostGetCanonicalFileName(moduleSpecifierResolutionHost);
139441
139495
  const globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(moduleSpecifierResolutionHost);
139442
139496
  const hasImportablePath = !!ts_moduleSpecifiers_exports.forEachFileNameOfModule(
139443
- from.fileName,
139444
- to.fileName,
139497
+ fromFile.fileName,
139498
+ toFile.fileName,
139445
139499
  moduleSpecifierResolutionHost,
139446
139500
  /*preferSymlinks*/
139447
139501
  false,
139448
139502
  (toPath3) => {
139449
- const toFile = program.getSourceFile(toPath3);
139450
- return (toFile === to || !toFile) && isImportablePath(from.fileName, toPath3, getCanonicalFileName, globalTypingsCache);
139503
+ const file = program.getSourceFile(toPath3);
139504
+ return (file === toFile || !file) && isImportablePath(fromFile.fileName, toPath3, getCanonicalFileName, globalTypingsCache);
139451
139505
  }
139452
139506
  );
139453
139507
  if (packageJsonFilter) {
139454
- const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(to, moduleSpecifierResolutionHost) : void 0;
139455
- moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, importInfo == null ? void 0 : importInfo.packageName, !(importInfo == null ? void 0 : importInfo.importable));
139456
- return !!(importInfo == null ? void 0 : importInfo.importable) || !!(importInfo == null ? void 0 : importInfo.packageName) && fileContainsPackageImport(from, importInfo.packageName);
139508
+ const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(toFile, moduleSpecifierResolutionHost) : void 0;
139509
+ moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(fromFile.path, toFile.path, preferences, {}, importInfo == null ? void 0 : importInfo.packageName, !(importInfo == null ? void 0 : importInfo.importable));
139510
+ return !!(importInfo == null ? void 0 : importInfo.importable) || hasImportablePath && !!(importInfo == null ? void 0 : importInfo.packageName) && fileContainsPackageImport(fromFile, importInfo.packageName);
139457
139511
  }
139458
139512
  return hasImportablePath;
139459
139513
  }
@@ -156282,7 +156336,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
156282
156336
  });
156283
156337
  function addSymbol(moduleSymbol, toFile, exportedSymbol, exportKind, program2, isFromPackageJson) {
156284
156338
  const moduleSpecifierResolutionHost = getModuleSpecifierResolutionHost(isFromPackageJson);
156285
- if (toFile && isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || (!toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) || fileContainsPackageImport(fromFile, stripQuotes(moduleSymbol.name)))) {
156339
+ if (isImportable(program2, fromFile, toFile, moduleSymbol, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache)) {
156286
156340
  const checker = program2.getTypeChecker();
156287
156341
  originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { symbol: exportedSymbol, moduleSymbol, moduleFileName: toFile == null ? void 0 : toFile.fileName, exportKind, targetFlags: skipAlias(exportedSymbol, checker).flags, isFromPackageJson });
156288
156342
  }
@@ -158560,7 +158614,7 @@ function tryGetImportedPackageName(sourceFile, pos) {
158560
158614
  }
158561
158615
  function getTypesPackageNameToInstall(packageName, host, diagCode) {
158562
158616
  var _a;
158563
- return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0;
158617
+ return diagCode === errorCodeCannotFindModule ? nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0;
158564
158618
  }
158565
158619
 
158566
158620
  // src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
@@ -166262,18 +166316,11 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166262
166316
  }
166263
166317
  );
166264
166318
  function isImportableExportInfo(info) {
166265
- const moduleFile = tryCast(info.moduleSymbol.valueDeclaration, isSourceFile);
166266
- if (!moduleFile) {
166267
- const moduleName = stripQuotes(info.moduleSymbol.name);
166268
- if (ts_JsTyping_exports.nodeCoreModules.has(moduleName) && startsWith(moduleName, "node:") !== shouldUseUriStyleNodeCoreModules(sourceFile, program)) {
166269
- return false;
166270
- }
166271
- return ((packageJsonFilter == null ? void 0 : packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson))) ?? true) || fileContainsPackageImport(sourceFile, moduleName);
166272
- }
166273
- return isImportableFile(
166319
+ return isImportable(
166274
166320
  info.isFromPackageJson ? packageJsonAutoImportProvider : program,
166275
166321
  sourceFile,
166276
- moduleFile,
166322
+ tryCast(info.moduleSymbol.valueDeclaration, isSourceFile),
166323
+ info.moduleSymbol,
166277
166324
  preferences,
166278
166325
  packageJsonFilter,
166279
166326
  getModuleSpecifierResolutionHost(info.isFromPackageJson),
@@ -180121,6 +180168,7 @@ __export(ts_exports2, {
180121
180168
  escapeTemplateSubstitution: () => escapeTemplateSubstitution,
180122
180169
  evaluatorResult: () => evaluatorResult,
180123
180170
  every: () => every,
180171
+ exclusivelyPrefixedNodeCoreModules: () => exclusivelyPrefixedNodeCoreModules,
180124
180172
  executeCommandLine: () => executeCommandLine,
180125
180173
  expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
180126
180174
  explainFiles: () => explainFiles,
@@ -180133,7 +180181,6 @@ __export(ts_exports2, {
180133
180181
  extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
180134
180182
  externalHelpersModuleNameText: () => externalHelpersModuleNameText,
180135
180183
  factory: () => factory,
180136
- fileContainsPackageImport: () => fileContainsPackageImport,
180137
180184
  fileExtensionIs: () => fileExtensionIs,
180138
180185
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
180139
180186
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -180983,7 +181030,7 @@ __export(ts_exports2, {
180983
181030
  isImportSpecifier: () => isImportSpecifier,
180984
181031
  isImportTypeAssertionContainer: () => isImportTypeAssertionContainer,
180985
181032
  isImportTypeNode: () => isImportTypeNode,
180986
- isImportableFile: () => isImportableFile,
181033
+ isImportable: () => isImportable,
180987
181034
  isInComment: () => isInComment,
180988
181035
  isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
180989
181036
  isInExpressionContext: () => isInExpressionContext,
@@ -181464,6 +181511,7 @@ __export(ts_exports2, {
181464
181511
  noTransformers: () => noTransformers,
181465
181512
  noTruncationMaximumTruncationLength: () => noTruncationMaximumTruncationLength,
181466
181513
  nodeCanBeDecorated: () => nodeCanBeDecorated,
181514
+ nodeCoreModules: () => nodeCoreModules,
181467
181515
  nodeHasName: () => nodeHasName,
181468
181516
  nodeIsDecorated: () => nodeIsDecorated,
181469
181517
  nodeIsMissing: () => nodeIsMissing,
@@ -181814,6 +181862,7 @@ __export(ts_exports2, {
181814
181862
  unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
181815
181863
  unmangleScopedPackageName: () => unmangleScopedPackageName,
181816
181864
  unorderedRemoveItem: () => unorderedRemoveItem,
181865
+ unprefixedNodeCoreModules: () => unprefixedNodeCoreModules,
181817
181866
  unreachableCodeIsError: () => unreachableCodeIsError,
181818
181867
  unsetNodeChildren: () => unsetNodeChildren,
181819
181868
  unusedLabelIsError: () => unusedLabelIsError,
@@ -184235,19 +184284,12 @@ var Project2 = class _Project {
184235
184284
  }
184236
184285
  /** @internal */
184237
184286
  onAutoImportProviderSettingsChanged() {
184238
- var _a;
184239
- if (this.autoImportProviderHost === false) {
184240
- this.autoImportProviderHost = void 0;
184241
- } else {
184242
- (_a = this.autoImportProviderHost) == null ? void 0 : _a.markAsDirty();
184243
- }
184287
+ this.markAutoImportProviderAsDirty();
184244
184288
  }
184245
184289
  /** @internal */
184246
184290
  onPackageJsonChange() {
184247
184291
  this.moduleSpecifierCache.clear();
184248
- if (this.autoImportProviderHost) {
184249
- this.autoImportProviderHost.markAsDirty();
184250
- }
184292
+ this.markAutoImportProviderAsDirty();
184251
184293
  }
184252
184294
  /** @internal */
184253
184295
  onFileAddedOrRemoved(isSymlink) {
@@ -185003,7 +185045,7 @@ var Project2 = class _Project {
185003
185045
  if (dependencySelection) {
185004
185046
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getPackageJsonAutoImportProvider");
185005
185047
  const start = timestamp();
185006
- this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getHostForAutoImportProvider(), this.documentRegistry);
185048
+ this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getHostForAutoImportProvider(), this.documentRegistry) ?? false;
185007
185049
  if (this.autoImportProviderHost) {
185008
185050
  updateProjectIfDirty(this.autoImportProviderHost);
185009
185051
  this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", timestamp() - start);
@@ -185261,7 +185303,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
185261
185303
  if (dependencyNames) {
185262
185304
  const symlinkCache = hostProject.getSymlinkCache();
185263
185305
  for (const name of arrayFrom(dependencyNames.keys())) {
185264
- if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
185306
+ if (dependencySelection === 2 /* Auto */ && dependenciesAdded >= this.maxDependencies) {
185265
185307
  hostProject.log(`AutoImportProviderProject: attempted to add more than ${this.maxDependencies} dependencies. Aborting.`);
185266
185308
  return emptyArray;
185267
185309
  }
@@ -188763,6 +188805,7 @@ Dynamic files must always be opened with service's current directory or service
188763
188805
  }
188764
188806
  };
188765
188807
  toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach(retainConfiguredProject);
188808
+ if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188766
188809
  this.inferredProjects.forEach(markOriginalProjectsAsUsed);
188767
188810
  this.externalProjects.forEach(markOriginalProjectsAsUsed);
188768
188811
  this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
@@ -188770,7 +188813,8 @@ Dynamic files must always be opened with service's current directory or service
188770
188813
  projects.forEach(retainConfiguredProject);
188771
188814
  }
188772
188815
  });
188773
- this.openFiles.forEach((_projectRootPath, path) => {
188816
+ if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188817
+ forEachEntry(this.openFiles, (_projectRootPath, path) => {
188774
188818
  if (openFilesWithRetainedConfiguredProject == null ? void 0 : openFilesWithRetainedConfiguredProject.has(path)) return;
188775
188819
  const info = this.getScriptInfoForPath(path);
188776
188820
  if (find(info.containingProjects, isExternalProject)) return;
@@ -188780,12 +188824,15 @@ Dynamic files must always be opened with service's current directory or service
188780
188824
  );
188781
188825
  if (result == null ? void 0 : result.defaultProject) {
188782
188826
  result == null ? void 0 : result.seenProjects.forEach(retainConfiguredProject);
188827
+ if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188783
188828
  }
188784
188829
  });
188785
- this.configuredProjects.forEach((project) => {
188830
+ if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188831
+ forEachEntry(this.configuredProjects, (project) => {
188786
188832
  if (toRemoveConfiguredProjects.has(project)) {
188787
188833
  if (isPendingUpdate(project) || forEachReferencedProject(project, isRetained)) {
188788
188834
  retainConfiguredProject(project);
188835
+ if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188789
188836
  }
188790
188837
  }
188791
188838
  });
@@ -194479,6 +194526,7 @@ if (typeof console !== "undefined") {
194479
194526
  escapeTemplateSubstitution,
194480
194527
  evaluatorResult,
194481
194528
  every,
194529
+ exclusivelyPrefixedNodeCoreModules,
194482
194530
  executeCommandLine,
194483
194531
  expandPreOrPostfixIncrementOrDecrementExpression,
194484
194532
  explainFiles,
@@ -194491,7 +194539,6 @@ if (typeof console !== "undefined") {
194491
194539
  extensionsNotSupportingExtensionlessResolution,
194492
194540
  externalHelpersModuleNameText,
194493
194541
  factory,
194494
- fileContainsPackageImport,
194495
194542
  fileExtensionIs,
194496
194543
  fileExtensionIsOneOf,
194497
194544
  fileIncludeReasonToDiagnostics,
@@ -195341,7 +195388,7 @@ if (typeof console !== "undefined") {
195341
195388
  isImportSpecifier,
195342
195389
  isImportTypeAssertionContainer,
195343
195390
  isImportTypeNode,
195344
- isImportableFile,
195391
+ isImportable,
195345
195392
  isInComment,
195346
195393
  isInCompoundLikeAssignment,
195347
195394
  isInExpressionContext,
@@ -195822,6 +195869,7 @@ if (typeof console !== "undefined") {
195822
195869
  noTransformers,
195823
195870
  noTruncationMaximumTruncationLength,
195824
195871
  nodeCanBeDecorated,
195872
+ nodeCoreModules,
195825
195873
  nodeHasName,
195826
195874
  nodeIsDecorated,
195827
195875
  nodeIsMissing,
@@ -196172,6 +196220,7 @@ if (typeof console !== "undefined") {
196172
196220
  unescapeLeadingUnderscores,
196173
196221
  unmangleScopedPackageName,
196174
196222
  unorderedRemoveItem,
196223
+ unprefixedNodeCoreModules,
196175
196224
  unreachableCodeIsError,
196176
196225
  unsetNodeChildren,
196177
196226
  unusedLabelIsError,
@@ -1225,6 +1225,8 @@
1225
1225
  "Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028": "专用标识符仅在面向 ECMAScript 2015 和更高版本时可用。",
1226
1226
  "Private_identifiers_cannot_be_used_as_parameters_18009": "不能将专用标识符用作参数。",
1227
1227
  "Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105": "不能在类型参数上访问专用或受保护的成员 \"{0}\"。",
1228
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
1229
+ "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383": "Project '{0}' can't be built because its dependency '{1}' was not built",
1228
1230
  "Project_0_is_being_forcibly_rebuilt_6388": "正在强制重新生成项目“{0}”",
1229
1231
  "Project_0_is_out_of_date_because_1_6420": "由于 {1},项目“{0}”已过期。",
1230
1232
  "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412": "由于 buildinfo 文件“{1}”指示文件“{2}”曾是编译的根文件,但不再是了,因此项目“{0}”已过期。",
@@ -1434,9 +1436,12 @@
1434
1436
  "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "显示将生成(如果指定有 '--clean',则删除)什么",
1435
1437
  "Signature_0_must_be_a_type_predicate_1224": "签名“{0}”必须为类型谓词。",
1436
1438
  "Signature_declarations_can_only_be_used_in_TypeScript_files_8017": "签名声明只能在 TypeScript 文件中使用。",
1439
+ "Skip_building_downstream_projects_on_error_in_upstream_project_6640": "跳过在上游项目出错时生成下游项目。",
1437
1440
  "Skip_type_checking_all_d_ts_files_6693": "跳过对所有 .d.ts 文件的类型检查。",
1438
1441
  "Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692": "跳过 TypeScript 附带的类型检查 .d.ts 文件。",
1439
1442
  "Skip_type_checking_of_declaration_files_6012": "跳过声明文件的类型检查。",
1443
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
1444
+ "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382": "Skipping build of project '{0}' because its dependency '{1}' was not built",
1440
1445
  "Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1_6164": "正在跳过看起来像绝对 URI、目标文件类型的模块“{0}”: {1}。",
1441
1446
  "Source_from_referenced_project_0_included_because_1_specified_1414": "由于指定了 \"{1}\",因此包含了引用的项目 \"{0}\" 的源",
1442
1447
  "Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415": "由于已将 \"--module\" 指定为 \"none\",因此包含了引用的项目 \"{0}\" 的源",
@@ -1660,6 +1665,7 @@
1660
1665
  "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "此成员必须有 \"override\" 修饰符,因为它替代基类 \"{0}\" 中声明的一个抽象方法。",
1661
1666
  "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "只能通过启用 \"{0}\" 标志并引用其默认导出,使用 ECMAScript 导入/导出来引用此模块。",
1662
1667
  "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "此模块是使用 “export =” 声明的,只能在使用“{0}”标志时用于默认导入。",
1668
+ "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807": "可以简化此操作。此班次与 `{0} {1} {2}` 相同。",
1663
1669
  "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012": "此重载隐式返回类型“{0}”,因为它缺少返回类型批注。",
1664
1670
  "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "此重载签名与其实现签名不兼容。",
1665
1671
  "This_parameter_is_not_allowed_with_use_strict_directive_1346": "此参数不允许与 \"use strict\" 指令一起使用。",