-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (25 loc) · 863 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { SourceMap } = require("./binding")
const ensureMap = (map) => {
return map && typeof map === "object" ? JSON.stringify(map) : map
}
class SpeedySourceMap extends SourceMap {
toMap() {
return JSON.parse(super.toString())
}
toComment() {
return '//# sourceMappingURL=' + super.toUrl()
}
static mergeMaps(vlqMaps) {
const instance = SourceMap.mergeMaps(vlqMaps.map(map => ensureMap(map)))
Object.defineProperty(instance, "toMap", {
value: SpeedySourceMap.prototype.toMap.bind(instance)
})
Object.defineProperty(instance, "toComment", {
value: SpeedySourceMap.prototype.toComment.bind(instance)
})
return instance
}
}
module.exports = SpeedySourceMap;
module.exports.default = SpeedySourceMap;
module.exports.SourceMap = SpeedySourceMap;