選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

source-map.d.ts 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. export interface StartOfSourceMap {
  2. file?: string;
  3. sourceRoot?: string;
  4. }
  5. export interface RawSourceMap extends StartOfSourceMap {
  6. version: string;
  7. sources: string[];
  8. names: string[];
  9. sourcesContent?: string[];
  10. mappings: string;
  11. }
  12. export interface Position {
  13. line: number;
  14. column: number;
  15. }
  16. export interface LineRange extends Position {
  17. lastColumn: number;
  18. }
  19. export interface FindPosition extends Position {
  20. // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
  21. bias?: number;
  22. }
  23. export interface SourceFindPosition extends FindPosition {
  24. source: string;
  25. }
  26. export interface MappedPosition extends Position {
  27. source: string;
  28. name?: string;
  29. }
  30. export interface MappingItem {
  31. source: string;
  32. generatedLine: number;
  33. generatedColumn: number;
  34. originalLine: number;
  35. originalColumn: number;
  36. name: string;
  37. }
  38. export class SourceMapConsumer {
  39. static GENERATED_ORDER: number;
  40. static ORIGINAL_ORDER: number;
  41. static GREATEST_LOWER_BOUND: number;
  42. static LEAST_UPPER_BOUND: number;
  43. constructor(rawSourceMap: RawSourceMap);
  44. computeColumnSpans(): void;
  45. originalPositionFor(generatedPosition: FindPosition): MappedPosition;
  46. generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
  47. allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
  48. hasContentsOfAllSources(): boolean;
  49. sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
  50. eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
  51. }
  52. export interface Mapping {
  53. generated: Position;
  54. original: Position;
  55. source: string;
  56. name?: string;
  57. }
  58. export class SourceMapGenerator {
  59. constructor(startOfSourceMap?: StartOfSourceMap);
  60. static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
  61. addMapping(mapping: Mapping): void;
  62. setSourceContent(sourceFile: string, sourceContent: string): void;
  63. applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
  64. toString(): string;
  65. }
  66. export interface CodeWithSourceMap {
  67. code: string;
  68. map: SourceMapGenerator;
  69. }
  70. export class SourceNode {
  71. constructor();
  72. constructor(line: number, column: number, source: string);
  73. constructor(line: number, column: number, source: string, chunk?: string, name?: string);
  74. static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
  75. add(chunk: string): void;
  76. prepend(chunk: string): void;
  77. setSourceContent(sourceFile: string, sourceContent: string): void;
  78. walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
  79. walkSourceContents(fn: (file: string, content: string) => void): void;
  80. join(sep: string): SourceNode;
  81. replaceRight(pattern: string, replacement: string): SourceNode;
  82. toString(): string;
  83. toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
  84. }