@typescript-deploys/pr-build 5.6.0-pr-59170-7 → 5.6.0-pr-59154-17

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
@@ -12745,7 +12745,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
12745
12745
  }
12746
12746
  if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
12747
12747
  return skipTrivia(
12748
- (sourceFile || getSourceFileOfNode(node)).text,
12748
+ (sourceFile ?? getSourceFileOfNode(node)).text,
12749
12749
  node.pos,
12750
12750
  /*stopAfterLineBreak*/
12751
12751
  false,
@@ -12757,13 +12757,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
12757
12757
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
12758
12758
  }
12759
12759
  if (node.kind === 352 /* SyntaxList */) {
12760
- const first2 = firstOrUndefined(getNodeChildren(node));
12760
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
12761
+ const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
12761
12762
  if (first2) {
12762
12763
  return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
12763
12764
  }
12764
12765
  }
12765
12766
  return skipTrivia(
12766
- (sourceFile || getSourceFileOfNode(node)).text,
12767
+ (sourceFile ?? getSourceFileOfNode(node)).text,
12767
12768
  node.pos,
12768
12769
  /*stopAfterLineBreak*/
12769
12770
  false,
@@ -23511,7 +23512,7 @@ function createNodeFactory(flags, baseFactory2) {
23511
23512
  }
23512
23513
  function createSyntaxList(children) {
23513
23514
  const node = createBaseNode(352 /* SyntaxList */);
23514
- setNodeChildren(node, children);
23515
+ node._children = children;
23515
23516
  return node;
23516
23517
  }
23517
23518
  function createNotEmittedStatement(original) {
@@ -26287,17 +26288,31 @@ function isJSDocImportTag(node) {
26287
26288
  }
26288
26289
 
26289
26290
  // src/compiler/factory/nodeChildren.ts
26290
- var nodeChildren = /* @__PURE__ */ new WeakMap();
26291
- function getNodeChildren(node) {
26292
- if (!isNodeKind(node.kind)) return emptyArray;
26293
- return nodeChildren.get(node);
26291
+ var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
26292
+ function getNodeChildren(node, sourceFile) {
26293
+ var _a;
26294
+ const kind = node.kind;
26295
+ if (!isNodeKind(kind)) {
26296
+ return emptyArray;
26297
+ }
26298
+ if (kind === 352 /* SyntaxList */) {
26299
+ return node._children;
26300
+ }
26301
+ return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
26294
26302
  }
26295
- function setNodeChildren(node, children) {
26296
- nodeChildren.set(node, children);
26297
- return children;
26303
+ function unsetNodeChildren(node, origSourceFile) {
26304
+ var _a;
26305
+ if (node.kind === 352 /* SyntaxList */) {
26306
+ Debug.fail("Did not expect to unset the children of a SyntaxList.");
26307
+ }
26308
+ (_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
26298
26309
  }
26299
- function unsetNodeChildren(node) {
26300
- nodeChildren.delete(node);
26310
+ function transferSourceFileChildren(sourceFile, targetSourceFile) {
26311
+ const map2 = sourceFileToNodeChildren.get(sourceFile);
26312
+ if (map2 !== void 0) {
26313
+ sourceFileToNodeChildren.delete(sourceFile);
26314
+ sourceFileToNodeChildren.set(targetSourceFile, map2);
26315
+ }
26301
26316
  }
26302
26317
 
26303
26318
  // src/compiler/factory/utilities.ts
@@ -34887,6 +34902,7 @@ var IncrementalParser;
34887
34902
  aggressiveChecks
34888
34903
  );
34889
34904
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
34905
+ transferSourceFileChildren(sourceFile, result);
34890
34906
  return result;
34891
34907
  }
34892
34908
  IncrementalParser2.updateSourceFile = updateSourceFile;
@@ -34922,7 +34938,7 @@ var IncrementalParser;
34922
34938
  }
34923
34939
  }
34924
34940
  }
34925
- function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
34941
+ function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
34926
34942
  if (isArray2) {
34927
34943
  visitArray2(element);
34928
34944
  } else {
@@ -34934,7 +34950,7 @@ var IncrementalParser;
34934
34950
  if (aggressiveChecks && shouldCheckNode(node)) {
34935
34951
  text = oldText.substring(node.pos, node.end);
34936
34952
  }
34937
- unsetNodeChildren(node);
34953
+ unsetNodeChildren(node, origSourceFile);
34938
34954
  setTextRangePosEnd(node, node.pos + delta, node.end + delta);
34939
34955
  if (aggressiveChecks && shouldCheckNode(node)) {
34940
34956
  Debug.assert(text === newText.substring(node.pos, node.end));
@@ -35008,6 +35024,7 @@ var IncrementalParser;
35008
35024
  if (child.pos > changeRangeOldEnd) {
35009
35025
  moveElementEntirelyPastChangeRange(
35010
35026
  child,
35027
+ sourceFile,
35011
35028
  /*isArray*/
35012
35029
  false,
35013
35030
  delta,
@@ -35020,7 +35037,7 @@ var IncrementalParser;
35020
35037
  const fullEnd = child.end;
35021
35038
  if (fullEnd >= changeStart) {
35022
35039
  markAsIntersectingIncrementalChange(child);
35023
- unsetNodeChildren(child);
35040
+ unsetNodeChildren(child, sourceFile);
35024
35041
  adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
35025
35042
  forEachChild(child, visitNode3, visitArray2);
35026
35043
  if (hasJSDocNodes(child)) {
@@ -35038,6 +35055,7 @@ var IncrementalParser;
35038
35055
  if (array.pos > changeRangeOldEnd) {
35039
35056
  moveElementEntirelyPastChangeRange(
35040
35057
  array,
35058
+ sourceFile,
35041
35059
  /*isArray*/
35042
35060
  true,
35043
35061
  delta,
@@ -51423,8 +51441,8 @@ function createTypeChecker(host) {
51423
51441
  const type = getReturnTypeOfSignature(signature);
51424
51442
  if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
51425
51443
  const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
51426
- if (annotation) {
51427
- const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
51444
+ if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
51445
+ const result = tryReuseExistingTypeNodeHelper(context, annotation);
51428
51446
  if (result) {
51429
51447
  return result;
51430
51448
  }
package/lib/typescript.js CHANGED
@@ -2143,6 +2143,7 @@ __export(typescript_exports, {
2143
2143
  trace: () => trace,
2144
2144
  tracing: () => tracing,
2145
2145
  tracingEnabled: () => tracingEnabled,
2146
+ transferSourceFileChildren: () => transferSourceFileChildren,
2146
2147
  transform: () => transform,
2147
2148
  transformClassFields: () => transformClassFields,
2148
2149
  transformDeclarations: () => transformDeclarations,
@@ -16357,7 +16358,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
16357
16358
  }
16358
16359
  if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
16359
16360
  return skipTrivia(
16360
- (sourceFile || getSourceFileOfNode(node)).text,
16361
+ (sourceFile ?? getSourceFileOfNode(node)).text,
16361
16362
  node.pos,
16362
16363
  /*stopAfterLineBreak*/
16363
16364
  false,
@@ -16369,13 +16370,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
16369
16370
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
16370
16371
  }
16371
16372
  if (node.kind === 352 /* SyntaxList */) {
16372
- const first2 = firstOrUndefined(getNodeChildren(node));
16373
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
16374
+ const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
16373
16375
  if (first2) {
16374
16376
  return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
16375
16377
  }
16376
16378
  }
16377
16379
  return skipTrivia(
16378
- (sourceFile || getSourceFileOfNode(node)).text,
16380
+ (sourceFile ?? getSourceFileOfNode(node)).text,
16379
16381
  node.pos,
16380
16382
  /*stopAfterLineBreak*/
16381
16383
  false,
@@ -27606,7 +27608,7 @@ function createNodeFactory(flags, baseFactory2) {
27606
27608
  }
27607
27609
  function createSyntaxList3(children) {
27608
27610
  const node = createBaseNode(352 /* SyntaxList */);
27609
- setNodeChildren(node, children);
27611
+ node._children = children;
27610
27612
  return node;
27611
27613
  }
27612
27614
  function createNotEmittedStatement(original) {
@@ -30507,17 +30509,43 @@ function isSyntaxList(n) {
30507
30509
  }
30508
30510
 
30509
30511
  // src/compiler/factory/nodeChildren.ts
30510
- var nodeChildren = /* @__PURE__ */ new WeakMap();
30511
- function getNodeChildren(node) {
30512
- if (!isNodeKind(node.kind)) return emptyArray;
30513
- return nodeChildren.get(node);
30512
+ var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
30513
+ function getNodeChildren(node, sourceFile) {
30514
+ var _a;
30515
+ const kind = node.kind;
30516
+ if (!isNodeKind(kind)) {
30517
+ return emptyArray;
30518
+ }
30519
+ if (kind === 352 /* SyntaxList */) {
30520
+ return node._children;
30521
+ }
30522
+ return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
30514
30523
  }
30515
- function setNodeChildren(node, children) {
30516
- nodeChildren.set(node, children);
30524
+ function setNodeChildren(node, sourceFile, children) {
30525
+ if (node.kind === 352 /* SyntaxList */) {
30526
+ Debug.fail("Should not need to re-set the children of a SyntaxList.");
30527
+ }
30528
+ let map2 = sourceFileToNodeChildren.get(sourceFile);
30529
+ if (map2 === void 0) {
30530
+ map2 = /* @__PURE__ */ new WeakMap();
30531
+ sourceFileToNodeChildren.set(sourceFile, map2);
30532
+ }
30533
+ map2.set(node, children);
30517
30534
  return children;
30518
30535
  }
30519
- function unsetNodeChildren(node) {
30520
- nodeChildren.delete(node);
30536
+ function unsetNodeChildren(node, origSourceFile) {
30537
+ var _a;
30538
+ if (node.kind === 352 /* SyntaxList */) {
30539
+ Debug.fail("Did not expect to unset the children of a SyntaxList.");
30540
+ }
30541
+ (_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
30542
+ }
30543
+ function transferSourceFileChildren(sourceFile, targetSourceFile) {
30544
+ const map2 = sourceFileToNodeChildren.get(sourceFile);
30545
+ if (map2 !== void 0) {
30546
+ sourceFileToNodeChildren.delete(sourceFile);
30547
+ sourceFileToNodeChildren.set(targetSourceFile, map2);
30548
+ }
30521
30549
  }
30522
30550
 
30523
30551
  // src/compiler/factory/utilities.ts
@@ -39126,6 +39154,7 @@ var IncrementalParser;
39126
39154
  aggressiveChecks
39127
39155
  );
39128
39156
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
39157
+ transferSourceFileChildren(sourceFile, result);
39129
39158
  return result;
39130
39159
  }
39131
39160
  IncrementalParser2.updateSourceFile = updateSourceFile2;
@@ -39161,7 +39190,7 @@ var IncrementalParser;
39161
39190
  }
39162
39191
  }
39163
39192
  }
39164
- function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
39193
+ function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
39165
39194
  if (isArray2) {
39166
39195
  visitArray2(element);
39167
39196
  } else {
@@ -39173,7 +39202,7 @@ var IncrementalParser;
39173
39202
  if (aggressiveChecks && shouldCheckNode(node)) {
39174
39203
  text = oldText.substring(node.pos, node.end);
39175
39204
  }
39176
- unsetNodeChildren(node);
39205
+ unsetNodeChildren(node, origSourceFile);
39177
39206
  setTextRangePosEnd(node, node.pos + delta, node.end + delta);
39178
39207
  if (aggressiveChecks && shouldCheckNode(node)) {
39179
39208
  Debug.assert(text === newText.substring(node.pos, node.end));
@@ -39247,6 +39276,7 @@ var IncrementalParser;
39247
39276
  if (child.pos > changeRangeOldEnd) {
39248
39277
  moveElementEntirelyPastChangeRange(
39249
39278
  child,
39279
+ sourceFile,
39250
39280
  /*isArray*/
39251
39281
  false,
39252
39282
  delta,
@@ -39259,7 +39289,7 @@ var IncrementalParser;
39259
39289
  const fullEnd = child.end;
39260
39290
  if (fullEnd >= changeStart) {
39261
39291
  markAsIntersectingIncrementalChange(child);
39262
- unsetNodeChildren(child);
39292
+ unsetNodeChildren(child, sourceFile);
39263
39293
  adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
39264
39294
  forEachChild(child, visitNode3, visitArray2);
39265
39295
  if (hasJSDocNodes(child)) {
@@ -39277,6 +39307,7 @@ var IncrementalParser;
39277
39307
  if (array.pos > changeRangeOldEnd) {
39278
39308
  moveElementEntirelyPastChangeRange(
39279
39309
  array,
39310
+ sourceFile,
39280
39311
  /*isArray*/
39281
39312
  true,
39282
39313
  delta,
@@ -56011,8 +56042,8 @@ function createTypeChecker(host) {
56011
56042
  const type = getReturnTypeOfSignature(signature);
56012
56043
  if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56013
56044
  const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
56014
- if (annotation) {
56015
- const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
56045
+ if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
56046
+ const result = tryReuseExistingTypeNodeHelper(context, annotation);
56016
56047
  if (result) {
56017
56048
  return result;
56018
56049
  }
@@ -148116,9 +148147,9 @@ var NodeObject = class {
148116
148147
  getChildAt(index, sourceFile) {
148117
148148
  return this.getChildren(sourceFile)[index];
148118
148149
  }
148119
- getChildren(sourceFile) {
148150
+ getChildren(sourceFile = getSourceFileOfNode(this)) {
148120
148151
  this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
148121
- return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
148152
+ return getNodeChildren(this, sourceFile) ?? setNodeChildren(this, sourceFile, createChildren(this, sourceFile));
148122
148153
  }
148123
148154
  getFirstToken(sourceFile) {
148124
148155
  this.assertHasRealPosition();
@@ -148199,7 +148230,7 @@ function createSyntaxList(nodes, parent2) {
148199
148230
  pos = node.end;
148200
148231
  }
148201
148232
  addSyntheticNodes(children, pos, nodes.end, parent2);
148202
- setNodeChildren(list, children);
148233
+ list._children = children;
148203
148234
  return list;
148204
148235
  }
148205
148236
  var TokenOrIdentifierObject = class {
@@ -180571,6 +180602,7 @@ __export(ts_exports2, {
180571
180602
  trace: () => trace,
180572
180603
  tracing: () => tracing,
180573
180604
  tracingEnabled: () => tracingEnabled,
180605
+ transferSourceFileChildren: () => transferSourceFileChildren,
180574
180606
  transform: () => transform,
180575
180607
  transformClassFields: () => transformClassFields,
180576
180608
  transformDeclarations: () => transformDeclarations,
@@ -194946,6 +194978,7 @@ if (typeof console !== "undefined") {
194946
194978
  trace,
194947
194979
  tracing,
194948
194980
  tracingEnabled,
194981
+ transferSourceFileChildren,
194949
194982
  transform,
194950
194983
  transformClassFields,
194951
194984
  transformDeclarations,
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-59170-7",
5
+ "version": "5.6.0-pr-59154-17",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [