c5b990d0e6c793d660c146be78952f62db1851dce7558156e323146f443f677bbff20f74f654bd5c8421686bacd5fe1ad7af1c97a4f8b3b9e52beff14f1753 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { GenMapping } from '@jridgewell/gen-mapping';
  2. import type { TraceMap } from '@jridgewell/trace-mapping';
  3. export declare type SourceMapSegmentObject = {
  4. column: number;
  5. line: number;
  6. name: string;
  7. source: string;
  8. content: string | null;
  9. ignore: boolean;
  10. };
  11. export declare type OriginalSource = {
  12. map: null;
  13. sources: Sources[];
  14. source: string;
  15. content: string | null;
  16. ignore: boolean;
  17. };
  18. export declare type MapSource = {
  19. map: TraceMap;
  20. sources: Sources[];
  21. source: string;
  22. content: null;
  23. ignore: false;
  24. };
  25. export declare type Sources = OriginalSource | MapSource;
  26. /**
  27. * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
  28. * (which may themselves be SourceMapTrees).
  29. */
  30. export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
  31. /**
  32. * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
  33. * segment tracing ends at the `OriginalSource`.
  34. */
  35. export declare function OriginalSource(source: string, content: string | null, ignore: boolean): OriginalSource;
  36. /**
  37. * traceMappings is only called on the root level SourceMapTree, and begins the process of
  38. * resolving each mapping in terms of the original source files.
  39. */
  40. export declare function traceMappings(tree: MapSource): GenMapping;
  41. /**
  42. * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
  43. * child SourceMapTrees, until we find the original source map.
  44. */
  45. export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;