@@ -20,6 +20,7 @@ import {
2020 REV_GENERATED_LINE ,
2121 REV_GENERATED_COLUMN ,
2222} from './sourcemap-segment' ;
23+ import { parse } from './types' ;
2324
2425import type { SourceMapSegment , ReverseSegment } from './sourcemap-segment' ;
2526import type {
@@ -38,6 +39,7 @@ import type {
3839 Bias ,
3940 XInput ,
4041 SectionedSourceMap ,
42+ Ro ,
4143} from './types' ;
4244import type { Source } from './by-source' ;
4345import type { MemoState } from './binary-search' ;
@@ -82,7 +84,7 @@ const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns st
8284export const LEAST_UPPER_BOUND = - 1 ;
8385export const GREATEST_LOWER_BOUND = 1 ;
8486
85- export { FlattenMap , FlattenMap as AnyMap } from './any -map' ;
87+ export { FlattenMap , FlattenMap as AnyMap } from './flatten -map' ;
8688
8789export class TraceMap implements SourceMap {
8890 declare version : SourceMapV3 [ 'version' ] ;
@@ -102,12 +104,11 @@ export class TraceMap implements SourceMap {
102104 private declare _bySources : Source [ ] | undefined ;
103105 private declare _bySourceMemos : MemoState [ ] | undefined ;
104106
105- constructor ( map : SourceMapInput , mapUrl ?: string | null ) {
107+ constructor ( map : Ro < SourceMapInput > , mapUrl ?: string | null ) {
106108 const isString = typeof map === 'string' ;
107-
108109 if ( ! isString && ( map as unknown as { _decodedMemo : any } ) . _decodedMemo ) return map as TraceMap ;
109110
110- const parsed = ( isString ? JSON . parse ( map ) : map ) as DecodedSourceMap | EncodedSourceMap ;
111+ const parsed = parse ( map as Exclude < SourceMapInput , TraceMap > ) ;
111112
112113 const { version, file, names, sourceRoot, sources, sourcesContent } = parsed ;
113114 this . version = version ;
0 commit comments