How to use the fromSource function from convert-source-map

Find comprehensive JavaScript convert-source-map.fromSource code examples handpicked from public code repositorys.

46
47
48
49
50
51
52
53
54
55
const rawSource = this.sources.source || await readFile(this.path, 'utf8')
this.rawSourceMap = this.sources.sourceMap ||
  // if we find a source-map (either inline, or a .map file) we load
  // both the transpiled and original source, both of which are used during
  // the backflips we perform to remap absolute to relative positions.
  convertSourceMap.fromSource(rawSource) || convertSourceMap.fromMapFileSource(rawSource, dirname(this.path))

if (this.rawSourceMap) {
  if (this.rawSourceMap.sourcemap.sources.length > 1) {
    this.sourceMap = new TraceMap(this.rawSourceMap.sourcemap)
fork icon1
star icon2
watch icon1

42
43
44
45
46
47
48
49
50
51
    output.end(buf);
    return;
}

if (opts.sourceMap) {
    inputMap = convertSourceMap.fromSource(body);
    if (inputMap) inputMap = inputMap.toObject();
    body = convertSourceMap.removeComments(body);
    sourcemapper = new MagicString(body);
}
fork icon0
star icon0
watch icon1