How to use the source-map-resolve.resolveSync function in source-map-resolve

To help you get started, we’ve selected a few source-map-resolve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wheeyls / critical-css-server / node_modules / css / lib / stringify / source-map-support.js View on Github external
Object.keys(this.files).forEach(function(file) {
    var content = this.files[file];
    this.map.setSourceContent(file, content);

    if (this.options.inputSourcemaps !== false) {
      var originalMap = sourceMapResolve.resolveSync(
        content, file, fs.readFileSync);
      if (originalMap) {
        var map = new SourceMapConsumer(originalMap.map);
        var relativeTo = originalMap.sourcesRelativeTo;
        this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
      }
    }
  }, this);
};
github MortenHoustonLudvigsen / KarmaTestAdapter / JsTestAdapter / TestServer / SourceUtils.ts View on Github external
private getSourceMapConsumer(filePath: string): SourceMap.SourceMapConsumer {
        if (filePath in this.sourceMapConsumers) {
            return this.sourceMapConsumers[filePath];
        }
        try {
            var content = fs.readFileSync(filePath).toString();
            var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
            var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
            if (consumer) {
                consumer['resolvePath'] = (filePath: string) => path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath);
            }
            this.sourceMapConsumers[filePath] = consumer;
            return consumer;
        } catch (e) {
            this.sourceMapConsumers[filePath] = undefined;
        }
    }
github liquidg3 / altair / node_modules / css-parse / node_modules / css / lib / stringify / source-map-support.js View on Github external
Object.keys(this.files).forEach(function(file) {
    var content = this.files[file];
    this.map.setSourceContent(file, content);

    if (this.options.inputSourcemaps !== false) {
      var originalMap = sourceMapResolve.resolveSync(
        content, file, fs.readFileSync);
      if (originalMap) {
        var map = new SourceMapConsumer(originalMap.map);
        var relativeTo = originalMap.sourcesRelativeTo;
        this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
      }
    }
  }, this);
};
github reworkcss / css-stringify / lib / source-map-support.js View on Github external
Object.keys(this.files).forEach(function(file) {
    var originalMap = sourceMapResolve.resolveSync(
      this.files[file], file, fs.readFileSync);
    if (originalMap) {
      originalMap = new SourceMapConsumer(originalMap.map);
      this.map.applySourceMap(originalMap, file);
    }
  }, this);
};
github rhiokim / haroopad / src / node_modules / css / lib / stringify / source-map-support.js View on Github external
Object.keys(this.files).forEach(function(file) {
    var content = this.files[file];
    this.map.setSourceContent(file, content);

    if (this.options.inputSourcemaps !== false) {
      var originalMap = sourceMapResolve.resolveSync(
        content, file, fs.readFileSync);
      if (originalMap) {
        var map = new SourceMapConsumer(originalMap.map);
        var relativeTo = originalMap.sourcesRelativeTo;
        this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
      }
    }
  }, this);
};
github MortenHoustonLudvigsen / KarmaTestAdapter / KarmaTestAdapter / TestServer / SourceUtils.js View on Github external
SourceUtils.prototype.getSourceMapConsumer = function (filePath) {
        if (filePath in this.sourceMapConsumers) {
            return this.sourceMapConsumers[filePath];
        }
        try {
            var content = fs.readFileSync(filePath).toString();
            var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
            var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
            if (consumer) {
                consumer['resolvePath'] = function (filePath) { return path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath); };
            }
            this.sourceMapConsumers[filePath] = consumer;
            return consumer;
        }
        catch (e) {
            this.sourceMapConsumers[filePath] = undefined;
        }
    };
    SourceUtils.prototype.resolveSource = function (source) {
github here-be / snapdragon / lib / source-maps.js View on Github external
Object.keys(this.files).forEach(function(file) {
    var content = this.files[file];
    this.map.setSourceContent(file, content);

    if (this.options.inputSourcemaps === true) {
      var originalMap = sourceMapResolve.resolveSync(content, file, fs.readFileSync);
      if (originalMap) {
        var map = new SourceMap.SourceMapConsumer(originalMap.map);
        var relativeTo = originalMap.sourcesRelativeTo;
        this.map.applySourceMap(map, file, unixify(path.dirname(relativeTo)));
      }
    }
  }, this);
};
github MortenHoustonLudvigsen / KarmaTestAdapter / KarmaTestAdapterTests / TestServer / SourceUtils.js View on Github external
SourceUtils.prototype.getSourceMapConsumer = function (filePath) {
        if (filePath in this.sourceMapConsumers) {
            return this.sourceMapConsumers[filePath];
        }
        try {
            var content = fs.readFileSync(filePath).toString();
            var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
            var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
            if (consumer) {
                consumer['resolvePath'] = function (filePath) { return path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath); };
            }
            this.sourceMapConsumers[filePath] = consumer;
            return consumer;
        }
        catch (e) {
            this.sourceMapConsumers[filePath] = undefined;
        }
    };
    SourceUtils.prototype.resolveSource = function (source) {

source-map-resolve

Resolve the source map and/or sources for a generated file.

MIT
Latest version published 5 years ago

Package Health Score

55 / 100
Full package analysis