@typescript/native-preview 7.0.0-dev.20260623.1 → 7.0.0-dev.20260626.1

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.
Files changed (45) hide show
  1. package/dist/api/async/api.d.ts +99 -10
  2. package/dist/api/async/api.d.ts.map +1 -1
  3. package/dist/api/async/api.js +386 -49
  4. package/dist/api/async/api.js.map +1 -1
  5. package/dist/api/async/types.d.ts +48 -3
  6. package/dist/api/async/types.d.ts.map +1 -1
  7. package/dist/api/node/node.d.ts +8 -0
  8. package/dist/api/node/node.d.ts.map +1 -1
  9. package/dist/api/node/node.generated.d.ts +8 -0
  10. package/dist/api/node/node.generated.d.ts.map +1 -1
  11. package/dist/api/node/node.generated.js +26 -1
  12. package/dist/api/node/node.generated.js.map +1 -1
  13. package/dist/api/node/node.js +44 -6
  14. package/dist/api/node/node.js.map +1 -1
  15. package/dist/api/proto.d.ts +36 -1
  16. package/dist/api/proto.d.ts.map +1 -1
  17. package/dist/api/proto.js +15 -0
  18. package/dist/api/proto.js.map +1 -1
  19. package/dist/api/sync/api.d.ts +99 -10
  20. package/dist/api/sync/api.d.ts.map +1 -1
  21. package/dist/api/sync/api.js +386 -49
  22. package/dist/api/sync/api.js.map +1 -1
  23. package/dist/api/sync/types.d.ts +48 -3
  24. package/dist/api/sync/types.d.ts.map +1 -1
  25. package/dist/ast/ast.d.ts +8 -0
  26. package/dist/ast/ast.d.ts.map +1 -1
  27. package/dist/ast/factory.generated.d.ts +8 -0
  28. package/dist/ast/factory.generated.d.ts.map +1 -1
  29. package/dist/ast/factory.generated.js +36 -2
  30. package/dist/ast/factory.generated.js.map +1 -1
  31. package/dist/ast/is.generated.d.ts +2 -1
  32. package/dist/ast/is.generated.d.ts.map +1 -1
  33. package/dist/ast/is.generated.js +3 -0
  34. package/dist/ast/is.generated.js.map +1 -1
  35. package/dist/ast/utils.d.ts +2 -0
  36. package/dist/ast/utils.d.ts.map +1 -1
  37. package/dist/ast/utils.js +20 -0
  38. package/dist/ast/utils.js.map +1 -1
  39. package/lib/version.cjs +3 -0
  40. package/lib/version.d.cts +2 -0
  41. package/package.json +14 -12
  42. package/dist/api/objectRegistry.d.ts +0 -40
  43. package/dist/api/objectRegistry.d.ts.map +0 -1
  44. package/dist/api/objectRegistry.js +0 -61
  45. package/dist/api/objectRegistry.js.map +0 -1
@@ -2,6 +2,8 @@
2
2
  import { NodeFlags } from "#enums/nodeFlags";
3
3
  import { SyntaxKind } from "#enums/syntaxKind";
4
4
  import { TokenFlags } from "#enums/tokenFlags";
5
+ import { getTokenPosOfNode } from "./astnav.js";
6
+ import { cloneSourceFileData } from "./utils.js";
5
7
  import { forEachChildOfJSDocParameterTag, forEachChildOfJSDocPropertyTag, } from "./visitor.js";
6
8
  export class NodeObject {
7
9
  kind;
@@ -405,6 +407,31 @@ export class NodeObject {
405
407
  node = node.parent;
406
408
  return node;
407
409
  }
410
+ getStart(sourceFile, includeJsDocComment) {
411
+ return getTokenPosOfNode(this, sourceFile ?? this.getSourceFile(), includeJsDocComment);
412
+ }
413
+ getFullStart() {
414
+ return this.pos;
415
+ }
416
+ getEnd() {
417
+ return this.end;
418
+ }
419
+ getWidth(sourceFile) {
420
+ return this.getEnd() - this.getStart(sourceFile);
421
+ }
422
+ getFullWidth() {
423
+ return this.end - this.pos;
424
+ }
425
+ getLeadingTriviaWidth(sourceFile) {
426
+ return this.getStart(sourceFile) - this.pos;
427
+ }
428
+ getFullText(sourceFile) {
429
+ return (sourceFile ?? this.getSourceFile()).text.substring(this.pos, this.end);
430
+ }
431
+ getText(sourceFile) {
432
+ sourceFile ??= this.getSourceFile();
433
+ return sourceFile.text.substring(this.getStart(sourceFile), this.end);
434
+ }
408
435
  }
409
436
  function isNodeArray(array) {
410
437
  return "pos" in array && "end" in array;
@@ -795,7 +822,7 @@ function cloneNodeData(node) {
795
822
  case SyntaxKind.JSDocPropertyTag:
796
823
  return { tagName: n.tagName, name: n.name, isBracketed: n.isBracketed, typeExpression: n.typeExpression, isNameFirst: n.isNameFirst, comment: n.comment };
797
824
  case SyntaxKind.SourceFile:
798
- return { statements: n.statements, endOfFileToken: n.endOfFileToken, text: n.text, fileName: n.fileName, path: n.path };
825
+ return cloneSourceFileData(n);
799
826
  default:
800
827
  return undefined;
801
828
  }
@@ -3015,9 +3042,16 @@ export function createSourceFile(statements, endOfFileToken, text, fileName, pat
3015
3042
  path,
3016
3043
  });
3017
3044
  }
3045
+ function cloneSourceFileWithChanges(source, statements, endOfFileToken) {
3046
+ return new NodeObject(SyntaxKind.SourceFile, {
3047
+ ...cloneSourceFileData(source),
3048
+ statements: createNodeArray(statements),
3049
+ endOfFileToken,
3050
+ });
3051
+ }
3018
3052
  export function updateSourceFile(node, statements, endOfFileToken) {
3019
3053
  return node.statements !== statements || node.endOfFileToken !== endOfFileToken
3020
- ? createSourceFile(statements, endOfFileToken, node.text, node.fileName, node.path)
3054
+ ? cloneSourceFileWithChanges(node, statements, endOfFileToken)
3021
3055
  : node;
3022
3056
  }
3023
3057
  //# sourceMappingURL=factory.generated.js.map