MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / constructor

Method constructor

src/SourceMap.ts:95–120  ·  view source on GitHub ↗
(properties: DecodedSourceMap | (Omit<DecodedSourceMap, 'mappings'> & { mappings: string }))

Source from the content-addressed store, hash-verified

93 declare rangeMappings: string | undefined
94
95 constructor(properties: DecodedSourceMap | (Omit<DecodedSourceMap, 'mappings'> & { mappings: string })) {
96 this.version = 3
97 this.file = properties.file
98 this.sources = properties.sources
99 this.sourcesContent = properties.sourcesContent
100 this.names = properties.names
101 this.mappings = typeof properties.mappings === 'string' ? properties.mappings : encode(properties.mappings)
102 if (typeof properties.x_google_ignoreList !== 'undefined') {
103 this.x_google_ignoreList = properties.x_google_ignoreList
104 }
105 if (typeof properties.debugId !== 'undefined') {
106 this.debugId = properties.debugId
107 }
108 if (typeof properties.rangeMappings !== 'undefined') {
109 let shouldOutputRangeMapping = false
110 for (const line of properties.rangeMappings) {
111 if (line.length !== 0) {
112 shouldOutputRangeMapping = true
113 break
114 }
115 }
116 if (shouldOutputRangeMapping) {
117 this.rangeMappings = encodeRangeMappings(properties.rangeMappings)
118 }
119 }
120 }
121
122 /**
123 * Returns the equivalent of `JSON.stringify(map)`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected