@typescript-deploys/pr-build 5.2.0-pr-55267-2 → 5.2.0-pr-55267-8

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
@@ -138396,7 +138396,7 @@ registerRefactor(refactorNameForMoveToFile, {
138396
138396
  if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
138397
138397
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
138398
138398
  }
138399
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
138399
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
138400
138400
  return { edits, renameFilename: void 0, renameLocation: void 0 };
138401
138401
  }
138402
138402
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
@@ -139032,25 +139032,25 @@ function getRangeToMove(context) {
139032
139032
  const { file } = context;
139033
139033
  const range = createTextRangeFromSpan(getRefactorContextSpan(context));
139034
139034
  const { statements } = file;
139035
- const startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
139035
+ let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
139036
139036
  if (startNodeIndex === -1)
139037
139037
  return void 0;
139038
139038
  const startStatement = statements[startNodeIndex];
139039
- if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
139040
- return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
139041
- }
139042
139039
  const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
139043
139040
  if (overloadRangeToMove) {
139044
- return overloadRangeToMove;
139041
+ startNodeIndex = overloadRangeToMove.start;
139042
+ }
139043
+ let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
139044
+ if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
139045
+ endNodeIndex--;
139046
+ }
139047
+ const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
139048
+ if (endingOverloadRangeToMove) {
139049
+ endNodeIndex = endingOverloadRangeToMove.end;
139045
139050
  }
139046
- if (range.pos > startStatement.getStart(file))
139047
- return void 0;
139048
- const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
139049
- if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
139050
- return void 0;
139051
139051
  return {
139052
- toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex),
139053
- afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
139052
+ toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
139053
+ afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
139054
139054
  };
139055
139055
  }
139056
139056
  function getStatementsToMove(context) {
@@ -139305,10 +139305,12 @@ function getOverloadRangeToMove(sourceFile, statement) {
139305
139305
  if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
139306
139306
  return void 0;
139307
139307
  }
139308
+ const firstDecl = declarations[0];
139308
139309
  const lastDecl = declarations[length(declarations) - 1];
139309
139310
  const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
139310
- const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
139311
- return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
139311
+ const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
139312
+ const start2 = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
139313
+ return { toMove: statementsToMove, start: start2, end };
139312
139314
  }
139313
139315
  return void 0;
139314
139316
  }
@@ -137403,25 +137403,25 @@ ${lanes.join("\n")}
137403
137403
  const { file } = context;
137404
137404
  const range = createTextRangeFromSpan(getRefactorContextSpan(context));
137405
137405
  const { statements } = file;
137406
- const startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
137406
+ let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
137407
137407
  if (startNodeIndex === -1)
137408
137408
  return void 0;
137409
137409
  const startStatement = statements[startNodeIndex];
137410
- if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
137411
- return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
137412
- }
137413
137410
  const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
137414
137411
  if (overloadRangeToMove) {
137415
- return overloadRangeToMove;
137412
+ startNodeIndex = overloadRangeToMove.start;
137413
+ }
137414
+ let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
137415
+ if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
137416
+ endNodeIndex--;
137417
+ }
137418
+ const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
137419
+ if (endingOverloadRangeToMove) {
137420
+ endNodeIndex = endingOverloadRangeToMove.end;
137416
137421
  }
137417
- if (range.pos > startStatement.getStart(file))
137418
- return void 0;
137419
- const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
137420
- if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
137421
- return void 0;
137422
137422
  return {
137423
- toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex),
137424
- afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
137423
+ toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
137424
+ afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
137425
137425
  };
137426
137426
  }
137427
137427
  function getStatementsToMove(context) {
@@ -137676,10 +137676,12 @@ ${lanes.join("\n")}
137676
137676
  if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
137677
137677
  return void 0;
137678
137678
  }
137679
+ const firstDecl = declarations[0];
137679
137680
  const lastDecl = declarations[length(declarations) - 1];
137680
137681
  const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
137681
- const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
137682
- return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
137682
+ const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
137683
+ const start = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
137684
+ return { toMove: statementsToMove, start, end };
137683
137685
  }
137684
137686
  return void 0;
137685
137687
  }
@@ -137726,7 +137728,7 @@ ${lanes.join("\n")}
137726
137728
  if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
137727
137729
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
137728
137730
  }
137729
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
137731
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
137730
137732
  return { edits, renameFilename: void 0, renameLocation: void 0 };
137731
137733
  }
137732
137734
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
package/lib/typescript.js CHANGED
@@ -137418,25 +137418,25 @@ ${lanes.join("\n")}
137418
137418
  const { file } = context;
137419
137419
  const range = createTextRangeFromSpan(getRefactorContextSpan(context));
137420
137420
  const { statements } = file;
137421
- const startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
137421
+ let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
137422
137422
  if (startNodeIndex === -1)
137423
137423
  return void 0;
137424
137424
  const startStatement = statements[startNodeIndex];
137425
- if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
137426
- return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
137427
- }
137428
137425
  const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
137429
137426
  if (overloadRangeToMove) {
137430
- return overloadRangeToMove;
137427
+ startNodeIndex = overloadRangeToMove.start;
137428
+ }
137429
+ let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
137430
+ if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
137431
+ endNodeIndex--;
137432
+ }
137433
+ const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
137434
+ if (endingOverloadRangeToMove) {
137435
+ endNodeIndex = endingOverloadRangeToMove.end;
137431
137436
  }
137432
- if (range.pos > startStatement.getStart(file))
137433
- return void 0;
137434
- const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
137435
- if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
137436
- return void 0;
137437
137437
  return {
137438
- toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex),
137439
- afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
137438
+ toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
137439
+ afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
137440
137440
  };
137441
137441
  }
137442
137442
  function getStatementsToMove(context) {
@@ -137691,10 +137691,12 @@ ${lanes.join("\n")}
137691
137691
  if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
137692
137692
  return void 0;
137693
137693
  }
137694
+ const firstDecl = declarations[0];
137694
137695
  const lastDecl = declarations[length(declarations) - 1];
137695
137696
  const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
137696
- const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
137697
- return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
137697
+ const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
137698
+ const start = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
137699
+ return { toMove: statementsToMove, start, end };
137698
137700
  }
137699
137701
  return void 0;
137700
137702
  }
@@ -137741,7 +137743,7 @@ ${lanes.join("\n")}
137741
137743
  if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
137742
137744
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
137743
137745
  }
137744
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
137746
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
137745
137747
  return { edits, renameFilename: void 0, renameLocation: void 0 };
137746
137748
  }
137747
137749
  return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
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.2.0-pr-55267-2",
5
+ "version": "5.2.0-pr-55267-8",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "288736dde18d1be30115fe9996c222aa98eaf2ac"
117
+ "gitHead": "352ff28197f0785e1fc1664f402e9bb1e2d350c8"
118
118
  }